Wednesday, February 07, 2007
Wednesday, February 07, 2007 10:44:13 AM (SE Asia Standard Time, UTC+07:00) (ASP.Net)

Having recently moved my DasBlog tech blog from one domain to another I wanted an easy way to redirect all the traffic from the old domain, to the new one.

My shared hosting provider doesn’t provide directory level redirects (although this can be done in IIS) – only domain level.

There are also plenty of examples out there for how to redirect a single page – typically Default.aspx. What I wanted was true SEO friendly Url for Url permanent HTTP 301 redirection for every page and service in the blog.

Since the blogging engine and directory contents were the same all I needed to replace was the name portion of the domain name for the incoming Urls, redirecting them to the same resource, but on the new domain.

So I knocked to together an HTTP Handler that looks like this.

namespace DotBits.Handlers
{
   public class RedirectHandler : IHttpHandler
  
{
      public void ProcessRequest(HttpContext context)
     {
        context.Response.Status = "301 Moved Permanently";
        string url = context.Request.Url.ToString().Replace("dotbits", "58bits");
        context.Response.AddHeader("Location", url);
      }

      public bool IsReusable
     {
        get { return false; }
     } 
   }
}

And then a reference to the handler with the correct path statement in the Web.config file.

<system.web>
   <
httpHandlers>
     <
add verb="*" path="blog/*.*" type="DotBits.Handlers.RedirectHandler"/>
   </
httpHandlers>
</system.web
>

Presto. Works for all registered ASP.Net resource types; .aspx, .asmx, .axd etc.



| Comments [0] | | #  
Monday, February 05, 2007
Monday, February 05, 2007 12:42:28 AM (SE Asia Standard Time, UTC+07:00) (Hardware | Other Tech)

I’m not a hard core gamer, or a hardware freak per se, but in my quest to build a small form factor (SFF) PC that will last a few years before having to upgrade I decided to push the envelope on SFF PCs. I have three boxes on the go at the moment including an older Shuttle SD31P. Space is an issue, and I’ve always liked the idea of being able to grab my main box – put it in a  carry-on luggage bag and fly off knowing that my ‘office’ is in the bag (for longer journeys of course).

In December I purchased a Shuttle SD37P2 Barebones SFF (Intel 975X Express chipset). This is a very cool box. The real hard-core iron guys will complain that the audio card is slightly below spec (Realtek ALC882 high definition audio codec for eight channels of 24-bit/192 KHz), and network controller from Broadcom uses a little more CPU resource than it should at full Gigabit bandwidth. I can’t say that I notice. The auido is great, and this is a workstation class PC not a datacentre server with a NIC at full throttle 24/7 and so I’m happy on both counts.

SD37P3

 

I then thought for a while about what to do in the video card department – knowing that DirectX 10 cards are on the way. The choice was to buy an economy card now knowing I would replace it in a month or two – or go for the only DirectX 10 card on the market at the moment. I waited until January before buying the video card – having decided to ‘go for it’ and buy an NVidia GeForce 8800 series card. The longer and more powerful GTX version won’t fit in the SD37P2 and even if it did the power requirements exceed the PSU spec. So the GTS was the one. Cool Card – dual slot PCI-E card with good thermal control. I purchased the Asus version (comes with a few extra connectors and some sampler games – including Ghost Recon Advanced War Fighter).

Asus GeForce 8800GTS

 

Then came Memory – courtesy of Corsair two sets of twinned 2GB XMS2 modules for a total of 4GB.

Xms2_module

 

And then the CPU. If I’d really wanted a ‘boastable’ box I would have bought the Core 2 Extreme X6800 CPU – but I just couldn’t justify the serious bucks required for this CPU. I’m not an over-clocker and for the 0.3 GHz trimmed off the clock speed – the Intel Core 2 Duo E6700 hit the sweet spot. Looking forward to trying out the Virtualization Technology and running my first VPC image soon.

E6700

There are 681 million transistors in this thing. Err.. that’s a lot. Incredible.

