Mad Props!

Omniscience is just a Google-search away.

Login

You're reading Mabsterama, the weblog of Matt Hamilton. Enjoy your stay.

New PC Details

So here are the final specs of my new PC. They don’t match the original specs because some parts turned out to have a long wait on them, and I was happy to replace them with in-stock parts of a similar ilk.

CPU: Intel Core i7 920
Motherboard Gigabyte GA-X58A-UD7
RAM: Corsair 6GB Kit (3x2GB)
Video: PowerColor Radeon HD5770
HDD1: Western Digital 150GB, VelociRaptor
HDD2: Western Digital 1TB, Caviar Green
DVD: Pioneer DVR-218LBK
Case: Antec P183 Performance One
PSU: Cooler Master RS650-PCARE3
TV Tuner: Compro VideoMate Vista E700

… and the whole thing’s running Microsoft Windows 7 Home Premium x64.

Here’s a screenshot of my Windows Experience Index. I’m not sure why my “Aero” graphics performance index is so low when the gaming graphics index is so high, but I do know that the hard drive index would be much higher if I was running a solid state disk, which is an upgrade I intend on doing this year some time:

image

And finally, just for kicks, here’s a screen clipping of my task manager. I love seeing eight CPU graphs! :)

image

The Case of the Corrupt New Tab Page

Hello from my new PC! I wanted to write a blog post documenting the discovering and successful fix of a very strange problem I had right from the get-go with this installation of Windows Home Premium x64.

When I first plugged in my new PC and booted it up, it started in the “finalize Windows setup” stage; allowing me to create a first, administrative user and customize locale etc. I proceeded through the final steps of Windows Setup and eventually logged in for the first time.

Naturally one of the first things I did was open IE to check that my Internet connection was working ok. It was, and I did a bit of casual browsing. Inevitably I clicked the “New Tab” button to open a new tab, and was greeted with this monstrosity (click to embiggen):

Corrupt "New Tab" Page

WTF??? The “New Tab” page in IE8 was totally corrupt. Not only was it not showing me my recently closed tabs, it was populated with garbage characters at the bottom of the page!

After a few fruitless searches for help, I posted on Super User (as well as a few other places, like the IE8 newsgroup). You can read all my updates on the Super User post, but eventually it came down to running a little command-line utility called sfc.

I dropped into an administrative cmd prompt and ran “sfc /scannow”. SFC reported that it had found errors, and pointed me at a log file. Inside the log file I discovered that a file called “ieframe.dll.mui” had failed its hash check, meaning it was corrupt in some way.

It turns out that “ieframe.dll.mui”, which lives in “C:\Windows\SysWOW64\en-us”, contains the English localization of the “new tab” page in IE8. No big surprise there!

After a few more searches I learned that you can run sfc from the Windows install DVD, and I had an unopened copy of the DVD that had come with my PC. I cracked it open, booted from it, and dropped to a command prompt to run the tool. Unfortunately it simply doesn’t work. No matter how many times I rebooted, it kept telling me that there was a “system repair pending” and that it couldn’t run.

Eventually I decided to take matters into my own hands. Using Windows Live Sync, I download ieframe.dll.mui from work PC (which also runs Windows 7 x64, and has a perfectly functional “new tab” page). I then dropped to my admin cmd prompt, and typed the following:

cd \Windows\SysWOW64\en-us
takeown /f ieframe.dll.mui
icacls ieframe.dll.mui /grant Administrators:F
ren ieframe.dll.mui ieframe.dll.mui.old
copy %USERPROFILE%\Downloads\ieframe.dll.mui .

So I have taken ownership of the file and granted all Administrators full access to it, then renamed it and copied down my correct version.

I’m pleased to announce that my PC now works perfectly. I’ll post some more details about it (including a screenshot of its impressive Windows Experience Index) later!

Xmas Haul 2009

That time again! Time for Mabster’s Christmas Haul! A day late this year because yesterday was a bit hectic, with several different family events to host and travel to.

