Getting Port 80 for Apache to work in MAMP or MAMP Pro

Setting Apache to use Port 80 in MAMP
Setting Apache to use Port 80 in MAMP

If you’re stuck with MAMP (or MAMP Pro) unable to use the default Apache and MySQL ports (Port 80 and Port 3306 respectively) when you change them in preferences, use the following steps to ensure that the changes you make are saved and work:

  1. Launch MAMP. Open Terminal by typing terminal into Spotlight (Command + Space).
  2. Open MAMP Preferences (Command + , ) and click on Reset MAMP Ports (Port 8888 and Port 8889 for Apache and MySQL respectively). Click on OK.
  3. Switch to the terminal. Type sudo apachectl stop to shutdown the system Apache.
  4. Restart MAMP.
  5. Open MAMP Preferences once again and click on Set to Default Apache and MySQL ports. This will set the Apache and MySQL ports to 80 and 3306 respectively.
  6. Switch to the terminal. Type sudo apachectl restart to restart Apache.
  7. Switch back to MAMP and click on Open Start Page (or go to http://localhost/MAMP/?language=English in your browser)

And you’re done.

By using Port 80 for Apache HTTP server, instead of having a URL like http://localhost:8888 you’ll have a clean URL like http://localhost

This is useful in certain cases, for example WordPress multi-site installation where you cannot create a network if “WordPress address (URL)” uses a port number other than ‘:80’, ‘:443’.

Setting preferences in MAMP usually works without a hassle but I encountered this problem, today morning. Only the default MAMP ports seemed to work, no matter what I set in the preferences. This led to a lot of wasted time and productivity. I hope this how-to guide saves you some hair and valuable time.

Humanoid Robot NAO performing Sun Salutation

As a Research Intern at Gade Autonomous Systems, I had the opportunity to implement the Human-Robot Interaction module on a NAO humanoid robot to promote linguistic and social learning in children with autism spectrum conditions.

Among other things, I programmed NAO to perform the Surya Namaskar, the traditional Indian practice of Sun salutation. The video starts a bit shaky but improves in a few seconds:

For development, I used Python for programming and Choreographe by Aldebaran Robotics running on a Ubuntu 11.10 machine. The behavior was simulated on NAOsim powered by Cogmation Robotics running remotely on a Windows 7 machine.

I utilized all the three methods for integrating motion to develop this particular routine, namely:

  1. The Timeline Editor
  2. The Recording Mode
  3. The Motion API (ALMotion)

Each of these methods have their own pros and cons. For example,

  • Programming the exact actuator position values using the Motion API is time consuming but allows for unparalleled precision
  • The timeline panel or the motion editor allows for defining frames quickly and specifying the animations in those frames
  • The recording mode allows you to move NAO’s body to a certain position manually and record the actuator position values

By building this behavior, I learned about the well designed interface between the simulator (NAOsim) and the development suite (Choreographe and Telepathe). The number of times NAO fell on his face in the simulator highlighted the importance of extensive testing and simulation with in a  physics-enabled environment before deployment in the wild. My understanding about the synchronous and asynchronous flows improved greatly using the box-based GUI and, eventually, I programmed the flows using the API as well.

An idea from my dad, and observing the locals practice their tradition inspired me to build this particular behavior into the initial Human-Robot Interaction module. Hope you enjoyed watching the video.

Me, teaching Surya Namaskar to NAO Humanoid Robot

pyblobs with OpenCV 2.1 on Ubuntu 11.10

pyblobs is a Python interface for cvBlobsLib. To use it with OpenCV 2.1 on Ubuntu 11.10 follow these steps.

Prerequisites

The following dependencies are required to use pyblobs library:

sudo apt-get install swig
sudo apt-get install libcv-dev
sudo apt-get install python2.7-dev
sudo apt-get install python-opencv

If you are using Python 2.6, then use sudo apt-get install python2.6-dev instead.

Getting the pyblobs library

Use svn to grab the source code

cd /path/to/Downloads/
svn checkout http://pyblobs.googlecode.com/svn/trunk/ pyblobs-read-only

Patching the files

The code from the trunk as of now uses Python 2.5 (python2.5-dev) and not the best way to link shared objects in the make_swig_shadow.sh file. There is another issue with building the pyblobs library to be used with OpenCV 2.1 in the file BlobExtraction.cpp

Hence, I have created two patch files for the aforementioned files:

Download these to the same directory as the downloaded library (pyblobs-read-only) and then run the following commands in the terminal:

cd /path/to/Downloads/pyblobs-read-only/
patch make_swig_shadow.sh make_swig_shadow.patch
patch BlobExtraction.cpp BlobExtraction.patch

If you are using Python 2.6, then after patching edit make_swig_shadow.sh and replace any occurennces of python2.7 with python2.6 .

Installation

To install

make
./make_swig_shadow.sh

To check your install, go to your Python shell and try the following imports:

>>> from blobs.BlobResult import CBlobResult
>>> from blobs.Blob import CBlob

If all goes well, you shouldn’t see any errors. Now you can work with pyblobs and OpenCV2.1 on Ubuntu 11.10!

That said, to get the example file demo.py working, you might need to modify it a little to use objects and methods from the newer OpenCV Python API. For example, in my programs I replace

from opencv import cv
from opencv import highgui

with import cv2.cv as cv to use the new API as cv.MethodName() instead of cv.cvMethodName() or highgui.cvMethodName(). Makes life a lot easier!