Machine Learning For Absolute Beginners

In this blog, we will talk about Machine Learning, and types of Machine Learning.

Let’s start with the Machine Learning, We human are too lazy, we don’t want to do work, so we come up with the solution and we transfer our work to machine. And we have seen that machine have done it quite well with accuracy and speed. But machine do what we tell to do, that is what human needed much so far. But we are not satisfied with work because machine don’t have intelligence. So, machine can not do intelligent work. We can not tell machine to work intelligently because machine don’t understand the term intelligent So, First we have to define the term intelligent then we can transfer the work to machine that need intelligence. that’s a problem human can not be able transfer intelligent work to machine without defining the term intelligent to machine i.e what kind of intelligence is involved in particular work.

What is intelligence?

First we will understand the term intelligence, what does intelligence means, we human take information from the surrounding environment using five sense and process that information in mind and then trying to interpret this information to make some rules. On the basis of these rules, we make decision when we get into similar environment. If we make wrong decision then people will definitely say that you are not doing your work intelligently. Actually you didn’t process the information correctly and as a result your rules may be not good to make a decision. Suppose if there is raining, what will happened before raining, there is cloudy weather, humidity is 20, air pressure is 5, because of these reason it is raining now. And we make the rule i.e if weather cloudy equals to true, air pressure > 5 and humidity > 20 then it will rain. If next day it is not raining but conditions are humidity = 30, air pressure = 6 and weather is cloudy. But accordingly to the rule it should be raining. What happened? May be this rule is not good enough to make decision, may be we didn’t process the information correctly and may be we miss some other factors that is necessary to make a decision that should be any other factor. We have to find that factor and get the information and make rule in considering additional factor also. So that our error should be become neglectable.

Read More »

Puppet Configuration on Azure VM (Part-I)

In this blog, I will deploy the Puppet on Azure virtual machine. First thing you have to do is take a look on my this blog to know, how to create a virtual on Azure using command line. And then If Puppet is new for you, read my this blog first.


Create a virtual machine for Puppet master using following command:

az vm create --resource-group halcyoona-group --name master --image UbuntuLTS --generate-ssh-keys --output json --verbose

you will get this output:

Use existing SSH public key file: /home/halcyoona/.ssh/id_rsa.pub
{- Finished ..
  "fqdns": "",
  "id": "/subscriptions/95623de4-e1df-4c06-9954-bd66314b4bd0/resourceGroups/halcyoona-group/providers/Microsoft.Compute/virtualMachines/master",
  "location": "eastus",
  "macAddress": "00-22-48-20-91-D8",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.5",
  "publicIpAddress": "13.72.73.153",
  "resourceGroup": "halcyoona-group",
  "zones": ""
}

Now using publicIpAddress, ssh into your master using below command:

ssh halcyoona@13.72.73.153

Now add the repository of the Puppet.

wget https://apt.puppetlabs.com/puppet6-release-bionic.deb
sudo dpkg -i puppet6-release-bionic.deb
sudo apt update

Now install the Puppet Server in the Puppet master virtual machine:

sudo apt-get install puppetserver

Now we create our own CA with uisng following command:

/opt/puppetlabs/bin/puppetserver ca setup

Output:

Read More »

Establish Connection between MySQL and Apache in a Containerized Web Application

This blog is the continuation of the previous blog of build a Containerized Web Application on Azure (Click here to read the previous blog) . In this blog, we will establish a connection between mysql-container and apache-container.

Now watch those containers with this command:

watch 'sudo docker ps -a'

If mysql-container stops then restart it using following command:

sudo docker start mysql-container

Open the mysql-container shell using the following command and check the status of the mySQL service.

sudo docker exec -it mysql-container bash
service mysql status

If MySQL service is not running then start it using the following command:

service mysql start

We have installed the network tools in the apache-container. Now install the network tools in the mysql-container.

apt install inetutils-ping net-tools -y

Checking Connection

Check network cards in the mysql-container.

ifconfig