I’m fairly certain that the haul is getting a little smaller each year as I become more difficult to buy for. That doesn’t diminish the spirit in any way! This year was as good a Christmas as any! To the haul!

From Sal

The Prestige blu-ray

Battlestar Galactica season 4 part 1 DVD

Battlestar Galactica season 4 part 2 DVD

Dave Matthews Band - Big Whiskey and the GrooGrux King CD

Fallout 3 GoTY Edition for Xbox 360

Diesel “Only the Brave” gift set

... and some clothes, including some tee-shirts and work shirts, and a night shirt so I can pretend to be Wee Willie Winkie (all I need now is the matching hat)!

From the Family

We got a whole bunch of movie tickets from various family members, which we will put to good use over the coming year. From Sal’s mum and dad we received a couple of nice fake plants and some pots to display them in, as well as a work shirt for me.

Mum and dad this year gave us a voucher for the Colonial Tramcar Restaurant in Melbourne. The food looks good, so we’ll have to book in a night for that ASAP.

I also scored quite a bit of food, including my favourite Christmas fare, shortbread.

The Aftermath

Now begins the Boxing Day shopping! Sal gets to spend the gift vouchers I included with her haul, and I get to see if there’s anything waiting out there for me that I didn’t get! :)

Hope you had a great Christmas in 2009! Leave me a comment with your own haul (or better yet, a link to your own Xmas Haul blog post)!

A New PC for 2010

Today I finally ordered a PC to replace my nearly-five-year-old desktop/media centre machine at home. I’ve ordered this one from Scorpion Technology, a Melbourne-based group with two physical stores and an impressive online system.

Here’s the spec:

  • Intel Core i7 920 CPU
  • Gigabyte GA-X58A-UD7 motherboard
  • Corsair 6GB Kit (3x2GB) RAM
  • Gigabyte Radeon HD5770 video card
  • Western Digital 150GB, VelociRaptor HDD for C drive
  • Western Digital 1TB, Caviar Green for D drive
  • Pioneer 218LBK DVD writer
  • Antec P183 Performance One case
  • Corsair 650W TX-650 ATX Power Supply
  • Compro E700 Dual DVB-T TV PCI Express TV tuner
  • Windows 7 Home Premium 64bit

All told it comes to just under $2500, which is my usual budget for a PC since they typically last me a long time. I’m really looking forward to playing with this PC! Should be a great media centre and a great Comicster development box!

foreach Over Multidimensional Arrays

Think fast! What will this code print?

int[,] nums = { { 1, 2 }, { 3, 4 }, { 5, 6 } };

foreach (var num in nums)
{
    Console.WriteLine(num);
}

If you’re like me, you probably thought you’d see this output:

System.Int32[]
System.Int32[]
System.Int32[]

That is, you figure that the “foreach” will iterate over the array of arrays, and try to print out each array.

I can tell you now that that’s not the case. If you compile the code and run it, you’ll find it prints this:

1
2
3
4
5
6

WTF? Iterating over an array of arrays actually flattened the array for me? Why yes, yes it did! Have a look at this article from the MSDN C# Programming Guide called Using foreach with Arrays. When you iterate over a multidimensional array, you get each element of the array rather than each “row”.

I figured I’d try something else after discovering this, and wrote this piece of code:

int[,] nums = { { 1, 2 }, { 3, 4 }, { 5, 6 } };

for (int i = 0; i < nums.Length; i++)
{
    for (int j = 0; j < nums[i].Length; j++)
    {
        Console.WriteLine(nums[i, j]);
    }
}

Surely that’s reasonable? A nested “for” loop over my multidimensional array? Guess what? It doesn’t even compile! You get this error on the “nums[i]” line:

Wrong number of indices inside []; expected '2'

So it turns out that multidimensional arrays in C# are not the same as arrays of arrays (also called jagged arrays because each element of the array might be an array of any size). The compiler treats these two objects very differently:

int[,] array1;
int[][] arrays2;

I’d love to hear from a C# guru on this one. I guess I just don’t use arrays enough to have known this, preferring instead to use generic collections and the like.

Master of My Domain

I just managed to pick up the matthamilton.org domain!

