domingo, 26 de julio de 2009

Debugging Django and JavaScript

I was doing a few adjustments to Iridium, specially on the image thumbnail generation, which is done via PIL, which has its share of problems.

First is the problem with "corrupted" image files, it could be either truthfully corrupted files or a file that hasn't been completely uploaded (very unlikely), PIL has some funny behaviors with those files and verifying the file is not simple, see django bug #3848 patch on this.

PIL usually trows exceptions, however, given that the function that handles file upload and thumbnailing is called Async (ajax) django won't trow the usual error page, debugging with breakpoints usually pin points the offending line, but you will not get any messages or exceptions (they are lost), at least with WingIDE, which makes debugging this kind of code with an IDE as useful as a bunch of print statements.

Once this was done I changed a few javascript lines to verify that the file has a thumbnail, the whole thing started misbehaving from there, steeping trough the javascript code with firebug revealed interesting behaviors, firefox was doing whatever it wanted with my code, including traversing trough wrong code paths (not respecting ifs), which was strange as it was working a few minutes ago, what was the problem? it was only a few lines, no typos, the only difference between last successful run was... Firebug, which I had tested before and find it useful, I had installed the new version (1.4) just a few minutes ago...

In the end I disabled firebug and reloaded, everything worked as it should be, looking at the firebug page there is a bunch of negative comments on the quality of this version, now I see why, either the thing didn't installed right, a bug or plainly this version sucks.

viernes, 24 de julio de 2009

Iridium

Not so long ago I started working on a django based application to manage software projects, Iridium, this as an internal project for my company, I looked to many fine alternatives but I wanted to reuse our expertise on Python and focus on django, at the time I was not convinced with the available options and started my own project.

Today I decided to release Iridium as open source, under a very permisive 3 clause BSD license.

Iridium is lightweight and simple, when I started writing it I didn't have much experience with django, coming from TurboGears I created a few utilities to be feel at home (like decorators for templates), thus the code may be wildly diferent from your usual django app.

Fortunately I have received a very positive response from the comunity where the project is hosted (github):

http://github.com/clsdaniel/iridium

sábado, 11 de julio de 2009

pyvcs

A few days ago I found this project, pyvcs, which aims to create a simple API for accessing useful data from many different VCS (such as git, hg, subversion, etc), just enough to create a repository browser.

Just exactly what I was looking for!, it supported Git and Mercurial, browsing the source it seemed simple and elegant, and thus I began coding a subversion backend, I already coded a browser for subversion repositories using python (for the now defunct tecforge) and zope, but that was with the low level svn python binding, this time I used pysvn (which seems to be the official binding now), it was a bit of guesswork, the documentation laked in details but was workable, in the end my work got merged with mainline.

I have been migrating my project from custom code to pyvcs and things are a lot easier now, also pyvcs is moving fast, it now supports git, hg, bzr and svn (all major open source vcs).

PyVCS Home:
http://github.com/alex/pyvcs

miércoles, 3 de septiembre de 2008

Final GSOC 2008 evaluations

I have submited the required code to Google for the final GSOC evaluation, well, now I just have to wait for my GSOC shirt! :)

Recently I started to use WingIDE to work on carcode, I tested wing in the 2.x series and current 3.1 version is really good, I like its code analysis tools specially, I applied for an free OSS license and got it right away next day!, now that is fast!

Now, I have to workout a few issues with carcode which appeared recently when testing for the beta release, collision detection is not working as it should, it could be a problem with the geometry (in memory geometry does not describe the rendered object accurately) or the algorithm, however I recall having it working in Alpha 2, propably I should have added a test suite for it, now I will have to see which version broke it, fortunately git bisect command will be very useful for this.

Now time to do some testing and reading for pharmacology exams next week!

miércoles, 27 de agosto de 2008

Carcode GSOC

I haven't posted anything since Alpha 1 and currently we have Alpha 2 available, Beta 1 is around the corner (has been for quite a while).

Google Summer of Code has ended, most features from my proposal where fulfilled, but I'm still working on it on my free time, altough now with school I don't have as much time as in summer vacations but is free time anyways.

I have updated the screenshots section from the carcode project page with latest work (beta 1):

http://code.google.com/p/carcode/wiki/Screenshots

Currently I'm working on adding a few levels in order to have a Beta with something to work on, more levels will come and ofcourse, you can make suggestions, there is a wikipage on level design:

http://code.google.com/p/carcode/wiki/LevelDesign

Feel free to add and modify!

Last but not so last, I'm Alive! and working on carcode! don't worry :)

lunes, 14 de julio de 2008

Carcode 3.0 Alpha1

Carcode is an experiment in programming education. The idea is to give beginning programmers carcode, which provides an animated car they can drive around the screen either using the keyboard, or programmatically through a simple API. By working on a series of problems (such as "park the car in parking space A"), beginners learn to program in an engaging, and goal-driven environment they already have much familiarity with.

The first version derived from GSOC 2008 code has been released, is an alpha release with a good and working code base but it is still not feature complete, you can however try it out and experiment with it.

Major features in this release:
  • Level scripting capabilities
  • Car scripting capabilities
  • Car sensors
  • Widgets for in game UI and dialogs
  • Few examples of scripting in demos directory
Downloads:
http://code.google.com/p/carcode/downloads/list

Issue Tracker:
http://code.google.com/p/carcode/issues/list

Don't forget to send feedback!, use the tag Milestone-Alpha1 when sending a new issue in the tracker.

This release has been out for a few days however there has been some heavy rain and electric storms in my area which delayed my work a few days, but I'm in working shape again (I hope there is no more storms for now).

Next thing to do is to add the event tracking system, add support for adding conditions and goals to the level and refine scripting in general, a few UI enhancements and I'll do another release.

miércoles, 2 de julio de 2008

GUI branch

After working a few days on my GUI branch of carcode, I got some interesting results, I completed a basic set of widgets that integrates well with carcode, I did a main menu and a file dialog to open script files:

It was interesting to work on this, I wanted once to create my own toolkit, based on SDL and C, but it ended up being a bit time consuming, this time was very simple and fast, using python + pygame + OpenGL to do all.

OpenGL has many useful features, for example Stencil buffers, I make use of them for clipping widgets inside windows or other widgets, even having multiple widgets that make use of it inside other widgets works fine, you just need to take care of how many times the buffer has been written.

Well, midterms are approaching but the project is on schedule, even better than I expected.