Sunday, January 3, 2016

Create your 1st Amazon EC2 Instance

7:25 AM Posted by Unknown 1 comment
Have you ever wondered why many applications move into cloud nowadays? Well to run applications which cater to concurrent requests made by multiple clients, it requires the application to scale on demand. Cloud based services provides for this requirement by enabling the application to have re-sizable computing capacity without having to invest on computing hardware up front. Amazon Elastic Compute Cloud which is well known as Amazon EC2, provides re-sizable computing capacity in the Amazon Web Services (AWS) cloud. The advantage of using Amazon Web Services cloud is that you only needs to pay for what you use.
Amazon EC2 web service can be used to launch a virtual machine (VM). This can be used to launch your own virtual server. You can even have thousands of them and create your own data center. Amazon EC2 instances can handle extra traffic which may come into your website by automatically scaling up to add more capacity. All the security and networking settings can also be configured by the creator through the AWS console.  
Getting Started
In this I will explain you the step by step approach in creating a new Amazon EC2 instance and setting up a new virtual machine on it.
Step 1: Go to Amazon Web Services website: http://aws.amazon.com
If you do not have an AWS account, click Create an AWS account on the upper right hand corner of the page.
1.png
You need to enter your name, email address and other information along with your credit card information to create an AWS account.

Step 2: Login to your AWS account
Click on My Account → AWS Management Console. Enter your email address and password and login to your account.
Step 3: Set up the region you are closest to.
 Click on EC2 Virtual Servers in the cloud, in the AWS management console.
4.png
Then it leads to the EC2 Dashboard where you can select the region you are closest to by clicking on the region menu towards the upper right hand side of the Dashboard.
5.png
Step 4: Go to step by step wizard to create the EC2 instance from the AWS management console.
Click on “Instances” on the menu towards the left.
6.png
There you can see the current EC2 instances that you have, their status and other information. In order to create a new EC2 instance, click on the “Launch Instance” button.
7.png
Step 5: Choose an Amazon Machine Image (AMI)
Amazon Machine Images or AMIs are pre-configured templates provided by Amazon for your instances. It provides it own Linux, Red Hat, Ubuntu, Windows distributions. If you are not running very extensive applications you can use the free tier eligible. In case you are running very extensive applications having lot of live users, it is recommended to use one of the premium versions or the actual tier versions. Let’s use the Ubuntu Server 14.04 LTS distribution for this.
Select Ubuntu Server 14.04 LTS from the list of AMIs.
8.png
Step 6: Choose an Instance type
In the next screen you are given a list of instance types having varying combinations of CPU, memory, storage, and networking capacity. You need to select the instance with the appropriate mix of resources depending on your application needs. For this we are going to leave the default option selected as it is.
Next click on “Configure Instance Details” button.
9.png
Step 7: Configure Instance Details
Here you are given the options to change the number of instances, network, subnet configurations etc. Here we will leave the default options as they are.
Next click “Add storage” button.
10.png
Step 8: Add storage
Here you have the ability to change the storage options. The size will be 8   Gigabytes by default and the volume type will be standard. Delete on termination option will be selected by default and it means when you terminate the instance everything related to it will be deleted forever. Here also we will leave the default configurations as they are.
Next click on “Tag Instance” button.
11.png
Step 9: Tag Instance
Here you can tag your Amazon EC2 resources with a case sensitive key-value pair. To more about tagging your Amazon EC2 resources refer the link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html?console_help=true. As default you do not need to tag it. Hence let us leave that blank.
Next click “Configure Security Group” button.
12.png
Step 10: Configure security group
A security group is a set of firewall rules that control the traffic for your instance. You can add rules here to allow only specific traffic to reach your instance via specific port ranges.
You can either create a new security group or select an existing security group. Create a new security group by any name and give a brief description about the security group.
Then for the types of security groups leave the ssh type as we will need that later to ssh into the virtual machine from your local machine. Also click “Add Rule” button and add another rule which is HTTP. This is to launch a web server inside the virtual machine for your web applications to run.
You can also configure the rules to allow traffic from known ip address only by specifying a custom ip address range or else leave the source as “Anywhere” to accept traffic from any ip address.
Finally click “Review and Launch”.
13.png
Step 10: Review and launch
Review the configuration details of your instance and click on the “Launch” button.
14.png
Step 11: Create a key pair
Then it requires you to create a key pair which is used when you try to access your instance such as when sshing to your virtual machine from your local PC. You can either use an existing key pair which you have created earlier or create a new pair. Here we will create a new key pair.
Select create a new key pair from the dialog box which appears and give it a name. Click download key pair to download the key pair in the form of a .pem file to your local machine. Store it in a secure location as you will only be able to download it once.
After that click on “Launch Instances” button to launch your 1st Amazon EC2 Instance.
15.png
Now you have finished creating your 1st Amazon EC2 Instance. You can view the status of it under “Instances” in the Amazon EC2 Dashboard. It will take a few minutes to fully initialize and run the newly created Amazon EC2 Instance.
In the blog posts which follow I will guide you through how to access your Amazon EC2 Instance from your local PC, host Apache web server and run a PHP web application on it.

