Wednesday, June 27, 2007

Quick desktop screencap

Clicky for larger size


Mike said...

Ahhhhh! Iggy is watching on your desktop!

We're all going to jail.. in two weeks.

Anonymous said...

I'll be a coder dork for a second and ignore the fun error messages and comments.

Wny do you run the match several times? It seems like your config file is a bunch of name/value pairss and you could do something like this:

my $line=$_;
if ($line=~/^(.+)=(.+)/) {
if ($1 eq 'dir') {
} else if ($1 eq 'name') {

I didn't think through this at all and certainly didn't try and run it and now it occurs to me that your confg file isn't all 'name=value' and you depend on the word "backup*******" before the other attributes, but still, it's early and I felt like giving some undeserved criticism.

Fletch said...

It was an odd bit of code.

The first match find the line that goes:
dir = c:\omg\wtf\bbq
Then it sets the full path to a variable.

The next match strips off the last directory (c:\omg\wtf) The extra bit of strangeness (\\[^\\]+\\*$) makes it match whether someone put a trailing backslash or not. If you've still got a way to shorten it, I'll do it! I lurve shortening my code.

Anonymous said...


Fletch said...

Ahhh... I read you comment again after lunch and see what you actually were talking about.

Only running the match once then checking the input with multiple if statements would save a small amount of time, but then I'd have to define variables to hold the initial values of $1 and $2 (as they are only place holders, and don't hold their values very well through other regexs, and can't do all the things regular variables can do) This would add a few more lines of code to define variables that have little use. If I was checking for 1000 possibilities I'd do it that way.

There's only 5 lines it's reading (per backup set) and only one line is unmatched. I only lose a few milliseconds, and I'm not concerned about those. (otherwise I would be using a compiled language)

Plus, it's quick, and easy to understand ;)