firesymfony - using firebug with symfony

Found a Firefox add on for symfony development while I was downloading firebug today. Haven't tried it yet, but might give it a try next time I'm working on one a symfony project.


Three guys "switching to Windows"

(This post is heavily updated and is now just a list of links.)

  1. Howto switch from Linux to Windows - a users experience
  2. Switching to Windows: Not as easy as you think
  3. Is MS Windows ready for the desktop?
  4. http://www.mailinglistarchive.com/ubuntu-users@lists.ubuntu.com/msg90388.html
  5. http://climbing-the-hill.blogspot.com/2009/06/why-windows-is-not-yet-ready-for.html (added 2009-06-13)
  6. http://basementcoders.com/?p=245 (added 2009-06-23)

You may like this articles or not, but, after having used Windows since 1995, I feel qualified to say that these post are not just funny, they are also informational and most of all they represent a refreshing change. :)

Also, if you know more articles like these, please add them below. Also add them to delicious with the keywords getthefacts windows whywindowsisnotready, vote them up digg or whatever you want and help spread the word :)

Do you have a good one? Leave a comment!

Hacking the rich:pickList using jQuery

Another post about the JSF 1.2 upgrade.

Short description of the problem:

We had hacked together a custom pick list from before. After upgrading to newest JSF and newest RichFaces, we could use a standard pick list, except that the standard pickList didn't support any means of showing details about the selected item.

We could of course tried to subclass the RichFaces pick list component, but then we would be stuck with maintaining it. So instead we decided to just throw in a quick jQuery script. Of course, it would also be a good opportunity to learn a little more jQuery. (Yes, I've just started learning jQuery, so if you think you've got a better way to solve the problem, please leave a comment.)

Getting an event when somebody selects a cell

