Tuesday, June 19, 2012

Enjoy Google App Engine (GAE) Development Platform in The Cloud


Today we will enjoy creating a simple web application, actually a guessing game, and will try to set it up on Facebook ;) BUT

First, we need to take a deep look on Google App Engine platform and then go for some installation instructions. App Engine is a complete development stack that uses familiar technologies to build and host web applications. With App Engine all you need to do is to write your application code, test it on your local machine and upload it to Google with a simple click of a button. Once your application is uploaded to Google, it is automatically hosted and scaled for you. So no need to worry about system administration, bringing up new instances of your application, sharing your database or buying machines (even no need to configure Web servers on your machine to test your application locally!!). Google will take care of all the maintenance so you can focus on coding only.

Google App Engine costs nothing to get started, Once you have gmail account, sign up for the GAE service then create account and publish an application that people can use right away at no charge from Google.  But as you go for using more resources, you will have to pay for that. All applications can use up to 1 GB of storage and enough CPU and bandwidth to support an efficient app serving around 5 million page views a month, absolutely free. But as you go for using more resources, you will have to pay for that and you only pay for resources you use above the free levels.

Google App Engine offers some advantages to developers:
·         Automatic scaling: is built in with App Engine, No matter how many users you have or how much data your application stores, App Engine can scale to meet your needs.
·         High performance and reliability: with App Engine you can take advantage of the 10 years of knowledge Google has in running massively scalable, performance driven systems.
·         Security: all Google applications' privacy and data protection policies are applied to all App Engine applications. GAE protects your code and application data.


Technical Details about GAE:
With Google App Engine you can:
  • Serve your app from your own domain name (such as http://example.com/) using Google Apps 
  • Or serve your app using a free name on the appspot.com domain.
  • Share your application with the world, or limit access to members of your organization.
  • write apps in several programming languages. With App engine's Java runtime environment, you can build your app using standard java technologies like JSP, Java Servlets, JavaScript, Ruby, Python, and Go languages.

The article is going to be little long but more interesting ;)



Using Google Plugin for Eclipse:
If you use the Eclipse development environment (which is highly recommended), you can use the Google Plugin for Eclipse to create, test, and upload your App Engine Web Applications. To do so, follow the steps bellow:
1. First, you should have already installed JDK 6 and downloaded Eclipse 3.7 (Indigo).
2. Install the Google Plugin for Eclipse using the Software Update feature of Eclipse:
       a. Select Help menu > Install New Software
       b. In the "Work with" text box, enter the URL shown in the figure below:




3. Click the plus icon next to "Google Plugin for Eclipse" and "SDKs". Check the boxes next to "Google Plugin for Eclipse 3.7" and "Google App Engine Java SDK". You can also select the "Google Web Toolkit SDK" if you'd like to use Google Web Toolkit with your apps. Click the Next button. Follow the prompts to accept the terms of service and install the plugin.

