Speak and Shout

Monday, January 16, 2006

Folding@Home stats

Amazingly, I found that I cracked the top 20% of Folding@Home users recently. I haven't been doing much more than keeping the client program going regularly at home, along with some occasional use at work. Kinda cool. I imagine, though, that getting in the top 10% is going to require a lot more effort. I just have to convince Doris that I really need a cluster of 1,000 Athlon FX-60 CPUs in my office, haha.

Saturday, January 14, 2006

Thoughts on backups and RAID

I tend to rely heavily on my RAID 1 mirror for keeping backups of my files (supplemented by occasional DVD burns). I've also recommended RAID 1 highly to other people, especially for the type of folks that I knew wouldn't backup their files regularly. However, I recently made an editing mistake that almost cost me some data, even with my RAID 1 backup. Matt Jadud's recent post on backing things up got me to thinking about the strengths and weaknesses of my different backup strategies.

Here are my current thoughts:

RAID
  • Mirroring prevents downtime due to hard drive errors or crashes
    • if one drive crashes, the backup drive can be used until a repair is made
    • new spare drives can be synched easily with the backup drive to get back up and running in minutes (you should always test this feature when setting up your mirror the first time!)
  • Mirroring is automatic and seamless.
  • With a hardware RAID controller, keeping your drives mirrored causes no discernable performance hit. (At least, not that I've ever noticed.)
  • Unfortunately, with hardware RAID, you also may be tied to a particular controller card's data format. (Or even worse, you may be tied to a particular motherboard in case of onboard RAID.)
    • If you have a controller card or motherboard failure, and your RAID controller is no longer widely available, you may be hard-pressed to retrieve your data.
  • RAID 1 does not allow you to revert to a previous backup state.
    • Once you've made a change to the data on your hard drive, the second drive has the exact same copy of the change.
    • This means if you change or blow away a file by accident, RAID 1 by itself won't help you. Archiving your data in some other fashion becomes essential if you need a previous version.
  • Mirroring is obviously somewhat more expensive since hard drives cost more than DVDs or tape. But this is becoming less of a concern as HD prices continue to fall.
  • Mirrored drives cannot be stored in another location ... a big disadvantage in the case of fire, flood, lightning strikes, etc.
Media backups (CD, DVD, tape)
  • Backing up to media helps you (to an extent) when your hard drive fails.
    • However, you may not be able to get back up and running very quickly ... installation of OS, applications, drivers and other software is separate from restoring your backup. In my experience, you'd better count on at least two days downtime if you're rebuilding your configuration from scratch.
  • Media backups are a manual process.
    • You may be able to automate it to an extent, but you still have to switch out tapes, or DVDs at some point.
  • Backups may cause a significant performance hit.
    • With data compression turned on, your backups may bog down quite a bit, making it tough to keep using other applications.
  • You may be tied to a particular type of media format.
    • Tapes are the worst for this. Many DAT drives read and write to tapes in a specialized format. Good luck trying to find that brand again if it's been more than a few years since you bought the drive.
    • CDs and DVDs are much better for this, although you still have to watch that the backup software you use doesn't change its data format either.
  • Media backups allow you to restore to a previous backup state.
    • This is, without a doubt, the single biggest advantage of backing up to media. If you accidently delete or change a file, retrieve the archive, and you're up and running with (hopefully) very little data loss -- depending on how good you are at regular backups.
  • Media backups are very inexpensive.
  • Media can be stored at a separate location to provide even more security.
I think I managed to convince myself that the approaches are complementary, and, in my experience, I now try to use both mirroring and regular backups to provide a good sense of security. Occasionally, I take my backup DVDs to work and store them there in case something ever happened at home. Sometimes that practice has paid off too (a few times where I needed a very old version of a file on a DVD that wasn't on the regular backup rotation).

A final comment: I also discovered a hole that neither mirroring or backups will catch unless you're aware of it. That area is storing files on the Web. I use Flickr for archiving some of my photos and Bloglines for reading RSS feeds. The other day, I accidently deleted 3/4 of my Bloglines feedlist by mistake. To my horror, I realized there was no way to undo my mistake and recreating the exact list would be almost impossible. Fortunately, I still have most of my feeds on another Web-based program called BlogBridge, but that was simply good luck.

The experience reminded me of all the online Web services we trust not to lose our photos, emails, address books, etc. This trust is simply misplaced. In truth, we can't count on those services to be reliable either (or immune to our simple mistakes!) Our online data should be as much a part of our backups as the data on our hard drives.

Saturday, January 07, 2006

Men's Equippers

In November of last year, I took on the role of discipleship team leader in our church in Perryville. One of the concerns God laid on my heart then was that we could see more of the men in the church step up to the roles as leaders, husband and fathers. Brian, our new men's discipleship leader, was also feeling the same promptings from the Spirit to help and equip the men of the church to be prepared for what God has planned for us.

The exciting thing was watching things unfold today at our first Men's Equippers meeting. (Brian picked the name from II Tim. 3:16-17.) Twenty-four men and one young teenager showed up to hear Brian give a lesson. We spent time looking at passages on the uniqueness of the God's Word, the Bible, and learning facts about it as well as what it has to say about itself.

(An aside here: did you know that the Bible is the most accurate historical document there is? It's no accident.)

It was an incredible thing to see so many guys hungry for the truth of God's Word. We're looking forward to great things ahead as God speaks to us through His book.

Wednesday, January 04, 2006

SNL Narnia video

I posted this to del.icio.us, but I have to share it here too. It's too good to miss.

IronPython beta out

I saw on CNET News that the IronPython beta is out. Still isn't integrated with Visual Studio though. Yawn.

Jython experiments, pt 2

I had a little time to play with both Java and Jython at work today during the down time before our software release. I typed up a couple of Swing example programs from my Java programming book. One was simply a JFrame with a few widgets; the other was a JColorChooser that changed the foreground color of a widget.

I was using the latest Eclipse with the JyDT plugin, so once I had the Java programs running, I could split the editor window and type in the Jython equivalent underneath.

I began to notice something.

The Jython code wasn't any shorter than the Java code.

I had to create inner classes (derived from ActionListener and WindowListener) to handle events. However, Java can create anonymous classes; Jython can't. The other Java win was the ability to create final variables that could be seen inside the inner class. With Jython, I had to use a custom __init__ method to pass the variables in. All this was slow going, as it dawned on me after some Googling on the subject that I really didn't have any other options.

The other obvious thing I noticed was that Eclipse was helping me everywhere with my Java code. There's a syntax error here. You're using a class you didn't import. You didn't implement a method you were supposed to. Eclipse seemed to courteously nudge me toward my goal.

JyDT ... nothing. Stony silence. Well, no, after I typed "from javax.swing import *" actually it did report a syntax error, but ... it was wrong. Reading the FAQ told me that JyDT can't parse this type of import correctly; it's a known bug. Hm.

Once I was done with my programs, I sat back in my chair and thought for a minute. I was startled to realize that Java+Eclipse pretty much took away all of Jython's advantages for my small sample set.

I know, my comparison is limited and, therefore, totally unfair. But who has time to waste on languages/tools that are painful to work with?

Bye bye, Jython.

Update: I got schooled. Phillip J. Eby and another Anonymous poster pointed out in the comments that Jython does indeed have anonymous classes and that I shouldn't be writing Jython code the same way that I write Java code. I will go back, study some provided Jython examples, and give it another go.

Tuesday, January 03, 2006

Jython experiments, pt 1

I had to parse a text file yesterday to count some array elements. I normally would fire up Python, but, for fun, I decided to give Jython a whirl.

I started out with baby steps.

def main():
   file = open("berlin.tsp")
   for x in file:
      print x

I started up Jython 2.1 at the command prompt and ran the script, but I got an AttributeError: __getitem__ on line 3. What the heck? I do this all the time in Python.

I studied the error again and played around with the code for a moment. Suddenly, I remembered that iterating over lines in a file was a Python 2.4 innovation. I had to think for a second ... how did I do it in Python 2.2? Oh yes, readlines().

OK, onto the next part, scanning for a particular substring in the file. Again, I like baby steps.

def main():
   file = open("berlin.tsp")
   for x in file:
      if 'NODE_COORD_SECTION' in x:
         print x
         break

Nothing fancy here, just seeing if things work. I switched back to the Jython prompt and ran it again. What?! Another error.
TypeError: string member test needs char left operand.

I had to consult Jython Essentials to confirm my suspicion: You can't test for substrings in a string with this syntax, only single characters. But I had done this in Python! Oh right ... in 2.4. Bloodied but unbowed, I replaced my existing syntax with a .startswith() method. OK, it worked. Press on.

I realized that once I hit the break statement in the code, I still needed to scan the file from that point. It was time to modify the code slightly.

def main():
   file = open("berlin.tsp")
   lines = file.readlines()
   for i,v in enumerate(lines):
      if v.startswith('NODE_COORD_SECTION'):
         print v
         break
      else:
         print "Error"
         return
   for j in range(i, len(lines)):
         print lines[j]

Oh, forget it. Even I know enumerate() is new for 2.4. Let's try again.
def main():
   file = open("berlin.tsp")
   lines = file.readlines()
   for i in range(len(lines)):
      if lines[i].startswith('NODE_COORD_SECTION'):
         print lines[i]
         break
      else:
         print "Error"
         return
   total = 0
   for j in range(i, len(lines)):
      lst = lines[j].strip().split() # parse the numbers
      total += sum(lst) # sum them up

I also added code at the bottom to sum the array elements. And what do you know ... sum() didn't work either.

At this point, I switched over to Python and finished the program as I was originally coding it.

I learned a couple things:
  1. I've assimilated new Python features more than I realized, and I've come to rely on them. I disagree with those that say that new versions of Python have been incorporating useless features.
  2. Jython hasn't caught up with the latest Python innovations and is suffering for it.

Still, I was keeping an open mind ... check out Jython experiments, part 2.

ProgBlog is closed

Maintaining two blogs is wearisome and dissipating. (Apologies to Thoreau.) I'm going back to one -- this one -- until I get my new web site design up and running.