Archive for the 'Nerd' Category

19
Oct

A Change

2011 has been an interesting year. Between the stupid earthquakes and the pressure of finishing my PhD, I have been silent because I have had nothing interesting to talk about (cf. twitter…).

But there is a light at the end, I’m on track to complete my thesis, ‘Biologically Inspired Visual Control of Flying Robots’, in December/January.

Christchurch, demolished, the old...

Christchurch, demolished, the old...

I’m excited to say that I have accepted a job at the Institute of Molecular pathology, in a research group studying the mechanisms of visual flight control in insects. Technology wise, it is a perfect fit; the experimental apparatus involves a multi-camera real-time flight tracking system and estimator for multiple targets in an augmented reality flight arena. It is open-source (ish), and python/numpy. Research wise, it allows me to investigate some of the assumptions and unknowns in the biomimetic control systems I implemented during my PhD. And it is in Vienna, 1st Feb, 2012!

Vienna, the new...

Vienna, the new...

This is a career change for me. In the last few years it became increasingly clear that I was morally uncomfortable with the use of UAVs as weapons (drones). Previously I had consoled myself with there existing an ethical and philosophical difference between ‘the application of research’ and ‘the action of research’. When It came to looking for work, and considering who to work for, this difference was often eroded.

It has also been particularly frustrating being in New Zealand for the last 12 months and watching our flaccid national response to the three recent challenges here (world cupearthquakerena oil spill).

Technology Tidbits

This post has been brought to you by procrastination.
15
Jul

Interfacing Python + C + OpenCV via ctypes

I was recently asked to help a colleague access his image processing C-library from python; quite a common task. As those of you who are familiar with Python might realise, there are a whole bag of ways that this can be accomplished;

In this case the colleague only needed to access a single function from the library returning image data, and then hand this result onto OpenCV. One happy side effect of the new (> v2.1) python-opencv bindings is that they do no validation on CvImage.SetData, which means you can pass an arbitrary string/pointer. Because of this I advised him I thought using something like SWIG was overkill, and he could just write a wrapper to his library using ctypes, or a thin python extension directly.
Image data contains embedded NULLs, and I could not find a concise example of dealing with non null-terminated, non-string char * arrays via ctypes so I wrote one.
# char *test_get_data_nulls(int *len);

func = lib.test_get_data_nulls
func.restype = POINTER(c_char)
func.argtypes = [POINTER(c_int)]

l = c_int()
data = func(byref(l))

print data,l,data.contents

and, another approach

# void test_get_data_nulls_out(char **data, int *len);

func_out = lib.test_get_data_nulls_out
func_out.argtypes = [POINTER(POINTER(c_char)), POINTER(c_int)]
func.restype = None

l2 = c_int()
data2 = POINTER(c_char)()
func_out(byref(data2), byref(l2))

print data2,l2,data2.contents

The full code can be found here and contains examples showing how to deal with data of this type using ctypes, and by writing a simple python extension linking with the library in question.

03
Apr

End of an Era: PyGTK

I just released PyGTK 2.24, which will almost certainly be the last major PyGTK release. The future of Python on the GNOME platform is PyGObject + GObject Introspection. From my experience over the last few months porting a number of my projects, the future is bright.

In a cruel twist of irony, the state of PyGTK on Windows and Mac has never been better. The credit for the windows work (and some great documentation improvements this cycle) must go to Dieter Verfaillie

I hope that the new stack will reach the same level of capability on other platforms as GTK+ 2.24, but in the large scheme of things the renewed development excitement surrounding GTK+ 3.0 and GNOME 3 is excellent consolation.

As a user I would like to thank those developers before me for creating PyGTK. It was the first ‘pythonic’ UI toolkit for linux, and a pleasure to use. As the recent maintainer of PyGTK I would especially like to thank those recent developers who helped me, in particular Dieter Verfaillie who really pushed PyGTK over the line regarding Windows support, into the great state it is now.

I’ll leave you with some graphical statistics (generated using pepper) for the 12 year history of PyGTK. If planet strips the wordpress gallery then please click here.

update: To clarify a point raised in the comments, PyGTK will be maintained in the exact same was as the GTK+-2.0 series will be maintained. Bug fix releases will be made if necessary, but no new features will be added. If you want the new GTK+-3.0 features then you should use PyGObject + GObject Introspection.

The PyGTK code will not disappear from any servers, it will continue to be shipped in all distributions for the forseeable future, it will continue to work very well on windows, and many applications will continue to use it.

24
Dec

PyGTK All-in-one Installer for Windows

The PyGTK team is pleased to announce the return of the highly popular all-in-one installer for Windows.

The PyGTK All-in-one installer provides an alternative installation method for PyGTK users on Windows. It bundles PyGTK, PyGObject, PyCairo, PyGtkSourceView2, PyGooCanvas, PyRsvg, the gtk+-bundle and Glade in one handy installer.

Currently 32 bit Python 2.6 and 2.7 versions are supported on Windows XP and above.

Dieter Verfaillie deserves enormous thanks for this work. Firstly, he performed the tedious job of ensuring that all the component MSI installers were exactly correct, and secondly, the really difficult task of deconstructing these individual installers and reassembling their contents into a single cohesive executable.