Saturday, January 2, 2016

Phonetic Search

3:15 AM Posted by Unknown No comments


Have you ever gone to McDonald’s? Is it McDonald’s or MacDonald’s? Well it sounds like the latter though. Phonetics is all about how words sounds like. People are bad at spelling things correctly. They do not memorize spellings but they type in the words guessings the spellings by the way the word sounds like. Most of us are more comfortable to listening stuff to understand something rather than having to read thousands of lines of text. And each year the number of distinct words we have encountered grows bigger and bigger. And as technology advances people rely on auto-correct generators or spell checkers to correct their spellings. These are the major reasons that most of the people in the world are spelling-challenged.
As people are the ones who use computers, it is a risk for the computers to depend on humans to type in the words spelled correctly for searches and stuff. If you read the blog post http://www.nextmovie.com/blog/most-misspelled-celebrity-names you will be able to see even the most popular celebrity names are reported misspelled most of the time. Not knowing either to pronounce what they read or spell what they hear often leads people to end up in this situation.   
This can be mostly seen in among spelling trademarks also which often leave out the vowels and arrange the consonants in unusual ways to sound unique. This uniqueness or distinctiveness in names often troubles the general public. And this has a greater effect on the amount of revenue earned by these brands as well because people may not be able to spell the brand name correctly on search engines and might not be able to get the correct results or might end up finding a different brand.   
Hence this arises the need to make computers less dependable on what people type in. Following approaches used in the content technology minimizes this problem to a certain extent.
  • Phonetic search
  • Voice search
  • Speech synthesis
Let’s look at Phonetics search in detail in this article.
Phonetic Search
Most of the traditional searches rely on the user to type in a query word. Although it auto-generate suggestions or predict text those also rely on the part of the text typed in by the user. But Phonetic search gives user the flexibility to search according to how the words sound like. Google also does not support it yet. One of the example where Phonetic search has been incorporated is general purpose search engine Exalead, from France’s Dassault Systèmes. This kind of search is mostly useful for e-commerce applications where products, brands and trademarks are searched in bulks.
How it works
Basically what it does is identify the sounds represented by the query word we type in and match it with words which sound alike (homonyms or near-homonyms for that sound). These words might have different meanings like the words cell and sell but will sound alike. You will understand that many such words which sound alike but completely different in meaning exist by referring the article http://www.cooper.com/alan/homonym_list.html. For this both the query and target words should be converted to a phonetic representation and when typed in the query word all the words which have a similar phonetic representation to that of the query word are returned.
Soundex Algorithm
Soundex is the main algorithm used in Phonetic search. It was developed by Robert C. Russel and Margaret King Odell and patented in 1918 and 1922. Many more modern Phonetic algorithms have also come up but the basis for most of these Phonetic algorithms is the Soundex algorithm.
Soundex algorithm indexes words according to their phonetic sound such that different words which sound alike get the same index. So, when storing words following the Soundex algorithm, those with similar phonetic sounds can be related together by their index and can be matched despite the minor differences in  their spellings.
Soundex algorithm first remove the vowels (except a vowel appearing as the first letter of a particular word) and other irrelavent consonants. The it calculates the Soundex index for the refined word. Soundex index for a name consists of a letter followed by 3 numerical digits. The letter is the first letter of the name and the digits encode the remaining consonants. Consonants at a similar place of articulation share the same digit. It partitions these consonants into groups and all the consonants which belong to the same group share the same digit. The following tables denote the similar groups of consonants and their corresponding digits.
Original Soundex consonant grouping
B P F V
1
C S K G J Q X Z
2
D T
3
L
4
M N
5
R
6
Refined Soundex consonant grouping
B P
1
F V
2
C K S
3
G J
4
Q X Z
5
D T
6
L
7
M N
8
R
9
Letters which are not included in the above table (all the vowels, H and W) are removed in the first step. Then adjacent letters from the same group are written as one letter. The result is truncated to the first letter followed by 3 digits. Missing positions of the 3 digits part is embedded with zeros. This is the Soundex index of a word and two words which sound alike will end up having the same Soundex index.
The following example will show how you calculate the Soundex index of two words which sound the same.

Labels