Posts

GWT Part II: From Ant to Maven

In the last entry I showed how to get started with GWT and get a nicer build file with Ant. In this entry I'll explain the process of moving from Ant to Maven. My goal here is to take advantage of all of Maven's features while still maintaining a workable project configuration that I can use from a command line and from Eclipse. GWT's tools generate an Eclipse project but don't do other things like, for instance, adding dependencies to the Eclipse project when you add them to the build file. Maybe you can do this using Apache's Ivy . I haven't tried it, maybe I will someday if I end up hitting a wall using Maven... First thing to do is to rearrange our source code. Maven expects things to be on different paths and we will have to do that. I started by moving all java source code to a newly created "src/main/java". I'm using git so I just did: $ mkdir -p src/main/java $ git mv src/org src/main/java/org I had to do a similar step for the unit tests:...

GWT Start-up: improving the Ant Build file

GWT Start-up: improving the Ant Build file In the past weeks I've been investigation Google's Web Toolkit . I started looking at it because I wanted a good "Web 2.0" application and JSF was cutting it. I tried using JSF and Porlets but Portlets 2.0 isn't ready for prime time yet: the JSF bridges I've tested still don't work, but that is a topic for another post. Today I want to make a fast track introduction to GWT and to summarise some of those issues and how I worked around them. For now I'll start with the basic project setup. GWT has first class support for Apache's Ant but I wanted to use Maven. Why Maven? It simply makes sense to me because of all the Project Management support it has. You can improve Ant with Ivy but for me it still feels like shell scripting in XML. If I'm going to pay the price for XML than I want something in return. There is an archetype for GWT and Maven but I simply don't like it so I decided to start with GW...

Simplified Option Icon 255 on Gentoo

I have an Option Icon 255 from work to use when I'm out of the office. It is a 3G USB pen. I've used many outside scripts and graphical user interfaces but I never liked them. They crashed a lot and never seemed natural. Also I wanted a script that actually worked all the time instead of failing sometimes because it took the device a couple more seconds to register in the network. My solution: a mix of udev and shell scripts. First I made udev rules for the device. I want it to always have the same name on the /dev file system and that as soon as I connect it to the laptop it should validate the PIN and register in the network.I created a "49-hso.rules" (hso is the name of the kernel driver for the device) in the "/etc/udev/rules.d" folder as follows: ACTION!="add", GOTO="hso_end" SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTR{hsotype}=="Control", SYMLINK+="wctrl0" SUBSYSTEM=="tty", SUBSYST...

Gentoo with LUKS and LVM

My company has security policy that forces us to encrypt the hard drive of the computer and any other media. Well, not the whole hard drive, but 99% of it: the 1% is what is required for the PC to boot and ask for a password to decrypt the rest of the drive. The good news is that I'm allowed to use Linux. The bad news is that they have red hat enterprise linux and I like Gentoo. For a long time I've been using kubuntu. It is not bad, but it is too easy to use that it borks some time and I like the control Gentoo gives. Since I only installed Gentoo 2 times, one in 2003 and another in 2007 I decided to write all the steps for a bare minimum Gentoo installation. I have tested these steps on a Virtual Machine using KVM. Next step is to make it on the real laptop. It should take something like 35 minutes to do this on a Core 2 Duo at 2.2ghz. Notice: This works for me. Use it at your own risk and remember that these commands wipe your hard drive so, if you want something special ...

Getting NetBeans to do Anti-Aliasing

I changed desktop environment from KDE to none when Gentoo marked KDE 4 as stable. Don't get me wrong: it has nothing to do with KDE 4 itself. The problem is that my computer is rather old and it was already getting a little slow with KDE 3.5. KDE 4 is heavier and slower bringing me to the tipping point. No, GNOME is not the answer: I switched from GNOME to KDE when GNOME got too bloated and don't get me started with mono... Now I'm using openbox , considering wmii or enlightenment but not a full desktop. I added adesklets to the mix, conky , tint2 and yeahconsole and I'm ready to work. A couple of days ago a colleague had issues with NetBeans on Gentoo, specifically the fonts had no anti-aliasing, hinting, whatever you want to call it. I tried it today because I was using NetBeans to do some PHP coding. Well, I had the same problem. After some investigation I finally found a way to get it back to work without running KDE or GNOME and I though of sharing it here ho...

CMake Cross-Compiling

I don't know if I already mentioned, but I'm writing and ODBC driver at work. A colleague of mine proposed that the driver is open sourced since it is not our main business. I hope it is, but I'm keeping my hopes high. In the mean time I can share what I have learnt. The driver is an ODBC-RESTful bridge, that is, ODBC requests are transformed into HTTP Restful requests. Although the initial goal of the driver was to be Linux only we had to change it because of the wonderful reporting tool chosen. So I had to port it to Windows. I wont go on the tiny details on how to write portable C code (basically using #ifdefs ) but on using CMake and cross-compiling. You see I went and tried to use Microsoft Visual Studio Express, the latest version, but the compiler was so slow, the IDE was, well, horrible and the Operating System is a stone in my shoe, even if executed in a virtual machine. So I decided to put MinGW to a good use and cross compile, that is, to compile on linux a win...

Back to C: CMake and CUnit

I'm back at programming in C. I proposed something 8 months ago at work that was totally ignore. Now my boss wants me to do it because the other alternatives have totally failed. The idea is to implement an ODBC Driver. If I have the time I'll put a tutorial here on how to do that on Linux. But back to the point of this entry. This small guide will help you create a simple project using CMake to build it and cunit to test it. Yes, I believe in test driven development, no matter the language. Let's imagine a simple project that produces an executable that prints the result of 2 + 3 (I know, lame but sufficient for this example). To make it easier to test I split the application. The functions will go into a library and there will be a source file that starts the program. The library header file is called "lib.h" (extra points for originality). Here are its contents: int add(int a, int b) ; The implementation is on the lib.c file as follows: int add(int a, int b)...

LOL - "Server Too Busy"

Image
This just happened to me today. What is more interesting is that this is an unhandled exception. So, the server being to busy is not something that they should predict and allow the application to handle, they just make you wait and then throw this at you. Don't you just love these products.

The Plan

It has been some time since I last posted here but I cam across this gem that I had to share. The tile is " The Plan ": In the beginning was The Plan. And then came The Assumptions. And The Assumptions were without form. And The Plan was without substance. And a terrible darkness fell upon the face of the Workers. And they spoke among themselves, saying "It is a crock of shit, and it stinks." And the Workers went unto their Supervisors and said loudly "It is a bucket of dung, and we cannot live with the smell." Whereupon the Supervisors went unto their Managers and didst say "It is a container of excrement, and it is very strong, such that none may abide by it." The Managers went quickly up into the temple and seeing there the Directors of the company, went unto them, saying in pious voices "It is a vessel of fertiliser, and none may abide its strength." After much feasting and lewd revellry, the Directors spoke among themselves, saying...

Helping out OpenStreeMap

It has been a while since I have last posted but I hope to do it more often. Don't ask me why. I guess that if you are in the bottom you loose all will to do anything. But a two weeks vacation and a few changes in both my personal and professional life and I'm starting to see the light at the end of tunnel. But that is enough drama, on to the goal of this entry. I made my very first contribution to the OpenStreetMap . Think of it like a Wiki that is a map of the whole world. Since my country doesn't have a nice coverage I decided to hack my GPS to track my trips and share them. Then I edited my first roads (two fully and a part of one) and they are already appearing on the site. Next step is to add more roads. Want to help out? You don't even have to edit the roads. Just trace your trips and upload them they will help others since the more information the more accurate the map will be.