Categories
Computers Linux Mac

Convert Rails 3 project to use jQuery

Rails 3 supports unobtrusive javascript to decouple the content from the logic in a way similar to how CSS has helped web designers to decouple the content from the layout.

By default Rails 3 comes with Prototype. But more and more people are switching to jQuery. The project Rails-3-jQuery on Github simplifies the process of switching out the Prototype support to jQuery. It includes jRails that provides drop-in replacements for Prototype and Scriptaculous helper methods to make it a seamless transition.

To update a project, just issue the following command in the project root

rake rails:template 
   LOCATION=http://github.com/lleger/Rails-3-jQuery/raw/master/jquery.rb

For more information on the project, check the project page on Github.

Categories
Computers Gadgets Mac

Possible uses for the Apple iPad

The genie is out of the bottle. Steve Jobs today presented the brand new Apple iPad and I’m thrilled. The only thing I missed in the presentation was the usual slide: “Available now!”. While I wait patiently I will probably make up all kinds of uses for this device. As if I needed any arguments for getting one.

So what are some possible uses (apart from the obvious ones that was presented by Apple today)? Here is a list to get us started. Please add more suggestions in the comments.

  • Remote control for my living room audio system.
  • Backseat video for my three-year-old when we will do a long-haul drive to France this summer. Here is a market for a device cover manufacturer to step up to the plate.
  • Digital sheet music content holder for piano players. Just scan all the score and add an iPad holder to your piano. Perhaps with voice controlled page flipping.
  • Digital cooking book for the kitchen. Just needs a holder that sticks to the fridge.

Come to think of it I probably need more than one device.

Categories
Computers Linux Mac

Roll your own certificates

I host a bunch of Internet services. Some, like this site, are for public use but most are intended for personal use. And since I want to keep them personal, security is important.

Most Internet applications can be secured by SSL certificates. This includes HTTPS access for web sites, IMAPS instead of IMAP, encrypted access to subversion repositories. The list goes on.

For a number of years I have been creating my own certificates with the help of OpenSSL. Much can be said about OpenSSL but it is not exactly point-and-click. I created a few scripts to assist me but still I found myself looking through the documentation whenever I needed to create a new certificate or renew an existing one.

To solve this I have now created the attached Bash script to wrap OpenSSL to be able to set up a two-level certificate hierarchy. The result is a menu-driven text based application that will no doubt save me time in the future. Perhaps it can help you too.

I use this to create certificates to be used by Apache, Subversion, Postfix, Dovecot, Microsoft IIS, Microsoft Exchange and a few others.

There are some limitations to this. The hierarchy will be two levels deep, not more and not less. In other words you will get a root certificate authority and one or more subordinate certificate authorities. User certificates will be signed by one of the subordinate CAs. Also, while it supports subject alternative names it only does so for DNS names (I only needed that for Exchange 2007 support). For real-world certificate authorities the certificate signing requests (CRSs) are created outside the certificate authority. Since I will be handling everything myself I have set it up so that CSRs are created inside this application. For that reason it is imperative to keep access to the CA folder structure secure so that the private keys are not compromised.

To use this script just download and extract the attached file. Inside the folder which will be created there will be two files. The file ‘ca’ is the Bash script and the other is a template configuration file. Run the script from within the folder. Certificates will be available in the folder ‘all’ and backups of the certificate hierarchy will be placed in the folder ‘backup’. For more help, please comment.

The script has been verified on Ubuntu 9.04 and Mac OS X 10.5. I don’t think there are any dependencies that aren’t already met by standard OS installations.

Download: ca_v1.tar.gz

Categories
Computers Linux Mac

Audio feedback to shell output

The -f switch to the tail command is a great help when it comes to keeping track of what is going on in some log file. But sometimes you just can’t keep your eyes on the output to see if something is happening. At those times it would help to have some other indication that there is activity. The following small Perl script emits a beep whenever there is a line of data being output.

#!/usr/bin/perl
while(<>) 
{
	print "\007" . $_;
}

Just tack the script somewhere in your path. Then, whenever you want some audio feedback just pipe the output to the Perl script (i.e. {some command} | beeper.pl).

Categories
Computers Linux Mac

Unbrick a Netgear WNDR3300

