Wednesday, 17 October 2018

OAuth 2.0 Authorization Process(Code Grant Flow)

Hello, as you already know, I'm Kindson The Genius and I'm here to help you understand tech concept very easily. You let me know what you would like to learn.

Today I would just outline the OAuth 2.0 Authorization Process, that is the steps and the flow diagram. No much details though.

Find more details here: What is OAuth and OpenID
Video explanation: Vidoe explanation


OAuth 2.0 Authorization Steps
Step 1: User visits a websit eg. kindsonthegenius.blogspot.com (App)
Step 2: App asks user for authentication though Facebook
Step 3: A consent screen is displayed to the user and user accepts to allow access
Step 4: IdP sends a code to the user (IdP stands for Identity Provider)
Step 5: User sends to code to the App via a redirect link
Step 6: App request for access token from the IdP using the code it has received
Step 7: The IdP checks the access code is valid and then send the access token to the App.
Step 8: App then requests access to restricted resources in the resource server by presenting its access token.
Step 9: Resource server checks with the IdP to make sure access token is valid and then grants access to the resources.

Notes
  • The flow may  have some variations depending on the particular implementation
  • The IdP is also known as the Authorization Server
  • The IdP and the Resource Server are sometimes in the same place.
Find more details here: What is OAuth and OpenID?
Video explanation: Vidoe explanation

Tuesday, 16 October 2018

What is OAuth? (An Introduction to OAuth and OpenID)

My name is Kindson and in this brief, lesson I would teach you the basics of OAuth 2.0 and OpenID. You will understand what they are and how they work very clearly.

You can watch the video explanation here

We would cover the following:
  1. What is OAuth?
  2. How OAuth Started
  3. OAuth Roles
  4. The OAuth Workflow
  5. Benefits of OAuth
  6. What is OpenID?


1.0 What is OAuth


OAuth is an open standard for authorization which is used for access delegation. This means that users of a web application can grant an application access to their information without having to give them the login credentials.
OAuth provides a secure delegated access to the user's information on behalf of the user.

2.0 Why OAuth was Introduced


Before OAuth 1.0 protocol was published in 2010 access delegation was achieve by providing the third party application with your the login credentials(username and password). This creates a security challenge as there is no control of what the third party application can do with these details. OAuth was created to address this issue.
So in 2010, the OAuth 1.0  protocol was published after a group of researcher have worked on it for about 4 years.



3.0 OAuth Roles and Terminology


Before we explain how it works, it is necessary to understand the roles associated with the OAuth architecture
Resource Owner: This is the user of the resource or the owner of the account the application is requesting to access.
Client: This is the application the requests access to restricted resources.
Authorization Server: Holds account information and used for authorisation.
Resource Server: Contains secure information that need token to access
Authorization Grant: The initial code sent to the requesting application initially. The is the same as the authorization code and is passed through the front channel(browser)
Redirect URI: This is the URI that the would be redirected to after the authorisation grant have been given to the application.
Access Token: The token that is sent to the application and can be used to access resources.



4.0 The OAuth Workflow


The OAuth workflow take the following steps to grant a delegated access to an application:



Step 1: The application request for authorization for access to some resource
Step 2: The authorization server creates and displays a consent screen to the user
Step 3: If the user consents to the request, then the authorization server sends an authorisation code (authorisation grant) back to the requesting application.
Step 4: The application then requests for an access token from the authorisation server using the authorisation code
Step 5: The authorisation server identifies the application and checks if the authentication code is valid. If it's valid, the server issues an access token to the application.
Step 6: The application can now access resources from using the access token
Step 7: If the access token is found valid, the resource server grants the resource to the application.
At this point the cycle is complete. The workflow is shown in Figure 1.



5.0 Benefits of OAuth 2.0


It provides a stronger security and easier to implement
It is an open standard
It is a very robust protocol that relies on SSL (Secure Socket Layer) making data very secure
Allows for expiration of authentication token which make resources more secure
Login credentials are not passed to the requesting application

6.0 What is OpenID


What then is OpenID?
Note that OAuth is a standard for authorisation. OpenID on the other hand is used for authentication to authenticate a single-sign on identity. It is created to be used for federated authentication. This means that a third party can be used to authenticate a user if the users already have some account.
While OAuth can be used for authentication too, that is not what it's designed for. OpenID does that.
There comes OpenID Connect(OIDC) which is an authentication protocol based on the OAuth 2.0 and serves an authentication layer on top of OAuth 2.0.

