Javascript as a Programming Language

Saturday, May 19th, 2007

Originally Javascript was intended for “enhancing” static web-pages with dynamic behaviour and was therefore positioned as an HTML extension for a long time. This is also reflected by Javascript documentation on the web; Naturally the target audience is the web-developer and almost every introduction puts Javascripts into HTML context, failing to explain underlying language concepts. Douglas Crockford is one of the few who tackles Javascript as a programming language.

Also helpful:

Button hell

Saturday, April 21st, 2007

If you want to style buttons in your web-application you inevitably end up with the <button> HTML element. There are alternatives: CSS’ing your <input type=submit> tag, using prerendered (!) images with <input type=image>, using links instead of form elements, etc. However if you want a flexible button layout without compromising the browser’s submit mechanics, then <button> should be the right thing, you’d think.
The “value proposition” goes like this: You can put any valid HTML inside the button element, for example background images or more spohisticated: a table with images for rounded corners on both sides and a stretching text-aligning middle AND it should behave like <input type=submit>. Nice! Ok and now to reality, welcome to “Button hell”.

  • <button> is broken in IE: And I mean it. Actually it is so broken that you’ll need hefty workarounds to get it working at all. Here’s why:
  • IE submits all button’s in your form: Yes! I mean what were they thinking? To clarify: You have three different buttons in your form, e.g. “save”, “delete” and “insert”. If you press one of them all corresponding values will be submitted! Which acutally means you can’t decide which button was clicked on the server side. One workaround would be to use hidden submit fields which are being filled by the button’s onclick handler.
  • IE button submits innerHTML: You might be tempted to believe that the “value” attribute holds the actual submit value. Actually this is what W3C says. Not in IE: In all circumstances the body of the <button> element will be submitted, that is: all your HTML code (escaped of course). If you submit via GET you will ultimately hit IE’s URI limit. This is a longstanding bug since IE5+ that eventually gets addressed in IE7.
  • IE stretches your buttons: Actually IE does this on all buttons not only those generated by the <button> tag. Why is this a problem? Well you use the button tag to style it according to your needs, which actually means you will disable the border of the original button and replace it with you images for example. However behind the scenes IE stretches the button proportionally to the enclosed text, only you can’t see the real dimensions any more! You will however see erratic paddings to your neighbour elements and wonder why the hell you cant right-align your buttons with your form. Thank god there’s a workaround.
  • Different paddings on browsers, Firefox nasty: Just as you think, you’ve everything under control, you open your form in another browser and start to scream again. See here for the details. Note the firefox behaviour:

    3px padding left and right, and 1px padding top and bottom appears to be added even when zero padding is applied. (Thus the user can never remove the padding completely. Buttons may also appear larger than expected.)

    Which acutally means you will not be able to right-align a image style button with your form in Firefox. It cost me hours to find out that the only workaround is to put the button content into a <div> or <table> and then apply negative 3px margins on that container.

  • You will need browser-specific CSS: As ugly it is, you will end up with conditionally included style-sheets to address the padding problems above…

Summing up the amount of work I needed to fight through the problems above, I would say it cost me a week of time and approx. 2500 hairs of my scalp.

Little Romina slideshow

Monday, February 26th, 2007

Some new pictures of Romina here (opens in new window). As you can (hopefully) see I experimented with an Javascript based slideshow. I found the following free, ready-to-use implementations: HighSlide, Thickbox, Lightbox, Greybox and Smoothgallery. I used Smoothgallery because it works with standardscompliant markup and is relatively easy to set up. Hacked up a small script for generating the gallery. I first tried to embed the gallery in the blog post, but got some sideeffects with the layouting. Furthermore I would have to include the Javascripts in the php-header of the wordpress theme, which of course decreases load time. So, although not a fan of “popups” I decided to use them for those mini-galleries.

Java finally Open Source

Tuesday, November 14th, 2006

Well, rumors are over, they’ve done it. Here some quicklinks:

Java Findings

Tuesday, October 24th, 2006
  • fastUtils (fastutil.dsi.unimi.it) Another enhancment library for Java collections like Javalution (see also earlier post). Released under LGPL.
  • mg4j (mg4j.dsi.unimi.it) “Managing Gigabytes for Java”. A libary for creating reverse indices. Similar to Lucene although a more lowlevel approach. Read about the differences here. Released under LGPL.

Borland changes mind

Saturday, August 12th, 2006

In February this year borland told us that they want to quit their IDE business. Well, obviously they realized that there are still some dollars to squeeze out of the “Turbo” brand. Read the latest news here (artima.com).

Axis 2 released

Saturday, May 6th, 2006

As reported on TheServerSide Axis 2 has been released. They seem to follow a more generic approach now with minimized hard-wiring to specific protocols. Found an interesting chart (codehaus.org) comparing the features of the different Web-Service frameworks popular at the moment.

Link roundup

Saturday, April 22nd, 2006

Ajax

Javascript/Web Testing

Ajax Hypecycle

Saturday, April 15th, 2006

If you are into IT you might be stumbled accross the concept of “Hypecycles” which is the preferred way for Gartner to position a particular technology. The basic idea is that every technology goes through different stages of visibility and maturity:
http://rra.amd.co.at/pics/GartnerHypeCycle.png

Altough Gartner has some articles on Ajax and Web2.0 I couldn’t find this topic on their hypecycle yet. However, Technorati helps by providing some fine statistics. Here you can see the number of blog articles which mention the term Ajax for the last year (173,264 in total):
http://rra.amd.co.at/pics/technorati_ajax.jpg

We clearly can see a peak in February/March 2006 and a fall-off afterwards. What can we infer from that? Well, we know that the term was coined on Feb. 18th, 2005 by James Garret so according to the typical Hypecycle Ajax needed a little more than a year to reach the “peak of inflated expectation” (in Gartner speak). I guess it will take another year to reach the stage “Trhough of disillusionment” with some sort of stabilisation aftwerwards. In contrast to the hypecylce-visibility the frequency of mentions in online-articles will probably not rise again from there on. How often do you see “hot topic” articles on DBMSs nowadays (clearly a matured technology)?

Internet Explorer crippling Applets

Monday, April 10th, 2006

Do you think Microsoft is done with applets? You’re wrong. Read this:

A recent update to Microsoft Internet Explorer 6 included a change that alters the way users interact with applets in the browser … With this change, users can no longer directly interact with applets by default. Users are first required to manually activate the applet’s user interface, before interacting with the applets. If the page has multiple applets, users have to activate each applet’s user interface individually.