Main | June 2003 »

May 29, 2003

Steal this button generator

Bill Zeller wrote a nice PHP script that uses GD to make 80x15 buttons like the ones found at Steal These Buttons. I downloaded it to so I could make my own buttons quickly on my local machine and the next minute I found myself hacking through the code and modifying it.

The only difference from the outside is that the central bar and the right hand side text now position themselves automatically if no value is given for the corresponding parameters. Under the hood, since I can be pretty maniac when programming sometimes, I grouped all the default values together, I put the code for text drawing into a function and I made it easier to take the parameters from the $_GET or $_POST globals in case register_globals is turned off, like on a freshly installed PHP 4.3. I even considered (and wrote some code for) using constants for the dimensions of the image and calculate all the other values, but I decided it was not worth the trouble since the text is bitmapped anyway.

Here is the source.

Update (June 4, 2003): The font must be downloaded on Bill Zeller’s site. font.png should go into a folder named silkscreen next to the PHP script.

Update (February 9, 2004): I forgot to mention it, but Rob found the solution to his problem:

It turns out the problem is that I have an older version of GD, and it doesn’t support imagecreatetruecolor(). I changed the directive to imagecreate(), and it works fine now.

Update (October 11, 2004): font.png is now available here. It should go into a folder named silkscreen next to the PHP script.

May 23, 2003

The point of the other blog

I have created another blog, called Ölbaum’s Knowledge Base. Its main purpose is to archive the knowledge I gain by failing at something, documenting myself and eventually succeeding (or sometimes just understanding why I can’t). Its secondary purpose is to be able to point people who ask questions to a ready-made answer instead of having to make up a new explanation and/or look up references again. It is only its tertiary purpose to be available for people to browse and find answers to questions they didn’t ask in the first place.

Entries about Apache, SSH and CVS are to be expected in the near future as I never remember the arguments to the import command or the flags for update that prune empty directories and create the new ones.

I’d talk as well about how I discovered the drastic limitations of CSS2 positioning after hours of trial, error, harder trial and complete failure, but Dave Hyatt recently described the problem better than I would ever have done.

May 21, 2003

The point of this blog

The main motivation behind this blog is that whenever I decide to go mad and write silly things, I have usually no trouble finding a friend or two who’ll tell me I’m being really funny. Of course, they might be lying to me — and occasionally they must be, considering the incredible amount of bullshit I’m capable of writing in no time once I’m started — but someone said “You asked for it, you got it, Toyota,” and therefore behold: here is my blog!

(Of course, Toyota has nothing to do in the picture, they just happen to have a slogan that is 78% accurate in this particular case, which is more than I need to make my point.)

So I’m going to write things here, and I’m going to enjoy it. If I ever get anyone to tell me that what I write is funny, then my blog will have proven its usefulness. If I don’t, it’ll mean I didn’t get enough readers and I might have to take extreme measures to get people to read it, like threatening friends with WMA (Weapons of Mass Abomination: cups of decaffeinated coffee), ‘accidentally’ sending excerpts to my research group’s mailing list or worse, citing popular blogs in my entries and sending trackback pings so they link to me.

May 19, 2003

Oh happy day

One of my best friends got married yesterday1, so I’m dedicating my first blog entry to him and his wife. That was an amazing day. After the ceremony and apéro in Kerzers, we moved to the Gurten, a very nice place on a hill near Bern. There’s a beautiful view on the city (and on the Bundeshaus too where, we could verify, there are no lights, neither by day nor by night2) and, most importantly, a tchoo-tchoo. In case you’re wondering, tchoo-tchoo is technical for “model steam train that really works and on which you can actually ride.”

The dinner was delicious and the dessert buffet, oh my God, I can still hear them cry “Eat me, eat me, plllease!” There were great contributions from the guests, too, during the afternoon and evening.

The guests’ writing skills were widely sollicitated during the evening. There were two quizzes to fill about the couple, a photo album with a page dedicated to each of the guests and a collective short story that everyone was invited to complete. I guess the couple will have great fun reading all of this. Note to self: remember to come with a ghostwriter next time.

The night ended with a great fireworks-enabled balloon release. It was lucky the fireworks went out before the ballons reached the Bundeshaus, though, because they were dropping pretty big sparks and could have looked like an attacking UFO to any overzealous, half-drunk security guard who’d have happened to be on duty that night.

1. Assuming I finish writing this entry today, i.e. in the next half hour. OK, let’s put it this way: the wedding took place on the seventeenth of May and now I can take my time to write. 

2. R@f actually came up with the Bundeshaus joke. 

Do not meddle in the affairs of Coding Ninjas, for they are subtle and quick to anger.