Friday, June 14, 2013

How To Triple Boot (Windows XP/Windows 7/Ubuntu)

Many of us want to use more than one OS on laptop or PC
One option here is to use some Vmware, Virtualbox or some other software like this. These softwares runs other OS on top of the current running OS, like you can run Ubuntu on Windows 7, but do not get some functionality with this option. Now if you do not want to do this, other option is to install other OS along with the current OS, so when you start your machine you can OS to boot from.
Click here to know how to do this.


See Also : Useful Run Commands
Ads :
Ads :
Electronics, Cars, Fashion, Collectibles, Coupons and More Online Shopping | eBay
www.ebay.com | www.ebay.co.uk | www.ebay.de

How to change Facebook default theme

Have you ever thought how good it would be if you could change default theme of Facebook. Yes, now you can do this, and do it very easily.
You Just have to use the script provided below..
Instructions :
If you are using IE then just open Facebook and copy paste the script in address bar and press enter.
If you are using Firefox Create a bookmark button on bookmark bar with the script as loaction (To add bookmark to bookmark toolbar goto bookmarks->bookmarks Toolbar). Now open Facebook and click on bookmarked button. If you cant see bookmarks toolbar select View->toolbars->bookmarks Toolbar. This is just a test version that changes all the colors.
NOTE : you can enter name of color or hex code in prompt box. If you like it please click on the ad below.

javascript:change();
function change()
{
    var x = document.getElementsByTagName('title');
    x[0].innerHTML =  "ZZ Script | "+x[0].innerHTML;
    var col = prompt("Enter Color");
    x = document.getElementsByTagName('div');
    var i=0;
    while(i < x.length)
    {
 x[i].style.backgroundColor=col;
 x[i].style.borderColor=col;
        i++;
    }

    x = document.getElementsByTagName('li');
    var i=0;
    while(i < x.length)
    {
 x[i].style.backgroundColor=col;
 x[i].style.borderColor=col;
        i++;
    }
    x = document.getElementsByTagName('ul');
    var i=0;
    while(i < x.length)
    {
 x[i].style.backgroundColor=col;
 x[i].style.borderColor=col;
        i++;
    }
    x = document.getElementsByTagName('a');
    var i=0;
    while(i < x.length)
    {
 x[i].style.backgroundColor=col;
 x[i].style.borderColor=col;
        i++;
    }
    x = document.getElementsByTagName('span');
    var i=0;
    while(i < x.length)
    {
 x[i].style.backgroundColor=col;
 x[i].style.borderColor=col;
        i++;
    }
    x = document.getElementsByTagName('input');
    var i=0;
    while(i < x.length)
    {
 x[i].style.backgroundColor=col;
 x[i].style.borderColor=col;
        i++;
    }
}
Ads :
Electronics, Cars, Fashion, Collectibles, Coupons and More Online Shopping | eBay
www.ebay.com | www.ebay.fr

Monday, January 21, 2013

File IO in Android

This article shows how to make an application that can write to external storage of android device. First off all we create a new project in Eclipse, say WriteFile.
Now, we will use the method getExternalStorageState() of Environment class to get detail about the external storage state. It will return a string showing the state of external device.
public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        String status = Environment.getExternalStorageState();
    }

}
We check if it is anything else than Environment.MEDIA_MOUNTED then we terminate the app with appropriate message else we continue.
 

        String status = Environment.getExternalStorageState();
        if(!status.equals(Environment.MEDIA_MOUNTED))
         return;

Now, we know we have external storage and it also has read/write permissions. Next is to get a File object referring to the external director. Now depending on the device this may vary. So we use getExternalStorageDirectory() method to get the File object and save reference in sdcard variable.
        File sdcard = Environment.getExternalStorageDirectory();

Now we want to create a file, say a dummy.txt in the directory. To do this first obtain a reference to that file using File(String name) constructor. Then we use character streams to write data to file (We can also use the Byte Streams). Create a FileWriter to write data to file and a FileReader to read data from the file. In both constructors pass the File object of our target file. Write() method of FileWriter is used to write data to file.
        char [] buf=null;
        File newfile = new File(sdcard.getAbsolutePath()+"/dummy.txt");
        FileWriter fileWriter = new FileWriter(newfile);
        fileWriter.write("This is a demo");
        FileReader fileReader = new  FileReader(newfile);
        buf = new char[50];
        fileReader.read(buf);
Now the data from file is in buf array. We can use it the way we want now. The Full Source code is available here .

Notes : Creating File object generates FileNotFoundExceptiion and FileReader and FileWriter Both generates IOExcption, so be carefull to surround the statements with try/catch block.

Writing to external storage requires the WRITE_EXTERNAL_STORAGE permission. In a future platform release, access to this path will require the READ_EXTERNAL_STORAGE permission, which is automatically granted if you hold the write permission.



Ads :
Electronics, Cars, Fashion, Collectibles, Coupons and More Online Shopping | eBay
www.ebay.com | www.ebay.ch | www.ebay.com.my