Lab49

Creation, dynamic loading and instrumentation with javaagents

February 7th, 2010 / Dhruba Bandopadhyay

Sometime back I had to delve into the depths of how one could dynamically and programmatically load a javaagent at runtime – in other words how a javaagent could be attached to a running process. Since then I’ve been meaning to blog my findings. Finally, after quite some time, I’ve got around to it but here I take the opportunity to expand the scope of the article to a complete treatment of how to create a javaagent, load it statically at startup or dynamically at runtime and also how to perform instrumentation of a simple class. As always the code will reside in an eclipse maven project that will be made available for download.

JMockit jar loading from remote file systems enabled

February 7th, 2010 / Dhruba Bandopadhyay

Over the past few months we’ve faced significant hurdles integrating jmockit into our development environment at a client-site primarily but not entirely because it is not a conventional development environment. The most noteable of these has been the inability to load the jmockit jar file from a mounted drive which is a remote file system. Having remote paths in the classpath such as //foo/bar/baz/jmockit.jar would result in a java.net.URI being constructed with that remote path and the URI being passed to the following java.io.File constructor.

JMockit & JavaAgent – Enterprise integration woes

February 1st, 2010 / Shanks' Tech Musings

We’ve been using JMockit as the preferred mocking utility at a large Bank that I’m consulting at. While generally the product and its non-intrusive mocking features are commendable, some of the under-the-hood mechanisms have caused us a nightmare with our continuous integration.

After upgrading to latest version of JMockit, version 0.996.0, we had ALL our unit tests failing with the following spurious error

Can iPad find a home on Wall Street?

January 29th, 2010

When the iPad was announced this week my first thought was, “They’ve come out with a giant iPhone!”  (Okay, so technically it’s more akin to a giant iPod Touch, but as an iPhone user, this is where my mind goes.)  I was skeptical about its potential usefulness.  It’s confined to iPhone-like applications; everything has to come from the App Store.  It won’t run a JDK, and isn’t even as useful to me as a netbook.

I was guilty of thinking inside the box.  The old, stale, PC box.

Kevin Kelly @ First HPC/Cloud Computing SIG

January 19th, 2010 / Gotham Canuk

Last week was the first meeting of the HPC/Cloud Computing workshop, hosted by Lab49 and Liquidnet.

Changing from the typical NY Java SIG format, this new workshop was a bit of an experiment. We limited the attendance to foster a more discussion-oriented workshop. I’m sure everyone in attendance would agree it was a great formula and a welcomed change from large seminar-styled approach. I asked Kevin Kelly from Amazon Web Services come to town and give the membership an introduction to Cloud Computing.

Kevin Kelly on Cloud Computing

Google Appengine and Maven – another hack for datanucleus plugin

January 17th, 2010 / Shanks' Tech Musings

After researching for mavenizing an Appengine pet project, most of the links that Google search returned were really old when first version of AppEngine was released and did not match the expectations. Also unfortunately there is really no maven plugin that supports the latest version as Google publishes them or a plugin that allows you to point to a local installation, so that you could update at the speed of Google releasing updates for AppEngine (as of this writing, there were atleast 3 updates in the shorter period of 2 weeks)

Java SE 6 1.6.0_18 update worthy of note

January 16th, 2010 / Dhruba Bandopadhyay

Compared to other v6 release the release of Java SE 1.6.0_18 is definitely worthy of note.

Major changes

  • VisualVM 1.2
  • Performance improvements
  • 20% faster jar file creation
  • Java Hotspot VM 16.0
    • Improved NUMA-aware allocation giving a 30% (for 32-bit) to 40% (for 64-bit) increase in performance (which is due also to arrive in jdk7 as well)
    • Garbage collection improvements including new default java heap configuration in client and server vms
    • Classloading optimisations for faster startup
    • Code generation improvements including elision of needless conversions between integer primitive types and optimisations of common string concatenation patterns

Introducing the HPC/Cloud Computing SIG

January 7th, 2010 / Gotham Canuk

I’ve been working with the NY Java SIG to create a more intimate SIG, specifically focused on HPC and Cloud Computing. I’ll be organizing meetings every other month, with talks from industry speakers on variety technologies and products entering these markets.

I’m happy to say that the inaugural meeting will be next Tuesday, January 12th, hosted by Lab49 and Liquidnet at Liquidnet World Headquarters in midtown New York. Our first speaker will be Kevin Kelly from Amazon Web Services.

Rather than an Amazon-centric presentation, Kevin will explain various aspects about the cloud and it’s technologies. He’ll cover various deployment scenarios that fit different business use cases. Looking to the future, he’ll explain some of the challenges that cloud computing has in the horizon.

Eclipse AJDT intertypes and Push-In refactoring

December 31st, 2009 / Dhruba Bandopadhyay

In the wake of the recent 1.0.0 release of Spring Roo, while going through Ben Alex’s captivating three part tutorial (1,2,3) on the tool, I experienced one of those moments that are normally few and far between when you know you’ve come across something new – something rare and revolutionary for the space of technology that it’s acting within that would never have occurred to you – something lateral in nature (no pun intended as we’ll see later on). Meet Eclipse ADJT, intertypes and Push-In refactoring.

Let’s take the Spring Roo project in the above tutorial as an example.

Spring Roo 1.0.0, EclipseLink 2.0.0 and JPA2 incompatible

December 31st, 2009 / Dhruba Bandopadhyay

Recently Spring Roo 1.0.0 was released. However for those interested in using Roo with EclipseLink (in other words for those with a fervent disdain of Hibernate) please note that this is not yet supported. The related online discussion is on the forum and there is an open JIRA for integrating it which you can vote on and watch. Apparently EclipseLink 2.0.0 has a dependency on JPA2 API which is causing issues. It’s a real shame that EclipseLink isn’t supported yet as it would have been useful on one of our projects going forward but this integration can always be done by hand.

