Sunday, September 14, 2008

Weird web troubles

No, I'm not dead yet. I have even been doing some of the maintainer tasks for Flot I have neglected the past months.

One of the new things in Flot is support for hovering/clicking with the mouse on the points. I was spending some time yesterday adding highlights so that Flot can show which point you're pointing the mouse at.


I got to the point that I was ready to performance test it, on my trusty old Pentium 3 950 MHz laptop. It felt a bit slow. Surprisingly, the profile from Firebug indicated that the slow function was the jQuery function offset().

I use it to compute where a mouse event is inside the plotting canvas - for some reason computing this offset separately is the only reliable way to know where the mouse is inside the element where the event happened because you only get the global coordinates reliably in the event. You would have thought local coordinates was a natural thing to standardize and every browser support, but no.

Anyway, offset() walks up the DOM tree, computing offsets along the way. And it was taking 25 ms per invocation on average! That's just ridiculous.

The funny thing is that I was meanwhile updating my system, apparently also updating Firefox from 2.x to 3.0.1. So when I boot up today with a couple of ideas for working around the slow offset function, it's now 4 ms on average. That's still far too much for querying a simple DOM tree, but it's not a show stopper anymore.

I think the lesson here is that as soon as you do exotic things in the browser, things that are not really about browsing HTML pages, you get bitten by weird bugs. But the state of affairs is improving.


Pssst. We're having a sale on YayArt. I have it from a reliable source that it's going to end soon.

Wednesday, April 30, 2008

The way of nature

I was helping my father put up new boards for the roof of my parent's house today. The old one was, well, old and rotten. It was the last remains covering the gutter on the north side of the house, we've already replaced the boards on the other sides of the house (got quite a thrill out of the top ones on a wobbly aluminium scaffold 8 meters above ground).


Anyways, as we've done about half of the boards and reach the far end of the house, a female blackbird starts examining the wooden box around the gutter carefully at the other end, apparently interesting in using it for a new home. A few moments later the male blackbird, maybe its mate, does the same while we stand there, hammering boards in a few meters away.

Leave things alone a few minutes and life around you starts occupying the good spots. Nature or perhaps rather evolution is wasteful with life, but certainly not with space.

I sometimes wonder how fast a city would disappear if all humans were all suddenly extinct by a new plague-like disease.

Thursday, April 17, 2008

YayArt is up!

So it finally happened, we launched YayArt! It's a community-based approach to new digital art for the people (real prints).

That's all. I'm wasted now. :-)

Friday, March 7, 2008

Flot 0.4 released!

New version of Flot is out. See the changes.

The date/time support has finalled arrived and there's support for coloring background areas. For instance, you might use this to plot the visitors to the Flot homepage. There's also support for segmented lines. Plus a long list of bug fixes and tweaks.

For the next release, I'll probably be focusing on adding more interactive features. There are some patches floating on the mailing list I need to take a look at.

I also think it would be a good idea with a hand-holding tutorial that for people who are not accustomed to Javascript plotting. I have something in the works, more about that later.

Favourite Linux bug of all times

Here's the story about my favourite Linux bug: the thrashing hell syndrome.

To reproduce it you need to have swap activated and a run-away process. Traditionally, for the latter Netscape Navigator was great, in these days it might happen with Firefox with Flash or Monodevelop. Or if you're developing something and accidentally make an eternal loop that allocates memory.

What will happen is that the system quickly slows down. You'll have some seconds to react to kill the process. If you're too slow, the graphical interface locks up and you're toast while the machine enters thrashing hell. You can usually get to a terminal and even enter username and password, but it locks up again before the shell is running. Probably because you can't spawn a new process when in thrashing hell.

The condition will last for anywhere between a couple of minutes and more than half an hour. Unless you power off the machine, there's nothing you can do. At all. Other than to stare at a frozen screen while the machine entertains itself.

