Formatting byte values in Excel 2007

May 20th, 2009

I was given a project, recently, that involved creating a spreadsheet to list storage capacities and free space. One thing I wasn’t sure of, was how to format the values.

A bit of searching on the internet for formatting KB MB, etc. came up with a post by Ajay on http://www.eggheadcafe.com which suggested pasting the following code into the current worksheet’s private module:

Private Sub Worksh5eet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("C:C")) Is Nothing Then
        If Target.Value < 1000 Then
            Target.NumberFormat = "0 \B"
        ElseIf Target.Value < 999500 Then
            Target.NumberFormat = "0.000, \K\B"
        ElseIf Target.Value < 999500000 Then
            Target.NumberFormat = "0.000,, \M\B"
        ElseIf Target.Value < 999500000000# Then
            Target.NumberFormat = "0.000,,, \G\B"
        Else
            Target.NumberFormat = "0.000,,,, \T\B"
        End If
    End If
End Sub

I had some trouble with the macro and eventually abandoned it, but it did give me some ideas. The actual formats were good and I ended up using them later. The criteria for setting the formatting was spot on as well. After thinking about it for a while, I decided to look into Excel’s conditional formatting feature. There are premade rules for changing the cell color, etc., but it turns out that it’s capable of quite a bit more.

Read more…

Brian Shacklett Technology , , , ,

Remote server administration with Windows Vista

April 26th, 2009

If you’re a systems administrator and run Vista, you might have run into some trouble with the server 2003 administration tools package (adminpack). Well, there’s good news for you. Remote administration is now built into the Vista operating system.

  1. Firstly, you should be running service pack 1. I believe the tools are available for the original release of Vista, but I haven’t delved into it.
  2. You’ll need to download the updated RSAT pack from Microsoft:

  3. Go to the control panel and open “Programs and Features”.
  4. Click on “Turn Windows features on or off.
  5. Find and enable “Remote Server Administration Tools”.

Once you hit OK, your system will spend about 5-10 minutes configuring itself for remote administration and the “Administrative Tools” menu should be populated.

Brian Shacklett Technology , , , , ,

Don’t forget StdErr

March 28th, 2009

I recently ran into an issue where a WSH script was calling an external executable and returning an exit code of 0 even though there had been an error running the external executable. The problem is that I was relying on oExec.StdOut.ReadAll() to block the script until the command had finished processing. The ReadAll() method functions synchronously, so if the executable had been writing to StdOut, I would have been right. Unfortunately, I was neglecting the StdErr stream. So, not only did I miss the errors that the executable threw, the script didn’t block on the executable’s output, so I returned the exit code before the executable had actually finished running. The lesson here is to always think about StdErr no matter what you’re trying to accomplish.

Brian Shacklett Technology , ,

The Boxee/Hulu honeymoon is over

February 21st, 2009

What if I told you there was a free (and legal) program that would let you watch most of your favorite shows on your TV without paying for cable? Well, there was. The program is called Boxee. The main source of most of Boxee’s goodness was Hulu and the makers of Boxee were forced by Hulu’s content providers to remove Hulu’s content stream from their software. It’s a very disheartening event that’s sure to affect new media for the immediate future.

The way I see it, there are a two ways this whole thing can go. The other content providers could either see this as a sign to keep fighting current technology and force us to hang out in the dark ages of media for a while. Or, if they have anyone with a brain working for them, they could see that this whole thing is a big mistake and they’re missing a great chance to ditch the cost of working with cable companies and distribute their content via the Internet.

Read more…

Brian Shacklett New Media ,

GnuWin32: A more helpful CLI for Windows

February 17th, 2009

I cut my system administration teeth on UNIX-based systems (OS X Server and Linux) and I quickly got used to being able to do a multitude of things very easily and efficiently from the command line. Windows, the main platform I support now, is missing a lot of these features. Every once in a while, after working on a Linux system, I’ll drop into a Windows command line and type something like tail -f foo.log just to get smacked with an error because the system has no idea what I’m asking of it.

Fortunately, the good people working on the GnuWin32 project have decided that Windows admins deserve a robust command line as well. GnuWin32 is a set of Windows-native executables that duplicate a large amount of the functionality found on a UNIX or Linux system. A lot of these little programs can make a Windows administrator’s life much easier. grep, tail, diff… all available without installing Cygwin.

The packages are distributed in a number of ways. Binaries are packaged in small collections. There’s are packages for the core utilities, diff utilities and separate packages for some of the other utilities like grep. There’s also a setup utility that functions as a package manager to help you keep all of the utilities up to date. Overall, this is a great project that’s definitely worth a look for anyone that hangs out in the CLI much.

