Mountain Lion Server MySQL Install Weirdness

I’ve been using mySQL on Macs since I was running debian linux on a Quadra 700 in the late nineties. So you can say that I’ve had to deal with every curve that Apple throws at us with respect to web services. After debian, I ran darwin until Apple released Mac OX Beta in 1999.

The latest challenge was while upgrading my Intel Nahalan Xserve to Mountain Lion Server, 10.8.2. Lo and behold there is no mysql installed. So gleefully I went over the to get the latest installer dmg ( Once I tried to run “mysql” on the command line to test, I kept getting the age old “Cannot connect to /var/mysql/mysql.sock” error. No biggie, just check that the file is there or create a symbolic link to /tmp/mysql.sock…

However no matter what I tried, I kept getting the error… so I needed to dig deeper. Some sage user suggested checking the error log inside /var/mysql/data – by looking for a file matching your hostname and ending with .err . So I set up a tail and ran the mysql startUpItem script by hand and watched the log. (/Library/StartupItems.MySQLCOM/MySQLCOM start). Sure enough it would start and then immediately abort and shutdown.

Turns out the mySQL configuration file was wrong (/etc/my.cnf). I’m not sure where mine came from, possibly an older installer. You may not run into this problem, since Lion and Mountain Lion don’t come with mySQL installed. So the error I saw first was “unknown option skip-locking”. I commented that out (backing up the my.cnf before starting) and ran the start command again. I also had to comment out “table_cache=512” and “skip-thread-priority”. Afterwards mysql started up like it should. So I’m putting this out there, in case it helps the next poor sap.


Apple’s own Objective-C overtakes C++ in programing language race

Recently reported in TIOBE’s software index, Apple’s own language for creating Mac OS X and iOS (iPhone and iPad) apps has surpassed C++ as most popular object-oriented language. This is due to the success of Apple’s iOS platform and the halo effect on Macs in general.

For some time we’ve been telling the community at large that we are only seeing the tip of the ice burg when it comes to developing for Macs an iOS. It’s great to have confirmation.

Read more here:

Fix – ITC “No eligible applications were found.”

It took a bit of digging to find the fix for this. I regularly upload applications for different companies to iTunesConnect. Imagine my surprise when I could upload an app to my own account. I found lots of threads helping Windows users but none for Macs.

The solution, on Mac OS X, can be done one of two ways. You can delete the .plist files in ~/Library/Preferences/ and/or
I’m not sure which one applies but it forces Application Loader to run the “Set Up Wizard…” again (“Set Up Wizard…” can also be run from the Window menu.)

After which you will be prompted to log in with the correct Apple ID again.

Publishing on the iPad

The App we built for 2

So here we are more than halfway through the year and over 5 million iPads sold. Consumers are rapidly snatching up all the available iPad and iPhone 4.0 devices as fast as Apple can make them. As a publishing professional you’re asking yourself what does this mean to me? What impact does this have on the publishing industry and how do we as publishers get involved?

Released to the public in April 2010, the iPad platform (aka iOS 4) has taken digital publishing by storm. If you have used an iPad then you already know that it is more than a big iPhone, digital book, Internet browser, or device for accessing digital media. If you’ve been following my articles you’d know that this is a revolutionary device and it’s causing a paradigm shift in several information industries.

Users of the iPad are looking to you as publishers to deliver content they desire in this new medium. Of course this is not just limited to Apple products but it is also pending the release of new digital devices and smart phones by other companies – who are scrambling to catch up with the release of their smart phone technologies and tablet devices. So how do you get your content into your reader’s hands?

Smart media devices all support Internet-based browser technologies and can access content online that is tailored to these devices with technologies such as HTML 5, CSS three, JavaScript. Simply adding a bit of tagging and creating custom style sheets for your website will transform content for these mobile devices. Open source publishing platforms such as WordPress and Joomla can use templates designed to optimize the display of the content.

AppleScript, Automator, and MacOS X Services can also be used to automate and build web ready content. Using Apple’s free development tools a competent web developer could build a web-based applications with a Dashcode. DashCode apps can then be converted into xCode – the application that is used to create native MacOS X and and iOS applications for the iPhone and iPad.
Apple has created its own digital reader for the iOS devices called iBooks. The iBooks Store is used to publish digital books in the ePub format. Applications like InDesign can export pages into this format. You can distribute your iBook publications from your own website or distribute for profit through Apple’s iBook store. Resources like available to help you self publish.

Starting at $99 a year, you can become an Apple developer and be able to publish applications to actual devices like the IPad. Once you become a registered developer and pay the fees you can submit applications for approval to Apple’s App Store. If Apple approves your iPhone app, they will distribute the application through the App Store.

Native iOS apps are written using Objective-C. There are many resources available to get you up to speed. Several books have been published in physical and digital form that teach users to build apps. Online resources available such as and Apple’s developer website offer learning materials online.

If you’re not already an experienced programmer learning Objective-C has a steep learning curve. The TapLynx framework, among others, help build basic apps in xCode. Frameworks will help you build real iOS applications without having to learn Objective-C.

You can also look into hiring a developer to help you build a app. Simple applications range from $2500 to $10,000. More sophisticated apps take many months to develop and will cost even more. Experienced developers can be hired for between $80 US and $160 US to either consult or develop your application. Single dedicated developer can cost a around $6500 US per month.

It is both an exciting time and a nerve-racking time. Publishing on ink on paper has been under pressure for last 15 years or so. The Internet has eroded any kind of profit-making and now the iPad presents an opportunity to deliver content to an end user who will be willing to pay for that content. Or at the very least advertisers will want the opportunity deliver their message along with your content. If you’re producing a magazine, newspaper, the list of services or even a real estate listing the iPad is proving to be a revolutionary publishing platform. You owe it to yourself to explore the opportunity for yourself and your clients.

Snow Leopard 10.6 Juniper Network Connect VPN

Here’e the fix:

Go to backup copy of OS. (you did make a backup copy before you upgraded!?!)

cd /Volumes/[backup]/usr/local/

sudo tar cvf juniper.tar juniper

sudo mv juniper.tar /usr/local/

cd /usr/local/

sudo tar xvf junpier.tar

sudo chmod 755 /usr/local/juniper/nc/[version number/
— this was not necessary for me (tar maintains permissions)

sudo mkdir /Applications/Network
— this makes no sense since “Frameworks” is not required on 10.4 or 10.5

Start FTP as service in Leopard

Apple has removed the FTP management functions in Leopard’s System Preferences. However it is still possible to run FTP on your Mac under 10.5.

To start the FTP service in the Terminal type:
sudo /sbin/service ftp start

To stop it type:
sudo /sbin/service ftp stop


Duh! It looks like Apple moved the “FTP” and “Windows” under Options in the Sharing Preference in System Preferences. Oops!

Set up fckeditor with Safari 3

Note this article is a couple of years old… I’ve given up on the folks who make fckeditor. We use Firefox now. (Jan 5, 2011)

1. Set the “this.EnableSafari = true ;” in “fckeditor.js”

2. Open the file “fckeditor_php5.php”
Then look for the function called “IsCompatible”
Add a new boolean “else if ( strpos($sAgent, ‘KHTML’) !== false )”
and add:
“$iVersion = (int)substr($sAgent, (72 + 27), 5) ;
return ($iVersion >= 3) ;”

3. Enjoy.

Here’s the function below…

function IsCompatible()

if ( isset( $HTTP_USER_AGENT ) )
$sAgent = $HTTP_USER_AGENT ;

if ( strpos($sAgent, ‘MSIE’) !== false && strpos($sAgent, ‘mac’) === false && strpos($sAgent, ‘Opera’) === false )
$iVersion = (float)substr($sAgent, strpos($sAgent, ‘MSIE’) + 5, 3) ;
return ($iVersion >= 5.5) ;
else if ( strpos($sAgent, ‘Gecko/’) !== false )
$iVersion = (int)substr($sAgent, strpos($sAgent, ‘Gecko/’) + 6, 8 ) ;
return ($iVersion >= 20030210) ;
else if ( strpos($sAgent, ‘KHTML’) !== false )
$iVersion = (int)substr($sAgent, (72 + 27), 5) ;
return ($iVersion >= 3) ;
return false ;

NB for Safari 3.1 the line should be:
$iVersion = (int)substr($sAgent, (72 + 32), 3) ;
This line reads the HTTP_USER_AGENT and reads the version number as an integer.

Allow register_globals ON and short_open_tag on virtual sites

It is good practice to leave the default options for Register_Globals and short_open_tags as ‘OFF’ – for security reasons. However you may be hosting a site that wants to use code written by LAZY coders. (if you’re coding you shouldn’t be using sloppy super globals or short tags – don’t be so frakin lazy).

If you do need to host some sloppy PHP then you can set these options to ON in an .htaccess file.

First set the directive in the sites config in the tag to “AllowOverride” (and gracefully restart apache).

Second create an “.htaccess” file at the root directory of the virtual site and enter:
php_flag register_globals ON
php_flag short_open_tag ON

When apache reloads it will check every directory here for an .htaccess file and follow the directions. (you don’t need to reload if you reloaded when you added the AllowOverride)

Authenticating changes with MySQL 4

If you get the error “Client does not support authentication protocol” it is because of a change in MySQL 4+’s password hashing…

here’s a function I wrote to determine the password’s length:

function password_length ($pass_field, $table, $field, $field_data) {
// figure out the length of the password (old is 16)
$sql = “SELECT “.$pass_field.” FROM “.$table.” WHERE “.$field.” = ‘”.$field_data.”‘”;
$result = mysql_query($sql);
list ($password) = mysql_fetch_array($result);
return strlen($password);

if the password length is 16 chars then you’ll need to add “old_password()” to log in:

function check_login ($email, $password) {

$password_length = (password_length(“password”, “users”, “email”, $email));

if ($password_length >= 17) {
$sql = “SELECT email, password, firstName, lastName, active, USER_ID FROM users WHERE email = ‘$email’ AND password = password(‘$password’)”;
//echo $sql;
$result = mysql_query($sql);
list($email, $password, $firstName, $lastName, $active, $user_id) = mysql_fetch_array($result);
} else {
$sql = “SELECT email, password, firstName, lastName, active, USER_ID FROM users WHERE email = ‘$email’ AND password = old_password(‘$password’)”;
$result = mysql_query($sql);
list($email, $password, $firstName, $lastName, $active, $user_id) = mysql_fetch_array($result);
$user[email]= $email;
$user[password] = $password;
$user[firstName] = $firstName;
$user[lastName] = $lastName;
$user[active] = $active;
$user[user_id] = $user_id;
return $user;

Here I stick the resulting user info into an array called “user”…