Tuesday, December 30, 2008

The Commuting Year in Review

I was listening to the TWIT year in review on the way into work this morning. I listened to every episode this year while commuting. If totaled in miles it would be a long way.

I started off the year traveling to Northampton by train from Rugby:
View Larger Map

I did that until February. I was working for a marketing company making enhancements to a legacy Delphi based system. It was without a doubt the worst job ever. The people who worked there were idiots, the work environment sucked and it was the most miserable 3 months I have ever spent. Not a great way to start the year.

From there I worked in Hammersmith in London and was taking the train from Rugby to London Euston:

View Larger Map

and then the underground from Euston to Hammersmith:


View Larger Map

I worked there for a local authority creating a portal site for customers. It was done using ASP.NET and C#, with a Biztalk layer connecting the different systems. I was pretty much responsible for the front end which was great. It was a hell commute, but the job was interesting and the people I worked with were great. It was a great step up from the previous job.

Commuting by train and tube was always interesting, sometimes frustrating, but glad I did it. It was a great "life" experience and took me way out of my comfort zone. Having to deal with 4 million other commuters was interesting for a boy from Temuka! I do feel sorry for the people that have to do it everyday for the rest of their working lives. We don't know how lucky we are here in New Zealand when it comes down to it.

From there I worked in Corby which was about an hours drive from Rugby up the A14. The A14 is the road trucks use to get to the M1 and the M6. It was jammed with trucks and the Cathorpe junction where the M6 and M1 merge was always fun! Again it was a great experience and gave me plenty of time to listen to Twit...

View Larger Map

I was the lead architect for a freight management system written in C#, with a Sql Server backend. I also did some training - upskilling some AS400 developers to .NET - which I enjoyed. Again the people were great, but needed a better processes in place, which they were aware of so good luck to them for the future.

I finished there in late August and we flew back to New Zealand and moved into our house in Timaru. (Sorry google doesn't do directions from Heathrow to NZ!)

I now do a daily commute from Timaru to Ashburton which is about an hour.

View Larger Map

I work for a Bank doing the teller systems (MFC/C++) and the Internet Banking Site (.NET). It is all interesting work and I look forward to being involved with the migration from MFC to C# which will be started sometime in 2009.

So all in all I did a lot of commuting this year and will have more next.

Wednesday, December 17, 2008

Remote desktop connection cannot verify the identity of the computer

If you get the following error: "Remote desktop connection cannot verify the identity of the computer that
you want to connect to. try reconnecting to the windows-based computer or
contatct your administrator."

when trying to connect OS X to a Windows Machine via RDP then do the following:

1) Delete all files in /user/{username}/Documents/RDC Connections
2) Don't fill in the domain text box

for some reason when using the Mac client if the domain text box is filled then the Windows machine at the other end can't authenticate the connection. Seems to be worse with Vista, but I have read of this happening with 2003 also.

Wednesday, October 29, 2008

Linking iPhone/iPod Touch with Xcode

I just spent the last hour or so trying to get my iPod touch working with Xcode so I could debug on the device

If you are having trouble after you have followed the instructions on Apples developer site, here's what to do:

In Xcode, right click the info.plist file and select open as text file. This will open the bundle as a plain text Xml file.

Find the Key:
CFBundleIdentifier
and below it will be a string element. Change the text between the element to your AppId minus the 10 digit number and the dot.

So for example if your appId is 1234567890.com.mycompany.myApp then change it to com.mycompany.myApp

Easy thing to do, but hard thing to solve.

Hope that saves someone the hours of frustration I had.

Tuesday, October 28, 2008

20 Second SQL tip

If you restore from a backup with NORECOVERY from the GUI it sometimes doesn't bring the database back online, even if the restore succeeds.

So if you are stuck with a database that no matter how long you give it, the status is restoring, or loading the following command should work:

RESTORE DATABASE databaseName WITH RECOVERY

Thursday, October 23, 2008

StackOverflow: the good, the bad, the ugly

The eternal dilemma for developers is finding the answer to their specific question. There are a number of sites on the web that try to help, some free, some not.

Stackoverflow is the latest attempt to create an ultimate resource for answers to programmers questions. It is the brain child of notable (or notorious depending on your view) doyens of the development community, Jeff Atwood and Joel Spolsky (who has Kiwi heritage).

The actual site is a work of genius. It is clean, clear and crisp and is, without a shadow of doubt, the best website engine of it's kind. Period.

I have been a member since the very early beta days. (User Tag is KiwiBastard BTW) In the early days there was a limited number of people on the site, but even so, questions where answered in quick time, and a question would stay on the front page a good amount of time, so that people had a chance to offer a reasoned answer.

Since then the private beta has gone public, the noise to signal ratio has increased. Post are only on the front page for a limited time. The questions are generally still answered but because there is more traffic, people rush an answer. It also appears that people won't bother answering a question once it has had a few answers. The reason for this is both the pro and the con of the site. The site is driven by a points and badge system.

Basically, you get points in a number of ways:

- Getting your answer upvoted
- Getting your question upvoted
- Getting your answer accepted

There are other subtle ways to get points, but it becomes addictive and like a game. So you find people don't bother answering a question that has been answered, because the chance of getting points is lower than answering a question that has no or few answers. While this is good because it means new questions get answered, it also means sometimes a question never gets a CORRECT answer. This is of course a problem.

The argument is, with more people, then there should be more eyeballs on each question so the net is the same as when it was a smaller audience. This argument seems to work in theory, I am finding in implementation it doesn't. The turnover of question is such that, a question just doesn't stay on the front page very long.

The other issue I am finding, is the tolerance for newbies is very low. People seem to get down voted if they ask a seemingly stupid question. Seemingly stupid to experienced developers, but we were all noobs once. I try to show tolerance to these people and answer their question the best I can, and maybe point them in the right direction. It's the fair thing to do, and I'm sure that Atwood and Spolsky would prefer this approach to down voting and alienating new developers.

Aside from the minor gripes, it is a great site. It will become the go to site for developers. Of that there is no doubt. I just hope that over time, newbies become better accepted, and people get use their upvoting ability a little more.

Tuesday, October 21, 2008

Nice Gmail Tip: plus-addressing

I was digging around the Gmail docs just to see what new stuff they've been throwing in there and came across something useful that I hadn't come across before.

A lot of people I know have multiple mail accounts some of which they use when signing up for stuff just in case for whatever reason that address gets "accidentally" sold to an organisation that will spam you silly. What Gmail does is provide a feature called "plus-addressing", which allows you to insert useful but ignored stuff into your Gmail address.

As an example:

If your mail address was myname@gmail.com (Apologies to Myna Me if you have an account) and you were signing up for something at "dodgysite.com" then you could supply the mail address in the subscription form as:

myname+dodgysite@gmail.com

The mails will still be routed to your account but if you start to get spammed and that address is being used then you have an idea of where they got your address from.

It's quite a nice feature and when used with filters can also be used to manage mail too so you could possibly give plus-addressed addresses to everyone and include some identifiable word in the address.

One thing to be aware of is that at some point if people start using this a lot then the spammers will start to circumvent it by striping out the +x part, but that doesn't seem to be the case at the moment.