At some point an out-of-memory killer was introduced in an attempt, I believe, to mitigate this problem. Its job was to kill a process to free up memory in memory-tight situations. Here's a hilarious analogy by Andries Brouwer. I suspect Netscape was the main cause, although I might be wrong, I've never been close to kernel development anyway.

Anyway, that was long time ago.

Fast forward to the introduction of Ubuntu, the really easy-to-use GNU/Linux. I should warn you that I'm going to do some bashing of Ubuntu now, which is not really fair since Ubuntu is pretty cool.

When I first got into thrashing hell on a Ubuntu system, I didn't believe it had happened. I thought the OOM killer should have saved me, but apparently not. Probably it'll only kick in when all of the swap is used. But hey, Ubuntu is for the masses, right? The system should have protected me. That's what I naively thought.

So I filed a Ubuntu bug report on the kernel. I hoped that a couple of the knowledgeable people who are working on Ubuntu would fix this old problem in a snap.

Which didn't happen. The bug wasn't accepted. As far as I can tell because the guy in the other end thought the process limiting support in the kernel is advanced enough to take care of the problem. I wasn't sure whether he was right. But I filed a new bug report with the hope that someone else would see the vision.

That's over two years ago. So far no progress. Which is not what I'd hoped, because it really puts the system in a bad light. If this happened to an average user, that person would instantly conclude that Ubuntu/Linux just crashed.

But it's sort of fine, because it's open source etc. etc. and the people in the other end are free to spend their time as they like.

Then today there was an update. Cool! I thought. Until I found out that it's just a drone reply. Even a particularly annoying one, apparently it's not good enough to report a bug on the latest release since the problem might theoretically be fixed in the next alpha. The bug has already been auto-closed once because if noone's interested then the report must be invalid.

So noone wants to listen. That makes me think this will continue to be my favourite Linux bug for many more years to come.


PS: My favourite recent Windows bug is probably the one where Windows interprets all mouse clicks as right-button clicks.

Sunday, February 24, 2008

Quiescence

No update for a long time. I've been busy, mostly at work but also at home with the garden.

I currently have our small garden full of bulbs. Many already have the first small leaves up, including some daffodils and tulips (in spite of it still being February!). I've buried so many bulbs that I have but the faintest idea of what is where. The last few batches are pretty much placed completely randomly.

I've also invested in seeds from Plant World Seeds. I chose them because they have several bags with different mixtures; our garden is not of a size where it's relevant with 50 flowers of the same kind. Janne also bought some seeds from a Danish merchant, mostly small flowering trees, so the house is now full of pots with moist soil and small white labels.

I'm currently mostly excited about the 12 pots of clematis montana (four seeds in each pot, unfortunately it can take three months before we see any seedlings), and a bag of dactylorhiza maculata (heath spotted orchid) that I haven't figured out how to sow yet. The funny part is that we haven't even sowed half of the seeds. The summer is still a bit too far away for most of them. I think we're going to have a problem by then.

I read somewhere that the original meaning of "paradise" is a garden. Last year it was a little empty. Not surprising given that I dug all of it in April and May. But we'll see this year.

In other news, I've spent some time today and yesterday working on time series support in Flot. I just committed the code to the SVN repository. I need to clean up a couple of things, test it a bit more and write up some documentation before release. Next on the list is reviewing the patches on the bug tracker and on the mailing list.

Friday, December 14, 2007

Flot 0.3 released!

New version of Flot is out. See the changes. This is mostly a bug fix release because the previous zip/tarball didn't contain the jquery.js file.

I've also started a mailing list which I really recommend using.

I did sneak in a new feature - that's why it is 0.3 instead of 0.2.1. You can now enable people to click on the plot and get the (x,y) coordinates (in the unit of the plot, not pixels) out.

This is a primitive form of interaction. Eventually I want to support automatic data coupling so you can know what has been clicked and in the same vein highlight the stuff underneath the cursor. But at the moment I'm pretty swamped with things to do, and this clicking was enough for our internal application. I suspect it will be useful for lots of other things too, at least until Flot is clever enough to map from points to data.