Wednesday, May 20, 2015

PhoneGap: Mobile App Development Framework

PhoneGap
PhoneGap: Mobile App Development Framework

What is PhoneGap :

PhoneGap is a mobile application development framework by adobe system to make one mobile application for all mobile operating system. So we can call PhoneGap as platform independent mobile app development. The app made using PhoneGap can run on all famous mobile operating systems like Android, ios, blackberry and windows. So Nowadays PhoneGap becomes very famous due to all these features.

Languages Used:  To develop mobile application using PhoneGap, developer does not required the knowledge about the mobile languages or mobile operating system languages but just required to knowledge about web development language HTML,CSS and JavaScript.

When to use PhoneGap : The developer who want to put his website into the mobile application either online or offline can use PhoneGap to develop mobile application fast using website technology languages.

So before starts working with PhoneGap, you must have knowledge about web technology languages like HTML,CSS and JavaScript.We can not use the native mobile operating system component i.e android,ios,blackberry and windows services and component while developing app using PhoneGap.

We will see how to setup environment to use PhoneGap and how to develop app using it in upcoming tutorial.

Thanks for reading the article. Give your valuable feedback we will come with more interesting articles soon.
Read More

Saturday, May 16, 2015

Android Intent

Android Intent: Android intent is a object which carrying an intent or message from one component to another component inside an application or outside the application. Android intent is a communication medium between any android core components- services,activities and broadcast receivers.

We can use android intent to send data from one activity to another activity with application. Android intent used while to call native android services from our application like calling camera, web browser, calender or any other native android service.



Intent Types:  There are two types of intent
  • Explicit Intent: Explicit intent specify the component to start by name directly because we already know the component name that we have to call. We mostly use this intent to start the component in our own application. For example to start a new activity on user request we directly specify the activity name in intent object.
     
    // Explicit Intent by specifying its class name i.e SecondActivity.class
    Intent i = new Intent(this, SecondActivity.class);
    // Below we are sending two parameter from one activity or screen to another activity or screen 
    i.putExtra("Param1", "ABC");
    i.putExtra("Param2", "123");
    
    // Starts Second Activity
    startActivity(i);
    
    Then the second activity must invoke method getExtras() to receive the parameter data sent by first activity as shown below 
     
    // Get bundle object in your second activity code
    Bundle extras = getIntent().getExtras();
    // Extract data using passed keys as described by first activity i.e Param1 and Param2
    String value1 = extras.getString("Param1");
    String value2 = extras.getString("Param2")

  • Implicit Intent: Implicit intent does not specify the name of component directly instead it specifies the action name which we have to perform which allows a component from another app to handle it. For example if we have to take photo in our app so instead of making camera functionality in our app we can use native android camera to catch the photo using implicit intent. 
     
    // Below intent code opens web url www.google4tech.com in another application  
    Intent intent=new Intent(Intent.ACTION_VIEW);  
    intent.setData(Uri.parse("http://www.google4tech.com"));  
    startActivity(intent);
    

So like this we can use intent in our android application to use android system native functions using implicit intent and to communicate between different android component (Activities,Services and broadcast receivers) using explicit intent.

Thanks for visit and reading the article. We will post more android related article soon. Please give your valuable feedback.

Read More

Saturday, May 2, 2015

Android Components:

What is Android?

Android is a Software stack for mobile devices which includes an operating system,middle-ware and key applications.

Android operating system is Linux based Operating system.

Android SDK provides the tool and API to start developing android applications in Java programming language.

Android offers its own java virtual machine called Dalvik Virtual Machine. Dalvik VM is optimized JVM to run compiled java class files in order to counter the handled device limitations such as memory, processor speed and power.

Android Components are the main part of android application. Each components has a different point through which system can enter your app. Each components plays a specific role.

There are four main android components. Each plays different role and have different life cycle. The four main android components are as below.

1) Activities : The building block of user interface is the activity. While it is possible for the activities do not have user interface. Each activity is independent even they work together. Each activity is implemented as derived class of Activity Class. An application may have many activities but out of many activities one activity is marked as first one that should be presented when application starts. One activity invoke another activity.

2) Services : The services dose not have an user interface, but rather runs in background for an indefinite period of time. Each service extends the Service main class. For example services might play music in background as the user attends to other matter or fetch data from network and make them available to activities. Like the other components services runs  in the main thread of application process.

3) Broadcast Receivers : Broadcast receiver is a components that receives and react to broadcast announcement. Any application can also initiate broadcast- for example, to let the other application know that some data is downloaded to device and is available for them to use. All receivers extend the BroadcastReceiver base class. Broadcast receivers do not display user interface. However they may start an activity in response to information they receive.

