KFM 0.7

demo, download (828k .tbz2, 1.1M .zip)

New Features

  • New Languages
    • Bulgarian, thanks to Tondy (tondy.com)
  • Unzip zipped files (84). This allows users to zip up multiple files offline, upload them as one file, and unzip once they are uploaded.
  • Multiple Databases (127, 122). We now support PostGreSQL, MySQL and SQLite.

Improvements

  • Files may be located anywhere on the system at all. They do not need to be within a web-readable area (33)
  • bugfixes (117, 100)
  • Long directory names are now truncated, using the same method as long filenames (80)
  • Directories with many files are now displayed quicker (106)
  • Download From Url has been combined with File Upload (108)
  • KFM has been tested and is known to work on PHP4.3+ and PHP5.1+

As usual, this release has been helped along by the many testers in the forum, testers who have contacted me by email, and all of the translators.

Development for version 0.7 was sponsored by the infinitely glorious web development company, Webworks.ie. We’re really quite good.

my son, the genius

Jareth had a checkup with a paediatrician a few days ago. He’s three years old, and can’t speak, so we wanted him checked out.

During the checkup, the doctor wanted to check that his hearing and comprehension were okay, as a deficiency in either of those are the most likely reasons for delayed speak.

He was sitting in front of a small game which had a load of letters on it. “Where’s the ‘W’?”, I asked. He immediately put his finger on it. “Where’s the ‘X’?”. Again – instant correct answer. That clinched it – perfect hearing and comprehension. The doctor was surprised as well – apparently not many three-year-olds know the alphabet.

Yesterday, while helping him with his learning, I drew the letters “ABCDEFG” across the top of his writing board. I expected him to attempt to copy the letters. Instead, he wrote the letters “HIJ” immediately. I think he has trouble with ‘K’, but then – he’s three years old!

Want proof? Here’s a video of Jareth drawing H and I without being guided.

Today, I walked into his room, and came across this on the floor:

a load of letters, in the order they appear in the alphabet

At first, I thought “nice – organised”. Then I noticed that the letters are laid out in the order they appear in the alphabet!

My son Jareth is a bloody genius.

kfm 0.7 in beta

No versioned release zip yet, but I just finished the last of the features scheduled for this release. You can download via SVN using the details mentioned on the KFM site.

I’ll be announcing the string-freeze to the translators later today. We have one more language this time, Bulgarian. The official release will be in one week’s time. I need to give the translators time to do their work, and also, will spend that time looking through the code for bits that I can make more efficient.

New features for 0.7:

  • you can now upload a zipped archive of a few files, and extract the archive. this allows you to upload a load of files at the same time.
  • there were a lot of problems with SQLite in version 0.6. to help alleviate this problem, KFM now supports MySQL, Postgres and SQLite, using the MDB2 Pear library.
  • instead of returning links which point directly to the requested images/files, we now return a link which retrieves the requested file via KFM. this allows your file repository to be held outside the web root, and will allow file authentication and other tricks (logging, uri-based thumbs) in the future.
  • long directory names are now truncated similar to long file names.
  • “file upload”, and “copy from Internet” now use the same form.
  • lots of speed issues have been fixed.

enjoy. The main release will be next Tuesday. I’ll write up a quick article then detailing what features I think will be in 0.8, 0.9, and on up to 1.0.

If there are any problems using this beta, please mention them using the KFM forum.

In related news, Webworks, my great and glorious company will be using KFM in a very large project next year, which will mean a lot of work will be put into it. I am still committed to providing the improvements to the great unwashed, so you’ll all benefit from our hard work.

a few web optimisation tips

Once a website has been completed, I like to sit back and look over the site again, and see if there is any way to improve on its responsiveness easily.

An example immediately comes to mind. A few years ago, we built the CMS behind Castle Leslie’s website. I don’t think we were involved with the design – we were asked to implement the design in a user-editable way.

Notice that the menu on the left is graphical. The original way we did that was to slice it up and have a separate image for each link, and put each <img> in a <a> tag. I was asked recently to optimise that particular part of the site, as one of the owners of the site uses dial-up for connection, and was irritated that the menu came down in dribs and drabs.

The obvious problem was the number of images. I opted to rip them all out and use one single image instead. I set the image as the background of the entire navigation layer, and made the actual links invisible, and sized individually to cover the appropriate area of the image. This is similar to how an imagemap works, in that you have one image, and some clickable areas on it. A difference here, though, was that we have a few hover effects that I didn’t want to lose (small icons that appear below the nav according to what’s being hovered over).

That was a big improvement – instead of loading a load of different images, we now only loaded one.

