Saturday, October 30, 2010

4 tips to get your support ticket worked pronto!

Isn't software support great? It's one of the few ways possible to make your problem someone else's! But when you've got one of those problems, you usually want it to be worked ASAP. Here are 4 tips to help your ticket go through as quickly as possible.

1) Have your artifacts handy
By 'artifacts', I mean logs, core dumps, mangled transaction prints, etc. If these things are not attached with your original ticket, there's a pretty good chance your first contact from the support engineer will be a request for you to go get them. Meanwhile, while you're off gathering those things your engineer isn't idly standing by-- he's off working another ticket! When your artifacts finally come in, the engineer may or may not be ready to put down that second ticket, you may have to wait. Avoid the asynchronous wait time associated with this first exchange-- provide them in the first place.

2) Open the ticket at the appropriate level of severity
Most ticketing processes involve a user-defined 'level' that indicates how important the ticket is to the holder. (Usually severity 1, or 'sev one', is the highest.) It's tempting to mark every ticket you enter as a sev one, but guess what happens if your development-environment problem isn't really the production-crash that sev one defines? (Check your support agreement to see what the definitions are.) Your ticket will be examined, re-prioritised, and put in a lesser queue. So you lose time 'till that first evaluation, your ticket is delayed going into the proper queue, and you may establish a reputation as a less-than-honorable ticket opener. (That last one is a bad one. Read on....)

3) Playing nice pays off
Often times there are more tickets than support engineers available, which means sometimes the engineer gets to decide which ticket to work first (all other things, like severity, being equal). In situations like these, the 'tone' of the ticket can make a difference. A polite and professional ticket tells the reader that the sender is a savvy user that's ready to collaborate and address the issue. On the other hand a defensive or accusatory note might signal an uncooperative sender. Which would you rather work first?

4) If at all possible, replicate the problem in a minimal environment
This is a big one-- if at all possible, encapsulate the problem in a minimal environment and attach it to the ticket. If your problem lies in a Spring application, isolate the offending components and attach them with an application context to run them. If it's a problem with JSF, build the smallest .war possible that shows the problem and attach the artifacts necessary to build it. It's not always possible, but when it is possible this really helps the engineer! Your ticket will be promptly picked up, and the problem will be put under the best microscopes the engineer has available.

That's it-- follow those 4 steps and your ticket will proceed at max speed.

Happy ticketing!

Thursday, October 28, 2010

ORM the Hibernate way -- on .Net!

I've been a casual user of Hibernate in my Java applications for a long time, but have never gotten around to using it's .Net cousin, NHibernate. Now I've got a reason to finally give NHibernate a look!

Packt has just released a new book, "NHibernate 3.0 Cookbook", described here. The book promises to teach the full range of features available and looks to be an easy read. It's a Packt "Cookbook", which means the book will be presented in a series of 'How To' episodes written in a consistent format. These books emphasize practical application over deep theory, so I have high hopes I'll be rapidly developing database-backed applications in .Net not long after cracking the cover. (Time will tell. I'm waiting for my copy to arrive in the mail.)

Watch these pages for a review sometime soon.


Happy Coding!

Saturday, October 23, 2010

How to find which .jar a class is in (easily)

Along with the many blessings a high level language brings you are a few curses. In Java's case, one of the biggest downfalls is the dependency graph your code becomes part of as you develop applications. This is especially noticeable when you're using frameworks like JEE or Spring.

A Java developer feels this pain in a couple of ways:

- Compile time, manifested with errors such as "(ClassName) cannot be resolved to a Type" or "The import some.class.SoughtFor cannot be resolved".

- Runtime, where the errors will show themselves with messages like the all-time favorite "java.lang.ClassNotFoundException".

But what if you had a report like this? Wouldn't that be nice?

So what do you do then? Many coders start by trying to guess which .jars hold the missing classes, then add them to the classpath one by one. This can be an exercise in frustration, as often times .jar names give you little clue as to which classes are inside.

A second methodology developers sometimes use is the 'throw everything but the kitchen sink at it' approach, where they build huge classpaths loaded with every .jar they can find. This inexact coping mechanism obviously leads to bloat.

But wait! There is an exact way to cure the problem, and it's easy and open sourced! Here's how to do it:

1) Download and unzip JBoss Tattletale. It can be found here.
2) Make a run script for Tattletale.
3) Run the run script.
4) Read the report Tattletale makes for you. It's that easy!

