Google Android Development Agency SASS

Friday 22 January 2010

Using C# 3.0 and LINQ with Kentico

I just encountered a weird problem with a custom webpart in Kentico CMS v4.

Our project is configured in VS.NET as a .NET 3.5 website; web.config references 3.5.0 assemblies and there's plenty of references to System.Linq in classes.

This morning I cane across an instance where I thought it might be useful to use a LINQ query to extract a filtered List from another List. I wrote my code

var filtered = (from m in data where m.DepartmentID = 1 select m)

VS.NET syntax highlighting was happy and showed no errors. However, when I browsed to the website I got the error "the type or namespace name 'var' could not be found" and varyingly various different "missing )" errors.

Clearly IIS wasn't treating this website as a 3.5 site. Easy to fix thankfully, I just added the following to web.config:


<system.codedom>
<compilers>
<compiler language="c#;cs;csharp"
extension=".cs"
warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>

Wednesday 20 January 2010

37 Signals - An unashamed testimonial

There's always a difficult balance in software engineering and the management thereof between choosing a toolset which is feature rich enough to be useful and lightweight and usable enough to make it, well, usable.

When it comes to project/development management I've tried everything from Microsoft Project Server to a whiteboard stuck to the development office wall.

Whilst Microsoft Project gives undeniable control over every minute detail of a project, it's not exactly lightweight and project plans can become cumbersome once you start adding progress tracking and expenditure.

On the flip side, a whiteboard on the wall is infinitely flexible, immediately visible and easily updated. Plus, you can draw all manner of rude things on it when you're bored and pin posters of your favourite Hotrod in my case to it. The downside is it's not inside one of them darned new-fangled computer machines so it can't send you a message to say you forgot to test yesterdays build on IE6 before releasing it you ningcompoop.

For the past year or so I've been trying to drag the easy-wipe marker from my hand and get everything electronic so that I can get reminders and such, and the toolset I've come to rely on is by those masters of lightweightness 37Signals.com.

We're now using their Basecamp product almost exclusively to manage our day to day tasks. Here's our setup:

We create Date-related Milestones for any deliverables. That way the deliveries appear on everyone's dashboard so noone can claim that they didn't know about it.

We create task lists for every milestone, tied to that milestone.
Now everyone knows what tasks need to be done to meet the milestone.

We add a due date to each task.
It's not exactly going to make a gannt chart, but now at least we've got some semblance of a plan. (That's a plerrrrrn if you speak geordie like me).

We turn on daily email digests
Now every morning at 9am we all get digest in our email of what's happened and what's coming up. Because everyone is too lazy to open Basecamp and check everyday and everybody opens their email in the morning to check for the latest hervia.com newsletter. Or is that just me?

We sync our Google Calendar with Basecamp
Praise be! Google Calendar syncs via iCalendar so all of our milestones appear in Google Calendar and we can add additional reminders if we think we're really going to forget about testing on IE6. (And god knows we're trying...)

So the moral of this outburst is, if you're not operating in a hardcore PM environment and are looking for some lightweight tools to manage your development activities, checkout http://basecamphq.com/ from 37Signals.

And no I don't work for them. But if you're listening Jason Fried I would not say no.

Wednesday 9 December 2009

NUnit and App.config

Here's the problem: You have a project which you want to unit test with NUnit but the project relies on some appSettings or other config data normally loaded from app.config or web.config. You know the sort of stuff, connection strings, usernames etc.

When you run your code in NUnit you get a NullReferenceException when you try to access your config, it's like it's being ignored.

I come across this problem quite often but I always have to refresh my memory of how I fix it. Well there's two ways, but only one I can get to work reliably:

1) When you create your nunit project, rather than clicking Project-> Add Assembly, just drag your DLL from Windows Explorer onto NUnit. After doing this it'll pick up the assembly.dll.config file for your assembly. I couldn't get to work reliably though, it would work once and then fail.

2) You need to have a config file named the same as your nunit project and located alongside. So in my case I have com.sass.ecommerce.tests.nunit and alongside it my assembly (com.sass.ecommerce.tests.dll) and my renamed config file, com.sass.ecommerce.tests.config.

Doing it the second way gave me more reliable results and I could access my config file no problem from my unit tests.

Tuesday 1 December 2009

Tub Thumper Pro for Android out this week

At long last, we're looking at releasing Tub Thumper Pro for Android this week.

We've been into Android Development since day one and I've been constantly suprised at the amount of positive feedback we've had from the first version of Tub Thumper. We receive emails daily asking us about the pro version so I'm hoping it's going to be well received.

I'll put some more details online once it's live in the Android Market, but here's a screenshot of the sequencer interface in the meantime, which is one of the coolest new bits.


Tub Thumper Pro Sequencer Screenshot
You'll need at least Android 1.5 to run it and a touchscreen device. It's pushing the low-level audio features of Android with this tool, although I already have plans for Tub Thumper Pro 2! Watch this space...

At last! A good UML Editor for Visual Studio

For years I've been trying various different UML/CASE tools for designing .NET based solutions and until now I've always been left diasappointed. (I've not tried the new in-built tools of Visual Studio 2010 yet...)

This week I've been working on an e-commerce system for a client of ours who have chosen to use Sagepay as their payment gateway. Their site is built on the Kentico CMS platform and the Kentico E-commerce system doesn't support Sagepay out of the box, so basically I'm designing a payment provider for it.

I decided to try once again to find something decent to do Use Case diagrams, Activity diagrams, ST diagrams etc in so that I don't have to resort to Visio and Word as always.

Praise Jebus! Something good at last in the form of Tangible T4 Editor for Visual Studio. This is a plugin for VS.NET which allows you to create half-decent looking UML painlessly.

Here's an Activity diagram for the aforementioned e-commerce system I'm working on:




The only gripe I have so far is with the Use-case diagram tool; it would be really nice to be able to double-click on a use-case to open up a text-view of the actual use case allowing me to document the steps and pre and post conditions.

Here's the best bit: THERE'S A FREE VERSION!

Friday 27 November 2009

Android AudioTrack source

I've been doing a lot of work optimising our audio playback on Tub Thumper Pro for Android this week and I constantly find myself referring back to the C++ source for the OS to help solve latency issues.

For anyone doing work with the AudioTrack object, it's worthwhile bookmarking the source online so that you can browse it whenever you hit a problem.

Here's two links I find really useful:

Incidentally, I've found that the best way of getting low-latency polyphonic audio is to subclass AudioTrack and call finalize() yourself after you're done playing; I was seeing more "write blocked for xx seconds" messages before I did this, although it may be co-incidental.

Thursday 26 November 2009

Useful tool for building Android user interfaces

Android user interfaces are built using XML and the support for graphically laying these out in Eclipse is limited to say the least. (There are many things wrong with Visual Studio .NET but at least the UI builder is reasonably well sorted...)

A while back I came across DroidDraw - a third party tool for prototyping UIs. I think I must have had an early build back then because it had some issues, but I downloaded the latest build today and it's now hugely useful.

If you want to throw some Android user interfaces together head over to http://droiddraw.org/ and try it out. It's the tool Google should have included with the SDK!