Håvard Pedersen

En blogg om vår digitale hverdag og andre pretensiøse temaer :)

Category: Utvikling

Usability in applications

My pet peeve regarding usability is the lack of (let’s face it, most) developers ability to put themselves in the situation of computer beginners (aka newbs). Eric S. Raymond describes exactly how bad this can get in The Luxury of Ignorance. And in my own opinion, this also describes why Linux is still miles away from being a viable desktop alternative for the regular Joe. I’ve had too many similar encounters like this myself.

A key point in understanding users is also discussed in Raymond Chen’s The default answer to every dialog box is “cancel”. Nice to see that Microsoft has people around that realizes this. Now if they could only understand that the default answer to security alerts is “allow” as well (atleast after the users learn what cancel does to them), they’d probably understand why those are useless aswell. ;)

Todays lesson? People shouldn’t need to read manuals to get things working, and they don’t read dialog boxes. I’ve always meant that any piece of software should be so straight forward that the manual becomes redundant.

Why Flash websites are a really, really bad idea

Just to state some basic facts…

  1. Flash doesn’t work _everywhere_, unlike normal HTML. My computer runs a 64-bit OS without 32bit emulation, and Adobe has yet to provide a Flash player for any 64-bit platform.
  2. Flash requires a proprietary plugin.
  3. Flash does not let users change font sizes or contrast settings using personalized stylesheets.
  4. A lot of screenreaders and other accessibility tools does not work with Flash (some screenreaders does using a Windows-specific API).
  5. Flash is not indexable by all search engines. Some does index text in Flash files, but since there is no way to link to the subpage your query was found in, people can’t be redirected to the result, making the result useless for users.
  6. If a browser doesn’t support Flash, you get nothing unless the entire website is also saved in a standard compliant (also know as HTML) way. If a browser doesn’t support CSS, you will still get a readable website.
  7. Flash doesn’t not present my usual OS widgets (textfields, submit buttons and such) or use my OS settings for these (larger fontsizes, higher contrast and such).
  8. Flash is owned by a commercial entity and even though the format specification is open, it is not licensed for free use.
  9. Flash sites breaks the back button, a fundamental function that users are used to.
  10. There is no way to bookmark a subpage of most Flash-only sites.
  11. Flash doesn’t work in most alternative browser devices, like PDAs or Smart phones.
  12. Printing content from a Flash site is extremely difficult and most of the time comes out weird on paper, if at all.
  13. Flash doesn’t provide a standard way of navigating without the mouse (tab navigation is possible by default).

Note: I’m not saying Flash should be banned from the net, I think there are numerous valid reasons to use Flash. But my opinion is that it should only be used for interactive multimedia which cannot be represented in HTML/CSS/JS in an easy way. Stuff like games, ads and (because of terrible object tag support in browsers) video playback. If you need to use Flash to have graphical menu buttons with mouseovers or display a logo in the header of your site you really should reconsider your profession. :)

Edit: Item 5 moderated, item 13 refuted.

Sidenote: Tadeusz Szewczyk at Fadtastic talks about the demise of Flash.

Edit: Item 4 moderated.

Why tables for layout is bad

Since I’m tired of Googling it up every time I need the link, I thought I’d just post it here. Seybold tells you why tables for layout is stupid.

Is XHTML supported wide enough for everyday use?

Today I stumbled upon an article by Lachlan Hunt which lists some of the problems with using XHTML for webpages. After having read through it, I was nearly ready to reimplement my XHTML pages in HTML… The main cause for this was IE’s lack of support for application/xhtml+xml content. It won’t render it, but instead provides you with a standard download dialog. Serving XHTML as text/html, like most people do nowadays is actually fooling older user agents (like IE) to treat the page as good ole’ HTML. But there were a lot of other issues with XHTML I didn’t like the sound of either.

This would actually make my employer have to use HTML Transitional, since some of the ad serving is done using <iframe>, which isn’t allowed in the strict doctypes. You can read more on the differences between strict and transitional markup here. I might be arrogant, but HTML4 Transitional sounds a bit too nineties for me to accept, even if it is an acknowledged standard. ;-)

