Friday, May 29, 2009

ideacampdavao!












ideacampdavao is set for tomorrow, 1:30pm @Kublai's Cafe (Ponce Suites) so see you there guys and hope to share ideas with the rest of you! :)

Friday, May 22, 2009

riding.the.city

I was tinkering with the GPStogo unit (loaned to Marloue by OSM) the other day and made a simple Delphi app to fetch GPS data from the device and plot the location to an OSM map of Davao. The idea is to create a DIY real-time GPS tracking system suitable for mapping (and for the upcoming mapping party), using only stuff in the office. However, I have not figured out a way to effectively render downloaded OSM tiles in my app (no offline-support yet) and my application is currently making use of Cloudmade's powerful API to request and render the tiles for me online. So unless I use WeRoam or Visibility it won't be as useful for mobile mapping (using the telco's 3G service for mobile mapping isn't as practical either). The next day I decided to install tangoGPS on my notebook and saw that it practically has what I wanted in the first place (plus its free and supports offline maps). Since Marloue and I are scheduled to meet a client after lunch, we figured that it would be the best time to try out this DIY setup and start logging POIs (Point of Interest) as we travel along the road.

Here's what you need:
1. GPS device...we used the GT-31 but any GPS device that outputs NMEA sentences will do
2. A notebook with Ubuntu 9.04 (or any distro you want) installed
3. tangoGPS

You can install tangoGPS via synaptic:

sudo aptitude install tangogps

Ensure that gpsd and gpsd-clients is installed as well:

sudo aptitude install gpsd gpsd-clients

Gpsd is a service daemon that monitors one or more GPS devices attached to a host computer through serial or USB ports. It then serves this information via port 2947 and allow multiple client application to access the to GPS devices without contention or data loss. You can actually use one GPS device for navigation, wardriving, mapping or whatnot all at the same time!

tangoGPS does not interface directly with a GPS device, however it accesses GPS data by listening to a gpsd service. So before you can actually use Tango you'll have to make sure gpsd is running. You also have to check what particular USB port the GT-31 or any (GPS device for that matter) is connected.

dmesg | grep ttyUSB

Normally it should give you /dev/ttyUSB0 but it could be any other number depending on which port is available. Next, run the gpsd service:

gpsd -N -n -D 2 /dev/ttyUSB0

Once the service is running, fire-up tangoGPS and proceed to configuration. The default setup should work (IP: 127.0.0.1 port 2947) as it uses a loopback address, change the IP if you're accessing the service from another machine. Thats about it, once the GPS gets a satellite fix tangoGPS will draw a marker that shows your current position and bearing. Righ-clicking on the map allows you to add POIs, which was exactly what Marloue was doing during the trip. I managed to discover a better driving route while doing this experiment and I hope something similar happens to you as well, have fun riding the city!

Thursday, April 30, 2009

lazarus.on.ubuntu.jaunty.64bit

Being a big fan of Delphi I've been wanting to port my apps to Linux...unfortunately Kylix (Borland's RAD tool for Linux) is no longer supported since...well years ago, the obvious path would be to use free pascal and Lazarus. Free pascal is an open-source Pascal compiler with two notable features: a high degree of Delphi compatibility and availability on a variety of platforms, including Windows, Mac OS X, and Linux, Lazarus on the other hand, is an open-source development system that builds on the Free Pascal compiler by adding an integrated development environment (IDE) that includes a syntax-highlighting code editor and visual form designer, as well as a component library that's highly compatible with Delphi's Visual Component Library (VCL).

In Intrepid, I found that Lazarus and fpc is best compiled from the svn repo, however this is not the case with Jaunty (9.04) or at least with Jaunty 64bit. I have not installed Lazarus or fpc on Jaunty's 32bit edition so I can't say for sure but in the 64bit version it won't compile, I'm pretty sure its a dependency issue but as of the moment I don't have the time or the patience to trace all of it, enter CodeTyphon (shouldn't it be CodeTyphoon?) a distribution of FPC and Lazarus with a nice graphical build tool that makes building (to any OS) easier. Until the Lazarus wiki reflects a nice howto here's an easier way to install and build fpc and lazarus.

  1. Download CodeTyphon here
  2. Extract CodeTyphon zip to a folder of your choice
  3. Double-click CodeTyphon_ln64.ex (a CodeTyphon window should show up)

  4. Go to main menu FreePascal -> FPC Extract Source (it should automatically extract the FPC source to its own directory...usually /usr/share/fpsrc)
  5. Next select FreePascal -> FPC 64bit Build Compiler (could take a few minutes)
  6. Go to main menu Lazarus -> Lazarus Extract Source(it should automatically extract the Lazarus source to its own directory...usually /usr/lib/lazarus)

  7. *Step 7 actually failed in my first attempt, I found out that later after looking at the error logs that a few dependencies have to be satisfied first (so much for no time and patience hehehe). So fire-up your terminal and type this:

    sudo aptitude install libX11-dev libgtk2.0-dev

  8. Next select Lazarus -> Lazarus 64bit Build IDE
  9. Create a link or launcher that points to /usr/lib/lazarus/startlazarus
  10. Start coding!



Hope this helps! :)