And note down the IPaddress of the mysql-container and exit from this container and move to host machine. In my case, It is 172.17.0.2.

Read More »

Build a Containerized Web Application on Azure

In this blog, I am going to setup MySQL server in one container and apache2 in other container and If you are not familiar with Docker, read my this blog first(Click here to read the blog). Moreover, this all will be done on Azure virtual machine, If you are not familiar with Azure virtual machine, please read my this blog first to create the virtual machine on Azure(Click here to read the blog).

Setting Up Docker

To install Docker, use the following command:

sudo apt install docker.io

To start docker, command is given below:

sudo systemctl start docker

To start docker, when you start the ubuntu use this command:

sudo systemctl enable docker

To view current images, use the following command:

sudo docker images

To pull images, use the following command:

sudo docker pull ubuntu

Creating MySQL Container

We have already downloaded the ubuntu images. Now using this ubuntu image we will create the container and named it mysql-container. Because we are going to install MySQL database in it.

sudo docker run --name mysql-container -it ubuntu

Now you are in mysql-container, execute the following comand to set the environment and install the vim for editing.

apt update
apt install vim -y
exit

If you want to see which container in running on your host machine use this command:

Read More »

Flask Website Deployment using Docker Compose on Azure Cloud

In this blog, I will deploy FLASK app on nginx using Docker Compose. If you don’t have any idea how Docker Compose works, read my previous blog first (Click here to read the previous blog).
Before we move to work, I will give you brief intro the things which I am going to use. I created a virtual machine on Azure Cloud Platform. If you don’t know, how to create virtual machine on Azure, go to my this blog create virtual machine easily with few simple steps (Click here to read the blog).
After creating virtual machine just ssh into your machine using simple command.

ssh halcyoona@40.114.31.5

Installation

To install Docker the in your virtual machine, type the command in terminal and press enter:

sudo apt install docker.io
sudo apt install docker-compose

Create a directory with the name of your app, like I am creating my_flask_app.

mkdir my_flask_app
cd my_flask_app

In this floder create two more directory with the nginx and flask. Nginx is entry point of the app, where we get request and then we redirect those request to flask app.

mkdir flask
mkdir nginx

Flask App Setting

Now move into flask directory and create python virtual environment but first install package that is required to create the virtual environment i.e venv first then create virtual environment using following command:

cd flask
sudo apt install python3-venv
python3 -m venv env

Now activate the environment with the simple command:

soure env/bin/activate

And then install flask and uwsgi.

pip install flask uwsgi

flask package is used to create the applications.
uwsgi is a Web Server Gateway Interface used to communicate to nginx server.

Read More »

Creating VM on Azure Cloud using CLI, Creating a User and Running Task in Background

In this blog, I am going to show the process of installation of Azure CLI tool and then using this tool to create a ubuntu virtual machine and then accessing this virtual machine through ssh and then add one user and then adding their private key and running one job in their environment.

The first thing you need is the tools that are required. The first tool you required is Azure CLI . You can install Azure CLI simple using the following command:

sudo apt install azure-cli

To use the Azure CLI tool you need first to login into your account through terminal. For this purpose use following command:

az login

When you enter this you will be redirected to the browser, there you can enter your login detail. When you entered then you will get this type of message on your terminal.

You have logged in. Now let us find all the subscriptions to which you have access...
The following tenants require Multi-Factor Authentication (MFA). Use 'az login --tenant TENANT_ID' to explicitly login to a tenant.
b76df79f-0110-465c-90f3-07df4642315d
[
  {
    "cloudName": "AzureCloud",
    "homeTenantId": "4ea778976d-32bd-7f5f-aaa5-084cb61a0b0f",
    "id": "37623de4-e2df-4d06-8754-bd88314b4bd0",
    "isDefault": true,
    "managedByTenants": [],
    "name": "Azure for Students",
    "state": "Enabled",
    "tenantId": "5ea9899d-30bd-4f6f-aaa5-084cb61a0b0f",
    "user": {
      "name": "halcyoona@gmail.com",
      "type": "user"
    }
  }
]

