Are they out of their mind?

19. February, 2010

I while ago, I downloaded the demo for X-Men Origins: Wolverine. It’s a PS3 game and I like Wolverine, so I was really excited. Whoa, they really spent some time on the levels … lush forests … tree roots, plants … okay, I can’t leave the paths (in games, heroes can’t climb or crawl … see my post on Batman Arkham Asylum *sheesh*).

Anyway. I played a while. Hack’n’slay (you have to chop people to bits with Wolverine’s claws … so he has no brain, either … oh well). Then, there was that helicopter scene. You’re on a rope bridge or an edge or something, I forget. There is this helicopter with the machine guns, making your life (or rather the game character’s life) miserable. So you jump on it, slice the window, pull the pilot out and … chop his head to bits with the main rotor of the ‘copter …

What did you feel in that moment? Please comment below.

I felt: WTF?

In an instant, I found the game revolting. All my impressions about the nice graphics, all the artistic work was washed down with a wave of disgust. To my shame, I continued to play until he end and took out the last boss. Okay, there are special moves and such … but for some reason, I didn’t buy the game and I deleted the demo without hesitation. Later, I saw a game review in TV where they showed a lot of special moves, how to use spikes and your environment to impale your enemies and gore them in various ways. For some reason, they ran it in the afternoon, around 1500.

Frankly, are you out of your mind? I’m not a softy or against so called “killer games” but some time last year, a border was crossed for me. Wolverine. Wet. Bayonetta. Brain-dead games, meant for simple button mashing, asking for the reflexes of a 15-year old but with the graphics of a motion picture.

I’m not sure who pays the money to produce such games. I’m not sure who works on such games. I’m not sure which person at Sony gave their OK for the production or distribution of such games. I don’t care. I don’t care if you think it’s OK. I don’t care if any court think it’s OK.

I’m proud to say that I feel this is WRONG.

Maybe you should read up a bit on how the human brain works. For everyone else, just don’t buy such games. They are a waste of time and money. And while there is no proof that they are bad for your soul, they aren’t any good either. As I said: A waste.


ePen 0.8 status update

8. February, 2010

Followup to my last ePen post: All but the first point are resolved. You can open an existing project by specifying the path on the command line but that’s too tedious for something which is supposed to be simple. Since I want to give a good first impression, I want this fixed before I release 0.8.

For spell checking, I’ve switched to jazzy which is more simple to use than JaSpell. You can find the repository with my fork here: http://epen.hg.sourceforge.net/hgweb/epen/jazzy/. Unfortunately, just invoking the spell checker for every key press is too slow, so I had to disable the code for the time being. I’ll resolve this with ePen 0.9 where I hope to fix some other issues with the editor as well.

[EDIT] The project home page is at http://sourceforge.net/projects/epen/


When you’re right, there is no middle ground

15. January, 2010

Yesterday, I attended a talk by Tom Schindl (he’s the guy behind UFaceKit and Qooxdoo, QxWT, etc.) And he’s working on e4.

During our little conversation after the talk, he stressed the fact many people aren’t willing to pay for bugfixes in Eclipse. He’d be willing to work on many of them but someone has to pay the bills. I nodded like everyone else. And we talked about Eugene Ostroukhov and his complaint ““Participate in community!” they said…“. And I immediately saw a parallel in my own history. I had a similar, painful experience with Ed Merks a while ago. That was about EMF and how badly it sucks. And that he didn’t listen to me.

I was mad because I was right and he just didn’t get it.

Yesterday, on the train home, I understood.

I’d like to introduce two new categories of programmers. Both are passionate and enthusiastic about software. The difference is that one group is pragmatic and the other idealistic.

Ed and Tom are pragmatics. They think: “Great feature, I like it, how much will it cost?” If it’s too expensive, they don’t get upset. They think about it, mull it around, consider their options. If there just is no viable way to do it, they can accept that. These people get money to write software.

I’m an idealistic programmer. I get money to stop writing software. That is, I get money to stop writing the software in my head and to start writing the software someone else wants. Not getting what I envision drives me up the wall.

Things can get pretty ugly when those two kinds meet. Because both are egoistic and both are right. It would make sense to make all the changes to EMF that I want. For me and probably a few others. It would cause quite a few problems for Ed, though (mostly because he’d get a lot of complaints by those people who are happy right now).

I’m asking for changes because I have problems. I’m not complaining about petty things. I need to bend EMF and SWT more than the API allows. To solve my problems, I just can’t accept the status quo. The API has to move. But my solution would cause problems for many other people.

Right now, I’m writing software which doesn’t have a lot of customers, so a stable, reliable API is not one of my goals. I can change my API at a whim and no one bothers. Eclipse has millions of customers and every change to any API will cause a tremendous amount of pain around the globe. Say 0.1% have a problem now? That would be at least 1’000 people complaining. One happy, 1’000 after your head. At least. How big is the pressure on Ed to make me happy?

So how to win? I think Linux has the best solution that you can get today. Linux has several release streams that strive in parallel. It’s not a bunch of forks, it’s a bunch of branches. People can hand in stuff that really isn’t ready for prime time. It can be incomplete. It can break other APIs. It can be an experiment. It can evolve. In Linux, there is the next tree.

