Entries by Kevin Godden

#Python Convert datetime to Unix Epoch Timestamp

There doesn’t seem to be a way to get a Unix timestamp directly from a datetime object in Python, the best workaround example I could find is:   from datetime import datetime import time now = datetime.now() u = str(long(time.mktime(now.timetuple()))) This gets the timestamp as a string, it seems a bit long winded, so if […]

Dynamic Tile Generation for Microsoft #Deepzoom

Here is an old but interesting article about how to dynamically provide image data to Microsoft Deepzoom as the user pans and zooms:   http://msdn.microsoft.com/en-us/magazine/dd943052.aspx   Scroll to the section called ‘Making Dynamic Deep Zoom Even Better’, this could be very useful! I had thought that it would be easy enough to find more posts […]

#GAE Development Server Hangs updating index.yaml

Since a recent Google App Engine SDK release ( 1.6.3?) the development server (localhost) has started appearing to hang every now and again this causes it to run very slowly. During the ‘hang’ the console output says that it’s updating index.yaml. Sometimes this ‘hang’ can last a few minutes, after a few minutes server will […]

Windows Installer – The Specified path is too long with subst.

I was testing an installation script (produced by a Visual Studio 2010 set-up project) on a open box virtual machine and was intermittently getting a lovely error message telling me that the ‘specified path is too long’, even though the path that the error message displayed as being incredibly short.   Anyway, I was installing […]

Adding a Menu Item to App’s System Menu in .NET

Here’s a good stackoverflow post about how to go about adding a menu item to you app’s system menu in .NET, the system menu is the one that pops down when you click on your app’s icon:   http://stackoverflow.com/questions/4615940/how-can-i-customize-the-system-menu-of-a-windows-form  

Get a Visual Studio 2010 .NET Setup Project to Update a Previous Installation

Here is a good post about getting an Visual Studion Setup project to generate a .msi that will update a previous installation rather than demanding that the existing install be uninstalled before it can be reinstalled:   http://www.simple-talk.com/dotnet/visual-studio/updates-to-setup-projects   I followed the steps in the ‘How to update your product’ section.   The only catch […]

Google APP Engine now supports Python 2.7

On Monday Google announced that their cloud platform, Google App Engine now fully supports Python 2.7 which is great news!   More details can be found here:   http://googleappengine.blogspot.in/2012/02/announcing-general-availability-of.html   and here:   http://code.google.com/appengine/docs/python/python27/newin27.html  

get_value_for_datastore() example

When using a db.ReferenceProperty in google app engine, the function get_value_for_datastore() can be used to get the key of a referenced datastore model without causing GAE to automatically fetch the model – this can be very handy if you are trying to optimise the performance of your cloud code.   from google.appengine.ext import db class […]

Google App Engine – Access ReferenceProperty without fetching referenced object

In google app engine’s cloud based Datastore db.ReferenceProperty can be used in a Model to reference another Model like this:   from google.appengine.ext import db class A(db.Model): b = db.ReferenceProperty(B) class B(db.Model): name = db.StringProperty() In the above example A references B, if you have an object of type A you can directly access its […]