The script is easy to write. It takes the form 'java -jar tattletale.jar DIRECTORY_TO_RECURSIVELY_SEARCH DIRECTORY_FOR_REPORTS.

Here's an example:
java -jar tattletale.jar /home/rick/Tools/JBoss/jboss-5.1.0.GA /home/rick/rpts

Then you just go to the reports directory and view the index. To find your classes in .jars, have a look at the 'Class Location' report. It'll tell you which jar holds the missing classes!

Tattletale has many more capabilities, which are well documented in the packaged docs. I hope you'll find this tool useful in your day-to-day development work.

Happy Coding!

Saturday, October 9, 2010

Solve your Java runtime mysteries easily with Byteman

Update February 2012

Use the following to easily use Byteman on AS7, using the HelloWorld quickstart:

-- Script to attach, check, and submit rule -----
export JBOSS_HOME=/home/rick/Tools/JBoss_Org/jboss-as-7.0.2.Final
export BYTEMAN_HOME=/home/rick/Tools/MISC_TOOLS/byteman-2.0/byteman-download-2.0.0
# Only install once.....
# $BYTEMAN_BIN/ -b -Dorg.jboss.byteman.transform.all $JBOSS_HOME/jboss-modules.jar

export QS_HELLOWORLD_TGT=/home/rick/Tools/JBoss_Org/jboss-as-quickstarts-7.0.2.CR1/helloworld/target/classes
# check it

# add the rule
$BYTEMAN_BIN/ RicksScript.btm

-------The Rule. Check the arbitrary Java code used! --------------

RULE trace main entry
METHOD createHelloMessage
IF true
#DO traceln("entering createHelloMessage")
#DO traceStack("found the caller!\n", 100)
DO System.out.println("Hey, I'm random java code!");


Have you heard of Byteman? It's sort of like AOP-lite. With a small script and a lightly doctored startup command, you can have x-ray vision into your Java applications. You don't even have to alter your source code, and it's easy to use.

Here's a quick example. Let's say we have a Java application where some method is called at some point, and you want to know when that method is called and what's being passed to it.

So let's say we have an application that provides this output. (I'll show you the source code in a bit.)
Suspects about to do stuff!
Thump! A murder happens!
Suspects done moving around!

