Tuesday, May 08, 2007

Your code is suboptimal!

I'm a sucker for t-shirts. Since I'm a geek with too much time on my hands, I'm part of an exclusive club. Then, because I read Eric Sink's Weblog, that makes me part of an even exclusiver club. Lastly, when I saw that Eric was offering to send some of his excellent t-shirts to people who were willing to mimic the character in a public photo plugging SourceGear's upcoming Fortress software, I couldn't resist the opportunity to sign up. 6-8 4-6 weeks later, here it is!

The t-shirt with the "Evil Mastermind" saying "YOUR CODE IS SUBOPTIMAL!" is part of an excellent marketing campaign.

Sunday, April 01, 2007

Please turn to page F%

I was reading the "Tech Weekly" section of a newspaper when I noticed that the staff are still typing page numbers by hand. How else could you explain page F5 (with page F3 folded up under it), as illustrated in this scan of a printout of a picture of a wooden table?

UPDATE: My submission to the Worse Than Failure website has finally appeared.

Saturday, March 31, 2007

They're more like guidelines...

Finally! An equivalent to SciTE's edge.* settings in Visual Studio! Trouble is, it's not called "edge" or "margin" (Eclipse), but "guidelines". No wonder I couldn't find anything on the topic when I was searching online!

Thanks go out to Sara Ford who blogged about this wonderful feature. If only I had known about this, oh, three years ago! :)

Here you go. Just copy/paste the following into a .reg file and import it. You can change the colour (currently a very pale green) and at which column you want it to show (currently at 80). You can even add more columns apparently, but that's getting a little silly.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor]
"Guides"="RGB(192,220,192) 80"

Monday, February 26, 2007

My name

It looks like Eber Irigoyen might be on to a new meme. I must propagate it by joining them in lamenting the mis-pronunciations of my names:
  • aw li vee eh
  • aw liver
  • dah gue naiz
  • dah gue nah
  • day je naiz
  • day je neh

As a result, I try to go by Oli, but this has proven to be equally as elusive as many people will write down Ali or even Holly! (WTF?)

Tuesday, February 20, 2007

Thanks for ruining it for the rest of us, guys!

Behold the power of stupidity on the internet, as I tried to e-mail a university computer science assignment to my professor:



OlivierDagenais-Assignment1.zip contains an executable file. For security reasons, Gmail does not allow you to send this type of file.

I can sort of see how something like this could have come about: logs show users e-mailing executable files of various degrees of maliciousness.  Google reacts by deciding one malicious executable file is one too many and refuses to accept executable files as Gmail attachments.

Some clever user then thinks "My nefarious H@xx0Rz.EXE must be e-mailed to my clueless buddies... I know: I'll just zip it!".  Google notices again and here we are.  Encrypting my ZIP file would probably do nothing as you can list the names of the files without the key and so Google's clever little ZipSecurityPeeker.py only needs to check for the presence of files ending with .exe.

I ended up submitting the assignment using another e-mail account. I bet I could have CCed my GMail account and received the "insecure" attachment no problem.

UPDATE: Whoa! I didn't even have a .exe file in my ZIP archive! I have some .bat, some .cmd and some .pl, as well as one or two shell scripts without an extension. Most of those files, incidentally, shipped as part of Apache Ant, which I included in my assignment's ZIP archive so the professor wouldn't have to go hunt it down, install it, etc.

UPDATE 2: Nope, I can't receive it either because I apparently broke the law:

Your message cannot be delivered to the following recipients:

Reason: SMTP transmission failure has occurred
Diagnostic code: smtp;552 5.7.0 Illegal Attachment c5si5493294qbc

Saturday, February 10, 2007

Unit tests can be fun!

Here's a snippet of testing code from a university assignment I did last term where we had to create a model of an alarm clock using finite state machines and then test using the FSM testing techniques we learned in class. This is Java 5 code with some JUnit goodness.

