Tuesday, February 23, 2010

Nobody reads the fine print (for mobile widgets anyhow)

I've gotten used to skim the legalese things that you agree to upon any account creation, etc. You know, those things that have a textbox next to them and the submit button is disables until you check them.

Anyhow -- here is a nice piece from jil.org, a developer portal for mobile widgets. I used to do Konfabulator (now Yahoo) widgets long ago and I though I should see what's with these new "mobile" widgets. (The terms PDF is here ).
   7.  JIL’s right to use User Content
         1. With the exception of personal information, you hereby grant JIL a perpetual, unlimited, royalty-free, worldwide, non-exclusive, irrevocable, transferable license to run, display, copy, reproduce, publish, bundle, distribute, market, create derivative works of, adapt, translate, transmit, arrange, modify, sub-license, export, merge, transfer, loan, rent, lease, assign, share, outsource, host, make available to any person or otherwise use, any widgets or other content you provide on or through the Developer Site or which you send to JIL by e-mail or other correspondence including, without limitation, any ideas, concepts, inventions, know-how, techniques or intellectual property contained therein, for any purpose whatsoever and in any manner (“User Content”). JIL shall not be subject to any obligations of confidentiality regarding any such information unless specifically agreed by JIL in writing or required by law. You represent and warrant that you have the right to (a) grant the license set out above and to (b) upload the User Content on the Developer Site. You acknowledge that the license set out above includes the right for JIL to make the User Content available to a Sponsor and other entities with which JIL has contractual arrangements for further distribution of the User Content.
Now, this paragraph starts like a standard paragraph on many sites where they basically say the want to be legally allowed to display your product. So they need to be able to host, distribute and market the widget. Sounds nice. Obviously their partners need to be able to do that too. Ok, pretty standard so far...

But here is the interesting part: they want to be able to modify your widget and create derivative works! So this is not the standard "hosting" agreement -- you are actually granting them a license on your source code to do as they please. If you combine this with the fact that every agreement of this kind (and obviously JILs too) has some indemnification clause, you get an interesting situation.

An interesting software would be one to track all these agreements. I think that by the end of your lifetime, it would be pretty scary to look at the dependency graph all these agreements have created between you and sites/companies, partner companies, merged companies, owners of bought companies.

In other words, if we define this "agreement distance" in the spirit of the Erdos number , I'd say that over a 30 years span the agreement distance becomes 1 for any reasonably active individual with any other major company or website.

Friday, February 19, 2010

OSGi has won

Although NetBeans' module system was on-par with OSGi, greater industrial support meant OSGi always looked like a better pick to outsiders.

Starting a while back I saw OSGi as the clear winner. Especially when Glassfish 3, an major Sun project picked OSGi instead of the NetBeans Module system, it was obvious OSGi was winning even inside Sun (although they were reluctant towards giving OSGi a too big stake in the upcoming Java 7 module system).

In the meantime NetBeans is getting native support to run OSGi bundles as well as getting ready to run inside an OSGi container.

Oracle wanted a common IDE extension API starting at least 2002 when they sumitted JSR 198.

Now, owning Java and NetBeans itself, they have it really easy to define the roadmap for both.

I estimate that NetBeans will be able to run inside an OSGi container by the end of 2010. We'll also see official NetBeans plugins distributed as OSGi bundles instead of NetBeans modules. In the end the NetBeans module system might become a deprecated subsystem.

--
Note: This is just my take at technology analysis. I have no inside information obtained via my NetBeans Dream Team membership or from Oracle.

Monday, February 08, 2010

Slicehost as a build server

I'm using a Slicehost server for over an year now to host my build server and my slice seems to be getting slower.

Here is the graph for one of the projects:


The build initially took about 30 minutes, then I had a period where I jumped to about 70 minutes. This lag was entirely my unit-test and after some refactorings I took is down again to about 30 minutes, which is decent.

Now take a look at another project:


The difference is that the project took all long about 40 minutes, and now I have spikes of 3-4 hours !

