Java Is Everywhere !

Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!

What is .NET?

.NET is an integral part of many applications running on Windows and provides common functionality for those applications to run. For developers, the .NET Framework provides a comprehensive and consistent programming model for building applications that have visually stunning user experiences and seamless and secure communication.

Linux

Linux was originally developed as a free operating system for Intel x86-based personal computers. It has since been ported to more computer hardware platforms than any other operating system. It is a leading operating system on servers

Java Script and jQuery

JavaScript is a scripting language. jQuery is a library built in the JavaScript language that enabled users to write some JavaScript code faster (Mainly DOM manipulation, Animation and AJAX).

Android Technology

Android is a Linux-based operating system designed primarily for touchscreen mobile devices such as smartphones and tablet computers. Initially developed by Android, Inc., which Google backed financially and later bought in 2005

ff

Recent Posts

Sunday, September 29, 2013

How to Install NS2.35 on Ubuntu 12.04



Lets Install NS2.35 on Ubuntu 12.4

I assume you have Installed the Ubuntu 12.4 . If not you can install it directly or by using Vmware or Oracle Virtual box.

First step is to download the ns2 installation bundle.


then I extract it same palce where it downloaded. For me its “Downloads” directory.
Do not worry about terminal coding... open the folder and Click on "Extract" button  as simply sown in the following figure.


Click on Extract Button again..



Now you can see... there is a directory called "ns-allinone-2.35" in the Downloads folder.

now open the terminal and change the current directory to the "ns-allinone-2.35" directory by using "cd" command




then execute the command 
./install

then wait until it ends... sometimes it shows errors but don't worry about them.. just ignore...

now you should set the environment variable and paths
to do that .. follow the following steps
run the command    gedit ~/.bashrc
it will open new window with text editor.. now we are going to add some values to it.




dd the following text inside the textviewer and click on "save" button.





                                  now exit from the text editor and type "ns" on the terminal
once you did it.. if you see percentage symbol "%"  on the screen , that means your ns2 installation is successful.
if instead of if you see some errors , just run the following command and then it will download some packages from the Internet and install it.
sudo apt-get install ns2 nam xgraph
then type your password to confirm yourself 

once the download complete.. type "ns" command and see whether its succees
here I go...







Sunday, September 8, 2013

Google Maps API V2 for Android



The Older Maps API V1 is officially deprecated as of December 3rd 2012. Starting from March 3rd you will no longer able to apply maps api key obtained using Maps API V1. This Tutorial is about how to use Google Maps API V2 for Android application development.  This Tutorial have described on both Android Studio and Eclipse IDEs.
 

Android Studio


 
It is easy to get the eclipse folder structure to avoid gradle errors on Android Studio. So lets create a project using eclipse and later import it to Android Studio
Create new Project using eclipse IDE
Go to File à New à Other


 

You don’t want to consider the build and compile sdk versions bcoz we will change them later.

Then click next,,, next,,, next,,, and finally “finish”

Then open Android Studio and go to Fileà Import Project and browse and open your previously created eclipse project



Make shure to select Google API as Build target (shown in following image)



Click next and Finish import.

Initially you should manually download and install the Google Play Services using SDK Manager .

Open the SDK manager by going  Tools à Android à SDK Manager
 


Then SDK Manager will be open , then scroll to bottom of the window and you will find “Extras” section. There is “Google Play Services” check box and on default it will not installed initially. If so you should check it and Click on Install Package Button.(Note: in the following image it is already installed for me.)



After you installed it, you should import the Google Play Services Library to your work space. To do this

Go to  File à Project Structure or press “Ctrl + Alt + Shift + S” and Open the Project Structure Dialog.

 
 
Then Select the Module  and click on the green plus button appear in the left top of the middle section as shown on following image. Then select the Import Module from drop down list.
 


Open the following url by browsing  ~\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib

You can find this for the SDK comes with Android Studio in

C:\Users\<UserName>\AppData\Local\Android\android-studio\sdk\extras\google\google_play_services\libproject\google-play-services_lib

Note: If you cant see the “AppData” folder in browse window just click on “show hidden folders” button

Click OK button

 


Click on Next button for next few dialog boxes and finally click Finish. Now you can See “google play services lib” project has imported.


Now Select on your Project name, under module section and click on the green plus button appears in right side under the “dependencies” tab and click on “Module Dependency”



Then Select “google-play-services-lib” on the dialog box

 



Again click on the green plus button and click “jars or directory” and import the google-play-services.jar file located under C:\Users\<UserName>\AppData\Local\Android\android-studio \sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs\google-play-services.jar




Use the up/down arrows to move <Module source> to the bottom of the list.

 

Then our next step is to Display the Google Map on Android device. In Map V2 your android version api level must be greater than or equal to 11. Otherwise it will not support.

 

Your next step is to take a Maps API key to uniquely identify your project, before having Maps API key you must have sign your certificate. This is based on SHA-1 fingerprint. The fingerprint is a unique text string generated from the commonly-used SHA-1 hashing algorithm. Because the fingerprint is itself unique. There are two types of certificates

1.Debug Certificate

This certificate only allow you to test your application, you can’t publish it to google play store. It  will have an expiration date of 365 days from its creation date.

           

2.Release Certificate

 

In this tutorial I only use Debug certificate to demonstrate the tutorial.

How to obtain a Debug Certificate from Command Line

Debug keystore can be found at <userhome/.android/debug.keystore>

