Skip to main content

Posts

Showing posts from September, 2013

how to backup and restore database in mysql

MySQL is one of the most famous opensource database. To transfer the database from one system to another you need to take the backup of the database from the source system and restore it on the target machine.  In this post i am going to explain how to backup and restore a database on MySQL database. Ads by Google  First you need to install the MySQL GUI tool called the MySQL Query browser for make this process easier. You can download it from here . Steps for backup a database. Step 1:            Login on MySQL Query browser. Step 2:            Click the Tools option on the menu bar and choose MySQL Administrator. Step 3:          Select the Backup option from the MySQL Administrator window.     Step 4 :         Click the 'New Project" button at the bottom of that window and select the database / databases you want to backup and add them into the backup content. Step 5:          Click the "Execute Backup Now" button at the bot

how to save data using hibernate

In this post i explain how to insert data into MySQL database using Hibernate with the help of NetBeans IDE. First you need to create a database and a table in the MySQL database. While creating the table keep in mind that, the table must contain a primary key field. I use the following query for create the table. create table test_table (id int not null primary key auto_increment,name varchar(50), email varchar(50)); Ads by Google Now you need to follow the steps given bellow. Step  1 :              Open up  the NetBeans IDE. Step  2 :              Go to the services and expand the database. Step 3:            Now right click MySQL server and choose connect.  Step 4:           Now you need to enter your MySQL username and password and choose the database to which you want to insert data. Right click the database and choose connect.  Step 5:           Create a new Web Application and choose the hibernate framework and choose the database connection

method overloading in java

Method overloading is one of the most important feature of the java programming language. One method of achieving  polymorphism in java through method overloading. Definition: Multiple occurrence of a method / function in a class with difference in parameter type and (or) difference in  number of parameters is called method / function overloading.  Consider the following example class OverloadTest { int a; String b; public void getValues() { a = 10; b = "no arguments"; } public void getValues(int a) { this.a = a; b = "with integer arguments"; } public void getValues(String b) { a = 20; this.b = b; } public void display() { System.out.println(b); System.out.println("Value of a ="+a); } } public class OverLoadDemo {

how to save data in android

Saving and retrieving of data is one of the fundamental part of an android application. In android you can save your data by using any one of the following ways.  1. Using shared preferences 2. Save into files. 3. Save into SD card. 4. Save as static data. 5. Save into sqlite database. Using the SharedPreferences is the easiest way of saving data in android. Here data is saved using key-value pair. This method is suitable for saving small amount of information such as login details, password's etc.                  Learn More about SharedPreferences You can also save your data into a file in your phone memory. You can use this method of saving for those applications which closely work with the android OS. This is a better method of saving but the application fails to install or to save data when the device internal memory is too low.               Learn more about Save data into files A better way of saving large data is to use the external SD card. By

save static data in android

In some situations you need to save the data for your android application statically. Which means you need to save the data during the design process of your android application. For example the information for the help topic, licence agreements for the application etc. So in this post i explain how to save data statically in android. Step 1: Create a new folder named " raw " under the " res " folder.  Step 2 : Create a text file of needed contents with file extension " .txt" and paste it in the " raw" folder. Step 3: Create an object of " InputStream " class with the " getResources() " and " openRawResources() " methods.    Example:                InputStream im = getResources().openRawResource(R.raw.myfile); Step 4: Obtain an object of " BufferedReader " class using the object of " InputStream ".   Example:                BufferedReader br = new BufferedReader

enable wifi hotspot in windows 7

To share internet connection with others through wifi hotspot follow the steps given bellow. Before proceeding make sure that 1. You are connected to the internet through the LAN cable (Ethernet connection ). 2. Your wifi adapter in on (enabled). Step 1:             Go to Control Panel. Step 2:            Choose Network and Internet  Step 3: Choose Network and Sharing center            Step 4 : Choose change adapter settings Step 5: Choose the properties of the currently active internet LAN connection Step 6: Choose the sharing option and tic the two options Step 7: Go back and choose Set up a new Connection or Network Step 8: Choose Set up a wireless ad hoc network and click Next Step 9: Again click Next and provide a Network name and Security Key and click Next Now you are successfully set up your wifi hotspot and for checking it click the network connection icon on the windows toolbar and you can see that the wifi hotspot network is

save data to sd card in android

In android you can save data by using the shared preference and files. But if the data size is much large, then using files or shared preferences is not a suitable option. You can save a large data from an android application into the external sd card available in that device. By using the external sd card for saving the large data, you got the following advantages. 1. You can share the app data to other devices. 2. You can save data of any size by expanding the external sd card memory size. 3. You can easily backup your data. In an android application for saving data into the external sd card you have to follow the steps given bellow. Step 1: Obtain the path of the sd card Use the getExternalStorageDirectory() method for getting the full path of the sd card. For real devices it return "/sdcard" and "/mnt/sdcard" for android virtual devices(AVD). Example:   File sdcard = Environment.getExternalStorageDirectory(); Step 2: Create a directory on t

"please correct the errors on this form" adsense error simple solution

Many of the bloggers now facing the problem with their adsense widgets. Whenever try to add the new  adsense link unit using the blogger widgets, it shows the error " please correct the errors on this form " as shown bellow. In blogger you can add the adsense units in two ways. First one is adding the adsense using the blogger widgets(Most of the beginners doing this) and the second method is to obtain the adsense code from the adsense login page and place it into the targeted position on the blog. To improve the revenue from adsense you have to place the appropriate ad unit into the right position. The adsense link units are very important for increasing the adsense revenue. So due to this error many of the bloggers are unable to place the link units.  Here is the solution for the problem. 1. Login into your adsense and blogger account. 2. Now make sure that only two adsense widgets (units) are present on your blog, this is because Google allows onl

Save data into file

To save data into file in an android application, you have to follow the steps given bellow. 1. Create an object of the FileOutputStream class using the openFileOutput method.     Example :                      FileOutputStream fou = openFileOutput("text.txt", MODE_WORLD_READABLE);        Here text.txt is the name of the file. You can use any of the file opening mode    a.    MODE_PRIVATE  :  File is accessible by only the application that create it.    b.    MODE_APPEND :  Appending an existing file.    c.    MODE_WORLD_WRITABLE : Allow write permission to all the applications.  2. Get an object of the OutPutStreamWriter class using the FileOutputStream object.     Example:                  OutputStreamWriter osw = new OutputStreamWriter(fou); 3. Write the data using the write() method.    Example:                  osw.write(Message); 4. For reading the data from the file, first you need to create an object of the FileInputStream class.    Example: