ADSI, IIS and Windows 7+

Time for another one of my, please-don’t-forget-this-again posts.

I was running some code today that was calling the ADSI (Active Directory Service Interfaces)IIS://LocalHost/W3SVC. However I was getting access denied. After trying every admin user on this earthly realm I decided that access denied was a red-herring. I then realised that ADSI is an IIS6 only feature and not part of IIS7. Once I enabled the IIS6 compatibility features the code started working again.

Nice quote from Apple

I don’t know if it’s true or not, but apparently this is the letter you get when working for Apple. I thought I’d keep it around as I think it’s a good attitude;

There’s work and there’s your life’s work.

The kind of work that has your fingerprints all over it. The kind of work that you’d never compromise on. That you’d sacrifice a weekend for. You can do that kind of work at Apple. People don’t come here to play ¡t safe. They come here to swim in the deep end. They want their work to add up to something. Something big. Something that couldn’t happen anywhere else.

Welcome to Apple.

Windows 8 Release Preview – improvements but lacking

I’ve finally upgraded my version of Windows 8 and I wanted to see if has become a useful edition for the desktop user.

First off, it’s “preddy”. There have been a couple of subtle eye candy changes that are nice, not enough to recommend buying it but it’s nice. Once opened your are faced with the tablet UI, I mean Metro. Felt a little better, so I tried out the Weather application.

Annoyance #1 – Poor Feedback

I opened the Weather app and nothing happened. Actually since I am a developer I know what just happened. The initialisation of the application had taken too long and Windows had closed it. Now this will be new to desktop users as again we see the tablet UI in action. Phone/Tablet apps expect snappy responses to starting up. Mobile OS’ enforce this expectation by timing how long it takes the app to become responsive, too long and it simply kills it off. The problems here are a) no feedback, if at least said, “sorry that app was unresponsive, please try again” but no, just nothing b) Windows is expected to work on older kit that may not respond as fast as a dedicated mobile platform would.

Annoyance #2 – No .net 3

After witnessing the lack of feedback I felt I should blog about it. So off to install Live Writer. The first message I received was that I needed to install .net 3. Now whilst I understand that for a tablet you want to keep the software footprint as small as possible and that Metro is only .net 4 but in reality most desktop users will be using .net <4. So making me wait for it to be installing is a) annoying b) an example of Microsoft ignore the desktop user.

Annoyance #3 – corners vs. mouse

Back to Metro, and I’m purposely still using the mouse (my PC does support touch). Scrolling left I kept accidently bringing up the Start/Desktop menu in the bottom left corner. The reason is because I quickly “throw” the mouse pointer to the bottom left to scroll left (since Metro is heavily biased to horizontal scrolling). However, it’s quite hard to do that quickly and accurately enough to hit the scrollbar and not the start menu. Again, I feel MS have ignore the mouse user in the UX.

Annoyance #4 – vanishing scrollbar

Now this one is REALLY annoying. For example, I launched the People app which results in a large amount of horizontal scrolling. So I move my mouse to the bottom scrollbar and start reading and clicking to scroll through the list. Except I pause too long on a set of people and the scrollbar vanishes. But I’m reading the people so I just carry on clicking but nothing happens. I have to jiggle the mouse to get the scrollbar back. Come on MS this is terrible UX. Again, ignoring the desktop/mouse user.

Annoyance #5 – hotmail is better than mail

Next over to the mail tool. Hurray they’ve made it easier to see the different folders. Well done. Oh dear still cannot request to view the content of junk mal, how annoying. But the most annoying problem is the trickle feeding of items into the list. Normally when you open email tools all the mail arrives in one neat bundle. With Metro the emails trickle in as they’re observed by the system. From a UX point of view I’m trying to read the title of the latest item as it vanished off the bottom of the screen…but at a choppy rate, every time I catch up with it, it moves again. Terrible UX.

Annoyance #6 – metro, should promote clarity not noise

Still far too noisy with desktop apps. After installing Visual Studio 2010RC my Metro home looked like this;


So not only is it full of noise, I have not opened 90% of them, they were apps that were presumably launched by the installer. Come on MS, if you believe in Metro (as I do) then go back to the goals and give us what we need…please.

