Wijsmullerbros.nl

I'm sure that in 1985 plutonium is available in every corner drugstore, but in 1955 it's a little hard to come by.

— Dr. Emmet Brown

Nov
29

Linux mint on a dell precision m4500 laptop

For everyone that is trying to install or wants to install the latest edition of linux mint "lisa" on a dell m4500, you'll be in some trouble.
The live dvd boots really nice, but only the external monitor gets a signal! Very unpractical.
I've finally gotten it to work by tweaking the nvidia adapter. The trick is to press alt on the grub boot menu, the countdown. Then add the options nomodeset and vga=normal.
Now you can install and download drivers etc, maybe later improve the resolution ;-) Nice.

1 comment

Anonymous

After having installed mint, choosing the newest version of the nvidea driver fixes things. Just to clarify, it's not all that bad :)

Nov
19

SWT is awesome again using e4 XWT

Eclipse 4 is definitely going to be a major improvement, first of all because of the fixed maven support, but there is more!

Part of e4 (the new eclipse), is a new way to describe SWT layouts, named "XWT" (do not confuse with xwt.org).
In one of the projects I was working on, we used Google web toolkit, that has this thing called UIBinder to help creating layouts. I found it quite convenient and an easy way to get a good feel for the actual layout.

It turns out that there's a tool called WindowBuilder pro, created by Google and recently donated to eclipse. This allows for designers to visually create layouts for Swt, Swing, GWT, etc. It works like a charm!

Now, since I'm using maven to fetch my dependencies, the project setup was not completely trivial. The libraries for XWT are not documented that well and are not available in any public maven repositories.
So, to get started I had to copy libraries from my eclipse installation (that uses swt), and mix and match the right ones. After having done this though, it's rock stable.

Actually there was a typo of the e4 XWT site which totally broke the system. After long dwellings along forums, I finally found the problem. I updated the e4 XWT page to show the correct examples.

http://wiki.eclipse.org/E4/XWT

I'm very glad that I don't have to fall back to the Netbeans Swing designer and/or code generation.
I will post the list of libraries needed here asap, since I can highly recommend using XWT!

2 comments

braam

I'm currently trying out some Model-View-Presenter tricks with XWT, it's looking quite promising, so maybe I'll be posting some more soon.

braam

These are the libraries I used to get things started with e4 XWT:

org.eclipse.core.commands_3.6.0.I20110111-0800.jar
org.eclipse.core.databinding.observable_1.4.0.I20110222-0800.jar
org.eclipse.core.databinding_1.4.0.I20110111-0800.jar
org.eclipse.e4.xwt.forms_0.9.1.SNAPSHOT.jar
org.eclipse.e4.xwt_0.9.1.SNAPSHOT.jar
org.eclipse.equinox.common_3.6.0.v20110523.jar
org.eclipse.jface.databinding_1.5.0.I20100907-0800.jar
org.eclipse.jface_3.7.0.I20110522-1430.jar
swt-debug.jar

Oct
27

Fixing Oneiric's gui

I've been running and using the latest release of Ubuntu, named Oneiric Ocelot, since the first beta version. There are many improvements, and I do really like to keep up with the newest features.

There is one problem though, both the new Gnome(3) shell and Unity, the other shell, or both nasty! I honestly don't like all the fancy graphics uselessly boring me to death, and the "clean" interface which means for me that all useful quick ways to do stuff, are gone.

But I've stopped worrying and learned to love the [bomb] Unity gui, with the following tweaks though:

* Install synaptic using the "software center", because the latter one is really slow, does not do what I want, has less software listed somehow and is just not ready for any serious use.

* Change the default Unity behavior using "compizconfig-settings-manager". For instance, I don't use the mouse that much, so I just want the windows button to pop up the menu bar thingy, otherwise just leave it alone. Also I want to cycle through ALL applications using ALT+Tab, not just some of them. This is possible, just tweak the right combination of compiz plugins.

* Check out this list of "indicators" which bring back all the nice applets for cpu freq settings, international characters, weather updates, cpu usage, etc. Some of these I just need, end of discussion.
http://askubuntu.com/questions/30334/list-of-application-indicators/3799...

* Customize the new login screen, put your own image there, by installing "simple lightdm manager":
http://www.ubuntugeek.com/simple-lightdm-manager.html

Given all these tweaks I'm kind of ready to also start using it at work. It is a shame that such a drop in usability is apparently needed to migrate from the deprecated system that gnome 2 really was. Hopefully, and I do expect that it will, the default gui experience will improve a lot in the next version.

2 comments

Anonymous

