Category Archives: tech

mysql history munging

At work, I run the mysql clients on multiple hosts with multiple versions. My home directory is a network mount and thus my .mysql_history file is shared between all these hosts. Often the command history gets weirdly munged, with spaces converted to \040 — the character sequence for the octal escape code for ASCII space. Here’s a little workaround/fix:

/bin/sed 's/\\040/ /g;' ~/.mysql_history > ~/
/bin/mv -f ~/ ~/.mysql_history

Make that into an alias or script. Just make sure you quit all instances of the mysql client before running. Then when you restart, the history should get reloaded correctly.

I haven’t bothered to figure out why this is happening, i.e. what the version problems are or 32/64 bit or readline/editline or the sequence of starting multiple clients on multiple hosts…

CKEditor spellchecker.jsp

Here is a JSP version of the server-side script needed for the CKEditor plugin for aspell. It was inspired by/based upon a post in the forums. I’ve made some mods to get it to work, be more complete, and be more like the current perl version, with fixes recommended in the main thread. It’s not fully tested but hopefully it will help somebody.

Note that for best results, you will need Apache Commons Lang. You can comment out that code but then you’ll get false-positive misspellings of partial words before and after the HTML entities.

Install the attached file as .../aspell/spellerpages/server-scripts/spellchecker.jsp


Grails standalone classes need package

I was reminded again today that standalone classes in Grails must belong to a package. That is, a class in src/groovy or src/java needs to be in a package. For example:

file: src/groovy/mypackage/MyClass.groovy

package mypackage
class MyClass { ... }

If the class is without a package (appearing as src/groovy/MyClass.groovy), it will compile correctly but no Grails classes (like your controller or service) will be able to find it, generating an org.codehaus.groovy.control.MultipleCompilationErrorsException with the message unable to resolve class MyClass

GORM nullables and unsaved transient instance

I have nullable one-to-many relations in Grails/GORM and started getting “object references an unsaved transient instance” exceptions from Hibernate. In the Grails forms, selecting a blank/no-selection value for the field sent''. GORM then tries to create a new empty object and during the save(flush:true), it complains with the exception:

org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: MyOtherClass

This stackoverflow answer gave me the clue about params and I now remove the nullable field from params when it’s blank.

def myObject = MyClass.get(
if (null == || '' == {
        myObject.myOtherObject = null
        } = params
if (!myObject.hasErrors() && true)) {

Moinmoin calls home

While on a ship at sea, I was using Moinmoin wiki to record some local documentation. We had internet (usually, except when the ship pointed a certain direction), but it was a bit slow and expensive. So I was annoyed to discover that Moinmoin was calling home in several places. Mostly it’s in the Help documentation, illustrating how to do external linking via {{...}} embedding. It was still annoying and tended to look up my web browser while I was trying to get local help when the internet link was down. Here’s the list of offending underlays I found in 1.8.7:


I reported the situation, but the developers don’t seem to care about even placing a warning in the documentation.

Phusion passenger calls home

While on a ship at sea with slow (sometimes no) internet, I was developing a Ruby on Rails application for local (onboard/intranet) use. I discovered that Phusion passenger (modrails) calls home. This error layout file:


has a stylesheet link to

Theoretically this layout will happen only in development, because we all completely test our code, but you may want to comment the offending everywhere you have it installed. At best this is rather annoying on slow connections or disconnected laptops. At worst, it’s some devious tracking of modrails users.

The image link could be removed with no loss of functionality. To maintain the “prettiness”, it could be loaded as a data URI although older browsers don’t recognize that. In any case, the developers are rather uninterested in changing.

Security policy permissions for Grails in Tomcat

Here are the permissions I’ve used for Grails apps deployed to Tomcat running the Java security manager. The Grails 1.0.x permissions are for a simple CRUD app. So far the Grails 1.1 permissions are just for a Hello World app. They’re not cut-and-paste: some thought is required to apply to individual server setups and some duplication is present. The grants go in the conf/catalina.policy file and restarting Tomcat is required. Unfortunately, it seems impossible to completely isolate these per-webapp since the Groovy and Grails code presents itself in funny ways.

I’m using Tomcat 6.0.18 and used both JDK 1.6.0_12 and 1.6.0_13 running on some sort of Linux.
Continue reading