So in summary I’m still annoyed by Windows 8. To be fair I have seen some incremental improvements especially in the built in applications. However, MS really need to improve the core desktop UX as currently it is frustrating to use. I certainly would not recommend moving from Windows 7. There is still time to change, come on MS.

Poor mans ORM

Recently I’ve been looking at and hearing about data abstraction code that basically just calls a stored procedure and populates an objects on the way back. No identity management, just a simple mapper. I thought about using AutoMapper but as an intellectual exercise I wanted to see how easy (or not) it was to write a single helper that could move data from the stored procedure to an object based on convention. Here is the result;

public TCollection Load<TCollection, TItem>(string procedureName, params object[] arguments) where TCollection : IList
  this.connectionString = ConfigurationManager.ConnectionStrings["MyProject"].ConnectionString;
  TCollection instance = (TCollection)Activator.CreateInstance(typeof(TCollection));
  IList list = instance as IList;
  if (list == null)
    throw new ArgumentOutOfRangeException("procedureName");
  procedureName = "mySchema." + procedureName;
  using (SqlDataReader reader = ExecuteProcedure(procedureName, arguments))
    while (reader.Read())
      TItem item = (TItem)Activator.CreateInstance(typeof(TItem));
      for (int i = 0; i < reader.FieldCount; i++ )
        string fieldName = reader.GetName(i);
        object value = reader[i];
        SetValue(item, fieldName, value);
  return instance;

The code assumes you’ll be getting objects representing lists of something <TCollection,TItem> and that the properties match the result set columns. The ExecuteProcedure command takes the arguments and maps them to the stored procedure arguments, easy enough to write. The SetValue is a little more involved;

private static void SetValue(object instance, string propertyName, object value)
  Type type = instance.GetType();
  PropertyInfo property = type.GetProperty(propertyName);
  var descriptor = TypeDescriptor.GetProperties(instance)[propertyName];
  TypeConverter converter = descriptor.Converter;
  if (converter != null)
    property.SetValue(instance, converter.ConvertFrom(value), null);
    property.SetValue(instance, value, null);

The code uses standard reflection methods to set the property of the instance. The complication is the converter. If you are using a type that isn’t directly represented by a .net variant of a SQLType then you’ll need to use a converter. For example the following Id type needs its accompanying type converter (thanks to Chris Hannon)

public class MyItem
    public MyId Id { get; set; }
public class MyIdTypeConverter : TypeConverter
    public override object ConvertFrom(ITypeDescriptorContext context,
            System.Globalization.CultureInfo culture,
            object value)
      if (value is int)
        return new MyId((int)value);
      else if (value is MyId)
        return value;
      return base.ConvertFrom(context, culture, value);

So there you go, not eactly pain free but if you have a number of stored procedures and classes and you’re not overly worried about the performance hit of reflection then perhaps something like this will fit.

Quick tip, compress images

Today I was trying to send a Word document that had a couple of innocuous looking diagrams in it. The document was 8Mb. The images was greatly inflating the size. Examining the images I could see that Word was dynamically scaling them down but how do you tell Word to just save the picture at the resulting scale? Well in Word 2010 double click the picture and select the ‘Compress’ ribbon button and NOT the ‘Size’ ribbon.

MVC does not find the controller

In a previous post I talked about using MVC’s controller injection to drop in DLLs that contain controller classes. It allows for a nice separation leading onto creating a composite UI. I was happily using this mechanism when it just refused to load a controller from an additional DLL. I still do not understand why it doesn’t work but my workaround is to override the ControllerFactory. Here is a quick example of this, please note I’ve hardcoded the condition for the sake of this example.

protected void Application_Start()         
  ControllerBuilder.Current.SetControllerFactory(new MyControllerFactory());
public class MyControllerFactory : System.Web.Mvc.DefaultControllerFactory
protected override Type GetControllerType(System.Web.Routing.RequestContext requestContext, string controllerName)         
  if (controllerName == "Library")
    Type reflib = Type.GetType("LibraryUI.Library,LibraryUI");
    return reflib;                              
  return base.GetControllerType(requestContext, controllerName);         

Note: setcontrollerfactory is a bit old school, should be using the IoC of choice…I’ll need to look into a bit more, but for now this works

I hate Windows 8…or do I?

I was fortunate enough to win a Dell Inspiron Duo. A little low-powered netbook with the dubious benefit of having a flip-top touch screen. Pretty useless really. So when Windows 8 Developer preview was released I thought it was the perfect match; it was pretty good. In desktop mode I could carry out my work related tasks, in Metro mode use it as a very basic tablet – at that time there were next to zero Metro apps. So when Windows 8 Consumer preview was released I eagerly installed it, knowing that the earlier tablet focus will have been redressed by improvements to the desktop variant. I installed it and was initially furious.

Metro aka Windows Tablet?

One you have logged on you are presented with the Metro interface. Now this is where my blood started to boil. Now I  like Metro, at least I love it on the phone. I can see the point of it on a tablet. I can just about cope with it on the XBox with Kinect. Where I just do not understand it is for a desktop PC. Let’s face, using Metro with a mouse is a poor experience. Like it or not mice are designed for vertical scrolling, it just doesn’t translate well to Metro. Add to the this that certification for Metro apps includes ‘finger size’ controls and there is nothing I’ve seen so far that has done anything to make me think Metro isn’t simply a tablet UI. So let’s take a look at the desktop.

Windows 8 Desktop, erm

My working life is going to be in the Windows desktop, both for me and some extent my customers too. So I select ‘desktop’ and I’m faced with Windows 7. But wait, no start button. How can I find my apps? Naturally my mouse gravitates to where the Start button should  be and I’m sent back to Metro. Hmm. Not what I would consider intuitive. So it looks like a desktop but actually to launch anything I have to go via Metro. That is really clunky. Enough of all this, my Dell has two finger gestures and it’s not working so before I go on I must install a driver. Now, first to check Control Panel to see if it has already been installed but switched off. Ok Start->Control Panel. Argh, no Start. Hmm. After some flapping around I discover the app search mechanism. Yes, after 20  years of the UI I’m back to a glorified DOS UI but with a pretty intellisense style search. Ok, now this doesn’t really bother me as I often just use Start->[Type in Name of App] in Windows 7, so I can’t really throw any mud here.

After a while, with plentiful use of the Windows key, I manage to get my Dell running almost correctly (orientation sensor isn’t working). However, now when I open Metro I’m faced with a shotgun splattered UI.


So what’s wrong with that? Here’s what I think.

What is Metro?

To explain why I got upset about this release you need to understand that I do like Metro, at least what I believe Metro to be. The principals behind it are, to be an easy way to see the information you need…just like the signs at the Metro (although the Metro Paris isn’t exactly a primary example of this idea). So when I open my Windows Phone I get pretty much all the important information. If I wait a second or two the information changes to show other contextual information, great. So how is it that different on Windows 8? Noise. When you’re navigating a public area, such as an airport, metro station, etc, the signs showing you the route through are clear. When I open my Windows Phone the information I want is there, clearly separated Why, because the real-estate only allows for a small number of ‘signs’ or in this case ‘tiles’. When I open MetroTablet I get far more tiles. If I start to scroll I get more tiles, in fact anything I touch ends up as tiles (see previous screenshot). IT’S NOISY. Stop shouting at me Metro. It’s akin to walking into the tube station and having every tube route sign added to the walls with no favouring of the routes from that station. You’ve lost the reader, and therefore the whole point. So I’ve established I’m angry at Metro, but how did we get here. Here is my guess…

Personas vs. Agile vs. Apple

Microsoft have been faced with an obvious problem of losing market share in the average home. Apple have had great success by building on their previous knowledge. IMO Apple owned the graphic design/publishing market even though their OS was obviously technically laughable with little to no multitasking. But still people used it, why? It’s my view that it was because people only really used one app at a time. There was little need for windows everywhere. I think Apple took that experience into OSX. Now with a proper grown up OS the user is still only shown about 5 apps in the in-your-face dock. The 5 apps they’re likely to use. Even though we have multitasking Apple are ‘restricting’ us to 5 apps. It works, and it works well. I hate it. I have apps crawling out the wood work, the dock is next to useless to me and the app explorer/manager is just painful. But I know I’m in the minority so why should Apple care?