I hope these brief explanation clarifies the concept.
You can watch the video explanation here





Friday, 12 October 2018

ML.Net Tutorial 2: Building a Machine Learning Model for Classification

This is the Tutorial 2 ML.Net series of tutorials. These tutorials would help you understand and build machine learning models in .Net very easily if you are already a .Net developer.

If you are not a .Net Developer, you could check my tutorial in Machine Learning with TensorFlow using Python.




You could also learn Difference Between Machine Learning and Deep Learning. This tutorial follows from Tutorial 1  where you downloaded your dataset, setup the Visual studio solution and added the ML.Net package to the solution

Take the following steps to create your Machine Learning Model.



Understand the DataSet

Open the iris-data file and view the data. Note that each record is made up of five fields. The first four fields are the features while the last field is the class the iris belongs.
This means that based on the value of the features(SepalLength, SepalWidth, PetalLenght, PetalWidth) we could predict whether the iris belongs to one of the three classes(Iris-setosa, Iris-versicolor, Iris-virginica)
This scenario is a typical classification problem.



Step 1: Class Classes that map to the Dataset

In this step, you need to create the two classes that represents your dataset. The first class represents the features and the second class represents the class.
The codes for the two classes are given below. You will write this code in the Program.cs file.


        //STEP 1: Define your data structure. That is clases to hold the data
        public class IrisData
        {   
            [Column("0")]
            public float SepalLength;

            [Column("1")]
            public float SepalWidth;

            [Column("2")]
            public float PetalLength;

            [Column("3")]
            public float PetalWidth;

            [Column("4")]
            [ColumnName("Label")]
            public string Label;
        }
Listing 1.0: IrisData class maps to the features of the dataset

The second class shown below just has one attribute that maps the class name (the last field in the dataset)

        //IrisPrediction is the result returned prediction by the model
        public class IrisPrediction
        {
            [ColumnName("PredictedLabel")]
            public string PredictedLabels;
        }
Listing 1.1: Class to hold the prediction



Step 2: Create a Pipeline and Load the Data

What is a Pipeline? A pipeline is a set of classes in ML.Net that allows you to load external data, transform it to format suitable for training and train the model.
Use the code below to load the Iris data set.


      var pipeline = new LearningPipeline();
      string dataPath = "iris-data.txt";
      pipeline.Add(new TextLoader(dataPath).CreateFrom<IrisData>(separator: ','));
Listing 1.3: Create a pipeline and load your data.



Step 3: Transform the Data

Data needs to be transformed from string data to numeric data since training can only be carried out on numeric data. So the column labels are assigned numbers. This is achieved by using a Dictionarizer object
Next the we need to use a ColumnConcatenator to merge all the features into one single string as shown in Listing 1.4.


     pipeline.Add(new Dictionarizer("Label"));
     pipeline.Add(new ColumnConcatenator("Features", "SepalLength", "SepalWidth", "PetalLength", "PetalWidth"));
Listing 1.4: Transform the data



Step 4: Add a Learning Algorithm

Here we add a learning algorithm that can train a classification model. This algorithm is the StochasticDualCoordinateClassifier object.
Then we convert back the numeric label into the original text using PredictedLabelColumnOriginalValueConverter object.


     pipeline.Add(new StochasticDualCoordinateAscentClassifier());
     pipeline.Add(new PredictedLabelColumnOriginalValueConverter() { PredictedLabelColumn = "PredictedLabel" });
Listing 1.5: Add a learning algorithm and covert back



Step 5: Train the Model

In this step, we simple call the Train() method of the pipeline object to train our model. This is achieved by a single line of code shown in Listing 1.6.


     var model = pipeline.Train<IrisData, IrisPrediction>();
Listing 1.6: Train the model



Step 6: Use the Mode to Make Prediction

Now we can now test the model by passing new set of features and then allow the model to predict the class it belongs.
The code is given in Listing 1.7, but you can change the values to see what result you get.


        var prediction = model.Predict(new IrisData()
        {
            SepalLength = 0.3f,
            SepalWidth = 0.6f,
            PetalLength = 1.2f,
            PetalWidth = 1.1f
        });

        Console.WriteLine($"Pridicted flower class is : {prediction.PredictedLabels}");
        Console.Read();
