Entries from March 2009 ↓

Adding Sorted Inserts to Cocoa Arrays

Fredrik Olsson

NSArray and NSMutableArray have methods for sorting arrays, NSArray returns new sorted arrays and NSMutableArray can be sorted in place. The sort methods comes in three flavours; using a function, using a selector, or using an array of NSSortDescriptor objects. NSArray admits to sorts being a slow operation, and adds a method pair for comultive [...]

Tags: , , , , , ,

Honoring our Industry Gurus

Henrik Bernström

The Halmstad office where I belong is a quite nice place to be. It’s clean, there are five desks and a sofa, and… yeah, that’s about it. Practical but perhaps a bit boring. We have these white and rather dull walls with nothing but whiteboards hanging on them so we figured, what could we do [...]

Tags: , , , , , , , , , , , ,

Layout resources in Android

Mattias Rosberg

One thing that often confuses developers new to the Android platform is the handling of layout resources. The xml files describing the layouts are magically transfered into a more efficient binary format behind the scenes and hidden away – leaving the developer with a static reference to the resources via the R.java file. By using [...]

Tags: , ,

Waygroup joining Earth Hour 2009

Peter Neubauer

Hi there, we decided to join Earth Hour and try to get all people at Jayway, Testway, Realway, Dotway and Leadway to save as much energy as they can on Saturday, 20.30 – 21.30. If you read this, please join in and register yourself or your organization! It won’t save the planet but it will [...]

Tags: ,

EasyMock: Capturing arguments from multiple calls

Jens Nordahl

With EasyMock it is, in some cases, difficult to set up sufficiently precise expectations for the mocks. This may be because we don’t know in advance with which arguments they get called or how often they get called. Or because the verification, we have to make in the test, involves relating the calls to one mock object to the calls to another mock object or relating calls to mock objects to data returned from the object being tested.

In such cases the solution may be to capture “traces” of the method calls to the mock objects, and then, after having exercised the object being tested, to make the needed verifications using the captured traces.

Tags:

Bridging the Gap Between Java and Cocoa

Fredrik Olsson

Many Java developers are looking at new dynamic languages, such as Groovy and JRuby, mostly because of the freedom and rapid development that a dynamic language allows. Some of my colleagues are also looking at Cocoa and feel daunted at the sight of Objective-C. Here I will use a small example that is easy and [...]

Tags: , , , , , ,

Executable .jar, with onejar-maven-plugin

Hugo Josefson

Onejar-maven-plugin collects your application including dependencies, into one executable jar. It’s both easy and works well!

(UPDATED for version 1.3.0. See below.)

It lets all your dependency jars stay jars, and your code is in its own jar. All of those jars are put in a bigger jar, which is made executable.

Configuration

It may sound weird, but it’s quite elegant! Just put this in your pom.xml‘s <plugins> tag to make it work:[...]

Tags: , , , , , , ,

UIToolbars in iPhone OS 2.x

Fredrik Olsson

The new release of iPhone OS 3.0 adds some nice API:s for managing a contextual toolbar. This is well needed as toolbars in the current iteration of iPhone OS is not only poorly documented, it is also quite hard to do right. So I will go over how to do toolbars the right way, for [...]

Tags: , , , , , , , ,

Getting started with JavaME jUnit testing

Mattias Severson

Introduction Unit testing is a very powerful tool that should be included in every developer’s toolbox. Unfortunately, this has not always been the case, especially not among MIDlet developers. One reason is that JavaME projects usually are small (compared to Java SE projects), which implies that manual testing could be enough. However, as soon as [...]

Tags: , , ,

How to mock MIDP RecordStore

Mattias Severson

The challenge PowerMock is a mocking framework that claims to have almost supernatural powers. According to its documentation it is able to mock both static and private methods, final classes, and other nasty things that would be insurmountable obstacles for other mock frameworks. As a result, it has been stated that it should be able [...]

Tags: , , ,

iPhone OS and the Lowest Common Denominator

Fredrik Olsson

Nishant wrote a good piece on why Apple continue to outdo it’s rivals, he used a variant of a quote by Canadian hockey player Wayne Gretzky to make his point: A good hockey player plays where the puck is. A great hockey player plays where the puck is going to be. This is true as [...]

Tags: , , ,

Configuring Timeout with Apache HttpClient 4.0

Mattias Hellborg Arthursson

Great news everyone: just recently an all-new version of Apache HttpClient was released. HttpClient is now part of the new initiative Apache HttpComponents, which seems to aim for a complete approach to Http programming in Java; server side as well as client side. I’ve used Commons HttpClient in older versions on several occasions in the [...]

Tags: , , , , ,

On Twitter…

Mattias Ask

Twitter has actually just recently gotten a lot of traction in Sweden and Scandinavia. Google Trends show this clearly which means that a Swedish blog-post about Twitter is still sort of relevant What is Twitter? Well, it’s a micro blog. Users post so called tweets, messages with 140 characters or less. You can tweet, follow [...]

Tags: , ,

Mavenizing the Liferay Plugin SDK

Henrik Bernström

Liferay is the leading Open Source enterprise portal platform in the Java market. It’s certainly an impressive piece of software. I’ve been following it for some time now and the product is improving a great deal in many areas, perhaps most in end user usability. One area that, in my opinion, could still be improved [...]

Tags: , , , , , , , , , ,

Scala IDE support

Michael Kober

Today we wanted to test the scala java interoperabilty in different IDEs. We used the Scala plugin for Eclipse, Netbeans and IntelliJ. The intellij plugin worked out of the box. We managed to get the eclipse plugin working after some trouble as well. Although the netbeans plugin seems promising the interoperability between java and scala [...]

Tags: , ,