EDIT: Nic points out quite rightly that this isn't strictly a Gmail feature but is part of the mail specs such as RFC5233 and yes, it is dependent on the site you're supplying the address to actually accepting a "+" (the latest version of Fring on iPhone doesn't even allow "."!!!!)

Wednesday, October 08, 2008

Useful Vista Tip: Open Command Window

Windows 2000 and XP had a bunch of power tools that had great, but little enhancements to Windows that made doing geeky things just a little easier. Unfortunately, there are no power tools for Vista. The most useful power toy I found was the ability to open a shell command window from an explorer window, by right clicking in the window and selecting the "Open Cmd Window" option.

Well, it turns out this feature is baked into Vista, but hidden away behind the scenes. To get it to work you simply hold down SHIFT, while right clicking in the Explorer Window.

Friday, September 12, 2008

iPhone 2.1 - Pointless!

I had really high expectations for the 2.1 update. Sadly it was always going to be a disappointment. Again I have been with a friend who owns a different phone on O2 and while his phone is showing 3 or 4 bars mine is showing No Service. Damn! Equally annoying is the fact that the phone apologists seem to fall back on the "number of bars does not mean the same thing across different phones" argument, but No Service is No fucking Service on any phone.

Anyway, another thing (other than Genius, aka please buy music you don't want) the only real difference I've noticed is a new little circle icon at the top where the connection type is shown, as you can see in the following pic. I have no idea what it represents and have not seen it before.


What it isn't is:

  • 3G
  • Edge
  • GPRS (I don't think, that's a square with hollow circle)
  • Wireless
Be interested if anyone has any idea what it might be.

EDIT:

Looks like this post is as useless as the update. It appears that all of the icons for the various data modes have been changed. 3G is now just white text rather than black on a white square so I'm assuming that the circle above is the GPRS equivalent to that. Surely the change isn't intended to save some battery power by lighting up 5 fewer pixels!!!!

Since 24 hours now I've been running 2.1 and none of my original gripes are fixed.

Thursday, September 11, 2008

Exclude CSS from Authentication in ASP.NET

This little thing has bugged me for a while. The CSS for authenticated sites where only showing once the user had logged in. This means that the Log On and Log Off pages are unstyled - although usually for me anyway, on my dev machine - seems to be ok live.

Well, if this is the case, you need to exclude the CSS folder (or files) from Authentication. This is achieved by added the following code to the web.config file somewhere in the configuration section

<location path="css">
<system.web>
<authorization>
<allow users="*"></allow>
</authorization>
</system.web>
</location>

Thursday, August 28, 2008

Do the hundred?

Can you do 100 press-ups? If not then follow this program one hundred push ups and you will be able to after 6 weeks.

I start tomorrow and managed a feeble 17 on my initial test...

Is there a more diverse field than software development?

I've been on the Stack Overflow for a couple of weeks. If you've been under a rock and don't know, Stack Overflow is a Q+A website for programmers, developed as a joint venture between industry luminaries Jeff Atwood and Joel Spolsky.

From the questions that fellow developers have asked, it highlights that a lot of people are doing a lot of vastly different things. Everything from tracing the inner exception of a soap message in ASP.NET through to rendering a tree structure in Django through to wondering the performance implications of case insensitivity in Regular Expressions.

This is why I love software development. There are so many fields to get into, and so many languages to learn and so many ways to do the same thing. If you get stale, you can just learn a new language or technology in your current language.

So my question is - is there any other industry that is as diverse?

Wednesday, August 27, 2008

Sorting a List using delegates

I have to sort Lists of Custom classes relatively frequently. Everytime I am about to write the Sort code, I always forget how to do it for a breif second. So as a reminder, I thought I would put a post on how to do it.

Say you have a List of Customer classes.

List customerList = new List();
customerList.PopulateList();

Now if you want to sort by a property in the list (for example BusinessName) you can do the following:

customerList.Sort( delegate( Customer x, Customer y)
{
return x.BusinessName.CompareTo(y.BusinessName);
}

Done.

Friday, August 22, 2008

Jingoistic reporting of the truth?

Olympic medal table from the BBC:









RankCountryGoldSilverBronzeTOTAL
1China46152283
2USA30 353499
3Great Britain181211 41
4Russia 16 16 20 52
5Germany 13 8 12 33
6Australia 11 14 16 41
As reported by NBC.com








RankCountryGoldSilverBronzeTOTAL
1China46152283
2USA30 353499
4Russia 16 16 20 52
3Great Britain181211 41
6Australia 11 14 16 41
5Germany 13 8 12 33

Which one is correct?

Well to me it is a MEDAL table, not a gold medal table. Either rename the table or repot the truth people!

Just a bit of tongue in cheek fun, but it has been hard work being a Kiwi in the UK over the Olympics. The Brits are worse winners than the Australians. For what it's worth, the per capita table is the real indication of success...

Thursday, August 21, 2008

iPhone 2.0.2 Update - admitting a problem?

I've had my iPhone now for a few weeks and as far as the device itself is concerned I'm really impressed. I've got another post queued up to add to the noise bascially discussing how I've found it and "good bits", "bad bits" etc. but the main issue I've had since it arrived is the really, really crappy reception.

In the UK we are on O2, a company not renowned for having the best coverage (although I think they would dissagree.) On their website, they have a tool which lets you put in a postcode or town, and it shows a (crappy) map coloured to show what sort of service you should expect in that area. For my local area, the entire map is coloured to indicate full HSDPA. This means I should be getting a reasonably good 3G signal in most places. The sad reality has been that even in the MAIN street of the villiage of Bishop's Cleeve, where I should get max sig, all I see is "No Service".

It's a bit lame, but I haven't bothered (read: summoned the patience) to talk to O2 about it yet, although that call is imminent. But what surprised me the other day was a friend of mine has an LG on O2 and both phones sat next to each other on a table, one was showing strong signal and 3G while my iPhone was a single bar with no data but more often "No Service" this leads me to suspect that it is more a problem with the phone itself.

When the update came out the other day to 2.0.2 I dutifully upgraded and since then the behaviour of the phone has been... odd! Some stuff I can't really put my finger on, but the main one is that whereas in the past, when the phone was in range of a wireless network, it would be constantly connected (or rather would show itself to be.) But now, the wireless connection symbol only ever appears when the phone is actually trying to fetch data. This would be fine but on some occasions the connection isn't coming up quickly enough for Safari or Twinkle and I'm getting error messages about connection problems. This even happened in the mail app once which is quite worrying.

So what's going on? I know Apple are shitty when it comes to revealing what is being fixed by an update, but I am wondering if this is some kind of attempt at a quick fix for what seems to be an emerging flaw in either the software or hardware on the phone. If it is, is this an admission however subtle that there is a real issue? And if it is, it's failed, and it has also damaged the useability of the phone.

Maybe the Aussies aren't stupid after all

It appears that Australians are switching to Mac faster than anyone else in the world.

Article here

Macs are still a little pricey in New Zealand I think personally. It doesn't help having a distributor in between Apple and the consumer. When I was an ISV a few years ago, I looked at selling a few Macs to some customers. The distributor would only talk to you if you signed a guarantee saying you would sell at least $50k worth of Apple products per year.

Which I guess is why only the major retailers sell Apple stuff, although Harvey Norman for example, make no money from the sales of Apple computer equipment - the distributor buys shelf space. That is why in most stores, the Apple stuff is tucked away in a corner - and a commision based sales person is going to show you a PC first, because they don't get a bean from the Apple sale.

That needs to change, and the sooner the better. A low to mid range price point would help too - say a mac mini bundled with Screen and keyboard etc for around $1500.

Tuesday, August 19, 2008

Final thoughts on the UK

We have a couple of hectic weeks left in the UK. I finish on 29th Aug and we fly out 31st and I start in my new job on the 8th. Nothing like a fast turn around.

We have enjoyed our time in the UK. We have had the opportunity to meet a lot of nice people, some officious prats and at least one Xenophobe!

We have seen some awesome, awesome things and had plenty of great experiences.

I would have to say my favourite place in England is Stonehenge without a doubt, and really enjoyed Easter in York. Paris is by far and away our favourite place to visit, but had good times in Slovenia, Holland, Ireland and Italy as well.

Our daughter speaks with a (posh) Uk accent now, and has spent more time in the UK than NZ. It will be a regret to us and her in the future, that she probably won't remember too much if anything from her 19 months in the Northern Hemisphere, except the 6000+ pics we have taken!

I thought I would list some pros and cons of life in the UK, as much as a future reference for myself as anything else.

PROS:
- ability to see and do things in UK and Europe is fantastic and relatively cheap
- much maligned but generally good public transport system
- excellent roading system
- high quality of living - things like free healthcare, competition in utilities and cheap broadband and access to multimedia
- excellent employment opportunities

CONS:
- Weather
- Weather
- Weather
- cramming 60+ million people into a little island means things get crammed - sick of people everywhere
- stupid little houses because of above
- stupid narrow roads
- red tape everywhere - "but we've always done it this way"
- did I mention the weather?
- tax - taxation in the UK is out of control - I feel for people trying to get ahead and the Govt cutting them down at every opportunity
- oh yeah, the weather is rubbish

There are a lot of things we will miss I suspect, and only realise once we are home. There are equally many things we won't miss. I can't wait to get back to the clean, crisp, open, friendly and spacious atmosphere of New Zealand.

I will miss not getting Top Gear and Dr Who before everyone else and the good people we have met.

Kia Ora UK, we wish you well, but it's time to go home...

Thursday, August 07, 2008

Newsgator RSS reader

I had previously been using Google Reader for web-based RSS reading. I don't run a desktop client because I am on far too many different computers to keep a desktop client in sync. I am also a contractor (for about another month) so don't want to have to install applications to keep track of the blogs I read.

Google reader is ok. It's pretty fast, but there was one thing that really, REALLY, annoyed me about it. It kept loosing posts, or more correctly, marking old posts as read, even if I hadn't.

Also, I have recently purchased an iPod Touch, and wasn't a fan of the GReader touch application. So looking for something better reader, Simone put me on to Newsgator. I've been using it a week and have become a bit of a fan. The web reader is a little slower than GReader, but has nicer features, such as the ability to tag posts, more powerful "Mark As" features and nicer rendering of blogs being read.

The major winning point is that is seemlessly syncs to the desktop client and the free iPhone application, which is very good too.

So, if you are looking for a replacement to GReader, then give Newsgator a try.

Thursday, July 31, 2008

Server ' ' is not configured for RPC

Just a quicky I came across this morning:

If you get the above message when trying to do a Remote Procedure Call across linked servers in SQL Server, your server is not configured to do so.

To fix this execute the following commands:

exec sp_serveroption @server='myserver', @optname='rpc', @optvalue='true'
exec sp_serveroption @server='myserver', @optname='rpc out', @optvalue='true'

Monday, July 28, 2008

Adding more noise to the "Code Comments" debate

For the record, before I get started I have to state that despite where Jeff Atwood has gone lately in editorial terms, I have a great amount of respect for his blog and the work he's put into it over the years. As a contractor, I move around different companies quite a bit, but one of the constants has always been the frequent, thought provoking team discussions which have arisen as a result of one of Jeff's posts. But ever since Jeff typed the now immortal phrase "strong opinions, weakly held" the majority of people I have spoken to think he is ever-so-slowly losing the plot. It does seem that a lot of his posts lately have been triggered by some experience he's encountered during his work on StackOverflow.com, and while there is obviously nothing necessarily wrong with that, I do wonder if the bubble he has found himself working in is skewing his perspective a little.

The post which finally drove this blog to state its own position is this:

Coding Without Comments


Unlike some of his other posts, specifically the one about #regions, this one I've read all the way through several times, and made sure I read it through again before I writing this post. And basically the whole thing leaves me with such a bad taste in the mouth that I can barely believe what I've been reading.

Like it or not, Jeff is read by many developers across the spectrum of ability and experience. Young and new devs are sent links to Jeff's posts and are over time gradually eased into the Atwood Cult. I feel as though in this one post Jeff has potentially done some significant damage to the hard work that all of those people, like myself, who as part of my job try to encourage others to write clear code and write good comments. It has handed on a plate an excuse for those devs who are too lazy, or disenfranchised in their jobs (the job security excuse), to bother putting any comments in the code that they churn out.

To try to keep the rest of this concise, I'll list my views on this as bullet points:

  • I won't go too far into any of the examples in Jeff's posts as clearly they are carefully chosen to prove the point. What I will say though is that his refactoring of the SquareRootApproximation by extracting the method did not, as he says, make the code "perfectly understandable". He's made the use of the code understandable, but not adding comments, or breaking up the string of operations, is creating code that is probably difficult to maintain.
  • We don't all work with our friends or with people we've worked with for years and so understand how they tick.
  • Encouraging people to use better naming for variables and methods etc is an exceptionally good thing, and I think this is probably where the emphasis in Jeff's post should have been. The policy of this blog is that code reviews are king, and code that is written with a bias towards readability, and therefore more suited to review, should be encouraged even if this results occasionally in less than optimal implementation, and maybe produces slightly larger source files.
  • There is such a thing as too many comments. I have a running joke with a particular developer I have worked with a couple of times that he over-comments his code. Taken to an extreme, comments which mindlessly state in verbose English the simple to understand operations that follow, do harm the ability to read and review code, as they add unwanted noise.
  • In terms of the argument for better naming of constructs and members rather than comments, I strongly believe that it should not be a case of either/or it should and must be BOTH.
  • Maybe Jeff can be forgiven for being US-centric but the overriding notion you get from his recent posts kind of implies that every team can and must be occupied by top tier, highly experienced and capable coders. If a team member isn't up to the task then it's in the team's interests to drop them and find another. This is a fine and noble sentiment but for a few flaws: Not every developer can be the best of breed. In general, especially in the UK, we have a skills shortage and in particular a shortage of high quality, experienced software developers. (The reasons for this are largely political and mainly due to the current government's attempt to destroy our IT industry, in favour of promoting the agendas of the large consulting firms, but that is a post for another day.) The net result is that the industry is filled with developers wholly unsuited to software development and have moved to careers in IT as an easy route. They are everywhere, both contractors and permies, and are writing ream after ream of code, with barely a consideration about how that code will be maintained or supported. These are the people who will use Jeff's posts to argue that comments in code are pointless.
  • One of the big anti-comments arguments is that they can become out of date in relation to the code they comment. My response to this is that COMMENTS ARE AS IMPORTANT AS THE CODE and deserve the same level of attention during modification of code as the compilable stuff itself. The argument that comments quickly go out of date should not hold water.
I could go on, but won't. I'll end by saying that in the real world, real software is over-complex, over-engineered, written under time pressures, often by people who's skill in the art is below average. They are expected to hammer out the code, those with the inclination to refactor are often not working in an environment where such things are encouraged. After all this, other people will have to fix and maintain the code and without comments, of any kind, this type of software which is being created ALL OVER THE WORLD RIGHT NOW is made all the more substandard because of it.

We can't all code in utopia.

Friday, July 25, 2008

Apple v Windows - get over it

I like Apple products. They are well designed and engineered, and the user experience is second to none.

Do I like them blindly. No. Apple make mistakes, just look at Mobile Me and the issues with iPhone activations, supply and crashing. The continuation of the iPhone SDK NDA reeks of typical Apple arrogance. It's a, "You'll do what we tell you, and if you don't like it we don't care" attitude.

But in the fan bois eyes, Apple can do no wrong. It's starting to get annoying to me to be honest. Sure, enjoy Apple products, but don't turn a blind eye to their faults. Or worse, attack people who rightly point out the flaws.

I'm sick of reading in places like Mac Daily News, pieces about how crap Windows is, how stupid Balmer is, how Vista is crap and driving customers to Apple, because Apple is the chosen platform and all who use it are the chosen ones. I mean read the drivel in here.

OSX is a great platform - it's fast, responsive and a pleasure to use. But fan bois constantly running down Windows, feels a little like poor cousin syndrome to me.
I can guarantee that if Apple had to write an OS to perform, with the user base and different hardware base that Windows has, it would be just as prone to bugs and crashes as Windows supposedly is.
Just look at the iPhone. Great device, awesome hardware, but the new 2.0 software is buggy as hell. It crashes a lot. You could argue that it is the third party apps that are the problem - but surely if they are supposed to run in a sandbox mode, why would an app crash bring the system down? It's not 1995 after all.

So guys, get over it. Windows isn't for you, we get it. It's not for me either, but constantly bagging it is making you look like a cock, and by association, the rest of us too.

Thursday, July 24, 2008

Reflections from the UK part 1

Now we're down to our last month(ish) in the UK, I am in a reflective mood.

I've enjoyed my time in the UK and Europe and the UK contracting scene has been kind to me so I have no real complaints. IT recruiters in the UK are about as trustworthy as a fox who has become self aware and started selling cars, but it's all part of the game and once you know the rules, it easy to play along.

I have done five contracts in the 18 months or so since I've been here. All doing C# or C++ in various guises. Four have been based in the Midlands and one in London. Travel has been from 25 minutes to 2 hours (each way) and pay rate has differed by 100 quid a day from the low to the high rate. The longest I have been out of work is 3 weeks, which included a week holiday.

So, like I said nothing to complain about really.

The market for contractors has dried up a bit in the last 18 months, and rates have definitely come back. Still there is plenty of work for the right skills, but I'm glad we came when we did.

I've met some tossers and some good bastards along the way. Some really good devs, some really shit devs and one freak (in terms of coding ability). I actually thought before I came that my skills might not cut the mustard, but save the freak and one maybe two others, I consider my skills to be superior to others I have worked with. I think that as Kiwi's we are early adopters and probably because of our smaller teams and budgets, have to get to know a lot more technologies and nuts and bolts than the guys here.

Companies here seem to be a little more conservative, backward thinking, and resistant to change. The majority of the companies I worked for still used Source Safe, and had old C++, VB or 1.1 code lurking around. C# 2.0 is used more often than not, but 3.0 isn't even being considered.

I was shocked at the lack of structure in a lot of places too. I'm not talking little companies here either, in a lot of cases we're talking large multi-nationals, or software used in high volume, mission critical places. Only one place had Unit testing, only one place had continuous integration and only one place used any sort of Agile practices. All of those were the same place! In my opinion a lot of the issues in companies like this is the middle management. To a company, the middle management are next to useless and create more problems than they solve.

A NZ company just wouldn't have the budget for PM's and Middle Managers, so management tends to take a more hands on approach and from my experience, is the better for it.

Next time on the muppet show I will discuss how I could fix roading issues in the UK in one easy step.

Wednesday, July 16, 2008

Uninstalling Resharper causes VS2005 intellisense to stop working

How about that heading for SEO eh?

Anyway, this appears to be a problem with those people who have uninstalled R# from 2005, but also have 2008 installed. In this case it appears R# leaves intellisense off when it uninstalls. To turn it back on again select Tools | Options menu and you will see this form:



(If you can't see the form (Blogspot was playing silly buggars when I checked this earlier) its under Text Editor | C# | General )

Just put the ticks back into "Auto List Members" and "Parameter Info" and your intellisense will be back.

Introducing....

After me needling him in a previous post, I have managed to convince Daniel Robinson, that he needs to be blogging, and also to join us here on "Software Development and stuff".
Dan will introduce himself properly later, but his specialist subjects include: ASP.NET, MVC and MVP patterns in Web applications, Biztalk and is always keen for frank and open discussions about software development!

So welcome Dan and over to you...

Monday, July 14, 2008

Visual Studio: what does that mean?

Ok, so sometimes in life things are called something and they are so much a part of your life that you don't give it a second thought. Car model names are the perfect example of this. I mean wtf is a Integra? What is a Corolla, or a Prius? Stupid names indeed.

I was looking at a retail box of Visual Studio on my desk today and a thought popped into my head. What a really really stupid name Visual Studio is.

If someone told you that they used something called Visual Studio as their tool of the trade, you would think they were into digital compositing, or photography or perhaps painting. A programmers tool isn't instantly obvious from the name. I mean back in the day when we (well some of us) were poking away at Dos, then using the word Visual actually meant something, but everything is "Visual" these days. Actually Visual Studio wasn't even the original name back in 96 or 97. It was Developer Studio, which event thought it may sound like something a camera tech would use, is a little better IMHO.

It's wasted air talking about it. MS are more likely to outsource their OS operations to Apple as they are to change the name of Visual Studio, but what would you call the tool you use everyday?

I've been trying to think while I have been writing this and I couldn't honestly come up with anything good, so with tongue in cheek, and using current Microsoft naming conventions, I think the new name should be "Microsoft Windows Development Studio for Microsoft Windows and Internet Information System 2008".

Carphone Warehouse: Technically inept or lying bastards?

OK, so I was going to wait a few weeks until the potential rush for iPhones eased off before I decided to take the plunge, but after realising that my contract with 3 whom I have had three problem free years of service was ending on 11th July it occured to me that it was the ideal time to switch.

Anyway, it's the Thursday (1oth) and accepting that I'm probably in for a bit of a wait due to the stuff I'm reading on the net I say to myself, "I'll head over to the CPW website and see if they're still taking orders." I visit the site and to my surprise they have the 16Gb phone "IN STOCK"!

OK there's a note saying that orders received after 3:30pm will not be delivered on the Friday, which is fine for me, so off I go, calling 3 asking for the PAC code so that I can transfer the number. This code is valid for 30 days so obviously the clock is now ticking. (Incidentally, the stuff that 3 were offering me to stay with them was mindbendingly stunning and if I hadn't already committed myself to the iPhone I would have jumped at it, no details but basically any phone I wanted for free, and the sort of tarrif that would make an O2 iPhone subscriber's eyes bleed, including unlimited data) Anyway, I go through the buying process, at each stage the words "In Stock" are there so I'm ploughing on thinking it just might happen.

Finally I get to the last confirmation page still expecting the rug to get pulled and finally... I get a confirmation mail for the order. I do the order status page and it tells me that it will be delivered on the 12th (the Saturday) and I'm thinking "yay!"

Then, later in the evening I get a mail telling me that, to paraphrase: "hey valued customer, you just ordered something on our site, we took your order but now we can't get you what you wanted. Don't worry though, now we have your details we'll be sure to get around to sorting you out at some unspecified time in the future, of our choosing, tosser!"

Now I know how limited stock was, and I know how I'm not the only person to miss out, but the one thing, the ONLY thing that is pissing me off about this whole story is the fact that Carphone Fucking Warehouse had "IN STOCK" plastered all over the iPhone pages and were more than happy to accept my details and go through the charade of taking my order when in fact they in no way, shape or form had any capability or intention of matching up an ORDER with a fucking STOCK ITEM.

Is it just me, or in this day and age with the software and computer capabilities we have available to us is to beyond a large company like CPW to be able to in real-time, match orders with specific items they have in stock? Is it?

I don't fucking think so... although clearly that kind of service is either beyond them or they truly don't give a flying fuck about customers. Which is made self evident in the image below which is taken from their highly informative and useful order status page:


Translation: "You know when you ordered something and we told you it was in stock? Well we lied, but we know you'll sit around waiting so we'll try to do something about it when we can be arsed and you'll just have to guess when that might be. Oh yeah, and here's the date we lied about when we said we would get it to you, just so you can imagine what it would have been like to actually get the thing. Just to rub it in a little bit more!"

How I got started in Software Development (Shaun's Go)

OK, OK, I don't usually do these sorts of things and apologies if I get take a few liberties and ramble on a bit but here are my answers:

How old were you when you started programming?

Like James, I'm a bit uncertain about dates with this stuff really but I know that the first computer I owned and did coding on was a Commodore Plus/4. I certainly didn't appreciate how unusual the +4 was at the time. It must have been around 1984 as they discontinued it a year later and I know it was a new machine at the time so that would make me 9-10.

I don't think that was my earliest bit of coding though as I know that at least one of my friends had a new ZX Spectrum and a girl who lived next door to me owned an Acorn Electron. I suppose my earliest memories of coding was basically boring those friends to death and getting into big fights as they wanted to play the games and all I wanted to do was sit there and type in the code listings at the back of the manuals. That will have been 82-83 so 8 -9 years old.

How did you get started in programming?

As I said above, it was all born from a fascination of the fact that rather than stick a tape in the deck and wait for 5 minutes while a game loaded then play the game. I was more interesting in the fact that you could type stuff in and make the computer do stuff that I'd told it to. Obviously, at this stage I think my childish fumblings were fairly rudimentary as, not knowing anyone else interested in programming rather than playing games, I didn't really have any other sources of information on programming available to me so I kind of had to work it all out for myself. I found myself wondering lately how someone like I was at that time would turn out if they had all the information and resources available to them that we have today on the internet, but I suppose that's a whole post in itself.

I do seem to vaguely remember some magazines with code listings in them, but I can't remember any more details than that. What I do know is that the excercise of typing in seemingly endless lines of code and then typing "RUN" only to find that I had a "redimmed array" or other more difficult to track down bugs that were either my mistakes or typos in the mag almost killed off my desire to write code.

A while later I remember a "computer club" in high school where they had BBC Model Bs and I think there was even an old Commodore Pet which I played with, writing rudimentary text adventure games for others to play. Also at that time the teacher who ran the club introduced us to the idea of connected computers as he used a modem with an honest-to-god acoustic coupler to dial up to some "online" BBS service (I forget the name) and download games and programs etc. Cool!

It hung on in there though, through owning an Amstrad CPC464 then an Atari ST. I think I'd pretty much drifted away from the whole programming thing for a while until I got to 6th form college when I decided to do a computing A-Level, it was at this point where, using a DOS emulator on the Atari ST I would spend nights, going right into the early morning working on my course project application. This was probably the point at which I started to really get the buzz of putting in all-nighters to get projects done.

The path as a coder was finally set in motion fully when the course teacher, Tom Threlfall, whom I respected greatly, commented on my report card that I had a "natural affinity with computers and programming".

What was your first language?

Probably the same as James, various flavours of BASIC. Then at 6th form, I dabbled with some C but with only a single textbook and no other sources of information, it frightened the life out of me and I would stay clear of C for some time. After that, it was Turbo Pascal, Turbo C and Microfocus COBOL 97 as they were the mandatory course languages for the first 2 years of my degree. Then while others went to Dephi I went to Borland C++ Builder having decided that C++ would be the best career move.


What languages have you used since you started programming?

  • BASIC
  • C
  • Turbo Pascal
  • Turbo C
  • COBOL
  • Borland C++(With OWL)
  • Delphi
  • C++ Builder
  • MS Visual C++ (Visual Studio 97/6)
  • VBA (I know!)
  • C#

What was your first professional programming gig?

Hmm. During my "year out" before my final year at Uni, I spent some months at a measuring instrument servicing company owned by a friend's father. There I worked alone developing a new inventory management system based on Access and VBA. I managed to integrate this with their non-networked calibration software (the cal app used Access so I had no choice) I then got their machines networked and came up with some new processes to streamline their operation.

I know it sounds corny, but the fact that something I had laboured over for months, sometimes battling against both technical and human obstacles and producing a system which although not perfect, dramatically increased throughput and reduced the company costs and allowed them to provide a much more seamless service for their customers really gave me a buzz. Up until that point everything I had done was abstract, theoretical stuff. But this was a real world system, which made a real quantifiable difference.

If you knew then what you know now, would you have started programming?

This is a tricky one for me. It's kind of what my brain is hardwired to do, it's what I'm damned good at (so I've been told) and given the right project with the right people I can still get that buzz about coding that I had when I was younger. If the question was "would you advise your son to become a programmer" I would say no. Personally, I feel that although technically the industry is heading for some exciting times, IT and software development as a career in the UK has been killed off.

I think despite my reservations, I would still have to say yes, I've met some great people through this job and had some moments of pure joy when I've been part of a team that has managed to pull off the seemingly impossible just in the nick-of-time.

If there is one thing you learned along the way that you would tell new developers, what would it be?

Hmm, one thing? Well I have to say that no one major thing jumps out at me so I suppose to get away from all the other cliched suggestions and hopefully pass on something insightful I'd probably say the following:

The biggest and best thing I ever did was become a contractor, above and beyond the financial and other forms of independence what it has enabled me to do is to keep my enthusiasm for the job as fresh as possible. The very nature of what I do means that every few months or sometimes longer, I find myself at a new place with new challenges and new people.

I know many people, very, very good, highly competent coders who have basically planted themselves in a company for years and years and have basically let themselves fester and rot their careers away to the point where only redundancy can offer them any salvation.

If you stay at one place for too long, you basically end up being the "guy who knows about x" and you end up being the maintainer of legacy apps. I think the worst thing that could happen to a good coder is that they end up at a single place for so long that it's far easier to hang around and wait to retire than to go out and find new challenges. So the advice I would give to a new developer would be to keep moving, it doesn't have to be by leaving a company, but always be trying to work on new things because once you become "maintainer guy" it's very difficult to move.

Saturday, July 12, 2008

How I got started in Software Development

Nic tagged me from a meme started asking about how people got started in software development

So here are my answers:

How old were you when you started programming?

Timelines are a little hard to remember exactly, but pretty young. I saw my first computer an Apple II at about 8 and was instantly captivated. My elderly neighbour had an Acorn Electron which he used to let my brother and I use from time to time. We started by tapping away at type-ins from magazines about that time. Not really programming per se but that sort of knowledge must have filtered through. I guess I would have been 10 or 11.

How did you get started in programming?

An excitement for computers grew from the introduction to home computers above. My brother bought an Amstrad CPC 464 maybe a year or two later. I started coding on Locomotive Basic, doing type-ins and generally experimenting with what BASIC could do. After that I went 50/50 with my brother and we bought an Amiga 500 and I continued to hack away at Basic. My first introduction to real compiled languages was around 1991 when I bought my first PC at about 16. Rocking fast 386SX20!

What was your first language?

As outlined above, I used various versions of Basic for a start, but my first "real" language was Turbo Pascal. Can't remember the exact version but 4.0 seems to ring a bell. From there I got a copy of Turbo C++ and stuck with C for a few years until I found Delphi in about 1995. The thing to remember about those days is that there was no internet, and books and programming information were really hard to come across - where I lived anyway. You pretty much learned programming by teaching yourself and pouring over the help files. It's much easier now to get up and running. Anyway, I digress.

What languages have you used since you started programming?

In roughly chronological order:

  • BASIC

  • Turbo Pascal

  • Turbo C/C++

  • Delphi

  • Visual Basic

  • Codewarrior C for Palm OS

  • ASP Classic in VBScript

  • C#

  • COBOL

  • Objective-C / Cocoa



Most of my profession career has been using Delphi for the first 5 or so years, a couple of years in COBOL and the last 5 or so years in C#, and recently the last year or so dabbling with Objective-C on the side.

What was your first professional programming gig?

I got hired to create some reservation tracking software on the Amiga 500 for a motel, but half way through the Amiga died, so I never got to finish it. I was about 17, after that I wrote some Car Dealer Management software for my brother-in-law, again never got paid, so I guess my first commercial gig was straight out of tech coding software for Gym's in VB5.

If you knew then what you know now, would you have started programming?

Yes. I can't imagine not programming. I sort of rebelled against it just after school - tried a few other jobs, but realised along the way I was best suited for software development as it was what I really wanted to do.

If there is one thing you learned along the way that you would tell new developers, what would it be?

Never stop learning. Computing evolves over time, and you should too. I have seen so many programmers who can't find work because they stuck with language or tech X and it has died and they haven't taken the time or been too stubborn to learn something new.

I know it says one thing, but I think the other bit of advice I can give new developers is this: there are NO EGOS IN SOFTWARE DEVELOPMENT. Always be open to suggestions, comments and criticism. Take a step back from your code and ask is there a better way to do this, and admit when you are wrong.

What’s the most fun you’ve ever had … programming?

Hmmm, that is an interesting question, one which I don't have an obvious answer. I've been involved with some interesting projects over the years, including writing and controlling automation gear for a Milking system, well before most people had heard about RFID. I also got to develop for the Palm OS early on in my career in the late 90's which was fun at the time - saw the first colour palm back then which we thought was ground breaking. Have been enjoying coding for the iPhone recently too.

Now, let’s tag someone else

Well, most of the people I would tag, have been tagged already or don't blog (Dan R and Tordon this means you), but Shaun Austin, who also posts here occasionally, over to you.

Friday, July 11, 2008

Programmers Font worth trying

Anonymous font is one I have switched to recently from Consolas. Give it a try - all personal preference of course. I find it slightly more legible than Consolas but either is a fine alternative to bleeding eyes caused by Courier New.

Linq to SQL - Dynamic SQL vs Stored Procs

Linq to SQL (L2S) is an exciting technlogy released with Visual Studio 2008. It is more or less an Object Relational Mapper (ORM) that easily integrates Sql Server databases to your C# object models. It can either create the database from a model, or the model from a database, or you can retrofit you existing Plain Old C# Objects (POCO).

I intially rubbished it, but after revisting and doing some more reading, I have become a convert. Like most things in the software development world, it's not a magic bullet, but is a great tool to have on your belt.

The interesting thing with L2S, is that it can generate the queries for you at runtime, or you can invoke Stored Procedures.

Now, standard and historical rule of thumb states that Stored Procedures are the answer to almost any question, but with L2S this may not be the case.

For a start, parameterised stored procedures are no faster than dynamic sql. Before you flame me, read this. The other reason I beleive that L2S could be more efficient than SP's is that because it generates the queries on a per instance basis, it can retrieve only the data you need at that point in time. Take this scenario:

You have some customer data you want to retrieve. In this case you only need, custId, custName and orderStatus. You already have a stored proc that retireves all of the customer columns. In my experience, given a pool of 100 developers, at least 75 of these will just reuse the original SP and filter at the C# end. Under L2S you are already prefiltering at the C# end and only hitting the fields in SQL Server you need.

Updates are the same, L2S will only update the fields it needs to, whereas most of the time you will just use a generic update SP that will send back all the fields changed or not.

I would not rule out SP's entirely. A lot of the time it is good, having a central repository for data interactions, especially for larger applications. Also, if you have a good DBA on team, then SP's would probably be a better option.

The point is that with L2S you have options, and don't automatically rule out dynamic sql in your next application.

Wednesday, July 09, 2008

New Zealand yells, Vodafone answers

It seems that you can get a 1Gb plan with their YouChoose 20 plan for $69.99 a month. This of course means no subsidy for the phone or $1000 but it's a start. Personally I don't talk much on the phone, so this plan would be fine for me.

Vodafone answers Q+A Here

I think they have been genuinely surprised at the negative reaction to their plans, and are trying to fight fires. Any goodwill has been lost at this stage I'm afraid. Drop the price of the phone to $350 for a plan, and say $700 on the YouChoose and it will be a start.

Tuesday, July 08, 2008

VODAFONE - YOU ARE A BUNCH OF ARSEHOLES

or, How to ruin a platform and golden opportunity in one step. The pricing for the iPhone in NZ is ridiculous. Actually it's worse than that, it's daylight robbery. Nothing short of that. $559 on a TWO YEAR PLAN. $80 per month for a measily 250Mb plan, or $130 for 500Mb.

I'm glad I'm not back in NZ yet, because I would be very tempted to firebomb every Vodafone store I could find.

Everyone out there, seriously. DONT. BUY. AN IPHONE. I desperately want one, and in reality need to get one to test the apps I create, but we have to make a stand.

Thursday, July 03, 2008

I love fixing bugs

I might be the strangest developer out there, but I love fixing bugs. Give me a list of things wrong with an app, and I will happily go through the list and fix the bugs one by one.

Most other developers I know, hate bug fixing. They grumble, moan and complain. I think the reason for this is, if their software comes back, then it is an afront to their skills as a developer. To them, a bug is like saying, "You're not as good as you think, here's the proof".

I have been in this game far too long to have an ego. Infact in my opinion, there is no place for egos in the world of software development. Egos get in the way of correct decision making. Like being under the influence of alcohol, an ego can cloud your judgement and make you do things you shouldn't.

To me a bug is as much a part of the game of software development as writing code. I get the same buzz with fixing a bug as I do when writing some gnarly code and getting it to work. Like I did today using DynamicMethods and IL to make use a faster way to get reflection info - more on that later. So don't fear bug fixing, just look at it as a problem solving exercise and start to enjoy killing those little bastards.

Thursday, June 19, 2008

Copy all files from a root dir to another directory

I had the need to copy all files of type .m4a from literally hundreds of subdirectories to a single directory. I tried and failed with XCopy so decided to roll my own utility.

So 10 minutes and some C# hackery later, SubCopyX was born. Feel free to hack and slash the code to your hearts content. If you do use it in anger or have suggestions, then let me know at : james at softwarex dot co dot nz

.NET 2.0 required to run.

Source here
Binary here

Usage:

from the commandline type:
SubCopyX
for example:
SubCopyX c:\Music d:\Music *.mp3

to copy all your mp3 files under the root dir c:\Music to a single directory called d:\Music

The following wildcard specifiers are permitted in searchPattern.

Wildcard character

* Zero or more characters.

? Exactly zero or one character.

Characters other than the wildcard specifiers represent themselves. For example, the searchPattern string "*t" searches for all names in path ending with the letter "t". The searchPattern string "s*" searches for all names in path beginning with the letter "s".

Note:

When using the asterisk wildcard character in a searchPattern, such as "*.txt", the matching behavior when the extension is exactly three characters long is different than when the extension is more or less than three characters long. A searchPattern with a file extension of exactly three characters returns files having an extension of three or more characters, where the first three characters match the file extension specified in the searchPattern. A searchPattern with a file extension of one, two, or more than three characters returns only files having extensions of exactly that length that match the file extension specified in the searchPattern. When using the question mark wildcard character, this method returns only files that match the specified file extension. For example, given two files, "file1.txt" and "file1.txtother", in a directory, a search pattern of "file?.txt" returns just the first file, while a search pattern of "file*.txt" returns both files.

The following list shows the behavior of different lengths for the searchPattern parameter:

* "*.abc" returns files having an extension of .abc, .abcd, .abcde, .abcdef, and so on.
* "*.abcd" returns only files having an extension of .abcd.
* "*.abcde" returns only files having an extension of .abcde.
* "*.abcdef" returns only files having an extension of .abcdef.

Tuesday, June 10, 2008

Post Keynote coverage

If you've been living under a rock you won't know that Apple has announced a 3G iPhone to be released in 22 countries (including NZ) on July 11.

It does have GPS and 3G, but otherwise it is fairly similar to the old one. The case is a little different and there is a white one available in the 16Gb model.

Big news is the price. Each carrier it appears, has there own deal available, but the maximum the phone will be is $199US. Compared to $599 last year this is great news.

In the UK for example, O2 has announced the tariffs. The maximum you will pay is £99 with the £30/month deal and it will be free for anything over the £45/month tariff. Oh, and they will be offering a Pay and Go iPhone also. It looks like 2008 will be the year of the iPhone. Big things ahead, especially with the AppStore opening soon.

The only other thing of note announced was MobileMe, which is a rebranding of .Mac. I haven't looked into it too much yet, but info is available Here

Also the next version of OSX was announced. 10.6 or Snow Leopard is to be available next year and is to concentrate on performance and reducing the foot print of the OS. I guess they are taking lession learnt from the iPhone and applying to the desktop OS. Hate the name, but like the idea of an even snappier OSX.

I was hoping to see some kind of incentive for Windows devs to get a mac and develop for the iPhone, but nothing was announced. I guess going forward Apple believes there is enough interest already, and I guess they are right. The have over 4000 developers signed up for the program with over 250,000 applying.

Intersting times to be an Apple developer I think...

Monday, June 09, 2008

WWDC Predictions

Another Apple event, another round of predictions. So without any further fanfare here they are:

1) 3G iPhone - well duh! I am also predicting that the phone will be available as of tomorrow, or at worst in the next week or two. Not expecting a GPS to be in built - hoping for better camera.
2) AppStore to be announced but not ready. I would expect it to be ready by the end of the month. I would be surprised if it will be ready today. The SDK is still not ready for primetime IMHO.
3) Apple want people developing for iPhone - that is a given. The only way at the moment is via a Mac. So look for some reason for Windows devs to develop for the iPhone. Not 100% sure what, maybe a cheaper machine, or maybe XCode for Windows.
4) A new range of iPhones. Am hoping for a bigger tablet style iPhone, but am thinking probably just different color ranges.

