Archive for the Mac Category

Tethering Nokia N73 with Macbook Pro

Posted in How-To, Mac with tags , , , , on August 18, 2009 by rubayeet

Tethering

Tethering your laptop with an EDGE enabled cellphone is an ideal solution for “Internet on the go” problem.

I have a Nokia N73 which  I wished to connect via Bluetooth with my Macbook Pro running on OS X 10.5.7. Unfortunately, it wasn’t a walk in the park as I expected everything with Mac to be. After spending quite some time searching on Google and with the help of some very useful resources(which I’ve listed at the end of this post). I was finally able to browse the Net on the macbook through the phone. I’ll outline the process below

1. Download the Modem Scripts

Although OS X ships with modem scripts for Nokia phones, they don’t work for all the models. Ross Barkman to the rescue! His website contains customized modem scripts for a large array of cellphone brands and models. N73 is 3G enabled so you’ll need Nokia 3G scripts. Download the zip file and extract it, copy the scripts(Nokia 3G CID 1, 2 and 3) and paste them inside [RootDrive]/Library/Modem Scripts folder.

2. Pair the phone with the Macbook

This step is pretty easy to follow. Click on the Bluetooth icon on the Menu bar(go to System Preferences > Bluetooth if (it’s not there) and select “Set up Bluetooth Device”. Follow the steps to pair the phone, make sure you’ve chosen “Access the Internet” option at the final step.

3. Connect to Internet

  • Go to System Preferences > Network and select Bluetooth from the left pane.
  • Click on “Advanced” button. Under the “Modem” tab, select “Other” for “Vendor” option.
  • Select “Nokia 3G CID 1″ for “Vendor” option.
  • Select “Ignore dial tone when dialing” from “Dial Mode” options
  • Click OK and now back to Network Menu. Enter your phone’s APN in the “Telephone Number” box. You can know your APN from your phone’s Menu > Tools > Settings > Connection menu.
  • Click “Apply” and then click “Connect”.

You should be connected to Net by now.

Resources

  1. Ross Barkman’s site. It has modem scripts for several phone brands.
  2. A similar post on tethering.

Update Tao of Mac has a very detailed post on this topic.

Deploying Django application on mod_python and Mini Mac

Posted in Django, How-To, Mac, Programming, Python, Sys Admin on July 2, 2009 by rubayeet
Server  : Apache 2.2
OS      : Mac OS X 10.5.4 
Python  : Version 2.5.1
Django  : Version 1.0.2 final
Machine : Mac Mini

mac finder

Mod_python is a loadable Apache module which embeds the Python interpreter, so Python code can be run in-process by Apache. To deploy and run your Django application in an Apache web server you have to

  1. Download and install mod_python
  2. Load it in Apache
  3. Configure Apache to run the Django app.

In this post I’m going to share my experience on how to do all that on a Mac Mini that runs on OS X 10.5.

The Software & Hardware

Here was my system configuration

  • Server  : Apache 2.2
  • OS      : Mac OS X 10.5.4 
  • Python  : Version 2.5.1
  • Django  : Version 1.0.2 final
  • Machine : Mac Mini running on 2.0 GHz Intel Core 2 Duo processor with 2GB RAM

1. Get the mod_python source

Check out the mod_python source code from the remote SVN repository*

$ svn co https://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk/ mod_python_src/

*The reason I’m downloading the source from an SVN trunk and not from the Apache website, is because the source available at the later one isn’t properly patched for Mac Mini’s architecture. In my earlier attempts, when I downloaded and built mod_python from stable releases, Apache was failing to start whenever the mod_python module was being loaded using the LoadModule Directive.

2. Build the source

$ cd mod_python_src

$ ./configure --with-apxs=/usr/sbin/apxs

$ make

$ sudo make install

3. Configure Apache to load mod_python when it starts

Open the Apache configuration file

$ sudo vi /etc/apache2/httpd.conf

Add the following line to the file 

LoadModule python_module libexec/apache2/mod_python.so

Now restart Apache

$ sudo /usr/sbin/apachectl restart

4. Configure Apache for Django 

Let’s suppose you have a Django app callled “mysite”. Copy you the directory to the Apache DocumentRoot

$ cp -r /path/to/mysite /Library/WebServer/Document/

Add the following lines to the httpd.conf file

<Location "/mysite">

    SetHandler python-program

PythonPath "['/Library/WebServer/Documents'] + sys.path"

     PythonHandler django.core.handlers.modpython

     SetEnv DJANGO_SETTINGS_MODULE mysite.settings

PythonAutoReload On

PythonDebug On

</Location>

This’ll make Apache to route any requests under URL “/mysite” to the mod_python handler. It passes the value of DJANGO_SETTINGS_MODULE so mod_python knows which settings to use.

Now restart Apache and go to the site http://localhost/mysite

If it works then congratulations! You’ve just deployed your app on Apache!

Troubleshooting tip(s)

If Apache fails to launch after you’ve installed and loaded mod_python, run it in debugging mode

$ sudo /usr/sbin/httpd -X

Look for any error message printed in the terminal, copy it and google it. You may find a solution online.

You should also check out