Symbolic link (aka symlink or shortcut in windoze)
ln -s /usr/java/jdk1.5.0_09/bin/java /usr/local/bin/java
ln -s /usr/java/jdk1.5.0_09/bin/javac /usr/local/bin/javac
ln -s /usr/java/jdk1.5.0_09/bin/javadoc /usr/local/bin/javadoc
Monday, October 02, 2006
linux: How to find where a program is located
To find where firefox is installed, type:
which firefox
To find where java is installed, type:
which java
which firefox
To find where java is installed, type:
which java
java/linux: Installing JDK/JavaSE
From command prompt, su as root.
create dir /usr/java
place jdk-1_5_0_09-linux-i586.bin in /usr/java
chmod 777 jdk-1_5_0_09-linux-i586.bi
From /usr/java type
./jdk-1_5_0_09-linux-i586.bin
JDK is now installed in /usr/java/jdk1.5.0_09
create dir /usr/java
place jdk-1_5_0_09-linux-i586.bin in /usr/java
chmod 777 jdk-1_5_0_09-linux-i586.bi
From /usr/java type
./jdk-1_5_0_09-linux-i586.bin
JDK is now installed in /usr/java/jdk1.5.0_09
linux: How to uninstall a (non-rpm) program
User brute force uninstall :
rm -rf /thedirwhereyourprogramresides
rm -rf /thedirwhereyourprogramresides
Sunday, January 22, 2006
java: Generating unique sequence of numbers
Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
//generate a unique sequential number. We derive this from the
//number of milliseconds since 00:00:00 GMT Jan. 1, 1970 using //calendar object.
String runNumber = new Long(calendar.getTime().getTime()).toString();
System.out.println(runNumber);
//generate a unique sequential number. We derive this from the
//number of milliseconds since 00:00:00 GMT Jan. 1, 1970 using //calendar object.
String runNumber = new Long(calendar.getTime().getTime()).toString();
System.out.println(runNumber);
java: Sorting Dates in a List (Collection)
final String DATE_FORMAT = "dd/MM/yy"; DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); dateFormat.setTimeZone(TimeZone.getDefault()); //we store date as time in milliseconds. //getTime() returns the number of milliseconds since //midnight of January 1, 1970. This method is also very //useful for generating a unique sequence of numbers. Long date0 = new Long(dateFormat.parse("29/01/1995").getTime()); Long date1 = new Long(dateFormat.parse("13/12/2007").getTime()); Long date2 = new Long(dateFormat.parse("01/04/2000").getTime()); List dateList = new ArrayList(); dateList.add(date0); dateList.add(date1); dateList.add(date2); Collections.sort(dateList); //Get wrapper Long from list. convert Long to String. //Convert String to primitive long. Convert primitive long to Date. Date dateLatest = new Date(Long.parseLong(((Long) dateList.get(dateList.size()-1)).toString())); String dateLatestString = dateFormat.format(dateLatest); System.out.println(dateLatestString);
javascript: Sorting Date in an Array (Collection)
function getDateLatest()
{
var date0 = new Date('12/31/2005');
var date1 = new Date('11/29/2007');
var date2 = new Date('01/13/1999');
var dateArray = new Array();
//we store date as time in milliseconds.
//getTime() returns the number of milliseconds since
//midnight of January 1, 1970. This method is also very
//useful for generating a unique sequence of numbers.
dateArray[0] = date0.getTime();
dateArray[1] = date1.getTime();
dateArray[2] = date2.getTime();
dateArray.sort(sortNumber);
var dateLatest = new Date(dateArray[dateArray.length - 1]);
alert(dateLatest);}
//By default, Array sorts alphabetically. To get it to sort
//numerically, we write a function that compares numbers.
function sortNumber(a, b)
{
return a - b
}
Subscribe to:
Posts (Atom)