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 ***

Wednesday, September 26, 2012

The Deception of Capital Gains

I could rant on this topic for hours, but for now, I'll focus on one point. Capital Gains tax rates are lower, typically far lower, than the average tax rate. This has been rationalized as being acceptable by saying that since you're investing in the growth of businesses, you should be rewarded or by saying that it encourages investment which in turn fuels business growth.

Don't believe it

What it actually does is reduce the tax rates for wealthy people. Now before you immediately stop reading and think I'm just spreading propaganda or anti-republican party BS, think about it. The only people that could really benefit from the lower rates are people that have extra disposable income. If you're living paycheck to paycheck and worrying about putting food on the table, you don't have extra money to invest in another business. In order to invest, you have to have at least some disposable income. Many or most middle class families make enough to invest some of their money, but most are investing in retirement plans and saving for the future. Retirement plans have their own tax incentives, but don't benefit from capital gains rates because they're separate. The beneficiaries of capital gains rates are those that have enough money to "make their money work for them" and use money to make money.

Don't you wish you could do that? Sounds like a great deal.

So basically, capital gains rates only apply to money that is made using money that you already have, and theoretically could afford to lose. Considering this type of income can only be made if your wealth increases and you only get taxed on the gain, not what you put in, do we really need to incentivize this behavior?