Listing 1.7: Making prediction with the trained model

The output of this is shown in Figure 1.0


Figure 1.0: Final  Output



Final Notes

If you have come this far then be sure you now know the basics of How to Build a Machine Learning Mode using ML.Net.
This is really interesting for .net developers as you don't need to learn how to use other tools like TensorFlow in Jupyter notebook and the Python Language.
We continues with Tutorial 3.

Subscribe to the Kindson The Genius Video Channel so you get notified when new lessons are made.


Monday, 8 October 2018

Program to Display Fibonacci Numbers in Java

Fibonacci Numbers or Fibonacci Series is a set of numbers where the next number in the series is the sum of the preceding two numbers.
For example:
0, 1, 1, 2, 3, 5, 8, 13, 21 and so on.
Note that the first two numbers are set to 0 and 1

I am going to present two different programs  written in java to display the Fibonacci series:
1. Fibonacci Series program using for loop without recursion
2. Fibonacci Series program with recursion

Both are written and tested using Eclipse IDE which you can download  and install for free.

1. Fibonacci Number in Java without recursion

/* Program to Display Fibonacci Numbers
 * By: Kindson The Genius
 * Date: October 8, 2018
 * Usage: Free        */

public class Fibonacci {
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  //Fibonacci Numbers: 0, 1, 1, 2, 3, 5, 8, 13
  //n1, n2, n3 = n1 + n2..., 
  
  int n1 = 0;
  int n2 = 1;
  int n3 = 2;
  int count = 10;
  
  System.out.print(n1 + " " + n2);
  
  for(int i = 2; i<count; ++i)
  {
   n3 = n1 + n2;
   
   System.out.print(" " + n3);

   n1 = n2;
   n2 = n3;   
  }
 }
}

2. Fibonacci Numbers in Java with recursion

/* Program to Display Fibonacci Numbers with recursion
 * By: Kindson The Genius
 * Date: October 8, 2018
 * Usage: Free        */

public class FibonacciWithRecursion {
 
 static int n1 = 0;
 static int n2 = 1;
 static int n3 = 0;
 
 static void displayFibonacci(int count) {
  //Fibonacci Numbers: 0, 1, 1, 2, 3, 5, 8, 13
  if(count > 0) {
   n3 = n1 + n2;
   n1 = n2;
   n2 = n3;   
   System.out.print(" " + n3);
   displayFibonacci(count-1);
  }     
 }
 
 public static void main(String args[])
 {
  int count = 10;
  System.out.print(n1 + " " + n2); //display 0 and 1
  displayFibonacci(count-2); //begining from the 3rd number
 }
}

Feel free to copy this programs for free and run them to see how it works. You could change the value of the count to a larger number to view more numbers in the Fibonacci series.

Friday, 5 October 2018