What's the catch: well, the first project is taking so long during unit tests since I have a lot of GUI tests, where the code has to sleep and give the interface time to repaint, etc. So, although the time is 30 minutes, it's mostly waiting for the GUI (inside an Xvnc instance) to paint.

The second project though does a massive build where I just produce JARs and don't run any unit tests. It's massively IO-bound.

So, the way I see it, in the past 2 months or so the machine I'm running my VPS on, has been getting slower doing IO request.

IO has always been a problem with my limited VPS experience. First, I got rid of this by moving from the 256mb slice to the 512mb slice since apparently I was just trashing the swap file.

But now, I'm not so certain it's a RAM issue anymore. The 2nd compilation just needs to touch the disk so it doesn't matter how much RAM do I add, after the minimal amount needed for ant and javac.

I'm starting to think I should move the build server onto an EC2 instance. This way I could use a smaller slice just to run Hudson, but do the actual building onto a bigger EC2 instance. I'm not certain it will be cheaper though.

Later edit: The discussion here is continued with my post about using EC2 instances as build servers.

Thursday, January 28, 2010

Oracle and Java

Since using Google is faster compared to loading the saved Javadoc, I always read the JDK Javadoc online. There was something odd today - the favicon (what's a favicon?) looked a bit off: it's a red square with a white O in the middle.

Heading off to http://java.sun.com/ I see that the header is different. It says "ORACLE: Sun Developer Network (SDN)". So that's where the red favicon comes from !

Well, I guess it will take some getting used to. I don't really know anything about Oracle, but I really liked Sun's logo much more.

Monday, January 18, 2010

Linux: The last 10% will take another 10 years

Note: The blog post bellow was written on the 6th of December 2007, but I never published it. It seems to still be valid today and given that the laptop I'm talking about went dead and was sent for repairs last week (but most likely they won't be able to fix such an old model), I'm finally publishing it now as a remainder of what that little machine had to endure :-)



Everybody in the Linux world will tell you that Linux has GoodEnoughTM hardware support. Meaning of course that all the good stuff is missing but that your system is fairly functional.

Which is fine ! I mean, as a programmer why would I want to squeeze 100% of my machine ? We can always buy another one which will be even faster but, due to the "LackOfLinuxDriver compensating factor", will fell just like the old machine would have felt with proper drivers.

That is, bad hardware support makes you feel on today's hardware as if you are using a refurbished machine.

Ok, enough ranting. The reason I'm evil in this post is because Linux killed my laptop's battery.

I have an old Dell C840 which had a battery that only lasted about 30 minutes. So I spent about a quarter of the laptop's current value on a new battery (the Dell has two battery bays which is kinda cool).

So now, with the new battery I had about 4 hours off the grid, which was acceptable.

That is, until one night when I just let my laptop with the lid closed but, somehow, it didn't suspend/hibernate as it normally did. Instead it kept on going and going and going upto total and 100% battery drain.

Strangely, the old battery (Li-Ion), after being at 0% and about 16 hours of charge recovered and it's now back to the regular 30 minutes.

But the new battery, after days of charging is dead. Hello LI-Ion deep discharge ! Now, why in the world didn't Linux shutdown my machine when it was clear the power was running out ? Or course, some weird hardware support-related fluke. Do I care ? No: my new battery was killed.

This is sadly a losing position for Linux as they can't write those drivers in some situations (due to so called evil corporations) but it sure makes me mad to use less then what my hardware has to offer...

Another example: Linux (Ubuntu) on a MacBook Pro. It's like the ugly duckling ! The scenario is like this: I use OSX with the nice fonts, Expose, I reboot, I select Linux and then I see the horror. It's as if the machine was reduced to a cheap NoName laptop: the image doesn't "look" good, you see pixelated things, then you see ugly fonts, then you see windows that barely drag/refresh due to lack of a proper driver, then you install the binary-blob-driver from nVidia and notice that the "effects" don't hold a candle to OSX' experience (and some more pixelated stuff).

