Kinect Hacks

Comments off

Oracle to set tiers for Java VM

The Register reports that Oracle is splitting the Java Virtual Machine into two tiers, a free one and a paid “premium” one. This is a natural progression of Oracle’s strategy to monetize the major assets of its Sun Microsystems acquisition.

While paying for a (presumably) faster or more feature-full JVM is no problem for large development companies, as a small business developer, I am glad most of my development projects use truly open and/or free languages, including Python, C++, and C#.

Comments off

Cross Site Request Hacking

The recent attack on twitter serves as a reminder about the dangers of cross-site requset hijacking. This entry provides a few suggestions on how to secure your site from this form of attack.

Comments off

Some Plone tips

To add a tab in the green tab bar, go to portal_actions/object and add an action.

Some useful expressions:

  • string:${context/portal_url}/folder/document
  • python:portal.restrictedTraverse(‘@@plone_context_state’).current_page_url()==”testurl”

Note the python expression portal.restrictedTraverse allows python expressions/scripts to access the new browser views

Comments off

Top 25 Programming Mistakes.

Mitre has published the top 25 programming mistakes that lead to security breaches.

Cross-site scripting is number one, with SQL Injection and buffer overflow following.

Comments off

Plone Main Template Slots

Here is the list of slots that are defined in the master page template for Plone.

  • HEAD slots
    • base
    • head_slot
    • style_slot
    • javascript_head_slot
  • BODY slots
    • content
    • body
    • main (for most cases use this instead of content or body)
    • sub

To use one of these slots (for example, “style_slot”) use the metal:fill-slot macro

<style metal:fill-slot="style_slot" type="text/css">
 table.LesionLocation {border:1px solid blue;border-collapse:collapse;}
 table.LesionLocation td {border:1px solid black;padding: 5px;}
</style>

The page template must reference the master template:

<html xmlns="http://www.w3.org/1999/xhtml" 
xml:lang="en" lang="en" i18n:domain="plone"
metal:use-macro="here/main_template/macros/master">
...
</html>

Comments off

Updating XNAT

A quick paste of a newsgroup post that outlines the steps necessary to update the xnat distribution from cvs.

To update from RC1, you should:
cd $XNAT_HOME
 cvs update -d
 $TOMCAT_HOME/bin/shutdown.sh
 bin/update.sh -Ddeploy=true
 psql -f deployments/PROJECT/sql/PROJECT-update.sql
 $TOMCAT_HOME/bin/startup.sh
The only thing I added to the schema this round were a few parameters for
configuring access to DICOM server.  Those are used on that settings page,
so it would make since that the save would fail if those columns didn't
exist in the db.
Try running the referenced -update.sql, and restarting Tomcat.

Comments off

[QN] MRI Facts

DCE vs DSC

  • DCE-MRI: Dynamic Contrast Enhanced MRI.
    • T1 Longitudinal Relaxation
    • Parameters
      • Ktrans: Tissue perfusion and Microvascular vessel wall permeability
      • Ve: Extracellular volume fraction
  • DSC-MRI: Dynamic Susceptibility MRI.
    • T2 Transverse Relaxation
    • Parameters
      • Blood flow
      • CBV Blood volume
      • MTT Mean Transit Time

Comments off

[QN] How to convert month name to month number in Python

For a short script I was writing I needed to convert a string representation of the month (“month name”) into a numerical value (“month number”). A quick google led to many solutions to the inverse problem, which to me seems a lot easier. Here is a quick and dirty solution that uses the calendar module.

import calendar
list(calendar.month_name).index(month_name)

I chose to use the calendar module array month_name because I would rather not have to create a list of month names myself.

Comments (1)

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