MailNG 0.6 is now available. What’s new :
- Users have now their own specific area,
- Auto-reply messages support,
- ‘mbox’ storage format support,
- Bugfixes.
The tarball is here.
I hope you will enjoy this release
MailNG 0.6 is now available. What’s new :
The tarball is here.
I hope you will enjoy this release
Python is a dynamic language, it means you can create new types at runtime. I had a case where I needed to create a new class depending of what a remote server could do.
The use case was:
Ask the server what class / methods are available, for example:
('/cat/meow',
'/cat/eat',
'/cat/sleep',
'/dog/bark',
'/dog/eat',
'/dog/sleep')
Create dynamically the class with the associated methods to call the corresponding remote methods.
This means I couldn’t use the well known syntax:
class A(object):
...
class B(A):
...
I could have by-passed the problem by using
exec:
exec('class %s(object): pass' % 'Cat')
But that’s not the right way to do it. Code generation is prone to breakage and
easy to get wrong. Using
type() is a better
option, it is simpler to use and faster to execute: no need to parse a string.
new_class = type('Cat', (object,), {'meow': remote_call('meow'),
'eat': remote_call('eat'),
'sleep': remove_call('sleep')})
new_class is a regular class:
>>> type(object)
<type 'type'>
>>> type(new_class)
<type 'type'>
>>> new_class.__name__
'Cat'
>>> new_class.__bases__
(<type 'object'>,)
It’s useful when you have to build a class from something external like a database schema, or a web-service.
by Henry Prêcheur (henry@precheur.org) at June 17, 2009 04:00 AM
A while ago, I posted a patch to display the date in dwm's status bar without reading it from the standard input. It doesn’t work with newer versions of dwm.
This patch works with version 5.5. To apply it:
$ cd path/to/dwm
$ patch -p 1 < dwm-5.5-displaydate.diff
by Henry Prêcheur (henry@precheur.org) at May 20, 2009 07:00 AM
I spent lots of time designing forms and trying to make them look good. It’s a
tedious process, usually involving a bunch of <div>, <ul>, <p> tags, and
even tables, with lots of CSS.
But now I found a way of making nice forms like this one:

