OpenMRS Logic-a-thon

November 6, 2008

So far, so good at the OpenMRS! To our surprise, we’re actually getting code written. We’re not sure if it’s because of Tammy’s amazing prep work or because Paul & Hamish couldn’t make it. 🙂

Looking forward to tomorrow…

Apache mod_rewrite: rewriting URLs based on HTTPS vs. HTTP

October 29, 2008

On occasion it’s helpful to be able to pass both SSL and non-SSL requests through the same Apache configuration file.  Using mod_write‘s RewriteCond and RewriteRule, you can perform URL rewriting differently depending on whether or not the connection is via HTTPS:

# For SSL connections %{HTTPS} is "on" -- the following will
# permanently redirect all non-SSL requests from remote sites to SSL
RewriteCond %{HTTPS} !on
RewriteCond %{REMOTE_ADDR} !127.0.0.1
RewriteRule (.*) https://example.com$1 [L,R=301]

The first condition is true if HTTPS is not on (the exclamation mark negates the condition).  The second condition is true for any remote address other than 127.0.0.1.  Since consecutive RewriteCond statements are AND’ed, the RewriteRule will only be applied to remote non-SSL requests and will permanently redirect (with HTTP code 301) all requests to an https address.

Tags

Keiahooooooooooooo!

October 12, 2008

When Lorrie offered to get me a Colts jersey last year, I had to pick a player.  That’s when I saw Freddy Keiaho single-handedly (literally, since one hand was in a cast at the time) tackle both the blocker and the ball carrier in one fell swoop.  I saw his passion and I knew that I could proudly wear a #54 jersey.  Now every time Keiaho makes a tackle, we shout out “Keiahoooooo!”  And by the end of a game, my voice is hoarse!

After sitting in our basement watching the Colts on the big screen break the curse of Lucas Oil Stadium with an awesome 31-3 win over Baltimore, Lorrie and I decided to go for a walk in our neighborhood.  Lorrie said it was too hot to wear a jersey and took her Harrison jersey off, but I insisted, “I’m not wearing it for warmth, I’m a fan!”

Just as we rounded the corner of our neighborhood clubhouse, a car pulled up and a young guy leaned out of the window.  “Hey there.  I’m Freddy Keiaho!”  It was really Freddy Keiaho, his wife, and a bunch of her sisters.  They saw my jersey and pulled over to say hi.

Freddy asked if we have a pen… of course, we didn’t.  So, they invited us to climb into the back of the car and they drove us to our house to get a pen.  Unbelievable!  Lorrie and I were very impressed with him.  An incredibly polite young gentleman.


Woohoo!  No washing this jersey!


Freddy Keiaho and a Freddy Keiaho fan


Traci, Freddy, Traci’s sisters and me

What are the odds?!?  Only in a great city like Indianapolis!  Go Colts!!!!

jEdit won’t start after OS X Java update

October 8, 2008

I noticed that jEdit would no longer start on my MacBook Pro with OS X 10.5.5.  I’d try to run jEdit via Quicksilver as usual, but it wouldn’t open.  Double-clicking on the jEdit application icon was just as useless.  Nothing happened.  I checked for anything that could be blocking it and restarted my laptop with no change.  I upgraded to the latest version of jEdit but it still wouldn’t run.

It turns out that the latest Java update from Apple managed to break jEdit’s launch.  After a decent amount of Googling, I ran into the solution.  Basically, it involves replacing a symlink with its target.

rm /Applications/jEdit.app/Contents/MacOS/jedit
cp /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub /Applications/jEdit.app/Contents/MacOS/jedit

And it even came with an explanation:

The basic problem has to do with symlinks to the latest java application stub. It used to be that you could symlink to the stub, so that you could use whatever was installed on the user’s system. Now it seems that there are some problems with the launcher looking for files in the wrong directory, and using the actual stub instead of a symlink is required.

I decided to copy it here just to improve the odds of finding a solution for the next person.  Thanks to those folks who discovered & reported the solution.

OpenMRS Test-a-Thon

August 22, 2008

