Google Sidebar Hotkey Activation

I like the new Google Desktop with the sidebar. It shares similarities with Konfabulator, recently bought by yahoo. They both allow easy access to some custom little widgets that I would call "active". They are active because they are refreshed periodically with new information (processor usage, news, scratch pad, emails, etc). But while Konfabulator choose to emphasize on visual effects, Google prefers a more standard information presentation. This shows as well in their choice of technologies:
  • Google Sidebar plug-ins are just Windows appz that can take advantage of Google Interfaces. That makes them quite powerful in theory, but programming them is less accessible.
  • Konfabulator plug-ins are Javascript+XML, the Javascript is not just regular client-side javascript, it can use Konfabulator API (containing many effect and rudimentary network access), and COM objects . That makes them very focused on presentation, and the Internet.
In the long run, Google choice makes sense, the forthcoming Avalon will make visual effects very accessible to windows developers.

Now back to the subject, I missed the 'activation on hotkey' feature from Konfabulator for the Google Sidebar. Fortunately, I a have found a powerful little open-source program, Autohotkey, that allowed me to do that very quickly. Here is the script I use (it's a hack since it relies on toolbar size (but not position), but I like the default position and it works (only using floating deskbar, i let you figure out for the non floating version)):
F12::
MouseGetPos, X, Y
if WinExist("ahk_class _GD_Sidebar")
{
WinActivate
BlockInput,On
MouseClick, left, 160, 16
MouseMove, X,Y
BlockInput,Off
return
}
else if WinExist("ahk_class ATL:0044A4C8")
{
WinActivate
BlockInput,On
MouseClick, left, 158, 16
MouseMove, X,Y
BlockInput,Off
return
}

I Need Another DB Framework!

I am currently facing a problem that neither Hibernate nor iBatis solves nicely. I also looked at other ORM or just DB framework, without success.

What I would need is a framework that generates PreparedStatements with a query by Criteria like API. I have many queries that are similar but varying according to different input parameters. iBatis can handle this, but for complex queries and scenarios, the XML becomes completely unreadable, and you therefore loose any advantage that iBatis was bringing with the externalization of SQL statements in XML. The other issue I have with using iBatis is that for another part of my project, the automatic generation of SQL statements a-la Hibernate is useful. Hibernate has a very nice Query by Criteria API, but it lacks just a tiny bit of flexibility in customizing queries. For example, I could not find a way to specify a “USE INDEX(index_name)” in the generated SQL, after the SELECT FROM xxx and before the rest of the query. I did not find either a way to specify the use of a “STRAIGHT_JOIN” instead of an INNER JOIN. These are all MySQL specific issues, but those little things are extremely useful at improving some of my queries performances. Writing N sql queries hard coded is not a good option, since this N can be quite big, which is why I am using Query by Criteria in the first place.

So is there a need for yet another DB framework?

del.icio.us toolbar customized

When I bookmark articles with delicious, I like to keep the content on my hard drive, because pages sometimes change, or are removed, or I want to do local searches. I believe this is one reason some people like furl (furl keeps a copy on their server that only yourself can read, but does not allow search).

A combination of slogger and delicious could solve partially the problem. But it is not integrated, I can't get my local version from delicious, so I loose the tagging, listing and all other plus from delicious.

I added my own feature to the delicious toolbar, which I like very much. This new toolbar saves automatically the file you bookmark (on the + button), and will add a link in your delicious home to the local version (if it exists).

I have it publicly accessible at http://perso.wanadoo.fr/logos01/deltoolbar.html

It is not meant to be used by everybody as it is not official. But the page will give you an idea of what it does. If you think it is useful, I will improve it, otherwise it will stay the way it is because it fits my use.

Categories: , ,

Inside the Java Virtual Machine

I am reading an old book, Inside the Java Virtual Machine. Some old books don't age, and this is one of them. The chapter on the Java Virtual Machine is just excellent and should be read by every Java developer. It explains each step a JVM does when you run a Java program, very clearly.

You could get plenty of stupid interview questions from it like: How is the Java stack used? Between method area, heap, pc register, stack which one are shared among threads?

Also they saw the full potential of Java quite early on (1997). They explain how the JVM specs allow for very different implementations, ones that can run in different environments, for example, simplifying a bit: low memory, embedded world, or lots of memory, mainframe world. It is not an accident if Microsoft chosed a very similar design for the CLI of .NET, they have been looking for getting into the embedded area for quite some time, and apparently, they are making good progress.

Firefox Shortcut URL as Command Line for the Web

I have been doing some work on Firefox extensions. Mozilla/Firefox is a really interesting world, it is extremely flexible, you can make it transform the web the way you want.

Recently, someone started YubNub, the "command line for the web", a very simple idea, but useful. This is a bit similar to the Firefox Search Bar, except more powerful, and quicker to use. Mozilla developers actually had that idea a long time ago (around 2000), it is called shortcut url. Basically to any bookmark, you can add a shortcut, you then just have to type that shortcut (let say g for google.com) in the address bar to go to the address pointed by the shortcut. This shortcut accepts 1 parameter (represented by %s in the URL), so you can do "g chasethedevil" to search google for "chasethedevil" if you set up your shortcut properly. Firefox can build this dynamic URL automatically for you if in an input box, you right click and choose "Add a keyword for this search".

Now we have seen the Firefox address bar can be used to quickly perform a search on a selected website. But this can be much more powerful. As this page suggests, you can associate a bookmarklet with a shortcut, you can execute whatever javascript you wish. One very simple example is:
javascript:void(location.href=
'http://web.archive.org/web/*dc_/'+location.href)
. This shows how you can use the address bar in a very flexible manner. It would be easy to support a multiple parameters search using a bookmarklet. There is a whole list of commands very similar to yubnub ones in addition to those on the previously mentioned link.

I first thought about writing a simple extension to have my command line in Firefox (for example by extending the getShortcutOnURI function), but after some information gathering, I discovered it was already possible. Firefox is truly amazing. It is a bit of a shame that this functionality is not a bit better exposed to the user.

tags:

Hibernate Criteria API vs HQL Overhead

I was wondering what was the framework weight in the performance of my application, and I wanted to check at several frameworks performance. I used JMeter to benchmark a stripped application (database access through tomcat) under various loads. My very modest test shows no significant difference between Hibernate Criteria API and HQL access for queries. Criteria might be a few milliseconds slower, but my query time will take 10x more time, even for a relatively simple query (my query is has 3 inner joins, is grouped, with a count and takes only 4ms when performed once in mysql under no load). It seems much more important for the Framework of choice to provide good scalability, easy development and maintenance, rather than saving a few cycles, unless the Framework becomes a bottleneck.

Java is more productive than Ruby/Rails

I have been doing some Ruby On Rails, for 2 small projects. While I think it is good, I think it is overhyped as well. It is well designed, has good ideas (easy configuration), and focus on the right problem, architecture. But my conclusion is that I am not more productive with it than with Java.

I think most of the development time is not spent coding, but thinking. It is a very obvious statement, and yet too often ignored.

The current Joel On Software article is just making my point: if you look at how much time it took the students to complete their program, you can see it is not the writing that took that much time. And I am sure you noticed the same on your own projects.

So all the nice features of the Ruby language don’t save you a lot of time. And actually when your code size is growing, it becomes increasingly difficult for an outsider to understand your program. Everything can be so dynamic, and your only help is a syntax coloring editor. Compare that to Eclipse, or IDEA, or Netbeans, where you have very convenient search, not text search, but search for declarations, for calls, of methods, variables, classes, all that just a mouse click away. Strong typing goes a little bit in the way while writing, but helps understanding better in many cases (personally I wish Java had type inference, as all the verbosity is not always needed). And when if you really want less verbosity, then you have access to a handful of JVM languages.

A drawback of Java is maybe that you have access to too many libraries. Sometimes, making a choice among the bazaar is not easy and the hype gets scattered.

féminisme et statistiques

Sur ce lien, un article un peu trop long, mais avec pas mal de points intéressants:
  • 6 femmes par mois décèdent, en France, par violence conjugale, soit plus que le nombre de victimes du metro anglais sur un an. Pour toutes les statistiques sur les chances de mourir suivant les causes, aux Etats-Unis, cliquer ici (on voit notamment que le plus grand risque est l'accident de voiture, ou la chute, ou le suicide par arme à feu, devant les attaques par arme à feu).
  • Un petit rappel sur l'antiféminisme chrétien, les femmes y étant qualifiées: de «défectuosité naturelle», de «raté de la création», d’«animal inquiet», de «mouche éphémère», de «méchante bête», de «porte du Diable», de «sac de fiente», de «diable domestique», de «racine du Mal», de «rejeton de tous les vices», de «piège tendu par l’ennemi», de «terre puante», d’«appendice de la race humaine». Ce qui lui permet d'ajouter: «Au lieu d’expliquer la misogynie des hommes par celle des religions, ne faudrait-il pas plutôt expliquer la misogynie des religions par celle des hommes?».
  • Une citation intéressante sur le voile en France: «ces filles qui affichent leur voile dans une société laïque sont le pendant exact de celles qui le refusent dans une société musulmane» laisse à réfléchir; et aussi un développement sur Theo Van Gogh dépeint ici en tant que raciste, misogyne et opportuniste, un avis que je ne partage pas.
C'est un peu extrême par moments, mais souvent juste. Sur le même sujet, Le Monde avait un petit article sur les wagons réservés aux femmes à Tokyo. Bon, j'ai peut-être un peu pété les plombs avec toute cette lecture.


Tags: .

Ruby, Python, JavaScript, Lua, Java, C++ benchmark

Simple benchmark but with interesting comments here:

Some of the conclusions are:

  • Java interpreter is very good
  • Java JIT is as fast as C++
  • Ruby, JavaScript, Python are of similar order of magnitude speed, Ruby the slowest.

It would have been interesting to benchmark interpreted languages for the JVM.

Now for most projects, architecture, not language is key in achieving good performance.

Previous

Next