Spring Roo Tip

I’ve been working on a Spring Roo application and needed to add a domain class used to model application users. I tried using the default Roo command for adding the User domain class “entity jpa –class ~.domain.User –testAutomatically”, but Roo does not like that method because the name “User” is a reserved word in SQL. However, you can overwrite the command and force Roo to create a User class by adding –permitReservedWords to the command (entity jpa –class ~.domain.User –permitReservedWords –testAutomatically). I’m not sure if this is the most secure way to do things, but it is an option.

Posted in Uncategorized | Tagged , , | Leave a comment

Maven Tip

Here is a maven command to list all of the jar files that project is dependent on:

mvn dependency:list

Posted in Maven, Programming | Leave a comment

Getting Current IP Address in Python

The following code example retrieves the current ip address. I know this works for Python 2.7.

import socket
ip_addr = socket.gethostbyname(socket.gethostname())

Posted in Programming, Python | Tagged | Leave a comment

Useful Unix Command

I’m a fan of cygwin. I needed a command alias for listing only directories using the ls command, so here is what I came up with:

ls -l | grep “^d”

I then added an alias to my .bashrc file like so:

alias ld=’ls -l | grep “^d”‘

Posted in Unix | 1 Comment

A New Word

Today I was working on a function to convert a map coordinate from degrees-minutes-second format (e.g., 125° 23′ 42” W) to decimal degrees (e.g., -125.395) and I came across the word Sexagesimal. It is not profanity.

Posted in Humor | Leave a comment

Django Fixtures and Dumping Test Data

I do quite a bit of work with the Python based Django framework.  Django is a flexible framework that leverages the Python programming language.  A typical development scenario for development using Django involves writing models and/or views then running unit tests to see if these changes break the application.  If you create test data for the unit tests using Django’s fixtures then you might have used Django’s “manage.py dumpdata” to export test and development data to one of your application’s fixtures.  If you have used the dumpdata command then you may be experience an error message when running the unit tests that indicates a primary key error when loading “contenttypes”.  The unit tests will run, but this warning can be troublesome.  There is a simple solution. When using dumpdata specify the “-e contenttypes” switch to exclude the “contenttypes” model.  I also suggest specifying “-e contenttypes -e auth”.  This should eliminate the primary key error or warning message when you run the unit test.

Refer to this link for more information.

Posted in Django, Python | Tagged , , | Leave a comment

Ecosystem Web Services

Over the last few months I’ve been volunteering some of my time to develop web services that deliver geospatial data for eco-systems. My eco-system web services help support the AFS Standard Methods for Sampling North American Fishes website. The initial version of the eco-services site can be found here. Right now the eco-services site only provides level 1 eco-region data as described here. The eco-service is accessed through a REST and JSONP call. Future enhancements are on the horizon.

Posted in Uncategorized | Tagged , , , , , , , , , , | Leave a comment

Grails 2.0 – PostgreSQL

I’ve been working on a Grails 2.0 app that uses PostgreSQL as the back-end db. One of the tables I have been designing is a Users table, which I named “user”. PostgreSQL doesn’t seem to like “User” as a table name, at least not in the context of the Grails/Hibernate sql generation tools. Consequently, in the domain model for the User class I had to set the table name to something other than “user”. In the model’s Groovy class I set the following:


static mapping = { table "tblUser" }

Posted in Uncategorized | Tagged , , | Leave a comment

HTML Output from Rails Helper

In order to render html returned from a Rails (3) helper the returning string should have the .safe_html method. Here is an example:

def my_custom_tag
html = ''
html Hello'
html.safe_html
end

 

Posted in Uncategorized | Tagged , , | Leave a comment

Moving Window Between Monitors in Windows (7)

If using a laptop connected to an external monitor and an application window is displaying on one monitor, but you want it on another you can press SHIFT + WINDOW + LEFT/RIGHT ARROW to move the window between monitors.

 

Posted in Uncategorized | Tagged | Leave a comment