The HTML code is straightforward:
<fieldset>
<legend>test form</legend>
<label for='input'>Input</label><input name='input' id='input'>
<label for='input_long'>Very long label blah blah blah blah blah</label>
<input name='input_long' id='input_long' size='50'>
<label for='select'>Select me</label>
<select id='select' name='select'>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
<label for='comments'>Comments</label>
<textarea cols='40' rows='4'>Sample comment</textarea>
</fieldset>
No <div>, <ul>, or <br> floating around. I think there is nothing to remove. The
CSS code is equally simple:
label
{
float: left;
clear: left;
width: 10em;
}
input, select, textarea
{
float: left;
}
Simple and it does the job. I didn’t test it on Internet Explorer 6 and Netscape Navigator 4, just because.
by Henry Prêcheur (henry@precheur.org) at April 30, 2009 07:00 AM
Make your site faster and cheaper to operate in one easy step by Paul Buchheit recommends to turn on HTTP gzip compression on your site, and makes a cost / benefit analysis. The advantages on the server side are clear, but what about the clients? What are the benefits of gzip encoding for them? I ran a series of tests using curl to see exactly how much time is saved on the client side. I ran the test on friendfeed.com.
| File | Connect time | Pre-transfer time | Total time | Transfert size | ||||
|---|---|---|---|---|---|---|---|---|
| Mean | Median | Mean | Median | Mean | Median | Bytes | KBytes | |
| no gzip | 41 | 41 | 155 | 144 | 292 | 282 | 42531 | 41.53 |
| gzip | 40 | 41 | 148 | 144 | 186 | 182 | 9639 | 9.41 |
| File | Connect time | Pre-transfer time | Total time | Transfert size | ||||
|---|---|---|---|---|---|---|---|---|
| Mean | Median | Mean | Median | Mean | Median | Bytes | KBytes | |
| no gzip | 160 | 157 | 393 | 384 | 861 | 853 | 42531 | 41.53 |
| gzip | 157 | 158 | 392 | 388 | 548 | 544 | 9639 | 9.41 |
Notes
The total time includes decompression time on rather slow computers (AMD Geode 266MHz and VIA C7 2GHz). Each test was repeated 100 times. The standard deviation was low, and times were stable.
First Let’s calculate the real download rate. It’s not the number of bytes transfered divided by the total time. The total time includes the connection time and the server’s processing time. Those are not strictly download. The real download rate is calculated this way:
size / (total_time - pre-transfer_time)
This formula is not 100% accurate, since it doesn’t take into account network latency and includes decompression time. But it’s close enough.
On my Canadian connection, the real download rate is about 310 KB/sec for the uncompressed page and 255 KB/sec for the compressed one. From France: 91 KB/sec uncompressed and 61 KB/sec compressed.
Bigger downloads tend to have a better rate. The compression is partially offset by the lower download rate. It’s not because gzip divides the size by 4 or 5 that you will get the page 4 or 5 times faster.
The download rate is not the only important factor. Connection & processing take time too, more than half of it if you have a fast connection.
When you have a rate over 200 K/sec the size of the page is not as important as it used to be. Faster broadband access means shorter connection time and even shorter download time. It also means that the server’s response time matters more and more. It takes at least 110ms after the connection is established before the first byte reach the client. That’s between 36% and 58% of the total time. It might account for even more in a few years.
GZIP encoding helps to reduce the total time significantly: around 35%-36%.
In theory compressing the page should do wonders with slower download rate. The server’s response time is just 26% - 42% of the total time. Download rate being lower, one would except GZIP encoding to reduce the total time by more than 36%. Surprisingly that’s not the case. The gain is unchanged at 36%.
That was a surprise for me. It turns out that GZIP encoding didn’t reduce the total latency by much more than 36%, because of the long connection time.
The results might have been better with bigger transfer, but 40K is already big for a HTML file. My data set was limited, so other tests with a greater set of connection types and different speeds might yield different results and would help determining how efficient GZIP encoding is in different situations.
Is there any case where you should avoid compressing your pages? Let’s run the test on www.google.ca.
It’s probably one the worst case:
| File | Connect time | Pre-transfer time | Total time | Transfert size | ||||
|---|---|---|---|---|---|---|---|---|
| Mean | Median | Mean | Median | Mean | Median | Bytes | KBytes | |
| no gzip | 29 | 28 | 56 | 52 | 74 | 73 | 6838 | 6.68 |
| gzip | 29 | 27 | 58 | 57 | 63 | 62 | 2897 | 2.83 |
Notes
The size of the page can vary by a few bytes between each request. But it’s not significant.
It looks like Google is compressing its home page on the fly, because of the delay of a few milliseconds in the pre-transfer time when using GZIP encoding. Caching the gzipp'ed page would save processing power, and on Google’s scale that’s probably a few millions dollars saved each years.
The gain is lower than before, but still significant at 15%.
I guess there are very few cases where you shouldn’t use gzip your content. If your typical page is less than 100 bytes then gzipping it could hurt the client’s and the server’s performance. But no website —except maybe a few web-services— serves pages with a typical size of 100 bytes or less. So there’s no excuse for serving uncompressed HTML.
Download the scripts. You’ll need curl to run the test and Python to create the report. The code is in the Public domain.
by Henry Prêcheur (henry@precheur.org) at April 23, 2009 05:32 PM
En francais plus bas
So I’ve been living in Vancouver for almost two years now. And from time to time I feel the need of a car. There are things and activities that one can’t do (or with difficulty) without a car: Big grocery shopping, trips to IKEA, trips to the local mountains, trips to Richmond :D…
Owning a car when you don’t use it often (less than twice a week) can be very expensive. Not including the loan (if you don’t buy it cash) you have to pay for insurance (which is crazy in British Columbia), maintenance, parking, gas and of course you loose money with the depreciation of the vehicle. When you own a car you tend to consider yourself free but this freedom has a price. Usually car owners pay between $500 to $1000 a month (sometimes more, sometimes less depending on the car).
So for people who live in Vancouver, Canada there as far as I know two alternatives to owning a car:
They are both membership based and you have to pay a small setup-fee to join ($20 for co-op, $25 for Zipcar).
I listed the differences between the two options in the table below.
| Zipcar | Co-op | |
|---|---|---|
| Cost to join |
|
|
| Joining process | Both require a driving history and claims record from ICBC. Zipcar doesn’t require a BC Driver’s License. That means foreign licenses are accepted and depending on the country of origin a notarized English translation of your driving record from that country is required. The Co-op requires holders of foreign licenses to get their BC Driver’s License within a month after joining. | |
| Pricing |
The rates depend on the time (weekday, weekend) and on the car you book. |
Depending on your usage you get a monthly fee + kilometer charges
There is no surcharge for bigger vehicles, no surcharge on week-ends and the hourly rate doesn’t apply between 11 PM and 7 AM. |
| Gas | Gas is included for both but Zipcar provides a gas card (only usable at Esso stations). The Co-op reimburses your gas expenses (they deduct gas expenses in your monthly bill) | |
| Parking | Parking is included for both and there are usually lots of cars in your neighborhood. For Co-op cars you are allowed to park in stalls that show “only with permit” in the city of Vancouver only | |
| Access to cars | An RFID card and gives you access to all the cars in the fleet during your booking. You scan it on the reader located on the windshield and you’re ready to roll. VERY convenient | A fob has been recently introduced and unlocks the ignition. So same thing you scan your fob on the reader located on the windshield and it unlocks the driver’s door and the ignition. You still need to get the key from the lockbox at the back though. A lockbox key is provided along with a fob when you join. The cool thing is that if you forget something in the car you can always go back anytime and get it |
| Booking system |
|
|
| Insurance | Insurance is included but you may have to pay a $500 deductible if you are in an at-fault (or no fault determined) accident. You can buy a damage waiver to decrease or eliminate the deductible (waivers are valid for a year). | Insurance is included but you may have to pay a $500 deductible if you are in an at-fault accident. You can use your credit card Loss and Damage Waiver insurance to cover that. |
The Co-op network now has a non-membership based offer comparable to Zipcar where they charge the car by the hour with a limit of 150 km per day + annual fee. More info here
A Zipcar member can use each and every car in the fleet everywhere Zipcar operates (many cities in the US and London, UK). Very convenient when traveling abroad. Co-op has an agreement with Victoria Car Share (Victoria, BC) and City Car Share (San Francisco, CA).
Zipcar and Co-op both allow you to cross the US-Canada border without any special clearance.
So who is the winner ? Well Zipcar is definitely more expensive than Co-op. I personally am a member of both but I use Co-op more often since it’s cheaper. I like the idea of being able to use cars in other cities and I also use Zipcar for longer periods of time (usually a day).
Some books seem to enjoy a bible-like status in the programming world. The Pragmatic Programmer is one of them. It is usually well ranked among Top 10 Programming books posts scattered all over tech blogs.
The writing is fine, it is entertaining to read. But you won’t learn much with “The Pragmatic Programmer”, it is too shallow to make a significant impact. It introduces a concept, sometime gives a quick example, and move on to something else. It is a programmer’s self-help book, and like most self-help books, works this way:
Many examples and exercises are confusing or badly explained. Some are just plain wrong like one example page 189.
Overall I was disappointed. The book is not particularly bad, but it’s overrated. Don’t waste your time reading it if you really want to be a better programmer. I recommend Code Complete 2ed, it is detailled and clear.
by Henry Prêcheur (henry@precheur.org) at April 18, 2009 05:05 AM
I have setup a discussion forum to centralize informations reported by users.
You can find it here.
There are places for questions, bug reports and more.
MailNG 0.5 is now available. What’s new :
The tarball is here.
Do not hesitate to send me feedbacks or suggestions
MailNG 0.4 is now available. What’s new :
You can find the tarball here.
Do not hesitate to send me feedbacks or suggestions
Like HTML 4, but now it’s HTML 5.
<!DOCTYPE html>
<title></title>
<p>
Thanks to the finally-easy-to-remember Doctype, it’s shorter. HTML 5 looks like pure-awesomeness turned into a markup language. And validator.nu validates it elegantly, it is much better than the w3 validator.
by Henry Prêcheur (henry@precheur.org) at March 28, 2009 01:50 AM
Mailng 0.3 is now available (very fast isn’t it?). This is a bug fix release only:
I have setup a little configuration using postfix, dovecot and mysql. It seems to work fine ^^.
Get it here.
This time I do it in english (I try…).
The tarball is here.
New release that makes Mailng usable with additional softwares. I think Postfix and Dovecot should integrate fine but this has not been tested. Feedbacks will be appreciated ^^
Take a look at the INSTALL file inside the tarball, you should find usefull informations.
Je voulais le faire depuis un petit moment déjà, malheureusement on ne fait pas toujours ce que l’on veut dans la vie (comme dirait l’autre…).
Bref, voici la première sortie officielle de ma solution de messagerie web : Mailng 0.1
Au programme pour le moment :
Le projet est écrit en Python et utilise le framework Django. Mootools est utilisé pour la partie dynamique.
Il ne s’agit pas encore d’une version complètement sèche. L’interface est pleinement utilisable mais l’intégration avec des projets extérieur n’est pas encore terminée. Elle me permet surtout de marquer une étape dans ma gestion de projet (olala le grand terme que voila).
Les avis/retours d’expérience/remontées de bug sont les bienvenus!

