Calculate and Set Bounds (Bounding Box) from Points in Google Maps Flash [Update]

I’ve got a list of points in my database, which I want to show neatly in a Google Maps Flash Map.

Thus, I …

  1. calculate the bounding box around these points
  2. calculate the center of this bounding box
  3. set the zoom level of the map in a way that the zoomed cutout contains all points
  4. set the center of the map
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//1.
var bounds:LatLngBounds = new LatLngBounds();
for each(var mapObject in tripMessages){
    var currentLatLon:LatLng = new LatLng(mapObject.latitude, 
	                                       mapObject.longitude);
    bounds.extend(currentLatLon);
}
 
//2.
var center:LatLng = bounds.getCenter();
 
//3.
map.setZoom(map.getBoundsZoomLevel(bounds));
 
//4.
map.setCenter(center);

Using a MacBook with Bootcamp in Windows XP with an External Primary Monitor

Today I came across the problem that I needed to use a MacBook with our multi-touch table the Virttable.

Therefore, the screen of the MacBook must be enhanced onto a video projector that has been attached to the DVI port and this projector must be the primary screen. Anyway, Windows did not offer to me to select this projector as the primary screen. The only option was to extend the MacBook’s desktop to it. As I need to run the Touchlib’s config app on the Virttable this demands the video projector to be the primary screen.

It seems like the NVIDIA chip built into the MacBook does support this feature but somehow it is not mentioned in the driver’s inf file and because of that it is not possible to set an external monitor as primary screen in the display properties under Windows XP with this NVIDIA mobile GPU chip.

However, there is a project called laptopvideo2go, which aims to solve this problem with NVIDIA mobile GPU chips.

I needed to download this modded inf file and this driver archive.

Finally, I followed this illustrated installation process.

Django on OpenSUSE Virtual Server

I had some struggles when installing django on my OpenSUSE virtual server. It started with the problem, that I have not found a django rpm via yast in the OpenSUSE repositories. Thus, I decided to install django manually and to keep the footprint as small as possible. Luckily, Python 2.5.1 and the appropriate mod_python module for Apache have been installed already.

These are the steps that worked for me:

  1. I installed subversion, the MySQL Python lib and python-devel via yast.
  2. I checked out the up to date django version via svn into /opt.
  3. I ran “sudo python setup.py install” from the trunk directory.
  4. I added “PYTHONPATH = djangoProjectDirectory” to my bash configuration (exchange djangoProjectDirectory with the path to your project directory).
  5. For the integration of django into Apache I needed to enable mod_env.
  6. According to the django mod_python site, I created a snippet I need for the integration into Apache. This snippet looks like this:#Map global URL /media to media folder of django's admin page
    Alias /media /opt/trunk/django/contrib/admin/media
    <Directory /opt/trunk/django/contrib/admin/media>
    Order allow,deny
    Allow from all
    </Directory>
    #add django project itself (repeat so for each additional django project)
    <Location "/mysite/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonOption django.root /mysite
    PythonDebug On
    </Location>
  7. I stored this snippet in a separate config file called django.conf into the folder /etc/apache2/conf.d/ from which all files are automatically loaded whenever Apache starts.
  8. Restart Apache.
  9. Go to http://your-domain.com/mysite or http://your-domain.com/mysite/admin (as you might have guessed already, exchange your-domain.com with your domain)

Done.

Django Invalid command ‘SetEnv’ in OpenSUSE

Today I came upon a problem when I wanted to integrate a Django project into my Apache via mod_python on my OpenSUSE virtual server.

I put the snippet I need for Django into a separate config file called django.conf into the folder /etc/apache2/conf.d/ from which all files are automatically loaded whenever Apache starts.

Everytime I wanted to start my Apache it said
Syntax error on line 6 of /etc/apache2/conf.d/django.conf:
Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration

This seems to be a problem with the Apache configuration of OpenSUSE as mod_env which provides the SetEnv directive is installed but disabled.

Solution:

  1. Start yast (from the command line)
  2. Select “Network Services”
  3. Select “HTTP Server”
  4. Select “Server Modules”
  5. Select “Network Services”
  6. Scroll to “env”
  7. Select “Toggle Status”
  8. Select “Finish”

Done.

Remove Plesk default host from Apache conf in opensuse

Yesterday, I struggled with a problem on my virtual server that Plesk automatically sets /srv/www/vhosts/default/htdocs as the htdocs directory of the Apache.

Anyway, the greatest advantage of the Apache configuration of opensuse is its biggest problem: everything is set up very modularly. There are many things you can edit and install with yast and there are many that you can not. The point is that you will have to decide at one point if you tweak a setting manually and give up searching on Google for the appropriate solution with yast or some rpm manager or whatever the best solution should be.

Then you will haveto start searching in the VERY modularly set up apache config directory /etc/apache2/.