Summary of the 10 Project Managment Process Group (So you don't forget)

If you are able to summarize the 10 Project Management Knowledge Areas fairly in your own words, then you will appreciate the much involved in project management.
In this brief article, we would briefly examine the key aspects of the 10 project management knowledge areas.


We would cover the following:


What is Project Management Knowledge Areas
1. Project Integration Management
2. Project Scope Management
3. Project Time Management
4. Project Cost Management
5. Project Quality Management
6. Project Human Resource Management
7. Project Communication Management
8. Project Risk Management
9. Project Procurement Management
10. Project Stakeholder Management
How to Memorize the 10 PM Knowledge


What are Project Management Knowledge Areas?


Project Management Knowledge Areas as sete of  guidelines and standard terminologies created by Project Management Institute (PMI) to serve as a guide for project management. This guidelines is published in the PMBOK Guide.
The project management knowledge areas are applied throughout the duration of the project during with life cycle of the project.  The knowledge areas is different from the 5 Process Groups which are like phases of a project.
For you to effectively manage a project, it is necessary to understand the key activities of each of the knowledge areas as presented below.

1. Project Integration Management


Project Integration Management is describe as the knowledge area that holds every other part of the project together. Aspects of the Project Integration Management include:
  • development of the project charter, which is the document that confirms the existence of the project
  • development of the project management plan
  • directing and managing the project work
  • change control carried out by the change control board (CCB)
  • closing of the project




Back to List of Processes

2. Project Scope Management


This is the knowledge area relating to what work needs to be done by the project. It answers the question: what is in the scope? and what is out of scope?
Aspects of the Project Scope Management include:
  • definition of the scope statement
  • the work breakdown structure (WBS)
  • validate scope, which makes sure the deliverables are approved
  • acceptance of the deliverables




Back to List of Processes

3. Project Time Management


Remember that a  project must have a set duration. The Time Management knowledge area ensures that the project is running according to a schedule. (Note the WBS relates the Scope Management and not Time Management!)
Aspect of the project time management include:
  • planning the schedule management
  • creating the schedule
  • arranging the tasks in order and dependencies such as FS, SS, FF and SF
  • estimation of the resources needed to complete the tasks
  • use of tools like Gantt chart
  • resource levelling to ensure resources are not under or over-utilized
  • earned value analysis to ensure project is proceeding as planned.




Back to List of Processes

4. Project Cost Management


The Project Cost Management relates with the project budget. This means making good estimates about how much funds is needed to cover the expenses of the project.
Aspects of Cost management include the following:
  • planning the cost management
  • establishing the project budget
  • setting the cost baselines
  • controlling the cost as the project progresses
  • amounts of project and management reserves are outlined
  • summing up the estimates

Back to List of Processes



5. Project Quality Management


In project management, quality means 'reaching the objectives or requirements of the project'. And quality management is very important because if the project succeeds in managing the time and the budget effectively, but fails to meet the quality requirements, then the project is considered failed.
Aspects of quality management include:
  • creation of the quality management plan
  • quality assurance (making sure quality standards are followed in the process)
  • quality control (checking that the deliverables meet the quality  standards)

Back to List of Processes



6. Project Human Resource Management


It could be said that the project team is the most important resource that is managed by a project manager. This makes sense because managing people is the key aspect of management. Human resource management has to  with obtaining the suitable and qualified members that would form the project team and then developing and managing them as the project progresses.
Aspects of the Human Resource Management include:
  • creating a human resource management plan
  • obtaining the project team either by in-house sourcing getting new hires
  • developing the team through training and team building activities
  • tracking the performance of the team members
  • resolving conflicts that may arise within the team


Back to List of Processes



7. Project Communication Management


The question always is: 'what percentage of the project manager's time is spent in communication? 50%, 60%, 70%, 80%, 90%?. Well the answer is 90%!
This highlights how important communication is in project management. It touches every aspect of the project.
Aspects of Communication Management include:
  • determining how communication in done (making the communication management plan)
  • reviewing effectiveness of communication methods

Back to List of Processes



8. Project Risk Management


Risk is defined as an uncertain event or condition that can occur during the project and can effect the outcome of the project. It could be positive(opportunities) or negative (threats).
Risk management involved identifying the risk that may occur in the course of the project and putting plan in place to handle them.
Aspects of Project Risk Management include:
  • creating the risk management plan
  • identifying the risk
  • creating a risk register with is a list of risks identified
  • performing qualitative and quantitative analysis of the risks identified(classifying them by likelihood and impact)
  • planning risk responses (what do when a risk actually occurs)
  • reviewing and updating the risk register




Back to List of Processes

9. Project Procurement Management


The procurement management has to do with purchasing needed materials from the outside. It may also include hiring of sub-contractors fort the project.
Aspects of procurement management include:
  • creating a procurement management plan
  • identifying resources that needs to be sourced from outside
  • identifying vendors
  • conducting the procurement, requesting proposals etc
  • managing and monitoring procurement activities
  • closing out contracts once work is completed




Back to List of Processes

10. Project Stakeholder Management


Stakeholders according the PMBOK guide are individuals, groups or organization who may affect or be affected by the project. This means that everyone involved in a project. Stakeholders may include:
  • Project team members
  • Senior management
  • Project Customer
  • Sponsor
  • The Project Manager
  • Consultants
  • Contractors
  • Governments
  • Communities in the project location
  • Project user groups
The first step in project stakeholder management is to identify the stakeholders of the project and then proceed by planning how to keep them satisfied.
The activities of the Stakeholder Management include:
  • identify stakeholders
  • create a stakeholder register
  • managing the stakeholder expectations
  • ensure stakeholder needs are addressed
  • communication with stakeholders



Back to List of Processes

How to Memorize the 10 PM Knowledge Areas


Now that you've reviewed the 10 project management knowledge areas, how could you remember then easily.
I found an easy mnemonic that would help you remember and that is:
"In School, The Calculus Quiz Has Created Really Poor Scores". Say it three times! The first letter of each word corresponds to each of the knowledge areas in order.

I hope this article has been a good reminder for you and I would like to thank you for reading.
Back to List of Processes




Sunday, 30 September 2018

What is the Difference Between Machine Learning and Deep Learning?

Hell guys, as you know, I'm Kindson the Genius and good to see you again!

In this short lesson, I would explain to you the difference between the two important Artificial Intelligence(AI) terms:
  • Machine Learning
  • Deep Learning
We would cover the following topics:
1. What is Machine Learning
2. Limitations of Machine Learning
3. What is Deep Learning
4. Application of Deep Learning

1. What is Machine Learning


Machine Learning is a branch of Artificial Intelligence the enables computer systems to learn from observation just the way humans learn without being explicitly programmed.. In machine learning, the system is presented with a set of data or objects. This is called the training set. The goal is for the system to examine this data and learn the attributes. This process is called training. After the training process, the system is able to classify when new input is provided.
For example, your camera is able to detect faces because it has been trained to recognize a face based on the features.
Machine Learning is divided in Supervised Learning and Unsupervised Learning. This is clearly explained in Introduction to Machine Learning and What is Machine Learning video tutorial.

2. Limitations of Machine Learning


Machine Learning has some of the following problem
  • Managing high-dimensional data. This means that conventional machine learning model does not perform well when there is very large input and output dataset.
  • Unable to effectively solve complex problems such as image recognition, handwriting recognition, natural language processing etc.
  • Does not handle feature extraction efficiently. Features have to be manually provided and used to train the data.



Machine Learning is a subset of AI and Deep Learning is a subset of Machine Learning

3. What is Deep Learning


Machine Learning is a subset of AI and Deep Learning is a subset of Machine Learning
Deep learning tends to build learning algorithms that mimic the way the human brain process information. Deep learning is implemented by means of neural networks. The key is that for a neural network to be used to efficiently model deep learning algorithms, then it must consist of a several hidden layers.
This is where the name 'deep learning' comes from. The input passes through many layers ( like goes deep). And then the output is passed back into the input repeatedly until the best output is produced. This process could be either back-propagation or gradient descent



Read more on neural network from the following beginner tutorials:
Basics of Neural Networks
Basics of Perceptron in Neural Networks
Basics of Back-propagation in Neural Networks
Multilayer Perceptions (MLP) Explained

4. Applications of Deep Learing


Deep Learning has the following applications.
  • Self-driving cars
  • Automatic Voice Translation
  • Automatic Image Recognition and captioning
  • Computer Vision

This is just a brief explanation find more details in the tutorial listed above.




What is SAP HANA - Beginners Tutorial 2

In Tutorial 1 we gave an introduction to SAP HANA and described the architecture of SAP HANA.

In this Tutorial 2, we would go further to discuss other bits and pieces of SAP HANA as well as how you can.


We would cover the following:
Watch the video tutorila here and subscribe to get notified when new tutorials are made.


Migrating Oracle to SAP HANA


Before SAP HANA, we have enterprise environments with Oracle backend connected to SAP Business Warehouse.
With SAP HANA, three steps would be required to make a migration to SAP HANA as illustrated in Figure 1.

Step 1: Transform the Oracle database into SAP HANA using one of the methods described in Tutorial 1 (BODS, SLT, DXC etc)
Step 2: Upgrade existing SAP Business Warehouse to a version that has support for SAP HANA.
Step 3: Connect SAP HANA to upgraded Business Warehouse

Introduction to SAP HANA Studio


SAP HANA Studio is an Eclipe-based application development tool used for creating information models in SAP HANA.
It Provides the following dedicated perspective roles:
  • Administrative
  • Modeller
  • Development



In SAP HANA Studio, you would be working with table and view. You can also load a table from a csv or xls file or other data sources.
The following views can be created using SAP HANA Studio:
  • Analytic View
  • Calculation View
  • Attribute View

We would then get into the a hands-on tutorial on working with SAP HANA Studio.

Watch the video here and subscribe to get notified when new tutorials are made.