Software Engineering can be a bit challenging on the Google App Engine, and so I am always on the lookout for a helping hand! I came across this article on using reCaptcha on the Google App Engine using python:
http://daily.profeth.de/2008/04/using-recaptcha-with-google-app-engine.html
Just what I needed, a step by step guide!

Archive for the 'Tech Stuff' Category
There are some interesting aspects to doing Software Enginering from within the Google App Engine sandbox - I came across this interesting article on how to play with things so that you can make XML-RPC calls from within the google app engine sandbox. By default such calls will be blocked but the article shows who to provide your own ‘Transport’ object to break out of the sandbox.
http://brizzled.clapper.org/id/80
I haven’t tried the technique yet as there are a few changes to make but I hope to try it soon and report back!
In the mean time if anybody has tried the technique please let us know how you got on!
Just came across a bit of a time-waster in the PHP SimpleXMLElement lib. Usually if you’re accessing an element called, say ‘username’ you use the follwoing syntax:
However if the element has a minus sign in its name, like ‘user-name’ you have to use the following syntax instead:
If you use the original syntax no data will be returned, mad stuff, I would have wasted much more time on this if it wasn’t for this post - Thanks for the dig-out!
Q: Is it possible to use the ubercart Option Images module (uc_option_image) with a custom product display template, via Content Template (contemplate) or a custom node.tpl.php?
A: Yes, you just need to manually call the attribute image into your template with a line of PHP code.
The ubercart Option Images module (uc_option_image) is a really nice module that allows you to provide an alternative image for product attribute options - when the visitor views a product and chooses an attribute option (say colour: Red) the attribute displayed image will change to the one for that option - very nice especially for online shops that sell, say clothes in different colours and patterns etc.
The strange thing is that (at the time of writing) the Option Images 6.x-1.4 doesn’t work and doesn’t even install! Luckily some good folks have worked around the problems and come up with a fixed version that does work (with a bit of TLC) - I have written an article about getting option images to work with the patched version on the Pride Design website here –>
http://www.pridedesign.ie/content/ubercart-option-images-installs
This should hopefully help you to get it up and running…
Now, by default this module only attaches the option image to the default ubercart product display, if you are using a custom product template (as I always do) via the Content Template (contemplate) module or via a custom node.tpl.php file then the option images will not be displayed.
To get around this you just have to pop a bit of PHP code into you template at the point at which you want the image to display as follows:
�
This should do the trick. If you want only the attribute option image to be displayed (i.e. instead of the product image) then just replace your current product image display code with this.
Software development can sometimes be a comical affair, I have just been caught out badly by a strange gotcha - it appeared that #pragma once stopped working on a Visual Studio C++ project on which I have been working. I was getting plenty of error messages about redefined classes!
Well it turns out that I had left a copy of one of my header files lying around in one of the project folders. As pragma once uses a header file’s full path to figure out if it has already opened it, a situation arose whereby both files were included and compile errors flooded in (despite the pragma onces)!
Well removing the (accidential) copy of the header file fixed the problem - boy do I feel stupid, I hope this post may help someone with a similar problem in the future!
I ran into a problem the other day with .NET’s Convert.ToDecimal() , it turns out that it doesn’t handle scientific Notation! Pass it something like “8E-5″ and the poor thing just throws an exception…
The software in which the problem surfaced was developed as a web application that must deal with numbers read from an Excel chart and so the formats encountered are many and varied!
This post points out that you can use this instead:
But just to be safe I am now using:
And it does work for Exponents, hopefully along with everything else!
I have been developing a web application for one of our clients using drupal, it’s a dashboard type data visualisation system that consumes and displays data over an intranet from their software systems. I have been using google charts with great success.
The Chart API module for drupal is very nice, it lets you quite easily incorporate google charts into your web site or application without having to get into the details of the google chart API itself, and the charts themselves look great - just the kind of thing to cheer up a busy software developer. However it deosn’t seem to support Radar or Polar charts. There is no mention of them in the documentation, no example on the examples page. There is also no symbol such as ‘CHART_TYPE_RADAR’ defined in the module as there is for the other chart types, for example ‘CHART_TYPE_LINE’ defined for line charts.
So is it possible to plot radar charts using the Chart API module? I consulted the google chart api and found that the radar chart type is donated as ‘r’, so I tried creating a simple chart and just set it’s type to ‘r’ (rather than say CHART_TYPE_LINE) and it worked just fine!
$chart = array( ‘#chart_id’ => ’sink_radar’, ‘#title’ => chart_title(t(’Failures by Sink’), ‘001334′, 15), ‘#type’ => ‘r’, ‘#size’ => chart_size(400, 240), ); $chart['#data'][] = array(20, 30, 15, 70, 90, 20); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink1′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink2′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink3′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink4′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink5′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink6′); echo chart_render($chart);
This code yileds a chart like this:

I ran into a funny problem recently with Ridge’s debian fileserver - I connected a second external USB drive to it and it stopped working! It always had one external USB drive connected, this was mapped to /dev/sda1 and auto-mounted in /etc/fstab along the lines of:
Everything was running nicely until I introduced a second usb device, this time a large flash disk onto which our automatic backup script is going to periodically dump an encrypted tarball (to provide an easy way for us to move encrypted backups off-site.)
Anyway, I saw that the second disk was mapped to /dev/sdb1 and I optimistically modified /etc/fstab to cater for the new flash disk along the lines of:
/dev/sdb1 /mnt/flash vfat rw,users,umask=0 0 0
So far so good, after reboot both file systems successfully mounted. But after the next reboot things were not as expected, the original disk was mounted onto the new ‘flash’ mount point and the FAT flash disk was not mounted at all!
With the second USB disk connected the way in which the disks were mapped to Linux devices would change randomly every time the system was rebooted - sometimes a disk would appear as /dev/sda1 and sometimes as /dev/sdb1. As you can imagine this completely ruined the file system setup as configured in /etc/fstab!!
I had never encountered this before, but after a little research I found a work around - this involved mounting the disks by label rather than by the more traditional device name.
All labelled disks/volumes can be found in /dev/disk/by-label/ , these labels are static and can be used to mount their volumes (instead of using the non-static /dev/sda1 etc.). Only labelled device appear in the by-label directory, so if you don’t see a disk you may have to give it a label using the tune2fs command. I had to give my original USB disk’s volume a label, I determined that it was currently mapped to /dev/sdb1 and issued the following command to label it as ‘external’:
Now with both disks labelled I modified /etc/fstab as follows:
/dev/disk/by-label/CORSAIR /mnt/flash vfat rw,users,umask=0 0 0
And thankfully that fixed the problem! - with the IT systems purring along I can get back to the many more mundane aspects of running a software development consultancy…
I was making some mods to an old ASP .NET web app today when I discovered that I could no longer properly debug it - when I started the debugger, VS2005 would launch IE8 and load the app but would then just detach and exit debug mode! I have been running IE8 for a few months now and figured that the problem might have something to do with IE8 and sure enough it did!!
I found this excellent post which details a simple fix for the problem - I can now happily debug again! It seems that the fix prevents IE8 from spreading itself across multiple processes this was confusing the poor VS2005 debugger..
Just in case I forget how to do it - here a link to a post that tells you how to change the add to cart button in ubercart, http://www.pridedesign.ie/content/ubercart-style-add-cart-button
very handy indeed!