Obviously Apple have made a great deal of money from iOS and Microsoft want to claw that back and originally I liked Microsoft’s approach, let’s have a unified OS rather that WinPhoneTablet. As much as I enjoy the iPad (or did before the terrible update of iOS5) I can’t do anything really useful with it. The idea of switching between tablet and desktop is very appealing to me.

So faced with these ‘facts’ it would seem the solution of Windows 8 is a good one, Metro presents the 5 apps you need and desktop lets you do your grey suit work. Great. However…

Microsoft use persona’s and they use agile techniques. Nothing wrong with that, but I think it’s gone wrong for MS. When Windows Phone 7 was released Microsoft pushed their main persona into the public. The 20-30 something who works all day in an office and wants to keep up with their social world but doesn’t have the time to spare opening lots of apps…they’ve got people to meet. That was the only persona, after-all you should deliver small chunks of value so using one persona is a way to do that right? Immediately I thought that was a secondary persona. I became more convinced of this when a Microsoft employee stated that, “young people didn’t buy phones…they don’t have the money to spend on them”. If you ever needed proof MS didn’t get the phone market that was it. However, the basic design idea of Metro holds true regardless of the persona, so the only negative impact of the phone’s persona was the worlds worst marketing campaign. But what has this got to do with Windows 8?

I believe the team have looked at these issues and created the persona of the home user who will have a tablet (a new tablet, you should try Windows 8 on a tablet without a Windows button – tough), and will occasionally use one of those ‘legacy’ applications. Otherwise they’ll use only the ‘5 apps’ they see at the start screen. That’s it, no other possible personas. Therefore we have an OS that is only practical for users that; a) have a new tablet b) only use a few apps. So what about me with my huge monitor (I wish), my vast number of apps all open and viewed at the same time, my tablet without a dedicated Windows button and no ability to select the lower left point? What about ME?

So I hate Windows 8?

After I climbed down from my high horse I decided to write this blog entry. I’ve written it because I realised that I am probably not your typical user. I’ve grown up with computers and have a lot of assumptions built in, e.g. “you scroll up and down, horizontal scrolling is horrible”, “I need a tree UI to find my apps”, etc. So considering the mass market out there Windows 8 doesn’t look so bad. Sure, as a friend rightly pointed out it, it does need cues to help the user find all the “weird” hot points that make it easier to use but perhaps a new user, or an soon-to-be-ex-Apple user (yeah ok), will find it intuitive?

I have my doubts about Windows 8, I can see the goal but I just hope someone dusts off the desktop persona otherwise I fear Windows will be consigned to the leisure market for ever more. I hope ‘consumer preview’ implies there is a ‘business/pro preview’ in the wings…I hope.

So to sum up, I actually like much of Windows 8; the prospect of running Windows 7 on low powered devices is great. I just hope someone takes a long look at the Metro/desktop integration for pro users.

[edit] looks like I’m not the only one

There’s no such thing as Non-Functional Requirements

Recently I was reading a draft requirements document and eventually I came to a section entitled ‘Non-Functional Requirements’ (NFR). As usual there was hardly anything in there. It reminded me of a session at a Extreme Programming camp I attended. The question raised there was, “how do you ensure the non-functional requirements are met”?” Both experiences lead me to believe that NFR are treated as some strange satellite requirement. The upshot of that is they are often just ignored, something that is pushed to the back of the priority stack. At the aforementioned XP camp I argued that there is no such thing as NFR. When I see a functional requirement (FR) I immediately read into it the NFR, I want the NFR to be included in the specification. For example, it is a classic mistake to only consider performance at the end of project, a mistake that is costly to fix. There are just requirements, each requirements is a combination of FR + NFR.

What to do? I would encourage everyone to include NFR with each FR. From a TDD/BDD point of view, we should be seeing references to those NFR. Ok a domain user might not understand the technical terms associated with NFR but even a simple reference to them would be enough to allow/remind more technical readers that they also need to be met.

Firebrand Bootcamp training review

My company needed to push four staff members through the Microsoft Certification program, so I was asked to attended a training bootcamp supplied by Firebrand Training. Here is my review of my time there;

What is it?
My course was 11 days long, including taking exams in Data, Web Development, WCF and an the solution designed based Web Pro.

