Thursday, March 22, 2012

Believe half of what you read and three-fourths of what you see

Great adage my 9th grade teacher taught us.

Amazing how we can forget something like this. Wonder how many people applied this when they were investing with Bernie Madoff.

Tuesday, March 13, 2012

Resolving runtime JUnit issues when Eclipse builds your JUnit project flawlessly

Currently I'm writing automation using JUnit to test REST endpoints.

I'm using Eclipse Iridium with Perforce and Maven as plugins. Eclipse builds my automation project just fine and I can also build successfully on the command line too using Maven (e.g. mvn -Dmaven.test.skip=true clean install).

When I launched my JUnit class I was getting a method not found error. After some exploring through Google I found a very handy Java method call to resolve my runtime dependencies and see what JAR file Java and/or Maven were using.

The method I used was:

System.out.println(Base64.class.getProtectionDomain().getCodeSource().getLocation());

The link to the original article is here.

It seemed under my .m2 directory a prior version of apache commons was being used during runtime (1.2 versus 1.5).

As a temporary stopgap measure I copied the 1.5 JAR file into the 1.2 Maven repository and I got my runtime working.

Sunday, March 11, 2012

microsieverts, millisieverts, fukushima and abcnews

Watched an ABC news segment today, reporting the current progress a year after the Fukushima accident. The reporter took some geiger counter readings a little over a mile from the plant (while traveling in a car) and stated that readings were 20 micro sieverts an hour. I wanted to compare that to other more common day radiation doses and also compare how cumulatively damaging that hourly dose would be over the course of a year.

To understand sieverts and it's smaller units of measurements I needed to do some research first.

First, I realized that one sievert can be very damaging; close to lethal if all at once, and still very dangerous - if not mortally so - if over time.

For more common everyday radiation sources, milli and micro prefixes are used to denote much smaller radiation exposure incidents.

Milli denotes a thousandth of a unit or in this case: 1/1000th of a sievert. Mathematically its factor is denoted by 10-3. The letter m is its symbol.

Micro denotes a millionth of a unit or in this case: 1/1000000 of a siervet. Mathematically its factor is denoted by 10-6. The letter µ is its symbol.

For an average US user the average yearly radiation dosage is around 3 millisieverts.

How does that equate to the 20 microsieverts an hour the reported recorded near the plant?

For my calculations I used the Microsoft calculator in scientific mode.

To start with the micro measurement I entered 1, hit the Exp button, the +/- button, and then 6. I hit equals to get 0.000001, which is a millionth of 1. I then multiplied by 20 to get 0.00002.

To reach the average US yearly dose it would take 6.25 days near the Fukushima plant.

How much radiation would the 20 microsieverts per hour be if added over the course of a year? I multipled 0.00002 by 24 and then 365 to get 0.1752 of a sievert. To make it easier to read I multipled by 1000 to get a millisievert result.

175.2 millisieverts was the answer, which is quite considerable but shouldn't be lethal over that long a time. US nuclear works were 'classically' allowed up to 50 milliseiverts a year; now 20.

So if you lived near the Fukushima plant for a year you'd get 3-8 times the dose of a nuclear plant worker.

Tuesday, March 06, 2012

Test RESTful endpoints for OAuth with curl

It's weird I never really got into RESTful testing while at BEA or Oracle but now I have an opportunity to do some REST with OAuth at my current job.

Basically POST, GET, PUT, DELETE matches CRUD operations.

I can also easily exercise REST endpoints with curl on the command line too.

For example I can use an example curl command line below to retrieve a user record using the GET endpoint:

curl --basic -u [username to authenticate with]:[password] -H "Content-Type: application/json" -X GET https://localhost:9031/pf-ws/rest/oauth/clients/[username to retrieve] --insecure

For POST and PUT endpoints I need to reference a file to add a record or update a record.