Toxic Elephant

Don't bury it in your back yard!

Artificial Silliness

Posted by matijs 25/01/2005 at 22h12

A friend sent me MapPoint's advice on how to get from Haugesund, Norway, to Trondheim, Norway. Very entertaining. Don't forget to look at the directions: there are 116 steps, plus the Start and End.

In fact, though, that was the quickest route. The shortest route is perhaps even funnier. And only 55 steps.

Just in case they fix things (hey, they probably will), here are screen shots of the fastest route, and the shortest route

no comments no trackbacks

Blafoolia!, for want of a better title.

Posted by matijs 24/01/2005 at 19h59

People who visit this site more often than once may have noticed that I changed its layout. It took a lot longer than I expected: It's easy to just whip something up that looks nice, but it's much harder to take a thought sketched on a piece of paper and make that happen in CSS. It's harder still if you want to make it work in old browsers.

In addition to the change of layout, I did a redesign of the URLs my site serves.

Tags no comments no trackbacks

Thank You, Poland!

Posted by matijs 10/01/2005 at 23h46

There's a great initiative to thank Poland for preventing the legalization of software patents in the EU.

(via Mark J. Wielaard's blog entry)

no comments no trackbacks

Mulholland Drive

Posted by matijs 05/12/2004 at 12h10

The first time I saw Mulholland Drive, I only saw the first part. It made sense to me. Then there was a fire in the theater.

The second time I saw Mulholland Drive, I saw all of it. The first part still made sense. Then something weird happened, and I was confused during the rest of the movie.

Last week, I saw the end of Mulholland Drive for the second time, and this time I understood it. What I had thought was real, was not, and suddenly it all made sense.

(Salon made sense of it too. See the movie first, then read that.)

Maybe I should also see Lost Highway again.

no comments no trackbacks

CSS Shame

Posted by matijs 25/11/2004 at 23h42

All this time, it turns out, people using IE5.5 (36 so far this month), and perhaps IE5.0 (44 so far this month), have been unable to read my website: The left and right sides of the text were simply cut off. I knew IE6 didn't show the vertical borders, but at least it showed the whole text.

Somehow, it feels similar to suddenly finding out you've been walking around all day with mismatched socks, or a torn shirt — assuming those things weren't part of your fashion statement. It's simply a little embarrassing. Anyway, it should all look fine now. The vertical borders even show up in IE6.

Oh, and I'm working on a new layout, so here are samples before and after, just in case the site looks completely different when you read this.

Tags , 1 comment no trackbacks

Oops

Posted by matijs 07/11/2004 at 01h57

I just noticed entry number 13 wasn’t showing. Of course, which other
entry could it be?

The file had the wrong permissions. I fixed it, so you
can go read it now. Scoot. It’s about writing Gimp
plug-ins.

Tags no comments no trackbacks

A LaTeX package for typesetting syntactic trees

Posted by matijs 07/11/2004 at 01h40

While studying linguistics, I often had to put pictures of syntactic trees in my papers about generative grammar. I made several systems to draw these automatically. One of these was a LaTeX package called synttree.

I actually uploaded the version from 1998 to CTAN. That version was clumsy, and the code was hard to read, a result of my struggles with TeX. I have always wanted to clean the package up, so it would be easier to extend it if needed.

In 2001 or so, I read an article from TUGboat that showed me how to write a parser that I could actually understand after I had written it. So, I wrote the new parser, and sort of bolted it onto the existing drawing macros.

Two days ago I finally came back to it. Now, I have a new working version, much more extendable and cleaner, ready to be uploaded to CTAN.

[Update Dec 9, 2004: The new version can also be found at CTAN.]

[Update Jun 11, 2005: Information on downloading and using the package has been moved to the synttree page.]

Tags 3 comments no trackbacks

Cocooning

Posted by matijs 04/11/2004 at 22h06

I feel a great need to shut out the world beyond my home. Curtains must now be closed in the evening, whereas before I wanted them open, even while sleeping. Lights and heating must be on.

I've decided to limit the intake of news to once per day. I get a newspaper. Reading that should be enough. Anxiously waiting for more news all throughout the day will do me no good: Events will not unfold faster, reasons and explanations will not be found earlier, and I will end up feeling more frustrated, angry and sad.

Luckily tuesday night brought Gillmore Girls, Sex and the City, and the OC, all in a row, so I could begin to forget that I live in a country where people are murdered for speaking their mind.

I will now make a nice bowl of decaf latte.

no comments no trackbacks

Getting Bryar to work: A Summary

Posted by matijs 11/10/2004 at 12h40

As I mentioned, installing Bryar was not
completely straightforward. Luckily, it is architected well, so making the
necessary modifications was easy.

Tags , no comments no trackbacks

Tips for Gimp-Perl

Posted by matijs 11/10/2004 at 12h05

After my image filtering annoyance day, I spent some more time on the problem, with more positive results.

First, I found out how to do pixel manipulations properly. It needs some incantations that are not in the man pages, but are in the source to Gimp's plugins written in C. For the basic framework of a plug-in, see Gimp-Perl's documentation and examples. For the rest, see below.

First, of course, you have to load the right modules.

use Gimp ":auto";
use Gimp::Fu;
use Gimp::Feature qw(pdl);
use PDL;

Then, the sub that actually does the work should look something like this:

sub do_something {
  my ($img, $dwb) = @_;

  my $w = $dwb->width;
  my $h = $dwb->height;
  my $gdrawable = $dwb->get;

  # make sure we can undo in one step.
  gimp_image_undo_group_start($img);

  # Read values from the source region, and write them to the
  # destination region. The destination region has its dirty and shadow
  # bits set. 
  my $src_rgn = $gdrawable->pixel_rgn(0,0,$w,$h,0,0);
  my $dst_rgn = $gdrawable->pixel_rgn(0,0,$w,$h,1,1);

  # Get pixel data as a 'piddle'
  my $rect = $src_rgn->get_rect($some_x,$some_y,$some_w,$some_h);

  # Do something with $rect's data.

  # Set pixel data
  $dst_rgn->set_rect($rect, $some_x, $some_y);

  # Magic incantations found in the C destripe plug-in.
  $gdrawable->flush();
  $dwb->update(0,0,$w,$h);
  $dwb->merge_shadow(1);
  gimp_displays_flush();

  # make sure we can undo in one step.
  gimp_image_undo_group_end($img);
  ();
}

Be sure to read the documentation for the PDL module. It explains how to manipulate the piddle with the pixel data. It helps to print part of the piddle now and then, or its dimensions (using the dims function).

Unfortunately, the method I had come up with to destripe my images didn't exactly work right. So, I went searching again. This time, I found a page describing an easy destriping method using the Gimp.

Since the method has several steps, I decided to automate it with a plug-in. I am quite happy with the result: It works on the selected layer, even if it's invisible, it handles errors gracefully, and it only works on the selection, if one is present.

Tags no comments no trackbacks