Brian Shacklett Technology , , , ,

Implementing IPv6 At Home – Part 1

February 12th, 2009

There have been a lot of articles floating around the net, lately, that mention how quickly we’re running out of IPv4 addresses. Seeing all of this got my interests in IPv6 rekindled. I’d been meaning to get it up and running on my network since I got my Cisco router, but it wasn’t until lately that I was really able to find enough information on the subject to know where to begin. I don’t have anywhere near enough knowledge to write up a tutorial, but I find it helpful and interesting to hear about other peoples’ experience with new technology. I hope it’s helpful for you to see how things went for me.

Read more…

Brian Shacklett Technology , , , ,

SpamAssassin: Dealing with unrecognized spam

May 3rd, 2008

Everyone hates spam, and one of the main ways that people are fighting it is through the use of SpamAssassin. I’ve been using it for a while now and have Sieve detecting spam headers and moving them to my Junk folder.

The Problem

Dealing with spam that went unrecognized has been more of a manual process. Every once in a while, I’d have to segregate all of my useful mail from the spam and run “sa-learn” on the leftovers. This isn’t horrible, because I tend to shell into my server fairly frequently, but I really prefer to have menial tasks like this automated.

A solution

First of all, I created a folder in my mailbox called “Unrecognized Spam”. The name isn’t important, really. It just needs to be a place to file away all of those messages that SpamAssassin didn’t catch on the way in.
Once that was done, I wrote a very simple little script, which I dropped in /etc/cron.daily/:

Read more…

Brian Shacklett Technology , , , ,

Server Upgrade

April 27th, 2008

So, now that Hardy Heron is out, I’ve gone ahead and upgraded my server. It took a little while, but overall it went quite smoothly. Having the ability to go back and forth between the old server image and the new server image made it a much easier experience. Big thanks to Linode and virtualization.

Changes

One large change I made to my configuration is using Dovecot’s sasl authentication for Postfix rather than Cyrus. Dovecot really seems to be making headway in the mail server market. I strongly reccomend it to anyone looking for a decent IMAP server.

I’ve also upgraded to Wordpress 2.5 and a later version of Roundcube for webmail. Unfortunately, Ubuntu seems to be holding Roundcube back a bit in their package repository. I’m not sure what the holdup is, but they’re at least one version behind at the time I’m writing this. For that matter, Wordpress is a couple of releases behind as well. I guess that happens with an LTS release.

Todo

I’m still having a bit of trouble getting Wordpress’ permalinks working correctly, so you’ll probably notice that some of the links aren’t working properly on the blog. I remember having this problem in the past, but, for the life of me, I can’t remember what I did to solve it.

Update: Got the permalink issue taken care of. Apache must be told, with the “AllowOverride” parameter, to allow .htaccess files. If this isn’t done, they will be ignored.

Brian Shacklett Technology , , ,

Buddy Club Racing Spec Seat: Initial Review

December 16th, 2007

I just installed a Buddy Club racing spec seat for my s13. The first thing I can say is that I never would have believed how much difference a racing seat can make had I not gotten a chance to sit in one myself. The first corner I took, I braced myself as usual so as not to fly out the drivers side door, and an amazing thing happened. I didn’t move at all. The second corner I hit, I realized what the difference was. The third corner all I could do was grin.

Read more…

Brian Shacklett Uncategorized

Wii want wireless GC play

June 8th, 2007

A couple of weeks ago I was able to secure a Wii from a GameStop about 4 miles away. I’ve got to say it’s the best purchase I’ve made since my Macbook Pro. Everyone in the house has been having a ton of fun with it. The cat’s even gotten in on the action by chewing up the wire to the sensor bar which was replaced by a wireless model from Nyko.One great thing about the Wii is that you’re not just limited to titles that are made specifically for the platform. Aside from the Virtual Console functionality, the Wii can handle GameCube games as well. Unfortunately, this means buying a GC controller, which is really my biggest gripe about the system.

My TV is about 10 feet back from the couch. This is not a good situation for wired controllers, and Wavebirds are overly expensive and hard to find. That basically leaves me with the option of a third party controller, which is something I always try to avoid. Rare is a third party controller that feels anything but hollow and cheap. I will admit that I haven’t gotten a chance to try many of the controllers available for the GameCube, but even in the best case scenario, I’m left with a big receiver sticking out of the side of my console for each controller I add.

Why? The Wii’s controller has an expansion port which the classic controller plugs into for an elegant wireless solution. This is perfectly suited to wireless play of GC games as well. I guess in the end, though, Nintendo just doesn’t want to deal with supporting that many peripherals.

Brian Shacklett Gaming