Spring Expression Language (SpEL) Primer

December 30th, 2009 / Dhruba Bandopadhyay

Spring Expression Language, abbreviated SpEL, is a powerful expression language, in the newly released Spring 3, that supports a plethora of ways of interacting with object graphs at runtime. It is intended to be a fully featured expression language for reuse across all products in the Spring Portfolio. This article explores all the various features of SpEL by example.

Builder Pattern Abused

December 16th, 2009 / Shanks' Tech Musings

Everyone has read Joshua Bloch’s builder pattern, which he has also described at his “Effective Java Reloaded” sessions at Javaone. However in this post, I am going to describe a misuse of this pattern, when used in conjunction with inheritance. 
When building a relational model, the biggest challenge is to maintain the integrity of inheritance and reduce the visibility of the properties completely. However if you need builders for this model, then you either have to create a class hierarchy of builders similar to the model itself or make all accesses protected (ugly #1) so that builders could appropriately initialize them. Making the properties less visible has at least two disadvantages though (1) you cannot make them final and ensure construction safe and (2) you’ll end up copying the builders to more than one class (ugly #2)

@Lab This Week 11/27

November 27th, 2009 / Tech Tock

Just Test – Nuff Said? Nah.

Big discussion about unit testing.  Views ranged from 100% coverage is necessary, to some code is not worth the trouble.  The 100% camp was hit with this rebuttal:

How is the coverage measured?
Is it just checking which code blocks ran during the test?
What about covering different code paths?

Everyone was in favor and there were some interesting insights including an example of “correctness by construction” in Haskell:

@Lab this Week 11/20

November 21st, 2009 / Tech Tock

Doug Finke was supposed to be podcasting from Microsoft PDC, this was what we heard.

Lots of discussion about ORM and Entity Framework vs. nHibernate with this conclusion.

Folks are happy that MS has open sourced  the “.NET Micro Framework”.  I met the announcement with “What the *!?*&^%# is the .Net Micro Framework”.  Read the link and you’ll find out.

.Net Meetup – I went and really enjoyed it.

NYFLEX Meetup.

There was a bit of interest in this story of Madoff’s programmers being arrested.  The consensus is that programming for financial companies is rarely illegal, so don’t worry friends.

@Lab this Week

November 13th, 2009 / Tech Tock

Humor from ZeroHedge is still popular.  Unfortunately, the Goldman they’re praising is not me.

Cool Barcodes

Heisenbugs

If you’re looking for Heisenbugs try MS Chess.  It can detect subtle hard to repeat bugs in concurrent programs.  It works in both managed and native windows programs.

CHESS repeatedly runs a concurrent test ensuring that every run takes a different interleaving. If an interleaving results in an error, CHESS can reproduce the interleaving for improved debugging. CHESS is available for both managed and native programs.

read more about it here and here.

Considering Adding a Functional Language to My Bag of Tricks

November 13th, 2009 / Tech Tock

There are a lot of people @Lab who know things like Erlang, Haskell, Python, R, etc., etc., etc.  I’m actually considering learning Lisp, but I need a project.  I “learned” php for a project over the summer, but I didn’t really like it since its so much like classic ASP (really messy).  Maybe I’ll learn F# instead…  That shouldn’t be such a strech since I built an ML compiler in grad school (F# is based on ML).  I wonder what kind of project I’d be interested in would benefit from a functional language…  I suppose I’ll have to read up on the language and maybe that will give me some ideas.

JMockit: No holds barred testing with instrumentation over mocking

November 8th, 2009 / Dhruba Bandopadhyay

Introduction

The transition from junit to stubs to mocking occurred long back in the world of testing. Traditionally mocking has used jdk proxies for interface based classes and cglib for non-final concrete classes. This article draws attention to the yet ongoing transition from mocking to instrumentation for testing. Particularly it highlights how to achieve complete access to your API by being able to instrument and thereby mock areas of your code that were previously inaccessible.

@Lab this Week

November 7th, 2009 / Tech Tock

A weekly roundup of interesting things I hear about at the Lab, since this is the first one, it covers a bit more than a week.

A couple of Flex developers commented that WPF and Silverlight are so much more mature, easier and feature rich.  They were half right as this popular diagram shows:

Some UX designers working with Expression Blend said it’s not horrible, so now I don’t feel too bad asking them to use it.

This fun character interaction chart was much discussed (small version here).  I think it gives an interesting summary of some great movies.  It may bear a resemblance to the Napoleon March Map.

Unit Testing — Back to Basics

October 31st, 2009 / Tech Tock

I’m drinking a lot of cool aid at Lab49 (tastes great, less kludgy).  Its a place where phrases like tail recursion, statistical programming languages, and Dependency Injection/IoC, are regular topics of conversation.  In other words, geek heaven.  So, of course I’m going to use all the tools and tricks I’ve got (otherwise known as best practices) and Unit Testing is fundamental.

What is unit testing? I like to think of it as a bunch of coded functions that test every small part of your program functionality.  But its actually a whole philosophy.

JDK7 NIO.2 FS API Primer

September 6th, 2009 / Dhruba Bandopadhyay

Earlier today I was watching Deep Dive: JDK 7 With Danny Coward and it prompted me to play around with the new NIO.2 java.nio.file.* APIs in JDK7 for filesystem access. They are one of the major new features in JDK7 being worked upon under JSR-203.

Here I enumerate almost all the new filesystem APIs by example using the latest binary snapshot of OpenJDK7. Asynchronous IO, socket operations and multicast datagrams are not covered in this article. The sample code is available as an eclipse maven project.