Wednesday, September 17, 2008

Launching OSX apps from the command-line

Use the following to open apps from the command line in osX:

open /path/to/

Mac OS X wget alternative

WGet is not a native part of OSX; try curl instead.

Wednesday, May 21, 2008

Configuring MySQL for Network access

The typical default install of MySQL server only permits connections from localhost (; this is presumably for reasons of security. While this is certainly secure, in some cases it is undesirable. This post explains how to permit network access to a MySQL server from remote clients.

Locate the my.cnf file, which is the master configuration file for MySQL server. (On a Ubuntu system this file may be located in /etc/mysql.)

Open this file in your favorite editor and look for the following entry:

bind-address =

This limits the MySQL server to listening to connections on the localhost address, as explained earlier.

To instead make the MySQL server listen on all interfaces, edit this entry to the following:

bind-address =

Save the file, then restart the MySQL server:

sudo /etc/init.d/mysql restart

Your MySQL server should now be network accessible. To verify that it's listening on all interfaces, issue the following command:

netstat -anp | grep 3306

If you see the following, then your configuration is complete:

tcp        0      0  *               LISTEN     -

You'll want to be certain your database users are permitted to connect via the network. This I'll leave to you to work out, though I will recommend the MySQL Admin tool.

(Conversely this tool can also be used to enable networking of MySQL, though this setting is somewhat buried within the myriad of options, and is more easily accomplished via the method described above.)

Tuesday, May 20, 2008

Macros and Variable Arguments in VisualStudio 2003

The preprocessor in Microsoft VisualStudio 2003 (VC++ 7.1) does not support variable argument lists in macros; instead it spews syntax errors when compiling. However, there is a way to get around this limitation and indeed gain this ability.

In a project I'm working on, we use macros to construct portions of our logging system. A typical declaration looks as such:

#define LOG_TRACE(...) log_routine(__FILE__, __LINE__, __VA_ARGS__)

However this fails to compile on VisualStudio.Net 2003, because as stated before, its preprocessor does not support variable argument lists.

A workaround is to instead use a class to handle the semantics of the variable argument list; observe:

class tracing_output_va
const char* m_file;
int m_line;

const char* p_File,
const int p_Line) :
m_file( p_File ),
m_line( p_Line )


void operator()( const char* p_Format, ... )
va_list marker ;
va_start( marker, p_Format ) ;
marker ) ;

va_end( marker );


And then redefine the macro as such:

#define LOG_TRACE_APPLIB (tracing_output_va(__FILE__, __LINE__) )

This will indeed compile and perform as expected in VC++ 7.1

The elegance to this solution is that one need only modify the declaration of this macro, and that existing calls to this macro need not change.

For what it's worth the routine LoggingOutVa( ) wraps the actual magic of formatting and file output.


Thursday, May 15, 2008

VMWare Fusion -- No Hard Links in Shared Folders

VMWare Fusion allows one to use folders on the OSX filesystem from within the guest OS via Shared Folders.

This is useful if you need to access files from both the host OS (OSX) or the guest OS running in VMWare Fusion.

However I have found limitations with this arrangement when the guest OS is a Linux-based system -- it seems that VMWare's driver for Shared Folders does not support all of the linux filesystem operations (most specifically hard links).

Observe (/mnt/hgfs/wa points to a shared folder residing on the OSX filesystem) :

clermontr@synergy:/mnt/hgfs/wa/test$ touch tree
clermontr@synergy:/mnt/hgfs/wa/test$ ln tree shrub
ln: creating hard link `shrub' to `tree': Operation not permitted

Operation not permitted?! How about symbolic links:

clermontr@synergy:/mnt/hgfs/wa/test$ ln -s tree shrub
clermontr@synergy:/mnt/hgfs/wa/test$ ll
total 1
lrwxr-xr-x 1 clermontr ccm_root 4 2008-05-15 14:17 shrub -> tree
-rw-r--r-- 1 clermontr ccm_root 0 2008-05-15 14:16 tree

Well it looks like symbolic links are permitted, but no chance for hard links. For what it's worth I also attempted to hard-link as sudo but to no avail.

Switching to the OSX filesystem I was able to create hard-links without issue. So then it would appear that this is indeed a limitation of the VMWare Fusion Shared Folders driver (vmhgfs).

I am interested in hearing if others have experienced this issue, and also if anyone has found a workaround.

Friday, March 14, 2008

Compiling MySQL 5 in Ubuntu

If when compiling MySQL5 you get an error similar to the following:

sed: can't read No such file or directory
make[2]: *** [] Error 2

Then you're probably missing the bison package.

To remedy, first install bison:

sudo apt-get install bison

Then start the mysql build again with a fresh start:

make distclean; ./configure; make

Your troubles should be over.

Tuesday, January 29, 2008

Using a Ubuntu VNC client to connect to a Leopard Remote Desktop

This post explains how to connect to a Leopard Remote Desktop session from a Ubuntu client machine using VNC. It is assumed that Remote Desktop is enabled on their Mac (you should also read this regarding a password on your Leopard Remote Desktop server).

The Leopard Remote Desktop speaks a flavor of vnc, albeit one which common vnc clients seem to have difficulty with. I tried both Ubuntu's default vnc client in addition to a realVNC client, both without success. However I did find that the tightvncviewer successfully connects.

To get xtightvncviewer, install this package:

sudo apt-get install xtightvncviewer

When you want to initiate a Leopard Remote Desktop session, open a terminal and start up xtightvncviewer:

xtightvncviewer ip.of.your.mac

You should be prompted with your password (you did set a password on your Leopard Remote Desktop, correct?), and following that you should then see the desktop of your Mac in the vnc window.

Friday, January 11, 2008

Quicktime video in Firefox on Ubuntu

Quicktime doesn't seem to work by default in Firefox on Ubuntu.

To get it working, you'll need to check/install plugins which Firefox uses to play video.

First, remove any other firefox plugins related to video; on my system these included:

sudo apt-get remove mozilla-mplayer
sudo apt-get remove mozilla-plugin-vlc
(I had previously installed these in attempts to get Quicktime working.)

Next install an additional plugin for gstreamer:

sudo apt-get install gstreamer0.10-gl

Now point your browser to some quicktime content ( and enjoy.

Note: I was previously using the mozilla-mplayer package with some success, though Firefox would periodically crash for some unknown reason when viewing Quicktime content .