Monthly Archive for January, 2010

Opinions surround iPad

Artists: “This iPad will benefit us a lot.”
Someone: “How so?”
Artists: “For starter, we need only to rent a one-by-one exhibition hall.”

“$500 is okay but what will I do with that?”
“Well, at the worst case, you can just hang it on the wall to show your photos.”

“Honey, I’m going to order an iPad.”
“What is that and how much does it cost?”
“It’s gorgeous new product from Apple which has 10′ display and it costs $500.”
“Okay, but make it two, will you?”

Someone: “With iPhone and iPad, why do we need Mac anymore?”
Software developer: “Well, you need one to develop apps for them.”

Analysts: “One year from now, students around the country will be laying on parks reading iPad.”
Students: “But… One year from now it will be another winter.”

See more on: firdausi’s post

Google Translate is very sensitive

If you haven’t heard… the translation engine of Google is very sensitive. Even a capital can make a difference.

Here is another good one…

Original:

Der Stundenpreis für Kinder unter drei Jahren beträgt 6,50 €. Darüber hinaus können folgende Pauschalen gebucht werden:

Der Stundenpreis für Kinder ab dem dritten Lebensjahr beträgt 5,00 €. Auch hier können folgende Pauschalen gebucht werden:

Translation:

The hourly rate for children under three years is € 6.50. Additionally, the following packages can be booked:

The hourly rate for children over the age of three is 5,00 €. Here too, the following packages can be booked:

See how the place of Euro currency is changed?

Eclipse plugin: Introduce Static Imports

The Static Import guide from Sun states:

So when should you use static import? Very sparingly! Only use it when you’d otherwise be tempted to declare local copies of constants, or to abuse inheritance (the Constant Interface Antipattern). In other words, use it when you require frequent access to static members from one or two classes. If you overuse the static import feature, it can make your program unreadable and unmaintainable, polluting its namespace with all the static members you import. Readers of your code (including you, a few months after you wrote it) will not know which class a static member comes from. Importing all of the static members from a class can be particularly harmful to readability; if you need only one or two members, import them individually. Used appropriately, static import can make your program more readable, by removing the boilerplate of repetition of class names.

Unfortunately, Eclipse didn’t provide a way to change all calls of static method/field to use static import. You can do ‘Add Import’ and Eclipse will create this static import for you but the other instances where this same method/field used will not be changed.

For example, if I have a class that contains static method like this:

package bug;

public class A {

	public static void bbb() {

	}
}

And other class that calls the static method:

package bug;

public class B {
	public B() {
		A.bbb();
		A.bbb();
	}
}

And I want to introduce A.bbb as static import. I can do Add Import (Ctrl+Shift+M) and what I will get is;

package bug;

import static bug.A.bbb;

public class B {
	public B() {
		bbb();
		A.bbb();
	}
}

Hmmm… not really nice, that says that I have to change all occurrence of A.bbb() in the same class (which can be many, after all the previously mentioned guide asked us only to use this import static when there are a lot of repetition of class name).

So I decide to do some hacks and create my first JDT extension plugins (yay!) that exactly do this. You can grab the plugin here (I might release the source later on GitHub):

firdau.si.introduceStaticImport_1.0.0.201001111558

Copy this plugin and drop it in the dropins folder. I must mention also that I use Java 6 for the development. I think Java 5 will also work but I make no guarantee.

With this plugin installed, you will get a new entry if you do right click in Java Editor.

And if you run it, the result is:

package bug;

import static bug.A.bbb;

public class B {
	public B() {
		bbb();
		bbb();
	}
}

Take it easy with the plugin, after all this is my first JDT extension plugin. I have tested it against the code of the plugin itself, but I can’t be responsible for anything that may happen. You may report the problem though…

Note also that the plugin currently is working only for static methods and I do think this should be provided by Eclipse in their default product. Unfortunately, I don’t think my code is good enough for a patch for such.

UPDATE:

The new code can also work with static field.

Pigpen Cipher on The Lost Symbol

Seems that Pigpen Cipher aka Sandi Kotak is so popular. Now The Lost Symbol also has it.

If only all codes are that easy!

Review: Talking Carl

Talking Carl is a simple application you can get from AppStore. Its idea is very simple. You’ll get Carl on your screen and if you touch him, tickle him, pinch him, he will react funnily. If you speak to him, it will repeat your sentence with funnier voice. It’s hilarious and both of my kids love it, even the one who is not yet 1 year.

It will be better if they add more interactions in the future though, like the background adjusted to the time of the day and something to see when we shake the device.

Anyway… it’s highly recommended.