Archive for 'Software'

Windows Server 2008, ASP.NET, Pre-compiling and Virtual Directories

windowsserver2008 There has been an interesting problem at work over the last couple of weeks. We are in the process of preparing to move service providers and at the same time upgrading all our servers to run Windows Server 2008 and SQL Server 2008. In preparation for this move, we have been upgrading our staging and test servers so we can be sure that everything will work as expected and to iron out the processes, so the move goes as smoothly as possible.

It took about ten minutes before we hit the strangest of problems. It was focused around the way we use a virtual directory to share common code and controls across different websites. The premise is that you create a project to hold your common javascript/images/ascx controls/web services and so on. You then use a virtual directory inside each of your websites that points to the common project. With only a small amount of tweaking for the common ascx controls everything seems to work without too much trouble. That is, until you try to do this on Windows Server 2008.

When we started up our web application on our new environment, we noticed almost immediately that the AJAX calls that used the common web service were failing. The error message was suggesting that the project that contained the common web service has not been compiled correctly. By copying the website across to a Windows 2003 server, we deduced that the problem was specific to 2008 as it worked perfectly on 2003. Having exhausted all the developers ideas on why this would be, we called Microsoft and got them involved in troubleshooting the issue.

A few days later an answer came: do not pre-compile your website. Sure enough, build the website without pre-compilation and it worked perfectly. Microsoft’s explanation was that it was due to a change in the way that Windows Server 2008/IIS7 worked. Fairly cryptic I must say and certainly does not leave me satisfied as to why it would not work and what have they done to stop it working. For us, using Windows Server 2008 and IIS7 is more important than the slight performance hit you get when deploying without pre-compilation. For others it may not be such a desirable solution.

Do You Speak HTML?

bubble Ever since I have been living away from my home country of England, I have noticed myself picking up on what I would consider misuses of the English language. On the most part, they are Americanisms, for which I take great pleasure and amusement in refusing to understand, until the person uses the English pronunciation. However, I also seem to hear an awful lot of completely made-up words or incorrect grammar. One may argue that this does not matter, as long as you can communicate the message but I guess being from the country that shares it’s name with the language, I have a built-in pride for it’s correct usage.

In development, things are usually not so forgiving when it comes to language. If you don’t get the spelling or grammar correct, it just will not compile or operate as expected. That is, except for HTML. Browser rendering engines are not fussy at all when it comes to HTML and will render pages happily, even when the code is all over the place. There is historical reason for this but unfortunately it seems to have lead to complete complacency in developers.

HTML is not a difficult language, it is simple to understand, there are not that many grammar rules and the vocabulary is tiny. So why then is there such a massive quantity of web developers who are just not that fluent in the language? I am not talking about just being able to get a page to look like the design. I am talking about expressing the content of the page using correct elements and combinations there of. There is a reason behind every html element, they were created because of a need, and each should be used where it is appropriate to do so.

If you are from the school of thought that does not worry about this, as long as it renders as the designer imagined, then there are good reasons why you should be thinking otherwise. Every day, web bots will be viewing your pages and trying to understand them. Screen readers do the same thing and a badly constructed page can be totally confusing to a blind person. You could be losing out on valuable traffic because of this. You could also find yourself with more work down the line. A site like Css Zen Garden shows just how much can be done with design without touching the html. That is not so easy when you have to work with a badly created page.

So what if that is not a big enough reason for you? Well, look at it this way. People who can speak correctly and have an extensive grammar, find themselves in a much better position than those who don’t. It can give a great first impression. The same thing is true for development. You may consider yourself pretty good in your chosen programming language but if you are sloppy in such a simple language like html, it could be the deal clincher in a job interview. It would certainly change my impressions of a potential candidate if they don’t have a decent grip on something that they should be able to in their sleep.

So how is yours? Time to brush up perhaps? Are you really that fluent? Be honest with yourself. How well do you speak html?

Edit: To all those that have taken this opportunity to pick holes in my use of language in this article: I do not consider myself an expert in English, by any means. I make as many mistakes as the next person. I now live away from England and on a daily basis I hear non-English people use phrases and pronunciations I was taught are incorrect. I don’t try to preach the way I was taught or consider that way the only way it should be done. My point was that something like Html should not have such variance. There is a worldwide standard we are all supposed to adhere to and were it not such a forgiving markup language, things would be much better.

Windows UAC. Get Over It.

