Finally got my patch committed!

I’m stoked. With the release of MonoDevelop 0.14 my class and member selectors are finally in the core MonoDevelop. I know it’s only a small contribution, but personally it’s a feature I find very useful so I hope other people are deriving some benefit from that work too. I do notice that most of the screen shots of MD I see have them enabled so I guess it’s not annoying people enough to turn it off!

Anyway, here is my little claim to fame:

Ndbunit is great – once you get past the pain

Over the last few days I’ve been setting up my latest project to use Ndbunit to initialise the database to known state prior to running each of my unit tests. It has been a bit of painful process as the documentation is fairly minmal and non-existant for some features, but I think I’ve got there now.

A couple of things I wanted to put down here in case I ever forget them and start banging my head on the desk again!

Firstly if you want to use the InsertIdentity method you need to make sure your xsd sets the AutoIncrement attribute to true for your identity column. eg.

<xs:element autoincrement=”true” type=”xs:int” name=”PERSON_ID”>

Secondly if you want to insert more than one row into a table you need to make sure your xsd sets the IsDataSet attribute to true e.g

<xs:element name=”PERSON” isdataset=”true”>

subversion 1.4.3 on ubuntu Edgy amd64

Just went through a few dramas tonight to upgrade svn on my system from the old 1.3.2 version that is in the ubuntu repos to the latest 1.4.3.

I found this howto which gets you almost all the way there. Unfortunately amd64 uses will get a link error complaining that libneon.a needs to be compiled with the fPIC flag. This is easily fixed by changing the following line in neon/src/Makefile (line 28) after the configure step from this
CFLAGS = -g -O2
CFLAGS = -g -O2 -fPIC

then you make and install as per the howto.


Cool open source .NET charting component

I’ve been looking around for a decent free (as in beer) .NET charting component that I can use from ASP.NET for my current website project. At first I tried WebChart, but it didn’t seem to want to work under mono. I could have probably figured out the problem with a little bit of effort, but I’ve got better things to spend my time on at the moment. So a little more digging and a search of the Mono mailing list uncovered zedgraph. This component is awesome. Take a look at some of the sample graphs – it produces really professional looking results.

Now I haven’t delved into the guts of it yet, that’s tonight’s task, but I just wanted to let people know it’s out there.

nhibernate – a complex beast

I am beginning to discover that nHibernate is a far more complex beast than I realised. Over the last couple of days I’ve spent some more time reading the documentation (out of necessity rather than pure interest) and it is capable of some amazing things, however this flexiblity comes at the cost of complexity (as is often the case).

Here’s an example of a trap for young players that caught me the other night. I have two entities A & B that map two two underlying tables tableA and tableB. The primary key of tableA is a foreign key in tableB. tableA contains a property Rating1Count which is the count of a column in tableB. I had code similar to the following:

ISession session = NHibernateHttpModule.CurrentSession;
ITransaction transaction = session.BeginTransaction();
    log.Debug(“Saving new B”);

    log.Debug(“saved new B”);
    ICriteria crit = session.CreateCriteria(typeof(A));
    crit.Add( Expression.Eq(“AId”, a.AId) );
    log.Debug(“Executing query”);
    IList As = crit.List();
    if (As.Count == 1)
        a = As[0] as A;
        log.Debug(string.Format(“Count of 1s in tableB {0}”, a.Rating1Count));

After testing this I found that even though my changes were being persisted to tableB (verified by querying mysql directly) they weren’t reflected in my tableA object.

Then it dawned on me, at what point does nhibernate write the changes to the database? I moved the transaction.Commit line up to be directly below the call to SaveOrUpdate and lowe and behold it works!

In hindsight it’s obvious, but it had me scratching my head for a while (and it was late – at least that’s my story and I’m sticking to it!).

MonoDevelop hacking

Spent the last couple of evenings updating some work I did on MonoDevelop ages ago but never got round to submitting. The internals of MonoDevelop have really changed since I first wrote my code so I had to spend a couple of hours updating it to work with the new version of MonoDevelop from SVN.

I then realised that I hadn’t quite got it right last time as the method combo would only show the methods the class had when the file was opened. i.e. if you added a new method it wouldn’t show up in the combo until you closed and reopened the file. With some helpful pointers from Lluis on #monodevelop last night I think I have just about solved that problem by hooking into the IParseInformationChanged event. This event fires with every key stroke. With a bit of GLib.Timeout goodness to stop the combos being rebound every time the event fires we are almost there…

Gtk# woes

Well, I have spent a decent amount of time hacking on f-spot today and have achieved exactly nothing. I have two problems to fix before the first cut of the Compare view for f-spot will be ready for review. One is a nasty problem with scroll bars not rendering correctly. I have a feeling that this is to do with the underlying ImageView class and so not something I can fix without talking to Larry Ewing about it. The second problem is I can’t seem to get any events firing of the those same scroll bars so I suppose it could be somewhat related. Hopefully I will be able to catch Larry on IRC next week and sort it out.