In Eclipse, evolution is hard. You have to get new features and patches past people you don’t know, who have more experience in evolving APIs, little time and little incentive to hurt themselves. API in Eclipse is hard to evolve because IBM pays many of the core developers. If someone wants some obscure API and the Lotus Notes team will have a problem with that, who will win? The bug report (even with a patch) or your next pay check? There are only a few big commercial products on Linux. Eclipse, OTOH, was created to form the basis for commercial products (hence the EPL). Products that have life cycles between five and ten years. Ten years ago, we had Linux 2.2, KDE 1.0 and SuSE 6.3.

For IBM and SAP, the one year release cycle of Eclipse is way too fast. They have to spend a lot of money on developers just to keep up with all the changes going on in Eclipse and this is for things that can’t be sold to customer (i.e. which don’t earn any money).

So I agree with Bjorn Freeman-Benson that Eclipse needs a set of public git repositories and a low-barrier entry to these repositories (which means one-click install for the build system, no IP checking). It should be a playground, a place where ideas can grow. Not all of them will make it into the mainstream but at least, people can solve their problems without hurting too many others.

At the same time, I’m afraid what will happen when this comes true. But then, I’m an idealistic programmer. I believe that time will tell who was right and that we shouldn’t bother too much upfront.


ePen 0.7 Status Update

9. January, 2010

I’ve pushed the code for ePen into a new set of Mercurial repositories: signal (a signal/event handling library, new BSD license), JaSpell (fork of the project jaspell.sourceforge.net; mainly a port to Java 5 and Maven 2, BSD-License) and ePen (the main editor, Eclipse Public License 1.0 since I had to copy code from the Eclipse code base).

The editor is pretty usable and I hope to wrap up 0.8 next week which should fix the following issues:

  1. Create new projects and open existing ones. The main problem here is that an ePen project is a directory and SWT doesn’t offer very good dialogs to select directories. Right now, the editor will create a demo project when you start it the first time.
  2. The translation mode is too slow
  3. Editing is sluggish.
  4. HTML export should support filtering by state (to allow to export only “final” scenes).
  5. Setting up the development environment is too complex. Especially the part where you need to copy the Eclipse plugins into the Maven repository. 0.8 will come as one huge JAR which you can start with a double click.

After that, I plan to resume work on my story “Haul” and post the first scenes in my old, desolate Philmann Dark site.


Making web development a bit more simple

3. January, 2010

When someone starts to make a path, most people tend to follow the trail. So when Sun introduced the Servlet API, most people were uneasy about the design problems:

  • Servlets are singletons (which are evil; this is due to performance problems in Java 1.2 which have been fixed about ten years ago).
  • The resulting code smells (feature envy since you call many methods of HttpServletRequest/Response, long method since you can’t call subdivide the doGet() without passing at least two parameters to each new method, duplicated code since you have to walk instance trees to get at a lot of information, …)

Whenever I see Java servlet code, I always wonder why people don’t solve this. It’s so simple:

public abstract class ServletRequestHandler {
    protected HttpServlet servlet;
    protected HttpServletRequest request;
    protected HttpServletResponse response;
    protected String contentType = "text/html";

    public void init(
        HttpServlet servlet, 
        HttpServletRequest request, 
        HttpServletResponse response
    ) {
        this.servlet = servlet;
        this.request = request;
        this.response = response;
    }

    public abstract void process();

    public PrintWriter out() {
        if( null == out ) {
            response.setContentType( contentType );
            
            try {
                out = response.getWriter();
            } catch( IOException e ) {
                throw new RuntimeException( 
                    "Can't get writer", e 
                );
            }
        }
        return out;
    }
    
    public ServletRequestHandler html( String html ) {
        out().print( html );
        return this;
    }
    
    public ServletRequestHandler attribute( String value ) {
        out().print( escape( value ) );
        return this;
    }
    
    public ServletRequestHandler attribute(
        String name,
        String value
    ) {
        if( StringUtils.isBlank( value ) ) {
            return this;
        }
        
        PrintWriter out = out();
        out.print( ' ' );
        out.print( name );
        out.print( "=\"" );
        out.print( escape( value ) );
        out.print( "\"" );
        return this;
    }
    
    public ServletRequestHandler text( String value ) {
        out().print( escape( value ) );
        return this;
    }
    
    // Add more methods to support your favorite
    // web design patterns
}

Now, all your servlets look the same: They accept the request, create a new instance of the right implementation of ServletRequestHandler, and call init() plus process(). With a bit of glue code, you can even use Spring to manage all your servlets for you. No more dabbling with web.xml!

And the best part: This pattern allows you to test the servlet code from a unit test without any container. Just use Spring or Mockrunner to get mock-ups for the J2EE API classes.


ePen 0.7

31. December, 2009

I’ve started to work on ePen again. This time, I’m using Java and SWT/JFace. Python Traits was nice but too slow for my purpose, especially the editor.

This is the main window. As you can see, there is an outline with all characters, places, items, wiki pages and books (with chapters and scenes). The whole thing is meant to save all the information in one place so you can easily find and use them.