Well, we don't know much about who committed the crime, do we? (In fairness, we don't even know who the suspects are yet.) But how about if you had the source code? Then could you tell? I doubt it. Here's the source:

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Clue {
private void makeMystery(){
List suspects = new ArrayList();
suspects.add("Colonel Mustard");
suspects.add("Mr. Green");
suspects.add("Miss Scarlet");
Random gen = new Random();
// determine the killer!
int theKiller = gen.nextInt(3);
System.out.println("Suspects about to do stuff!");
for (String suspect : suspects){
// maybe commit the crime!
if (suspect.equals(suspects.get(theKiller))){
System.out.println("Suspects done moving around!");

private void walkThroughLibrary(String suspect) {
// walks through...

private void commitCrime(String suspect) {
System.out.println("Thump! A murder happens!");

private void walkThroughKitchen(String suspect) {
// walks through

public static void main(String[] args) {
Clue clue = new Clue();


I defy you to tell me who committed the crime! But with Byteman you can tell!

So let's set things up. Aside from downloading Byteman (found here), you need to do a few things.
  1. Make your application into a jar (using jar -cvf someJar.jar *.class, perhaps). This is done as a convenience to make it easier to put on a classpath.
  2. Make a Byteman script, telling it what you want to see.
  3. Make a command-line script to invoke your application.
Step 1 should be familiar to most Java coders.

Step 2. For the above class, let's make a script like this:


# clue_script.txt - A simple script to intercept calls to a method
RULE Simple byteman example - watch a method
METHOD commitCrime(String)
DO traceln("Caught the murderer! It was " + $1)

Step 3. Add the necessary agent to your startup shell script.
java -javaagent:/home/rick/Tools/Examples/Byteman/byteman-1.3.0/lib/byteman.jar=script:clue_script.txt -classpath clue.jar Clue

Now when we run the script, we see this:
Suspects about to do stuff!
Thump! A murder happens!
Caught the murderer! It was Colonel Mustard
Suspects done moving around!

There we have it! Byteman has let us find out which arguments were being passed to that method, and we did it without altering the source for the application, without attaching a remote debugger, and without much trouble.

Byteman can do much more, though. It can provide stack traces on demand, it can inject faults for testing and other neat tricks. You can add an arbitrary Java helper .jar to help you do things-- just bind it with a "-b" option.  Best of all, it doesn't cost anything. Check it out today, here.

Happy Inspecting!

Saturday, October 2, 2010

Voting now open for 2010 Open Source Awards

The nomination stage is now closed and voting has begun in the 2010 Open Source Awards.

Your vote could reward an open source project with cash awards (I know the developers will appreciate that!) Registering to vote will require your name and email, and it's a single button click to cast your vote.

Here are the finalists, in categories:

Open Source CMS Award

Every Content Management System (CMS) that is based on one of the Open Source licenses is eligible to participate for this category. Vote for your favorite Open Source CMS here.


  • CMS Made Simple
  • MODx
  • mojoPortal
  • SilverStripe

Hall of Fame CMS

This category is reserved for those CMSes that have won the Overall Open Source CMS Award at least once in the past. Since the launch of the award in 2006, only Joomla!, Drupal and WordPress have won the Overall Open Source CMS Award, therefore, this category will feature only those three participants in 2010. Vote for your favorite Hall of Fame CMS here.


  • Drupal
  • Joomla!
  • WordPress

      Most Promising Open Source Project

      This category is for all Open Source projects, whose first release date is less than two years from 9 August, 2010. Vote for your favorite Most Promising Open Source Project here.


      • BuddyPress
      • LiveStreet CMS
      • Pimcore
      • Tomato CMS
      • WolfCMS

        Open Source E-Commerce Applications

        This category is reserved for the type of web applications that simplify buying and selling of products on the Internet. This will include complete e-commerce applications or frameworks designed for e-commerce. E-commerce modules or extensions to other systems can also be nominated. If a system is general purpose (like a CMS such as Drupal or Joomla!) the specific e-commerce functionality should be nominated, not the base system.Vote for your favorite Open Source E-Commerce Applications here.


        • Magento
        • nopCommerce
        • OpenCart
        • PrestaShop
        • Tomatocart

        Open Source JavaScript Libraries

        This category is reserved for JavaScript libraries, libraries of pre-written JavaScript controls which allow for easier development of RIAs (Rich Internet Applications), visually enhanced applications or smoother server-side JavaScript functionalities.Vote for your favorite Open Source JavaScript Libraries here.


        • Dojo ToolKit
        • Ext JS
        • jQuery
        • Mootools
        • RaphaĆ«l

        Open Source Graphics Software

        This category, as the name suggests, is for all Graphic Application Software that is used for graphic design, multimedia development, specialized image development, general image editing, or simply to access graphic files. It can also include graphics libraries, which use command line references or programming language inputs to design or edit graphics.Vote for your favorite Open Source Graphics Software here.


        • Blender
        • Gimp
        • InkScape
        • jMonkeyEngine
        • Scribus

        Happy Voting!