With all the bits coming together nicely the only thing missing was the OS. This was going to be a Vista box – but so close to retail launch, and with Vista RTM already in the hands of Microsoft’s corporate customers there seemed little point in installing the the RC1 image I’d previously tested. Somehow a Windows Vista Universal Key and DVD arrived as if by magic; with 26 days left to activate as I write, and yes – I’ll be buying my Windows Vista Ultimate license pronto… :-)

After a couple of test runs with Windows Vista Ultimate 64bit edition I decided that I just wasn’t going to be able to build a stable production machine on a 64bit OS. Not least of which Cisco show no sign of updating there VPN client for 64bit use and have only just released a 32bit beta version of the VPN Client for Vista.

A few hours on and I had a fully functional production box with all the usual tools and utils, VS 2005, SQL Server 2005 and everything else I need to work. The amazing thing is that it does exactly that – works! And does it ever – the machine is incredibly fast. Despite risking it with the VS 2005 SP1 Patch Beta for Vista, the SQL Server 2005 SP2 CTP patch for Vista, the Cisco Client Beta for Vista, Cute FTP Pro 8, FeeDemon, EditPad Pro etc. etc. etc.; it all works! Tortoise SVN misbehaved for the sum total of about 2 hours before the benevolent Stefan Küng posted a fix to the nightly build directory of Tortoise SVN (Stefan deserves a medal for his work on Tortoise SVN).

The number of major and minor improvements in Vista is incredible. Everything from a disk checking utility that actually works and provides a decent report, to the ‘not one’ but ‘three clocks’ and timezones that you can configure for the taskbar clock. The list is huge – and the best site for all the goodies in Vista that I’ve discovered so far is definitely Paul Thurrott's SuperSite for Windows.

So with everything up and running – and real work being performed on my new machine – the only thing left were the video drivers from NVidia followed by activation to get Aero Glass. NVidia must have been scrambling to get the 8800 series Vista drivers out because they showed up on their site on exactly the same day of the official retail launch of Vista. I’d expected something there from the November RTM. And these are still listed as Beta drivers.

About an hour ago I installed the NVidia drivers and a funny thing happened – I got Aero Glass as a bonus. :-). I still have 26 days to activate Vista – and from everything I’ve read you don’t get Aero Glass goodies until you fork over the bucks. Thank you NVidia – two in one!

Aero Glass is just so cool (lurking Gnome, KDE or OSX users – pah – I scoff in your general direction). Aero Glass is the slickest OS UI that I’ve ever seen – and fun too!  I’ve been flip 3Ding for an hour now – and I’m not bored yet (sad I know). I love the blurred transparent background effect on the window frames of apps that have the focus…

Here’s a shot of Windows Media Player 11 on top of BlogJet 2.0.

Aeroeffect01

Here’s the effect…

Aeroeffect02

So cool….

And for the Windows Experience Index braggers out there – I’m a 5.4 all in.

WEI

:-)



| Comments [0] | | #  
Monday, January 29, 2007
Monday, January 29, 2007 2:03:03 PM (SE Asia Standard Time, UTC+07:00) (SQL Server)

The following MS link - http://support.microsoft.com/kb/274188/ - will help you to troubleshoot and fix orphaned logins in a database, re-joining the database username to the SQL Server Login.

However if you've moved a database from one machine (A) to another (B) using the attach database method and B doesn't have the logins available to be fixed in the first place - then you need to create the required SQL Server logins first. MS have a great helper script that will extract the Login name, SID, default database and password as well as create a script that can be run on the new machine B to re-create all the required logs (and SIDs). You won't need to fixed any orphaned users since the user information in the newly attached DB and SQL Servers login information will now match.

http://support.microsoft.com/kb/246133/- How to transfer logins and passwords between instances of SQL Server.

A huge time saver and makes moving a DB using the attach method a breeze.



| Comments [0] | | #  
Sunday, January 28, 2007
Sunday, January 28, 2007 6:19:35 PM (SE Asia Standard Time, UTC+07:00) (Other Tech)

