Thursday, March 13, 2014

Changing the Color of Table and Column Names in SQL Server Management Studio 2012

If you've upgraded to SQL Server 2012 and used the new Management Studio, you've probably noticed that your table and column names are now a teal color that looks exactly like the color of your comments. Previous versions of Management Studio would use the color specified for "Plain Text", but the new version uses a new setting.

To change the color, open the Tools menu and choose Options.... In the Environment settings click Fonts and Colors. Locate and click "Identifier" in the Display Items list box then change the Item foreground to something other than Default. That should do the trick.

Monday, February 24, 2014

How to Restore Files from a Restore Point

In my last post, I mentioned how I had used Windows System Restore, only to find out that JavaScript (*.js) files are considered to be "system files" and are restored back to the state they existed when the restore point was created. I tried restoring back to the previous state, but no-go. System Restore failed with every other restore point.

I thought all was lost, until I found this article by the How-to Geek that has a batch file letting you mount the latest VSS (Volume Shadow Copy) volume and view the files contained there-in (when you create a Restore Point, Windows creates a VSS volume containing your files at that point in time). I didn't want the most recent volume, but I looked at the batch file and figured out how to list the available volumes and mount the one I wanted. I figured I'd document the steps in case this helps anyone else.

  1. First off, you need to open a command prompt as an administrator (Right-click the "Command Prompt" and choose "Run as Administrator").
  2. At the prompt, type
    VSSAdmin List Shadows
    This will list the available VSS volumes on your system. This can be confusing, but each one displays a creation time. What you're looking for is the the "Shadow Copy Volume" (e.g. \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1).
  3. Once you find out the name of the shadow copy volumne, you can mount the volume using MKLINK just as you would any other folder (if you haven't used MKLINK, I'd recommend you check it out - it's a pretty useful tool). For example:
    MKLINK /D C:\ShadowBackup \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1
    In this example, you'll see a new folder named ShadowBackup on your C: drive, containing the contents of the VSS volume.

Now you can view the contents of the VSS volume and view/copy any of the files within. This can also be useful if you accidentally delete a file or want to see what changes you've made.

To "unmount" the volume, you can simply delete the folder in Windows Explorer. This won't delete the volume, just the link to view the files.

Warning: System Restore will Modify/Delete JavaScript Files!

I discovered too late that Windows System Restore considers JavaScript (*.js) files to be system files. Apparently, the way System Restore works is it uses the Volume Shadow Copy service to back up your files, then during the restore process, it restores "system" files to their state at the time the restore point was created.

As a developer, this is bad for me, since I regularly create and edit JS files. After restoring my system, I opened up my code and found, to my surprise that all my JS changes had been reverted. If this happens to you, in my next post, I'll detail how I managed to restore the files.

Tuesday, January 14, 2014

Munchkin Rules Removed by Request.

The page of Munchkin rules has been removed by request. No hard feelings on this end.

Monday, January 6, 2014

Performance of a shortcut to document.getElementById

I don't like typing document.getElementById (or document.createElement, etc.) repeatedly so for a while now, I've used my own function, I call byId (I know jQuery has $get, but I don't use jQuery, for reasons I won't go into here). This function started out as a simple:

function byId(id)
{
 return document.getElementById(id);
}

In Internet Explorer, I could use var byId = document.getElementById, but this didn't work in other browsers. I then tried, what I though was a more elegant solution of binding byId to the document object (var byId = document.getElementById.bind(document)). This works, but it winds up being slower then then simple method in all browsers, but IE. I decided to publish my results on jsperf for anyone interested.

What's really maddening is that the best method is different in each browser. I'm sure any web developers have experienced this themselves.

Sneaky Christmas Music

More and more, it seems that every year the holidays sneak up on me and suddenly it's Christmas. I was thinking about it last night, and I think I figured out why.

For starters, I'm older and time seems to go faster as you get older because a defined period of time is a smaller and smaller percentage of your memories. But it's more than that. I think it's the music.

Back when I was younger, the radio was constantly playing Christmas music. We had to go outside to shop and all the stores were replaying Christmas songs (driving their employees crazy).

This year, I listened to very little Christmas music. Due to the digital age, I had Pandora, podcasts, and my iTunes music library. I rarely ever turn on the radio anymore. I think next year I might try and mix in a little holiday cheer to my auditory experience and see how that affects me.

Friday, January 3, 2014

Munchkin Rules in HTML Format

I love playing Munchkin so much, I decided to translate the rules of Munchkin into HTML format to make them more searchable/linkable/viewable on other devices and post them here as a good way to access them anywhere. Note that I am in no way affiliated with Steve Jackson Games and if they ask me to take these down, I will without hesitation (though I'd ask them to make them available on their own site).

*** Edit: Removed by request ***