Same here, upgraded home and work pc/laptop from Ubuntu 11.04 to 11.10. Played a bit with Gnome 3 and with Unity. I feel more attracted to Gnome 3 than Unity, but because Unity it so much better integrated in Ubuntu I'll stick with Unity for now.
But I'll really keep a VM running Gnome 3 to keep up with that, as I really like the possible tweaking Gnome 3 supports, and.. it's Gnome, it's waaaay better tested than Unity can ever be (in my humble opinion :)). They both just miss the nice little tools that were already build for Gnome 2 in the last decade.

braam

Yesterday I was once more frustrated about the all to well known usability problems with unity, and thought "why again am I using this?". So I finally gave up and just installed gnome-shell and I have now started using the classic! session.
With some tweaking here and there I now have the old way of working back again, including the good version of alt-tab, virtual desktops, sensible menus, awesome keyboard shortcuts, application status bar, a gnome bar having shortcuts always available, etc. Ahhhhh, so good to be back.

Oct
10

Working with currencies in GWT

Another hurdle taken; currencies.

Say you want to display a product priced at 25 dollars an 45 cents, you should be able to use the GWT NumberFormat to get $ 25.45 or $ 25,45 using the Dutch locale for instance.

It turns out though, that there is no way to specify the currency symbol, so your always supposed to use the "default" currency for your locale. This is quite strange because I can imagine that there are countries using more than one currency?

My solution is has been to use the Messages system to define a format, such as:

@DefaultMessage("{0} {1,number,###,###.00}")

where 0 is the symbol and 1 is the amount. This allows a different format for each language, so it's quite flexible.
Next is the currency symbol itself. It can't be determined on the server, and sending it from the client just seems a little to much trouble.
Thankfully GWT does provide a way to access the list of symbols that it houses, you just have to know where to find it (I found it here).
private static CurrencyCodeMapConstants lookup = GWT.create(CurrencyCodeMapConstants.class);
Map currencyMap = lookup.getCurrencyMap();
String symbol = currencyMap.get(currencyCode);

That's it, combining the formatting with this lookup solves my use case. Google does not document these things that well, but I'm glad we have the sources so we can figure it out anyway.

Oct
8

GWT: Example on how to pass init data through the host page

In my last post I talked a little about how the host page can supply data for the client application.

Now I would like to show in some more detail how to use the AutoBean system for this purpose.

The MyInitDataFactory is my custom arbitrary marker interface that extends the AutoBeanFactory interface which is responsible for the AutoBean magic.

The MyInitData class implements my simple custom IMyInitData interface, which allows the client side to generate a implementation, compile time, that can be parsed from Json code.

Server side:

MyInitData data = new MyInitData("interestingValue");

MyInitDataFactory factory = AutoBeanFactorySource.create(MyInitDataFactory.class);
       
        AutoBean<IMyInitData> autoBean = factory.create(IMyInitData.class, data);
       
        Splittable splittable = AutoBeanCodex.encode(autoBean);
       
        // not strictly needed, but highly advisable if data is dynamic!
        String json = ESAPI.encoder().encodeForJavaScript(splittable.getPayload());
       
        String formattedJson = String.format("var hostPageVar = {\n\tjson : \"%s\"\n}\n", json);

// render the formattedJson inside a script tag on the host page, using spring or some template system

Client side:

MyInitDataFactory factory = GWT.create(MyInitDataFactory.class)

        Dictionary dictionary = Dictionary.getDictionary("hostPageVar");
        String json = dictionary.get("json");

        AutoBean<IMyInitData> autoBean = AutoBeanCodex.decode(factory, IMyInitData.class, json);

        IMyInitData result = autoBean.as();

I hope that this sheds some light on how to pass data to the client through the host page without to much custom code. Google does not really seem to give any hints about how to do this, and I couldn't find any examples really showing how to use the AutoBean system for this.

1 comment

Anonymous

Something that I did not realize before was that though collections and custom interfaces are supported as properties of an AutoBean, collections containing custom interfaces are not.
The reason is that the AutoBean mechanism is supposed to work server and client side. On the client side, there is no support for reflection and generics, so the information about the contents of a list is lost.
This is quite a restriction and basically means that we will need to change the layout of our data to not produce any lists having custom class contents.

Oct
6

more gwt, the host page

To start a GWT application, the client will often need some data to work with. Ideally this needs to happen without any extra requests fired. So not using rpc calls.
so, how to get server based data to the javascript world?

Our solution first was to use the Dictionary system. A spring requesthandler (servlet) renders the data to the page using a custom formatter and simple maps.
It worked, but in time the data became more complex and using simple maps was getting really complicated!

The next step has been to introduce the AutoBean system, part of GWT. It allows to covert a hierarchy of classes into json, and back into java/javascript. So combining this with a single dictionary works really nicely!

I'll post some urls later on these steps.

Oh and when passing javascript to the client, take security into consideration. Take a look at the Owasp threats and the ESAPI responses to them. Its actually not that hard to use, though the amount of features is a bit overwhelming.

Whats next?

Oct
3

