Ever since upgrading to Firefox 3, I’ve been without my beloved LastTabfirefox It was but a simple extension: it allowed me to control-tab back and forth between tabs that I was working on.  With the many (many) tabs I like to keep open, well, being able to control-tab back through them in the order I last saw them was a real time saver.

Something better has finally come along: ctrl-tab.  It is as simple as LastTab…only prettier.  It apparently is slated to be included in Firefox 3.1.  Very nice.

(It appears that LastTab has been upgraded to work with 3.0 finally.  I’m a little disappointed I’m only finding out about this now.  I had added the writers blog to my Reader with the sole intent of being able to get the updated extension on its release date…but no!  No announcement was made by Timothy Humphrey on this blog.  For months now I’ve been reading his mumbo jumbo posts for naught!  Bah!)

This is in the babble category tagged as ,

Add a comment »

- 09 Aug 2008 -

When writing a dbunit test for the CohortServiceTest, I encountered this non-informative error:

org.dbunit.dataset.NoPrimaryKeyException: COHORT_MEMBER

In the Cohort mapping file the cohort_member table is mapped like any hibernate collection:

<set name="memberIds" cascade="none" lazy="true" table="cohort_member">
    <key column="cohort_id" />
    <element column="patient_id" type="integer" />
</set>

It looks normal enough.  Cohort.memberIds is a list of integers defined by the cohort_member table.

Hibernate automatically creates the schema in our test hsqldb because we have hbm2ddl set to “auto”.  The problem arose here because hibernate wasn’t creating a dual primary key on the member_ids table.  Digging through the code, I found that Hibernate only assumes the primary keys are the columns that set to “not null”.

The corrected mapping with both columns set to be not-null:

<set name="memberIds" cascade="none" lazy="true" table="cohort_member">
    <key column="cohort_id" not-null="true"/>
    <element column="patient_id" type="integer" not-null="true"/>
</set>

Now hibernate creates the table with primary keys and hsql is happy again.

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

1 comment »

- 07 Aug 2008 -

Meghan’s laptop hard drive recently died.  It was a painful death.  One consisting of much clicking and clacking with no data retrieval.

Of course she didn’t have any backup solutions, so it was looking like her data was gone forever.

She cries, “Unacceptable!”

I retort, “But its expensive!”.  I cry.

So I do some googling for hard drive recovery reviews and companies.  I call a few and they all say it’ll be in the thousands of dollars.  So I turned to my trusty friend, ebay.  I found one company called Hard Drive Savers offering invasive recovery it for only $300.  (I had taken the top off my drive already and saw it was a hardware problem, so I knew I needed invasive).

I was skeptical, so I did some more googling to get some background on HDDSavers.  I found relatively few comments on them, but all were good.  So off went Meghan’s hard drive.

Lo and behold, a week later a dvd arrived with the contents of the folders she needed!  John over there at hddsavers came through!  I highly recommend them for anyone needing to recover data from a dead hard drive.

Disclaimer for all you doubters out there:
I am in no way affiliated or obligated to hddsavers.com.

Feel free to contact me via the comments (won’t be published) if you want any more information.

This is in the babble category tagged as , ,

Add a comment »

While migrating from JUnit 3.x to the new 4.x framework, one method I found that was missing was Spring’s getLoadCount() method on the
AbstractDepenpendencyInjectionTest. The value returned allowed us to tell whether a test was running by itself or in a group a tests (like with the ant junit-report target or right-clicking on /test/src and choosing run-as junit test).

Having this method was useful for two reasons:

  1. A test like CreateInitialDataSet that is meant to be configured and run alone.  If this test sees that its being run in a group, it returns early and doesn’t actually run the test
  2. The module tests needed to have the application context refreshed before running.  To do this, I made the previous test mark the context as “dirty” so that the test directly following it would have a fresh app context.

There were actually two separate solutions:

  1. All tests extend BaseContextSensitiveTest for convenience methods and setup.  Every junit class will invoke this class and its constructor.  By adding a static variable loadCount and incrementing that in the constructor, I am able to know how many tests have been run up to that point.
  2. The application context doesn’t need to be marked as dirty.  The dummy method could actually be removed without replacement.

This is in the openmrs category tagged as , ,

Add a comment »

- 25 Jul 2008 -

I was recently tasked with finding out the number of methods in each class in each package inside of OpenMRS. My first thought was to write a java class to do some reflection. My second thought was to find a java class that someone else had written and use that. My third thought was to find a way for Eclipse to do it.

I really should have jumped to that last one first.  Googling for my second thought gave me nothing useful.  However, simply adding “eclipse” to my search term brought up the Metrics plugin as the first result!  The Metrics plugin counts all different types of things.  Lucky for me, “number of methods” just happens to be one of them.

To get the counts working for you, follow these easy steps:

  1. Add http://metrics.sourceforge.net/update to eclipse as a plugin update site
  2. Turn metrics on for your project:
    1. Right click on the root of your project in Package Explorer view
    2. Choose Properties–>Metrics–>Enable Metrics
  3. Do an Eclipse clean rebuild
  4. Click on the root of your project in the Package Explorer
  5. Open the “Metrics” view

These are the relevant statistics from the OpenMRS project:

The second api/web are from the test package.  We have a lot of work to do to catch our total number of unit test methods up with our number of api methods.

I’ve also uploaded the entire OpenMRS metrics output.

This is in the openmrs category tagged as , ,

Add a comment »

« Previous Entries