James Crisp

Software dev, tech, mind hacks and the occasional personal bit

NUnit SetUp Attribute and Subclassed Test Cases

If you have a ChildTestCase class that inherits from a ParentTestCase class, and both of these have a SetUp method, marked with the [SetUp] attribute, would you expect both to be called? If so, you would be sadly disappointed. Only the SetUp method of the ChildTestCase will be called, and the SetUp in the ParentTestCase will be ignored.

According to the NUnit documentation on the Set Up attribute, this is intended behaviour:

If you wish to add more SetUp functionality in a derived class you need to mark the method with the appropriate attribute and then call the base class method.

An alternative approach to get all your SetUps called is to have a base TestCase class define a protected virtual SetUp() (with the SetUp attribute), which all child classes override (and call base on their first line).

Sybase Adaptive Server 12.5.3 SQL (Un)Supported Features

Sybase has some unusual features:

  • Column names and table names are case sensitive
  • Subqueries cannot include TOP 1 or ORDER BY
  • Queries with max(COLUMN_NAME) and an ORDER BY seem to ignore the WHERE clause. Removing ORDER BY seems to fix this.
  • Column names are 30 characters max
  • Join syntax is: left_table [inner | left [outer] | right [outer]] join right_table on left_column_name = right_column_name
  • Can’t do boolean operations in SELECT (eg, =, > <), but can do mathematical operations (eg, +, -) in SELECT clause

Thoughts from Process Consulting

Just finished reading “Process Consulting” by Alan Weiss, lent to me by my talented colleague, Darren Smith. The book is concerned more with general consulting, not IT consulting or IT methodologies. I found the bigger picture view in Weiss’s book enlightening and helpful in evaluating and questioning my own consulting practices. Here’s a few thoughts from the book:

  • Remember that you are not the change agent. The client personnel are the change agents. You are the catalyst, but they are accountable for enduring change. Don’t be a hero…
  • Cute phrases and pithy slogans don’t change behaviour. Aligning people’s objectives behind corporate objectives and supporting that behaviour with metrics and rewards will usually gain their attention. Rapidly.
  • Is it really progress if we teach a cannibal to use a knife and fork? (from Stanislaw Lem, quoted by Weiss)
  • At the outset of any change process, immediately after agreement with the buyer, identify and “recruit” these key positions [hierarchical leaders, front line management, respected leaders and experts]. Use the buyer’s clout if you must. The most crucial factor in organizational change occurs prior to implementation: It’s the conceptual agreement and acknowledged self-interest among the few people who actually have their hands on the controls.
  • [Regarding change,] neutral is as bad as negative, since the default position for everyone else will always be the old behaviour.
  • Don’t be anxious to “make change”. If you have a six month window, for example, invest at least the first month or more aligning your support and key sponsors and establishing their accountabilities. The more time you take with critical sponsors, the faster you will ultimately create change.
  • When you find someone micromanaging, it is almost always because of a lack of trust. If you don’t do the job the way he or she would do it, you must be doing it incorrectly. If the leader has trust in subordinates, simply providing the goals should be sufficient.

Sydney BarCamp 3 this Weekend!

BarCamp Sydney is two days long this year, and will span the whole of the coming weekend (5-6 April). I’ll be there on Saturday. It’s usually quite a fun event, lots of good sessions and you’re quite free to move around and find something that interests you. Part of the BarCamp manifesto is that you should also contribute as well as listen – I’ll probably give a JRuby talk and demo.

Hope to see you at BarCamp!

“JRuby: Enterprise 2.0” Slides

Here’s the slides from “JRuby: Enterprise 2.0″ from our recent talks at Sun Tech Day and the ACS Web Technologies SIG.

“JRuby: Enterprise 2.0” Presentations

Josh Price and I will be co-presenting at the Melbourne Sun Tech Day and the Sydney ACS Web Technologies SIG. Here’s the low down:

JRuby: Enterprise 2.0
There’s a lot of buzz around JRuby in both the Java and Ruby communities, for good reason. This talk will give you a whirlwind introduction to JRuby. We’ll show you why JRuby is regarded as such a powerful and dynamic development platform. We’ll also suggest where to use JRuby in product development and the enterprise and how to leverage your existing Java investments.
There will be sample applications, live demos and not many slides.

Sun Tech Day Melbourne
4 March 2008, 2:30pm
More info on Sun site…

ACS Web Technologies SIG Sydney
5 March 2008, 6:15pm
More info on ACS site…

Hope to see you there!

Wedding and Honeymoon Photos on Flikr

Well, being married and all, we decided to splurge and buy a Flikr account for us both. It is:

http://flickr.com/photos/soosun_and_james

For the impatient, jump straight to:

Married! Our Wedding In Korea!

Soosun and I got married in Suseo Church, Seoul on 5 January 2008.

Married!  Married in the Church

It was pretty exciting, with multiple costume changes, lots of food and exotic ceremonies! Soosun had heaps of family and friends, and my parents, sister and her husband and one of my grandmothers and some of my close friends were able to come to Korea for the wedding.

We got up bright and early and went to the Korean hair, make-up and dressing place before the wedding, and also had a spot of breakfast.

prewedding1.JPG   prewedding2.jpg

One we got to the church, we welcomed friends and relatives and had photos taken.

At noon, we had the wedding ceremony in the church. Soosun’s uncle is a Catholic priest, and he performed the ceremony and took our vows. It was then time for lots of photos with all possible permutations of relatives and friends.

Picture with Soosun’s uncle  Family  Friends

After the religious ceremony, we changed into our hanboks. Meanwhile, the guests were enjoying the banquet. The food looked really good and we had a chance to nibble a little bit before cutting the wedding cake with a sword and making toasts.
Cutting cake with a sword