4) Content Provider : The content provider makes a specific set of applications data available to other applications. The data can be stored in SQLite database file. The content provider shares data between applications. The content provider extends the ContentProvider base class to implement standard set of methods that enable the other application to retrieve and store data. Application call content provider methods by creating object of ContentResolver. A ContentResolver can talk to any content provider, it cooperate with the provider to manage any inter-process communication that involved.

So these are fundamental components of android. We will see how to activate these components using intent in next article..

Thanks for reading the article. Please give your valuable feedback.


  

Read More

Monday, April 27, 2015

Android Application Data Storage Options

Nowadays, Android is popular platform for mobile application. So while developing application in android for mobile data management is very important thing. So there are multiple ways to store and handle data in android application. So which way to choose for storing data is depend on our need, such as weather data should private or public to your application and how much space you want or require.

Five Ways to Store Data in android are as follows

1) Shared Preference : Shared Preference stores private data in Key-Value Pair. This option stores data in application level in android system memory. We choose this option while doing Session Management in android.It stores session variables data in Key-Value Pair.

2) Internal Storage :  Internal Storage stores private data of android application on the device memory. The device memory is internal memory of phone or phone built in memory.

3) External Storage : External Storage stores public data of android application on external memory i.e. on external memory card.

4) SQLite Database : SQLite is the option to stores data of android application in private structured database. It store data in table format. So we can use our simple SQL queries to handle or manage data.

5) Network Connection : Network Connection stores the android application data over web with there own network server.

So these are some ways to store and handle data in android. We will see these option in details in upcoming post.

Thanks for reading this article. Please give your valuable response about it.




Read More

Wednesday, July 30, 2014

AJAX Tutorial: Asynchronous JavaScript and XML

AJAX: Asynchronous JavaScript and XML Tutorial 

What is AJAX?

AJAX Stands for Asynchronous JavaScript and XML is language used for making interactive web application. It is used at client side to make asynchronous web application.

AJAX allows client to interact server asynchronous (client request processed in background) so due to this it make web application faster and save bandwidth which required to reload the whole page and time.

 AJAX= JAYASCRIPT + XML

AJAX is used to exchanging the data with server and updating the part of the page without reloading the whole page. AJAX is a technique of creating fast and dynamic web page.

Example of AJAX: The some sites like Gmail, facebook and Google extensively use ajax to save the bandwidth.

AJAX code lies in html and javascript. So no need to write separate file for ajax code. In AJAX, XML is used to exchange the data over server. 

Classic websites which do not use ajax need to reload whole page if some content of the page changes.

The flow of AJAX application is as follow:

Step 1:
At Browser Side :  when event occurs browser creates an XMLHttpRequest object and then it send and HttpRequest to the server

Step 2:
At Server Side : Server processes the HttpRequest and create the response and send it back to the browser

Step 3:
At Browser Side : Browser receive the response and process it back using javascript and then it update the page content.

AJAX Example :
    This is sample AJAX example. In this, when we press button named change content then the content of myDiv div changes without refreshing the whole page.



Let AJAX change this text



Now we will see what the above code of ajax says:

In the above code we have written our ajax code within java script and html code. In html we have taken one button with label "change content". We click this button the function from java script get called and  that function runs the ajax code.

In this ajax code, we first create the xmlhttp object to exchange the data over server asynchronously. To send data using xmlhttp we need to create first open the xmlhttp object using either GET method or POST method as a parameter to open() method and after that send the request using send() method.

we create the xmlhttp object as below

code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();

code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

and after that we open and send xmlhttp object as below

xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send()

In above open method, the first parameter is method i.e. get or post and second parameter is file or url of the server and third parameter is true or false. True means sent xmlhttp request asynchronously and false means sent xmlhttp request synchronously.

After getting xmlhttp request to the server it processes the request and sent back response. So client check the xmlhttp.readyState==4 and xmlhttp.status==200 if both are true then the client gets the response from the server. So client gets the response text from server using xmlhttp.responseText and then it changes myDiv content with response text.

So in this way using ajax the client changes the part of the page content without refreshing the whole page. Please make the comment on this tutorial so i will be back next time with some good one. Thanks for reading this.






Read More

Sunday, January 5, 2014

PHP MySQL Database tutorial

PHP MySQL Database tutorial :



What is PHP?


PHP is most popular server side scripting language used for web development. To know more about php and how to start with PHP programming CLICK HERE
PHP works with many databases. You can connect to many databases and manipulate with them with PHP. But the MySQL is most widely and popular databases with PHP. So now we learn more about MySQL.

What is MySQL?

MySQL is the widely used open-source Relational Database Management System(RDBMS). MySQL is the database used on the web and it is runs on the server side. MySQL is good for both small and large application. MySQL is reliable and easy to use database. MySQL is supported by number of platforms and It supports standard SQL.

So from this we got to know about both PHP and MySQL. So now we move to the PHP with MySQL that is how to use PHP with MySQL.