Luckily, the XHTML specs states that text/html is ok to use for XHTML documents, and they even included a thorough appendix on how to make sure your XHTML document renders correctly in browsers that treat it like HTML. Very good reading, and it contained several implications I weren’t aware of!

Edit 1: There’s an article over at workingwith.me.uk about sending mime headers depending on what the user agent supports. Highly recommended reading. Works like a charm here. :) Though I was a bit shocked to notice that W3C’s validator doesn’t send the correct ACCEPT-headers.

Edit 2: W3C has a table with the definitive overview of contenttypes for the differenct specs.

Edit 3: The code from www.workingwith.me.uk har some bugs if a browser explicitly states it does NOT want application/xhtml+xml. I rewrote my handling using some code from www.autisticcuckoo.net which seems to work more reliably (setting Q to 1 as default).

Development in the free world

Lately I’ve done some research for free (as in beer) development environments, both for web and Java. The result was, to put it blunt, a huge disappointment. What actually disappointed me more, was the horrible pricing for commercial solutions with no “personal use only” licenses available.

The “can do everything known to man but is like removing a lash in the eye with a shovel”-approach would ofcourse be Eclipse or Netbeans, but after using them for a couple of days you loose all faith in using Java for creating large desktop applications. They’re essentially large and fancy texteditors with the possibility of launching external compilers. Why this task should need to require the good half of my 1 GB RAM is totally beyond me… Add to this a startup-time that matches that of the OS itself, and your productivity probably needs to be picked up from the floor by the time you’re ready to do some actual programming.

For smaller things I’ve found myself using Notepad++ lately, and while it lacks a lot of automation it’s still the best Notepad replacement I’ve seen, so I advice you to give it a try none the less. But I was stilling missing some things in order to use it as a full IDE so I set out to test the competition. My wishlist went something like this:

  • Extendable
  • Open-source and actively developed
  • Syntax highlighting
  • Project- or filebrowser panel
  • Some sort of context-sensitive lookup
  • FTP support for web development
  • Shortcuts for build/run/preview
  • Should support the languages I use most (XML, Java, JSP (this one’s surprisingly rare!), PHP, HTML, CSS, JS and ideally Python)
  • Subversion support

I don’t think I’m particularily picky, so why were there so few programs that managed to fill half of these? I have no idea myself, but the only one that fitted the bill for me was PSpad. It supports a ton of languages, but lets you define compilators, run commands and preview commands for each one yourself. The only things missing from my list are opensource (it’s closed but still freeware) and SVN support. But SVN updating isn’t something you do continously anyway, so TortoiseSVN does the job fine for now. In addition you get macro support, chm-file help integration, class browser for several languages, integration against TopStyle CSS editor, direct FTP edit, template library, hex edit, export with highlight to RTF or HTML, HTML processor (tidy up or just compress), internal webbrowser and more. This one is truly my recommended download of the day! :)

Finding the best way to insert Flash

In my earlier days (before I switched from Opera to Firefox, now I use the AdBlock Plus Firefox extension to block ads) I used to surf the web with Flash disabled. I was actually quite shocked to notice how many websites that just didn’t display anything when read though a browser without Flash support. This might be fixed by what I am about to discuss here, but it’s not my main point.

Have you ever tried validating a page with Flash in it? Chances are it didn’t validate. Even Adobes official material on how to embed Flash encourages use of the <embed> tag, which is not a valid tag in any of the W3C specs for markup languages on the web. It’s a Netscape invention, and it actually took quite some time until the Mozilla-based browsers managed to support the <object> tag in a satisfactory fashion. Frustrated with this fact, I started Googling, and this opened up a can of worms, as Internet Explorer didn’t fully support the <object> tag in a standard-conforming way either…

