Categories
Code Sample Geek How-To Technology

How to build and install the Metakit DB for Python on MacOSX

Ever since I used it years ago on a geek-project for my Zaurus, the Metakit DB has always been a favorite of mine. I had the chance to use it again on another personal project and this time on MacOSX. Unfortunately, the prebuilt binaries on the Metakit site are for older versions of MacOSX, so I had to build it myself.

Normally one would simply follow the “Metakit installation instructions”:http://www.equi4.com/pub/mk/, but they are old and didn’t work correctly with 10.5 Leopard. I scraped enough information together from the Internet to get it working, but I had to do a lot of research. To save others the same hassle, I have put together all of the changes and put them here in their entirety:

Building Metakit

Make sure you have Xcode installed on your system before starting.

Get the latest source from the “Metakit downloads page”:http://www.equi4.com/pub/mk/. At this time the latest version is @metakit-2.4.9.7.tar.gz@.

Uncompress the archive in a work directory and run the following commands:

> cd builds
> ../unix/configure --with-python=/System/Library/Frameworks/Python.framework/Versions/2.5

Note: Your Python install might be in a different location. If so, give the @–with-python@ arg the proper value.

“Fat” binary setup

If you need this to run on the PPC architecture you will need to make a couple of modifications to @./builds/Makefile@ after running @configure@, otherwise you can skip this step and build the binaries with @make@.

Find @CXXFLAGS = $(CXX_FLAGS)@ and change to the following:

CXXFLAGS = $(CXX_FLAGS) -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk

Find @SHLIB_LD = g++ -dynamiclib -flat_namespace -undefined suppress@ and change to the following:

SHLIB_LD = g++ -dynamiclib -flat_namespace -undefined suppress -arch ppc -arch i386

Build the binaries

Run your typical @Makefile@ commands:

> make
> make test

Installing Metakit

Rename the shared library which is now in the @./builds@ directory:

> mv Mk4py.dylib Mk4py.so

And copy the following files to @/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python@ (be sure to adjust the path name for your version of Python):

../python/metakit.py
./Mk4py.so

Testing Metakit

At this point you should have a working system and ought to be able to run the following command in a Python shell without issue:

>>>from metakit import *

Enjoy !

h3. Resources

  • “Metakit for Python website”:http://www.equi4.com/metakit/python.html

  • “helpful instructions from www.ospace.net”:http://www.ospace.net/wiki/index.php/ServerHowTo

Categories
Flex Programming

Trying to do MVC in pure Flex

I was looking for some examples of how to structure a Flex application using MVC, but using only the Flex framework. In the long run I think I’ll be using PureMVC, but right now I am anxious to get my app working and don’t want to have to learn Yet Another Technology just to get there. Besides, shouldn’t Flex be able to stand on its own?

I found what I was looking for in the article _”An architectural blueprint for Flex applications”_ written by Joe Berkovitz. In it he talks about a way in which he architects Flex applications using pure Flex/Actionscript constructs.

Being a Flex newbie, I learned a lot from his article like how to pass variables to your own MXML tags and even customize them using Actionscript. His architecture also solves an issue I was having with Event messaging/bubbling due to the fact that it only works automatically on DisplayObject components. His design also has an interesting way of handling multiple data-services as well as the operations required for handling service communication.

Source code for the project is available in the article. I would recommended downloading it and browsing through the files.

Resources: