2009-12-10

Internationalization in UI toolkits


I have some experience with many different UI toolkits. The most with Swing, QtJambi, GWT, and some with SWT and Echo2. Some of them providing you with their own i18n techniques. Let's take a closer look...

Swing is the most comfortable tookit because it gives you full Java API, with source code, possibility to dive deep into it's internals and no external libraries or dependencies. And it gives you standard Java i18n engine: ResourceBundle. It's simple, powerful and effective. And it's customizable (if you know Java of course).



Qt Jambi gives you Qt's native internationalization engine. It works in other manner than ResourceBundles. API is clean and simple, every Qt widget have method tr(String) where you can specify default value, but not the key as ResourceBundle suggested. From one point of view it's good because you're hardcoding default values, and you will be sure that on any system it will at least show default version. From the other side - those messages can take a lot of space in your source files, plus they are actually keys in internationalization files, similar to properties files. Having keys like this is not very good, because modifying single char you have to modify all resource bundles, while in ResourceBundle you can leave code "as is", modifying only value but not key.

GWT is totally different. It's using properties files too, but you have to extend Constants interface, and add all your keys as String methods to interface. As for me GWT is the total winner, because you have properties files with key-value pairs and IDE support, and you have compile-time safety because you're getting those strings from Java class. In ResourceBundle you're operating mostly with Strings, and simple typo can waste lots of your time, while using GWT approach you must ensure your keys only once, then you're totally saved from any kinds of typos using Java methods to get your internationalized messages.

GWT 2.0: almost 6000 downloads in 33 hours


GWT 2.0 released yesterday, but almost reached 6000 downloads already!



Well, I am agree that GWT is pretty cool thing, especially if you must do something for web browsers, but 6000 in 33 hours... Can you remember any other toolkit with same download rate? Even Java developers are not bothering themselves with downloading of new versions.


2009-12-09

GWT 2.0 released, HTML drawbacks as new feature


Few minutes ago I read about release of GWT 2.0. It's great new release, with many useful features. Except one: UiBinder. HTML and XML both have their problem - they are page-oriented. You can't just replace some widget as long as it's Widget subclass. You need to repaint all page if you want to layout it in some other manner. GWT allowed you to avoid those drawbacks, providing you with great feature-rich component-based framework. You could do everything in plain Java, and as for me it's big advantage, because average quality of GWT project were relatively high (you at least need to know Java, and maybe some component-based framework like Swing, right?). And now any novice HTML coder can feel something native and ugly using GWT, lowering average code quality and writing another crappy application with cute HTML-like interface. Impossible to debug, impossible to apply any Java techniques, and even making harder to use version control system (I hope you noticed that modern DIFF algorithms are not very good with XML?).

2009-11-27

Stupid frameworks are forcing you to do stupid things


I am working with GWT+GXT right now. And I have strange problem - I can't save some user object. Just can't. When user logined to the system I want to save user object, containing his name, mail, role, group and other things. But as soon as F5 pressed - all static is cleared from the application, so even static fields can't help me. Cookies can help me, but they're limited to String only...

