Fix for running MySQL 5.5.8 under MacOS X 10.6.5 (Snow Leopard)

Oracle recently released the latest MySQL 5.5.x versions. Despite of having tones of fixes and supposedly running much faster and (finally) making InnoDB the default storage engine, it is always good to keep up to date with latest releases.

But, as in the past, MaxOS X users always have to battle with getting it run correctly on their platform of choice. With this release it is no difference. This time, we are hit by permission issues and wrong path settings that prohibits MySQL to start at all and also to make it automatically startup during boot time.

Fixing startup

After installing the preference pane, you should be able to simply click the button to start/stop the MySQL server. Point is that “it should”, but it wont. This is due to a wrong path setting in the startup file. In order to make it work you have to edit a file. Jump into your favorites tool (no, it is not iTunes), but the Terminal application and enter:

nano /usr/local/mysql/support-files/mysql.server

(Nano is a editor in your shell, you can also use “vi” or “emacs”, but I guess “nano” is easy to use)

Then hit “ctrl + W” (for search) and enter “basedir=”, then hit Enter”. This will search for the string entered. Once found, change it to:

basedir=/usr/local/mysql

Once changed, hit “ctrl + W” again and search for “mysqld_pid_file_path=$datadir/`hostname`.pid” and change it to:

mysqld_pid_file_path=$datadir/`/bin/hostname`.pid

After these two changes simply press “ctrl + X” and enter “y” and then enter. This will save the changes you just made and will close the editor.

Fixing Startupitem

During reboot you might have seen the error message:

“Insecure Startup Item disabled. /Library/StartupItems/MySQLCOM has not been started because it does not have the proper security settings.”

This is because the StartUpItem has been installed with the improper permission settings. This can simply be solved with the following commands you have to enter in the terminal:

chown -R root:wheel /Library/StartupItems/MySQLCOM

That’s it. After next reboot the MySQL server will startup as expected and you will also be able to start/stop the server from the preference panel.

Fun with Cron

For some of my Ubuntu Servers (10.04) the Cron jobs did not work or only sporadically executed. I’ve asked around, but none of my friends could explain why this is so. This happened on physical as also on virtual servers. Thus I set out today to finally figure out what caused this. To mention it upfront, I did not find the cause of it, but I got my Cron jobs working again. (and learned a lot along the way)

System Crontab and User Crontab

In the past I always set cron jobs in the /etc/crontab file. This is also the way I’ve used cron in the last couple of years. By switching to Ubuntu server 9.x this worked, but somehow since 10.04 they only worked sporadically. As explained, I don’t know why this is so, but moving those cron jobs into the user (in my case the root account) with “crontab -e” they started working again.

The only difference is that one does not need to pass the user the jobs has to run in with the command, since we edit the user crontab file with “crontab -e”, but everyting else works now as expected.

Getting cron to log

Under Ubuntu logging of any cron action is disabled by default. Since, I wanted to see if my jobs are running and execute successfully I had to enable it. Enabling logging of cron is done in the system default files with:

vim /etc/rsyslog.d/50-default.conf

Uncommenting the ‘#’ before the line that says cron and it will enable logging for cron:

cron.* /var/log/cron.log

and save the file. Now simply reload or restart the rsyslog utility with:

service rsyslog restart

Note: In my case, I had to create the file “/var/log/cron.log” manually in order for cron to write the log.

Enable or preventing cron to send eMails

I guess by default, cron will send eMails on errors or completed actions to the user. In my case, I got a lof of eMails with completed actions and more from cron shortly after. Controlling sending of eMails is done by the global variable ” MAILTO=”" “. One can also direct the output to null for disabling sending of emails.

To disable cron from sending for all jobs:

Add MAILTO=”" to the top of cour crontab file.

To disable sending of eMails for individual jobs:

0 1 5 10 * /path/to/script.sh &> /dev/null

Ubuntu 10.10 and grub menu