For now, I have simply pointed it to this site. I’m thinking that some time down the track I might end up re-branding Mad Props to my own name, but there’s so many incoming links out there that madprops.org will never truly disappear.

Still, it’s great to have a true “vanity” domain name! I’ve set up matt –at- matthamilton.org too, so if you ever need to email me it shouldn’t be too hard to remember the address.

Text Rendering in WPF 4

For your viewing pleasure! You might have to copy the images and overlay them to see the difference, but I’ve taken the liberty of zooming in on a similar section in each image so you get a better look.

This is a straight recompile of Comicster – I didn’t have to change any XAML markup at all. I think you’ll agree that the “after” screenshot has more readable text. It’s darker, somehow, particularly in the semi-transparent “subtitle” text under each issue name.

Before (.NET 3.5 SP1)

.NET 3.5 SP1

After (.NET 4.0 beta 2)

.NET 4.0 beta 2

Removing Replication Info from an Attached Database

I often need to grab a copy of a production database so I can work with it on my local SQL Server instance (for testing purposes etc). Traditionally I’ve been doing this by taking the most recent full backup and restoring that. That’s time-consuming, though, and doesn’t necessarily mean you’ll have the latest data unless you also restore the logs.

So late last week I tried a different approach. Our database is merge-replicated across a bunch of servers, one of which is a reporting server that isn’t used very often. I visited that server and took the database offline while I copied the .mdf file down to my local machine. Once that was done, I brought the database back online and attached the copied .mdf file to my local server. It was a much quicker way to copy the database and I was online almost straight away.

So for this particular job I needed to add a column to a table. I went ahead and ran my ALTER TABLE statement against the newly-attached database, and was met with this error:

Msg 21531, Level 16, State 1, Procedure sp_MSmerge_altertable, Line 361
The data definition language (DDL) command cannot be executed at the Subscriber. DDL commands can only be executed at the Publisher. In a republishing hierarchy, DDL commands can only be executed at the root Publisher, not at any of the republishing Subscribers.

Well, damn. The copy of the database has brought with it the replication information, which is telling my local server that this database is “subscribed” to a merge replication and can’t have its structure changed. The interesting thing is that this query:

select * from master.sys.databases

… brought back a 0 for all the replication-related columns (“is_published”, “is_subscribed”, “is_merge_published”, “is_distributor” etc).

In the end, I found a stored procedure that I’d never heard of before: sp_removedbreplication. I executed it like this:

sp_removedbreplication @dbname = 'pigfmcor'

And voilà! My database now allows DDL statements to be issued against it! Good to know, and handy enough that I thought it was worth blogging about.

A Week of SQL and Corny Jokes

My brain is full.

This week at work we’ve been hosting a visit from Rob Farley, SQL Server MVP and proprietor of LobsterPot Solutions. He’s been taking us through three solid days of SQL Server Analysis Services training.

While I feel as if I’ve known Rob for years (we first started corresponding via blog comments about three years ago, and have had Twitter conversations) this is the first chance I’ve had to meet him face to face. I was a little dismayed to learn that he’s actually more or less the same age as me (I typically assume that “experts” are older than me), but at least he isn’t some sort of child prodigy barely out of puberty.

As well as three days of training, Rob volunteered to present at AWDNUG this month, and ran us through a fast-paced version of his Tech.Ed Australia talk “Improving Your SQL Arsenal”. This is a collection of tips and techniques to improve your SQL queries, and was well-received by the entire group.

Right now I’m sitting in the auditorium at the SQL Down Under Code Camp, watching a presentation called “The Dangers of BEGIN and END” by … you guessed it … Rob Farley.

The week has given us plenty to think about for our SQL-based solutions at work, and I can’t wait to try to put some of the techniques into practice. I imagine, too, that my colleagues at work are looking forward to returning to an environment in which the worst jokes are made by yours truly. Let’s face it, Rob: comedy is not your forté! ;-)

UI Evolution?

Eighteen glorious years of user-interface evolution!

Windows 3.x Program Manager vs iPhone