Entries by Erik Pragt

Pure Python: Reversing a String

Except for programming examples, you almost never encounter the need to reverse a String. But if you would, how would you do it in Python? There are many ways, but there are two Pythonic ways, and depending on your taste, or if you have memory constraints, you might pick one over the other.

This […]

Pure Python: The in keyword

The in keyword has a number of uses. The two most used functions to check if a value is in a range of values, the other usage is used when traversing a tuple in a for loop. A first example of using the in keyword is when checking for the existence of an element in […]

Pure Python: Multiplying Strings

Whenever you want to create a repeat String in Python, you can use the overloaded * operator. You can do so like this:

or

(Note the difference in double and single quotes). Under the hood, when Python attempts to multiply two objects, it first tries to call the left object’s __mul__ method. The […]

The curious case of Grails’ generate-all

I’ve been using Grails for some years now, and my normal workflow is something like: grails create-app, followed by creating some domain class, followed by a a grails generate-all, and a grails run-app. It helps greatly in selling Grails, and people are usually quite impressed by the speed of having an up and running hello-world […]

Upgrading Grails 2.2.4 to 2.3.0

I’m currently working on a trivial Grails application, running on Grails 2.2.4. However, two days ago, Grails 2.3.0 was released, providing many new features, like testing with Spock by default, Hibernate 4, etc. However, when upgrading to 2.3.0 using

I received the following error:

I turns out grails upgrade doesn’t fix this for […]