Debugging web application requests

Posted on Wednesday, August 26, 2009 by Nicki

Have you ever needed to debug a web application request for an application for which you do not have the source? There is a neat little application that can do it transparently, without needing you to reconfigure anything. It's called Fiddler, and you can download it here.

Some screenshots:

How to make video recordings of screen activity on your computer

Posted on Monday, August 24, 2009 by Nicki

A colleague found a nice tool for creating videos from activity on your computer, like when you show someone how to navigate your website, etc. It's called CamStudio, and is free. Get it here.


Common Table Expression (CTE)

Posted on Tuesday, August 18, 2009 by Nicki

Do you know what a Common Table Expression is? It is a temporary named result set that can make your SQL easier to read and maintain.

Where can I use it? Often one encounters a summary screen that has some basic information, along with a sum or count. One example is for instance details about an employee, plus a count of the number of people reporting to him. This can lead to some nasty SQL if you write it all in one statement. This is where CTE steps in. You can create a CTE for the number of people reporting to an employee, and join that with the employees table like it was a normal table.

In the example below the CTE is a result set with a ManagerID and the number of people reporting to that manager. It is then joined to the Employee table. Do you think it makes the SQL cleaner and easier to read?
USE AdventureWorks;
WITH DirReps(ManagerID, DirectReports) AS
FROM HumanResources.Employee AS e
SELECT e.EmployeeID, e.BirthDate, ISNULL(DirectReports, 0) as DirectReports
FROM DirReps as d right outer join HumanResources.Employee as e on d.ManagerID = e.EmployeeID
ORDER BY e.EmployeeID;

You can find some additional info here.

Adding more storage for mythbuntu (and other uses)

Posted on Sunday, August 16, 2009 by Nicki

Since my mythbuntu box is old and does not have onboard SATA support, I deciced to build a storage server with new hardware and record from the mythbuntu box to an NFS share on the storage server.

The hardware of choice was an Intel Atom motherboard, D945GCLF2D, due to the low processing power required. It has a 1.6GHz dual core processor, but is very quiet due to no fan on the processor (although the chipset has one!). Since I don't want to have problems later on, and RAM is so cheap nowadays I decided to get the max 2GB that the board supports, even though it is a huge overkill.

For storage I got 2 500GB SATA drives, which is going to be used in a RAID mirroring configuration to provide some form of protection from failure. Since I don't have hardware RAID capability, I needed another disk to install the base OS on, because the RAID volume would not be available until after boot. I also wanted a cost effective (read cheap!) solution, so I opted to get a USB drive to install the base OS on, since the motherboard supports USB booting. This meant I did not have to get an optical drive, which was only going to be used once for installation.

The software of choice for the storage server is FreeNAS, a free Network Attached Storage server based on FreeBSD. It has software RAID capability, and can exposes the storage in lots of different ways. It can also notify you via email in case something goes wrong with your server, so you can really hide the box in a corner and almost forget about it. Administration is via a web interface once you have it up and running and connected to a network.

I installed the embedded image from the downloaded ISO onto a USB drive using physdiskwrite, booted the new box with it, configured the disks, and shared the RAID volume via NFS. The next step was mounting the NFS share from my mythbuntu box, which was trivial as well, I only had to install the nfs-common package.

Initially I had a stability issue on mythbuntu with the NFS share, it kept hanging up after a period of inactivity, but installing all available updates seems to have cured that problem, I'm happily watching a recording as I'm typing this.

MyTechEd #2 - Visual Studio Tips and Tricks

Posted on Friday, August 14, 2009 by Nicki

Presenter: Mike Palermo

The session started off a bit rocky due to the fact that Mike's laptop and the projector did not want to go to a higher resolution than 640x480 or800x600, can't remember, all I know it was big and not a lot fitted on the screen. It was really unfortunate, as it was a great session.

One of the nice things we were shown was how to create your own code snippets.
Snippets are XML documents, so they can be created/edited easily. The standard code snippets are stored in Program Files\Microsoft Visual Studio 9.0\VC#\Snippets\1033\Visual C# for C#, so you can copy one from there to My Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets and edit it to your liking, obviously changing the Title and Shortcut values.

Look here for a snippet editor.

Other usefull tips were Prevent Copy on Blank Line and Toggle Clipboard. I'm not going to post every tip here, so please see Mike's speaker notes here.

Link to presentation: download here

My TechEd #1 - Dashboards & Scorecards

Posted on by Nicki

Presenter: Gavin Russell-Rockliff

This was an overview session to introduce the dashboarding and scorecarding capabilities available in the Microsoft platform.

The central component is PerformancePoint Server 2007, which now comes with MOSS Enterprise. A variety of datasources can be integrated into dashboard/scorecard, including SQL Services Analysis Services, Excel 2007, Excel Services and Relational Tables.

Link to the presentation: download here

WITH NOLOCK = dirty rotten scoundrels

Posted on Wednesday, August 12, 2009 by Nicki

A comment by a presenter at a SQL Server tuning session at TechEd Africa 2009 sparked my interest, so I decided to investigate.

Do you use WITH (NOLOCK) with each SELECT statement? Do you know what it does?

Let me fill you in. It allows your query to read uncommitted data, i.e. deleted or inserted rows that might still be rolled back. Even worse is that it can double read rows, or even misread rows. Imagine the impact it might have on financial systems...

This might be ok in a data warehouse environment (when the data is not being updated), but certainly is not ok in a transactional database.

If you still need convincing not to to it, look here.