Software

7-Zip – Archiving for the masses

There was a day when the only way to create ZIP archives was to purchase a copy of WinZip. The software was definitely ahead of its time… on Windows. *nix users had been playing with compressing and archiving files for quite some time prior to that.

Then, Microsoft decided to begin including the ability to create and manage simple archives directly into the Windows Explorer. This decision really brought archiving to the masses. However, many of us still have a need to do more… more quickly… with our archiving utility.

Today I was attempting to unzip 1,000 or so very small files (a set of PNG icons) into a directory on my machine. When I began the process using the built in Windows tool it told me it would take 19 minutes. Using what I can only assume is Microsoft’s patented time tracking algorithm the timer then proceeded to continue calculating backwards until I stopped it at 36 minutes with only 300 of the files copied over. This was after a 5 minute period of waiting on it to finish, figuring that things would eventually just speed along.

After a moment of frustration I went and got 7-Zip, an open source archiving tool that I had used in the past a limited amount. I figured this would be a perfect opportunity to test the speed and abilities of 7-Zip against the convenience of the Windows tool.

Well… the 7-Zip archiver took less than 5 seconds to complete the same job.

I really shouldn’t have to say any more than that to sell you on how good this tool really is.

Spoofing your browser’s user agent

If you are a web developer (or anyone doing any programming which involves web browsers, which is just about everyone nowadays) you really are doing yourself a disservice if you don’t include Firefox in your toolbox for diagnosing issues and testing sites. The community provided Addons for Firefox are just invaluable in day to day tasks. A great example is the ability to spoof your browser’s user agent, pretending to be any browser you want, all from one browser.

My quest to do this started as a curiosity when I found a blog post titled “Search Engine Marketeers are the new script kiddies” discussing a WordPress blog which was hacked in such a way that it invisibly provided more traffic to the hacker’s site whenever a search engine bot crawled the site. The hack was pretty impressive, actually but more impressive was the ability for the blogger to diagnose what had happened and track down the culprit.

Having a few WordPress blogs of my own, I decided to look into checking mine for the same issues. It took me an hour or so of toying and poking around to get everything I needed, so I figured I would take a shot at documenting the steps that went into my adventure in the hopes that someone else would be able to get this done more quickly if they ever needed it. Plus… it will provide a reference for me when I inevitably do this on more computers in the future.

First, you’re going to need to get the User Agent Switcher Addon for Firefox (written by Chris Pederick). Installation should be fairly straight forward, so just click the button while in Firefox and let it do its thing.

Now for the part which took some searching…

The default installation of the Addon doesn’t provide a lot in the way of user agents to switch to. A couple of examples are all that are there, so in order to be really useful you’ll need to add agents of your own or find them somewhere. I found a very complete set of agents conveniently compiled into an XML file which can be imported into the Addon (Options > Options > User Agents > Import) over on Tech Patterns.

Once you have installed the Addon and loaded a complete set of user agents, you can test them out with the QuirksMode Browser Detect page.

There are a lot of uses for this ability, from security to verifying code which reacts to a specific browser. Whatever you use it for, hopefully this short guide made it easier to get your results.

SQL Management Studio… How NOT to save in Unicode format

A project I work on requires that we developers edit stored procedures and store the resulting script in a text file that we put in our source control tool. In our case, we use Microsoft SQL Server Management Studio to do the aforementioned editing and we use CA’s Harvest Change Manager as the corporate mandated code repository and source control tool.

Now if you were using another tool, Notepad or Query Analalyzer, for instance, you probably wouldn’t have the problem I’m going to outline. As a matter of fact, the problem I’m going to outline is probably pretty rare. But it exists and I found a solution, so I’m going to write about it.

As it turns out, whenever you “Save As” in Microsoft SQL Server Management Studio the default encoding for the file is Unicode – Codepage 1200. Yes, this is a new approach to saving your beloved stored procedures and no, it wasn’t done that way in the past. Further, I can’t find any notification that the “standard default” was going to be changing.

Anyway, Harvest doesn’t like Unicode files. So when you go to add the file to your Harvest project it won’t let you. Oh, the humanity! ANSI for everyone!

Now I may be in the minority here, but I originally failed to notice that on the “Save File As” dialog there is a small arrow on the right side of the [Save] button. Once I noticed it, I clicked it… Then I clicked “Save with encoding…” Now I’m happy again! Kind of…

The good thing is that this will let you save your file in whatever encoding you want. The caveat is that it will let you save your file in whatever encoding you want.

So how is the default set? I’ll leave that for another article… Mostly because I don’t know yet.

Update (04.11.2008): Thanks to Chris May for the following step by step instructions on how to overcome this issue (edited for formatting, the original version is comment #8):

I have found some information about this.

Though it is possible at the time a script is saved to change the encoding to ascii it is tedious. Here is the process.

  1. Choose File\Save
  2. Choose the name and folder to save the file then look really closely at the right edge of the “Save” button for a tiny arrow
  3. Click that tiny Arrow and choose “Save with Encoding”
  4. From the Drop list select the encoding you want (the default encoding is “Unicode – Codepage 1200″, which means “UTF-16″). I have been using “US-ASCII – Codepage 20127″
  5. Hit OK and Save. Your files should now work just fine with Perforce, CVS, etc.

Additionally, Chris has voiced his feedback to the SQL team, I encourage everyone to go have a look and hopefully we can get a solution sooner rather than later… although the outlook is bleak.

What did Firefox teach IE?

I love open source products. I love the way they branch out and provide competition for each other from the same base code. I love the way the software is generally released often and I love the way that user feedback is the driving force behind the majority of changes.

Now I have another reason to love open source software. It forces proprietary software to evolve… even against the will of the author of that software.

I have long contended that in the future when we speak of Firefox in a historical sense the only benefit we will remember will be that it made IE better. I just didn’t expect it this soon.

About 10 minutes after my first test drive with IE7 I spent some time staring blankly at the Firefox icon on my desktop. I hated to admit it, but Microsoft had out Firefox’d Firefox.

Read on for why I think that…

More >