Mon, 11 Dec 2006

Firefox is Broken (Update).

Thanks to some help on IRC from Ycros, chesty, yama and praetorian who informed me that the Sessionsaver functionality is built into Firefox 2 and hidden under Edit -> Preferences -> Main.

One of them also clued me in on possibility of unzipping the XPI file, hacking the RDF and re-zipping before installing. Fantastic, I now have BookmarksHome back as well.

So as appreciative as I am of the help I received, Firefox is still broken. All we've done is wallpaper over the cracks.

Posted at: 22:12 | Category: WTF | Permalink

Sun, 10 Dec 2006

Firefox is Broken.

The main browser on Linux (and for anyone with any sense on other platforms) is Firefox. Its a great browser, it really is, but is is very broken in one very important regard.

Many "features" of Firefox are provided by external plugins and these plugins are often locked to a specific set of versions of Firefox.

I spent most of this morning upgrading my laptop to Ubuntu Edgy Eft which removed Firefox version 1.5 and installed Firefox version 2.0. Moving to version 2.0 has broken the two Firefox plugins I rely on the most, SessionSaver and BookmarksHome. These two addons are vital to the way I prefer to use Firefox. Being without them is a major pain in the neck.

Firefox 2.0 has been out for over a month and there are probably a bunch of other plugins that other people rely on that are broken. If these were a built-in features that disappeared from one release to the next, the user base would be justifiably peeved. I think the Firefox people and the authors of plugins really take a look at this issue and fix it.

Update here.

Posted at: 15:08 | Category: WTF | Permalink

Sat, 02 Sep 2006

Tilde strcmp.

At a previous employer, I spent about six weeks writing tests for code written by another developer. This developer had a PhD in engineering and years of experience in low level coding in both C and assembler. When I joined the project he had already been working on it for a number of months.

I'm very keen on the ideas and practice of Test Driven Development (TDD) and I'm also quite good at finding and writing tests for all those horrible little corner cases. I tried to sell the techniques of TDD to the developer but he wasn't buying. According to him doing testing would slow him down.

However, he was already doing some (rather ad-hoc) testing. Whenever he completed a new module he would temporarily hack the module that fed data into his new module, run the whole thing in the debugger and then in the debugger verify that the output of his new module was correct. He would then undo the hack in the preceding module and never test his new module again.

I tried to convince the guy that something more rigorous and repeatable was required. I told him how I had done development with testing and development without testing and that I much preferred the with testing. I explained how in my experience development with testing could proceed more quickly and with more confidence than development without testing. I laid it out as "I've tried it your way, how about you try it my way?" but he still wasn't buying.

Our manager however did understand the importance of testing so he suggested that I do it. Thats how I spent the next six weeks writing tests and filing bugs. During the first two weeks of testing, I was filing about 6 new bugs per day. I'm pretty sure that it was during this time that I found some other code written by this developer that contained this little boo boo.

  if ( ~ strcmp (s1, s2))
  {
      /* Code goes here. */
  }

Yes, thats a tilde character (ie bitwise not operator) where a logical not operator would make infinitely more sense. This was not the only error I ever found, just one of the most mind bending.

Fortunately, a couple of months after finding this and writing the test code I was able to get a much better job elsewhere.

Posted at: 08:37 | Category: WTF | Permalink

Sat, 29 Apr 2006

Intelib : WTF?

LISP is one of the grand daddies of the programming languages; the first implementation was written in 1962. The Wikipedia entry is an interesting read for anyone interested in programming languages.

In many ways, LISP was way ahead of its time and was vastly different from other high level languages of a similar era like C and FORTRAN. LISP was dynamically typed (like Perl, Python, Ruby etc) a decade before the the first implementation of Smalltalk, had garbage collection more than two decades before Java and had meta programming capabilities over three decades before templates were introduced to C++.

During the 1970s and 1980s, programing languages like C and FORTRAN would have seemed pretty primitive in comparison to LISP. So much so that in 1993, computer scientist Philip Greenspun came up with his Tenth Rule:

"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."

The Wikipedia entry cites the GTK+ GUI libraries (written in C) as a perfect example because these libraries contain their own internal implemention of "garbage collection, dynamic loading, object orientation, and even closures". All of these are features that already exist in LISP and many other high level languages.

Recently I came across something else that is a perfect example of Greenspun's Tenth Rule in action. Intelib is a GPLed library of C++ template and operator overloading hacks that allows the criminally insane to write inline LISP code in a C++ program.

From the Intelib web site the following LISP code:

  (defun isomorphic (tree1 tree2)
     (cond ((atom tree1) (atom tree2))
           ((atom tree2) NIL)
           (t (and (isomorphic (car tree1)
                               (car tree2))
                   (isomorphic (cdr tree1)
                               (cdr tree2))
  ))))

can be inlined in C++ as:

  //       File isomorph.cpp
  #include "lisp/lisp.hpp"
  #include "lisp/lsymbol.hpp"
  #include "lfun_std.hpp"

  LSymbol ISOMORPHIC("ISOMORPHIC");

  static LFunctionalSymbol <LFunctionDefun> DEFUN("DEFUN");
  static LFunctionalSymbol <LFunctionCond> COND("COND");
  static LFunctionalSymbol <LFunctionAtom> ATOM("ATOM");
  static LFunctionalSymbol <LFunctionAnd> AND("AND");
  static LFunctionalSymbol <LFunctionCar> CAR("CAR");
  static LFunctionalSymbol <LFunctionCdr> CDR("CDR");

  LListConstructor L;

  void LispInit_isomorphic() {
    static LSymbol TREE1("TREE1");
    static LSymbol TREE2("TREE2");

    (L|DEFUN, ISOMORPHIC, (L|TREE1, TREE2),
      (L|COND,
        (L|(L|ATOM, TREE1), (L|ATOM, TREE2)),
        (L|(L|ATOM, TREE2), NIL),
        (L|T, (L|AND,
          (L|ISOMORPHIC, (L|CAR, TREE1),
                         (L|CAR, TREE2)),
          (L|ISOMORPHIC, (L|CDR, TREE1),
                         (L|CDR, TREE2))
    )))).Evaluate();
  }
  //      end of file

Now I am one of many who think that C++ is an abomination of a language with way too many features fighting each other for supremacy. Similarly, as advanced and ground breaking as LISP was, it also had some major problems. The heavy use of parentheses makes LISP coding almost as big a pain in the neck as writing XML in a standard text editor.

To merge the worst features of C++ and LISP like Intelib, while technically amazing, is also a stunningly bad idea. When I first saw it, I was sure it was some sort of amazingly clever troll. Looking over the web page, I'm less sure. The author/s are even offering other licensing arrangements for people who would like to use Intelib but don't want to use it under the terms of the GPL.

Scary. Very, very SCARY!

Posted at: 12:25 | Category: WTF | Permalink