The troubles and benefits of using GWT

We're currently doing some stuff using Google Web Toolkit. To test it, we're following Google's advice on the MVP pattern, to make things testable.

Now MVP is all nice and all, but a little more work than just making some widgets unfortunately.

Today I came across this nice support library: http://code.google.com/p/gwt-test-utils/
It looks promising, even if it requires an agent to run. Though for our project it is a no-go because it also requires java 6, while we're stuck at java 5.

On the other hand, it's not all that bad. The validation on input can be dealt with on the client side, which is really cool and snappy.
Another good thing is the Animation class which offers a surprisingly simple way to morph, move and do other cool stuff inside your browser screen! Instant awe effects :D

What's nice is that GWT does not dictate anything about how to run your server side, you're free to do whatever.
If you're looking for a quick way to interact with the server I can recommend gwt-dispatch, works like a charm and is relatively simple to use.

More soon.

2 comments

Anonymous

Actually, gwt-test-utils does not use a java agent anymore, everything is done through a custom classloader since almost 16 months ;-)

It has been designed for Java 1.5, so you'd be good to go with it ;-)

Cheers,

Gael

braam

Hey that's good news, I will try it for sure :D

Maven multi module site generation with javadoc

Maven can generate a site. It should be standard, it should be easy, but it's not. Due to various bugs and plugins having to work together perfectly, generating a site is super messy.

After much pain and horror of trial and error I came to the following configuration using maven 3:

<profile>
<id>maven-3</id>
<activation>
        <file>
<!-- This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
<exists>${basedir}</exists>
</file>
    </activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<configuration>
<reportPlugins>
<!--To make the dependency report generation faster -->
<plugin> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.3.1</version>
<configuration> <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>project-team</report>
<report>summary</report>
</reports>
</reportSet>
</reportSets>
</plugin>

<!-- Uses the Javadoc tool to generate javadocs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<excludePackageNames>
our.company.testutils.*
                    </excludePackageNames>
</configuration>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
</profile>

Our codebase uses maven 2 and maven 3 for different builds, that's why it's configured inside a profile.

Most reports (especially dependencies) are not enabled because this build is already taking far to long (about 45 minutes for 65 modules, of which 6 or so are parent poms).

Running the build using (important!):

clean install javadoc:javadoc site:site site:deploy -DskipTests

"Install" because it makes the submodules "know" about the parent module built artifacts. Javadoc is done explicit so it does not run inside the reporting (site will include them). Site is called twice to make sure parent and submodules will be linked. Jikes.

For those needing to do more or less the same, good luck!

May
5

Kill process by command line path in Windows

I was in need of a way to kill processes from the windows command line. The normal ways of doing so either require the process id (PID) or the process name.

When running java programs, the name will always be java.exe, so that does not help a lot.
I was looking for a way to kill processes, selecting by the command line options used to start the process. For instance: java.exe MyFavoriteMain -cp /somedirectory/matchthis/*

It turns out that doing this with the regular commands, is very difficult, if not impossible.
After searching, talking to Windows power user friends, I came to the following solution!

wmic PROCESS WHERE "Commandline LIKE '%matchthis%'" CALL Terminate

A little obscure if you ask me, but it does the job.

Oh and when using this inside a batch script, you'll need to duplicate the % signs, or else the interpreter will use these instead of passing them literally to be used as regex pattern.

Jan
23

More about GAOSP

GAOSP: Samsung Galaxy (i7500) Android Open Source Project is a project by a dude that calls himself "Drakaz".

This software is truly a huge improvement over the standard (crappy) android version that Samsung delivers.

Some highlights:
- battery now lasts 32 hours including gaming, calls, app updates, etc!
- dutch language support for navigation
- froyo features such as "Car Home", improved messaging, improved browser, more apps!
- much snappier GUI somehow, the memory management is better (this phone is very low on RAM)
- many little tweaks are in the core system (modded), for which I used to install a whole range of apps before
- rooted and a "sudo" like privilege lifting system, to allow for example to remove the default music app that used to be really annoying (I blame google for that crap)

Installing it was not really that hard, though a lot of reading was involved to understand what steps exactly to take.
Basically all that was needed was:
- install the google android sdk package on my laptop
- get adb to actually list my phone on linux (part of the sdk that links to the phone)
- use adb to copy the image and a thing called "recovery" to the phone
- use "fastboot" (a utility by htc) to install the recovery on the recovery partition of the phone
- boot in recovery mode by pressing some buttons
- choose backup from a nifty little menu to backup current image
- choose install to get the awesome new superpowers of GAOSP froyo!

Oh yeah, in this beta 3 release, there is still one little snag with bluetooth headsets. This means my car kit does not work, which sucks. But still, the rest is so much better that I'm happy to use my phone on speaker for a while until the bluetooth part is fixed again.