December
5

Support for fonts on the web has been a sore spot for a long time, but that’s all about to change with both Firefox 3.1 and the latest Webkit (Safari, Opera, Google Chrome) properly support CCS 3’s @font-face property.  Now browsers will be able to automatically download fonts from an online location.

Here’s a simple example:

      @font-face {
        font-family: "Robson Celtic";
        src: url("http://site/fonts/rob-celt")
      }
      H1 { font-family: "Robson Celtic", serif }

This is very exciting news.  No longer will typographically savvy developers need to rely on clever sIFR hacks.  Oh, and not to make Internet Explorer an afterthought, but IE has supported @font-face since version 4, except with a proprietary .EOT filetype, a compressed form of OpenType, while Firefox and Webkit are supporting the more common and non-proprietary TrueType and OpenType formats.

3
February
13

Before replacing my  old Motorola RAZR with an iPhone I needed to backup up all of my photos.  Unfortunately Motorola’s naming convention for images is terrible:  DD_MM_YY-hhmm.jpg, if you try sorting that you get all the photos taken on the first of any month grouped together, followed by all those taken the first of the second month, etc.  That’s terrible.

So I wrote a little perl script that renames all RAZR pictures to YYMMDDhhmm.jpg so that they can be easily sorted in chronological order by any file browser.  You’d think a big international company like Motorola would be able to respect the ISO 8601 standard by now.

Comments Off
December
28

If you’ve waited until now before upgrading to Ruby on Rails 2.0 now you may be in for a little surprise.  As of version 2.02 the default database in Rails is SQLite, arguably because there is no need to for grants or the creation of tables, meaning a simpler setup for n00bs.  If you still want to use MySQL (or any other database for that matter) you have to provide the following:

rails -d mysql appname

SQLite3 and the necessary driver gems come preinstalled on OS X Leopard, but if you don’t have the Ruby bindings installed it’s as simple as:

sudo gem install sqlite3-ruby

You can always change which db your Rails app is using by changing your config/database.yml.

0
December
18

This Lotus Notes script strips email attchements using an Agent instead of Rules.

Lets say you want to forward mail from your Lotus Notes account but want to strip attachments, you’ll definitely want to try the following script. It’s perfect for sending your mail to your sexy new iPhone without racking up ridiculous bandwidth charges.

This works in Notes 8, but has not been tested in earlier versions. Also be sure to replace YOUREMAIL@MAIL.COM with an external email address. Credit should go to Simon Lacasse who did the nitty gritty work, I’m just making sure others can benefit from it.

Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim memo As NotesDocument
Dim doc As NotesDocument
Dim j As Integer
Set db = session.CurrentDatabase

Set collection = db.UnprocessedDocuments

For j = 1 To collection.Count
Set memo = collection.GetNthDocument( j )
''If Not( memo.SentByAgent ) Then

Set doc = New NotesDocument( db )
Call doc.CopyAllItems( memo, True )
Dim rtitem As NotesRichTextItem

Set rtitem = memo.GetFirstItem("Body")

doc.Form = "Memo"
doc.Subject = "From :" + memo.From(0) + ":" + memo.Subject( 0 )
doc.Body = memo.Body
doc.Principal = memo.from(0)
''doc.InetFrom = memo.SMTPOriginator
doc.ReplyTo = memo.from(0)

Call doc.Send( True, "YOUREMAIL@MAIL.COM" )
'Call doc.Send( False, "Put another EMail address here" )
''        End If
Call session.UpdateProcessedDoc( memo )
Next

End Sub
0
November
4

Terminated

Posted In: Thoughts, command prompt by Chris Lamothe

 

 

Terminal

Leopard (OS X 10.5) has its fair share of goodies, including a new and improved terminal client with *gasp* tabbed windows. I thought this feature would be great news, since as I wouldn’t need to install the venerable iTerm in much of the same way that Spaces has supplanted VirtueDesktops. After a week though I’ve gone back to iTerm, as it became painfully obvious that the Window Groups features of the Leopard terminal couldn’t hold a candle to the bookmarking features in iTerm. The Window Groups in terminal fail to retain any useful information such as which host you are connected to, and you’re manually forced to ssh back to where you were before, this is something that the bookmarks in iTerm solve easily. So close Apple, yet so far…

0
September
6

Chris Lamothe presenting at Montreal on Rails 2So this Tuesday I had the honour of presenting at Montreal on Rails 2, where I demoed the Acts As Authenticated and Role Requirement plugins.

I think Marc Andre Cournoyer’s review impressed me the most, mainly that …[it] is an exploit to be able to code a live app in front of a crowd like this. It’s a testament to the power of Rails and I’m just glad the Roles portion didn’t bomb the way it had during my rehearsals at home.

I was especially impressed by Chris Scott’s demo of the Ext JS framework. Sorry Darin, but there are some pretty nice features in Ext that will make me want to take a closer look. Terje Tjervaag’s demo of Firebug was convincing enough to make me wonder why I hadn’t already installed it yet. Used it at work today to great effect. You can read more reviews of the night here and here, while photos have been posted on Flickr and videos might pop up on Youtube.

0
August
31

If you work in a 9-5 environment, then the biggest mistake you can possibly make on a Friday afternoon is to start major changes in your code. Stop! Step away from the keyboard! This one goes right up there with never sending an email late at night (especially when you’re tired or cranky) or discussing work/money in bed.

I learned this lesson on my own and it bears repeating, because even after all these years I still catch myself doing it sometimes. It’s Friday, you’re tired, and when your guard is down that’s when you start doing stupid things to your code.

So go write some documentation or as Marc-André Cournoyer suggested, fix the little things that you told yourself you’d do later but never did or add some tests. Just stay away from major changes on a Friday afternoon!

5
August
27

I’m happy to announce that I will be speaking about user authentication at the next Montreal on Rails meetup, scheduled for Tuesday the 4th of September at the McGill MAASS Chemistry building, room 328. The show starts at 18h45 and I think I’ll be the first to present, so come early.

Although user authentication may sound like an advanced topic, it will be aimed mostly at the novice Rails developer as a showcase of how easy it can be to implement advanced features such as user security and roles in a Rails application. I hope to touch on a few items including the excellent Acts As Authenticated, roles and salting. If there’s anything in particular you would like to see, drop me an email.

4
August
16

The integrators at work had a problem recently with a shell script that generates SQL deployment and rollback scripts on the fly based on SQL patches submitted by developers. The problem was that sometimes the name of an object would include a “(” at the end of it (e.g. “FN_RESET(” instead of “FN_RESET“). Here’s a quick solution I whipped up for them:

#if $TEST_END doesn't become an empty string,
#then OBJECT_NAME ends with "(" so we strip it
TEST_END=$(echo "$OBJ_NAME" | grep \($)
[ -z "$TEST_END" ] || OBJ_NAME=$(echo ${OBJ_NAME%\(})
echo “OBJ_NAME is : $OBJ_NAME”

The sharp eye amongst you will notice that this works for FOO( but not for FOO(NANY. If you want to strip everything after the ( and including the ( the you want this:

TEST_END=$(echo "$OBJ_NAME" | grep \()
[ -z "$TEST_END" ] || OBJ_NAME=$(echo “$OBJ_NAME” | awk ‘{split($0,a,”(”);print a[1]}’)
echo “OBJ_NAME is : $OBJ_NAME”

Notice how the grep no longer uses the $ anchor to match a ( at the end of the line? Now if $TEST_END isn’t empty, then we have a ( in our string, so we split on that and return everything to the left (first element in the a[]).

0
August
8

Last night’s Montreal on Rails meetup (their first ever) was a large step up from the Commodore 64 disk swaps of my youth, but probably a lot more significant as far as self improvement goes. A good 30-35 people showed up and the two presentations given were fantastic.

The first presentation topic was improving tests, it was given by Marc Cournoyer and included a hilarious introduction to a somewhat advanced topic. The next presentation was given by Carl Mercier, who introduced the extremely useful HAML, which appears to cut the code in your views by half by generating HTML using a simplified indentation scoped ruby based markup. Very simple and very powerful stuff and I’ll be trying it shortly.

Overall the people who attended the meetup were great and I look forward to the next one. It’s so good to see a vibrant developer scene in Montreal.

2