Posts

When tests become hard

A friend contacted me for advice. He was having trouble writing a test for some code. I asked him to send me the code and the test so I could see what was going on. I encounter this problem quite frequently, so I thought I'd post one of my responses... Okay, here is where I think you are going wrong, and when writing tests becomes hard, it’s usually because of this. It’s important to layer your applications. Web/Services/DB – at least conceptually. What you have is a class that does everything. Web and Service. No-one can reuse your file processing logic without using the web, not even tests! A nice way to code would be to: Write a UNIT test that attempts to process a file. It passes in a file X and asserts that the result is Y. It won’t compile because you haven’t written the file processing code yet! Now you write the service which processes the file The test will compile and run now, but probably fail because you forgot something. Now you can fix your service And ...

Solved - Trouble with the Samsung Galaxy S 1 phone

My wife has had a Samsung Galaxy S1 Android phone for over a year now and its been great. Recently though, she'd been having terrible battery performance and had noticed that after charging the phone overnight, it was only at 50% in the morning. My first thought was to buy a new battery, but then I figured I'd try updating the firmware first. Thats when I discovered that windows couldn't recognise the device!! This was a big issue - how could I get all of her photos off the phone? Solutions: Quite by accident, she plugged her phone into an iCoustic USB charger that we got with an iPod accessory pack - this fully charged the battery and now there are no battery issues. She'd been using my iPad USB charger previously and for some reason, this makes a difference. I realized that when syncing the phone with Kies I wasn't using the original USB cable that came with the phone. We'd been using a third party cable we'd bought after losing the original one. Sinc...

Grooveshark for listening to music

I've just started using Grooveshark.com for listening to music. Running in the browser, its a great cross platform solution - no installs necessary. I'm just running the browser on my MythTV media center, with the sound via the TV. The quality seems great, even though I've got it on the lower quality, and I'm hoping its just what I need to find some new and interesting music.

Fixing browser sound on Ubuntu 11.04

I've finally fixed sound via the browser on my Ubuntu 11.04 MythTV media center. MythTV was working fine, but the browsers never even tried to play sound (the sound settings would show NO applications using sound, when Chrome or Firefox should have been). The information I needed was here and I had no /etc/asound.conf so I had to put the following in ~/.asoundrc - pcm.pulse { type pulse } ctl.pulse { type pulse } pcm.!default { type pulse } ctl.!default { type pulse }

Could not complete schema update

I recently mapped a JPA entity to a view, and encountered this error while using hibernate to update the database schema: ORA-01702: a view is not appropriate here [SchemaUpdate.execute] could not complete schema update I was using the Oracle JDBC drivers 10.1.3.3 - luckily, the solution was to upgrade the drivers - when using 11.2.0.2.0 it works fine. Download ojdbc6.jar from here: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html ojdbc6.jar (2,152,051 bytes) - Classes for use with JDK 1.6. It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types.

On to some exciting stuff

I went to a Agile Sydney meetup recently - "Automated web tests as a team communication tool" - by John Smart of Wakaleo Consulting . It was great stuff, and the presentation is now online . There is a nice story here in that the project feature set is documented via easily readable and executable tests, and the reporting shows which features are implemented and which aren't. More information on the the Thucydides tool he references can be found at: https://github.com/thucydides-webtests/thucydides/wiki While reading that presentation online, I found more gold here in some of his other presentations: JUnit Kung Fu: Getting More Out of Your Unit Tests Introduction to Domain Driven Design They are a great read and are great pointers in the right direction to improve your software development. (If you haven't seen them before, check out Wakaleo's training courses . I haven't been on them, but based on the course content, they look to be the most relevant ...

Using the Crystal Reports Java API to generate PDF

I recently had to investigate how to generate a PDF from a Crystal Report created by another team. Without knowing anything about Crystal Reports, I had to google around for information and piece it all together. It turns out to be really simple once you know how. We were using Business Objects 4.0, and probably the most important thing was to get the Java library - download 'SAP Crystal Reports for Java runtime components - Java Reporting Component (JRC)' from http://www.businessobjects.com/campaigns/forms/downloads/crystal/eclipse/datasave.asp There are a lot of samples on the web to look at - you might find something to help here: http://wiki.sdn.sap.com/wiki/display/BOBJ/Java+Reporting+Component++SDK+Samples A good example to start with is “JRC EXPORT REPORT”: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40d580ce-bd66-2b10-95b0-cc4d3f2dcaef If you have an RPT file, the java to generate the report is relatively simple - : ReportClientDocument reportClie...