I could solve my problem by deleting the file /etc/apache2/conf.d/zz010_psa_httpd.conf. Files from this directory are included automatically in the file /etc/apache2/default-server.conf into the Apache configuration by the directive
Include /etc/apache2/conf.d/*.conf

/etc/apache2/default-server.conf itself is included into the main config file httpd.conf of Apache by the directive
Include /etc/apache2/default-server.conf

Phew…

MBP Keyboard Assembly: Backlight illumination with FTIR

Today I have made an interesting discovery: my 2008 2.4 GHz MacBook Pro is using frustrated total internal reflection (FTIR) for the illumination of its keyboard.

The background to this discovery is that I spilled a bit of salad dressing into my keyboard (pro tip: do never try to show someone the salad you are currently eating via skype) and since then some of my keys are not working reliable anymore. To be more precise: Some keys I must push two or three times until they produce the letter. Thus, I wanted to look if I could clean the keyboard and what kind of keyboard I would need if I wanted to replace it. I used the MBP iFixit guide to achieve the disassembly (and as I have been a lucky guy also the reassembly).

Anyway, when I removed the keyboard compartment from the MBP’s body I discovered that it consisted of four parts:

MacBook Pro Keyboard Parts
MacBook Pro Keyboard Parts

Continue reading “MBP Keyboard Assembly: Backlight illumination with FTIR”

Nokia S60 Problem: Invalid Jar file / Ungültige Jar Datei

When I started to develop some software for my Nokia Navigator 6110 I repeatedly ran into the problem that my apps worked fine with the Symbian SDK S60Emulator but when I tried to install them on my device via Nokia Application Installer everything went fine until finally the device would say ‘Ungültige Jar Datei’ or ‘Invalid Jar file’ in English.

Nokia Navigator 6110
Nokia Navigator 6110

I updated my Navigator to the latest firmware version but the jars still would not run.

My fault was to use the wrong Symbian S60 SDK. And there are lots of SDKs.

At first I downloaded the S60 5th Edition SDK from the Symbian S60 SDK download site and the Jars would not work. Afterwards, I downloaded S60 3rd Edition F3 SDK and the Jars still would not work. Finally, I checked the edition and the feature pack of the Nokia Navigator 6110 and found out the correct ones: 3rd Edition Feature Pack 1. I downloaded the appropriate SDK and it worked. Thank goodness. Those SDKs are several hundred MBs big. You definitely need to be patient when you have such problems.

Thus, if you run into the same problems: check five times whether you picked the appropriate SDK for your Edition and Feature Pack.

And do not forget to add your midlet to the Application Descriptor.

Symbian SDK IllegalStateException: No application specified in JAD or command line

This is a bit off-topic for this blog but recently I’ve needed to cope with Java ME and my Nokia S60 device Nokia Navigator 6110.

The problem: If you are doing what I have done and want to run an old midlet project with the Symbian SDK then do not forget to add all your old midlets to the ‘Application Descriptor’ file you will find in your project’s directory in the eclipse workspace folder.

Otherwise the Symbian SDK emulator will tell you something about an ‘IllegalStateException: No application specified in Jad or command line’.

Therefore, add a line like this to the ‘Application Descriptor’ file for each midlet, save it and run Create Package once more:
MIDlet-1: YourMIDlet,,your.package.name.YourMIDlet

Done.

Stantum SMK-15.4 Multi-Touch Development Kit

I recently had opportunity to lay my fingers onto a Stantum SMK-15.4 Multi-Touch Development Kit. The SMK-15.4 is a TFT panel with a resolution of 1280*800 pixels, which is equipped with a foil that contains a net of transparent capacitors, which can track multiple touches. Thus, the SMK-15.4’s touch principle is similar to the iPhone’s.

The Stantum SMK 15.4 Multi-Touch Device
The Stantum SMK 15.4 Multi-Touch Device

I have used it to develop the multi-touch parts of the TUIO-driven Flash multi-touch application Pf Design Media Installation. The SMK-15.4 comes with drivers for Windows and for the Macintosh. Additionally, for Windows there is a small application available that tranlates Stantum multi-touch events into TUIO events that can be (more or less easily) processed by a Flash Actionscript application.

The image quality of the device is not too good. The foil takes away lots of screen brightness and the colors tend to be fairly flat. The SMK-15.4 produces some error blobs quite next to the center of the screen, which bothers a bit. The whole appearence and manufacturing of the device is fairly prototypeish. I would not trust it to be used in an everyday application because the device and the touch foil coating seems to be rather fragile. However, it has been reported by a Stantum engineer that the panel can be equipped with a thin sheet of acrylic glass, which does not prevent touches from being realized. I only tested this with a thin sheet of paper and the tracking worked through the paper smoothly.

The apperance and the performance of the SMK-15.4 can not overcome the impression that the device is still a prototype that I would not use in a productive environment. However, the device has been a hell of a lot helpful to develop, test and debug my multi-touch application and especially tasks that were related to multi-finger input like pinching and rotating.

Thus, multi-touch software developers will have good use of the SMK-15.4. Everyone else should think twice before buying one.

A picture of my setup with the Stantum SMK-15.4 and my MacBook Pro running under Windows Vista:

Stantum SMK 15.4 Connected to MacBook Pro under Windows Vista
Stantum SMK 15.4 Connected to MacBook Pro under Windows Vista

On the Stantum SMK-15.4 you can see Pf Design Media Installation in this picture.

If you are looking for a Stantum to TUIO overlay you might find it here.