So that's my list - lets see how it goes.

Saturday, June 07, 2008

iStat Menu

I have just found out about iStat Menus. I used to have this sort of monitoring in the Windows days and it's great to have similar in OSX.

It can monitoring all important system activities, such as CPU usage, CPU temp, CPU usage, network activity, to name a few.

Also it makes you look like an uber geek with such a cramped menu bar!

Donationware so just download and try

Wednesday, May 28, 2008

New Contract

Just a quick note to say I have secured a new contract. A bit down on rate, but the market is pretty slow at the moment. Still doing .NET - I had hoped in a dream world to be doing all freelance at this stage, but a couple of projects fell through last week so that wasn't to be.

Still have a few things in the air, and things looking brighter on that front.

Contract market in the UK is pretty slow at the moment, so if any SANZA's thinking of coming over, might pay to leave it a month or two and see how the market shakes up after the new financial years budgets have shaken out.

BTW still looking for freelance work - no job to big or small - particularly in Rails or Cocoa as trying to get a commercial portfolio together. Something around $30/hr would be fine.

My .NET rates would be a higher due to what I bring to the table, but still look at anything.

james (at) softwarex (dot) co (dot) nz is first port of call.

Friday, May 23, 2008

Registered iPhone Development Company

My Company is now registered for development with the iPhone. It's pretty exciting times in my opinion, almost like the start of the computer age.

