As usual, stuff I've spotted but have been too busy to properly comment on:
- Gnome and KDE pseudo-integration (the article itself is a pretty good collection of links to examples of what could be the end of mainstream UNIX's GUI nightmare...)
- The authoritative DSC-F828 review as far as I'm concerned, including detailed comparisons with a few other prosumer cameras.
- Simon Switched, and is undergoing the kind of discovery process that all tech-savvy Mac users can relate to. Gongrats, Simon - hope you've read my tips for new switchers.
- Macrumors has links to a number of GarageBand screenshots, and over at Macslash folk are asking what the best keyboard for MIDI/Piano might be - others are still whining about the $50 iLife price tag without realizing how much all of it is actually worth, though.
- Hyatt is still redesigning ;)
- O'Reilly is churning out four Mac OS X titles: Mac OS X Panther in a Nutshell, Mac OS X Panther for Unix Geeks, Learning Unix for Mac OS X Panther and Mac OS X: The Missing Manual, Panther Edition
- Pheed aims to standartize RSS for photo logs, and is a worthy effort - I've already started to tweak my Photo section to conform to it one day, but there's a basic flaw with the concept - it's too much trouble to comply with it all. I can surely provide thumbnails for all my images (they're automagically generated), but I can't be bothered to provide titles and descriptions for all photos (at least not all 1600 of them).
Framing Things The Right Way
One of the coding catchphrases I retained from Lisp (yeah, I did my time counting parenthesis too) was "lists are everything, and everything is a list" (purists can complain about atoms to /dev/null). So, when I decided to improve my photo section's look with a nice frame and alpha-blended shadow (background colour had to be adjustable, of course), I thought nothing of drawing a shadowed square, chopping it into PNG sections with an alpha channel and doing this:
$hNewImage = imagecreatetruecolor( $nNewWidth, $nNewHeight );
$aBackground = hex2dec( $szBackgroundColor );
$hBackground = imagecolorallocate( $hNewImage,
$aBackground['r'],
$aBackground['g'],
$aBackground['b'] );
imagefilledrectangle( $hNewImage, 0, 0, $nNewWidth, $nNewHeight, $hBackground );
imagealphablending( $hNewImage, true );
// Frame Element List
// dstX, dstY, dstW, dstH
$aCorners = array( "frame_tl.png" => array( 0, 0, 16, 16 ),
"frame_tm.png" => array( 16, 0, $nNewWidth-32, 16 ),
"frame_tr.png" => array( $nNewWidth-16, 0, 16, 16 ),
"frame_ml.png" => array( 0, 16, 16, $nNewHeight-32 ),
"frame_mr.png" => array( $nNewWidth-16, 16, 16, $nNewHeight-32 ),
"frame_bl.png" => array( 0, $nNewHeight-16, 16, 16 ),
"frame_bm.png" => array( 16, $nNewHeight-16, $nNewWidth-32, 16 ),
"frame_br.png" => array( $nNewWidth-16, $nNewHeight-16, 16, 16 ) );
foreach( $aCorners as $szFile => $aParams ) {
$hCorner = imagecreatefrompng( $szFile );
imagecopyresampled( $hNewImage, $hCorner,
$aParams[0] - 1, $aParams[1] - 1, 0, 0,
$aParams[2], $aParams[3], 16, 16 );
imagedestroy( $hCorner );
}
imagecopyresampled( $hNewImage, $hImage, 15, 15, 0, 0,
$nNewWidth - 31, $nNewHeight - 31,
$nImageWidth, $nImageHeight );
A friend of mine who teaches at college looked at the foreach loop and $aCorners and despaired. According to him, not a single kid in the programming class he teaches (we're talking 4th year students, the kind of people one year away from having to code for a living) would even consider approaching the problem like this. "They have no grasp of data structures, and would probably have cut and pasted eight imagecopy calls."
I was dumbfounded, since it is such a trivial approach.
According to him, cut-and-paste programming and "instant gratification editors" (just for the record, they are using Microsoft Visual Studio) are killing the reasoning involved in solving problems, because it's easier to cut and paste "dumb" code than actually type out code to properly handle complex data structures.
"Kids click around in the class browser and think it natural to have skeleton code there waiting for them", which, according to him, makes them totally ignorant of why the skeletons exist or how they interact, let alone design data structures to handle the problems.
I won't go as far as to concur with him that application frameworks and GUI editors should be held back from students (if they can use them properly, they should be allowed to), but I am worried that we might be creating a whole generation of half-baked programmers by making some things too easy.
Or am I just becoming an old fogie?