[geeks] learning script/prog [was: search and replace]
Jonathan C. Patschke
jp at celestrion.net
Sat Sep 6 02:26:40 CDT 2003
On Sat, 6 Sep 2003, Jonathan C. Patschke wrote:
> After HTdP, I'd recommend:
And I forgot the most important things:
4) PRACTICE
Even if it's cobbling something together in ksh so that you don't have
to type it in twice, script -everything-. Make your scripts work
together. Keep an archive of scripts, and improve rather than start
over each time you need a variation on a theme.
It sounds trite, but you'd be amazed how much your skills will improve
if you use them, just a little bit, each day. I -still- find myself
looking a code I wrote a year ago, being embarrassed at how I could ever
churn out something so crude with my name on it, and I've been
experiencing that since I started programming nearly 17 years ago.
And, in the same vein:
5) Relish toy problems
Don't turn something down as a possible scripting (or, if you're feeling
bold, programming) candidate just because it's simple. For example, I
don't own an alarm clock. I've used a computer for that since I was in
junior high.
The first iteration, in BASIC, was neat, because GW-BASIC has so many
cool sound functions. The second, in C for Windows, was even better,
because I learned how to use MCI[0] to play CDs. I woke up to AC/DC's
"Back in Black" every morning for nearly four years. Even now, it can
snap me out of a sound sleep by reflex.
Then, when I moved to Unix from Windows, I got to do it all over again,
as neither GW-BASIC nor Windows programs will run on a SPARC. I started
with:
sleep $((3600 * hours)) ; echo ^G^G^G
Then, I wrote an "annoy" script that beeped, waited 1 to 3 seconds
(chose at random), and beeped again:
sleep $((3600 * whatever)) ; annoy
Now I have a lump of Bourne script and AppleScript that tells iTunes to
play either my Depeche Mode, Thomas Dolby, or Information Society
playlist, starting at a random track.
And I'll probably rewrite it again to learn Cocoa. :)
[0] The old API for manipulating multimedia devices under Windows. It
has...."issues".
--
Jonathan Patschke ) "Gamer weenies...are the sludge at the bottom
Elgin, TX ( of the user swamp." --Gary Nichols
More information about the geeks
mailing list