May 22
Enterprise Library error: Binary format of the specified custom attribute was invalid fix
I’ve just started to work on a project and I am using the Enterprise Library 4.1 (http://msdn.microsoft.com/en-gb/library/cc467894.aspx) , download at (http://www.microsoft.com/downloads/details.aspx?FamilyId=1643758B-2986-47F7-B529-3E41584B6CE5&displaylang=en) in Visual Studio 2010 Beta 1.
I kept running into a really annoying problem using DatabaseFactory.Create():
System.Reflection.CustomAttributeFormatException: Binary format of the specified custom attribute was invalid.
and
build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, null]) failed: Binary format of the specified custom attribute was invalid.
Turns out that Enterprise Library 4.1 doesn’t support .Net Framework 4.0 (http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=444020) so I changed the Project Preferences to use .Net 3.5 and it worked perfectly.
No commentsMar 22
Rookie Mistake 101
Note to self:
STOP DATABINDING DATAGRIDS IN PAGE_LOAD WITHOUT HANDLING THE POSTBACK!!!!
Thank you.
No commentsApr 18
A forage into Ruby
I’ve been experimenting with Ruby (and with the Rails framework) the last few days after a need came up for a console based application with a large degree of string manipulation. I have been using Python and Perl for similar jobs before – in fact I run a number of Python scripts that have proved to be extremely useful. A lot of the legacy code I work with is written in VBA (Visual Basic for Applications) within Access and Excel so this was another possible choice.
I wanted to avoid hosting my code within Access due to a possible rollout of Access 2003 soon and the fact that I needed to access mailstores – the thought of using ADO scared me and I don’t have a machine I can dedicate a copy of Outlook to so this effectively ruled out VBA.
Perl has loads of libraries available on CPAN and Python seems to be going the same way but the quality of community code can be suspect – I’ve never run into a problem with it myself, I use CPAN libraries all over the place – especially on my web server – and I didn’t want to be supporting third party libraries as well as my own code.
We are effectively a C# shop for new development – just myself and my boss keeping the legacy code up to date really – so I had to consider this as an option. .Net provides a nice SMTP library but not POP3 or IMAP… so that brought me back to the same problem I had with Perl and Python. I spent about half a day with a CodeProject IMAP library but it was not feature complete and after scoping out the changes I’d need decided I might as well have written the library myself.
I’ve been looking into Ruby and Rails recently for a personal database project and knew that Rails provided a lot of functionality. Now, I know that technicaly Rails is a community third party library but it is so much more refined and integrated than a hodge podge of CPAN modules thrown together. And, Rails provides IMAP straight “out of the box”. I loaded up Ruby.Net only to find that neither them or IronRuby supports Rails yet! This project was proving more complicated than I had expected – and I hadn’t written a line of code yet.
So I made the decision to write this application in neat Ruby on Rails without linking to .Net binary in the hope that Ruby.Net will catch up eventually! (Rails support is expected in the next version apparently)
My first surprise was that Rails just works. I did not have to go through any rigmarole to get Net::IMAP to work – just
require 'net/imap'
and I was off. As I didn’t have access to the rails scaffold I used DBI to access a Microsoft SQL Server instance with the amazingly complicated
require 'dbi'
which is shorter even than PHP’s database linking code. Opening a handle with
dbh = DBI.connect('DBI:ODBC:MY_DSN')
gave me immediate access to the ability to run SQL with sensible data returns.
Suffice to say, I was impressed. A few helper functions later, and some hastily learnt Ruby conditional statements for error catching
var = var ? var : " "
to remove nils from strings – this technique even works when passing parameters – amazing. Features available in Perl like
run_my_long_complex_function(variable) unless defined?(use_simple_mode)
are so much cleaner and clearer to read in Ruby – plus the excellent “PickAxe” (Programming Ruby – possibly the best Ruby textbook) not only encourages this technique – it’s the one it teaches you.
More impressive and powerful functions that let you pass in chunks of code (’blocks’) using “yields” are likely to be my next excitement but so far I haven’t needed them.
The only thing I can say is that I had some 22 lines of error checking code using if then else etc – Ruby first impressed with the ability to use ? : notation which reduced it to about 8 lines. Then I realised that I could use conditional formatting like the unless example above. Then Ruby amazed me with the ability to use them both together – did you realise that if blocks are expressions, not statements – Ruby did. That code is now 1 line – and it works just as well.
I muchly look forward to developing the rest of the feature set in Ruby as I’m sure it’ll keep impressing me with it’s ability to make programming interesting again!
2 commentsMar 19
Arthur C Clarke
I’m not one given to obituary’s – but celebrating life and remembering the good times only works if you know someone close enough to be able to say “I know how this person felt. I know what they would want to hear right now”. I’m not in this situation today, I feel sadness and an undeniable loss.
Hours ago one of the finest science fictions writers to ever grace us with his prose passed away. Arthur C Clarke, author of 2001, the Rama series and countless short stories (from which I know him best) was the visionary of the last half of the 20th century. Without him so many ideas would never have been explained so clearly, so many young readers would never have looked upward and pondered the questions he asked and our world would have been worse for it.
At a time of such rapid scientific change – a telephone in every household connected by satellites? – who else but Clarke could have theorised the domestic demand and provided the idea of how to do it – 9 years before Bell Labs got there and actually started to build them. For a Science Fiction writer to have had such a direct impact on society is remarkable, but somehow, when we are talking about Clarke, it is not so remarkable – it is easy to have expected nothing less.
I will mourn his passing, as will all of his readers, because we have lost something special – a mind filled with ideas and revolutions that will not come again.
Remembering the good times will not be difficult – Clarke has left a wondrous collection of his ideas – the fruits of his genius – in every library in every English speaking town. I for one will console myself with knowing that his memory will long outlive my own.
From us carbon based bipeds to our lost spirit – we thank you for all that you have given us.
A humble reader.
More obituary’s
No commentsNov 24
DDD6 as it happens
Well – posting from the foyer of Microsoft’s Thames Valley HQ during DDD6.
The emphasis is most definately on scripting – but that was clear from the agenda. As always, SQL and databases in general are getting a lot of exposure but hidden in are gems like Ben Lamb’s excellent introduction to Microsoft Powershell.
Even burdened down by the black death, Ben gave an interesting, and most importantly, practical demonstration of the new .Net/administrative CLI.
Other highlights so far include Chris Hay and his well placed use of Monty Python demonstrating Silverlight 1.1 – I look forward to his next session building a twitter app!
No commentsOct 18
Firefox gets down with the natives
Firefox 3, due out “soon”, is at a conundrum. Do they want to maintain a familiar look and feel across borders or go native on each platform?
News.com covers the story nicely.
Personally I agree that fitting in to the host system is a good idea – it makes for easier integration and one could argue shorter learning times but as a user of three separate operating systems (Windows, Ubuntu and OSX) I like that Firefox looks the same on all of them. I use Google Browser Sync to keep my bookmarks up to date, del.icio.us (and it’s firefox addon) for the rest and don’t have to worry about it. I use Firefox far more than any other application – can’t imagine my day to day life without it.
I’m probably bias – in fact I am – because I don’t like the look of Safari or of IE so I naturally want Firefox to look like Firefox. I don’t use Opera because I don’t know how it works and because I’m afraid it won’t do what I want. I know Firefox will but that isn’t the reason I use it. Something about it feels right.
I’m writing this on a machine without Firefox (need to put Portable Apps Firefox on the network!) and I feel icky inside. It’s a browser with tabbing so I’m able to survive having 20 web pages open without clogging up the OS but it just doesn’t feel right. I can’t bring myself to think of using Firefox and having it look.. like this. It’s just wrong.
So I would definately definately keep Firefox looking as it does – or at least ship the current default skin as an option. I guess that’s the great thing about open software -if I don’t like it, I don’t have to lump it.
No commentsOct 12
Developer Day 2007 – DDD6
The UK development community event DeveloperDeveloperDeveloper is returning this year to Microsoft’s Reading Campus. DDD6 will be held on November 24th 2007 and the agenda is now open for voting and shaping.
To show your opinion, visit:
http://www.developerday.co.uk/ddd/votesessions.asp
No commentsSep 24
DNS in Linux
I have a world of problems with DNS in Linux. My Ubuntu box is sat on a Windows 2000 domain and usually holds it’s own. It’s not a member of Active Directory nor does it import great knowledge from Active Directory – it is an island of peace amongst the Kerberos hoades.
Most recent problem – after an unscheduled, shall we say ungraceful, shutdown of the box it appeared to have dropped off the network. After a lot of faffing I found that the DNS servers were not specified anywhere, the machine became static IP from DHCP assigned between the last reboots so evidently I didn’t set it up correctly the first time. After trying several solutions this helped:
http://blog.technomancy.org/2006/09/21/adding-a-static-dns-server-to-resolvconf/
Excerpt:
In order to assign a static nameserver, you must edit the file /etc/resolvconf/resolv.conf.d/base, and add you “nameserver x.x.x.x” line there. This file is automatically included at the start of the /etc/resolv.conf file that resolvconf generates.
To add a search domain I similarly added “search xxx.com” to the same file.
- Update
I have recently installed Ubuntu 6.10 (I know, I’m still about 2 releases behind) and I didn’t have this problem. Good work team Ubuntu!
No commentsSep 10
My Website
As part of my coordinated online presence I have put together a website at http://pcurd.co.uk/
Please enjoy. Applause optional.
No commentsSep 10
M4 in the morning

M4 in the morning 2, originally uploaded by PCurd.
The M4 in the morning is a scary place. It’s a standstill and it’s not fun. This morning I faced the view of 45 minutes of other car’s behinds.
Not the most pleasing way to spend one’s morning.







