First Snow

October 22nd, 2008

img_5919-desktop.jpg
The snow is back!

Here’s a small piece of the view I had this morning in my backyard.

Traffic Control on Linux

September 24th, 2008

Years ago, I had to shape some traffic at the office — I don’t even remember why.

I do remember how painful that was. The tools (iproute2) were quite new, and the documentation was excessively terse.

Recently I rebuilt my whole home network (essentially 2 “servers”, one dual core 3800+, the other single 3500+) with OpenVZ virtual servers: one for the telephony using Asterisk, one for the network configuration (DNS, …), one for general linux development, one for …, …

My home network is plugged on the internet using a Videotron cable modem. Good downloads (~ 1MB/s), good uploads (~ 100KB/s), very poor download/upload mix. So I punched myself into looking at the traffic shaping tools available in Linux, again.

Amazing how things have changed! There’s actually good documentation here! And the HTB qdisc is so much understandable when compared to CBQ (the only thing I had the last time I looked at all this)!

Anyway, now that my queues are managed by my router instead of my provider, uploading something doesn’t jam up everything, it barely has any effect on my pings, and I can still browse, check my mail, and speak over the phone :) I can finally prioritize services in a manageable way!

Another nice thing I should’ve looked (again) years ago. Life is full of discoveries!

Barcodes and SVG

September 23rd, 2008

Recently, I looked in possible solutions with a friend to generate “3of9 barcodes”. He wanted no dependency aside PHP itself, which excluded GD. The point is to print barcodes, not dump them to the screen, and so required a printable solution.

So I tought about sIFR: simply dump a good font (1, 2, …) in a flash animation.

Of course that failed because of flash’s inerent inability to be printed (seems to be rendered at the browser’s screen resolution, then scaled).

The next thing I looked into, was SVG.
Read the rest of this entry »

MacBook Pro Power

September 13th, 2008

A little post after months of inactivity to celebrate my joy…

In the past months, my battery lasted less and less. When I got an estimate of ~20-25 minutes left, the MBP shut abruptly if I did anything more than nothing.

The battery, having only 53 cycles, had a full charge capacity varying from 1300 to 4200, which is way below Apple’s advertised capacity of 80% @ 300 cycles! (See the Laptop Battery Guide on macrumors.com).

Anyway, I finally decided to replace the battery on warranty. Had a hard time deciding myself because a Mac laptop runs at half speed without a battery, and the store had to send it to Apple before they would send a replacement.

So I got the replacement a few days ago… I had forgotten how fun it can be to be “unplugged”!

And I could swear the laptop’s bottom (where the battery lives) stays much cooler!

Yay!

PostScript Metrics & Kerning with PHP/GD

February 5th, 2008

So you want to render a nice PostScript Type 1 font (.pfb/.pfa) using PHP+GD. Sadly, you just realized you can’t load the associated font metrics (.pfm/.afm) in PHP.

The “afm” (ASCII) and “pfm” (Binary) metric files contain, amongst other things, the metrics and the kerning information about the font. To render a font correctly, both the font and the metrics are required.

Freetype2 supports metrics, but you have to load them up “manually”, using the FT_Attach_Stream() or FT_Attach_File() functions. Sadly GD (and PHP) knows nothing about PostScript metric files.
Read the rest of this entry »

Website protected against non-Windows users

February 5th, 2008

Today, a friend sent me an interesting discovery: a website working only with Windows.

Ok… this is certainly not the first time you’ve heard something like this. So let me rephrase this:

Today, a friend sent me an interesting discovery: a website where TCP connections only work when initiated from a Windows computer.

Ahh… never heard this one have you?
Read the rest of this entry »

rxvt-unicode on Os X

January 29th, 2008

I’ve done most things using CLIs: Commodore 64 don’t have GUIs or mouses (well.. there was GeOS), AmigaOS is quite UNIX+X11-like, and I can’t live with Windows without Cygwin installed.

When I bought my MacBook, one of the first things I did was to launch the terminal. My last meal crawling its way back through my throat forced me to close it fast!

Ok… it’s not that bad, but it doesn’t seem to allow turning off that annoying bold and use 16 colors instead. The option “Use Option as Meta Key” is nice, but at the same time a pain… how am I supposed to type @, \, {, [, … without a normal “alt” key? (BTW I’m mostly using a “French Canada” keymap) On the other hand, I’m not used to type ESC followed by left-arrow or w or … I want my meta key!

Then there’s iTerm. It can turn off bold and use 16 colors. Not bad.. but I can’t seem to get a working meta key.

So my quest is over… I want rxvt-unicode back! It supports everything and have the greatest UTF-8 support I’ve ever seen: Hit Control-Shift and 2022 and you get •, hit Control-Shift and click on the bullet, and you get an overlay saying “2022″.

After being asked by a few friends about how to get rxvt-unicode working under Os X, I decided to dump this in my newly born blog.

Thus, in this article, I’m going to describe (tersely and yet verbosely enough, I hope) how I launch various X11 or shell applications like gnuplot, urxvt, ssh to server <insert_server_name_here> or gucharmap using QuickSilver.

Be warned that I’m assuming at least some knowledge on how to use a terminal, what is a shell, and such.

Read the rest of this entry »

« La petite maison blanche »

January 26th, 2008

Petite maison blanche
The picture in the header of my blog is known as “La petite maison blanche” (”The small white house”).

In 1996, the Canada saw its biggest overland flood of the 20th century, in the Saguenay region (Source: Wikipedia). That little house was submerged in the river, water flowing all around. Of all the buildings of the neighborhood, only this house and the church survived.

I took this photography in 2004 during the winter, armed with the widest lens I had at the time: a Sigma 12-24 for Canon EOS mounts.

You can find a picture taken during the flood (with a few more houses :) on Wikipedia’s French page.

Better Freetype2 control in PHP’s GD extension

January 24th, 2008

Years ago, I made a patch to PHP’s GD module, allowing me to use most of Freetype2’s rendering options.

When I first made this patch (somewhere in the PHP3 years), the extension always forced autohints, even when compiling freetype2 with bytecode support. Later on, they changed this to a better default, but you still couldn’t render a font, for example, without anti-aliasing.

Today, I cleaned up my patch a bit and released it here. Maybe someday I’ll clean it up for real and submit it for inclusion in PHP, but I’m not there yet :P

Anyway, have fun with fonts.. or not :)

Dirvish - The ultimate backup system

January 23rd, 2008

For years I employed a conventional backup methodology to backup my personal server to my home server: monthly full backups, weekly and daily incrementals to save space.

A few months ago, my home internet provider (Vidéotron) vitiated the quality of their service: from unlimited monthly usage, they slammed a 100 gigabyte limit in our face.

This led me on the divine quest.. “How to ™quit byte-drinking in 30 days”. I kind of failed and ultimately went for a commercial link, but still have found a marvelous piece of software… Dirvish.

I wish I had ™made that discovery years ago!

Each night my full backup takes less bandwidth (and time) than a daily incremental previously took (thanks to rsync).

The full tree of what I backup can be accessed like any other file on my drive and takes less space than the previous backups did (thanks to hardlinks)!

Restoring a file doesn’t require hours of untarring to find what I’m looking for.. simply cd, copy/scp, and enjoy (or use the included locate-like system to find things first).

For those using a Mac with Leopard, it’s very similar to Time Machine.