I just upgraded one my Ubuntu server from 10.04 to 10.10 (works flawlessly) and realized that I was prompted with the grub menu during a reboot. Since this is a cloud server and it being managed over SSH, I surely wanted that Grub automatically selects the latest kernel and does not wait for an input.

To be honest, I don’t know why this changed (well the only grief with the move from 10.04 to 10.10). Luckily, this is a easy task. All there is to do is to change a value in one of the grub conf files. Edit the file “/etc/grub.d/00_header” and search for “recordfail”. This should bring you to the line;

if [ \${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=${GRUB_TIMEOUT}
fi

Now, all there is to change is the value “-1″. The value 0 will bypass the menu and any greater value is the time of countdown after a unsuccessful boot. (I changed it to 3).

After you saved the change you need to run “sudo update-grub2″ to apply the change. If all goes well, you should boot directly with the configured kernel during next reboot.

Coldfusion and invalid XML character

Today I had a “banging my head to the wall” time where I was confronted with this pesky error:

“An invalid XML character (Unicode: 0×0) was found in the element content of the document.”

Point is that I already created the file in Coldfusion and also used xmlformat for adding the content. So it was “impossible” that there was an error in the content of the XML file. After looking around (yes, Bing or Google is sometimes really your friend) I read that the problem should be some character encoding issue. Since, I already used UTF-8 for writing and reading the file, I thought I had it covered.

Well, to spare you from reading any longer (after all you just came here for the solution ,right?) I figured that I had to escape the control chars before using xmlparse(). In other words, a simple rereplace() was the solution:

“< cfset myxml = REReplace(theXML,'[\x0]','','ALL') >“

A solution to MySQL ERROR 2006 (HY000): MySQL server has gone away

Having just moved quite a large installation to a MySQL database I have encountered the following error when connecting to the MySQL server:

ERROR 2006 (HY000): MySQL server has gone away

After looking at countless solutions and none working (many say that the max_packet value has to be increased), I found a MySQL engineer stating that is has to do with the timeout values which could be 10 or 20 (by default).

Indeed, the problem was solved on our servers with a higher value for interactive_timeout and wait_timeout. You can set these values (and many others) in the my.cnf file.

Where ideas come from

Steve Johnson talks on “Where ideas come from” gives a good overview how people and especially where they get their ideas from. I personally have been a long time fan of creating an environment where one can cultivate ideas instead of working like a horse. He just emphasizes that socializing creates ideas and being together with others brings out the best. Enjoy.

How behavior spreads in social networks

This talk by Nicholas Christakis given at the TED talk in Cannes is a must see for everyone who wants to know how social networks influence our behavior. Especially for marketers or people who want to avoid marketers this is a knowledge to have… This also shows how important and powerful every single person is within the society.

From iPhone to Android – Samsung Galaxy i9000

Ok, so I did it. I went from my truly lovely iPhone (3G) to a Android phone. My choice is the Samsung Galaxy i9000 (some call it GT-9000). So, how is the experience so far?

Actually, I can say nothing else then just good thing about it. The Android OS feels just like…. natural. You realize quickly, that Google has put in a lot of efforts into this system. Actually, they put in a lot of efforts in their latest products (Chrome, Picasa, etc.). In any case, I could get everything running in short time.

If you have a Google (or Google Apps) account then synching and setting up the phone is a breeze. All you have to do is to enter your eMail address and password and your phone pulls all the eMail, Calendar and Contacts from Google. Nothing else to do there. I actually had a funny thing with Contact synching. That is, that one contact wouldn’t sync at all and I also received a lot of “sync has a problem right now” with the Contacts. In the end I removed the contact in question and entered it again. But otherwise, everything runs fine.

You can feel that Android was build for working with Google Apps. eMails come in almost as instantly as on any desktop app. GTalk is integrated also and you get notification going all over the place. One thing that Android has definitely gotten right, are the notification in general. They don’t only work for some applications, but work for about everything. This is especially useful if you are on Twitter (who isn’t? btw: follow me at @thenitai) and someone mentions you or is sending you a message. This works with Seesmic or Hootsuite and any other app. Very nice.

Another thing is the geo location functionality. Google Maps with direction just blows aways about everything you have seen before. Did you ever try to use Directions on the iPhone? The last time in London, I ended up in a total different place. Anyhow, all I’m saying is that Android is really a good system and if they continue like this, they will give everyone a run for their money (yes, Apple I mean you).

Not being a “game” guy, I did not play one game on it yet, but can imagine that the Galaxy screen just screams for it :-) Talking about the screen. WOW. This Super Alomed screen is just marvelous. The phone itself is bigger then the iPhone (3g and 4G) but just a little. Since it is lighter then the iPhone 4G you actually don’t feel a difference at all. Actually, you won’t even notice a big difference between the iPhone and the Samsung, until you start working with it and realize that Android is not just a “Linux” and “Geek” system, but a grown up operating system for the phone. And a fun one as well. Turn on “Live Wallpaper” and you know what I mean…

At the end, I recommend the phone wholeheartedly to everyone who is thinking of switching from the iPhone.

Below are some tips for connecting to MacOS X and setting up the phone with Swisscom.

Mounting the phone in MacOS X

The good thing is that you can simply hook up the phone by USB to the Mac and it starts charging the battery. Of course, there is no iTunes synching or alike, but if you need that you can get “The Missing Sync for Android” application. I haven’t used it but heard good things about it, especially since you can use it over Wi-FI and Bluetooth.

But if you want to simply mount the phone and the HSDC card (if any) then you have to go trough some setting. There are somehow “hidden”, so here they are:

1. Go to “Settings”, then to “About Phone” and click on “USB settings”. Since the default is set to Samsung Kies it will never connect to a Mac. So choose either “mass storage” or “Ask on connection” (my choice).

2. After you have set the above you need enable USB debugging (strange but true or else you can’t connect to the Mac). Go to “Settings” again and choose “Applications”. Then click on “Development” and enable “USB debugging”.

Once you have done the above two steps you can connect your phone per USB to the Mac. The phone and if any SDHC card installed will show up as hard disk drives.

Setup GPRS and MMS for Swisscom network

If you, like me, have not bought the phone from Swisscom directly you have to setup the phone manually to be able to connect to any Internet service on 3G. Swisscom offers a “setup your device” website which will send you a SMS and will automatically configure the phone, but unfortunately the Samsung Galaxy can not be configured this way. Thus we have to do some hand work here.

Go to “Settings”, click on “Wireless and network” and then on “Mobile networks”. Within click on “Access Point Names”. You will probably see a black screen. Thus we will have to add a APN now. Click on the menu key and “New APN” (do it once for GPRS and one time for MMS). Then simply enter all the required paramaters according to the list below:

For GPRS:
Name: Swisscom GPRS
APN: gprs.swisscom.ch
Proxy:
Port:
User name: gprs
Password: gprs
Server:
MMSC:
MMS-Proxy:
MMS-Port:
MCC: 228
MNC: 01
Authentication type:
APN-Typ: Internet + MMS

For GPRS:
Name: Swisscom MMS
APN: event.swisscom.ch
Proxy:
Port:
User name:
Password:
Server:
MMSC: http://mms.natel.ch:8079
MMS-Proxy: 192.168.210.2
MMS-Port: 8080
MCC: 228
MNC: 01
Authentication type:
APN-Typ: MMS

That’s it. Now you should be able to see the “3G” sign in the upper menu bar and will be able to connect to Twitter et all on your mobile network.

Hope this helps anyone. If you have questions or want to know something just leave a comment.

On my way to Linux – Part One

Right, so here is the scope. I’ve been a MacOS X user for many years, not that I have been a fanatic one but I simply used what works best for me. In any case, I own 3 Mac Mini’s and mostly got a new MacBook Pro every year. I also converted quite a lot of people over the Mac. Recently, I’ve even got a iPhone (well, 1 1/2 years ago) after many years of using a BlackBerry. I have to say, the “Apple way” has worked very well for me.

That being said, I have always followed how Linux has been developing, especially on the desktop side (all of our servers run Linux). Actually, with Ubuntu 8, I seriously was thinking of using Linux on the desktop, but back then some application were missing. Later with Ubuntu 9, I took another try, but it still wasn’t ready for me. Now, with Ubuntu 10, the distro is not only very mature, but also, the applications I need are mostly up to date and work well for me.

So, today I set out to see if I will be able to replace my workplace which is based on MacOS X to Linux Ubuntu. My current setup is a MacBook Pro 15″ as my main machine hooked up to a 23″ Cinema screen. I was thinking to replace this setup with a desktop machine and have a netbook (the Asus EeePC 1201PN looks very sweat) as well. Since I still have a older MacMini lying around I set out to get Ubuntu 10 running on it.

Installing Ubuntu on a MacMini

Installing Ubuntu 10 on the MacMini was easy and surprisingly Ubuntu found every bit of hardware, it even found my Bluetooth Logitech Mouse within seconds.WIFI, Ethernet and external hard drives were also found without problems. For those wondering how to install Ubuntu on MacMini all you have to do is to partition your drives with BootCamp, insert the Ubuntu CD and then reboot the Mac (hold down the ALT key). Select the “Window” partition and it will start up from the Ubuntu CD and will start to install it.

So, how is it working with Ubuntu 10?

What can I say, except that the people over at Canonical (the company behind Ubuntu) has fulfilled the promise to bring the best Linux experience to the desktop. I have had no driver problems, could immediately connect to the WIFI network and installing new software even easier then on the Mac.

But we already knew that Ubuntu is good, right? So the real thing for me is to see if I can get my workspace going under Ubuntu. In short, this means that all my applications and workflow will be available and doable with Ubuntu. Thus the rest of this blog post and part two and maybe even part three will be about finding and using the equalivant of of the Linux app to the Mac ones.

I won’t go into the obvious applications that are the same on each operating system like browsers or file explorer systems. The good thing to know is that Firefox and Google Chrome and all their extensions work the same under any operating system. One thing I noted so far, is that Firefox does not seam to have the memory leak problems like the one on the Mac.

Eclipse

I’ve used Eclipse for a long time and recently switched to Coda on the Mac, since Eclipse just eat away all the RAM I had and even crashed many times a day. I’m happy to see that Eclipse under Linux is rock solid and I can use my favorite development environment again.

Mail / Calendar / Contacts / iCal / Address Book

This is a no brainer for me, since I have been using Google Apps for some time and thus my Mail and Calendar already resides in the cloud I can simply continue using my browser without any OS worries. I never used Mail.app (instead used the Browser or Mailplane) and used Spanning Sync for keeping iCal and my Address Book in sync with Google Apps. Since, I don’t like any Mail apps or Calendar under Linux I simply opted to use the browser for Mail, Calendar and Address Book (this will keep it in sync with the iPhone/Android).

Word / Excel / Powerpoint

Right, so much has been said, about using OpenOffice instead of iWork or Microsoft Office. In my testing I have to say that OpenOffice 3.x works fine, but maybe it is just me or does OpenOffice on Linux look like Word 98? Feels like flying back in time… I have to say, that I haven’t tested this part in depth and so I can’t really give any verdict on this.

I have some other apps I need to work with like Aperture, TextExpander, 1Password, etc. and will write on these on the second part.

I hope this helps anyone that is wanting to switch over to Ubuntu. I haven’t made up my mind, if I should switch full time to Ubuntu. At the current state, the MacOS X with its Unix root feels like the grown up Linux, just more polished and with all the apps in the right place.

Please let me know your thoughts in the comment section.