Building MySQL-python on OS X 10.5.x (Leopard)

Stock OS X 10.5.4 (Leopard) is devoid of MySQL. Thankfully, binary packages are available from the official MySQL.com website (MySQL 5.0.67, in this case). To use Python with MySQL, not least such when with the MySQL backend, Django is required to run, a Python binding to MySQL need be installed. It is called MySQL-python, and at the time of writing, 1.2.2 is its latest version available. To many a user’s dismay, binary packages of it are not available yet on the official website. To add fuel to fire, causing much frustration, building from source of MySQL-python is best an exercise not suited for those faint of heart.

Two packages, peculiarly to many and aptly to some, named mysql15-dev and mysql15-shlibs, providing development headers and libraries and a bunch of shared libraries all in some manner related to MySQL-5.0.x, are required. With a binary package of MySQL installed already, it makes sense to have binary packages as well of these two installed. This is where the mighty, god-sent fink comes to timely rescue. Luckily, the fink repo has binary packages of the two softwares in question available. Being a dependency of mysql15-dev, mysql15-shlibs is automatically installed with a touch of command such as this:

$ sudo fink --use-binary-dist install mysql15-dev

Building and installing MySQL-python from hereon isn’t any more difficult than running the de facto python package build and install commands. Voila!

Advertisements

MacBook, OS X, some cool softwares, and happy me!

I have always dreamt of having a MacBook one day. Last week was nothing short of a dream coming true (much thanks to you know who you are). I got my first brand-new, shiny spanking white MacBook. It’s got a 2.1-GHz core 2 duo processor. I bumped up the RAM from the standard 1-GB to a whooping 4-GB. The screen is smaller than my Dell, about 13.1 inches. The entire laptop, in fact, is much smaller than the Dell. But doubtless it is nothing short of being a beauty. It is running the latest iteration of Mac OS X, Leopard, 10.5.5.

I wanted to mention some of the softwares I have downloaded and/or installed separately. Some of them are what I believe those that any first-time Mac user would want to have on their Mac. Do note that I’ve never earnestly used a Mac before, which pretty much makes me a first-time user.

IM

  • Adium Adium is a multi-protocol IM software for Mac. Being multi-protocol, it supports a two dozen different protocols. I use it mostly for MSN, Yahoo, and GTalk. The interface resembles very much, if you have used it, Pidgin. It is stable, and works very reliably.
  • Mac Messenger There is also a free port of MSN Messenger available on Mac called the Mac Messenger. It isn’t exactly like the Windows counterpart in terms of UI and features, but for those of you who want a similar experience, it is the best thing that comes the closest.
  • X-Chat Aqua Yes. That is X-Chat on Mac. It is an awesome IRC client for Mac. I have used it on Windows and Linux before.
  • Skype You know what Skype is. Best for voice and video chat on Mac with all your friends who don’t own a Mac–those who do, I would highly recommend the built-in Mac application iChat. Excellent stuff.
  • Colloquy This is an advanced IRC client for Mac that supports both IRC and SILC (if you’ve ever used that before).

Office Productivity

  • OpenOffice.org for Mac I needn’t say anything. It is great.
  • Microsoft Office for Mac There is also the famous Microsoft Office for Mac, but, you guessed it, it isn’t free of cost.
  • FreeMind An excellent Java-based mind mapping tool. Great for brain-storming and generally anything that requires you to create mind maps.

Browser

  • Firefox How can I not mention that? Safari, Apple’s premier browser, is great, but Firefox is greater.

Package Management
If you are migrating from a Linux background, as I am, you will find the following two tools indispensable. They are the equivalents of tools you might be in love with on Linux, such as, ‘apt-get’, ‘yum’, etc.

Development

  • XCode and Mac Dev Tools XCode is Apple’s development environment on Mac. Not merely an IDE, it constitutes the entire development tool chain, including gcc, gdb, make, etc, along with the Cocoa and Carbon frameworks and tools for development in Objective-C. Even if you don’t require the IDE or the frameworks, you may still need the development tool chain, if you ever plan to build software from source (not least your favourite open source softwares).
  • iPython If you hack often on the Python shell, it goes without saying that you MUST get iPython. You will never look back. It is an excellent wrapper over the bare Python shell, providing countless convenience features and lots of colourful eye-candy.
  • pysqlite Mac comes with the SQLite DB and client pre-installed. For the Python SQLite binding, you have to compile and install pysqlite from scratch. There may also be binary packages available.

