Entries : Category [ Programming and Software ]
[Miscellaneous]  [Computers and Technology]  [Travel]  [Education]  [Hacks]  [Robotics]  [Science]  [Programming and Software]  [iPhone]  [Digital TV and Video]  [Intellectual Property & Copyright]  [Personal] 

13 April

I am at the International Conference on Robotics and Automation in Rome, and Tandy Trower (general manager of the Microsoft Robotics Group) gave a long presentation pitching Microsoft Robotics Studio to the robotics research community. The reaction was quite mixed. MSRS has a number in interesting features and it promises to help provide a standard easy-to-use interface for robotics enthusiasts and certain researchers. Most importantly, it is an endorsement of robotics as a field that is on the verge of really opening up and having major impact. This is consistent with the recent Scientific American cover story authored by Bill gates. On the other hand, it is a closed proprietary system and it may reduce the amount of innovation in robotics software, if it is successful. This is probably a natural consequence of the maturation of any field, and in particular a software-intensive one, so it is not necessarily a bad things.

Herman Bruyninckx from K.U Leuven (and head of Euron) gave a very spirited rebuttal to Trower and argued that every time Microsoft enters a new market the range of alternative solutions becomes much smaller and more polarized. He was quite provocative and got a very strong level of support from the audience. At present, there are several alternative open source robotics toolkits and packages around.

Part of Trower's presentation included a brief discussion os MSRS 1.5 beta, which will have more features than the current version. Of course, the open source Player/Stage software which is now widely used was also discussed and a call went out that this is a key time to support that effort. All in all, it was one of the most talked-about events at the conference.

Even if MS Robotics Studio fails to get traction with the research community due to functional limitations, it may bias a whole generation of students who eventually do robotics, and thus become an almost-unavoidable presence.


By Gregory Dudek at | Read (7) or Leave a comment |    
29 August

Screenshot from iPhone contact list
Well I finally got my hands on an iPhone and it's just as nice a device as all the media frenzy would lead you to believe. I am lucky enough to have a project that needs exactly such as device, so I can rationalize the purchase (in fact it's actually less costly than alternative solutions that provide the key feature set, and that was before the big price reduction of Sept 6th).

The user interface is genuinely very satisfying and the whole experience in really nice. Just as a mobile web client and PDA, it totally blows the socks off my prior Palm Treo and/or Windows CE (iPAQ) devices in terms of both aesthetics and usability. One slightly frustrating feature relative to the Treo is that the key on the on-screen keyboard are rather difficult to type with. This, apparently, improves with familiarity and is alleviated by a built-in automatic spelling correction engine; we'll see about that.