OK – so the post below gushed over True Image. That was until I spent a weekend kicking the tires on Vista RTM (more soon….)

Firstly, on Vista 64Bit – True Image was broken; corrupt images and failed restores. Not sure about 32Bit Vista yet – however having discovered the new Vista Image format and full backup and recovery options – I’ve switched (I also postponed the Vista 64Bit install until Cisco kindly update their VPN client). I’ve run several complete Vista image backups – nuked the drives and restored flawlessly each time. Before my Vista box goes into production I need to be super confident that I have good recovery options.

The new Backup and Restore Center in Windows Visa is excellent; boot from the Vista install CD, enter your language and time information, and then choose repair Vista on the next screen. If there’s nothing to repair (i.e. an empty drive) you will still be allowed to move onto the next screen where you can choose your repair options – including a full recovery. No need to install the OS first. The Vista image will recreate all drive partition information and restore the machine to the state it was in during your last backup. Can be used in the same way Ghost and True Image are to upgrade or replace a drive.

Lots of good things in Vista – and this is certainly one of them.



| Comments [0] | | #  
Monday, January 15, 2007
Monday, January 15, 2007 2:45:11 PM (SE Asia Standard Time, UTC+07:00) (Utilities)

I’ve been a loyal follower of Norton Ghost for many years. I’ve used it regularly in the past to copy, clone, and restore drive images. I’ve always used a dedicated drive image tool to create my own system restore points. The last DOS version of Ghost running from my boot CD with USB support to store the image was the zenith of Ghost usage for me I think. Feature bloat and a really terrible recovery CD in the latest version forced me to begin a search for an alternative.

Powerquest’s Drive Image Pro is long gone thanks to their acquisition however - happily I found exactly what I was looking for at Acronis True Image. Thank you Acronis. What an excellent piece of software. For starters the imaging tool is cool – well designed, easy to use and FAST. I can do a full image of my OS disk in about 15 minutes (a 14GB image file from 28GB of data). But the really amazing part is their recover CD. It takes only a couple of minutes to prepare, boots VERY fast, and runs True Image nicely – allowing me to browse for the backup image wherever it’s located, on another disk, or on my USB drive. The Ghost recovery CD takes nearly 10 minutes to boot – using a PE version of Windows (I think). The simplicity of True Image combined with their excellent recovery CD was the killer blow to Ghost, and I’m now an Acronis True Image convert.

For interest – I use True Image to create recovery images of my OS partition (my C: drive) and another very cool tool called SmartSync Pro to sync my data volume (my D: drive) with an external USB drive. I run backups (syncs) to the USB drive every day and also keep a fortnightly drive on rotation, locked in a safe at a friends office for off-site storage. The Robocopy console app is also a good way to kick-start the backup of a data volume and can also be used to mirror or sync data – but I liked the UI in SmartSync Pro enough to pay the asking 35.00 USD for the product.

Between the two – Acronis True Image 10 and SmartSync Pro, I’m pretty much covered on the system backup and data recovery front.



| Comments [0] | | #  
Sunday, December 10, 2006
Sunday, December 10, 2006 6:38:04 AM (SE Asia Standard Time, UTC+07:00) (General)

