Sunday 14 December 2008

Am I virus free?

A few days back, Windows Defender popped up a message to say that a process was attempting to modify my hosts file. I didn't think anything of it for a while as I was running a number of applications that were harmless contenders (such as Mojo CMS, Microsoft Mesh, IIS) and furthermore an anoying URLRedirect service was installed be default on my XP desktop as part of the Dell desktop package which changes your homepage dynamically when a URL is not found.

Initial Virus Scan
As a precaution, I looked up the "SettingsModifier:Win32/PossibleHostsFileHijack" error that was being displayed and followed the advice to perform a full virus scan. I ran a full scan using both Windows Defender AND Semantic (Norton) Antivirus (corporate edition). Both of these gave me a clean bill of health which was encouraging - or so I thought.

Sysinternals

After a reboot and after working in VS for a couple of minutes, I received the hosts file hijack error again. I was now rumbled and determined to find out what was causing this. I allowed the process to modify my hosts file to see what was happening. Microsoft.com was being redirected to 127.0.0.1 localhost. I then went onto sysinternals.com and downloaded both the autoruns application (a tool to determine which processes are launched at startup) and process explorer - an advanced task manager with process tree information and file dependencies.

The first thing that browse all autorun processes. In this list there were 4 libraries and exeutables that were NOT registered to any company. This was suspicious. I searched for the corresponsing entries in google and all of them pointed to a worm or trojan. I found the corresponding executables through the tool and deleted them from my system, some of which were locked hidden system files requiring me to kill the host processes using the sysinternals.

I then peformed the same search using the sysinternals process explorer and found another 5 processes that were not registered to any company. Some of these were desktop extensions that were more than likely harmless (such as Filezilla and Tortoise SVN) but I wasn't going to take any risks. I remove the files and killed the processes.

I then went on a mission to remove any software and files that I was no longer using, simply to allow the virus scanners to run more quickly.

4 hours later and after a subsequent reboot I was still not comfortable. I was receiving a Windows Defender warning from a proces called Kontiki (which is a peer-to-peer media sharing tool). This was likely to be harmless again as it is installed by the media streaming services such as 4OD, but by this stage I was not taking any chances. I have prided myself for having avoided viruses for years, since the disk sharing days of the Commodore Amiga, something had allowed by system to be compromised (perhaps the prevelence of USB keys in the workplace). My firewall is on, my wireless is encrypted and includeds MAC address filters!

I manually removed Kontiki from the startup registry entries (again using sysinternals) and from the program files folder.

Insufficient virus scanners?
I was really concerned that my two virus scanners, both of which were fully up-to-date, had not detected any problems after a full system scan. A collegue had recommened AVG. I downloaded, installed and performed yet another full system scan. AVG found 4 additional Trojans that I had not detected. Fortunately these were not running and were easily quarantined by AVG.

So what is the message? Firstly I am now nervous that I am not clear of viruses based upon the inconsistencies between the virus checking software. Secondly, how on earth is a typical home user supposed to deal with viruses. I am extremely careful, but I will be even more so now. I am still extremely tempted to upgrade my desktop to Vista now that we are moving across to BizTalk 2006 R2 (R1 is not supported on Vista). Hopefully UAC will further mimimise the risks.

Cheers - Jon.

Friday 12 December 2008

ASP.NET and AJAX unit testing with Watin

I stumbled across a great .NET library for unit testing our websites. This was listed alongside a question that I answered about "must-have" .NET libraries on stackoverflow.

The Watin tool (pronounced "What-In") is a .NET library which allows you to issue simple commands for navigting around your web site and more importantly supports the Microsoft AJAX control toolkit (as well as other Ajax implementations).
I used the following code to login to our travel product, navigate to the hotels page and search for a hotels with a town via an ASP.NET autocompleter control.

IE ie = new IE("http://localhost/mytavelproduct");
//login

ie.TextField(Find.ByName("txtUsername")).TypeText("username");
ie.TextField(Find.ByName("txtPassword")).TypeText("password");
ie.Button(Find.ByName("cmdLogin")).Click();

//goto the hotel search pageie.Link(Find.ByUrl("http://localhost/mytavelproduct/Hotel/HotelSearch.aspx")).Click();

//gradually populate the ajax autocompleter field in the town field

TextField field = ie.TextField(Find.ByName("ctl00$cphM$ucHotelLocationSection$txtTown"));
field.TypeText("lo");
Thread.Sleep(1000);

field.TypeText("nd");
Thread.Sleep(1000);

field.TypeText("on");
Thread.Sleep(1000);
//the autocomplete dropdown should have appeared at this stage...

However, in order for the above code to work with the Ajax autocomplete dropdown control, I had to jump through a few hoops.

The first issue is detailed as follows on blogspot http://lazyloading.blogspot.com/2008/06/testing-aspnet-ajax-autocomplete.html

Adding an attribute to the ajax control on page load, performed some "Runtime event reanimation" which allowed the TypeText methods of Watin to be captured by the ajax control.Without this the mocked key presses are ignored.

The second issue was related to javascript that we had on the page. The Watin code appears to loose focus, or blur the control between methods. Unfortunately the onblur event is used by us to clear the text value if nothing has been selected from the ajax autocompleter. By removing this javascript code from the control (with a view to moving it to the page Submit button?) the ajax dropdown is now displayed during the Thread.Sleep periods.

Having completed this and by browsing various blogs for the answer, I also found something that will generated the above code for you!!
http://watintestrecord.sourceforge.net/

This is not perfect (as the ajax stuff requires a bit of hand crafting) but this will take the leg work out of 90% of the coding.

Finally I have found a community out there building frameworks and further examples on how to use Watin.



This has been a long time coming. The Microsoft Web tests have simply not delivered, this is going to make life much easier