I have a few ideas for apps, but most of my time is currently taken doing work for other companies.

If you want any iPhone apps developed then give me a shout at james at softwarex dot co dot nz. Happy to discuss any kind of terms including profit share etc.

Friday, May 09, 2008

Shameless self promotion

As part of my push to become a telecommuting freelancer, I have to become a shameless self promoter and networker. Anyone who knows me will probably say that won't be much of a stretch.

Anyway, with that in mind...

I am finishing up my current gig soon (9/5) and am looking for more work. Preferably telecommutable, but can be on site in the UK.

I can/will do any of the following:


  • C# - ASP.NET/WinForms/WPF

  • anything database related

  • C/C++

  • Cocoa/Cocoa Touch iPhone

  • Ruby on Rails (just beginning that so rate will be lower!)

  • Delphi

  • Cobol



I have also have been using .NET 3.5 for about 6 months since Beta 2 I think it was, and am becoming a big fan of the ASP.NET MVC framework.

I can be contacted at james (at) softwarex (dot) co (dot) nz in the first instance.

Thanks. Normal programming will resume.

Tuesday, May 06, 2008

Friday, May 02, 2008

Best programming quote ever!

..."just not an actual problem, it's a fun programming exercise that you're doing because it's just hard enough to be interesting but not so hard that you can't figure it out"