It's this last 10% threshold that I'm talking about here. Sure, hardware works 90% of the cases, but I sure would like to know I'm using the full power of my machine. Gnome does give you some GUI but I sure would like to see fonts I can stare at for 10 hours a day or some decent effects that aren't there just to show what OpenGL does.

In conclusion: I really like Linux and the reason I bought a Mac was because I needed an "unix" with proper hardware support. Because Linux still doesn't have a place as the main machine.

Linux on a headless server ? Sure ! Linux on my main machine I have to stare at the whole day: not if I have a choice.

Thursday, January 14, 2010

I wonder how much does AllegroGraph cost

Although I'm not a big RDF user, I did notice that some SPARQL queries take some time on my machine so I cannot but ask myself how much faster would it run using AllegroGraph ?

Franz Inc does provide a free edition that's limited on how many triples you may store so at some point it should be easy to run some benchmarks.

But -- how much would the AllegroGraph enterprise license really cost to get rid of the triples limitation ?

Like any company that is (or thinks it is) selling an expensive item, the price is not listed, all you are given is a phone number.

I wonder how many customers are they losing this way because people assume the product is way more expensive then it actually is. Because I won't pay 0.5 million dollars to get the enterprise license. Then again, what do I know, it might be 5 mil plus  :-)

Monday, January 11, 2010

Personal growth a purpose in itself ?

2 or 3 years ago I used to read some of an internet-famous person's blog posts. They were mostly economical and entrepreneurship related and I liked the way they were written.

Ever since, I stopped reading his blog since his personal growth "road" has taken him into some strange areas I don't really care to follow.

For example, there were some traces of some kind of mysticism, and then he decided he should separate from his wife, then try polyamory and this year he's going into BDSM !

I know the last part since I re-open once in a while his link to see if something interesting might pop-up. Imagine my surprise when I read his latest blog post...

Of course, it could also be some cultural blocks that deny me to see the "value" in what he's is trying to achieve, but I think at some point personal growth might be able to turn malign.

Humans aren't really built for infinite growth given the simple limitation that people die. So, it might be that trying too much to "grow as a person" leads to desensitizing towards normal life. Which means that it's possible to start using more extreme "personal growth" experiences to make up for it.

Go see Avatar

Yesterday I watched Avatar in a proper cinema with 3D glasses. The experience was almost surreal and while I had already read the book long ago, the adaptation was decent.

But really -- the 3D part of the movie is where all the magic is. Well worth the ticket price !

Monday, January 04, 2010

No such thing as a bad technology

The human race will adapt to the tools and technologies it has developed. That's why the cell phone companies for example just have to play a long term game and wait: in time fewer people will be sensitive to their cell phone radiation.

It's just another level in the "adapting to the environment" game. Even if this time the environment is man-made.

Wednesday, December 09, 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 our string creation and expensive function call is done only if the log really is needed. But this adds extra boilerplate in the code as well as makes you maintain the log level (for example what if I change the line to log.finer -- I have to update the if).

If all the log methods would have lazy evaluation this problem would go away -- the code won't be executed until actually needed and there will be only one line in the code.

The AOP style is to inject the logging using bytecode engineering. Perhaps it would be nice to do a post-processing of the resulted JAR artifacts and replace all log calls with something that injects that if check, etc.

And speaking of memory and CPU wasted on logging, there's nothing like seeing that your biggest CPU user is caused by the increased log level while debugging. Debuggers should know how to filter log calls, including time spent in the string building itself otherwise they don't really help.

Friday, October 23, 2009

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.

Sunday, October 11, 2009

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 either try to play catch-up or, most likely, don't run into the race at all and just import all the English words.

In my country developers, for example, dislike applications localized into the native language. The more technical the application is (like a developer tool), the more foreign it seems to them to see the text in the local language instead of English. Native words disturb them and metaphors seem weird when they make the cognitive connection: a mouse is actually a rodent ! I'm pretty sure English people also thought of rodents the first time they heard "mouse" in a phrase -- but this has been changed nowadays. Computers have become so ubiquitous that "mouse" usually means that computer peripheral. "Firewall" is not some fireman expression or a burning wall, but something computer related, etc.