48 hours ago I went through laser eye surgery on both of my eyes. Before that, I had never been able to do anything without my glasses. Not been able to see more than 3 feet away. I had tried several times to wear contact lenses on daily basis (I tried all of them including the extreme hydrophilic ones such as Extreme H2O, Acuvue moist, …) and even if I was able to sometimes tolerate them, it wasn’t always easy especially after wearing them for several hours. I work in front of a computer and in confined air-conditioned room all day. My eyes were irregularly too dry. It was nothing chronic but I remember getting allergies every once in a while due to contacts.
Glasses were fine and looked not bad on me but you can’t do much with your glasses on: your vision is very limited to the sides, you can’t watch TV while laying on the couch and first and foremost you can’t practice any sports.
So after a little bit of thinking, researching and talking to all those happy and satisfied people who had it done: I decided to go for it as it would probably relieve me from wearing contacts or glasses for a while. I am only 24 years old and my vision hasn’t significantly changed for the past 3 years. I’ve had the same correction on both eyes (-2.00). Now I am feeling that my left eye is a bit weaker but not by much. I know that my vision is most likely going to change (maybe a lot before I turn 30).
Of course my research got me onto these findings on the bad sides of the laser eye surgery: some terrible side effects such as increased dry eye problems leading to sensations of burning and pain, night vision problems (halos, hazes, stardusts…). Besides my mum, who is an experienced ophthalmologist back in France warned me about the procedure and was totally against it. She would always say: “why all surgeons who actually need vision correction never had the surgery done on themselves?” If you want to scare yourself before you have it done check out this website. It will make you think twice believe me!
A month ago I went to my free consultation at Clearly Lasik and after about an hour and a half I was told that I was a good candidate for all laser eye surgeries and there were three: Regular Lasik (with a blade)/PRK, Wavefront Custom View Lasik (with a blade)/PRK, Intralase Wavefront Custom View Lasik (bladeless) know in Europe as femtoseconds or Z-Lasik IIRC and has been around for the past 5 years or so.
I didn’t want to go cheap because I only have two eyes and they’re precious to me so I decided to take the more expensive one: Intralase Wavefront Custom View Lasik. That included lifetime enhancements (if I ever need to do it again) at the same clinic.
The procedure itself took less than 10 minutes for both eyes and was fairly painless. I remember feeling a slight pain when the surgeon lifted my left eye corneal flap but nothing huge. I remember not being able to see for a few seconds when that laser was reshaping my cornea and I remember smelling a bad odor of burnt hair when the laser was performing. Other than that nothing. When the operation was over, the Surgeon quickly checked my eyes and then sent me home. I remember him and his two technicians talking to me during the procedure but I also remember not saying much other than “OKs” here and there.
That same day, I didn’t do much but keep my eyes closed with protective sunglasses on.
It’s been 48 hours so far and what I am feeling right now is really close to what I used to feel when I had worn contact lenses for a while. Meaning sometimes it would feel nothing and sometimes it would feel pain. I try to keep my sunglasses on even indoors in dark areas because the air contact makes my eyes dryer and brings more pain I feel. I look like Agent Smith (i.e like an idiot) but who cares. My vision is definitely a lot better and I can see almost everything but I don’t know the numbers, I will have to check that next week.
To be honest I don’t know if I have made the right decision, it’s too early to tell anything. The only thing I know is that I caused permanent damage to my eyes as the flap that was created to perform the surgery will never ever heal completely and could be lifted by anybody even years from now. But that’s a sacrifice I am willing to make if it comes with clear vision without glasses/contacts.
Another procedure I could have done is the PRK procedure but I didn’t know much about it except that the healing time was longer and Lasik seemed to be the preferred procedure.
The PRK/Lasek procedures are older procedures that are now being replaced by Lasik. When you talk to most Surgeons they will tell you that the main difference between PRK/Lasek and Lasik is the healing time (a few hours for Lasik as opposed to a few days/weeks for PRK/Lasek). Actually the main difference is that in PRK/Lasek there is no flap creation as they operate directly on your cornea and that’s why it takes longer to recover. So your cornea will stay almost intact (close to what it was before surgery). This is very important because any trauma caused to your eyes will be the same had you done the PRK/Lasek surgery or not. So for athletic people who do a lot of contact sports such as martial arts, kick boxing, football, …PRK/Lasek are better alternatives but think about the healing time and the side effects as well (as they are the same and maybe worse than lasik side effects…).
I actually do a pretty violent martial art called Krav Maga but I didn’t know that PRK was preferred over Lasik for contact sports.
My optometrist said to me yesterday for my 24 hours post-op exam that if she had known that I was doing a martial art she would have told me to go for PRK but I forgot to mention it and she didn’t ask me either. Now I guess I have to give that up for a little while and maybe forever as it represents a lot of risks and I am not willing to lose my eyes yet.
Weblog 2.1 is now available. This is a bug fix only release:
UTF-8 characters are now allowed in templates. There is currently no way to specify another character encoding for templates.
Fixed crash when no author was specified in the post file and the configuration file.
Thanks to Thiago Coutinho and Michael Lange for reporting these problems.
Get it on the download page.
Weblog’s repository is now http://bitbucket.org/henry/weblog/. Bitbucket provides an issue tracker where you can report bugs and request features.
Don't hesitate to ask questions or request support in the mailing list:
by Henry Prêcheur (henry@precheur.org) at March 20, 2009 04:51 AM

