Skip to main content


Showing posts from 2009

Logging needs some lazy evaluation

If it's one situation where lazy evaluation is needed in Java, it's logging. Until something better comes up and we'll have logging injected via AOP or something similar, a log message will be just the result of an extra line in our Java files, and this is a problem.
A normal log message is something like this:
log.fine("Some parameter is:" + someVariable);
This looks quite harmless especially since we know that depending on the log level, our message might be saved or not.
But say we have an expensive function:
log.fine("The extra informations starts at" + reallyLongLastingFunction());
The problem above is obvious: the log string will be built no matter what and our reallyLongLastingFunction() will be called each time, including when the log won't actually be saved.
The solution to this is to pollute your code with something like:
if(log.isLoggable(Level.FINE)){ log.fine("The extra informations starts at" + reallyLongLastingFunction()); }
This way…

Official NetBeans build with Romanian localization

Head over to the NetBeans download website and notice the language popup also has Romanian now.

More info about the localization on the Joseki Bold dedicated page.

Aversion towards localization a sign of technological barbarism

English is obviously the lingua-franca of everything computer and computer-science related. Having a single language does help everybody since it easily allows people to communicate and exchange ideas.

The side-effect of using English for everything computer related is that it decreases the focus on using the local language for computer-related discussions. Or, if the local language is used, it is filled with English words ! The more complex the discussion becomes, the more English is used until it becomes almost easier to use English full-time and just revert to the local language when some explaining is required using examples. I think this is the reason some multinationals revert to English as the official language -- for computer related workers, it doesn't affect the productivity, especially since people of different nationalities might end up working together.

Well, this means that while English has evolved to be a technology-centric language, most of the other languages eithe…

Green software

Long ago I wrote a blogpost where I was mentioning that for an always-on (wall-plugged) workstation, the latest (then) fad of lowering power consumption is not that essential since, as a developer, all you care about is overall machine speed to get the job done and the cost of power is negligible compared to the cost of on developer hour (and then rent, administrative overhead, etc.)

Well, that is one aspect. The other aspect is when power consumption is important. This is clearly a major factor for large datacenters where a big chunk of their cost is power (for the machines and cooling) so they keep a keen eye on performance per watt. The specifics of the business are different there: you don't have developers on top of each machine, but you have hundreds / thousands of machines providing some service to remote users. The cost of maintaining that datacenter determines the cost you sell your services to users and your overall competitiveness.

Another scenario I've personally not…

Busy bee

( makes one smile once in a while..)

The most complex simple GUI: VirtualBox snapshot handling

It's amazing how the guys doing Virtual Box (purchased by Sun and now by Oracle) have managed to screw up so badly their snapshot mechanism and specifically their GUI allowing the user to handle it:

1. Let's start with the easy pickings: they support linear snapshots only. What did they select to display this? Obviously not a list, but a tree !

2. Their snapshot documentation is less than 1 page in the PDF help file. Out of this, half is spent explaining how to "take" a snapshot which is probably the easiest thing they support. A quarter of the page includes a scary note about possible data loss which references some VBoxManage interface which is some script that has nothing to do with the GUI.

Also, their documentation doesn't have a single screenshot or at least pictures of the buttons users are supposed to press.

In the remaining quarter of the documentation they briefly mention revert and discard snapshot.

At no point do they bother explaining how their mechanism …

Matrix thoughts

AI lemma (anti-Matrix): We do not live in a simulation of a similar universe as a simulation will consume more energy than a real existence.

A corollary would be: The universe simulating our existence might be so different that the above lemma doesn't apply.

iPhone Location Manager taking forever

On the iPhone, the Location manager that provides the GPS location is a nice API to use.

It does have some issues though: CLLocationManger doesn't work if it's called from another thread !

I first noticed something was really funny when my delegate wasn't being called at all.

Neither – locationManager:didUpdateToLocation:fromLocation: nor – locationManager:didFailWithError: was called and my application was just waiting there forever for some GPS information.

My first thought was that it was some issue with my memory management as I wasn't holding a reference to the location manager in any class, just in the method where it was created. But still, it didn't work.

Then, I though it was a problem about the threading model being used (I waited for the GPS location in another thread in order not to block the GUI). Sure enough, that seemed to be the problem, and at least another person complained about it. Not sure it is a matter of threading or a matter of memory pool be…

Developer surprise on OSX

I had a strange bug in the OSX Address Book application: I had a rule that included all the address cards not present in any other rule.

This worked initially, but after an update, Address Book got confused and entered into an infinite cycle (it was probably trying to ignore the cards in the rule itself and then went on to resolve that recursively).

Anyhow, the good thing was the application crashed only if I scrolled on top of that particular rule. And since I had quite a lot, I was safe to open the application at least.

But, still, having a semi-buggy application isn't fun to use. So I went and looked at the Address Book file format which seemed to be some sqlite3 database, but I couldn't fix the problem from there.

To my surprise Apple has a public API for the Address Book !

So I wrote these short lines of code:
ABAddressBook *AB = [ABAddressBook sharedAddressBook];

NSArray * groups = [AB groups];

for(int i=0;i<[groups count];i++){
ABGroup * group = [groups ob…

My Slicehost / VPS analysis

Fist time VPS user

Starting a few months back, I have a VPS from Slicehost. It's the cheapes one they've got, with only 256MB RAM.

I never worked on a VPS, I only had either dedicated physical servers in the company datacenter (at the previous job) or CPanel-based hosted accounts (for some other clients).

All in all, a VPS is just as one might expect: almost like a normal server only slower.

And the slowness is starting to bug me a bit, specifically the problem that I don't know how slow is it supposed to be.

The fixed technical details from Slicehost is that you'll have 256MB RAM, 10GB or disk storage and 100GB bandwidth.

Now there are 2 issues here. One which seems quite obvious and another one I'll introduce later.


OK, the 1st problem is that you don't know how much CPU cycles you are going to get. Being a VPS means it runs on some beefy server (Slicehost says it's a Quad core server with 16GB of RAM).

According to Slicehost's FAQ:

Each Slice is assigned a…