Category Archives: Howto

Comment déjouer les frais de courtage d’UPS

Si vous achetez de vendeurs situés aux États-Unis, vous avez surement déjà eu la mauvaise surprise de voir le livreur d’UPS cogner à votre porte et demander une soixantaine de dollars de frais de courtage (quand votre paquet ne vous a coûté qu’une centaine de dollars!)

Cette pratique d’UPS, bien que malhonnête, est légale. En fait, tous les transporteurs qui traversent la frontière doivent effectuer le dédouanage de vos paquets (appelé courtage). Les autres transporteurs chargent de 5$ à 10$ pour effectuer cette tâche, tandis qu’UPS charge près d’une quarantaine de dollars (plus les taxes).

Heureusement, il est possible de déjouer cette pratique, ce n’est pas simple, mais ça fonctionne!

Continue reading

OBDC connections with perl on 64 bits IIS7

This one is quite confusing… to use perl on IIS7 on a 64 bit machine, you need to install the 32 bit (x86) version of ActivePerl (the 64 bit version won’t work) and follow these instructions.

If you want to connect to a database using ODBC, you can’t use the ODBC manager available in the Start menu since it’s the 64 bits version, you need to use the one hidden in %systemdrive%\Windows\SysWoW64\Odbcad32.exe

Check out the KB 942976 article for the details.

LWP giving Crypt::SSLeay not installed when run as CGI in IIS

This wasn’t terribly easy to find, so hopefully it will help some Googler:

LWP will support https URLs if the Crypt::SSLeay module is installed.

501 Protocol scheme ‘https’ is not supported (Crypt::SSLeay not installed).
it is required that the IIS internet guest account (iusr) has
‘Read and Execute’ permissions set on the Crypt-SSLeay dlls,
namely, ssleay32.dll and libeay32.dll. to set permissions,
locate these files, choose properties from the context menu, and
under the security tab, add the iuser account to the user names menu
with ‘Read and Execute’ permissions checked.


Some fun with SMS from Twilio

My favorite radio station is Radio X2. Many many times, I’m listening to the radio and asking myself “What’s the name of that song?” When I’m near a computer I just look at their What’s playing widget, but most of the times I’m in my car and I can’t access the web…

Then it hit me, why not make a SMS bridge using Twilio?

Continue reading

UTF8 with Perl and Ajax

It took me about three hours to figure out something this simple, so I’m posting this here!

If you’re doing ajax stuff with in perl, you’ll want to exchange your data in UTF8, to do so you need only one special line of code*:

my $json = decode utf8=>$q->param('json');

This will make perl work natively in UTF8 with $json.

If you want to put this (or part of it) in a database, you don’t need to do anything special because the DBD driver will convert your string from UTF8 to the database encoding (UCS-2 in my case).

*Of course, you’ll also need to use Encode;.

msdb is huge!

On our SQL Server 2005 DB, I found out that the msdb.dbo.sysmaintplan_logdetail table was more than 6 GB, so I ran the following SQL code to reduce it to 60 MB. It took about 10 minutes to run the query, so don’t panic.

Continue reading

MythDora: MythTV that works!

I tried once more to install MythTV on an old PC (P4 1.6 GHz, 512 MB RAM) that has been gattering dust at home for months. I tried using KnoppMyth in the past with ressounding failure. This time, I decided to try mythDora.

Continue reading

QL: Où s’en va votre argent?

Le Québécois Libre a publié récemment un lien vers un site gouvernemental qui permet d’obtenir des informations relatives aux organismes subventionnés par le gouvernement québécois.

Ce site est malheureusement difficile à naviguer et ne permet pas de manipuler les informations aussi facilement qu’une base de données permettrait de le faire. J’ai donc décidé de faire un web scraper pour « gratter » l’information présente sur ce site et la mettre dans un format plus facile à manipuler.

Continue reading

Fun with perl and Google Video

A couple weeks ago, I started playing with Google Video, it’s a great ressource, I really love it. The only thing that bugs me with this tool is that you can’t download the video to your hard drive. You can download a Google Video Player (GVP) file that’s effectively a pointer to the video, but you can’t download the actual MPG or AVI.

Well, I recently found out that you could. So I modified a perl module to make it very easy to do!

Continue reading

Simple query_string based http accelerator for a dynamic web page

A particular web site is serving pretty fancy statistics using SQL queries generated on the fly by an ASP page. The ASP page is receiving parameters using GET parameters. As the site is getting more popular, the load of the SQL server is rising, and the time needed to execute one big SQL query is now around 30 seconds.

After an analysis of the requests, I found out that 80% of the requests were for the same three stats — another example of the principle of locality. So I thought of using a reverse caching proxy (http accelerator) to reduce the load on the server. I tried squid and mod_proxy. However, both programs understandably don’t cache the data from pages that are given GET parameters. So I had to make my own solution: Perl to the rescue!

Continue reading