By focusing so much on the English language and not allowing themselves to jump-start the native language metaphors related to computer science, developers are the main culprit of keeping the native language into a phase of technological barbarism.

An then, they act surprised when the local market almost doesn't exist and their parents can't understand a thing from computers and need help with the simplest things (usually they can't understand the language on screen, which is English).

Thursday, September 24, 2009

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 noticed as of late (see my other article somehow related to this) is the importance of performance per watt when working on your laptop's battery !

Now, the overall system performance per watt is a given of the machine you happen to own. You can't actually tweak that very much, except some hardware upgrade here and there and operating system optimization.

So what you are left is the actual software you use everyday and its performance per watt. Let's call that productivity per watt. Lower performing sofware might exhibit different issues:


  • Consuming too much CPU
  • Hitting the disk too often. IDEs are notoriously culprits here when a normal clean build deletes and recreates hundreds of files on disk. Even some feature like compile on save doesn't save much since developers save often and all this disk writing might actually stop the disk from going to sleep (and thus consume less power).
  • Hitting the network too often or too much. No point in checking for software updates when the user is on battery. No point downloading that 200MB "update" file -- updates should consist of binary diffs and be as small as possible (Google is looking into this as it becomes very important the more users you have). Also, laptops generally use WiFi is they are not plugged in and (I think) that consumes even more power than ethernet.


These are all optimization issues but the main culprit is not scaling down when on battery: this includes being smart about redundant tasks like re-indexing the Maven repository or checking of non-essential upgrades that could be deferred to a time when you're not on laptop battery .

What we seem to be missing is a new metric to evaluate applications: productivity per watt and teaching users to pick applications the same way they pick an A+ energy rating fridge.

Looking forward to see which IDE uses less power to refactor a class or just to stay idle.

Monday, August 17, 2009

Wednesday, July 15, 2009

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 works, you kinda have to read between the lines what the philosophy is.

3. When you press "Discard snapshot" it actually merges changes. So you're not losing data actually, you're just losing the little timestamp that the snapshot gave you. They couldn't have picked a more confusing wording and it's not what you would expect.

4. Next to the notion of "snapshot" they have a separate notion of "current state" or "state" which is somehow related but kinda different. I'm not entirely certain if "state" is something like a placeholder that I can fill with different snapshots or just the tip of the snapshots list. Their wording makes it sound one or the other.

Also, not only did they pick such a wrong wording and show such lack in clearly explaining what their application is supposed to do, but they don't even seem to find this important. A bug report on their website complaining about this very thing is marked as minor !

I guess this is a sign of some geek mentality. They assume that people must train using the uber-software and actually read and memorize the 250 page PDF (probably at some point it all makes sense). The sad thing is that the GUI is really simple and this minimalism should allow them to focus on the details, but a third of it is broken.

Obviously I'm not talking about their "Settings" GUI where you configure the machine, that's very complex.

I'm talking about the normal GUI the users gets to see every other time after the creation of the virtual machine which has 3 tabs: "Details", "Snapshots" and "Description". The only one the user will interact for the rest of the virtual machine's lifetime is "Snapshots" and this is the one they thought it's minor. Go figure.

Tuesday, March 03, 2009

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.

Monday, February 02, 2009

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 being used.

But more to the point, always create your CLLocationManager instance in the main thread, and not in another thread. Having a singleton method there which is called from the main thread somewhere assures you that the location manager is created in the proper thread/pool.

Friday, January 30, 2009

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 objectAtIndex:i];
NSString * name = [group valueForProperty: kABGroupNameProperty];

if([@"BadBadRule" compare:name]==NSOrderedSame){
[AB removeRecord:group];
[AB save];
}
}

and that was it ! No more Address Book crashes ! Turns out OSX is really nice to tweak if you are willing to code a bit.

Findus and the Christmas Tomte

Sven Nordqvist's Pettson and Findus series is beloved for its cozy portrayal of rural Swedish life. An eccentric old farmer, his talking...