Official ObjectGraph Blog

Archive for the ‘compile’ Category

Compiling Objective-C using only Command Line

Friday, April 11th, 2008

My newest love is TextMate, the ultimate Mac OSX text editor. I am so used to having TextPad on Windows that i felt lost with out a good  editor. I used vi for a while, but it felt awkward after sometime.  As you know from my previous blog posts, I am learning Objective-C to program the iPhone. I am using textmate now to program simple console based Objective C programs. So if you want to compile them using command line use the following

gcc sample.m  -o sample -L /System/Library/Frameworks/Foundation.framework/Foundation

 

Installing Python 2.4.4 on Cent OS 4.4 (Final)

Thursday, January 4th, 2007

We at ObjectGraph are moving to a dedicated hosting solution. The server is hosted in NY. It has Cent OS 4.4 (Based on RHEL 4).

It comes installed with Python 2.3.4. A lot of packages (like yum) depend on this version of python in the system.

So when i found out that some of the syntax like ‘@staticfunction’ we were using to develop in django is not compatible with python 2.3.4, I was distraught. I decided i need to upgrade python.

Here is a simple test program that fails in the older version of Python.


class Test:
        def __init__(self):
                print "Hello World!"
        def sum(self,a,b):
                return a+b

        @staticmethod
        def sum1(a,b):
                return a+b
t=Test()
print t.sum(10,10)
print t.sum1(10,10)

After a lot of struggle to find a binary package of Python 2.4.4 for Cent OS, I gave up and compiled python from source.

It was pretty straightforward and i am happy with the results. This is what i did.

#wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tgz
#tar xvfz *.tgz
#cd Python-2.4.4
#./configure
#make
#make install

Just run python to see if it is the version 2.4.4

Now python is cleanly installed. The site-packages folder under /usr/local/lib/python2.4 are empty. So get the latest version of django and install it


#svn co http://code.djangoproject.com/svn/django/trunk/ django
#cd django
#python setup.py install

Similary you can install MySQLdb and other libraries you want on python.
Now the next steps for us is to get django running on Apache using mod_python