I borrowed a brand new Netgear WNDR3300 from a colleague the other day. I quickly powered it up and accessed the internal configuration web page only to be met by the automatic update function which I hadn’t seen in previous Netgear wireless routers. Before I knew it I had mistakenly aborted the update and the router was more or less dead. The power LED just kept blinking, the router replied to ping but the configuration web page was nowhere to be seen.

I managed to solve the issue by downloading the firmware file from the Netgear site. It is a 3MB file with a .chk file extension.

I then uploaded the firmware using TFTP. The following step-by-step guide is from my Mac but should work on Linux. Start by connecting the wireless router to the computer but don’t power it up. Then open a terminal and type:

tftp 192.168.1.1
binary
rexmt 1
timeout 60
trace
put WNDR3300_V1.0.29_1.0.29NA.chk

Directly after the last line you should then power up the WNDR3300 and wait. Hopefully it will pick up the firmware file from the TFTP client. Once the file has been transferred it will take a few minutes while the router flashes its memory with the new firmware. This is normal. Just wait and hopefully you will have your wireless router back.

Categories
Computers Mac

OS X panics when inserting USB memory

Suddenly my Macbook started crashing whenever I inserted a USB memory stick. Not just crashed – it completely froze.

iousbfamily-crash

The problem report report listed a module called IOUSBFamily and I had a vague idea that I had changed that some time back for something that had to do with my iPhone.

iousbfamily-report

It turns out the solution to the problem was rather simple. Just log onto Apple Developer Connection and search for IOUSBFamily and whatever version of OS X you are running. In my case I searched for “IOUSBFamily 10.5.6”.

Download the Mac OS X USB Debug Kit file for your version of OS X. The .dmg file will include the kernel extension with logging enabled as well as the standard one. Install the one without “log” in the file name. Then restart your computer. The problem should now be solved.

Categories
Computers Mac

Messenger for Mac signing out each night

Every night at precisely 01.00 CET (00.00 GMT) Messenger for Mac signs me out. When this happens a manual intervention is required in order to sign back in. I just can’t figure out why this is happening. The error message is “The system is unavailable now so you have been signed out of Microsoft Messenger”. I am running Microsoft Messenger for Mac version 7.0.1.
messenger-signout
messenger-version

Categories
Computers Mac Music

Saving a clip from YouTube

It’s gearing up to be a very nice spring for all die-hard fans of Depeche Mode. There are clips on YouTube of their next single – Wrong – and it totally rocks!

dm-wrong

So, how to get this onto my iPhone to be able to pass the time until April 20th when their next album “Sounds of the Universe” is to be released?

It turns out it to be quite easy. There are a number of Firefox add-ons that claim to be able to download content from YouTube. I imagine YouTube isn’t too happy about people downloading content and keep trying to shut down options to circumvent it. I found that the add-in “Fast Video Download” did wonders. The add-on adds the icon in the bottom-right corner of Firefox in the screenshot above.

isquint

The output from the add-on is the Flash video file with a .flv extension. This then needs to be converted to avi format. Now there are many applications that claim to do this and they all charge around $30-40. iSquint does a terrific job and it is for free. The applications has actually been discontinued but it is still available for download.

Categories
Computers Linux Mac Windows

Extract image metadata

Over the years I have used many small applications to extract metadata from images but none of them were as versatile as Image-ExifTool by Phil Harvey. It support just about any image or video file format your can imaging. And a nice thing is that it is implemented in Perl so that one can easily use it to build a script. And it works cross-platform which is important for me who move between three operating systems on a daily basis.

This is all it takes to extract all metadata from a file:

Categories
Computers Mac

Cyberduck crash report question

Cyberduck is a great application for FTP/SFTP/WebDAV use on the Mac which I use daily to manage files on various Linux and Windows servers. It also works rather well together with TextMate, my favourite text editor on Mac (or elsewhere for that matter!) although I lack the ability to open a set of files and get them in one TextMate window.

With the latest version of Cyberduck (3.0.3) I received the message “do you want to report the last crash” every time I started the application. There was no option to remove the alert on future application launches.

To remove the warning when the application is started, just remove the files ~Library/Logs/CrashReporter/Cyberduck*.

css.php