To generate SHA-1 of debug keystore use below command by changing current directory to “.android” directory in Command line.



 

keytool -list -v -keystore <debug keystore path>/debug.keystore –alias


 androiddebugkey -storepass android -keypass android
 


To access the Google Maps with the Maps API, you have to add a Maps API key to your google application project. You can get this key via Google API Console .

Create your project in Google API Console. Go to following link.


if this is the first time you enter to the google api console, you will prompt to asking for create new project. Click on “Create Project” then you will get All Services window.

 


Scroll to down and find “Google Maps Android API v2” and toggle on the button appears in front of the text by accepting google terms of services agreement.
 
 

 
Then go to “API Access” tab and click on “Create new Android key” button.



Type your obtained debug key and android project package name with separated by a comma.

Click on “Create” button.

Note: In this example I have used “com.example.myapplication” as my package name, if you have different one, use your own package name.



Copy and Save the “API Key” somewhere on your local computer, you will need this later.
Now you are ready for Display your Map. Go to Android Studio Project and add the following code to your layout.
<fragment
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.MapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
 
In Order to Display Your map using “MapFragment” class, you must have some permissions add  on your “AndroidManifest.xml” file and you also add your  google map api key as meta deta.
Note:
1.       <metadata> element must be place as a child of <application> element and before the closing tab of application element
2.      <uses-permission> elements must place as child of <manifest> element
·         android.permission.INTERNET Used by the API to download map tiles from Google Maps servers.
·         android.permission.ACCESS_NETWORK_STATE Allows the API to check the connection status in order to determine whether data can be downloaded.
·         com.google.android.providers.gsf.permission.READ_GSERVICES Allows the API to access Google web-based services.
·         android.permission.WRITE_EXTERNAL_STORAGE Allows the API to cache map tile data in the device's external storage area.
The following permissions are recommended, but can be ignored if your application does not access the user's current location, either programmatically, or by enabling the My Location layer.
·         android.permission.ACCESS_COARSE_LOCATION Allows the API to use WiFi or mobile cell data (or both) to determine the device's location.
·         android.permission.ACCESS_FINE_LOCATION Allows the API to use the Global Positioning System (GPS) to determine the device's location to within a very small area.
 
3.       version 2 of the Google Maps Android API requires OpenGL ES version 2, you must add a <uses-feature> element as a child of the <manifest>
<uses-feature

        android:glEsVersion="0x00020000"

        android:required="true"/>
    
4.      add following permissions with your package name instead of red text.
<permission
         android:name="com.example.myapplication.permission.MAPS_RECEIVE"
            android:protectionLevel="signature" />
    <uses-permission android:name="com.example.myapplication.permission.MAPS_RECEIVE"/>
 
Now your AndroidManifest.xml file must appear like this..
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication"
    android:versionCode="1"
    android:versionName="1.0" >
 
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
 
    <uses-feature
            android:glEsVersion="0x00020000"
            android:required="true"/>
 
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <!-- The following two permissions are not required to use
         Google Maps Android API v2, but are recommended. -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
 
    <permission
            android:name="com.example.myapplication.permission.MAPS_RECEIVE"
            android:protectionLevel="signature" />
    <uses-permission android:name="com.example.myapplication.permission.MAPS_RECEIVE"/>
 
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.myapplication.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
 
        <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="your api key put here"/>
 
    </application>
</manifest>
 
Then put the following code in your activity_main.xml file
Now Run your project. it will make you smile
We can do lot with maps.. Lets learn them one by one in future tutorials.
For next tutorial I’ll show you how to create this app on eclipse with google map api.



 

Saturday, September 7, 2013

Let’s start Android Development with Android Studio.


First of all you should download the android studio from official android website. Use the following link.



Android Studio download bundle comes with latest android SDK. If you have previously downloaded SDKs you should change the sdk path using following steps
1.       Press F4 into Project Structure
2.       Left > SDKs
3.       Press +, add another sdk

This can also done from the quick start window, choose Configure, then choose Project Defaults, and then choose Project Structure. Then on the left under Platform Settings choose SDKs. Then to the right of that choose the current android platform, mine was Android 4.2.2 Platform, and delete it using the red minus button at the top, then add a new android platform using the green plus button at the top and point it to your current SDK folder and that is it.
Once you download the Android Studio you should install it and no need to install external plugins as you previously done in “eclipse” IDE. But to run the project you should have a Virtual device or a Real handset.
How to create a Android Virtual Device
       Go to tools à Android à  AVD Manager



Then you will get the AVD Manager dialog.



 Click on New Button.
Then fill the "Create AVD"  data to create the device that you want



Run the Android Project  on a Real Device

First you should have install  your phone driver files in your computer.  For Samsung phones you can install the Samsung kies and you will accomplish the requirement
then you must connect your device to the computer using a USB cable
after that enable and allow the usb debugging in your phone.
Go to Settings à Developer Options à check the button “allow usb debugging” 




Create your First Project with Android Studio

Go to File à new Project

Then you will get following window.. and fill the rest of details.



Once you create the Project, you can run the project using “Shift+F10”  
It will start the default AVD (Android Virtual Device ) and after the boot , your project will be automatically load.
If you want to run your project on your Real Device, you should change the Run Configuration shown as following images.

Change the target device to USB.



Now run your project. It will run on your Android Phone



That's all for this tutorial.. make your comment if there anything to know..

Cheers.. (Y)