- 20 Sep 2008 -

I struggled for a long while to get the unix “grep” program to do a true multi word search.  However, grep merely searches within lines, so only files that had all words in the phrase on the same line would be returned.  I wanted to know which files in the current folder contained the words “Reuben”, “Onida” and “Cornelius” anywhere (and in any order) within them.

The solution turned out to be to grep three times and pipe each result into the next:

grep -l Reuben * | xargs grep -l Onida | xargs grep -l Cornelius

The first grep -l Reuben * returns all file names that contain the word “Reuben”.  Piping that to xargs makes the second argument essentially grep -l Onida file1 file2 file3 file4 etc.  This chaining can go on for as many search phrases as you have.  The final output is a list of files that contain every word in your search phrase.

This is in the babble category tagged as , ,

Add a comment »

Over the past year, I scoured Google for an Eclipse plugin that would launch the terminal in a specific folder for me. I was picturing something that added a right-click context menu option for opening any folder in a project in the console so I could do command line stuff on it.

I would do a bunch of searches and find nothing, give up for a few months until I needed the functionality again, do a bunch of searches, give up, and so on…

…read the rest of this entry »

This is in the babble category tagged as

11 comments »

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 , , , ,

4 comments »

- 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 »

« Previous Entries Next Entries »