Comes from Joel talking about Mesh

It's funny cos it's true...

Over complicating things

A few years ago when I wore a younger man clothes, I worked along side some COBOL programmers. They had been in the industry for ever and had seen it, tried it and done it. But still they used COBOL.

At the time Delphi was the best tool for the job, so I spent a lot of my time trying to convince them of this. "That's alright son. We'll stick with COBOL. We know it inside out, and anyway what will we do when the next trick language comes along?"

I would scoff at this, shake my head and go back to my programming.

A couple of years later C# was the best tool for the job, so I spent a lot of my time trying to convince them of this. "That's alright son. We'll stick to COBOL. We know it inside out, it does Windows now, and what will we do when the next trick language comes along?"

I would scoff at this, shake my head and go back to programming.

Now I am learning Ruby/Rails and Objective-C and they are still using COBOL. I no longer work with them, so don't have the opportunity to tell them how great Rails is, but I know their answer already.

What is the point of all this?

Well, over the years the only true constant I have witnessed in the IT industry is a tendancy to over complicate and over engineer projects.

Here is a real life example: A project I worked on once was a ASP.NET intranet Portal application. Different parts of the portal talked to different systems, coming from different places. All of these other systems either published web services, or were developed in house connecting to an in house SQL Server database.
A Biztalk middle layer was introduced to "expose a common middle tier" to the front end.