4. When the installation is complete, Eclipse prompts you to restart. Click Yes. Eclipse restarts and then voila`! plugin is installed ;).

Create a Web Application using Google App Engine SDK:
Here we go:
1. Click the New Web Application Project button in the toolbar: 




2. Then Create a new web application:




3. Click Finish Button and then here is the project created:



4. Double-click the file "index.html" and put the following code inside the <body> </body> tag:
<h1>Hello App Engine!</h1>
<script type=text/javascript>
var iRandom;
function Restart()
{
iRandom = Math.floor(Math.random()*10)+1;
alert('OK, I am thinking of a number between 1 and 10');
}
function Guess()
{
var yourGuess = document.getElementById('myGuess').value;
if (yourGuess>iRandom)
alert('Too High.');
if (yourGuess<iRandom)
alert('Too Low.');
if (yourGuess==iRandom)
{
alert('Well done! You guessed it.');
Restart();
}
}
</script>
Enter your guess between 1 and 10: <input type=text id='myGuess' name='myGuess'>
<input type='button' onClick='Guess()' value='Guess'>
<br>
<br>
<input type='button' onClick='Restart()' value='Start Again'>
<script type=text/javascript>
Restart();
</script>


Now, it is time to run and deploy the application. There are two ways to deploy your application:
1. Locally: right-click on your project > Run As > Web Application


Here is your Application is running locally!


2. Publicly: using the free domain appspot.com  by uploading your application files on Google App Engine's web host. This requires you to create an account with Google App Engine. Let's see how?
       a. Go to this link: https://appengine.google.com/
       b. Then create an account for your Web application:


      c. Then enter your mobile number so Google will send you the verification code to your mobile:




        d. You will have to enter this verification code in the next step and then you will be asked to create an application by entering Application ID and title:


          e. Next, click Google menu button and choose "Deploy to App Engine":



         f. Sign in with your gmail account:



         g. Continue authenticating:


** Important Note:
Before deploying your web application, go to your project in Eclipse and find an XML file with name "appengine-web.xml" and set your application id as registered on appspot.com domain which is "raniagame" in this example, see the figure below:


         h. Then choose your project and click button "Deploy":



          i. Then your project will be uploaded to the application you already registered with the app engine:


           j. Finally your application is deployed successfully: 



           k. Now, let's go to the Web browser and write this URL:
                        http://raniagame.appspot.com/




Now, how about setting this application on facebook? ;) 

1. To do so, go to http://developers.facebook.com/apps  and click button "Create New App"





2. Then put the name of the facebook app


3. Fill the following fields as shown below and click button "Save Changes":



4. Verifying these entries might take minutes so don't panic if it didn't work quickly, afterwards, you will find the app working fine and here is the result:


So start socializing and get feedback from your friends about your application whatever it is ;) that's all for this article, I hope it was useful and wish you good luck all ;) :)











Saturday, June 16, 2012

Social Media from The Web to Our Life

Speaking by the language of today, Social Media concept combines advanced web technologies with the meaning of both words "social" and "media". Being social is to be connected to some kind of society (either virtually or in reality). Media is the means of communication which is,popularly, the Web nowadays. Going formal, I found two proper definitions of social media:

Social media definition by Ron Jones
"It is a category of online media where people are talking, participating, sharing, networking, and bookmarking online. Most social media services encourage discussion, feedback, voting, comments, and sharing of information from all interested parties."

Social media definition by WebProNews Staff
"It describes the online tools that people use to share content, profiles, opinions, insights, experiences, perspectives, and media itself, thus facilitating conversations and interaction online between groups of people."

The above definitions indicate how social media stormed our life in a friendly and most welcomed manner since we started using it as a replacement for the traditional media like T.V. So we can be updated with what's going on all over the world by social news sites, like Mashable, that allow people read about news and articles and vote/comment on them. Photos and videos for special moments and memories can be shared using social sharing sites, like Picasa and YouTube, so people create, upload, and share videos or photos with others. Most of our interactions and activities take place when we use social networking sites (SNS), like Facebook, that allow you to get connected to other people so you can keep up to date with their contact info, interests, posts, as well as share news and knowledge with them. Also social media enabled us to to save our bookmarks online and access them from anywhere or share them with others through sites like delicious.

Going specific to Social networks, let's have a look on the dates when the most popular SNSs started:

  1. 2002: Friendster
  2. 2003: Myspace and LinkedIn
  3. 2004: Facebook
  4. 2006: Twitter
  5. 2011: Google+


Facebook is the most buzzy social networking site as we became familiar with it, that's why it recorded the first rank according to eBizMBA rank in June 2012. With facebook, you enjoy:

  1. Creating new relationships, reconnecting with family and old friends (studies indicate that Internet users have wider social network than non-Internet users).
  2. Text/video chatting with friends ;) .
  3. Sharing status, photos, or videos with your friends and get their feedback via (likes) or (comments).
  4. Issuing questionnaires with your friends about important matters.
  5. Creating groups for people of common interests to discuss ideas and discover new ideas as well.
  6. Storing photos in albums with customized privacy.
  7. Playing games and installing cool Apps.
  8. Publishing important events so your friends can attend it.
  9. Doing activities beyond entertainment like publishing Ads or starting your own business and creating a page for exhibiting your business products and services. 
  10. Developing and publishing facebook Apps!

Social Networking Sites take care of your children!!! any profiles for persons of age under 16 are automatically set to "private" so they cannot be found by a general search.

But Take Care !
Be careful from technology and virtual community or you will be in trouble :D . Virtual social networks might affect your personality, psychological manner, and even your entire life negatively. I mean when you get used to talk to people virtually, you might have some kind of inability to socialize in real. Also social networking sites might threaten your time, with BIG wasting activities, that you would spend it with another productive activities. Another concern, How do you know that the person you are talking to is your friend herself/himself???? Again, your personality can be confused and you will not be able to have real conversations. Face-to-face socializing disappears gradually as the virtual socializing increases which may result in "social isolation" so you don't spend much time with your family just because you are living in your virtual bubble :D . Negative effects on health can be brain disorder, attention deficit, and rewire brain with repeated exposure. Vulnerability to security attacks like hacking, leaking sensitive information, and sending viruses. A more problematic case, social networking sites do not scan messages for viruses :$ .


So enjoy but take care ;)