Do you see all those nice links? The editor will create them for you from names of characters and other things. If you click on them, you’ll jump right to the meat. I’m thinking of a hover mode where you get a summary but there is a bug somewhere.

The other feature is: No save button. The editor will save your work as you type. If it crashes or your whole computer crashes or there is a power failure? No sweat. Worked for an hour and forgot to save? Won’t happen again. I’m still working on automated backups plus a client/server mode so you can have automatic off-site backups, too.

Right now, I’m shaving off a few rough edges. Then, I’ll drop it on sourceforge.

[EDIT] The project home page is at http://sourceforge.net/projects/epen/


SWT Tree and tooltips

26. December, 2009

If you need tooltips for elements in an SWT Tree or JFace TreeViewer, you had to jump through some hoops as Snippet 125 shows.

Since SWT/JFace 3.3, you should use a TreeViewer, a ColumnLabelProvider (which has all those cool getTooltip() methods) and this line of code:

ColumnViewerToolTipSupport.enableFor (viewer);

That’s it. There is a catch, though: The tooltip doesn’t wrap automatically. If you have long lines of text, you need commons-lang and this piece of code:

    private String wrap (String s)
    {
        StringBuilder buffer = new StringBuilder ();
        
        String delim = "";
        for (String line: s.trim ().split ("\n"))
        {
            buffer.append (delim);
            delim = "\n";
            buffer.append (WordUtils.wrap (line, 60, "\n", true));
        }
        
        return buffer.toString ();
    }

Note that this code is only necessary if you have several lines of text in the tooltip. For single long lines, WordUtils.wrap() alone is enough.

Link to the JFace snippet.


How to make Eclipse 3.5 work on gtk2 2.18

24. December, 2009

If you’re using Eclipse in Linux with gtk2, then you might have run into this issue: Buttons don’t work when you click on them, tree views are initially empty, icons are missing or not drawn correctly. To fix this, just run this command before you start Eclipse:

export GDK_NATIVE_WINDOWS=1

I suggest that you put it into a little wrapper script. With this option enabled, Eclipse works like it should, even on Linux/gtk.

It’s a good example of the pain when working with Eclipse developers: Everyone agrees that it’s a bug and it’s pretty clear what needs to be done. The fix apparently even exists and “just” needs to be copied from the 3.6 sources to 3.5. And nothing happens because the release process is so involved that it just takes too much time and the workaround (adding the line above or control Eclipse with the keyboard) is too simple.

I can’t say on which side I’m on here. I understand why nothing happens but it still freaks me out.


Finding unindexed foreign key columns

15. December, 2009

If you’re using Oracle and you have tables with foreign keys, then you must remember to add indexes to all the columns in the referenced tables (i.e. the foreign tables). If your schema has more than two tables, it’s hard to make sure all the necessary indexes exist. Fret no more and let Oracle do (most of) the work for you:

select table_name, constraint_name,
       cname1 || nvl2(cname2,','||cname2,null) ||
       nvl2(cname3,','||cname3,null) || nvl2(cname4,','||cname4,null) ||
       nvl2(cname5,','||cname5,null) || nvl2(cname6,','||cname6,null) ||
       nvl2(cname7,','||cname7,null) || nvl2(cname8,','||cname8,null)
              columns
    from ( select b.table_name,
                  b.constraint_name,
                  max(decode( position, 1, column_name, null )) cname1,
                  max(decode( position, 2, column_name, null )) cname2,
                  max(decode( position, 3, column_name, null )) cname3,
                  max(decode( position, 4, column_name, null )) cname4,
                  max(decode( position, 5, column_name, null )) cname5,
                  max(decode( position, 6, column_name, null )) cname6,
                  max(decode( position, 7, column_name, null )) cname7,
                  max(decode( position, 8, column_name, null )) cname8,
                  count(*) col_cnt
             from (select substr(table_name,1,30) table_name,
                          substr(constraint_name,1,30) constraint_name,
                          substr(column_name,1,30) column_name,
                          position
                     from sys.user_cons_columns ) a,
                  sys.user_constraints b
            where a.constraint_name = b.constraint_name
              and b.constraint_type = 'R'
            group by b.table_name, b.constraint_name
         ) cons
   where col_cnt > ALL
           ( select count(*)
               from sys.user_ind_columns i
              where i.table_name = cons.table_name
                and i.column_name in (cname1, cname2, cname3, cname4,
                                      cname5, cname6, cname7, cname8 )
                and i.column_position <= cons.col_cnt
              group by i.index_name
           )

Isn’t it a beauty? Thanks to Tom.


Groovy Eclipse V2 M2

14. December, 2009

It’s been a couple of days since the Milestone 2 of the new Goovy Eclipse V2 plugin was released. If you’re developing with Groovy and you’re using Eclipse and you’ve been living under a stone, get it now. It’s so much better than the old Groovy plugin.

In word: Development with Eclipse has become Groovy, again.

Links:
Groovy-Eclipse 2.0.0M2 New and Noteworthy
Groovy-Eclipse 2.0.0M1 New and Noteworthy