The real reason was because the Lead Architect of the system was a Biztalk guru. The only thing the Biztalk layer added to the system was an extra layer and slowed it down.

This sort of things happens a lot. Ok, sometimes it's great to build redundancy into the system, but most of the time we over engineer because we want to add another buzzword to our C.V., or find a reason to try out some flash new tech.

These days of agile and iterative processes, surely isn't it better to release for the now, get it out the door and add to it if the business needs change? Builders don't build a mansion when the clients ask for a 2 room apartment, just in case they have kids one day. Why do we?

And anyway, like my COBOL mates would say, no point building a mansion. Something new and whizzy will come along making the mansion look old and tired so it will be bull dozed and started again. Hmmm, maybe they did know what they were talking about after all.

Thursday, May 01, 2008

The twitter effect

I track certain keywords in Twitter. One of them is Rails. Not long ago this article was released. I know it was not long ago because twitter has just gone crazy with the story.

It's amazing to see the word spread. Just shows some of the power of the social network.

Monday, April 28, 2008

Race Results

Steve, Penny, Madison and James before the race
I won't be winning any olympic medals, but I managed to finish in just over an hour. I had issues with my calf muscles leading up to the race so didn't manage as much training as I would have liked but I don't think it would have made much difference. I was reliably told that there was only one hill in the race, which was true, except for the fact that the "hill" was an undulating 8km mass! Anyway, whinging over. It was a lovely day and a well organized event, and the proceeds all went to a worthy cause.