The slating of Microsofts UAC has recently been reborn now that the early adopters of Windows 7 have found security flaws in the new version. It reminded me of the outrage that occurred when it was first introduced in Vista and at this late stage, prompts me to point out something that was conveniently overlooked at the time.
With all those people that seem to stand on their soap box and claim it was the most rediculous thing ever to have come out of Redmond, no one mentioned that UAC was just Microsoft catching up with the other major operating systems. I recall all those smug-faced OSX and Linux owners saying ‘Vista? Don’t bother. Try a decent operating system’. I even recall an Apple advert poking fun at the fact that UAC was introduced. Yet, when I boot up my Hackintosh or Linux VM and do anything that is outside the realms of everyday use, low and behold I get prompted to elevate my security level just like UAC in Vista.
I admit when I first started using Vista it confused me. Whereas before, I could put files here and there, install things with very little thought, all of a sudden I was prompted to stop and think for a second before I do. After some use, the dust has settled and I realise it makes sense. What’s more, the times I am asked to confirm my actions are relatively few, as it only occurs when I install something new, try to copy something to a system area or do anything that may affect the system configuration.
I realise that I am a bit late with this comment but I never got the chance to talk about it at the time. So please, anyone who wants to moan and complain about UAC please accept that in the long run it’s a good thing, appears in some form in every major operating system and is here to stay. So please, get over it.

PuTTY Auto Login at Media Temple (gs)

For one of my projects, I use the Media Temple Grid Service for hosting. They offer ssh access to the hosting, which is superb and coupled with svn repositories, enables me to keep all the source there too.
Using a nice, secure complex password to log on with the ssh client, my IDE and my svn client is very tedious – I have to dig out the password every time. It was therefore imperative that I configured the ssh private-public keys so that I could login automatically.
It took me a while to figure it out first time and recently something happened with their servers that caused my ssh login root directory to change (of course they denied this), causing my ssh keys and a few scripts I had to ‘disappear’. This meant that I needed to setup the keys again and although not as bad as the first time, it still took longer than it should. I therefore log the process here to help others that may struggle with setting them up and as a reminder to myself, should another ‘incident’ occur at Media Temple. Here is the process:

  1. Ensure you have putty, puttygen and psftp installed/downloaded
  2. Login to your MediaTemple account using putty
  3. Type: ssh-keygen -t rsa
  4. Follow the instructions to generate the keys. Do not use a pass phrase as we want autologin.
  5. You should now have id_rsa and id_rsa.pub in the .ssh directory
  6. Change directory into .ssh and type: cat id_rsa.pub >> authorized_keys2
  7. FTP into you MediaTemple account using psftp and download the id_rsa file. For Vista users, watch out for UAC. Its best to ensure you download to a safe directory like your desktop
  8. Open up puttygen and select from the menu: conversions->Import Key
  9. Select the id_rsa key file you downloaded and puttygen should then import it
  10. Click Save Private Key and save the .ppk file in a place of your choice
  11. Open up putty and fill in Connection->Data ‘login username’. Then go to Connection->SSH->Auth and select your newly created .ppk file when you click on ‘private key file for authentication’
  12. Save the putty session. This session should now login automatically

The important point here is that the keys were created on the server and then imported to putty. Many of the guides I found create the keys with putty in the first place and that just did not work for me.

The Technical Debt

I have spent the last few days at work doing some intense refactoring of a seemingly complex jQuery plug-in. I managed to cut it down by 140 lines and speed it up immensely. Whilst it would have saved time if I had written the plug-in myself in the first place, I cannot be expected to do everything and nobody else at work would improve their jQuery and javascript writing skills if I did so. I therefore label my time spent as paying of some of the technical debt that we create, in the process of releasing the software as quickly as we can. If you have not come across this metaphor before, here it is:

It really nails the reason that as developers, we try to refactor regularly. Unfortunately refactoring is not something that people outside of the development community tend to understand and it is considered a waste of time all too often. I think use of this metaphor may just help those people understand.

Is Atlas So New?

Slipping musically into my twitter stream earlier this morning came an excited remark by John Resig. He seemed all hyped about the new Atlas product from 280 North that they announced at Future of Web Apps, Miami.

Given John’s reputation in web development, I immediately followed the link and watched the introductory video on the site, expecting to be amazed. It looked all very pretty and the creation of an rss reader with just a few clicks of the mouse gave suitable wow-factor to the demonstration.

However, I could not help thinking that I had seen this idea somewhere before. I use it at work every day – Microsoft Visual Studio. The same concepts are there for web development – a drag-and-drop interface, with built-in controls that are supposed to take most of the grunt work away from you.

At first look, this idea is great – creating fully-fledged application in no time at all. However, in my experience with Visual Studio, this ends up being more of a hindrance than a help. I avoid the drag-drop functionality of VS like the plague, not because I am a glutton for punishment but because of the intrinsic limitation it places on you and because most of the time the same functionality can (and should) be achieved in a faster, more flexible and more maintainable way. The biggest gripe I have with web development in VS is the constant struggle to make it produce tidy html that is standards compliant.

Atlas might not be like that at all. I have only seen the video. However, I don’t think it is revolutionary as the buzz today would lead us into thinking and it may not be all that people hope it is. It could endup just being a Visual Studio type development environment based in a browser.