* It's 21:30 and I'm going to bed. I set the alarm time for 06:00 and then
* sleep until the damn thing wakes me up, but I don't want to get up just
* yet and I think 4 more minutes will change my mood today from
* "didn't get enough sleep" to "downright chipper" and so I slam my hand in
* the general direction of the drowse button (it has an 80%, no 70% chance
* of hitting it the first time) and then wake up a new man 4.2 minutes
* later, turning off the alarm functionality until I need it again the
* following night.
public void SetTickRingDrowseTickRingStop ( ) {
// set clock time from 01:00 to 21:30
// that is to say add 20 hours
for (int c = 0; c < 20; c++) {
// and 30 minutes
for (int c = 0; c < 30; c++) {
areEqual(21, 30, super.clockTime);

// set switch to Run

// set alarm time from 13:00 to 06:00
// which is to add 11 + 6 hours
for (int c = 0; c < 11 + 6; c++) {
areEqual(06, 00, super.alarmTime);

// set switch to Run

// go to sleep for 8.5 hours
for (int c= 0; c < 8.5 * 60; c++) {
areEqual(06, 00, super.clockTime);

// whoa, it's ringing!

// leave me alone for 240 more seconds!
for ( int c = 0; c < 4; c++ ) {
areEqual(06, 04, super.clockTime);

// whoa, it's ringing again!

// that's it, I'm getting up and turning this thing off

The test depends on some @Before method which resets the model (i.e. makes it just like the alarm clock just had batteries put in for the first time) and thus the the initial clock time is 01:00 and the initial alarm time is 13:00.  The model was created from observing the behaviour of an old Westclox travel alarm clock.

Wednesday, February 07, 2007

Backups of Subversion repositories

Here's the scenario: you are running a Subversion server and like all serious geeks, you want it backed up. This here post will show you how I do it for Windows and *nix _simultaneously_. I'm making the following assumptions:

Path typeWindows*nix
the subversion repositories are locatedd:\svnrepo/home/svn
the backup root folderd:\backups/home/backups
the subversion CLI(in the path)(in the path)

The first script performs not only a hotcopy backup of a repository (provided as the first parameter), but also first erases whatever backup might have been there (with a special provision for the very first time around) and creates a "dump" of the repository's contents, along with a final clean-up to save space. The reason we are keeping a dump over the contents of the db folder is that you can then "restore" your backup with a different version of Subversion. (trust me, I've lived through a catastrophic failure of a Subversion server and the dump format stays the same across versions while whatever's in the db folder doesn't necessarily)
@echo off
mkdir d:\backups\Subversion\%1\_backup
rmdir d:\backups\Subversion\%1 /s /q
svnadmin.exe hotcopy d:/SvnRepo/%1/ d:/backups/Subversion/%1/
svnadmin.exe dump d:/backups/Subversion/%1/ > d:/backups/Subversion/%1.svndump
rmdir d:\backups\Subversion\%1\db /s /q
mkdir -p /home/backups/svn/$1/_backup
rm -rf /home/backups/svn/$1
svnadmin hotcopy /home/svn/$1/ /home/backups/svn/$1/
svnadmin dump /home/backups/svn/$1/ > /home/backups/svn/$1.svndump
rm -rf /home/backups/svn/$1/db

The second script iterates through all the repositories in a root folder and calls the first script (which, BTW, is located in the backup root folder) for each one.
@echo off
cd \svnrepo
for /D %%d in (*) do d:\Backups\BackupAndDump %%d
cd /home/svn
for d in *; do /home/backups/backupanddump $d; done

Well, that's enough for tonight. I'm sure all you Linux gurus out there are pointing and laughing at my noob-skills.

Tuesday, February 06, 2007

A new oxymoron: cybersurf reliability

Go head. Google it and, even there, you'll see enough of the following: (emphasis mine)

CIA.com : The Freedom of Choice
Cybersurf's premium Internet service utilizes the fibre backbones of Call-Net and Bell Canada for speed and stability, and the latest CISCO remote access equipment (modems) for state-of-the-art digital access and reliability.

...yet ONE link down, there's the sign-up page (emphasis mine):

Welcome to Cybersurf

Err... aside from the "yes reliability, no reliability", they don't even acknowledge that future customers will be able to use the phone or internet to do anything? Legal and marketing need to have lunch together a little more often.

(Yes, yes, I know, standard "bait & switch"... I'm just pointing out it sucks, that's all...)

Saturday, January 13, 2007

That was easy!

So this [oldish] computer stopped booting properly about six months ago. It would start, but then mysteriously die during the sequence. I finally had a bit of time to check it out tonight, so I powered it up and noticed the POST would not only show a garbled version of "Maxtor" (and the model number), but also identify this 40 GB disk as about 8 GB. At this point, it would refuse to even boot and instead barf up with INVALID SYSTEM DISK, INSERT BOOT DISK AND HIT ENTER TO RETRY (or something just like it).

Anyway, I figured the hard disk wasn't that old and so I powered down and unplugged it. I noticed the ribbon cable wasn't quite straight (it was sort of folded onto itself, but not perpendicular to the wires), so being obsessive-compulsive as I usually am, I straightened it out, carefully plugged it back in and decided to give it a shot. Lo and behold, I'm blogging this from that computer.

Monday, January 08, 2007

Handy equivalents of Outlook Express keyboard shortcuts for Outlook 2007 users

Outlook 2007 is pretty neat but it's also a little awkward if you've been using Outlook Express a lot (or maybe even previous versions of Outlook). Since I'm a keyboard freak, here's my cheat-sheet of stuff that was really hard to find in the documentation (*cough* context sensitive help my ass! *cough*):

ActionOutlook ExpressOutlook 2007
Switch from plain text to HTML (while viewing a message and plain text is the default - which is what everybody should do)Alt+Shift+HCtrl+Shift+W, D
Focus on the folder tree (while in the main interface)TABCtrl+1
Insert default signature (while composing)Alt+I, SAlt+N, G, ENTER
Invoke smart tag (i.e. AutoCorrect Options)'s drop-down menunot applicableAlt+Shift+F10

Update: Until I put all the HTML code on one line, the spacing was way off, sorry. My "Preview" button doesn't really Preview. :p