30 November 2012

Why I'm done with Microsoft Operating Systems

**Warning rant alert**! I'm going to complain in this article, which is something I don't like doing, but I feel I must.

I'll preface this artcile by saying some of Microsoft's stuff does work. Windows Server is a good product, SQL Server is an phenomenal product that does you credit. The Xbox again works beautifully, I just don't understand why you can't apply the same standards to your desktop operating systems.

I've spent years supporting Microsoft's operating systems, literally years, in that time I've built hundreds of computers and I make my living in IT. I first started my love affair with Microsoft in the days of MS-DOS, since then I've used, abused and installed every major operating system they have released. So I flatter myself that I know the market and I've tried, I really have.

..but I'm sick of this crap from Microsoft. Windows 8 is diabolical.

You've had twenty years to get it right and you give me Windows 8. This is embarrassing, if I worked for Microsoft I'd quit out of shame! I'm glad they fired Steven Sinofsky, he deserved it. I haven't been this frustrated since my Scalextric got trodden on!

OK OK I get it, building an operating system is no easy task. There are infinite combinations of processor / motherboard / memory etc and you have to support drivers and every piece of software under the sun. I'll admit, probably not a lot of fun.
Yes, yes I know we're supposed to embrace change and be adaptable. That might apply to a the weather or a restaurant menu but this is an operating system. Do car manufacturers suddenly decide put the gear stick on the roof? My Mum and Dad have to use this thing, are you going to spend weeks on the phone explaining how they can find their files? No you're probably not. If I struggle to use an operating system, how do you expect "average Joe" to use it?

For goodness sake Google have built Android in four years, you've had thirty seven!
Windows XP was good. It worked, it had a few problems but it mostly did what I wanted. Windows Vista is an embarrassing, unstable, disgrace and I think you knew it. Windows 7, credit where it's due is pretty good. It's mostly stable, quite fast and the user interface isn't appalling. So build on that, don't give me something like Windows 8.

The main problem appears to be it's built for touch screens, why in planet earth you made this decision is beyond me. This is a desktop operating system. DESKTOP. As in mouse and keyboard. I don't have a touch screen monitor, neither do I want one. Does anyone really use a touch screen monitor for every day regular use?

OK So here are the main reasons I hate it:
  1. You've replaced the classic well known start button with a gimmicky looking sneeze of applications scattered across the screen. It looks more like a stack of building blocks a three year old put together. You created the start button and surprise, it works, stick with it.
  2. How do I close an app? Seriously?
  3. Internet Explorer is a festering turd of an application that's set back web development decades. This aside, I've now got two versions? One as an app and one on the desktop? How does that make sense?
  4. IE Tabs, I've been using this thing 3 days and I still can't figure out how to switch tabs? Why is this sort of thing hidden? Tabs were designed for quick switching between pages. You've just taken me back to the dark ages of multiple browsers running.
  5. What the hell is this right hand menu thing? I still haven't found a use for it other than just to hide the shut down button.
  6. My running apps are displayed how? By hovering over the left and then dragging down? Because just showing what I've got open needs to be hard?
  7. People - ok so I like that I can sign in with my "msn messenger / messenger / live messenger / skype" account, cool. Well done, this is a nice feature. The great big "people" app looks like it could be really good. A simple intuitive method of seeing all my friends and getting in touch. If it were implemented right....it's not. All I want to do is see a list of my friends who are online on msn. I want to send IMs to my BFFs about how much this product stinks. Unfortunately this task is almost impossible. I hover over this and drag that, it takes me hours to just get this simple view of who's online.
  8. Stability - This is the big one. After 37 years I expect your operating system to just work. No crashes, no hanging, no embarrassing blue screens of death. I had this brand new totally clean OS running for less than 4 hours and boom. My first total lock up.
    Several hard reboots later I thought I'd apply some windows updates. BOOM, failure two. After 20 minutes waiting windows update announced it had failed to update and it was going to roll everything back....time passes....more time passes. 40 minutes later we're back to square one. FFS.
Well done MS, this stupid product is going back to the store and I'm switching to Ubuntu. After twenty odd years I've given up on you. I'm sorry, I really really really didn't want it to come to this but I've just run out of patience.

22 November 2012

ColdFusion - Find common elements in two lists

I recently stumbled across an interesting programming question, how to find the duplicates in two lists? In this case I had two lists of email addresses and wanted to know which email addresses were in both lists. Sounds simple.

I'm curious to know what is the optimum approach, both in terms of simplicity and in terms of speed.

The first solution (compareLists) is the one I came up with, the second (listCommon) is one I adapted a little from Phillip's Coldfusion Blog.

<cffunction name="compareLists" access="public" returnType="string" output="false">
    <cfargument name="strList1" type="string" required="true" />
    <cfargument name="strList2" type="string" required="true" />

    <cfscript>
        var stuCompare        = {};
        var intCount        = 0;
        var strTempElement    = "";
        
        //loop through second list
        for(intCount=1; intCount LTE listLen(arguments.strList2); intCount++){
            strTempElement    = listGetAt(arguments.strList2,intCount);
            if(listContainsNoCase(arguments.strList1,strTempElement)){
                //Add key to struct
                stuCompare[strTempElement]    = "";
            }
        }
    
        return structKeyList(stuCompare);
    </cfscript>
</cffunction>

<cffunction name="listCommon" access="public" output="false" returnType="string">
    <cfargument name="strList1" type="string" required="true" />
    <cfargument name="strList2" type="string" required="true" />
     
    <cfset var arrList1 = ListToArray(arguments.strList1) />
    <cfset var arrList2 = ListToArray(arguments.strList2) />
     
    <cfset arrList1.retainAll(arrList2) />
     
    <!--- Return in list format --->
    <cfreturn ArrayToList(arrList1) />
</cffunction>

I was a little surprised you could use a java function like retainAll quite so nativity, but other than that it's fairly self explanatory.
So to time the methods, I took a leaf out of Ben Nadel's book and used getTickCount() to count the processing of 10,000 iterations of the above functions with two small lists.

Function Name Time (in milliseconds)
compareLists 849
listCommon 611
compareLists 352
listCommon 182
compareLists 232
listCommon 234
compareLists 208
listCommon 151
compareLists 80
listCommon 104

So as you can see, the listCommon method is much quicker. However it seems after the first few runs, caching kicks in and from then on the compareLists method remains very fast. I don't really want to get into caching, I'd rather focus on the differences between the two methods. Does anyone have any suggestions or input? Anyone got any examples of how they'd do this kind of thing in Java or possibly even something lower level?