As with many of our hackathons, we learned a lot about where we stand… in this case, on unit testing. We worked through a lot of the conventions and methodology to create a pathway to improve our unit testing coverage. We’re embracing at least the method-naming aspects of BDD. I am confident that we can increase our success rate:

And while we may have a ways to go to think that we’ve got a decent percentage of our behaviors covered, we’ve at least got Darius covered:

Twice as fast. Half the battery life.

July 13, 2008

I’m enjoying my new iPhone 3G, though I haven’t gotten much time on a 3G network with it yet (at the summer cottage this weekend). Had to get a white one to get 16 gig (even though I was about 30th in line, the AT&T store had already sold out of black). It has noticeably worse battery life when 3G is turned on. Not a big surprise, but increasing the need for certain accessories. Rather than wondering what phone he used before the iPhone, I’m very curious if Steve Jobs is going to use an iPhone 3G as his day-to-day cell phone. That might be our best chance of finally getting a replaceable battery.

So far, Paul has been holding out for an Android phone. I’m too much of an early adopter. Steve Jobs has already milked me out of about five iPods, a MacBook Pro, and two iPhones. It won’t take much for me to switch to an Android phone if it can compete (or improve…can you say “cut and paste?”) on the iPhone.

New server for OpenMRS.org

June 8, 2008

We just migrated to a new server (thanks atomicturtle, bwolfe!).  Writing a quick blog to test the feed aggregator.  Hopefully the website will be a bit faster on the new server.

ReviewBoard for OpenMRS GSoC 2008

May 5, 2008
Thanks to the generous folks at Review Board, OpenMRS has the opportunity to try out Review Board for performing code reviews for our GSoC projects.

Students can download post -review (a python script) and submit changes for review simply by issuing the command “post-review” within the root of their local copy.

Mentors can review the changes and attach comments to specific parts of the code for the student to review prior to submitting the code.

NOTE: since this feature is being generously hosted by Review Board, this feature should only be used for student projects at this time. If we decide that we want to continue using Review Board, then OpenMRS will host our own instance.

Thanks to chipx86 for his help in getting this set up. And thanks to r0bby for letting us know about the opportunity!

Firefox Incorrect Window Position

April 25, 2008

Okay. I’ve been enjoying Firefox 3 Beta, but today it started opening up its window way off to the right of my desktop and about the height and width of a stamp. WTF? A little Googling led me to a fix: Corrupt localstore.rdf. So if you’re Firefox window starts misbehaving, try deleting localstore.rdf in your Firefox profile folder and letting Firefox re-create it.

So, why am I blogging about something mundane like this? A few reasons:

  1. I’m trying out the latest update to ScribeFire
  2. Trying to get more in the habit of blogging.
  3. Sometimes it’s nice to have stuff like this tip blogged for the next time around

Tags

Determine a the JDK version used to make a JAR file

Maybe there’s already a tool to do this, but a quick Google search only yield this tip.  So, I made a quick little JAR reader to fetch the estimated version from the manifest:

import java.util.*;
import java.util.jar.*;
import java.io.*;

/*
 * Sends the "estimated" JDK version (expected to be in the jar manifest "Created-By" attribute)
 * to System.out.
 */
public class JarJDKVersion {

	public static void main(String[] args) {

		JarFile jarFile = null;
		Manifest manifest = null;
		String version = null;
		
		// Report usage if no parameters given
		if (args.length < 1) {
			System.out.println("usage: java JarJDKVersion ");
			System.exit(0);
		}
		
		// Open specified jar file
		try {
			jarFile = new JarFile(args[0]);
		} catch (IOException e) {
			System.err.println("Unable to read jar file: " + args[0]);
			System.exit(1);
		}
		
		// Fetch manifest from jar file
		try {
			manifest = jarFile.getManifest();
		} catch (IOException e) {
			System.err.println("Unable to read manifest from jar file: " + args[0]);
			System.exit(2);
		}
		
		// Display version from jar manifest
		Attributes attributes = manifest.getMainAttributes();
		version = attributes.getValue("Created-By").toString();
		if (version != null)
			System.out.println(version);
		else {
			System.err.println("Unable to determine version from jar manifest.");
			System.exit(3);
		}
		
	}

}

Download the source code or the class file.