The last part of the ceremony was traditional Korean. We dressed up in a double layer of traditional Korean hanboks and bowed away like crazy to relatives, and they gave us advice and honeymoon money in envelopes. We poured plum alcohol for close relatives out of a teapot and drank with them. We at dates stuffed with pine nuts and various other traditional foods. Our parents threw chestnuts and dates and we had to catch them in Soosun’s hand veil. We caught 10 dates and chestnuts altogether, which means we’re meant to have 10 children!

Sitting pretty in traditional costume  Bowing to mum and dad  Catching chestnuts and dates

After the wedding, the younger crowd headed out to Beer Plus for an after party…
img_3416.JPG  img_3418.JPG

The whole wedding ceremony was recorded, and we’re going to edit together a short highlights movie. Stay tuned…

Practical JRuby on Rails (Web 2.0 Projects) by Ola Bini

The fine folk at Apress sent me a copy of Ola Bini‘s new book to review. The full title is “Practical JRuby on Rails Web 2.0 Projects – Bringing Ruby On Rails to the Java Platform”. Overall, it was a good read, and extremely valuable to anyone who is developing in JRuby. JRuby information and documentation is scarce and most of the time, a Google trawl does not give you good results on a JRuby related query. Ola’s is the first, and currently the only JRuby book available, and in my experience, the most valuable resource available to give you an all-round picture of JRuby capabilities and usage.

Audience
Despite comments on the cover, I would suggest that this book is not ideal for people new to Ruby / Rails. Ola jumps in the deep end quite quickly, and being a talented Ruby programmer, makes use of lots of shorthand, procs, code blocks etc which would likely be hard to follow for someone new to Ruby. Although there is a section at the back called “Ruby for Java programmers”, I think this would not be sufficient for somebody new to Ruby to understand all the code examples.

To get the most value out of the book, it would be good to have at least a basic understanding of Ruby and Rails (eg, having read Agile Web Development with Rails or messed around with Ruby/Rails a bit) and a basic understanding of Java syntax, deployment and Java EE.

What’s Covered?
The book is project based, so as to give context and useful examples of JRuby functionality. There are 4 projects:

  • The Store (Shoplet) – a standard Rails app running under JRuby using Active Record JDBC.
  • Content management system – general Java integration and using Java libraries for content rendering.
  • Administration System – using EJBs, JMX and discussion of JRuby deployment options.
  • Library System – JRuby as the “glue that never sets”. Using Java Web service frameworks and JMS from JRuby.

The Good

  • Teaches you how to do all those tricky bits which are half-Java and half-Ruby and can’t be easily found online, such as converting between Ruby and Java types, including JAR files, implementing Java interfaces, etc
  • Clever and concise Ruby code – I picked up some Ruby tricks reading Ola’s code.
  • Complex code snippets are generally well explained in text.
  • Useful tips on when to use Java libraries and when to use Ruby ones.
  • Generally good and interesting example projects which justified the use of JRuby and the techniques shown in the book.
  • Helpful discussion of JDBC and database connectivity options for JRuby.
  • Nice overview of the many JRuby deployment options.
  • Helpful “sidebars” about Java Enterprise Edition technologies.
  • Covers the strong areas of JRuby well – web applications and system integration.
  • Appendices provide useful reference information.
  • Nice section at the end on how you can get involved in JRuby.

The Less Good

  • Example views often contain table layouts, inline styles and other layout information that would be better done in separate CSS files.
  • Variable names in code could be more descriptive. This would make example code easier to follow.
  • Occasional odd spelling like “sur_name” and use of deprecated Rails features, such as “start_form_tag” (to be fair though, Rails API does change very quickly).
  • The title suggests that the book is about Web 2.0. There is a little token AJAX, and I suppose a content management system is a bit Web 2.0, but overall, buy the book if you want to know about JRuby, not Web 2.0.
  • Although REST is only mentioned briefly in a little sidebar, and not a focus of the book, I found the description of REST and CRUD a bit misleading, especially when considering PUT vs POST.
  • The discussion of JRuby deployment provides a good overview, but more in depth discussion of major options (eg, GoldSpike), and production configurations would be great.

Conclusion
As the best and only JRuby reference, I’d highly recommend you buy a copy if you are working in, or planning to work in JRuby. The book will help you to write JRuby applications which make good use of Ruby, Rails, Java libraries and Java Enterprise Edition features.

Treo 650 incompatible with Optus Postpaid SIMs

Over the last 6 months, my old Treo 600 touch screen was dying. Cleaning and re-seating helped for a while, but eventually, the touch screen stopped working. As the Treo 680 barely improves on the Treo 650, and costs a lot more, I bought a new-ish Treo 650 on eBay. All went well until I tried to send SMSes using my Optus SIM. No luck – I got an error 4027 every time I tried to send a SMS, although voice and GPRS worked fine.

First attempt at a solution was to set the Message Centre Number in the phone. Strangely, the Message Centre number (configured though the SMS app) was always empty, and when I tried to set it to the correct number for Optus, the value wouldn’t stick past a phone reset.

Thanks to Google, I found the outline of a solution on a message board.

In summary, the Treo 650 (unlike the Treo 600) is not compatible with Optus’s standard post-paid/plan SIMs used in Australia. However, it is compatible with the Optus pre-paid SIMs. If you have a Treo 650, and a post-paid/plan SIM, you can buy yourself a new pre-paid SIM for $4 from your local Optus store, then ring the Optus call centre to have them do a “SIM replacement” to move your account and number to the new SIM. This solves the problem within minutes of the “SIM replacement”.

Page 12 of 20

Powered by WordPress & Theme by Anders Norén