Cheers - Jon.

Monday 8 September 2008

Challenges of installing SQL Server from an ISO image extract.

I decided to build a portable, laptop version of my office development workstation, simply because I often struggle to get the bandwidth necessary to use remote desktop comfortable when connecting to my work PC.

The corporate policy dictates that all machines need to been Windows XP SP2 or SP3, this rule however is something that does not apply to the development team - as long as the company is not required to support the non standard OS installation.

Anyway, I had recently aquired a high end dual-core, 64-bit Dell XPS with 4 Gb RAM - simply because we have a company policy to have a minimum of 2 of any one model (to help with hardware/software troubleshooting in case of machine failure). I decided to go Vista Ultimate 32 bit after failed attempts to find the necessary NVIDIA display drivers for the 64 bit installation of both Vista and Windows Server 2008.

My role requires me to keep up to speed with the latest technology developments, largely with a Microsoft focus but with an eye on the non Microsoft world. The development machine installation is as follows:-

Microsoft Dev Tools
SQL Server Expresss, 2005, 2008
Visual Studio 2005, 2008 SP1
BizTalk Server 2006 R2
Office Ultimate
Powershell

Non Microsoft Tools
Apex SQL - DAL Generator
My SQL 5.0 + Client tools
Sybase Power Designer 12

I made a call to take an image of the other XPS that a collegue of mine had built, he had already gone down the path of Vista 32. This was the start of my problems.

The machine restore worked fine for all tools except SQL Server 2005/2008. The BizTalk install which I had assumed would cause me grief required a simple "Remove Current Configuration" to get back to a fresh installation.

The first problem was probably the catalyst for all subsequent issues. The local system accounts used for running SQL Server were shown as a GUID representation rather than an account name. From experience, this usually means that the user name that is being referenced does not exist. To this end, I thought it would be cleaner to re-install SQL Server (all versions) given that BizTalk was in an unconfigured state with no active database dependencies.

I ran through a lengthly process of uninstalling all SQL Server related features via the control panel, whilst simulatenously downloading the installation ISO images from MSDN. I removed SQLExpress as part of this process. Once downloaded, I extracted the ISO images to a sub folder on my laptop and launched the setup process, starting with SQL2005 Standard Edition.

With all pre-requisites in place, the installation ran through to near completion, but failed at the final hurdle installing the client tools portion. From this point onwards trial and error and a lot of forum surfing began.

Numerous forums directed me to the installation log files and I began to go through the following in sequence.

1. SQL Server has a problem when iterating through named/default instances. Ensure that that your machine name is in upper case.
This is easier said than done, when attempting to rename your machine in Vista, the uppercase version of the machine is recognised as being the same machine name - so the Apply button is disabled. To achieve this I had to switch from an AD domain to a workgroup domain to change to an upper case version. Even after this however, when returning to the machine settings a mixed case version of the machine name was displayed.

2. When installing from a local file system, the Tools and Servers folders must exist off of the root folder or exist in a folder directly below the root folder (e.g. c:\SQLServer2005\Servers and SQLServer2005\Tools)
http://support.microsoft.com/?kbid=916760
This is not too clear, the 2 ISO images (CD1/CD2) are not named as server and tools. An assumption was made that CD1 was Servers. I copied the files to the structure as described by the KB article and re-attempted the install. Having attempted the install numerous times before, I restricted the options to just to client tools for speed. BINGO! Having succeeded in the client install I continued on to install the server componenents successfully.

I have since read articles that indicate that the clients tools installation can be launched and installed independently from the CD2 image. This makes sense, the installation from CD1 would normally prompt for CD2 when installing from the physical media - the file version obviously isn't too clever.

Anyway, SQL 2005 is now installed - on to the service packs and SQL 2008!

Thursday 24 January 2008

Microsoft Apps vs Google Apps

Battle of the applications

I am convinced that the battle of the Internet will continue for many years, and it is clear, to me at least, that at this stage Google are way ahead in the search engine arena. This is almost too obvious to state.

The next battle that is about to begin, is the battle of the online application. I consider myself to be a medium to heavy user of the Internet: banking, email, research, development, weather, maps, directions, holidays, VPN, ...the list goes on. I have learned that as much as I think that I am an individual, I am not alone. Thousands, if not millions are becoming more comfortable with shifting more of their life into the online cloud.

Can office applications be moved online?

Microsoft are now offering a free web site and URL with Office Live Workspace and Office Live Small Business initiatives. I pre-registered for the Beta of Live Workspace today, I will post my findings once I gain access. It is clear that Microsoft are considering Google Apps to be a serious threat to the Microsoft Office suite - the single largest earner for Microsoft.

Google Apps is well established, and I for one am amazed at what can be done with the recent addition of Ajax to the web developer's toolkit. Recent additions to the documents include charts, drag-and-drop, custom backgrounds. The question is, how long will it be before the online office applications are as good as their desktop counter-parts? Are these application really usable or am I just impressed by what has been achieved within the browser?

My brother, who is also in the software development arena, bought me a copy of the the Google story for Christmas. Having read the book, it is now very clear why Google are such a threat to Microsoft. Simply put, they are growing exponentially financed by their unique advertising model (read the book if you are interested). Google's financial security and their attitude towards research and development mean that they are now a massive influence on the direction of the software that we will be using in the future.

Until recently, Google was purely an Internet based offering. I am now using Google desktop for indexing the files and emails on my laptop and desktop PCs. I have Google mobile on my mobile phone and Blackberry to read my online documents. A blue dot tells me where I am in the world on my mobile when I access Google maps by referencing the location of the mobile phone mast that I am connecting to. How long will it be before Google office applications appear on my desktop?

Will Google take the next logical step and release an operating system? Will we need anything other than a browser and a mobile device?