April 2007 Entries

Ruby on RailsI was at a Ruby on Rails presentation last night, run by the Oxfordshire branch of the BCS. I was expecting great things, to be told how all our .NET and Java web apps were to be made obsolete overnight (or something like that).

Unfortunately, it wasn't all that it seemed cracked up to be. It looks lovely for bashing out quick sites, especially if you are designing the data model from scratch (and it's quite simple). However, as you try and do more complex things, then it gets exponentially harder. I think it was summed up by someone I was chatting to after the event, who said that Ruby on Rails is great as it's "Convention not Configuration" and once you learn the "Rules", then you can develop sites very quickly.

I don't know about you, but once I'm told that I have to work within rules, then that implies potential limitations. I don't want to hear what it can't do, I want to hear what it can do!

Apparently the next release forthcoming will perform better. Maybe this is a first step to making this snazzy technology ready for the Enterprise?


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist

When installing SQL Server Express 2005, you may get an error saying something like:

An installation package for the product Microsoft SQL Server Native Client cannot be found. Try the installation again using a valid copy of the installation package 'sqlncli.msi'.

Irritatingly, it only says this after the installation file has already extracted, installed support files, checked the system, checked pre-reqs, initialised main installation, prompted you for config and installed a bunch of things (which it then rolls back). It's 5-10 mins until you get the error and there's no 'retry'.

Anyway, at least it's easy to fix :) I read a couple of articles on Microsoft and MSDN Forums which weren't THAT helpful. They seem to contain too much info. I found that I could fix the error by doing this (note - I was installing on a box which already had full SQL2000 installed... it might well not work if you are installing 'clean')

Extract the SQL Express MSI to a temp folder. (SQLEXPR32.EXE /X:TEMPFOLDER). Then find the "SQLNCLI.MSI" file that it extracted into the 'Setup' folder. Run it, and when prompted, choose to Repair the installation. Now re-run the SQL Express installation, and it should work fine!


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist

If you are setting MOSS User Profile properties, there is a bit of a gotcha when dealing with multi-value properties. Normally, you'd do something like:

UserProfileManager oManager = GetUserProfileManager();

UserProfile oProfile = oManager.GetUserProfile(sUsername);

oProfile["SomePropertyName"].Value = "This is a nice value to set";

If you try this then, happily, it will probably work. That is unless you have a multi-value property. Well - it will work if you have a multi-value property, as long as you are only setting a single value.

Let me explain.... it looks at first glance as if the property is just an object with a 'Value' property accessed via the indexer, it's a little more than that. The property is, in fact, a UserProfileValueCollection object. Indeed, apparently it's a UserProfileValueCollection object even if it's not a multi-value field - it just has a default indexer to the first object in the collection so that you'd never realise it was a collection. This is why the syntax I showed above for a single value worked OK.

So when will it not work? Well, try and do this with a multi-value property when you have a constrained choice list (comma-separated in this case):

oProfile["SomePropertyName"].Value = "Multivalue 1, Multivalue 2, Multivalue 3";

It will throw an exception along the lines of 'thats not a valid option'. This is because it is trying to find an option in the choice list that matches the whole string. It is not 'intelligent' enough to try and break down the string into separate values.

(side note - the 'Separator' property of the Property object, which is of type MultiValueSeparator enum, appears to be only related to how the UI itself captures or presents the data. Behind the scenes, the data is stored in a collection and the Separator property is pretty much redundant. In fact, you could build your own UI elements to manipulate the value collection and you can totally ignore that Separator property, if you wished.)

So, how to fix it? Well, luckily its actually very simple. In the above example, you'd just do this:

((UserProfileValueCollection)oProfile["SomePropertyName"]).Add("Multivalue1");

((UserProfileValueCollection)oProfile["SomePropertyName"]).Add("Multivalue2");

((UserProfileValueCollection)oProfile["SomePropertyName"]).Add("Multivalue3");

If you wanted to be very clean about it, or it was an automated process which didn't know what type the property was, then you could use the following technique to check for a multi-value (assuming oManager and oProfile are initialised as per the top of this blog post):

if(oManager.Properties.GetPropertyByName["SomePropertyName"].IsMultiValued)

{

    // do the multi-value stuff

}

else

{

    // treat as a single value

}

I hope this helps someone out because the Microsoft documentation, at the moment, is a little sparse. 


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
Massive frustration... only being able to point to an AD once with a single Import connection. (Try setting up a second and see what happens!) Can anyone think of a logical reason why this limitation should be there?

To work around it, either construct a clever LDAP query to change your search root or select specific AD nodes, or use a Security Group on the filter, like so:
(&(objectCategory=Person)(objectClass=User)(memberOf=CN=YOURGROUP,OU=YOUR_OU_IF_PRESENT,DC=SOMEDOMAIN,DC=CO,DC=UK))
The advantage of using a Security Group is to get excellent granularity. I use it to select whole groups of users, and then pick just a couple of extra ones as well (could be staff admins or something)

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
I've been having issues with my clipboard on my Host OS and my VPC. Occasionally, it just decides that copy-paste is too complicated for my little mind to handle and so it unilaterally decides that it should no longer work. After a bit of digging and a lot of screaming, I found that I could get the clipboard working again by restarting the VM Additions service from the Services MMC in Administrative Tools. Hope this helps someone - and if anyone can tell my why my @ symbol and apostrophe still don't work..... :)

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist

If you use MOSS profiles much, and especially custom properties, you will probably be aware of the excellent tool kick off by Angus Logan called ProfilePropertyMgr. Unfortunately, until now it had one particular drawback - it didn't support the entries in a multi-value field. So, if you had a multi-value field with values 'A', 'B', and 'C', when you exported the property it just exported the property and thats it, without the values.

One of the MOSS projects I've been working on has massive multi-value lists, such as country lists. Now, you can have them in a text file and 'Import file...' them into the multi-value field after the property is set up, but that's unwieldy.

What I therefore did is chatted to Angus and he added me to the project. I then added some more code to the 'WorkerBee.cs' file to export the choices along with the properties, and import them again at the other end. Not as easy as it sounds because the way properties are done is a bit obscure, but trial and error wins the day!

To use the modified tool, grab the latest version of the source-code from here, compile, and there you go! When you run the export and import all your choices will magically come across as well.

 


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist

I don't know if you have read much about the new MCTS qualification, but here at B&D we're getting a few guys through the new course (grats Dom!). I've got the book for the .NET Framework 2.0 course and I'm quite amazed at just how much work is needed to get through it! I've been coding for longer than I care to remember, and doing .NET for many years, but this book just shows how much great stuff there is in .NET 2 that you wouldn't know about unless you knew about, if you know what I mean.

If you haven't been thinking about MCTS yet, I suggest you get your mitts on this book and have a scan through it - it's a great book to read to further your knowledge even if you don't take the exam. And no, I don't believe that you know it all already :)


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist