WordPress – Can’t Approve Comments

If you’re using wordpress and all of a sudden you can’t approve comments, then try deactivating the ‘Cimy Swift SMTP’ module – It worked for us!

 

Compare and Swap added to Google App Engine Cloud

On Wednesday Google released v1.5.3 of their App Engine cloud platform SDK, the release notes are here. There are some interesting new additions to the API, however the one that really caught our eye is the addition of a Compare and Swap (CAS) primitive to their Memcache API.

 

A CAS primitive can be used to build all sorts of higher level synchronisation primitives like mutexes etc. and so the existence of such a primitive may be very handy for synchronisation of GAE taskqueue tasks! The SDK is currently quite lacking in such synchronisation tools so it will be interesting what can be done with this new addition.

 

Eclipse & Google App Engine – Variable references empty selection: ${project_loc}

If, when you try to debug or run a PyDev Google app engine project in eclipse after following these instructions, you may experience this error message:

 
Variable references empty selection: ${project_loc}
 

If you get this error you should be able to make it go away by first clicking on you project in the PyDev package explorer window before trying to debug or run your project. Eclipse & PyDev can be just a little quirky…

 

Google App Engine error 500 on Upload to Cloud

Q: I keep getting ‘Error 500’ when I try to upload / deploy to my code to the google app engine via ‘appcfg.py update’ or similar, what’s going on?

 

A: Most often this error is caused by problems with the Google cloud infrastructure and as such there is nothing you can do to fix the problem except wait and keep retrying every now and again, the problem normally goes away in an hour or 2. Do however check that your various quotas havent run out.

 

Don’t be suprised if when you view the System Status table, you see that it is all green – in our experience this status grid rarely represents the status of the cloud as experienced by developers and users. You could report the problem to Google here as suggested in the error message however if you were to report every service interruption you wouldn’t be left with very much time to do much else… ;-)

 

Google App Engine – TransientError in Cloud

We were engulfed by a blizzard of Google task queue ‘TransientErrors’ over the weekend, the ‘TransientError’ is one most ellusive of google app engine errors. This is what the official documentation has to say of it:

 

exception TransientError(Error)
There was a transient error while accessing the queue. Please try again later.

This very detailed description has left many scratching their heads wondering (a) Why they are getting the errors and (b) What should they do about them!

 

So far, the best description I could find of the error is here:
http://osdir.com/ml/GoogleAppEngine/2009-06/msg01337.html

 

A TransientError is an unexpected but transient failure. Typically it
is a deadlined or otherwise missed connection between two backends in
our system. We distinguish TransientError from InternalError to say
that transient errors failed but were expected to succeed (and
retrying will probably work), whereas InternalError is quite
unexpected and retries will have no effect.

 

This seems to suggest that you shouldn’t worry too much about them as they happen rarely and the automatic retry should work – no harm done…

 

In our experience however it seems that the error is far from transient in that it often occurs in batches with the retries experiencing the error too – it causes our app to grind to a halt, the whole thing tends to snowball. It is like something fairly serious goes wrong with the google cloud and things just stop working.

 

Does anybody know if there is any reliable way of handling these errors when they occur?

 

And more seriously, can an application be made reliable on the google cloud with nasty undocumented errors like this cropping up in batches every few months? I suppose software development for cloud environments is still really only in its infancy, developers and platform suppliers have a lot to learn, but unexplained stealth errors like the TransientError really doesn’t help the situation!

Store Datastore Models in Google App Engine Cloud

Yesterday I came across this gem of a Blog post on Nick Johnson’s Blog about how to go about efficiently storing Google App Engine datastore objects in Memcache on the cloud.

 

I had previously read that the Datastore models were large and carried around a lot of baggage (software baggage that is, not the stuff on wheels!) – this is one reason why you are discouraged from passing them as arguments to tasks on task-queues.

 

This blog shows you how to extract and store only the essential info from the objects for storage in memcache using th methids model_to_protobuf () and model_from_protobuf()

 

Anyway, enough chat – here’s the post:

 

http://blog.notdot.net/2009/9/Efficient-model-memcaching

 
 

Python – Get Object’s Class Name

Q: How do I get a python object’s class name?

 

A: Use the object’s __class__ attribute and then get its __name__ attribute.

 

Another python introspection gem, to get an object’s class name just access its __class__ attribute, for example you can define a method to return the object’s name as follows:

[code]
def get_runtime_type_name(self):
  return self.__class__.__name__
[/code]

Python – Get Name of Current Function

Q: How do I get the name of the current python function, I want to output its name as part of some logging information.

 

A: Just import the ‘inspect’ module and call its stack() method to get access to the call stack, for example, to get the name of the current function:

 

[crayon]
import inspect

fn_name = inspect.stack()[0][3]
[/crayon]

 

The first index indicates the stack position, so to get the name of the parent calling function use:

 

[crayon]
import inspect

fn_name = inspect.stack()[1][3]
[/crayon]

 

or to define a function that returns the name of the function from which it was called:

[crayon]
import inspect

def get_current_function():
return inspect.stack()[1][3]
[/crayon]

 

Introspection is one of the really cool features of modern software programming languages!

UML Design Package Options

I have been at software design for quite a while now and UML has been my constant companion for a good part of this time. Whenever I think of UML I think how great it is for helping with software design, but also how more or less uinversely rubbish most of the UML design applications are.

 

I have used tonnes of them, the big and expensive ones, the small funky ones and the in between ones and they all have their problems. I especially hate the ones that require at least 100 mouse clicks and popup options screens to get anything done, they are a real RSI minefield! Sometimes I think you would be better off with a pen and paper…

 

Every so often I go and on the hunt for new or improved offerings, testing them on real projects. This all takes time and I haven’t gone on such a hunt for 2 years now – So could anybody please recommend what they think is the best UML package out there at the moment and hopefully save me some time?

 

Here are some of the things I would like from a design app:

 
  • Efficient user interface, the less clunky context menus and mouse clicks the better!
  • Not tied to any particular programming language
  • Affordable (open source would be great!)
  • Standards Compliant (no renaming or reinventing of bits of the UML)
  • Easy to copy diagrams out into other documents
  • Good support for the different diagram types
 

Oh also, are there any decent cloud offerings?

 

Cheers – looking forward to hear your suggestions!

Microsoft C# Coding Style Guidelines & Visual Studio

These days most software developers need deal with more than one software development technology and programming language on a day to day basis. This often means that they have to switch back and forth between coding styles, with this in mind I noticed that although the MS coding guidelines for C# in .NET recommend K&R style braces for code blocks, e.g:

 


if (sneeze) {
  nose.Blow();
}

 

By default Visual Studio’s auto code formatting stuff will format your code with braces on newlines, e.g.:

 


if (sneeze)
{
  nose.Blow();
}

 

Very interesting indeed, I wonder are there internal coding style conflicts within Microsoft…