So I’ve been ice skating since I moved to Canada but not very regularly to be completely honest. The main reason is that I wasn’t feeling any improvements throughout my sessions. Every time I was just getting bored turning around the arena (or they call it Ice rink here).
So I looked on the Internet and I found a series of videos that really helped me a lot.
The guy is visibly from somewhere in Eastern Europe but he’s got perfect English imho.
Before your perform any of this you need to know how to skate at least barely without holding to the side wall.
As I said above it really helped me a lot, especially the one where he teaches how to stop.
The videos are here
A few bruises later you should be able to master the thing!
PS: There are some videos on YouTube as well but I find them to be “not” complete.

Before last year I had almost never seen snow nor had the chance to try any snow sports such as skiing or snowboarding. But last year I decided to give it a try. I took some ski lessons and snowboarding lessons just to see how both feel. I liked skiing but even though it was super hard for me to get the fundamentals, once I got them it seemed too “easy” and not very “challenging”. So I opted for snowboarding and I bought a VERY cheap gear for $150 including everything. I knew that I liked it but I didn’t know how much I really liked it so I figured I’d better buy a cheap gear in case I didn’t like it.
I first thought I was goofy until this year when I realized that I was in fact regular (which kind of makes sense because I am right handed). That prevented me from doing the basic stuff such as J-C turns for a very long time. I remember this one day on chairlift when a very nice guy told me that my feet were positioned weirdly and I should probably think of switching positions (from goofy to regular) but I never listened.
This year is actually when I realized that I couldn’t make any turns so I might as well switch and see how it feels. BINGO, I could make my first basic turns after a lot of bruises and back pains! I am still in the very beginning of the learning curve but I got to a point where I actually enjoy it and that’s all what matters. Right?
So same thing as with Ice skating I did some research on line and I stumbled upon this website where they teach you everything for every level. As you might guess I am still at the beginner level. They even tell you the things you should know before you buy a snowboard and equipment a lot more!
I really find that watching the videos over and over again helps a lot!
Enjoy!