What does a day consist of?
The basic timetable is;
7am-8:20am Breakfast
8:20-12 Working though the official Microsoft courseware with a teacher. Some of the hands-on labs are worked through, but only a selected few. There are few 10 min breaks during this time.
NB The courseware is typically aimed a 5-days, the bootcamp asks you to complete them in at most 3 days and for WCF 1 day.
12:00-12:30 Lunch
12:30-19:00 Typically a mix of courseware and the MeasureUp tests and the end of the session. MeasureUp tests provide 150 mock questions that provide an explanation of the correct (and incorrect) answers.
19:00-19:30 Dinner
19:30-23:00/00:00 Completion of MeasureUp tests, reading of the provided Study Guide and reading of the next days slides

Exam days are different. Typically they include a classroom review where everyone goes through a set of mock questions and talk about why they chose the answers they selected. Then a period of time (changed for each exam) to cram for the exam. Then the exam itself.

What are the facilities like?
The training ‘camp’ is on a hotel complex where the class rooms and accommodation are on a separate part of the complex. The training area can be accessed 24×7 and has hot/cold drinks, fruit and vending machines for chocolate and cans/bottle drinks. There is a common area where you can watch the news or play Fifa on the Xbox.
The accommodation is simple but clean enough and the staff are helpful. However, I was originally placed in a room that was 20′ from the main A1 and I lost two nights sleep before I asked to change room, a decision I should have taken after the first night. The bed linen is not very nice either, sorry but it’s not good. My room did have a mini kettle, contrary to the web site description. There is an ironing room too, which I did have to use.
The food was decent, with a choice between a vegetarian or meat dish for dinner and a sandwich bar or hot food for lunch.

What was it like?
First up, we almost achieved the goal. At the end of the course the four of us had passed all the exams except for one exam. I failed the Data exam (by one mark) but passed the retest. You got (or get if the offer is still on) one free retake per exam. So the ends would seem to justify the means. I would also add that many of my fellow students were keen to go home and create sites using the technologies on the course, so it was certainly successful for some people. However, I think it really depends on why you attend such a course. There seemed to be three distinct groups of people on the course; 1) Company sent Certification hunters – know about technology and have the foundations to allow them to rush through a 5-day course in 1-3 days. 2) Professionals looking to enhance their knowledge of specific areas – certification is a nice to have, more interested in learning new stuff 3) Retraining – professionals looking to learn something new. The course is certainly aimed at (1). You are directed through the course with the prime aim of learning just enough to get you through the exam. Did I learn new stuff, yes I did. Do I know it to a good depth, probably not, the lack of time spent on the lab work means you do not gain the experience of using the technologies. So for those in group (2) then I think they were a little disappointed. Group (3) would be better served by taking a course focused on one specific subject.

My recommendations;

  1. Make sure you can sleep – ask to change room, take ear muffs if you must. If you’re driving there then consider taking your own pillows. Also close the window vents at night, that really helps to reduce the noise
  2. Don’t put up with people chatting (or celebrating) at the end of the corridors outside your room. It’s not nice but you can’t afford to be distracted, ask them nicely to move on
  3. Hold your questions – this is about passing the exams, don’t be tempted to consider the wider use of the technologies you really can’t afford to lose time. Also don’t ask, “it’s on the next slide” questions – there is a reason you’re asked to read the slides the night before.
  4. Don’t waste time. Don’t read emails, go on Twitter, nothing. I can’t emphasise enough that you don’t have any spare time. You’ll be working at least 16 hour days, you’ll need them all
  5. The study guide is your friend, read it and read it well
  6. Before you go I would advise you brush up on your page life cycle, what Transactions are and the Session managers (In Proc, State Server, Sql Server). You need those and there isn’t enough time spent on them
  7. It’s as much about learning how to test, get into the ‘groove’ of the questions. Learn how they’ll try and trick you, read the questions very carefully. I know it’s been said before, but often they’ll be more than one correct answer, just a subtle change in the question will mean one is more correct than the other – I hate that, stupid IMO

Overall it did produce the results but it is not easy. The pass rate was not great and one student failed 3 of the 4 but was obviously very bright. If, like them (and me) you like to go into these exams with a real sense that you know it all (well most of it) then this might not be for you. If you’re good at hands-off book learning then it’s probably well suited to you. That’s not to say you can’t pass from just studying, I managed it after-all 😉