However, it was still taking a while, because I had chosen to use CSS to add the background. I don’t know if this is a fact, but it seems to me that when you have a few actual images and a few background images in the same page, the background images are loaded last, as they are considered low priority.

A way around that is to use Aaron Hopkins’ tips and spread the load over a few separate domains. They don’t even have to be completely separate servers. Here is part of the virtual server config for castleleslie.com, for example:

  ServerName castleleslie.com
  ServerAlias *.castleleslie.com

What that means is that if you look for blah.castleleslie.com, it will actually show you castleleslie.com, as Apache believes they are the same thing.

So, to improve the responsiveness of our site, I then went through the CSS and used pseudo-subdomains for the images. For example, http://static5.castleleslie.com/i/style/back.gif instead of /i/style/back.gif. This meant that the browsers could immediately grab the images, instead of needing to queue up and wait (browsers usually can only download about two items at a time from the same server).

Now, onto AJAX.

AJAX involves sending information back and forth between the server and client. As you can guess, this also falls fowl to the connection limit – if you have three javascripts to load for your page, two will be loaded, and the third will not load until the first two are finished.

A while back, I demonstrated the problem with concurrency, and a possible solution. In the massively concurrent version of the script it took my laptop 30.02s to complete the tests. In the optimised version, it took 2.53s – an improvement of more than 10x.

What happened to make this improvement was that a load of server function calls were combined into blocks so that very few actual http requests were made. To do this, I made a local cache of requests, and set a timeout of 1ms on it. If another request came in, it was added to the cache, and the timeout was restarted. If the timeout fired, then all the requests were combined into a block and sent to the server, which extracted them, ran them, and returned an array of results. This was in comparison to the original, where every request was immediately acted on and sent to the server, resulting in massive traffic problems.

The lesson here can also be used elsewhere. For castleleslie, it occured to me that the time involved in downloading the HTML and separate CSS file was more than if the HTML+CSS were combined and downloaded as one. Yes, you lose out on the caching effect for subsequent calls, but in sites where the average user is only expected to read a few pages while looking for information, this is not really a problem. I would never try that on Wikipedia or a forum, for example.

By the way, I really advocate the use of Firebug – it’s a massive help when hunting down glitches in performance.

Another example of combinations can be seen in the panel headers of my KFM application (which is free, by the way – get it here). Notice that when the app loads, the panels have three buttons – ‘-‘, ‘+’, ‘x’. Some of the buttons are grayed out, indication that they are not usable. When you hover over an active one, it turns red.

There is actually only one image used for the entire header, including the effects.

CSS is used to shift the image up or down for each button, depending on what is needed.

The same trick is used for the Directory panel – there is actually only one image in there:

What’s important about this is that, instead of 10 separate images for the panel (the background, and 3 state images per button), and 7 separate images for the folders, single images, and a few CSS tricks are used to reduce the HTTP overhead.

Here are two demos to illustrate this in action. Please view the source to read how it works. demo 1, demo 2.

I could go on, but my fingers hurt. I hope some of this has been useful.

Visitor Q

That wonderful freak film director, Takashi Miike, has done it again.

Even though this film has scenes of murder and extreme violence, this is not a horror.

Even though there are graphic scenes of sex and very very abherrent sexual practices, it is not porn.

Even though there are some scenes which will have you splitting your sides in laughter, it is not a comedy.

Instead, I suppose you could call it art. The film shows an extremely broken family, which is brought together by the weird influence of a strange Visitor, Q.

It would be hard to explain the plot of this, as there doesn’t seem to be a coherent one. Instead, there are three stories – the father, the son, and the mother, which are all intertwined.

The father is a documentary-maker who has a bit of a short fuse in the bedroom department. The first scene of the film shows him having sex with a prostitute. We find out later on that the prostitute is his daughter.

The son is being bullied by three class-mates, and takes out his frustrations violently on his mother, who accepts it all. He’s a bit of a clean-freak, and has a collection of whips.

The mother has a self-esteem problem, and is a junkie. With the help of Visitor Q, and plenty of milk (don’t ask), she learns to appreciate herself.

I think the funniest moment in this film has to have been when the father accidently kills a film partner while trying to rape her, then brings her home with the help of the Visitor, in order to dismember and dispose of her. While drawing the “cut here” marks on the body, he gets a bit excited and decides that necrophilia is on the cards. Of course, rigor mortis adds a bit of comic relief to the proceedings.

All in all, I don’t think I’ve seen such an offensive-sounding film that did not offend at all – it’s actually quite touching how they all settle their differences and become a happy family.