To all of you who sponsored, thank you very much. Your support made the difference and spurred me along up the steepest parts of the hills! The total is up to £140 so far, and the website stays up for another 90 days, for those of you who may have forgotten! (www.justgiving.com/jamessugrue)

Anyway, it's something I will definitely do again (although maybe I'll pick a flatter course next time) and intend on keeping the training up so next time I can break the hour

Made it. Trying to cool off

Thursday, April 24, 2008

New Family Member

As a long time and dedicated Windows developer and user, it will probably come as a surprise to some of the people who know me to hear that a nice TNT delivery man called today and left the following package for me:


I have decided that like James, I am also going to attempt a change in direction. For me though, I hoping to wean myself off the endless hamster wheel of software development and at long last delve into the equally challenging but for me potentially more rewarding career as a writer. My genre of choice will inevitably be SciFi and will be likely to span the range from near future dystopia to giga-epoch spanning space opera.

For me, the biggest issue is the problem of being overloaded with little projects of which writing is usually only one. In situations like this I would sit at my HP laptop and be almost literally paralysed by the need to make progress on so many tasks that I don't actually do anything at all. The Air will help me as I intend to have that machine as a dedicated creative space.

I will be posting the traditional "unboxing" article and first impressions soon.

Wednesday, April 23, 2008

New blog. Change in focus for this one

As I have announced in a previous post, I am looking for a change in direction. As such, I am opening a new blog which will concentrate more on things like Ruby on Rails, iPhone and Mac development and anything else that I encounter while trying to reach my goal.

The new blog is currently under development, and I am writing it completely in Ruby on Rails as a test site and a showcase site all rolled into one. I will be posting my thoughts about the process on the other blog when I get something publishable.

What does this mean for this blog? Well I still intend to post here, but it be more of a focus on .NET related topics, and general rants. If over time I succeed in my goal, then I would guess that poosting will slow down here and increase over on the other blog, but time will tell. In the meantime it will be transmission as usual.

Monday, April 21, 2008

Using Control + Alt + Delete in a Remote Desktop Session

Just a note to self as much as anything else...

If you are in a virtual remote desktop session you can't use Control Alt Delete to bring up the shut down / reboot dialog. In this case try Control + Alt + End to achieve the same result.

Friday, April 18, 2008

Mac tips for the switcher: Print Screen

I was in need of capturing the current window (for the last post actually) to store as an image. I went to press Alt + PrnScrn. Ah. Where's the print screen? So after doing a bit of research, here are all the ways you can do a screen capture in OSX.

Capture All
Press Command + Shift + 3

This will place a document in pdf format on the desktop. You can then open and Save As...

Capture selected Window
Press Command + Shift + 4 + Space. This will turn the cursor into a camera and you then click the window you want to capture. Again it will save to the desktop in PDF

Select Area to Capture
Press Command + Shift + 4. This will turn the cursor into cross hairs which you then select what you want captured.

While these are useful, what if you want to save to the clipboard instead of saving to the desktop? Well Apple has thought of that too - just press the Cntrl key with all the combos above.

Firefox 3.0 b5


I have been sipping from the Firefox firehose for a long time. Long enough to remember that it used to be called Firebird! (bet ya didn't know that!)

Since moving to the Mac about a year ago, I have been pretty happy with the speed of Safari so have pretty much just used that. I use Camino when I encounter sites that isn't Safari friendly - my bank for example. The reason I choose Camino over Firefox is purely aesthetics. Camino renders widgets natively, whereas Firefox 2.x doesn't.

After reading a bit about the speed and memory improvements in the last FF3 beta, I decided to give it a try. Wow. They weren't kidding about the improvements. I like the new skin and it is noticeably quicker to load and render. FF3 now feels about as fast as Safari 3.x when rendering pages.

The biggest new feature about FF3 is that is now renders widgets natively. Nice.

I have been using FF3 for a week and haven't used Safari once. I think that says it all.

Thursday, April 17, 2008

Looking to change direction...

A conversation on Twitter yesterday with Tim got me thinking.

I have been getting a little bored with being a software developer of late. I'm not really sure if it is a general apathy toward software development in general, or just the stuff I have been doing.

As any regular reader to the blog will know (all three of you), I am a born again Apple addict. I think my development boredom has come out of the fact that I sit in front of Windows for 8+ hours a day. Every time I fire up one of my Macs, my inner ten year old, open to the endless possibilities of computing returns, only to be beaten away by the 32 year old reality of being a commercial software developer when I sit back in front of a Windows box.

So I have made a conscious decision to make a change. My end goal is to eschew Windows completey and make a living as a developer on the Apple platform. I have made a start on that front with a bit of iPhone consulting, but by the end of the year I am looking to either be a full time Mac developer/consultant - whether that be Cocoa or Cocoa Touch, and/or get more in to Ruby on Rails.

I am also aiming to be getting 75%+ of my income from telecommuting gigs. Tim is showing me the way on that front, he has been completely freelance for the last 5 or so years and hasn't looked back.

Of course commercial and financial pressures might mean I have to do a little .NET stuff here and there, but there's no point setting a goal if you don't set the bar high enough. (That's enough mixed metaphor's for one post)

BTW if you are a Apple dev shop looking to offload some work I can be contacted at

james at softwarex.co.nz

Monday, April 14, 2008

10km Charity Fun Run

I am participating in a 10km fun run for the Marie Curie Cancer Care organisation on April 27. From their blurb:
Marie Curie Cancer Care provides high quality nursing totally free, to give terminally ill people the choice of dying at home supported by their families. Your local Marie Curie Hospice actively promotes quality of life for people with cancer and provides support for their families. The services are completely free to patients. World class scientists at the Marie Curie Research Institute are investigating how cancer develops to find better ways of treating the disease in the future.


I really can't think of a better way to expend a few calories and raise a little money. My original target was £100 but through the generosity of friends and family we have reached that in under a day!

But, you can never raise enough money so for anyone reading this with some spare cash here is the link to my page and feel free to donate as much or as little as you can. As the old saying goes, It all helps.

Saturday, April 12, 2008

.NET NZ (expat) catchup in London number 2.0

Nic, Dan, Tana, Vince, Shekhar and myself got together for a few drinks and a chat in Earl's Court recently. We have these catchup's roughly monthly - it's just a way for a bunch of Kiwi geeks to have a catch up, a few beers and a general chin wag.

Topic of conversation was varied - from Rugby to Security concepts, but never strayed to far from Web development, and our thoughts on Microsoft, and where they are heading. We talked a bit about Apple, and Mac's in general - three of us run Mac's as our personal machines. The general consensus is that if you are running Windows, then Apple hardware is the fastest way to go!

Anyway, any other Kiwi geeks in the UK drop me a line and I'll be sure to send you an invite next time it's held. To the other guys, cheers for a enjoyable evening and catch ya next time!

Wednesday, April 09, 2008

Tips from the Frontline: null coalescing operator

I knew about this feature but for some reason thought it was new in .NET 3.5.
It's not, the null coalescing operator has been available since 2.0.

So what is it? It's hard to say but easy to use, so a code example might be easier:

string name = Request.QueryString["name"] ?? "Please Supply a Name";

Basically it allows you assign a value for the not null case and an alternate value for the null case.

This used to be done using the conditional operator:

string name = null != Request.QueryString["name"] ? Request.QueryString["name"] : "Please Supply a name";

Very handy for example when populating C# Model Classes from a DataReader.

Thursday, April 03, 2008

Who needs Ruby on Rails?

This is one of the funiest things I've seen in a long while. I guess it helps that I have maintained a few COBOL projects in the past.

For fsk sake.

http://news.bbc.co.uk/sport1/hi/motorsport/formula_one/7328018.stm

Lets make this clear. Nothing Max Mosely has done is illegal, or infact remotely illegal. What people do in private, is their business. Period. The fact that something gets published and put into the public domain, does not make it public domain.

Let me say that again. The paper in question posted a story and video of a private act and made it public. This in no way makes it public.

Issuing statements like this doesn't distance Toyota, Honda, Mercedes or BMW from anything Mosely did. Because they were never implicated. To issue these sort of statements infact makes you look like a bunch twats. What they should have said was something like, "while we disagree with Mr Mosely's conduct, we find the posting of such material abbhorent and an invasion of privacy. Mr Mosely has our full support in this difficult time for him and his family"

That's what a company with intergrity and balls would say. Or better yet, just say nothing.

This comes from the PC society we have become. I for one am sick of it. Surely the out cry should be against the paper, not whether or not some old dude gets off on being spanked by someone dressed up in a Nazi uniform?

Wednesday, April 02, 2008

ASP.NET MVC Framework - First Look

I have been playing with the ASP.NET MVC Framework (Preview 2) recently. For those of you who don't know what the MVC framework is about, then read the overview docs in the link above. (I'll wait).