You can simply install PHP and MySQL on your PC with the help of complete package of XAMPP. XAMPP is acronym of  xml apache mysql php and perl. To know about how to install XAMPP on your windows machine please CLICK HERE

PHP MySQL Tutorial Content:

1) MySQL Connect Syntax :

First you have to connect to your mysql through PHP so you need to use mysql_connect().

Basic syntax for mysql connect is as below

mysql_connect(host name, username, password);
// Here host name is the name of host or ip address of host where mysql is installed

Try out the below code for mysql_connect()

//the example of MySQL database connection 

$conn = mysql_connect("localhost","","");
// write your mysql username and password in the second and third parameter of mysql_connect respectively
if ($conn) {
 echo ("Connection is succeed")
} else {
 echo ("Connection is fail")
}


2) MySQL Create database :
MySQL create database syntax is as below

mysql_create_db("database")


3) MySQL execute Query :
Mysql execute query syntax is as below

Sorder="insert into table (val11,val2)";
mysql_query($order) ;
//The above command execute the insert sql command

4) MySQL fetch record :
The syntax of fetch single row or record from table is as below

$result=mysql_query("select id,name from student where id =10");
if(!$result)
{
  echo "No record exist";
}
else
{
   $row= mysql_fetch_row($result);
}

echo $row[0];   //10
echo $row[1];   // suresh
Read More

Wednesday, July 24, 2013

WinDump: TCPDump for windows

WinDump: TCPDump for windows 


WinDump is TCPDump for windows.

What is TCPDUMP?

                        TCPDUMP is command for capturing TCP/IP packet on unix/linux platform i.e. it is command line network analyzer for UNIX. 
For more detail about TCPDUMP visit Click Here

What is WinDump?

                      WinDump is TCPDump command line packet analyzer for windows. WinDump is fully compatible with TCPDUMP have same commands and features available on windows. WinDump. If you want to traces the packets for some analysis purpose. We can easily capture packets on a particular network interface card  as well as trace route of packet using Win Dump. 

Installation of WinDump :

Step 1: Installation of WinPcap

For installation of WinDump we first require to install WinPcap. WinPcap is a set of network capture drivers require to WinDump to capture packets.

Download WinPcap from http://www.winpcap.org/install/default.htm then the following page appears in browser click on red circle icon then the WinPcap starts downloading


Once the download is completed start installation by double clicking the winPcap.exe file as shown below


Click on next button to start the installation of winPcap.


Then click on I Agree button as shown in above picture. 


Click on install to install winPcap in your computer



So click on finish button to complete installation of WinPcap.

Step 2:  Installation of WinDump
To download windump Click Here


Then above click downloads the windump.exe
then goto folder where the windump.exe is present.

Step 3: WinDump tutorial

                 Open the command prompt and then change the directory to path where windump.exe is present.
Here in my example i have put the downloaded windump.exe in  D drive
then follow the steps shown below,

Open command prompt by clicking (windows+R) button and type cmd in run window as shown below then click on ok


Then the comand prompt apperas as shown below


place the downloaded windump.exe in D drive as shown below


The red circle shown in above picture denotes  the drive D and windump.exe
 Then change the directory in command prompt to drive D as shown below


Now our environment is ready to capture packets.

To see the available options for windump enter  WinDump.exe -help in command prompt



Windump commands:

Enter the following command to capture packets in above open command prompt.
  • WinDump.exe -D  This command give us the list of available interfaces for capturing packets.

So there are two interfaces available first one for capturing packets over Ethernet interface i.e when computers are connected using wired LAN and second one interface is for capturing packets when the computer connected using wireless LAN.


  • WinDump.exe : This command is to capture packets on all available interfaces in this example we are listening on both interfaces


 So after stopping the packet capture by (control+C) button the log is generated. The generated blog is circled with red as shown below,



  • WinDump.exe -i <interface number>  : This command listen on the particular interface defined by -i parameter. In this case there are only two interfaces so interface number can be 1 and 2.

          So example WinDump.exe -i 1 reads or capture packets from interface number 1. Below snapshot of read packets on interface 1,



  • WinDump.exe -i <interface number> -port <port number> :  This command give us the two options to specify the interface number and port number on which we have to capture packets. So we can capture the packets on a particular port number like 80 if we want to capture the http packets. 

 So WinDump.exe -i 1 -port 80 to capture http packets on first interface as shown below



  • WinDump.exe > <output file name>  : This command used to capture packets on available interfaces and store it into output file for further analysis.
The command WinDump.exe > packets store the captured packets in packets file as shown below.


The above snapshot captures packets and store it into the file name packets.
The captured packets file we can open in notepad and see the captured packet list as shown below


Thanks for reading WinDump tutorial.
We can find more commands related to windump using WinDump.exe -help


Read More