Now you are logged in and you can use the Azure CLI tool to create resources from CLI.

az group create --name halcyoona-group --location eastus

When you execute above command you get following output:

{
  "id": "/subscriptions/95623de4-e1df-4c06-9954-bd66314b4bd0/resourceGroups/halcyoona-group",
  "location": "eastus",
  "managedBy": null,
  "name": "halcyoona-group",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null,
  "type": "Microsoft.Resources/resourceGroups"
}

In Azure, all resources are allocated in a resource management group. Resource groups provide logical groupings of resources that make them easier to work with as a collection.
You have to set the name of the resource and then location. Now the resource group is set then move to next creating a virtual machine with this resource.

From now We look forward to creating a virtual machine using the Azure CLI. Use following command to create virtual machine.

az vm create --resource-group halcyoona-group --name halcyoonaVM --image UbuntuLTS --generate-ssh-keys --output json --verbose

In this you have to set the name of the virtual machine. Second Image you want in your machine. Generate ssh key to access it without password using your private key and if you do not specify key name, it will create a key in ~/.ssh/id_rsa.pub by default. Output will be in json form.

Read More »

Journey to become a Microsoft Student Partner Beta member

In this blog, I will discuss my journey towards the Microsoft Student Partner program, But first I will discuss what Microsoft program is.

Microsoft Student Partners is a worldwide recognizable program to sponsor students majoring in disciplines related to technology. The MSP program enhances students’ employability by offering training in skills not usually taught in academia, including knowledge of Microsoft technologies.

The program is available in most countries, and all students in college and university level are eligible to apply. If accepted, Student Partners are assumed to further share the knowledge among the academic community by, for example, arranging courses, giving presentations and initiating projects.

First time when I came across to know what Microsoft Student Program is the year 2019 when Mr. Hanzala Maqsood(MSP Gold) arranged Inspiron session at my university(FAST NUCES, Peshawar). Then I become motivated and thinking for applying for MSP because MSP gives a lot of benefits to students as I am working on robotics so I need some platform to practice machine learning algorithms. in this regard, Azure suits me the best. Azure has a different platform and you will get hand-on sessions on these platforms. Although, MSP program gives a great mentorship to their MSPs and MSP get good experience as working with Microsoft team. But I don’t know how to fill that application then, Mr. Ali Muzahir(MSP Beta) comes to the rescue and help me out in filling that application and then I come to know MSP team is too supportive and collaborative.

On 10th Jan 2020, I got an email from Microsoft that I have been selected in the MSP program-2020 as Alpha I. But there is a question that why I am selected in the MSP program. Before applying for MSP, I have all the things needed in the MSP application. I have my digital portfolio on LinkedIn. I am managing my Github from the previous two years (click here to see my Github). I have also done a lot of workshops and presentations on different topics at my university and many more things. Actually, the thing is you have to make yourself ready for the opportunity and when the opportunity comes you grab it without wasting any time.

To achieve the Alpha-II level, I need to complete one learning path so I completed the learning path in two days i.e start working with C#. And then I promoted to Alpha-II. And now I want to become a Beta-level MSP. To achieve this, I need to conduct a workshop on any topic at any place. So, I with Mr. Hanzala Maqsood managed to arrange a workshop at Islamia University Peshawar to motivate the student to apply for the MSP program and become a part of the Microsoft team. And also do participate in the newly formed MSP society at their university. By reporting this event, I am promoted to the beta level.

Screenshot_2020-02-10 Student Partners Account Microsoft Student Partners

Now I am at beta and looking forward to becoming a gold member.

IA-32 Floating Point Unit

Introduction:

The Floating-Point Unit (FPU) provides high-performance floating-point processing capabilities for use in graphics processing, scientific, engineering, and business applications.

