Wednesday, July 30, 2008

Avoid cryptic errors with Setter injection and Spring.Net

Today I found out about a really neat feature in the Spring.Net framework that can help enormously with debugging Spring.Net configuration problems.

If you are using setter injection and have properties that need to be set (why aren't you using constructor injection?) then you should decorate those properties with the [Required] attribute. You then need to add a built in post processor to your application configuration like so:
<object type="Spring.Objects.Factory.Attributes.RequiredAttributeObjectPostProcessor, Spring.Core"><object/>

Now if you forget to configure one of your required properties instead of getting a cryptic dependancy error like this:

Spring.Objects.Factory.ObjectCreationException: Error thrown by a dependency of object 'myWidget' defined in 'assembly [Widgets, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], resource [Widgets.application-config.xml]' : Initialization of object failed : Object reference not set to an instance of an object.
while resolving 'constructor argument' to 'otherWidget' defined in 'assembly [Widgets, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], resource [Widgets.application-config.xml]

You get a nice helpful error like this:

Spring.Objects.Factory.ObjectInitializationException: Property 'OtherWidget' required for object 'myWidget'

Much more helpful!

Labels: ,

Monday, July 28, 2008

Book Review: CSS Mastery


As a web developer I've had to do a certain amount of CSS development over the years but never really felt like I understood it. CSS can be a bit of an esoteric beast and I wanted something to clear the fuzz away.

CSS Mastery was the solution I had been looking for. Andy Budd writes in a clear and engaging manner and the book is extremely readable for a technical text. Andy starts by getting right back to basics covering the Cascade and the Box model in the first two chapters.

The book covers most aspects of CSS with concise and easy to understand examples used through out. Andy also spends a good amount of time on cross browser compatibility issues where appropriate, as well as including a whole chapter of hints and hacks on this topic at the end.

If you are just starting out with CSS, or like me have used it for years but never really understood it at a visceral level then I urge you to give CSS Mastery a try.

Labels: , , ,

Thursday, July 24, 2008

Why new website startups fail?

I've been under an enormous amount of self induced stress lately due to the fact that my startup business still isn't online. This is due to a number of contributing factors of course, but it got me thinking about some of the reasons why it's taken so long.

Manage Scope: Trying to do to much too soon

It would be my guess that a large number of failed business (particularly online ventures) are guilty of this one. If nothing else this experience has taught me that you need ensure your initial offering constitutes a realistic amount of work. You can then build on that by making small incremental improvements adding features and new offerings to your business over time with much less effort than trying to do it all in one go.

By all means, have a grand all encompassing vision, in fact I'd almost consider this a prerequisite, but break it down into realistic bite size deliverables. To make a software analogy; you want to take a rapid iterative development approach rather than attempt a huge waterfall model project.

It doesn't have to be perfect

There is always a tendency with geeks (myself included) to try and engineer the best, most flexible, and high performance solution first time round. Unfortunately this flies in the face of getting a new business off the ground. As a new start up you have limited time and money and you can't afford to waste either trying to come up with the "ultimate solution".

Any coder worth their salt is going to try and anticipate performance bottle necks and design and develop their software to avoid potential pitfalls. However you've got to keep your focus on the goal of delivery at all times and not get trapped in refining and improving your product without delivering. It doesn't matter if you have the best website in the world if no-one can use it because it isn't online yet!

Don't forget the business

Project planning, it's not fun and certainly not something most geeks enjoy. Unfortunately it is absolutely necessary to make your new business a success. You need to have a clear idea of what your deliverables and deadlines are, and what your outstanding tasks are at all times. There isn't much point getting to the end of development, having built an outstanding best of breed product and suddenly realising you don't have a company set up, bank accounts, tax registration, contracts, lawyers, accountants and all the other mundane things that are prerequisites to running a business.

Are you trying to get a tech startup off the ground? Do you have any advice for other would be entrepreneurs?

Labels: , , ,

Mono bugs fixed; Spring.Net support coming soon!

I've managed to get all my Mono patches committed in time for 2.0 which be released very soon. Bugs I've fixed are:

#325128 ConfigurationSection.GetRuntimeObject
#395209 Fix incompatibility in the HierarchicaDataBoundControl
#397612 Mutually exclusive behaviour between Mono and MS.NET for xs:import

As well as a couple of other fixes I didn't create bugzilla bugs for:
The TypeDescriptor bug which I blogged about a while ago, and another XmlSchema bug where Uri.OriginalString wasn't being returned in the correct case.

Hopefully with these Mono bugs fixed in the latest release the major barriers to getting Spring.Net support finished and committed in will be removed. I'm in the process of working through my patch with Mark Pollack, so all going well we may see some Mono support in the next Spring.Net release.

Labels: , , , ,

Saturday, July 19, 2008

background-image position in IE6 with png images doesn't work!

After spending about three hours hacking CSS and searching the web today I've discovered that IE6 doesn't respect the positioning of your background-image if you are using png's. Both gif and jpg images work as expected.

So if you're wondering why something like this:

background: White url(../Images/promobox_bottom.png) no-repeat center bottom;

isn't rendering correctly in IE6, try a different image type.

Labels: ,

Thursday, July 17, 2008

Book Review: Iron Man: Extremis

This is the first Iron man comic I've read (Extremis is actually a 6 part series grouped into a single volume) but I absolutely loved it. I got inspired to give Iron man a go after seeing the recent movie which I also really enjoyed.

Extremis covers the genesis of the modern Iron Man character, although it is slightly different to the movie version. The comic doesn't dwell on the back story but drip feeds the reader with a series of flashbacks. This makes it interesting without feeling contrived.

The artwork is simply excellent; the storyline is compelling and well written with the exception of a couple of pieces of weak and slightly mellow dramatic dialogue.

I particularly like the modern references to both technology (Bluetooth, WI-FI, 3G phones) and people (Dean Karmen, Edward Teller and Clive Sinclair). It helps to anchor the story in a contemporary setting and prevents the dated feeling you get from some comics (although that will go against it in years to come!).

All in all I really enjoyed Extremis and am looking forward to reading "Iron Man: Execute Program v. 2" next!

Labels: ,