All I really wanted was a way that…

  • Was completely valid (X)HTML.
  • Sent the user to the Flash download center if the Flash plugin is missing or out of date.
  • Did not require JavaScript running in the browser in order to display the Flash. More and more people (mostly geeks) actually surf with JavaScript disabled.
  • Didn’t use the IE-specific conditional construct <!–[if !IE]> <–> (I don’t like browser-specific coding, even if it doesn’t break the standard).

Read the full post »

Run several IE versions on one computer

This is a webdesigners dream… Haven’t you wished there was a way to quickly test a page in different versions of IE? If you’ve tried, you probably know that installing Internet Explorer will overwrite any verion currently installed. One install at a time. Bah humbug!

The rescue comes in the form of IE standalone distributions from evolt.org. Just download (I tried the 9x version under Windows XP), unzip, doubleclick iexplore.exe and off you go! Note that the about dialog will display the version of your current system IE install, so there’s no way of knowing which IE you’re running without remembering which version you launched or looking at the HTTP headers.

Imagine my relief when I discovered this page works nice in both IE 5.5 and 5.0 (though a slight menu anomaly on the latter). :)

Update: Thanks to Yousif Al Saif at TredoSoft there is now an installer that installs IE 3.0-6.0 side by side on your computer! Recommended.

Google Homepage plugins

Og der var min første modul for Google Homepage et faktum! :) Den viser status (inkludert spilleliste) for spilleserveren min og kan testes ut ved hjelp av knappen nederst på statussida på spilleserveren min (fjernet, pga bytte av CMS).

En modul er i utgangspunktet en xml-fil med inline html og Javascript.

Problem nummer en er at de fleste nettlesere av sikkerhetshensyn ikke lar Javascript sendte http-forespørsler til andre servere enn serveren HTML-sida hentes fra. Greit i mange situasjoner, men min modul leses jo fra Google (siden Google må parse og wrappe modulen), og da begrenses mulighetene fort. Nå har Google tenkt så langt og gitt deg en Javascript funksjon som heter _IG_FetchContent(). Fine greier, tenkte jeg. Men dessverre cacher denne funksjonen responser i timevis, så den blir totalt ubrukelig til det meste av dynamiske løsninger. Dette måtte jeg løse ved å legge til ?randomshit=12345 i URL’en, hvor 12345 er et slags hjemmelagd timestamp som er garantert unikt over en periode på 28 dager. Ikke pent, men det duger inntil Google kan tilby noe bedre.

Problem nummer 2 var selvfølgelig at spilleserveren min i utgangspunktet bare rapporterer via rå TCP, men dette løste jeg ved å lage et lite PHP-script på serveren som modulen min spør. Dette scriptet kontakter igjen spilleserveren direkte og konverterer infoen til HTML før den returneres.

Ellers kan jeg nevne at modulen min krever å kjøres inline (div istedenfor iframe) siden den har variabel høyde og oppdaterer seg hvert 30. sekund uten å reloade siden (bytter bare ut innerHTML for div-taggen).

Jeg vurderte selvfølgelig å lage en åpnere og konfigurerbar løsning så flere kunne implementere dette på sine servere, men jeg følte meg litt i det egoistiske hjørnet. ;) Hvis Google gir meg en skikkelig fetch-funksjon så jeg slipper å bruke stygge triks skal jeg muligens revurdere saken…

VB.Net wizard extraordinaire

Hmm… Enten har jeg misforstått noe relativt grunnleggende eller så har .Net 1.1 elendige funksjoner for parsing av XML-filer med mer enn 2 nivåers dybde i entitetstreet… Jeg endte opp med å flytte masse data fra egne barnenoder til attributter istedenfor. Eventuell eksempelkode mottas med takk! :p XMLDocument er klassen jeg bruker. XMLReader passet ikke meg helt siden jeg ikke er sikker på hvor sekvensielt jeg ønsker å lese…

Antispamgreie

Kan alle linke hit? Riktignok er det vel relativt fort gjort for store aktører å legge inn unntak for det domenet, men inntil da… :P

Edit: Jeg vil heller oppfordre folk til å melde seg inn i Project Honeypot hvis de har en hjemmeside.