What’s a dev to do?

July 7th, 2008

I have been trying to get straight in my head what I want to become proficient at in order to be a useful software developer for the next three years. It’s proving really difficult. I’ve always felt that, as a professional working every day cranking out code for real clients on real projects, it is very difficult to keep up with what keeps falling out of Microsoft. I have to say I don’t think they do that good a job in helping us committed and loyal Microsofties do that, especially those of us who haven’t the time or money to attend conferences, or don’t live in the M4 corridor (UK specific reference there).

Here’s my (unfinished) list:

Things that are a given – that I need to know
ASP.Net latest version

The side-road stuff that I think will make a difference:

CSLA latest version
AJAX for ASP (although I hope that using a UI toolkit like Telerik or Infragistics may allow me to enter a layer up the stack)
Code generation – I’ve been keen on this for ages but never found a practical implementation I liked, but more on this soon.
WPF/Acropolis/Prism – having used the WinForms CAB I wan’t to get my head around the latest generation stuff for the desktop.

Posted in Development | No Comments »

Accessing procedure parameters with Oracle Odp database block

April 21st, 2008

The particularly astute among you will have noticed that we have been accessing parameters directly in the code I posted. Really we should be using the Set and Get methods that the database object provides. So instead of:

Database db = DatabaseFactory.CreateDatabase();
DbCommand dbCmd = db.GetStoredProcCommand("AUTH_LOGIN");
DbParameterCollection cmdParams = dbCmd.Parameters;
cmdParams["P_OSNAME"].Value = criteria.Username;
cmdParams["P_INCOMING_PASSWORD"].Value = criteria.Password;
authenticationReturnCode =
Convert.ToInt32(db.GetParameterValue(dbCmd, "P_RET_CODE"));


db.SetParameterValue(dbCmd, "P_OSNAME", criteria.Username);


authenticationReturnCode =
db.GetParameterValue(dbCmd, "P_OSNAME");

I strongly advise you do do this – a lot of my pain over the last few days would have been eased if I had.

Posted in Development | No Comments »

EntLib Data Access block with Oracle Odp OUT parameters

April 18th, 2008

My code has been failing when getting values out of procedures when I switch from the Microsoft provider to the Odp provider inside the Data Access App Block.
Here is some typical code:

Database db = DatabaseFactory.CreateDatabase();
DbCommand dbCmd = db.GetStoredProcCommand("AUTH_LOGIN");
DbParameterCollection cmdParams = dbCmd.Parameters;
cmdParams["P_OSNAME"].Value = criteria.Username;
cmdParams["P_INCOMING_PASSWORD"].Value = criteria.Password;
authenticationReturnCode =
Convert.ToInt32(db.GetParameterValue(dbCmd, "P_RET_CODE"));

This doesn’t work – it fails with an exception:
Unable to cast object of type ‘Oracle.DataAccess.Types.OracleDecimal’ to type ‘System.IConvertible’.

P_RET_CODE is defined as a NUMBER OUT in the procedure.

It seems that the DiscoverParameters call doesn’t set up the OUT parameter quite right, even though it looks fine. However, if you explicitly tell it the expected data type it decides to work (this line comes just before the ExecuteNonQuery):

cmdParams["P_RET_CODE"].DbType = System.Data.DbType.Decimal;

Posted in Development | No Comments »

Adapting the DAAB to use Oracle ODP.Net provider

April 15th, 2008

I’ve been doing a bit of tweaking of the Data Access Application Block to try and get around the problem described earlier.

I’ve replicated OracleDatabase, OracleDataReaderWrapper and the OracleDatabaseAssembler to reference the Odp provider (Oracle.DataAccess) rather than System.Data.OracleClient. I’ve called these classes OracleOdpDatabase etc. Inside them are some simple changes to enumeration values and data types (details on request).

Then a simple addition to the configuration details makes the block use the new objects rather than the old ones:
You need to add a providerMappings section inside the <dataConfiguration defaultDatabase="Dev" > section to indicate what new database class to use

databaseType= "Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleOdpDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral, PublicKeyToken=null"
name="Oracle.DataAccess.Client" >

Note that I haven’t ramped the version number here which I suspect I should if I end up using this in production.

Then in the connectionStrings section just reference the Odp provider:

connectionString="Data Source=dev;User ID=owner;Password=owner;"
providerName="Oracle.DataAccess.Client" />

The ODP provider doesn’t recognise the Unicode item in the connection string that I have been using with the Microsoft provider.

This mostly works but I am having problems getting return values from procedures with OUT parameters. More details to follow…

Posted in Development | No Comments »

Oracle CLOB’s and the MS Data Access Application Block

April 9th, 2008

We have hit upon a problem with the Microsoft Data Access Application Block when trying to update / insert to an Oracle CLOB column; in short it doesn’t work.
In long: it seems to work until the total size of the data you are passing to the procedure is over ~32k. This actually seems to be a limitation of the System.Data.Oracle provider rather than anything the DAAB is doing.

Posted in Development | No Comments »


February 27th, 2008

