Gifts

Now, why would my wife see “this comic as totally believable?”:http://www.penny-arcade.com/comic/2006/04/19

Maybe it has something to do with me offering to get *her* a mac mini for her birthday, so it could be used as a media center.

iWeb

After using iWeb as a test for a site, I have a couple of key points that I’ll mention about it. Overall it’s a simple tool for basic sites. For a first version, there is a lot of pollish making it very easy for an average mac user to publish something.

*Pro’s*

Web Design Taste

And on the subject of web design, I have to go on a rant. Now I’m sure this is a rant that any of you who have done _any_ web design work for other people will understand. Please share your horror stories in the vein of ‘Biting the hand that feeds you’.

A good function gone bad

One of the nice features about where I work is that I have switched the division from a really crap old proprietary, windows based billing system, to a “Perl based, GPL billing system”:http://www.sisd.com/freeside using Postgres (optionally MySQL) as the back end.

One of the main tasks I have at work is “Enterprisifying” this system. Making sure it can handle enterprise level features that my company needs.

Right now I’m working heavily on caching mechanisms and middleware storage, turning it into more of an N-tier architecture, and I’m looking at some existing code that starts with…

bc.
$statement .= ‘ WHERE ‘ . join(‘ AND ‘,
( map {

p. A really simple SQL building block (that’s another issue altogether) but the problem is what comes next. That join of course means there is a list next, but the map has a ‘(‘ before it. That’s right, there is more than one (two in fact) which take up the next *2 pages*. ARRRGHH! What were you thinking people? Yes it’s possible, might have even saved 2 variables, but it sure didn’t help readability. This should most positively have been broken out into multiple statements, over even better, re-factored into some subroutine call or similar visual optimization. Two *pages* of code written in what is a single line tool. It will look so much nicer when it’s more like:

bc.
$statement .= ‘ WHERE ‘ . join(‘ AND ‘, define_columns( @data ) );

p.
Oh well, I have the source, I have cvs, I can correct this blasphemy.

Intermediate Perl

The recent upgrade to what was a very useful book. When it came out, I reviewed the originally named “Learning Perl Objects and References”, with very high marks. It was a book targeted for an unfulfilled niche in the Perl book market. That extremely important step from the ==
Learning Perl
== book and into the world of full development.

Read on for my overall review…

dapper dist-upgrade

On my main home machine I’ve been using “ubuntu-64”:http://www.ubuntu.org for a little over a year now. Last time I attempted to upgrade versions I went to breezy, which frankly has been a bug-ridden version on every machine I’ve used it on. Recently I’ve been trying to get “MythTV”:http://www.mythtv.org/ running on the box, without any success.

* the breezy packages are abandoned, mixes of .18.1 and .17.1, they can’t even be installed
* almost every breezy .deb source seems to be offline most of the time
* I can’t get any svn version to compile (which I’d like anyways, to be up to date)
* using other debs, I can’t get it to compile, even though friends say they had it working

One coworker is running his system via dapper, and has had more success, so I threw up my hands, and prepared for a rough weekend of upgrading my box. *Amazingly*, changes my sources to dapper and doing a dist-upgrade worked extremely well though. The only problems were ia32-gtk libs needed by openoffice.org-gtk, and python-twisted modules. I just got rid of those (didn’t care), re-upgraded, and everything worked great. Best ubuntu upgrade I’ve had.

The dapper myth packages are .18.1, and installed well. But I learned that you should run mythtv-setup as root instead of as the mythtv user (as several sources suggested). I *still* can’t compile my own, due to libavcodec problems (relocation error with libdts) 🙁 but am grabbing sources to do my own debs from a coworker. Hopefully will have some patch or other requirement I need.

List and scalar context

One of the things I love with Perl is how well it can tell when you want something to be in list or scalar context. However there are a couple times that the compiler isn’t sure which you want, and assumes incorrectly. This happened today to me on what seemed a very minimal issue. This was one of those cases where I typed a one-liner to confirm something, and the answer wasn’t what I expected and led me down the path of finding out what was wrong.

The basic problem was that I wanted to verify something with the ‘mday’ value out of the localtime() function, without capturing an entire array, or listing out undef in array locations when it assigned. so my one liner listed:

print localtime( time ) [3][1];

But this doesn’t work. So I figured I need to make sure it sees the list that localtime returns:

print ( localtime ( time ) ) [3][2];

And I got the same syntax error. Playing around I tried to assign it to a variable instead of printing:

$mday = ( localtime ( time ) ) [3];[3]

And that works.. Why?
The basic reason is that print actually expects a list, and the assignment was to an array, so the two really are different. Now, since in my real code I was doing an assignment anyways, that worked just fine. If by chance you actually wanted to print this without the capture though, just use the compiler hint of ‘+’ :

print +( localtime ( time ) ) [3];[4]

So, just remember kids, understand list and scalar context.

fn1. Print the 4th element of the localtime array as parsed from time()

fn2. Enforce the List context of the localtime function

fn3. Only difference is an assignment to a scalar instead of the print

fn4. The + in front just gives the parser/compiler a hint, or an anchor when it’s figuring out what you are really trying to do in what could be ambiguous circumstances.

Green River Pictures

For those interested, I now have some pictures from our recent paintball sojourn. “Kia”:http://www.teamdesertedge.com/kia.html took “pictures from the players perspective”:http://halls.lug-nut.com/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/ outside of the games. Whereas the “SpecOps”:http://www.specialopspaintball.com/ media man allowed usage of some of his “In action photography”:http://halls.lug-nut.com/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/SpecOps/

A couple of my favorites:

“!/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/SpecOps/.cache/100×66-IMG_8160.jpg (The Convoy Bridge)!”:http://halls.lug-nut.com/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/SpecOps/IMG_8160.jpg
“!/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/SpecOps/.cache/100×66-IMG_8403.jpg (Desert Edge Squad 2)!”:http://halls.lug-nut.com/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/SpecOps/IMG_8403.jpg
“!/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/SpecOps/.cache/100×66-IMG_8423.jpg (Advancing in the smoke)!”:http://halls.lug-nut.com/gallery/friends/Paintball/DesertEdge/Green%20River%2C%20April%2006/SpecOps/IMG_8423.jpg

Plug Map

“Google Map to Plug Meeting”:http://maps.google.com/maps?f=q&hl=en&q=1253+N.+Research+Way,+Suite+q-2500,+Orem+Utah+84097 For those that have requested it.