Of course my imagination works fine, and I can implement some GWT RPC service and get user from the server (where I have user's session, and I can save User object into that session). But it's stupid, isn't it?

2009-11-26

NetBeans and Safari


On my Windows box I am using Safari to read javadocs. Because of fonts antialiasing of course. And just noticed strange effect - NetBeans starts to lag when Safari is opened. Sources parsing is slower, autocomplete waits visibly longer before suggest something... Do you know where is the problem?

2009-11-25

GWT2 Firefox plugin download


First release candidate of GWT2 released on November 17, it can be downloaded here. One of the first changes you'll notice - they removed their "hosted browser" and added plugins for some browsers that will help browser (Firefox?) to do the job of "hosted browser". The first time you'll run application - it will suggest you to download plugin. But what can you do it you want to copy your project on workstation with strict or no internet? Or it you're planning to clean Firefox profile from time to time?

I asked question about where can I get those plugins on Google Groups for GWT, but 7 days passed and no answers...

So here is the small guide how you can get it manually.
1. Find folder where firefox storing it's plugins. For me it was C:\Documents and Settings\Username\Application Data\Mozilla\Firefox\Profiles\5zchoudq.default\extensions\gwt-dmp-ff35@gwt.google.com (yes, yes, I am still using Windows on my job).
2. Open install.rdf in text editor. After reading it for some time the only interesting line you'll find looks like this: http://google-web-toolkit.googlecode.com/svn/trunk/plugins/xpcom/prebuilt/update.rdf in em:updateURL tag.
3. Open that link in browser and read that file. Now you can see the link where you can get that extension, can't you? Here is it: https://dl-ssl.google.com/gwt/plugins/firefox/gwt-dev-plugin.xpi.
4. Now you can save it for farther usage.

2009-10-13

Tablet on VirtualBox guest


If you're Linux user and you have Wacom Intuos3 tablet - it's obvious that GIMP will not satisfy your needs. Solution exists: you can download and install free VirtualBox, install WindowsXP as guest system and work with your tablet in guest system, installing your favourite graphics application on Windows guest.
I did those steps: installed VirtualBox 3.0.8 on my SUSE Linux 11.1, installed WindowsXP as guest. But I couldn't configure it - checkbox to turn on tablet in guest system was disabled (grayed out).
I spent few hours reading different forums and bugreports, most of them suggested to mount tablet as usbfs to your system, but it didn't worked for me. When I found solution - it was fast and simple:
1. Open your /etc/udev/rules.d/10-vboxdrv.rules as root. You will see something like this:
KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"
SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0664"

2. Modify third line like this (adding name):
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="VirtualBox/$env{BUSNUM}/$env{DEVNUM}", GROUP="vboxusers", MODE="0664"

3. Restart your system to be sure.

That's it! Now checkbox will be enabled and you will be able to turn on your USB tablet for guest system. VirtualBox will fail with error (something like couldn't create usb proxy device) but only 2 times, when pressing third time - tablet will be recognised by guest system and you will be able to use it. Of course you should also disable mouse integration and your tablet will no longer be available to your host Linux system, but what for do you need it there anyway?

2009-10-08

Problems of small opensource projects

Being Java developer and fan of OpenSource I am writing lots of stuff. Mostly for myself, tools that I am missing or to get some experience with something. But of course there are projects that I think others will like and use if they will know more about it. Few examples:
  • Once I wrote small tool for Swing apps to choose LookAndFeel in runtime. It was JLAFChooser and I hoped it will become popular very soon. But days passed and downloads count was small. I thought that mostly it's downloaded by different search engines, nobody cares about it. And I just forgot about it, didn't planned to make it better. Download rate is about 1.001 per day. No bugs, no feature requests, no thanx or private mails. Nothing. Maybe this project had it's future, but now it's as good as dead. And even java.net registration did nothing to improve the situation.
  • Then came p4nb. I did it for myself anyway, I am still using it at work because it's the best available Perforce plugin for NetBeans IDE. It's just enough for me. And nobody cares. Looks like nobody using NetBeans and Perforce at once. I can implement vast amount of features, including changes browsing, changelist management and many other. But I have more interesting projects for myself, and nobody else asks for it. Why should I do it?
You will ask what's the point of that moaning? But the point is, once one guy mailed me with words like "hey, I added few features to your p4nb plugin, maybe you need it?". That day I understood that I am not the only user of that plugin, there are at least another man using it. It was the new beginning for p4nb, it got completely rewritten with new and better feature set and better usability. And then it was forgotten again, because all users were glad with what they had, no bugs and no change requests fired.
Today I got a mail from one guy who is using JLAFChooser, he asked about launching it from Java WebStart. Of course I answered him, but why so late? I have no interest in that peace of software now, and I will not get back to it's development. It's dead for me, because no one really needed it when it was interesting for me.
  1. How many projects died like this? What kind of project they were, maybe we lost something really interesting?
  2. What should I do to prevent it in future? Post to slashdot? Buy Google Ads? Tell me what I did wrong to fix it in future.
Thanx for your attention, and I hope this post will not be just ignored in the same sad manner.