Friday, 11 June 2010

Change the Firefox cache location

Not necessarily the safest thing to do, I agree, but this is how I set up Firefox on my desktop PCs to avoid fragmentation and keep temporary files separate from my OS, Documents, data, and applications.

  1. Type about:config into the Firefox navigation bar and hit [Enter]
  2. Right click anywhere and select NEW, then STRING.
  3. Enter browser.cache.disk.parent_directory in the first popup box
  4. And then the location in the second popup box, for example: k:\tempintfiles
 If the entry already existed, simply right click on it and select MODIFY and enter your new directory path.

 Information taken from http://www.infohole.com/blog/computing/firefox-cache-location/

Tuesday, 23 February 2010

Java's static arg(h)s

The classic Java question when we finally manage to compile and run our "Hello world". What's with the public static void main(String args[]) line?
So our example is
public class TestArgs {
 public static void main(String args[]) {
  for (int i = 0; i < args.length; i++) {
   System.out.println("args[" + i + "] is " + args[i]);
  }
 }
}
I'm assuming you have some background knowledge here, and common sense. main( ) has to be public, since it is the main point of entry to our program and has to be easily accessible. As it is the first method that is run, it also has to be static, because we need to invoke it without instantiating its class. By this I mean that we do not need to create an object before we invoke the main method. Finally, void means that our main method returns nothing.

String args[] lets you pass arguments to your main method when you run your program. The argument(s) will be put in an array of string elements. The sample program prints all the arguments you pass via command line.

So a sample run should work like this:

javac TestArgs.java
java TestArgs uno 2 tres 4 cinco
Hello!
args[0] is uno
args[1] is 2
args[2] is tres
args[3] is 4
args[4] is cinco

Monday, 8 February 2010

technomess on twitter

Yes, technomess also on twitter now!
Small stuff like news and quick posts will go there.

You're welcome to follow using the button on the sidebar or

https://twitter.com/technomess/

Sunday, 24 January 2010

Ubuntu Linux: Install Sun's Java JDK

If you're using Debian (this works with Ubuntu as well, and may work with other Debian derivatives) and want to install Sun's Java Development Kit, and ensure it is set properly.
First, let's start by opening a terminal. Remember to use su or sudo for admin tasks.
sudo apt-get install sun-java6-jdk -y
You'll be asked to accept the accept the license terms before installing the JDK.
After all is done, type the following to test your JDK:
java -version
javac -version
Many Linux distributions come with other versions of the JRE (runtime environment). If this is the case, use the following terminal commands to choose which want to use as default:
update-alternatives --config java
update-alternatives --config javac
The first line lets you choose a JRE and the second, a compiler (provided more than one alternative is installed).

Notes: You need the nonfree/multiverse repository(-ies) enabled. OR, if you're using Ubuntu 10.04 onwards, the "partner" repository (Sun's/Oracle's Java packages have been moved to partner). Via command line, you may easily do this by pasting the following line in your terminal:

sudo add-apt-repository “deb http://archive.canonical.com/ maverick partner”
sudo apt-get update
 If you're using Ubuntu 10.10, the word in bold should be maverick; for 10.4, use lucid.

Wednesday, 6 January 2010

Java programming fun

This is an interesting problem solved using Java, but without using any fancy extra methods.

public class TestIsSubString {

/*
* Write a isSubString method that searches for a specific string within
* another string; the method must return true if the former exists in the
* latter string. Otherwise, the method return false.
*/

public static boolean isSubString(String part, String whole) {
// The hard way, with nested loops instead of whole.indexOf(part)!= -1
// Note to self: local variables MUST be init'd
int hits = 0; // flag type of variable
boolean isFound = false;
for (int i = 0; i <= whole.length()-part.length(); i++) {
hits = 0;
//isFound = false;
for (int j = 0; j < part.length(); j++) {
if( part.charAt(j) == whole.charAt(i + j) ) {
hits ++;
}
}
System.out.println("Hits = " + hits + " | len = " + part.length());
if( hits == part.length() ) {
isFound = true;
}
}
return isFound;
}

public static void main(String[] args) {
String text = "The cat in the hat.";

System.out.println("isSubString(\"cat\", \"The cat in the hat.\") "
+ isSubString("cat", text));

System.out.println("isSubString(\"bat\", \"The cat in the hat.\") "
+ isSubString("bat", text));

System.out.println("isSubString(\"The\", \"The cat in the hat.\") "
+ isSubString("The", text));

System.out.println("isSubString(\"hat.\", \"The cat in the hat.\") "
+ isSubString("hat.", text));

}
}

Saturday, 5 December 2009

Mousey Terminal

I found an insteresting software package playing with Fedora 12. It may be available for other distriburions as well.

It's called GPM.

According to Wikipedia (short and sweet description), GPM means "general purpose mouse" and it "provides mouse support in Linux virtual consoles. It is included in most Linux distributions."
If you want to know more, this is GPM's official page.

Saturday, 28 November 2009

Sitex 2009

SITEX 2009 is here again, and here's some information that can be very useful! Tomorrow (Sun 29/Nov) is the last day, so apologies for not posting this before. Fortunately, I don't need anything from it, so it slipped my mind. Plus I'm really into avoiding crowds.

Anyway, here it goes:

Other information you may get (via Google, for example) I found not as relevant and essential.
So if you're going to Sitex, check the offers and perhaps decide before you go.

And remember that some shops have Sitex offers during or even after the event (and some despite not taking part in Sitex).

Anyway, Selamat Hari Raya Haji, and happy IT, everybody.

Optimise Windows 10/11

How to optimise your Windows setup Just in case you need it. If you want a safe and conservative approach, just disable the background apps ...