Over time the messages in our Spring message.properties files grow stale. When a developer updates/changes code he/she doesn’t necessarily go to the messages.properties and remove all the keys that they removed from code. This has not detrimental effect on code, it just means that when translating into a new language the translator is potentially more work than they need to.

I wrote this quick shell script to loop over the file and do a recursive grep for that key. The key is considered “used” if it exists in the current directory with quotes around it (single or double). This WILL NOT find keys if they are only used programmatically. (e.g. VAR + “.started”)


# Loops over all the keys in the given messages.properties file
# and looks in the current directory for the string in quotes.
# Results are printed to stdout
# use: (from the “web” dir in openmrs)
# sh ./findunusedmessages.sh WEB-INF/messages.properties

props=`awk -F= ‘{print $1}’ $propfile`

echo “These property keys were not found in the code base:”
for prop in $props
#echo “Looking for property: $prop”
if [ ! -z “$prop” ];
total=`expr $total + 1`
output=`grep –exclude-dir=”.svn” -re “[\’\”]$prop[\’\”]” *`
if [ -z “$output” ];
echo “$prop”
count=`expr $count + 1`

echo “done! Found $count possibly uneeded message keys in $propfile (out of $total total keys)”

Download the file here: findunusedmessages.sh

This is in the babble, openmrs category tagged as , , , ,

Add a comment »

- 01 Apr 2010 -

We held a training here in Indianapolis in February. Darius Jazayeri and I led the talks that walked through all development aspects of OpenMRS. You can see the agenda here: http://openmrs.org/wiki/OpenMRS_Developer_Training_Week_8-February-2010

Overall I was quite pleased with how the training went. There were more people involved that I expected: 40+ were in attendance physically at the Regenstrief building at some point during the week and another 10-15 that participated via the online web casts! One very positive outcome from the week was that Darius and I created a lot of wiki pages directly from the content we were talking about. This gave us a blueprint from which to talk while preserving the content for future users to see. I am still waiting to hear from Michael about the long-term availability of daily recordings.

I really see these types of trainings being a good long term revenue stream for OpenMRS. Obviously it won’t be able to be the only source, but if we had 3-4 trainings a year at various locations around the globe we would be able to hit a large number of developers. (Doing an implementer-centered training is a whole other matter) We learned a lot through this training: get the word out earlier, give out pre-training required reading, and write the entire week’s lesson plans prior to starting the training!

This is in the openmrs category tagged as , ,

Add a comment »

- 26 Feb 2010 -

Andy sleeping in front of computer My wife gave birth to our first son on Saturday: Andrew Benjamin Wolfe. He was a very healthy 8 pounds and 21 inches long. He has been eating and sleeping very well. Sleep is at a premium in the Wolfe household and we take it whenever we can get it. Our daughter, Eden, is 14 months old, and does her best to keep us both up all day to play with her!

I’ve been attempting to keep up with email while at home, but Andy has been fighting me for computer time!

This is in the babble, openmrs category tagged as ,

Add a comment »

We have well over 50 million rows in our obs table. Using the simple “update obs set uuid = uuid() where uuid is null” would bomb out with a “The total number of locks exceeds the lock table size” error.

I ran this for a few hours to get through all rows. (Note that it overwrites any uuids that are currently there)

Copy this into a sql script and run it with “source” in mysql at command line.

drop procedure update_uuids;
delimiter //
create procedure update_uuids() begin
set @max = (select max(obs_id) from obs);
set @x = 1;
set @y = @x + 100000;
update obs set uuid = uuid() where obs_id >=@x and obs_id <@y; set @x = @y; until @x > @max
end repeat;
delimiter ;
call update_uuids();

This is in the openmrs category tagged as , , ,


OpenMRS recently added a non-null uuid column to every table.  All of our dbunit xml files needed to be updated to insert values for this attribute.  I wrote the following shell script to loop over all xml files under the current folder and add a uuid attribute to all rows that didn’t have an attribute already.  There is a bit of logic in there to ignore certain tables because those tables didn’t actually get any uuids.

…read the rest of this entry »

This is in the openmrs category tagged as , , ,

Add a comment »

« Previous Entries