Issues with ASP.NET
While the ASP.NET framework is a huge improvement over classic ASP, it does have some pitfalls and downsides. The Postback and Viewstate pattern does add flexibility, it does also add bloat in the form of encrypted values to your page. This means slower download times and ugly HTML (Some designers really, really hate this. Good synopsis of Viewstate issues and work arounds Here

While ASP.NET goes some way into code seperation, by splitting the View from the Code, the Page_Load mechanism can promote lazy developers into stuffing alot of business logic into there.

Also the current model makes unit testing ASp.NET pages difficult.

Alternatives
There are alternative patterns already being used. The current project I am working on uses the Model View Presenter pattern. MVP adds more seperation from standard ASP.NET and allows for greater testability. I quite like MVP and is probably better suited to larger projects, due to extra initial coding. I will do a follow up post on my experiences with MVP, but there are quite a few resources available for a quick grok.

While I like the MVP pattern, I would strongly recommend people looking at the MVC pattern also before comitting to the MVP.

Model View Controller
The MVC pattern is quite common in standard GUI apps. Cocoa development on the Mac and iPhone actively promotes and enforces the pattern, and Java developers have been using it for a while. It is only in the last few years that web developers have embraced the technology.

The ASP.NET MVC framework is still in beta, with Preview 2 being released recently. The major benefits I can see are

  • Greater Testability and Mockability

  • Greater seperation of concerns - logically breaking down app into components

  • URL rerouting built in

  • Elimination of PostBack and Viewstate



Along with these it enforces a logical project and solution layout, so going back to old code will be easier under MVC.

I went off on a tangent on what I originally thought I would post about, but I will post some sample code about MVC in the future as I get to grips with it.

Thursday, March 13, 2008

Resetting Intellisense in VS 2005

For some reason or another (well possibly due to uninstalling R#) intellisense had stopped working in Visual Studio (2005).

It's fairly easy to rest it. To do so enter the following commands into the console from the \progra files\Microsoft Visual Studio 8\Common7\IDE directory:

1) devenv /setup
2) devenv /resetuserdata
3) devenv /resetsettings CSharp

Restart VS after step 3 just in case.

This will clobber any customised settings such as fonts or colors you may have installed. For me it killed the TextMate theme I had installed. Worth it to have intellisense back!

Twitter

So I've decided to experiment with Twitter.

I am "KiwiBastard" - www.twitter.com/kiwibastard

Feel free to follow me. Actually please do I only have one at the moment and that's my wife!

For those of you that don't know, Twitter is a service where you can update what you are up to, keep in touch with people all in 140 character posts. Has the power of social networking like Facebook, without the app Spam.

Wednesday, March 12, 2008

iPhone SDK. Initial Impressions

I have been playing with the iPhone SDK over the past few days. BTW they need a better name than that I think, it's not just for the iPhone. I think there will be just as many iPod touch users. Anyway I digress.

After the intial hiccup of the download server being over loaded, I managed to down the SDk a couple of days after the release. It's a whopping 2.1Gb which includes the actual SDK and other tools including an update to XCode to 3.1. That's a post in itself, but the code editor seems to be a lot nicer with inline error messages, code folding (that may have been in since 3.0 not sure) and little things like brace matching animations etc.

The actual SDK is broken in 4 layers. They are: Core OS, Core Services, Media and Cocoa Touch. I won't go into detail here but the main layer is the Cocoa Touch layer which includes the UIKit framework which handles UI and UI events such as gestures etc.

More info HERE

Initial Thoughts
First off, I am a hobbiest Objective-C programmer at best. While I am a very experienced C# developer, Objective-C is a little different. Having said that, I had an iPhone app running pretty quickly. Admittedly, the app only displayed a TableView and then on touch of a cell loaded another view, but it was easy. A few lines of code easy.
The SDK would be an impressive effort on a full blown desktop, but packing all the animation and UI features into a device the size of a phone is nothing short of amazing. The features the iPhone exposes through the SDK is nothing short of game changing. As a long suffering Windows Mobile developer, to say the iPhone is a generation ahead from a developers point of view is an understatement.

I think the clearest thing I can say is that a developer with a good idea isn't limited by the device. Except...

Issues
There are a couple. First off, your iPhone app exists in a "sandbox" mode. It can't access resources from other applications or files from outside it's realm.
Also, only one application can be running at once, and if the phone rings for example, your application will simply quit.
The last issue is syncing. There isn't at this stage inbuilt syncing functionality. There are a couple of options to get over this mostly involving communicating with a network layer or webservice. So your desktop app will have to expose it's data either locally or over the internet via a webservice. This does give the option of having a Windows app serving the data, but it would be nice to have a desktop syncing mechanism ala Active Sync.

The thing to remember is this is a Beta so hopefully some of the issues can be addressed before official release, but even so this is going to be big. I mean think of the games potiential alone. With the motion detection on the devices, it has the potiential to take hand held games to another level.

So as a conclusion to this ramble, I had great hopes for the SDK, and they have been met in almost every way.

Thursday, March 06, 2008

iPhone SDK announced

The iPhone SDk has been announced by Apple. It is beta at the moment, with full release in June.

All apps will be published through iTunes with the developer getting 70% of revenues. Pretty fair I think.

This is going to be huge. If you don't believe me, try and download the SDK - the server is overloaded!

Wednesday, March 05, 2008

Intoduction toExtension Method

One of the nice features in 3.5 is Extension Methods. Basically a side effect of LINQ, Extension methods offer the ability to create utility methods that are statically available to all classes. I'm not going to go into detail here, but there is plenty of information available on the net.

One utility class that most developers will have in there virtual rucksack is for Encrypting and Decrypting. In most cases encryption/decryption is done at variable level, for example encrypting/decrypting passwords or logins.

Creating an Extension Method to do this is a simple thing to do.

There are a couple of criteria that an EM must adhere to. Out of the Visual Studio help file : "Extension methods are defined as static methods but are called by using instance method syntax. Their first parameter specifies which type the method operates on, and the parameter is preceded by the this modifier. Extension methods are only in scope when you explicitly import the namespace into your source code with a using directive."

To achieve our goal we will create two EM's. One for encrypting some plain text and one for decrypting an already encrypted value back to plain text.

First we must create a new class. Make sure the class is marked static.

Our encryption EM will take a string parameter and return an array of byte as below:

public static byte[] ToEncryptedValue(this String unEncryptedValue)
{
   return ProtectedData.Protect(Encoding.Default.GetBytes
      (unEncryptedValue), null, DataProtectionScope.LocalMachine);
}

All the hard work of encryption is handled by the ProtectedData class. The DataProtection class is a .NEt wrapper for the Data Protection API (DPAPI). The beauty of using the DPAPI class is it illeviates the neccessity of generating and storing an encryption key, which can be an issue when dealing with security. The protect method takes a string, and a protection scope and returns an encrypted array of bytes.

Conversely, our decryption EM will take an array of bytes and return a string as below:

public static string ToUnEncryptedValue(this byte[] encryptedValue)
{
   return Encoding.Default.GetString(ProtectedData.Unprotect
      (encryptedValue, null, DataProtectionScope.LocalMachine));
}

again we use the ProtectedData class. The only caveat here is the data protection scope must be the same as the encryption scope.

Also, the encryption is tied to a machine. You can't take a password encrypt it on one machine and then try and decrypt it on another machine.

Extension Methods are called like any other class method, except they are called by variables themselves. For example to encrypt a variable called password:

byte[] encrypted = password.ToEncryptedValue();

and coversely to decrypt:

string plainText = encryptedArray.ToUnEncryptedValue();

Easy!

Hopefully from this the potential of extension methods are evident.