Archive for March, 2009

XNAT Cheatsheet

At my workplace I am tasked with getting familiar with and eventually customized XNAT, a Java/Tomcat web-based content management system for the health care industy. As this is the first time I am working with a Jave web application, the learning curve is particularly steep. Here are my running notes as I try to get familiar with Java/JSP/XNAT. I must say though that I think Plone/Zope or even an ASP.Net system would have been a lot easier to understand!

  • Top level directory for xnat
    • Inside the VM (from NRG):
      • /mnt/hgfs/Shared/Workspace/xdat_release
      • Also, /usr/local/NRG/Shared/Workspace/xdat_release
    • Inside the host OS
      • ~/s/prog/xnat_rc1/Virtual-XNAT/Shared/Workspace/xdat_release
  • Directories @ top level
    • bin: Contains maven batch script, quick-deploy.sh and quick-deploy-templates.sh batch scripts to “deploy” XNAT from the top level directory to the tomcat directory (/usr/local/NRG/Applications/tomcat/webapps/xnat)
    • With Eclipse set up properly, there is no need to run the batch scripts.
    • build.properties: From the xnat.org website:
      • SUMMARY: The build.properties file is located in the root directory of the XNAT package.  The file contains the location of your Tomcat installation and details about your database connections.  The xdat.project.name variable will become the name of the generated project.  This will become the name of any generated webapps as well.  The xdat.project.template variable specifies whether or not your new project will use a template.  To create an XNAT project, this variable must be set to ‘xnat’.  Set the db name and connection information to your postgres installation. (This db connection string/name should point to a pre-created empty database of this name).  The initial build.properties is set to create an xnat project called ‘xnat’.  You simply need to create an empty database called ‘xnat’ (see step 2) and set the appropriate user name and password.  Also, the maven.appserver.home variable must be set to reference the root directory of your local Tomcat installation (abslolute path).
    • projects: Again from the website: XNAT will generate a folder in this directory for each of your projects. When you make customizations to your XNAT project, you will modify the files in this directory. These modifications will then be processed by the setup or update script.
    • deployments: XNAT will generate a folder in this directory for each of your projects. It stores the settings for your command line tools. It will also be used to generate your web application via the setup or update command.
      • If I need to modify a template, I have copied the template (a Velocity macro, .vm) from the deployments/xnat/src/xnat-templates/screens folder to the projects/xnat/src/templates/screens folder and edited it in Eclipse. On a deploy-templates operation, the web site is updated with the template content. (Note that for .vm file changes a full rebuild is not necessary.)
  • Deploying to Tomcat
    • This can be done in several ways, including using Eclipse, but on the command line running bin/update.sh -Ddeploy=true from the root directory works.
  • Customizing XNAT
    • From the website: Note: The XNAT framework looks for custom code, including additional schemas, in the XNAT_HOME/projects/PROJECT directory.  To make your customizations take effect, run the bin/update process from the XNAT_HOME directory.  This process updates the XNAT_HOME/deployments/PROJECT directory, which will contain your customizations and XNAT-generated code to support these customizations, and deploy it all to your webapp (WAR).
    • I am currently on this step, and will update this when I am successful

Comments off

Allow ssh access to a Fedora 10 machine (VM)

I have been setting up several Virtual Machine’s lately , to test deployment in various linux environments. I must say I have been frustrated with the way linux handles shared libraries. The DLL hell that many people complain about on Windows machines is nothing compared to the interdependencies of shared libraries! (Statically linking everything was not an option, as I was unable to successfully statically compile Python + wxWidgets + wxPython + Numpy)

Once a Fedora 10 VM has been set up, I need to do the following:

  • system-config-firewall   Turn off the firewall
  • chkconfig –list sshd   Confirm whether sshd is running or not
  • Assuming it isnt running in modes 3 & 5,
    • chkconfig sshd on
    • service sshd start

Comments off

wxPython on Linux (GTK) Annoyances

It is very fashionable to gripe about Windows short comings and brag that Linux solutions are always better, more bug-free, etc. I have come to the opposite conclusion in the case of wxPython and Windows/Linux development. Programming on Windows just works. Linux (or more accurately the GTK platform on Linux) is very frustrating because of the quirky behavior in a surprisingly wide variety of cases.

  • the File Browse Button widget (wx.lib.filebrowsebutton) had a bug that appears on GTK (but not Windows). If the value of the associated text control points to a directory or file that does not exist, clicking on the Browse button causes an assertion error. More info (and the fix) is here, summarized below:
    • This is the same error as discussed in
      http://trac.wxwidgets.org/ticket/4749 for 2.8.7.1 (I am using 2.8.9.1)
      but apparently the fix didn't carry over or fix this particular case.

      "Simple fix is to add a line that blanks out the file part when the
      directory is not found." is what it says but my 2.8.9.1 source for
      filebrowsebutton.py doesn't actually blank out the file part.

      adding:
      current = ''

      in the else clause around line 161 fixed it.

      else:
      directory = self.startDirectory
      current = ''
      dlg = wx.FileDialog(self, self.dialogTitle, directory, current,self.fileMask, self.fileMode)

  • Default fonts are sometimes (but not always!) larger than the encapsulating control. Pull down menus especially suffer from this on GTK, and I have to write special case code to check whether the program is being run under GTK, and size the fonts smaller so they are not clipped by the control. Very annoying!
  • StaticBitmap on GTK does not behave as on Windows, with the latter version being more feature full. There is a work around, by using a wx.lib.statbmp.GenStaticBitmap, but this leads to a performance hit, so I need to special case this as well for GTK.
  • More to come as I struggle with cross-platform programming.

Comments off