The FPU represents a separate execution environment within the IA-32 architecture. This execution environment consists of 8 data registers and following special purpose registers.

  • The status register
  • The counter register
  • The tag word register

Mechanism:

The FPU data register consists of eight 80-bits registers. Values are stored in these register in the double extended-precision floating point format. When floating-point, integer, or packed BCD integer values are loaded from memory into any of the FPU data registers, the values are automatically converted into the double extended-precision floating-point format (if they are not already in that format). When computation results are subsequently transferred back into memory from any of the FPU registers, the results can be left in the double extended-precision floating-point format or converted back into a shorter floating-point format, an integer format, or the packed BCD integer format.

The FPU instructions treat the eight FPU data register as a register stack.All addressing of the data registers is relative to the register on the top of the stack.

floatingstack.gif

The register number of the current top-of-stack register is stored in the TOP (stack TOP) field in the FPU status word. Load operations decrement TOP by one and load a value into the new top-of-stack register, and store operations store the value from the current TOP register in memory and then increment TOP by one. (For the FPU, a load operation is equivalent to a push and a store operation is equivalent to a pop.) Note that load and store operations are also available that do not push and pop the stack.

Read More »

PESTEL Analysis of Coca-Cola

PESTEL analysis of Coca-Cola is my assignment in my course mg-223(fundamental of management). After reading this blog you will be able to understand how multi-national companies grow and extend their business to different countries. In this blog, I am talking about the PESTEL analysis of Coca-Cola company.

The non-alcoholic beverages brand Coca-Cola operates in the global environment. The global environment subjects a corporation to several pressures. Today, the world market has grown highly globalized. Companies are doing business across large regions spanning several countries. In this highly globalized market, certain factors are of special significance that affects the businesses. Culture, politics, economic situation and even laws are some factors that affect businesses directly and indirectly. Coca-Cola also feels the pinch from time to time. Any change in the global business environment can impact its profits and revenues directly.

cocacola.jpeg

Coca-Cola despite being the leading brand in the beverages industry, is not immune to the various political, social or economic fluctuations. Political or economic changes can negatively impact its profits. There are laws and regulations which vary from country to country and affect it directly. Simultaneously, Cultural factors are of significance. The business of Coca-Cola is spread over more than 200 countries. Social and cultural factors acquire a special importance in that case. A PEST analysis of Coca-Cola will determine all these factors which can impact its business in the global environment.

Political:

The most important political factors which can have a direct impact on Coca-Cola are laws and government regulation of food products. For example in the US, the Food and Drug regulations apply to its business. Apart from it, these laws may vary from country to country. Coca-Cola and its products must conform to the relevant laws in the countries they are sold. (Coca-Cola is a maker of non-alcoholic beverages) However, apart from the food and beverages related regulations and the quality standards, the business is also subject to the common accounting or business regulations. Tax laws vary from country to country. The company has to follow the relevant laws in order to do business in a particular market. Changes to these laws can potentially impact Coca Cola’s profits and revenue. Any increase or decrease in tax rates can affect the profits of any corporation. Similarly, changes in the political situation of the countries like government changes or any political turmoil can potentially impact its business.

Read More »

Chef Introduction

In this blog, I will tell you about chef, component of chef needed for working and detail of chef working environment. In next blog, I will show you installation of chef and working of chef.

Intro

Chef-Logo.png

Chef is an automation tool that provides a way to define infrastructure as code. Infrastructure as code simply means that managing infrastructure by writing code rather than using manual processes. Configuration management is all about trying to ensure that the files and software you are expecting to be on a machine are present, configured correctly, and working as intended.
When you have only a single machine this is fairly simple. When you have five or ten servers, it is still possible to do this manually, but it may take all day. However, when your infrastructure scales up into the thousands we need a better way of doing things.
Chef uses a pure-Ruby, domain-specific language (DSL) for writing system configurations.
Below are the types of automation done by Chef, irrespective of the size of infrastructure:

  • Infrastructure configuration
  • Application deployment
  • Configurations are managed across your network

Read More »