We had an earthquake last night – I was working upstairs on the PC when house began to shake.
It woke my wife up, but luckily not the kids.
As soon as it was over I wrote down this account:
“5 to 1. At first sounded like a very strong gust of wind. Then noticed the desk was shaking, got stronger, everything was shaking. Lasted about 10 seconds.”
I was quite shaken by it. I think it was the completely unnatural feeling, and the lack of control as the intensity built. This is nature and there’s nothing you can do.

Posted in General | No Comments »

Change of theme – change in general

October 5th, 2007

I thought it was about time that I had a bit of a revamp around here, so I upgraded a couple of weeks ago and decided to try out a new theme.

Lots of stuff has happened in the last six months; our daughter arrived, which has soaked up lots of time and I’m working like stink on a project that has not been running too well.

When we started on the project in March, I thought I would be able to blog a bit about how we were pulling it together using a stack of different bits that we really didn’t know much about, but it has been so hectic that it just never happened. Maybe I’ll do a bit of reflecting on how things have gone so far and post some musings on the process.

One day.

Posted in General | No Comments »

Preventing the designer setting properties of a User Control

July 4th, 2007

I’ve built a couple of user controls to simplify some data capture in our current application, one of which is a date choosing control. It exposes a couple of fields exposed as properties that should only be used by code and not accessible through the design-time property grid. I quickly discovered the decoration [Browsable(false)] to stop the property from showing up in the Properties grid, but the designer was still setting them in InitializeComponent; until I discovered the power of [DesignerSerializationVisibility].
Decorating the property with [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] supresses the serialization of the value into the designer code. There are two other options – Visible which only serializes the value if it isn’t the default (and you can use the DefaultValue to set that) and Content which does something clever with collection properties.
Aren’t attributes great!

Posted in Development | No Comments »

Finding the deepest node in some XML using XPath

August 22nd, 2006

Today’s problem was, given a set of XML nodes or arbitrary depth, how do I find the deepest node quickly. I have an XML description of a hierarchy of folders in a document respository. It consists of a series of Location elements, each with one or more children.

After quite a bit of pootling around using XPath, I came up with this…

XmlNodeList deepestNodes = _routingInfo.SelectNodes(“//Location[count(child::*)=0]“);

That is (I think) an instruction to select all nodes called Location that have zero children. Now all I need is to find which of these is the deepest.

Also, thanks to http://www.dpawson.co.uk/xsl/sect2/sect21.html which pointed me in the right direction.

Posted in Development | No Comments »

Customer service at Compman.co.uk

March 22nd, 2006

For some time now I have been ordering my computer books from Computer Manuals – a UK based on-line retailer. Apart from being very reasonably priced, their big advantage was that they only sold computer books, so, if I needed to find something quickly, I could just type the author’s surname into the search box and hey presto up would come a few books to choose between – unlike Amazon for example.
Recently they have started selling other books which meant that often searching by author meant I had to look through lots of books to find the one I wanted. OK, they had a quick search box that limited the results to computer books, but I prefer to go to the advanced search and look for stuff by author name. It’s the way I work.
Last week this irritance got to me so I emailed them and had a winge (it hadn’t been the best of days). About an hour later I had a reply, which impressed me. When I explained in a bit more detail, they responded within 24 hours to tell me they had changed the site to make my searches easier. (Obviously not only my searches, but, well, I was impressed). How’s that for service?

Well done Computer Manuals. Excellent service. One happy customer.

Posted in General | No Comments »

New machine at home

October 9th, 2005

Got a new home PC last week – bought from pcnextday who are based in Liverpool. Chose an AMD chip this time, for a change; so I have a AMD Athlon 3400, 1Gb RAM, 250Gb HD and a GEforce 6800 for about £550. As T.J. would say: ‘tender’.

Posted in General | No Comments »

McAfee breaks .net messageboxes

September 2nd, 2005

Colleague of mine spent most of yesterday trying to work out why any message boxes that our .net applications popped up contained invisible text. The box grew when more text was added so we knew the captions were there but they just couldn’t be seen. A quick test exe confirmed that it was only a problem on his machine (elimimating the build) and a quick VB6 app worked fine on his machine (so it had to be a problem between .net and the win32 api).
Eventually he tracked down a note on the internet somewhere that pointed him to McAfee being the culprit – when he turned off ‘buffer overflow protection’ all the pretty captions came back. Not before he has reinstalled the framework though.

Posted in General | No Comments »

Back to it

June 30th, 2005

I’m back to looking at this now, as I have a tiny bit of spare time. Actually this post is to see if my RSS reader is picking stuff up properly. Need to look at upgrading to the next release too.

Posted in General | No Comments »

Upgrade to 1.5

April 5th, 2005

Upgraded to 1.5 today, didn’t quite work OK. Might try doing a full re-install as there is nothing on here of note at the moment.

Posted in General | No Comments »


January 18th, 2005

Well, I have spent half an hour getting WordPress installed on my host. Dead, dead easy – excellent. Now I am watching the snow fall onto South Park and wondering what to do next…..

Posted in General | No Comments »