SCM

  • Git If you want to move onto a feature-rich, robust and reliable distributed source code management system, do give Git a go.
  • Subversion (SVN) SVN comes pre-installed with Mac. For a non-distributed SCM, I’d pick SVN any day.

Right, that’s all for now. I’ll be droning on about everything Mac quite often now.

On someone’s requests, I made a five minutes un-boxing video of my Mac. I have it available in private on youtube. If you’d like to take a peek at it, please email me your YouTube account ID at ayaz -at- ayaz.pk and I’ll send you the link.

Symbian: Changing language of Symbian Emulator

The biggest hurdle in writing mobile applications for Asian markets, in particular, is providing multi-lingual support. From hunting down people for translations to acquiring phones that actually support a big, diverse set of languages in common use in Asian countries, it is an all-round big challenge for mobile application developers. It is almost frustrating to the point of throwing in the towel, but if you want to tap into the markets, making headway, especially since Asian markets tend to be more competitive than any others, you have to persist and expend serious effort. There is also no question of demonstrating your product in English to potential customers in Asian markets — they would always want the product translated into whichever language they speak and read, and if you do give a demo of the English version of your product, by the time you have a localised version ready to market and sell, some smart aleck would already have bootlegged your idea, developed a localised version and sold it. That alone is a troublesome drawback when marketing your products to Asian markets. Therefore, as a rule of thumb when diving into Asian markets: Have a localised version of your product ready and fully tested before going in.

I am falling off on a tangent. I wanted to talk about multi-lingual support on the Symbian emulator. The symbian emulator by default is in English. For testing and debugging a multi-lingual application, you would naturally want the emulator to be converted into whichever language you are testing your application on. Once inside the emulator, you will find that there is support to change the writing language to any from a large set of languages available. However, if you do that, you would notice that the emulator crashes with a panic. This happened when I tried to switch writing language to Chinese. I cannot say if the panic is reproducible for other languages as well.

Even if you can change the writing language to any language that works well on the emulator, it isn’t sufficient. In order to test multi-lingual applications, you have to convert the emulator to look and work exactly how a mobile phone would for someone who can only understand, say, Chinese. How do you do that? If you look under Program Files > S60 Developer Tools > 3rd Edition SDK > 1.1 MR > Languages, you will see few links to languages to which you can switch the emulator. Unfortunately, clicking on any does nothing. It is possible the options are fixed in recent releases of the SDK. But if they are broken on yours, here is a way to change the language of the emulator.

You must have javaw.exe in your system PATH. If not, you will have to explicitly give out the complete absolute path to the javaw.exe binary. On the windows command shell, jump to the \Epoch32\tools\ecmt\ directory (which can be found inside where ever you’ve installed the SDK on your system), and run the following command:


C:\Symbian\9.1\S60_3rd_MR\Epoc32\tools\ecmt>javaw -classpath unzip.jar;plugins/general.jar;lib/log4j-1.2.8.jar -Dsource=language -Ddestination=..\..\.. -Dlanguage=en_us -Dplatform=winscw com.nokia.epdt.zip.ZipManager

C:\Symbian\91.\S60_3rd_MR\ is where I have the Symbian SDK installed on my system. I also have javaw in my PATH, thus eliminating the need to put down the absolute path to the binary.

Pay close attention to the -Dlanguage=en_us argument. This is the value you have to change to suit your requirement. If, for example, you have to switch the emulator to Chinese language, you will have to change “en_us” to “zh_cn“.

Look inside the \Epoch32\tools\ecmt\language for information on which language packs come with the SDK by default.

Always remember to change the language back to English after you are done with testing your localised application.

Before I close this off, I would like to give credit to this post on Nokia Developer Forums from where I picked this solution.