This is a true all-in-one installer, it does not simply call out to launch the individual MSI files.

  • More screenshots here.
  • Please file bugs as appropriate.
  • We are looking to collaborate with others who want to create gtk+ (and friends) all-in-one installers for Windows. We anticipate the tools to generate these installers will move to GNOME in future - perhaps in a common repository. Suggestions and feedback welcome.
19
Nov

GTK+ Viewer for Microsoft Kinect

I’m hacking on the new Kinect at the moment and the OpenGL viewer didn’t work for me so I threw together this terrible quality gtk+ one. I’ll clean up the code and try to get this into OpenKinect ASAP.

GTK+ viewer for Microsoft Kinect

GTK+ viewer for Microsoft Kinect

10
Jun

Map Updates

I recently made a number of improvements to osm-gps-map, the easy to use mapping widget. The motivation for these came at the request of the foxtrotGPS developers (foxtrotGPS is a community developed fork of TangoGPS). These changes enhanced the API for adding images and tracks to the map, and in addition allowed me to clean up the basic API making it easier to use for the common case. But, there is more, especially relevant to Gtk+/GNOME 3.0.

osm-gps-map demo application

osm-gps-map demo application

05
Feb

Nautilus + Coverflow part two

After two complete rewrites following my initial experiments, the other gloobus developers (badchoice and kitkat) have continued to work on integrating this coverflow view into nautilus.

The implementation of the coverflow widget this time is a little more sane. It is passed a GtkTreeModel of GFiles, and basically does everything in isolation. The coupling to nautilus is quite loose, so the idea is that the widget can be reused easily by others.

The code is available from the linked blog post, or from github.

22
Jan

Misc Hacking

I had two days off while I moved offices, so I got a chance to catch up on my backlog of random hacking.

osm-gps-map

I released osm-gps-map v0.5.0 which adds a few new features (such as keyboard navigation) but also contains many bugfixes and performance improvements. Check the release notes for more information. The next item on the TODO is merging the OSD/layers branch.

Conduit

I released Conduit 0.3.17 which was long overdue. Mostly a bugfix release and updating to new API. The Conduit homepage has also moved to live.gnome.org. Progress on Conduit is a bit slow at the moment, it does everything I want it to (I have a budget cellphone so phone synce does not interest me), and is pretty stable. I have some SOC work I would like to merge, but basically I am looking for developers and inspiration…

PyGTK for Windows

I finished off the fixes to build correct PyGTK+ installers on windows, hopefully closing bug #589671. I uploaded new installers with the fixes people have reported. I expect these installers to become the ‘final’ installers at some point. Feedback welcome.

PyGTK Hacking

I wanted to play with the new client side windows work in Gtk+, so I ported the effects gtk-demo to Python. This required a bit of ctypes magic to access the new API (good), and some more ctypes magic to interact with new signals that appears to have unfriendly prototypes (not so good, bug filed here).

PyGTK example using client side windows

PyGTK example using client side windows

11
Jan

Gtk+ Map Widget

It has been a long time between blogs. I thought I should talk about the piece of software that has been responsible for the most emails in my inbox over the last few days - osm-gps-map, the Gtk+ based map widget. What started as a widget for use in one small application of mine has grown considerably.

  • I recently released 0.4.0, a bugfix release.
  • I created a mailing list, if you are a user or interested osm-gps-map, them please join.
But I thought I should take some time to highlight some of the most interesting users of osm-gps-map, particualry those users on the Maemo platform.

Maep, OSM2Go and GPXView (by Till Harbaum)

BrainStorm (by Adam Boggs)

  • BrainStorm is a storm chasing application that plots your track, and overlays current radar and severe warning imagery on the map.
  • Brainview

    Brainview

eCoach

  • eCoach is an application for recording and managing sport activities with Nokia N900, it records heart rate data from various monitors, and plots your path on the map as you exercise.
  • eCoach

    eCoach

Conclusion

  • With the help of these users, the future of osm-gps-map looks very positive.
  • I am currently working on merging Till’s improvements to master to discourage people from copying osm-gps-map source into their application.
  • If you are a user of osm-gps-map and I have forgotten you then I am sorry. Please contact me and join the osm-gps-map mailing list.
27
May

Playing With Clutter

Some of you out there might be familiar with Gloobus. Over the last few nights I spent some time integrating Gloobus inside nautilus.

This is a proof of concept. I have done very little so far - it shows the first 8 files in the directory, and allows you to navigate between them with animation. It is mostly just a port of Gloobus from C++ into a ClutterGroup derived Actor in C, most of the thanks should go to the Gloobus author.

It features the same bugs as Gloobus, like poor support for resizing the window, positioning bugs, and it does not scale to very many files. It also leaks like a sieve (that one’s on me). Here is my inadequacy represented in video form.

Those of you who regularly work with computers and other technology will be aware of how important it is to have a good quality internet connection. If you are looking into getting a new broadband connection then I recommend you look at O2 uk broadband reviews.

However, if you would still like to take a look and perhaps fix all the bugs, the steps for testing it are

  1. Install clutter-gtk-0.9
  2. Download nautilus from my Git repository (the clutter branch)
    https://github.com/nzjrs/nautilus/tree
  3. Build the test program
    cd src/file-manager
    make -f Makefile.covflow && ./test-covflow
  4. Built nautilus with –enable-clutter-view
  5. Run the newly build nautilus
    cd src
    ./nautilus -q
    ./nautilus –no-desktop

This is very early work so the standard disclaimers apply. I needed to get this off my chest so I could get back to PhD work.