For some reason Java doesn’t like to obey http forwards if the protocol is changing. It has been this way for a while: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4620571.  So when I was trying to load https://modules.openmrs.org that had an apache redirectMatch to http://modules.openmrs.org, I would get the html for the 301 redirect instead of the source of http://modules.openmrs.org.

I was lucky that I have control over the server and could change the http/https to a simply proxy instead of redirecting.  If I didn’t, I would have had to catch the protocol change and refetch the new url.

It took me a while to find an answer for this because these keywords didn’t give many results on google: URLConnection HttpURLConnection openConnection() connect() getInputStream() Apache redirectMatch 301 302.

This is in the babble category tagged as ,

Add a comment »

For some reason Ubuntu regressed a bit in the multiple monitor department between Hardy and Intrepid.  Before upgrading I was able to dock my Thinkpad and easily switch screens using fn-f7 to switch resolutions just like in the Windows World.  After upgrading function f7 usually didn’t work so I had to start just shutting down the computer (or at least control-alt-backspacing to restart x) if I switched between external monitor and the laptop monitor.

I recently discovered “grandr” and its capabilities.  It worked more often than Ubuntu’s Screen Resolution program…but I had to use my mouse and see the screen to do so.  This meant that I had to the lcd before I did a stand by or took the laptop off the dock.

I then discovered the command line “xrandr” program.  It let me set up some scripts to switch the screen resolution.

  • Use open source ATI driver (not fglrx)
  • Set up your terminal to launch with a keyboard shortcut (System–>Preferences–>Keyboard Shortcuts)
  • Figure out what randr calls the lcd and vga video card outputs with just xrandr
  • Create ./lcd.sh and ./vga.sh and set them to be executable with chmod +x

lcd.sh:

/usr/bin/xrandr –screen LVDS –auto

vga.sh:

/usr/bin/xrandr –screen “VGA-0″ –auto
/bin/sleep 4
/usr/bin/xrandr –screen LVDS –output LVDS –off


Now after undocking I don’t need to be able to see the screen to turn on the lcd.  I just type Alt-t to bring up the terminal, then ./lcd.sh and the lcd turns on. :-)   Jaunty is supposed to have improved monitor support, so I’m looking forward to its release.

This is in the babble category tagged as , ,

Add a comment »

When trying to merge from our trunk to a branch I was getting these errors:

svn: File ‘/tmp/svnkitmerge42139.tmp/.diff.192.tmp’ has inconsistent newlines
svn: File ‘/tmp/svnkitmerge42139.tmp/.diff.192.tmp’ has inconsistent newlines

and

svn: File ‘/tmp/tmp’ has inconsistent newlines svn: Inconsistent line ending style
svn: Error reading spooled REPORT request response

svn: Generic IO error
svn: Generic IO error



Here are the steps I did to get around this and still merge from trunk to the branch:

  1. Check out a fresh copy of the branch.
  2. Merge the branch to the latest, skipping over the revision that did the newline changes (5893 in my case). You might have to do two merges for this: previous merge point to 5892, then one from 5894 to HEAD.
  3. Run the fix_newlines.sh script.
  4. Commit the branch.

Note: If you have changes on another checked out copy, an “svn update” won’t work on that one. You will have to apply a patch of the changes to the freshly checked out/merged copy.

This is in the openmrs category tagged as , ,

Add a comment »

I had a lot of trouble recently merging a renamed branch back into trunk. I ended up having to resort to the command line to get the exact parameter setup that I wanted. Subclipse didn’t quite cut it, unfortunately.

To set the stage:

  1. All changes on trunk have been merged to the branch (complex-obs) and committed
  2. The checked out trunk copy is up-to-date

I created a patch file comparing trunk to the branch:

svn diff –old /home/ben/workspace/openmrs-trunk-clean –new http://svn.openmrs.org/openmrs/branches/complex-obs > /home/ben/openmrs/patches/complexobs.diff

I then applied that patch file to my local trunk copy:

patch -p0 < /home/ben/openmrs/patches/complexobs.diff

This should only be used if you plan on closing the branch. Subversion isn’t able to keep track of any ancestry this way, so future merges would be harder.

Note: Diff files don’t handle binary files. You will need to move those yourself. I suggest comparing the patched trunk with your branch to make sure everything is the same. (In eclipse, select the root of both projects, then right click–>compare with–>each other)

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

Add a comment »

If you don’t want to upgrade to use the gui update-manager program (update-manager -d) in Ubuntu, you can upgrade your system with the simple call to apt-get:

sudo apt-get dist-upgrade


This is in the babble category tagged as ,

Add a comment »

« Previous Entries Next Entries »