cruft /kruhft/ [back-formation from {crufty}] 1. n. An unpleasant substance. The dust that gathers under your bed is cruft; the TMRC Dictionary correctly noted that attacking it with a broom only produces more. 2. n. The results of shoddy construction. 3. vt. [from `hand cruft', pun on `hand craft'] To write assembler code for something normally (and better) done by a compiler (see {hand-hacking}). 4. n. Excess; superfluous junk; used esp. of redundant or superseded code. 5. [University of Wisconsin] n. Cruft is to hackers as gaggle is to geese; that is, at UW one properly says "a cruft of hackers". This term is one of the oldest in the jargon and no one is sure of its etymology, but it is suggestive that there is a Cruft Hall at Harvard University which is part of the old physics building; it's said to have been the physics department's radar lab during WWII. To this day (early 1993) the windows appear to be full of random techno-junk. MIT or Lincoln Labs people may well have coined the term as a knock on the competition.

http://www.techfak.uni-bielefeld.de/~joern/jargon/cruft.HTML


| Comments [0] | | #  
Saturday, December 09, 2006
Saturday, December 09, 2006 5:38:48 PM (SE Asia Standard Time, UTC+07:00) (Books)

CLR via C# – another great “roll your sleeves up” book. As the author says, there are a lot of “top down” books out there that will teach you how to use a tool, an application, or a framework, but fewer that will take you on a “bottom up” tour of the underlying technology.

What impressed me most about the book was the constant reference to efficiency and performance issues associated with the CLR and CTS, along with various pitfalls and performance traps that I would have continued to be oblivious of if I had not read this book.

To some extent I think type safety and the managed heap in the CLR may have given me a false sense of security where memory allocation and type design was concerned. There are still many performance pitfalls and many more performance gains to be made by having a deeper understanding of the CLR and CTS

I rank this as one of the best technical books I’ve read to-date. The coverage and depth is impressive. Jeffrey Richter knows his stuff.



| Comments [0] | | #  
Thursday, November 23, 2006
Thursday, November 23, 2006 8:32:07 AM (SE Asia Standard Time, UTC+07:00) (ASP.Net)
As site I’ve been working on recently required that all pages be XHTML Transitional compliant, with one exception. A special document page of the site needed to be in XHTML Strict format. 
 
The problem was how to get ASP.Net 2.0 to render all the pages in the site as Transitional, while rendering the special page as Strict.
 
Setting the xhtmlConformance option as bellow in the system.web section - will render all controls and pages as Transitional.

<system.web>
   <
xhtmlConformance mode="Transitional"/>
</system.web>

Since the main pages of the site are in the same root level directory - defining another web.config file for just the document.aspx wouldn't work.

Instead I used the location element (outside the <system.web> section). This will let you override any of the <system.web> settings for a specific location, directory or individual page.

<system.web>
   <xhtmlConformance mode="Transitional"/>
</system.web>

<location path="specialpage.aspx">
  <
system.web>
   <
xhtmlConformance mode="Strict"/>
 </
system.web>
</
location>

The hidden viewstate input element for the special page is now correctly wrapped in a <div> and the form name element no longer appears (just the ID).  The special page now passes for Strict while the rest of the site will pass for Transitional.

One last sneaky trick that took me a while to uncover - which could almost be consider a bug in ASP.Net - is that by default, with the default browser definition list - ASP.Net 2.0 doesn't recognise the W3C Validator's user agent - and no matter what you do - will not render Strict pages correctly and therefore all validation attempts for Strict will fail.

The trick is here....

http://idunno.org/displayBlog.aspx/2005080101

I created an App_Browsers folder in the project - and placed the browser definition for the W3C validator from the site above in this folder. The W3C Validator service was then receiving correctly rendered pages and passing the special page as strict.

:-)



| Comments [0] | | #  
Tuesday, February 14, 2006
Tuesday, February 14, 2006 11:32:59 PM (SE Asia Standard Time, UTC+07:00) (Other Tech)

As a favour to anyone else out there that may hit this one.

svn: Can't open file next-ids: The process cannot access the file because it is being used by another process.
If you see this message on your Subversion server - it's likely that your real time anti-virus software has got a hold of the next-ids file while it was being written, locking Subversion out.

Exclude the transactions directory in your repository from your AV software.



| Comments [0] | | #  
Saturday, June 18, 2005
Saturday, June 18, 2005 10:27:55 PM (SE Asia Standard Time, UTC+07:00) (Books)

Abraham Lincoln: “ If I had six hours to cut down a tree, I'd spend four hours sharpening the axe.”

...that and other lessons in 'The Art of Project Management' by Scott Berkun. I've not had my yellow highlighter out as often in a long time. A fantastic read and an even better bibliography.



| Comments [0] | | #