Learnosity Logo
Learnosity Banner Image

Loading MySQL timezone info on Linux and Macs

MySQL has some really useful functions that make timezone support a bit easier as described in a previous blog post..

However, you need to do a tiny bit of setup work before you can use the functions. You need to load the timezone info from your system into the mysql db.

Thankfully, the MySQL Developers have included a very handy script that will do just that from a zoneinfo files which are used on Linux and on Mac's.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

Obviously change the mysql params or add a -p if you have a password or are connecting to a remote server.

Check out the MySQL developer site for full details on MySQL timezone support

Cheers, Mark

Convert Mac Line endings to Linux

I was cleaning up some source code yesterday and wanted to print it all out, however the Mac line endings (we use Mac's and Ubuntu mostly) were messing up the printout on my Ubuntu machine.

A quick google later and I found the solution, a program called 'tr', posting here for next time:

tr "\r" "\n" < filewithmaclineendings.txt > filewithunixlineendings.txt

Obviously you could convert from Unix to Mac by reversing it.

tr "\n" "\r" < filewithunixlineendings.txt > filewithmaclineendings.txt

Cheers, Mark

DVD to iPod conversion - Linux, Mac & Windows

I've been looking for a while for a way to convert DVD's and other movies that I have into iPod format and have been failing miserably. That is until today, when I came across the unusually named HandBrake.

It does exactly what is says on the tin and makes it very easy to copy dvd's. Initially I used it from my Mac and it worked flawlessly.

I also tried the Linux version on Ubuntu Hardy (8.04) which has no GUI but it is pretty simple when you get the hang of it.

Here's a typical command line:

HandBrakeCLI --preset="iPod Low-Rez" -i /media/cdrom -o myvideo.mp4 -t 2

This reads from /dev/cdrom and uses the handy "iPod Low-Rez" preset which fixes it all up nicely for the iPod.

And here's one that takes the second title:

HandBrakeCLI --preset="iPod Low-Rez" -i /media/cdrom -o myvideo.mp4 -t 2

The wiki has more information on command line usage.

Happy iPodding.

Cheers, Mark

Gmail, Docs, Calendar and Analytics standalone with Prism

I came across Mozilla Prism the other day and while I'm still deciding if it's going to be a permanent addition to my machine so far so good.

Screenshot of Prism Gmail Prism is a cut down version of Mozilla which is designed to run single sites from icon - what's the use of that you may ask? Well it allows you to have an icon on your desktop for Gmail or Google Calendar or docs or analytics and get to it nice and quickly.

It also free's up some much needed screen real-estate as all the other toolbars relevant for a web-developers browser can get in the way and are not used when you are using you email and calendar.

Additionally - as web developer I tend to restart firefox more often than some - and having my email seperated from that is nice.

Give it a try and see if you like it. On Ubuntu Hardy you can do the following to install it:

#install calendar
sudo apt-get install prism-google-calendar
#install google docs
sudo apt-get install prism-google-docs
#install gmail
sudo apt-get install prism-google-mail
#install analytics
sudo apt-get install prism-google-analytics

On other platforms (windows,mac or other linux versions) you can go to the Prism site and download it.

For the different applications check out the Bundles section or the User contributed bundles section.

Obviously this shares a lot of similarities with the adobe AIR platform albeit not as full featured. It will be interesting to see what further development plans there are for the prism platform.

Cheers, Mark

Pretty network diagrams and flow charts with Open Source software.

I had been using Dia for all my charts and diagrams, and it does a very good job. The only downside is that it doesn't produce very pretty charts of the like of Omnigraffle.

However, inspired by this article, I'm starting to use a new solution, Inkscape, that fulfills my criteria that works on Linux, Mac and Windows.

Dia Omnigraffle Inkscape
Can create pretty pictures No Yes Yes
Cross Platform (Linux, Mac, Windows) Yes No - Mac only Yes
Open Source Yes No Yes
Open file format (to work with version control) No - Binary No - Binary Yes - SVG
Export to PNG Yes Yes Yes

Now you may argue that Inkscape is not a diagraming tool but a generic drawing tool. This is true, but with the addition of a few templates of pre-drawn items it become a very good diagramming tool.

I've created a few simple flow chart elements which I use and also scoured the net for some SVG icons for network based diagrams which were sourced from Gnome (via Ubuntu) and from Quantum Bits.

Templates Previews

Flow chart diagram preview

Computing devices preview

Download

Download the svg templates (right click - Save As):

Give it a try - it's very easy.

OS X Leopard and Ubuntu Screen sharing - HOWTO

I just go a nice shiny new Mac Mini today to use as a testing machine.

To make my life easy I want to be able to connect to it remotely from my Ubuntu (Gutsy 7.10) laptop. Luckily with Leopard's new screen sharing and a bit of googling it's easy to connect both ways.

Ubuntu to OS X

The Apple screen sharing uses a version of VNC - but the default VNC client on Ubuntu won't work with it - however thanks to this post I discovered the xtightvncviewer will work.

You need to configure your Mac to allow it with the following settings:

  • Open "System Preferences"
  • Select "Sharing"
  • Ensure "Screen Sharing" is on
  • Select "Computer Settings" on the Screen sharing page
  • Tick both boxes - "Anyone my request..." and "VNC viewers may control..." and add a password.

Note the address of your machine also - eg: vnc://192.168.0.55 or similar

Then over to the ubuntu machine and install xtightvncviewer:

$ sudo apt-get install xtightvncviewer

Then connect to the machine with: (change the ip address as relevant)

$ xtightvncviewer 192.168.0.55
You will then get a prompt - enter the password and you should be good to go.

OS X to Ubuntu

Once I had that working I was keen to see if I could get it working the other way:

You need to enable remote desktop sharing in Ubuntu:

  • Select "System->Preferences->Remote Desktop" from the menu
  • Tick the following boxes: "Allow others to view...", "Allow others to control...", and "Require ... password" and enter a password.

Then open up safari and type in the the address of you Ubuntu machine with vnc:// in front of it. eg:

It will give a warning about the vnc server not supporting "Keystroke encryption" but it will work (albeit not as securely as a Mac to Mac connection) - but good enough for your local network.

That's it - I did notice that it also showed up in Finder->Shared which I presume it found via Avahi/Bonjour - which is nice.

Hope it helps. Cheers, Mark