Activating the phone was tricky (without an AT&T subscription yet). In principle, the software does not permit this (and you can't get AT&T here in Canada), but inspired hackers have come up with a work around and now there are lots of tools for doing this. (I recommend the progran called iNdependence.) I would not recommend this for people who are not technically skilled and willing to risk an a few hours debugging, though. Better to get one of the (very attractive) AT&T phone plans, or (outside the USA) suffer it out until a carrier in your own country is available.

Activation was fairly "easy" on the factory-installed firmware (or I was just lucky). Once I installed Apple's 1.0.2 firmware update, however, the activation tools became very fussy and consistent told me that activation failed with an error code of -402653165 (i.e. "Activation failed with code -402653165") . I tried numerous tools and tricks. Simply attempting it several times in a row is supposed to work. I think getting it to work may well involve a random process since the set of alternative "solutions" people have reported on the web seems diverse to the point of being ridiculous. Key issues seem to be to (1) make sure all iTunes applications are stopped, (2) generating the proper home-made "plist" using the correct device codes, (3) re-enter jailed mode just while activating, and (4) making sure no other programs (such as iTunes) are using the same USB ports. I also though it was a good idea to kill USB camera demons (such as the PTP daemon for my Canon camera). The technically inclined should use "ps wax" and "kill" from the terminal window. Even so, getting it to work seemed to depend on an apparently random enabling and subsequent disabling of "jailbreak" mode (i.e. write enabled or protected modes) .

By Gregory Dudek at | Read (1) or Leave a comment |    
10 September

The iPhone has a note-taking application, but at present the notes do not seem to get synchronized with the host computer. I wrote a program that allows you to sync and save the notes database from the iPhone and/or restore it at a later date. It also produces an ASCII text file (notes.ascii) that has the content of the notes so that they can be accessed off the phone.

The program is python code and requires a python interpreter. This is found by default on Mac OS X, but I am not sure about it's status on Windows.

On a Mac, running it would involve opening a terminal window and typing:
python getNotesaver.py

The program can use the USB connection to communicate with the iPhone (in which case iTunes needs NOT to be running and the open source iphuc program must be installed). It can also communicate with the phone using scp, assuming you have "jailbroken" the phone and installed this tool. If you use scp, then the phone needs to be on your network and you should know it's IP address.


Of course this program comes with no assurance of utility or anything else. I do not warrant it in any way against any consequence, direct or indirect. I believe it works well, but by using this you disclaim all recourse for whatever it does, even if it erases your database, your phone or your bank account.

The program is here. The latest version is version 1.2.0. This page entry is updated as new releases appear.
(it was originally released as version 1.0 and there were several other versions).

It now includes the ability to patch the display of the cell-phone carrier name to allow the name to fit in the allocated space, for those not using AT&T. (Yes, it's sort of an odd feature for this tool.)

Feeback is welcome, especially from Windows users who should feel free to provide patches.

Updated Nov 26, 2008 to version 1.3.2 (Not all updates are noted in this way.)

By Gregory Dudek at | Read (4) or Leave a comment |    
29 March

I recently configured a Linux (Ubuntu) web server for SSL support. I had not done this for a long time, and had largely forgotten how. Here is the recipe and a fix to this problem.

Prologue: making your own SSL certificates

The easy solution to generating self-signed certificates needed for SSL is the the CA.pl perl script, which is included in the openssl installation tar ball. You can find it at
or else Google for "openssl-0.9.8 tar gz".

You need to generate suitable security keys (certificates) before you can use SSL. This can be accomplished using these steps from a suitable configuration directory:

perl CA.pl -newca
perl CA.pl -newreq
perl CA.pl -sign

You will have to answer various questions. The questions are stored locally, so the actual answers do not matter much, except for the domain name.
In particular, you should enter your server host name (e.g. www.dudek.org) when asked for a "common name".
This should produce the files newcert.pem and newkey.pem in the current directory.

Setting up Apache to use SSL

The apache2 configuration section for SSL then needs to use these keys with lines like:

SSLCertificateFile /etc/apache2/ssl/newcert.pem
SSLCertificateKeyFile /etc/apache2/ssl/newkey.pem

Whoops: error -12227

After this I was getting the error in my log file

OpenSSL: Exit: error in SSLv3 read client certificate B

which leads to an error -12227 from Firefox when the site is accessed.

After searching Google I found other people complaining about this, but with no actual diagnosis. Well, I have the answer. Looking at the error logs, I found that it was due to having configured apache/ssl for client authentication without having provided suitable certificates (the detailed story is that apache needs to understand you are acting as your own certificate authority, and not depending on an external one).

Solution to error: SSLCACertificate

The fix is to change the line in the apache config file that reads:

SSLCACertificate require

to instead read

SSLCACertificate none

After that, it should all work.

CA.pl manual page: http://www.openssl.org/docs/apps/CA.pl.html

SSL configuration explanation:

Ubuntu instructions (good) which avoids using CA.pl:


More user's stories:

By Gregory Dudek at | Read (3) or Leave a comment |    
10 April

Python includes a uudecode and uuencode module (accessible via "import uu"), but the module only supports base32 uudecoding, and not base64. I needed base64. Although I have posted an official patch to the python2.4 library, python had already moved on to a later version. Here is my patch for python2.5 uu.py to make it able to decode and intrepret base64 data. Encoding in base64 is probably pretty easy too, but I don't need it and have not bothers. I encourage somebody to add it.

One problem in applying this patch, especially from a web page, is that the white space versus tabs might not match. The - l flag (that's a lower case L) tells patch to ignore white space, but since python is senseitve to white space, you might have to adjust things manually.

Also note that on OS X, the uu.py module can be found at

The patch file (input for patch -l) is as follows:

--- uu.py.orig 2007-08-25 23:42:35.000000000 -0400
+++ uu.py 2007-08-26 11:42:54.000000000 -0400
@@ -18,6 +18,9 @@
+# Modified by Gregory Dudek, April 2008:
+# - added support for decoding of base64 uuencoded files.
# Modified by Jack Jansen, CWI, July 1995:
# - Use binascii module to do the actual line-by-line conversion
# between ascii and binary. This results in a 1000-fold speedup. The C
@@ -81,7 +84,7 @@
out_file.write(' \nend\n')

-def decode(in_file, out_file=None, mode=None, quiet=0):
+def decode(in_file, out_file=None, mode=None, quiet=0, base64=0):
"""Decode uuencoded file"""
# Open the input file, if needed.
@@ -100,9 +103,10 @@
if hdr[:5] != 'begin':
hdrfields = hdr.split(" ", 2)
- if len(hdrfields) == 3 and hdrfields[0] == 'begin':
+ if len(hdrfields) == 3 and (hdrfields[0] == 'begin' or hdrfields[0] == 'begin-base64'):
int(hdrfields[1], 8)
+ if hdrfields[0] == 'begin-base64': base64=1
except ValueError:
@@ -130,11 +134,13 @@
s = in_file.readline()
while s and s.strip() != 'end':
- data = binascii.a2b_uu(s)
+ if base64: data = binascii.a2b_base64(s)
+ else: data = binascii.a2b_uu(s)
except binascii.Error, v:
# Workaround for broken uuencoders by /Fredrik Lundh
nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3
- data = binascii.a2b_uu(s[:nbytes])
+ if base64: data = binascii.a2b_base64(s[:nbytes])
+ else: data = binascii.a2b_uu(s[:nbytes])
if not quiet:
sys.stderr.write("Warning: %s\n" % str(v))

By Gregory Dudek at | Leave a comment |    
Rate item 113: Rating: 16.4/10 (8 votes cast)
30 January

Getting c++ to use a custom python framework

This post addresses how to get the OpenCV vision package with Python bindings to compile on OS X, such that you can use a version of Python other than the one that is supplied with the original operating system installation. It's very hacky and not for casual reading, but my help some person questing for help.

Dudek faces detected
Detected faces, using opencv, Viola-Jones algorithm (boosting)

Detecting a sleeply dudek with opencv
Face and eyes detected

The problem is that OpenCV insists on being linked with the standard default installation of Python on OS X. On the other hand, many (most?) techie people using Python will have installed an alternative newer release (for instance via "fink" or "macports").

When you compile OpenCV and try to use it with your custom-installed Python (e.g. version 2.5.2 instead of the stock 2.5.1), you get an error as follows:

% python
>>> import opencv
Fatal Python error: Interpreter not initialized (version mismatch?)

Using the standard Python is a workaround, but for me it wasn't acceptable. Unfortunately, since I had no prior experience with cmake or opencv, this was problematic. Here's how to fix it. Despite many only-semi-correct discussions of this on the net, it's fairly easy to fix, once you realize the source of the problem.

On OS X (or, in fact, the core operating system kernel, Darwin), many packages are installed using Frameworks. They group together libraries and headers. The C compiler on Darwin has been extended to take a -framework PATH flag, and by default this causes the linker to look in the system directories, but not user-installed directories. You need to provide an extra -F DIRECTORY flag to specific the location of your user-installed frameworks (e.g. "-F /opt/local/Library/Frameworks/").

I never quite figureed out the "right" place to insert the flag before starting a build, but after a failed build you can just insert it into
The right place is probably interfaces/swig/python/CMakeLists.txt
using something like

set(CMAKE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -F/opt/local/Library/Frameworks")

but once I got it working I didn't want to waste more time on a really clean fix (instead, I wasted time writing it up here).

When you run make, in order to assure it's working you can set the system frameworks to be temporarily inaccessible to verify the right places are being searched. Do this with the chmod command. Afterwards, you can put things back the way they were (mode 755).
I suggest you test your patch as follows:

sudo chmod 000 /System/Library/Frameworks/Python.framework/
cmake .....
sudo make install
sudo chmod 755 /System/Library/Frameworks/Python.framework/

As an aside, I was also confronted by the error:

opencv/src/highgui/cvcap_ffmpeg.cpp:70:28: error: ffmpeg/swscale.h: No such file or directory

this can be fixed by the hack:

cp -r /opt/local/include/libswscale/* /opt/local/include/ffmpeg

By Gregory Dudek at | Read (1) or Leave a comment |    
[1]   2   3   Next