Thursday, April 8, 2010

Easiest way to sort a Map in JAVA


Comparator<Integer> comparer = new Comparator<Integer>() {

public int compare(Integer o1, Integer o2) {
return o1.compareTo(o2);
}
};

// hours
Map<Integer, String> hoursUnsorted = new HashMap<Integer, String>();
for (int i = 1; i <= 12; i++) {
if (i <= 9) {
hoursUnsorted.put(i, "0" + i);
} else {
hoursUnsorted.put(i, "" + i);
}
}
Map<Integer, String> hours = new TreeMap<Integer, String>(comparer);
hours.putAll(hoursUnsorted);

NTFS mount error in ubuntu

ERROR

$LogFile indicates unclean shutdown (0, 0)
Failed to mount '/dev/sda1': Operation not supported
Mount is denied because NTFS is marked to be in use. Choose one action:

Choice 1: If you have Windows then disconnect the external devices by
clicking on the 'Safely Remove Hardware' icon in the Windows
taskbar then shutdown Windows cleanly.

Choice 2: If you don't have Windows then you can use the 'force' option for
your own responsibility. For example type on the command line:

mount -t ntfs-3g /dev/sda1 media/win -o force

Or add the option to the relevant row in the /etc/fstab file:

/dev/sda1 media/win ntfs-3g force 0 0

SOLUTION

1) Run Disk identifire
sudo fdisk -l

2) Create a new mount point in your system
sudo mkdir /media/chaami

3) Mount your NTFS drive to your mount point by using ntfs-3g
sudo mount -t ntfs-3g /dev/hda1 /media/chaami -o force

Friday, April 2, 2010

Create bootable flash drive by using UNetbootin

UNetbootin allows you to create bootable Live USB drives for a variety of Linux distributions from Windows or Linux, without requiring you to burn a CD.

References:
http://unetbootin.sourceforge.net/