Softwire Blog


Lightning Talks: Tim Perry’s Lightning Talk: Performance Testing Better


10 May 2013, by

In April 2013 Rupert Wood organised our second Lightning Talks competition where eight employees each had five minutes to tell us something interesting about software development. This time our theme was “A Call To Arms”. Once again we voted on our favourite talks and the top three won Amazon vouchers.

This is Tim’s second-place talk: “Performance Testing Better”. He explains why it is important to build performance testing into your project from an early stage and practical steps for setting this up and monitoring the results.

Training Tracks: How to become amazing at JavaScript


20 March 2013, by

previous article in series

Here’s Rowan‘s Training Track on JavaScript: we hope you find it useful! 

(“Training Tracks” are one strand of our in-house training – see here for an explanation of what a Training Track is.)

(more…)

Training Tracks: How to become amazing at User Experience


25 February 2013, by

At Softwire we select employees on the basis of technical ability and potential as well as technical knowledge, and provide all the training that our new recruits need in-house. It goes without saying, then, that training is  something we devote a lot of time to getting right, and it takes many different forms.

We thought we’d share one of those forms with you: our set of recommended reading lists or “Training Tracks”. We get a top developer to compile a list of books, tutorials and other on-line resources for a specific technology or area of development, and categorise them into different levels, all the way from beginner (Level 1) to ninja (Level 5 and beyond). Below is Tej’s UX Training Track to start the series: we hope you find it useful!

(more…)

Lightning Talks: Your XML Parser Will Destroy Everything You Have Ever Loved


3 December 2012, by

Softwire ran a Lightning Talks competition where 8 of our employees had 5 minutes each to tell us something interesting about Software Development. We all got to vote on our favourites and the top 3 won Amazon vouchers.

Here’s the winning talk: Tim Perry with “Your XML Parser Will Destroy Everything You Have Ever Loved”. Congratulations Tim!

(You can view the slides here.)

Lightning Talks: You’re All Doing JavaScript Wrong


12 November 2012, by

Softwire ran a Lightning Talks competition where 8 of our employees had 5 minutes each to tell us something interesting about Software Development. We all got to vote on our favourites and the top 3 won Amazon vouchers.

Here’s the third-placed talk: Hugh Greenish on “You’re All Doing Javascript Wrong!”

Updating a tree of selections


18 September 2012, by

Last time I discussed how to render a tree of selectable items in HTML, including partially-selected branches. This time I’m going to talk about initialising, maintaining and persisting this state from a selection tree.

This is actually all very straightforward once you’ve spotted the basic principles of how the tree works:

  • a non-leaf node is selected if-and-only-if all of its descendant nodes are selected
  • likewise a non-leaf node is de-selected if-and-only-if all of its descendant nodes are de-selected
  • therefore a non-leaf node with a mixture of selected and de-selected descendants is partially-selected.

An illustration of the three basic rules: selected if-and-only-if descendants are all selected, de-selected if-and-only-if all descendants are de-selected, partiaully-selected otherwise.

(more…)

NCrunch: Unit testing, the right way?


4 September 2012, by

NCrunch is an automated parallel continuous testing tool for Visual Studio .NET. It intelligently takes responsibility for running automated tests so that you don’t have to, and it gives you a huge amount of useful information about your tests (such as code coverage) inline in your IDE while you work. Basically, it runs your unit tests for you, simplifying your workflow.

(more…)

Using tri-state checkboxes in HTML


18 June 2012, by

a partially-selected tree of checkboxesSometimes you find yourself requiring a third state for checkboxes to show ‘partially selected’. In the bad old days, if you needed to implement this (or other complex checkbox behaviour) on a web page you had no choice but to make fake checkboxes using clickable images. This meant you had to reimplement any other checkboxes on your site using the same clickable images to keep a consistent look-and-feel.

However, nowadays most browsers support a native third ‘indeterminate’ state for checkboxes as a DOM property: (more…)

Getting my feet wet with Scala


26 April 2012, by

The hype around the Scala programming language just got too much recently and I decided to give it a go. I’m two thirds of the way through Programming in Scala, a massive but very good tome and I’ve been experimenting with the language and tools, though only a little bit so far. I have also just received the newly published Scala for the Impatient (a deliberately much more compact book) and will be working through that as well.

Scala is an attractive proposition to the adventurous Java programmer (it being a JVM-based language) bringing a wealth of advanced features that promise to cut down on boilerplate and deliver more elegant solutions with less code. Scala is not for the faint hearted though, or anyone who just wants to get some stuff done ASAP. There is a big, steep learning curve and the relative immaturity of the language and the small community means you’d better be used to the pains of the bleeding edge. I thought Ruby was hard work, but Scala is frankly more so in my experience so far.

However the language is somewhat addictive – or perhaps I just like the challenge of learning stuff that takes a bit of grokking. It’s a big language, with many very clever facilities and features. It’s mind-boggling to start with but I think it’s sinking in now. Of course there’s the functional paradigm to understand and master, but I did plenty of that at university so it doesn’t frighten me.

Enough people have written about the frustrations and wonders of writing code with Scala (here, for example), so instead I shall reflect on a few miscellaneous findings, mostly of a practical bent.

(more…)

JavaScriptSerializer circular reference error when serializing a proxy object


19 April 2012, by

One day, my code suddenly started throwing circular reference errors while trying to serialize objects into JSON. There was no circular reference, and I couldn’t figure out why the couple of extra lines that I last added would affect serialization. What’s more, it only threw an error when I was logged in as certain users, and not as others.

The problem was that the object it was trying to serialize sometimes appeared as a proxy instead of the actual object. This happens if NHibernate doesn’t have enough information to resolve all the dependent objects after the first load – in our case it was dependent on the length of the chain in a parent-child tree. We first attempted to tweak our lazy loading config via .LazyLoad(Laziness.NoProxy) in our Fluent NHibernate mapping, but that laziness mode is only supported on some relationship types and not on the ManyToMany that was the cause of our problem, so this didn’t help us.

There seem to be a lot of people out there asking the same question, and some very complicated solutions being offered (such as this one using Json.Net).

However, in some cases there is a fairly easy workaround you can employ: unproxy the object before you serialize (see here).

Put this in the EntityBase:

public virtual T As<T>() where T : EntityBase
{
  return this as T;
}

And then when you want to serialize it, do something like

var lSerialiser = new JavaScriptSerializer();
unproxiedObject = originalObject.As<User>();
return lSerialiser.Serialize(unproxiedObject);

Note that this will not fix the issue in all cases. But if it works for you, then we’re glad to have been of service!