Wednesday, December 24, 2008

disposable e-mail account

If you are bored of giving your e-mail address to lousy forums/websites so that they can fill your inbox with lots of spam, then try mailinator which offers a disposable e-mail service. Give a e-mail to the lousy website when you sign-up and then go to mailinator and check your e-mail (you don't need to log in with a password). Do the confirmation thing through the e-mail and voila! You didn't have to give your usual e-mail for a stupid confirmation of a stupid website/forum.

Monday, December 22, 2008

reprogram your mouse buttons via x-mouse

x-mouse I have a Logitech cordless optical mouse. I recently tried to reprogram its buttons for new functionality, but Logitech recommends the usage of native windows vista mouse drivers instead of offering a more functional one, so here I am, googling for an application that'll give me the desired functionality. Then, I found X-Mouse. It has every option I need when I tweak my mouse buttons and a very low RAM consumption. You can change the functionality of left, right, middle, left thumb, right thumb button into one of the offered functions (like "close application", "copy/cut/paste", "send a custom keystroke sequence", "launch any application", "double click" so on) . I highly recommend it.

Thursday, December 18, 2008

varargs in javascript

I'm learning Javascript in my spare time. So when I learnt the possibility of using varargs in Javascript, I wanted to share it. Here we go;

You probably know how functions are defined in Javascript:

function transform(){
// write stuff to html below
document.write("transform function initiated");

It is, of course, possible to define functions with arguments such as;

function transformWithMessage(message){
document.write("transform function initiated: "+message);

Now, I'll show functions with indefinite number of arguments;

// defined similarly to a function with no argument
function transform(){
document.write("transform function initiated: ");
// arguments array holds any argument sent to transform() function
for(var i=0; i< arguments.length; i++)
document.write(arguments[i]+" ");

A call such as transform("first lock engaged", "second lock engaged") will result in an output such as transform function initiated: first lock engaged second lock engaged . Similarly, a call such as transform("first", "second", "third") will result in an output such as transform function initiated: first second third .

Friday, December 5, 2008

javascript plug-in for eclipse

My favorite IDE for Java is Eclipse. So when I searched for a development environment for javascript, I checked if there's a javascript plug-in for Eclipse and the answer is yes. The installation is a piece of cake:
  1. Eclipse > Help > Software Updates > Available Software
  2. Type javascript in the search area
  3. Tick the checkbox next to "Javascript Developer Tools" with latest version
  4. Click Install

Tuesday, December 2, 2008

gaudi: google audio indexing and in quotes

Google's audio indexing service basically scans video content (from Youtube) for extracting audio data from it. Later, it applies a speech recognition algorithm for extracting words from obtained audio data and then index this textual data; GAUDI is not as interesting as it should be due to the spesific catalogue that it works on. For now, it's limited to election material of US presidency.

Another addition to Google Labs is "In Quotes" which's an application less ambitious than GAUDI. In Quotes can search words from newspapers and magazines and it is -again- limited to election material. Interested to find Sarah Palin's words on Turkey. Then visit In Quotes.

Tuesday, November 18, 2008

scanner class

Java 5 introduced Scanner class which has a functionality similar to the Reader in addition to the StringTokenizer class. Scanner can read input from a File, InputStream and ReadableByteChannel and can tokenize this data. It is more powerful than StringTokenizer, because it can parse primitives directly instead of taking them as String and parsing them to the corresponding primitive type.
Assume that we want to take the user input which consists of two Strings (e.g. name and last name) and an integer (e.g. student number).
Let's see how Scanner class works:
First we will link scanner to some input source.

// I link Scanner to System input.
Scanner scanner = new Scanner(;

Then Scanner will take the input from user and parse the input values to desired variables.

String name =;
String lastName =;
int studentNumber = scanner.nextInt();
// above I parsed anything I needed, below I'll close my Scanner.
/*Scanner closed. If the input source implements Closeable interface, it will be closed after that method call.*/

It is also possible to parse numbers with base other than decimal.

scanner.useRadix(2); // I'm setting Scanner to take a binary number as input
int number = scanner.nextInt();
// assume that the input was "101" which's "5" in decimal base
// then number is now "5".

Sunday, November 16, 2008

cooler for-loops

JDK 5 offers an interesting enhancement for for-loops. With the new feature, for-loops are less error-prone and with a higher readability. You can convert your for-loop from
for(int i=0; i < integerArray.length; i++) {
System.out.println( integerArray[i] );

// read below as int i "in" integerArray
for(int i : integerArray){
System.out.println( i );

Better, huh? Same stuff works with object arrays too.

Tuesday, October 21, 2008

varargs in java 5

I'm going to talk about one of the minor enhancements of Java 5; Varargs. Normally, if you are going to pass an arbitrary number of elements (object or primitive type) to a function, you would put them into an array and then pass the array to the function.
Assuming we have a concat() function such as

String concat(String[] tokens){
String result = "";
for(int i=0; i<tokens.length; i++){
result += tokens[i];
return result;

We will put all the Strings to be concatanated in an array and pass them to concat(). i.e. concat( new String[]{"come", "on", "eileen"} ) .

With Varargs, it is now possible to skip the array creation and pass the elements (again, object or primitive type) directly to the method. You change the concat() function so that it can accept them. String concat(String[] tokens){ becomes String concat(String... tokens){ and now you're free to pass any number of elements to concat() function without worrying about an array.
i.e. concat("come", "on", "eileen"); concat("dexymidnightrunners");

Monday, October 20, 2008

video lectures

Here you can find an awesome video lecture site that's mainly focused on computer science. Every lecture video here has a powerpoint presentation screen next to it and that works great. Highly recommended!

linus torvalds' blog

Linus Torvalds begin recently to blog. Check it here.

Wednesday, October 15, 2008

software holds cell phone calls while you drive

A Canadian company developed a software that will hold incoming calls during your drive. Required implementation is rather straightforward. Using the cellular network structure, the approximate location of the driver can be found. After that, you pick a time granularity (minute?) and do the math. If in the first minute the driver's on location X and in the second he's on location Y,then
distance(X, Y)/1 > driving_speed_threshold
will tell you if the driver is on the move. Notice that "1" stands for the difference between time.

For the details of the news, you can check here.

Friday, October 10, 2008

windows services

Black Viper offers a nice site with lots of information on Windows Services. If you're interested in freeing up some of your ram by closing unnecessary services, I'd recommend to take a look at the site. The site even contains reg files which apply the optimal service settings with your single click.
And no, Black Viper is not a 11 year old guy as you extrapolated from the nickname.

Thursday, October 9, 2008

operation aborted error of maxthon 2

I was getting "operation aborted" error from maxthon 2 everytime I hang on facebook.
Here's the cure:

-open maxthon setup center
-choose "add hunter" from the left tab.
-click on "edit filter list" link of "content filter"
-add "facebook" to the white list