<ui:define name="perPageJavaScript">
                jQuery(".rich-picklist-source-cell").click(function () {

Using the event to update a part of the page

    <a4j:jsFunction name="updateFooBar"
    <a4j:actionparam name="param1" 
        assignTo="#{fooBarBean.selectedFoo}" />

the perPageJavaScript is just a way to insert a custom JavaScript into the header of one particular page.

Hope this helps someone. I guess I'm not the only one who needs this construct.


Reduced size of my online pomodoro timer

Had forgotten to remove some pictures I used early in development of my online pomodoro timer. When I removed then, the size decreased from >1 MB to less than 100 KB :)

Hope this will reduce loading times significantly. If not, there is a feedback form on the third tab on the page. Feel free to report bugs or add feature suggestions.


Upgrading a JSF 1.1 project to JSF 1.2

I've just upgraded a project from JSF 1.1 (MyFaces) with tomahawk to JSF 1.2 (Mojarra) with Facelets. Halfway through the process I realized it would be worth sharing, since I would have appreciated if somebody else had done that before me. (There is a description about how to make a new project with JSF 1.2 on http://forums.sun.com/thread.jspa?threadID=5156242, but I wanted to upgrade an old project.)

Facelets is XML

Because facelets are xml documents you need to change && in your expression language statements to &amp;&amp; (I found the tip here: http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=82&t=001835.)

Update 2008-12-23: If you're smart and read the documentation, you might also find out that you can just write and instead of both && and &amp;&amp;.

Also remember that xml comments are written as <!-- --> instead of <%-- --%>

We don't need the tomahawk taglib any more!

While I appreciate the effort that people has put into MyFaces/tomahawk, it also became a major hurdle in the process of upgrading the application. The reason is that it took very long time before the developers announced a JSF 1.2 compatible version, and by that time, I was already decided to get rid of that taglib.

We mainly used to use the tomahawk library for 4 different things:


<t:updateActionListener value="#{fooBean.bar}" property="#{bazBean.bar}" /> can now be substituted with <f:setPropertyActionListener value="#{fooBean.bar}" target="#{bazBean.bar}" /> in the standard f: taglib.


t:dataList can be substituted with rich:dataList


The components in the tomahawk taglib has an attribute called forceId which overrides JSF's id generation, allowing you to specify the precise id you want for a tag.

There's no such things as a forceId attribute in any of the other taglibs we use, but luckily, with facelets you can now use plain html tags if that is what you want. Also, much of the reason for using forceId was for selenium testing. Later on, I learned that we could use xPaths with selenium to pin down a page element without resorting to the id. (If you decide to try, there is at least two different Firefox plugins that you can use to find the xpaths, and at least one of them is useable, I just can't remember the name.

The last reason for using tomahawk was either the sortable table or the fileUpload component. Luckily, both are easily available in the rich taglib.


Using arrays in faces-config.xml doesn't work

At least not i mojarra. Here's my changes:

- public SelectItem[] getFooBarOptionList() {
+ public List getFooBarOptionList() {
      List optionList = new ArrayList(FooBazFooBarEnum.values().length);
      for (FooBazFooBarEnum fooBar : FooBazFooBarEnum.values()) {
          optionList.add( new SelectItem(fooBar.getValue(), fooBar.getValue()));
-     return optionList.toArray(new SelectItem[optionList.size()]);
+     return optionList;
-   <property-name>fooBarOptionList</property-name>
-   <property-class>
-    javax.faces.model.SelectItem[]
-   </property-class>
-   <value>#{fooBazDetailFilterBean.fooBarOptionList}</value>
-  </managed-property>

+   <property-name>fooBarOptionList</property-name>
+   <property-class>java.util.List</property-class>
+   <value>#{fooBazDetailFilterBean.fooBarOptionList}</value>
+  </managed-property>

One last thing:

Here's some code to fetch whatever managed bean you need without injection. I don't suggest you should do anything like this, but if you have already done it, and need to upgrade to JSF 1.2, here is how:


public static Object getBean(String beanName) {
    return getContext().getApplication().getVariableResolver().resolveVariable(getContext(), beanName);


public static Object getBean(String beanName) {
    return getContext().getApplication().getELResolver().getValue(getContext().getELContext(), null, beanName);

Remember: use with caution, as the result may be hard to unit test.


First usable result form my playing with JavaFX

I really like the pomodoro technique. So, while learning JavaFX, I made a software kitchen timer for use with the pomodoro technique.

The result can bee seen here: http://www.itlanddata.no/the-pomodoro-technique/. Click once to start, click again to stop.

I also used the opportunity to add a little jQuery goodness to the mix, allowing you to add to do's, urgent and unplanneds, sort and move elements from one list to the other.

Oh, and it's all done client side. There's no sign up form, your data is not stored on my server. You may even drag the applet out of the browser and into your desktop if you have a jre 1.6.10 or higher, so you don't even have to visit my page.


Going to boot Windows XP on my laptop tonight..

..because I want to test JavaFX while commuting tomorrow.

I've been looking forward to JavaFX because I hope it may put an end to the current misuse of HTML for web applications by people who think that hiding javascript from the developers is a good thing.


Ubuntu Intrepid supports Nokia N82

Just the other day I saw HAL was updated with support for, among other things, Nokia N82. Today I had time to test it. I seems I can now use my telephone as a wireless broadband modem, preconfigured with correct settings, and also sync Rhythmbox even easier than before.

I've tried installing support for Nokia N82 on Windows XP, and it seems to me that once again, once things work in Ubuntu, they are far easier to use than under XP.


Making a "selectable" list component using facelets

Disclaimer: This is not a defense of jsf. If markup were an animal specie, then using jsf would get you arrested for mistreatment. I'm hoping that JavaFX wil give us a better way to make RIAs.

in web.xml


in whatever.taglib.xml

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
  "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"


in li.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        <c:when test="#{selectedPageName == pageName}">
            <li class="#{class} menuItemSelected"><ui:insert /></li>
            <li class="#{class} menuItemNotSelected"><ui:insert /></li>

(I was particularily impressed to see that I could just add the existing classes as easy as it is done above. It's one of those rare moments when I think that it would be wonderful if it was this simple, -just to find out that it actually is!)

making the menu

<ui:component xmlns:jsp="http://java.sun.com/JSP/Page"
<ul class="horisontalMenu" id="topMenu">
        <li jsfc="y:li" pageName="home"><a href="Home.faces">#{bundle['topmenu.home']}</a></li>
        <li jsfc="y:li" pageName="search"><a href="Search.faces">#{bundle['topmenu.search']}</a></li>
        <li jsfc="y:li" pageName="reports"><a href="Reports.faces">#{bundle['topmenu.reports']}</a></li>

setting the selected top menu

easy as just dropping this into the ui:composition of the facelet your displaying:
<ui:param name="selectedPageName" value="home"/>


Quick wins with Java 6 update 10

So, the other day I needed a count down timer. For the pomodoro technique. A quick search on the net: java timer applet gives this http://javaboutique.internet.com/JavaTimer/ Seems like it was uploaded 2000-12-11. (Nice thing about Java. Just works, also with old stuff.)

Problem solved. But, it would be funny to see if I could use any of the new features of Java 6 update 10, so I downloaded the source code, updated the html-file to include <PARAM name="draggable" value="true"/> in the applet tag.

Open from the downloaded folder, alt-drag, WOW, it works! Cool!!!


Using git locally, perforce centrally.

Work In Progress...

It probably comes as no surprise for people who know me that I find Perforce a bit awkward. I have suggested in an earlier post that the only reason anyone would go for Perforce is because they already have a big Perforce repository from before.

That is not to say I'm against version control. I use version control for every project that lasts for more than a few hours, for both strategical and tactical purposes I believe that it makes me about 10% more effective, mostly because it works as a project wide undo, removing the fear of making mistakes. This is, to me, the tactical purpose of version control(*). To have that benefit however, you have to commit your work frequently. If commiting you work is hard, or can have unpleasant side effects (think breaking the build on the ci server), then you'd probably just commit every time you've finished a piece of work.

By using git at your local computer, you can have almost(**) all the benefits of having a modern version control system, without having to move the entire company to another vcs. Just do "git init", "git add ." and "git commit" in your workspace and you have a local repository.

You can now commit your work as often as you like, branch out crazy ideas, and, when you've finished a piece of work, you just commit it to the central repository using standard perforce tools.

Hint: You might find it useful to let the master branch follow perforce exactly, and do your work inside a "local" branch. That way you can even use git tools for resolving conflicts before each commit.

So, what do you loose? Nothing. You still commit to the perforce repository every time you've finished a piece of work, so no significant revision histrory is going to be lost.

Disclaimer: I work at a smart, nice company, where nobody cares if you install cygwin, git or whatever, as long as it is safe, legal and doesn't hamper productivity. Installing git may not be a smart idea at every other company :)

* One of the strategic benefits is of course that you have the revision history when you wonder what went into a specific release.
**You still have to "open files for edit". :/


JavaZone: Domain specific languages in Java

For me, one of the most inspiring talks at JavaZone this year was by Robert C. Martin. He talked about refactoring at method level, and one of the ideas he brought was that you should be able to read down a class like a book and immediately understand what was going on.

To achieve this, he said, you have to make methods that do one thing, and you have to make them short. When you give those methods meaningful names, it seems like reading a description of what the class does, and the function calls become a domain specific language. Guess I've never thought about it that way before. I used to think Domain Specific Languages was something you could do in Ruby and Groovy because of their slack syntax rules.

I've now rewritten a class that used to be about 1500 mLOC (messy Lines Of Code, that is). It is now about 500 LOC, does one thing (supports a JSF page) and delegates the rest to a nice little well tested class that also does just one thing. All this was accomplished while adding a much needed feature.

Guess it goes without saying: Martins Book: "Clean Code" is on my wish list.


Why I would never choose perforce

I know two kinds of people who like perforce: People who have never tried a modern version control system, and Roall.

Perforce has one major weakness: It is very obtrusive, forcing you to "open" every file you want "for edit" every time you want to do any change to it. This basically means that perforce is very hard to use without tool support, compared to svn or git. Add to this that when eclipse europa arrived, it took 6 months before perforce released an updated plugin. The result was many crashes with lost workspace as result.

In my opinion there is one reason why anyone would choose perforce, and that is because thy are stuck with a big repository saved with perforce.

Obviously you should not take my word for this, so add a pinch of salt to my opinion, and also try some version control systems before you decide for your next project. I've liked both subversion and git (the only two other version control systemes I've used btw.) And if you like perforce, please write a post explaining why you like it, and add a comment, or you could send me a mail at erik . itland at gmail . com, cause I am stuck with perforce. (And yes, I have already tried once to find an answer.)


So, you're stuck with <insert not so cool technology here>

This is a work in progress. Don't be surprised if this post changes over the coming weeks. This post is about small things you can do, even if you're stuck with whatever uncool technology.

Do something cool while commuting

I personally have spent a almost all my commuting time the last twelve months programming symfony. First a billing system for small businesses and then a web app for organizing work parties. The last one was for a non profit. Not paid of course. But it helps a lot to to something cool for 45 minutes in the morning before you start wrestling obtrusive frameworks that don't even respect basic things like url's. I also believe, out of personal experience, that I arrive at work more fit for work after 45 minutes of doing something cool and relevant, than after sleeping for 45 minutes more.

Use test driven development to save time

When I arrive at work, I can just forget about the comfort of making changes, alt-tabbing to firefox and refreshing to see the changes. There are some smart ways of avoiding server restarts, but the most important trick I've learned so far is to do use tests as far as possible before I deploy to the server and do the final testing. This way I save time, and I avoid sitting and waiting for that server, just to loose the patience and start looking at dzone for something useful. Oh, and then you also have the usual benefits of having a test suite to help you when you find out that you have to refactor that stuff.
Update (2008-10-31): Learn mockito. It is wonderful to just write someComplicatedClass = mock(SomeComplicated.class) instead generating a mock manually.

Refactor that stuff

I've recently read Michael Feathers "Working Effectively with Legacy Code", and it contains a lot of useful hints about how to get your code testable and how to add features in a safe way, but it was first at Robert C. Martin's speech at JavaZone this year that I became really inspired to make existing code more readable. If you've time, watch that presentation. It is available here. He recently published the book "clean code". Guess I'm going to buy the book. Just watching his presentation about functions was enough to go back to work and turn a 1200 line monster class into a much more readable class of less than 500 LOC. And I'm not finished with it yet.

Find some uninterrupted time, any uninterrupted time

(I don't do this anymore. But it worked 2 years ago, before I got married.) Sometimes I've found it better to trade in a couple of hours of sleep for a couple of calm hours. If your day is filled with interruptions, and you don't have a family to take care of, try sleeping a couple of hours (not more) in the afternoon. By the time the interruptions are going to sleep, you are (hopefully) wide awake and ready to get some real work done. Uninterrupted. And since you're not paid for it, you decide what to prioritize. In the morning, you might find it useful to sleep a couple of hours again, just so you can stay awake the rest of the day.

Update: Learn The Pomodoro Technique

(2008-10-31)I have just started learning "The Pomodoro Technique" and, so far, it has been a very interesting experience. Basically it helps you staying focused and avoid internal and external distractions. Add to that that you could learn the basics in less than one hour, and that you don't have to convert your whole team to increase your own productivity.

Update: Get a headset

Headsets serve two purposes:
  • Inform coworkers that you're trying avoid beeing interrupted
  • "Mask" conversations to avoid beeing distracted.

You found out something useful? Blog about it

How many times have you searched for something just to find the answer at someones blog? If you've had a hard time finding out something, chances are that someone else on this planet is wondering about the same. An example: I recently had a lot of work to remove a trojan until I did a search on google for information updated last 30 days about tdsserv. It turned out to be a very new trojan, first observed around 15. of september, as far as I understood the information. I posted the solution to my blog, hoping that someone else might find it useful, too. Last time I checked, I had three results coming in from search engines, related to that post, so obviously, I was not alone. It won't get me rich, but at least I'm sharing back.


Delphi for Java developers

Why is there no book titled Delphi for Java developers?

I guess I'm not the only software engineer who has been forced to learn Delphi after Java. The reason is of course not that the company I'm working for at the moment is moving to Delphi, but rather that they have some programs written in Delphi that still needs maintenance.
Learning Delphi after Java give some interesting insights into programming language design. After I started to learn Delphi, I've started to appreciate Java more and more, just because Java is so clean and so simple. I've also started to see that language features that sounds nice when you first hear of them, can turn out to create really hard-to-read code. Here are some examples I'd like to mention:
  •  the with statement in Delphi. The with statement can save you for some typing, and could even make your code look a little more elegant, however, it's one of the features that makes Delphi code harder to read. (BTW: Here is something that you can do to make your code a little more elegant, and even save yourself some typing, hopefully without making it hard to read.) 
  • Another feature that Java "lacks" is global variables. (OK, I admit, when I was younger, I couldn't understand why people whined about global variables. Having to read and understand others peoples global variables really helps a lot on that understanding..)
  • You don't need parenthesis after function/method calls if you're not passing parameters. In Delphi it's not necessary to include parenthesis after a function or method call, if there is no parameters. Seems like it's not even laziness, but rather considered best practice. Sounds smart, but at least for my eyes, it isn't obvious that "SomeMethod" is a method call.
  • More than one public class can be defined inside a Delphi "Unit" (a Delphi source code file) . Even worse, the intefaces of the contained classes are at the top of the file, and the methods that makes the rest of the class can even be mixed at the bottom of the "Unit". Of course I guess mixing implementations is bad style, but guess what: If bad style compiles, chances are somebody is going to introduce it.
  • To make things even worse, Delphi doesn't have package trees or wildcard imports, so it's even more tempting to put many classes into one unit.
  • The Delphi IDE (of earlier versions) is composed of many top-level windows, instead of a main form. Today I heard someone talking about this as one of the features of older Delphi versions, but I clearly disagree. It is however better than gimp's interface in that if you activate one Delphi window, the rest of them are also activated.
For Delphi hackers who might read this: I guess my views are heavily influenced by the fact that I learnt Java first. If I've written something wrong, please write a comment about it, or even better: write a follow-up on your blog, cause I'm trying to learn Delphi, and I know there must be some reason why so many programs are written in Delphi, except for the speed.
Btw: Here is some interesting Delphi links I found a while ago:


Another anti-virus solution

Tried vipre yesterday on a customer pc. After a 6 minute scan it found and removed the trojan (TDSServ) that neither spybot, trend or avg managed to remove. I think it is the worst trojan I've seen so far, hiding from the Windows API, redirecting requests for security related domains to various other domains, including, if I remember correctly, qxl.no and thefreedictionary.com (instead of the usual spam search engines and spam portals). So I had to read every security site through the google cache, or from another computer. :) The reason I found vipre? Sunbelt software had posted research materials mentioning the specific trojan on their web site. I guess there is a lesson for everyone who's thinking about seo here: go ahead, post relevant stuff on your webpage. It has a strange way of attracting readers that is actually interested in the stuff you sell. After finishing the job, I bought a license, even though the trial version had fixed the problem. I guess 30$ is cheap for avoiding all the hassle with hijackthis etc, etc and going home early.


About Java, closures and attracting new developers, part II

(Warning: A web developers perspective.) I've been thinking of this since I wrote the post: About Java, closures and attracting new developers, where I tried to prove that the problem with Java is not related to the lack of closures. At the risk of offending the rest of you, here comes my explanation of why I don't use Java for my spare time projects, even if I like it.
  • The web server (I mostly use tomcat 6 at work) takes to long time to restart, so long time that it quickly becomes painful, especially when you add to this that:
  • you have to restart it every time you've changed a class.
  • The recommended web framework, JSF (JavaServer Faces) doesn't care about URLs. By default it will show the URL from the last page you visited.
  • JSF has a really unnecessarily complicated template language. I mean, I can't see the reason for having to use <h:panelgrid> when what you wanted is just <table>. Not to mention that there is no <div> tag in the default component set. Of course, you can just use a component set that has one, (or make your own if you have a couple of hours to spend,) but I guess you see my point.
  • JSF messes around with my id's, even if I've not asked it to do that. To get around that limitation you once again has to use a different component set (tomahawk comes to mind).
  • You don't have access to the javascript that is used. Of course this is touted as a benefit of using JSF, but in my opinion it's just a horrible violation of the rule about separation of concerns. What happens is that you can't just include that standard well-tested javascript library you want, which means you have to use jsf components again. And guess what: Those components are broken, and it always ends up with a lot of extra work for the designer.
  • And of course: JSF isn't the only problem with Java. Take something as simple as how to print a line of text to the console: "System.out.println()", or think about trying to open a file for reading. With execuse to every swede who reads this, we have a childish joke here in Norway that goes like this "How many swedes do you need to change a light bulb?" The answer is 1000, one to hold the bulb, and 999 to turn the house around. Same goes for Java, - how many objects do you need to read a file line by line? Or to resize a picture? (Yes, I know Fabrizio Giudici has tried to defend it, but I do not agree. Often, the Java API's seems way to low level, and my feelig is that sometimes you have to use one factory class on top of another. Also see next point on why this is more of a problem than it could have been.)
  • The documentation is also painfully unbalanced: There is a lot of javadoc generated API documentation everywhere, but I can't think of a single place to find something like askeet, -a well thought out demonstration of how to use the api or framework your're providing. (OK. I can remember to have seen som interesting blog posts over at http://weblogs.java.net. Example.)
But yes, I still use Java at work. And I still think Java is a great language, and a great platform. It just lacks a good, full stack web framework with great documentation, running on a fast server that doesn't need to be restarted many times an hour. (Edited: 2008-09-30)

Updated 2008-12-14: Symfony has done it again! More documentation available here: http://www.symfony-project.org/jobeet/1_2/Propel/en/


A really great time logger

Are you already using KDE? If so, you're in luck, cause the best time logger I've ever seen has been available on KDE for years.

Karm (forget about the name, it's a KDE thing that almost every name starts with a K) logs the time you spend on each virtual desktop. Just place all programs related to each project on a separate desktop, and all private stuff (like instant messenger, gmail etc) on the last one. Then set up Karm to track time on the different desktops to the projects.

Also, if you leave the computer for more than a few minutes, when you come back, Karm will ask you if you want to include the time since last activity or not.

Just one more reason why I like Linux, and KDE in particular.


Update: Ubuntu on GIGABYTE ga-73pvm-s2h

Earlier this year I installed a new computer with Silverstone SST-LC17 case, GIGABYTE ga-73pvm-s2h mainboard, 4 GB RAM and Intel Core 2 processor. The power supply was a Fortron Source Zen 300W. The computer was built from a recommendation from hardware.no, who also suggested that the pc should work with mythbuntu. After I've testet it, my conclusion is that it will need a better power supply. You can read more about the experience here.

I've now upgraded the machine to Ubuntu Hardy, and I'm happy to say that it was an even better experience this time, as sound worked out of the box to.

However I stil had to install Nvidea drives manually. Envy was still installed from last time, but the old version wouldn't work with Hardy. A quick search revealed that there's a new version of envy, named envyng, and that the new version has even made it into the ubuntu multiverse repository. Before I removed the old envy, I used it to remove the old Nvidea drivers. Installing the new envyng is just a matter of running sudo apt-get install envyng-gtk . (There is a qt version too, but installing that meant downloading more libraries so I chose the gtk version.)

Now, I'm struggling with getting kvm-based virtual hosts to run behind a bridged interface on this machine, as it's my personal server, camuflaged as HTPC to increase WAF : )

Hope this helps, and again, big thanks goes to everyone who blogs about technical stuff! (Oh, btw, if you know how to make kvm work with bridging on hardy heron, please post a comment here  with a link : )


Had a really strange problem with JSF before the weekend. A command button was supposed to save the form, but instead, the page would just rerender, as if it failed validation. It turned out to be just an ordinary null pointer exception, but it took some time to realize that because no stack trace showed up, and the h:message box was empty.

I guess sooner or later someone will search for this problem, so here is the post I found that solved it: http://forums.sun.com/thread.jspa?messageID=3263230  . I had to change it a little to get it to work, but I guess those changes has disappeared since then. (Of course I didn't submit those changes, as they were just for debugging.)

(Yes, someone is going to search for what you just found out, so you better start blogging now. Big thanks goes to everything is Broken for sharing how to get the Trust Flat Scan USB 19200 working under linux.)


About Java, closures and attracting new developers

Julian Exenberger has an interesting post where he states that of the top 10 languages on the Tiobe index, Java is the only one not to support closures in any way, either officially or by at least som kind of (planned) support. He goes on to state that Java is going to be perceived to be obsolete, and it's going to be a harder sell in the enterprise because of this.
Another possible explanation
It might be that the Java crowd is panicing about the wrong thing. Surely, Java.next, as Stuart Halloway describes in his article Java.next: Common Ground might turn out to increase productivity a lot, but I guess language features are not the reason why some1 developers are leaving Java for Ruby or less known languages. I guess the reason why Ruby got popular is because of Rails2. Sure, the Rails people argues that it's better because of things like "metaprogramming", dsl's etc., but then, why is it possible to make an equally good, if not better, web framework in PHP? And why is everyone still talking about Ruby, and not about Django, TurboGears, symfony?

Here is what I guess: It's because of the enthusiasm in the Ruby camp. They're not very many, but they have a good language, they innovate, and they make a lot of noise! What Java lacks most is enthusiasm. Innovation can be copied (it's mostly open source), and lack of language featueres can be programmed around3, but not without enthusiasm, that is not going to happen. 

Of course there used to be a couple of reasons for that lack of enthusiasm, but they're starting to really fade away. Here are some examples: 
Focus on strength

Java has some unique features that makes it stand out. If we want Java to succeed, advocates of the language should focus on things like:
  • Supported by multiple big companies.
  • Secure. Java is widely perceived as a very secure programming language.
  • A clean language.4
  • Very good ide and debugging support.
  • Both Ruby, python and PHP are available on top of the Java platform, together with some Java-only languages like clojure, scala and groovy.
I have left out the open source argument, and the multi platform argument, because both of these holds true for both Ruby, python and PHP.

Java isn't dead, and it doesn't need to die even if Sun doesn't add all those cool features people are asking for. Start beeing enthusiastic!

1: Yes, I'm not writing many. Most of us still use Java, and it even seems that more people are still searching for java programming than for ruby programming: http://www.google.com/trends?q=java+programming%2C+ruby+programming
2: I guess this is evidence enough: http://www.google.com/trends?q=ruby+programming&ctab=0&geo=all&date=all&sort=0

3:  Yes, I am talking about my favourite web framework, symfony. Programmed in php, which, in case you didn't know has no closures (yet), and is not elegant at all, but rather ugly. I mean, having to prefix variables with $, and using "->;" instead of "." is just ugly. But that doesn't prevent sensiolabs from creating a super effective web framework out of it, and it has not prevented yahoo from choosing it over rails for both the new delicious site and yahoo answers.
4: I sometimes spend some hours maintaining Delphi code, and there is a couple of features that I really dont like, like the "with" keyword, that saved the previous author from some typing at the cost of making that hundred lines function even more unreadable, and the possibility to mix two different classes in one unit, and even mix the implementations!


5 minutes well spent: Automatic notification about new information on the web

Todays post is about two techniques to get automatic notifications about new information on the web.

First out is Google's free service "Google Alerts."

Some interesting uses:

  • Get notified when other people write about your company.
  • Get notified when other people write about your competitors.
  • Get notified about what other companies/organizations write. (example: make a search for site:tomra.com.)
  • Follow interesting, but not (yet) very hot technologies. (example: seam wicket)
After registering your search, you'll get an email with a confirmation link. This is a technique I use to keep up to date with less surfing. The advantage over just collecting links to various searches is that with Google Alerts, you'll only get the new and updated pages. And you get it delivered to your inbox automatically. Just make sure you make a rule to filter out those alerts to a different folder, so you can read them in a batch. The second tip is to use the firefox extension Update Scanner. I use it for web sites that both are not indexed and have no RSS feed. Examples are the forums for the delphi build tool "want".


Delphi maintainers survival kit

This is going to be a short post. Just wanted to share my most important Delphi books in case there are other Java programmers out there who has to maintain Delphi apps. I like "Delphi in a nutshell". Especially the first two chapters which gives you a brief introduction to Delphi programming, and chapter 5 that is a (big) alphabetical language reference. Developer's Guide to Troubleshooting is a description of almost 1000 error message that you may get when programming Delphi, design-time, compile-time and run-time error messages. Great reference in case the company Delphi guru is at holiday when some strange error pops up : ) The USB stick below contains articles from issues 1 to 139 of The Delphi Magazine. There's a lot of well written articles there about different aspects of Delphi programming, including "cool" topics like unit testing and how to set up Delphi build scripts. Seems like blogging is less common in the Delphi camp, and it seems that those who do post about Delphi mostly writes for other Delphi developers. If you know anyone else who already blogs about it, please post a comment with a link to it. I would really appreciate it.


Ubuntu post-install customization

Here I've collected some of the things I did last time I installed Ubuntu from scratch on my commuting-part-time-LAMP-developer laptop.
  • Get security upgrades.
  • Install my favourite firefox extensions:
    • Firebug. The must have web developer extension.
    • Delicious bookmarks. I don't care much for the social part of it (at least right now,) but I consider it the best bookmarking feature I've found.
    • Scrapbook. Commuters best friend! Allows me to download web sites recursively, read, and even search in downloaded web pages.
    • All-in-One gestures. (I absolutely love keyboard shortcuts, but when I am using the mouse, why change back to the keyboard just to go back to the previous page? With mouse gestures it's just pressing the right button and drag the mouse to the left, release, welcome back.)
    • Google gears. (For offline access to Remember the Milk.)
  • Install LAMP-server. (Using Synaptic.)
  • Install subversion.
  • Install php-pear.
  • Install symfony by running the commands below in a terminal:
    • sudo pear channel-discover pear.symfony-project.com
    • sudo pear install symfony/symfony-1.1.0
    (Symfony is, in my opinion, one of the best php frameworks out there. Maybe also one of the best web frameworks, regardless of language.)
  • Download PHP Development Tools. Since last fall, Ive considered the eclipse based PDT a better alternative than anything else I've used, including both commercial and open source alternatives. Earlier I used to use jEdit, an awesome heavyweight text editor (hey, I've got 2 GB RAM, and I don't really care if it uses 40 MB as long as it is the best editor I know.) in combination with a lightweight alternative like notepad++ (on Windows) or gedit or kate on Linux.
  • Download the php documentation.
  • Using the Scrapbook extension mentioned above, download the symfony 1.1 book. (After installing the Scrapbook extension it's just a matter of right clicking the site, choose "Capture Page As..." from the context menu and set depth to follow links to "1" under "In-depth Capture". And if you're in a hurry, like me, choose "Filter" and "Restrict to Directory", so that you'll only download the relevant files.
  • Install keepassx and copy the old database from the backup. I use it to keep rarely used passwords, serial keys (e.g. vmware server,) and other details that I don't want to be available for whoever uses my PC.
  • Install vmware server.This used to be a matter of installing it from the repositories, but now it's slightly harder. Here is the best way I've found to install it on Ubuntu Hardy Heron, a script made by Brett Alton.
Edit 2008-07-22: Forgot a couple of details when first publishing this post last night.
  • Add nautilus-gksu from repostitory.
  • Add nautilus-open-terminal from repostitory.
  • Add edit as root to the nautilus context menu. It really shouldn't be necessary to open a terminal to edit /etc/fstab . (e.g. for enabling acl)
Edit 2008-07-30: Another detail:
  • Add php-xsl from repository. Without this, data-load doesn't work.
Btw: Seems like I'd rather use this checklist myself next time : )


New web site for want

Want, the Delphi build tool I wrote about back in february, has launched a new web site: want-tool.org.

Looks like the new site is mostly geared towards the development of want 2, while I personally would have preferred some fixes to want 0.3.0 :)

Anyway, thanks for the great work you've done so far by giving us want, and I'm looking forward to see if you can make something even better. If want 2 doesn't turn out to be what I want, then I'll maybe patch 0.3.0 myself if i get tired of removing useverbose-statements. Hey, want is not bad (I tried want and finalbuilder in parallel but decided to go with want, because it's easier.)


Why Mandriva isn't perfect

Having used Mandriva for a couple of weeks there's a lot to like about it, like

  • a nice default theme (so you don't have to use a couple of hours just to get rid of the Ubuntu-brown interface
  • KDE done right: KDE looks good in Mandriva. With some other distros it's not hard to understand why people don't like KDE.
  • Suspend/resume just works. Ubuntu broke suspend resume a couple of days before Hardy Heron was released, at least on my machine. (To be honest, I didn't reinstall it from scrath, that might work. But I have reported it on launchpad, and I'm not the only one who've seen this bug.)
  • Elisa media player. It rocks!

However there's also something i miss about ubuntu, most notably:

  • sudo. It just feels smarter than a shared root account. And if I really want to be root, I just write sudo su.
  • Easy to use virtual hosts.
  • Better documentation
I guess Mandriva would be a good all purpose Office and home user OS, but for development I still prefer Ubuntu, if only suspend/resume would work.

Vista: Not ready for my desktop, yet


I've installed Vista on another computer today. Think it's the third time I install Vista on a pc. And this time I got it installed in less than one hour. I expected it to take at least a couple of hours based on my previous experiences, so i was pleasantly surprised.

I even thought about installing Windows Vista on my laptop, but then the PC used several minutes just to install a Microsoft mouse driver from a supplied CD, which led me to the conclusion that Vista isn't quite ready for the desktop yet. At least not my desktop. I also noted that there was a program named "Installshield Update Service Update Manager", and judging by the name, that should be something like update manager on Ubuntu. However it didn't work out of the box. (It pops up some message boxes about Internet Explorer script error.) Seems like someone has tried to copy the automatic update feature from some Linux distro they've seen using vbscript. I really appreciate that this feature is coming to Windows, but it will needs some more polish.(Yup, I know that Windows has automatic upgrades, but thats only for the core operating, and optionally some other Microsoft programs.)

I guess I wont buy Vista if it's not preinstalled on my next PC. And hopefully, by then I can get that PC with preinstalled Linux instead.

Also have a look at this article: http://www.theregister.co.uk/2008/04/14/linux_manual/page2.html, especially the paragraph about missing features in Linux, like "Windows genuine disadvantage", "the Windows pause" etc.



Changing from Ubuntu to Mandriva

The new Ubuntu Hardy Heron release broke suspend / resume on my hp compaq nc6320. The bug is reported on https://bugs.launchpad.net/ubuntu/+source/linux/+bug/219657.

For me, however this was the a good excuse to try something new. So I'm running Mandriva Spring 2008.1, and it seems to be a really good release. If you think Ubuntu is well polished (I used to think so,) then think again. Mandriva just works with my laptop too, it makes KDE shine (I used to use KDE before Ubuntu,) and after a year of brown it is really refreshing to have a blue default theme.

What I miss most is sudo(!). Another thing I found out tonight was that there seems to be no bittorrent client installed by default.


New use for subversion

Have you ever been in the situation where you need to figure out exactly how some legacy software works? I have too, a couple of times. This time I was trying to make a build server for some old Delphi stuff, when I suddenly realized that much of the hard work could be simplified considerably by using version control together with vmware workstation. So I thought it might be worth sharing.

Here's what I did:

  1. Installed xp on a virtual machine.
  2. Checked the Borland\Delphi folder from program files into a subversion repo on my physical machine.
  3. Installed cygwin and did a ls -laR>>somefile.txt from windows/system32, and checked the file into subversion.
  4. Exported each of the root branches from the windows registry to text files and checked them into the repository.

Now, for each upgrade I do, I can just check the new files into the repo, save a snapshot of the virtual machine and continue. If something goes wrong, rewind the virtual machine and try something else.

By having the registry dumped to text files I can at least use a good diff tool to see what each update has changed.

Hope this helps someone else, cause I wish somebody had told me this a couple of years ago.


I never thought of using tail that way before

While debugging a symfony app I suddenly realized that I could grep tail:

tail -f log/frontend_dev.log|grep someword

I realize it's quite obvious, it just took a couple of years before I thought of it :)


Update: Ubuntu on GIGABYTE ga-73pvm-s2h

Turned out that the built in sound card didn't work with ALSA. Here is what I found: ubuntuforums.org/showthread.php?t=684839. Here's the command that fixed it: sudo aptitude install linux-backports-modules-`uname -r`. Just needed one more reboot after that and everything worked!


Building Delphi programs using Want

I've recently been trying to get some Delphi code into continuous integration using want. As there's very little available documentation on the net on this subject, I decided to collect what I've found out.

Want is an ant-like build tool for Delphi. It's available from sourceforge.net, but if you want the latest and greatest binaries, you might (at the time I'm writing this) just as well download it from this confluence page. There's also a jira issue tracker on the same site. You'd most likely also want to have a look at a new page about want available here:www.optimax.com/want/, and the forums that are available at the same site. Although want is no longer maintained by the original author, it seems he's still frequenting the forums. Seems like Delphi build tools is a rather odd topic, so there's almost no flaming and also few pleeeaase help me! topics :)

I'd also like to link to some articles that talk about want. Here's one from CODEGEAR, and from elvenware.

If you're serious about using want for your Delphi builds, the best thing you can do is probably read the builds scripts from the want project itself, and from the DUnit project. They are both easily available from this page: www.suigeneris.org/kb/display/WANT/Home.

Finally: Don't forget to have a look at these alternatives: NAnt (open source) and FinalBuilder (commercial). Here's an example of how to build a Delphi project with Nant and CruiseControl.Net: Extreme Programming in a Delphi Context.

Have you used want, tried to get Delphi into continuous integration?

Delphi 6 and Perforce

Using Delphi 6 with Perforce can be a cumbersome process. Coming from Eclipse I'm used to having the IDE opening the files for edit. Last week I tried to get Delphi to do the same. Here's what I did:

  1. Search for delphi perforce 6
  2. First result: Chris Fairall's Home Page - Delphi
  3. Dowloading, compiling and installing, gives a new menu:
  4. I tried to click logout on the new menu. That was stupid. Trying to login again I got this message box:
  5. Agent Ransack, search for files containing ExplicitTop. Thats FormLogin.dfm
  6. Open in notepad++, remove both occurrences of ExplicitTop
  7. Return to Delphi. Recompile, install, login.
  8. It works! I can log back in. Now if could only remember the password : )


Ubuntu on GIGABYTE ga-73pvm-s2h

(Updated information is available here.)
I recently installed a new computer with Silverstone SST-LC17 case, GIGABYTE ga-73pvm-s2h mainboard, 4 GB RAM and Intel Core 2 processor. The power supply was a Fortron Source Zen 300W. The computer was built from a recommendation from hardware.no, who also suggested that the pc should work with mythbuntu. After I've testet it, my conclusion is that it will need a better power supply some day. As of now, it sometimes won't start properly before I disconnect the network and some external usb-cables. After booting however it works smooth. The next problem was that the video drivers wouldn't work out of the box with both ubuntu and mythbuntu. I also tested with fedora, and in fedora everything just worked. However, installing mythtv on fedora seemed to be a rather cumbersome unless you can live with fedora 6, so I reistalled mythbuntu, and this time I found envy, which solved my video driver problems. I've been a little concerned about how the mainboard would work with linux, but now everything is running smooth.