I’ve not been playing with AppleScript much, so I opted to reserect it, since Apple was kind enough to provide it with their Developer Tools.

For a simple little test, I made probably one of the worst coded applets in Applescript history; a talking clock. Then, I decided to just go hog wild and make it a little ‘fuzzy’, referring to the date in a less-arcaic way, completing the often-toted ‘relaxed’ feeling of the Mac. That’s marketing for you.

Anyhow, here it is, ugly as sin:

set zDate to current date
try
set zMonth to (month of (zDate)) as string
on error errorMsg
set zMonth to word 3 of errorMsg
end try
try
set zWeekDay to (weekday of (zDate)) as string
on error errorMsg
set zWeekDay to word 3 of errorMsg
end try
set zDay to (day of (zDate)) as string
set zYear to (year of (zDate)) as string
set zTime to (time of zDate)
copy (round (zTime / 3600) rounding down) to zHour
copy (round ((zTime – (zHour * 3600)) / 60) rounding down) to zMinute
copy ((zTime – (zHour * 3600)) – zMinute * 60) to zSeconds
copy ” ” to zMinuteStatus

if zMinute > 12 then
copy ” a quarter past ” to zMinuteStatus
end if
if zMinute > 27 then
copy ” half past ” to zMinuteStatus
end if
if zMinute > 42 then
copy ” a quarter to ” to zMinuteStatus
copy zHour + 1 to zHour
end if

if zHour < 12 then
copy “AM” to mornEve
copy “Morning” to greetEve
else
copy “PM” to mornEve
if zHour < 17 then
copy “Evening” to greetEve
else
copy “Afternoon” to greetEve
end if
if zHour > 12 then
copy zHour – 12 to zHour
end if
end if

copy “Good [[emph +]]” & greetEve & ” Shawn; it is” & zWeekDay & ”, ” & zMonth & ” ” & zDay & ”, ” & ”, at about ” & zMinuteStatus & zHour & ” ” & mornEve to MyTime
say MyTime as string

Pretty painful, huh? I won’t bother to comment on this, other than it could really use some optimization, and you can probably spot a few buglets right off the bat, but for a little 10 minute exercise, I think it holds it’s water fairly well. 😉

Time for another quick tip! I know I removed the ones from before – Sorry; I’ve been changing my diary quite a bit, and considered it somewhat out of date. Besides, I have no idea if anyone even bothers reading this silly little journal of mine.

Assuming you have a bourne compliant shell, this will pick a random MP3 within a directory you specify, if you specify none, it will choose from the current directory (or subdirectories thereof):

#!/bin/sh
if [ ”$1x” == “x” ]
then
DIRLIST=”.”
else
DIRLIST=”$1”
fi

find $DIRLIST -type f -name \*.mp3 | sed -n $((1 + $RANDOM % `ls|wc -l`))p

If you name this “randfile.sh”, you can utilize as follows:

%open `/bin/sh /path/to/randfile.sh`

Myself, I made this an alias, so I can just type “randmp3”. As this uses ‘open’, it will follow the HFS creator code for whatever you have set for your audio files, such as Audion. A spiffy alternative to ‘open’ is ‘launch’, by Nicholas Riley, and can be directly swapped with ‘open’ above.

Note that this approach is rather suboptimal, as ‘find’ will recuse over your entire directory structure, a simpler approach would be:

ls $DIRLIST/*.mp3 | sed -n $((1 + $RANDOM % `ls|wc -l`))p

…but this doesn’t do any post checking for any funky ls settings if you’re running a non-standard ls (such as color-ls). You can grep that out if you need to. It’s your call, change for your needs. 😉

Looking at the current development for BitTorrent, I like how certain things are so simplistic; it’s nearly trivial to tinker with. Bram has managed an elegance; with Python being supported on multiple platforms, Windows, Mac, UNIX junkies can all utilize the same basic platform.

The biggest issue I find is that the trackers are generally hard-coded to port 6969; it should be trivial (it is, to all but rather low-grade end-users) to proxy this via other ports.

It should have a [better] discovery system. Some universities are already filtering out all known BitTorrent ports (defaults to 6969 for the tracker, and 6881 through 6889 for the client).

Currently, for my own use and for those whom have issues with sharing BitTorrent, I’ve likened to using port 1080 for the tracker, as I have no internal need for SOCKS support, it’s legacy, but usually left open; as well, under UNIX, root access is not required as it is over the 1024 lower ports boundary. As requests for client can use any list of ports, I’m contemplating a new means of discovery and sharing, or perhaps hardcoding some other viable defaults. The existing schema just doesn’t stand up to three seconds with enable, or almost any cheap router.

I’ll be working on modifications to this existing system in the near future. I don’t feel the direct need to tie to any specific port; the creation utilities just point you to a home server to obtain information and find your peers. This should be trivial to decentralize, but with this information being written into the .torrent itself; I really don’t want to break off and start anew.

Thoughts?

I am amazingly annoyed today; on Monday, my Athlon ups and dies. No warning, no magic smoke. Just dead.

Today, I get my old PII back, thanks to trusty old UPS, but wait, what’s this?


AHHH! IT’S RABID!

They killed it! I mean, they really-really-really killed it. This is beyond dead; this is beyond dead parrot sketch dead. The CPUs are out of their sockets and bent; the speaker is broken from it’s clasp and has been rattling around about the video card, SCSI, and everything.

In short, this machine is a wreck, inside and out. The top and bottom are smashed it, even the back of the machine is bowed in – THE RECESSED BITS ARE SMASHED INWARDS. How could someone do this without kicking it? I’d really like to know.

Anyhow, I have no functioning PCs; this poor laptop is growing a bit slower, older, with a crummy keyboard, every day. We’ll see how things go.

I haven’t updated my diary in over a month.

The blue car didn’t pass smog anymore, and it was not economically viable to keep repairing it. It’s a shame, the interior was beautiful, it was like driving a Laz-E-Boy recliner. Sorry, no whistle tips. I ended up giving it up at what a single hubcap would cost to replace, but at least I know who bought it will take care of it – it’s his 9th Cutlass!

Things have been amazingly busy for me; I’m searching for work, and am having less luck whist trying to find longer-term employment. I know something will come through, but I am getting a bit depressed over the whole ordeal.

As well, my poor ‘old’ laptop is getting testy – my OS X ports are beginning to become a bit crusty, as are the applications themselves, it seems.

I had to downgrade my gallery to ver 1.3.2-b31, because 1.3.4b11 is entirely broken, whist 1.3.3 had a few odd issues – it was more trivial to backport the security patch with my changes than to fix 1.3.4. Sigh.

Atop of that, this evening while wishing for a bit of leisure time, I found that every single one of my IntelliVision consoles has died for one reason or another… in less than two months since I last used, well, one.

I tore them all apart and found that one was working, but the controllers were both dead (WTF?), so I swapped them with one of the other’s controllers, tested. Works. YAY!

Whilst having them apart, I opted to open the third. Here comes the tricky part – the main logic board is trapped between two metal shrouds to comply with the 1979 FCC regulations. Hot welded together. CRAP! I ended up prying one apart, my soldering iron too weak. The other one had been repaired prior, and I was able to take the rosin core right off.

So, on a whim, I replaced the 2k RO-3-9502 ROM which holds half of the IntelliVision’s ‘kernel’ with that of the other unit. I plugged in the power and my makeshift RCA cable (stripped and taped to a 75Ohm on the back of an ancient TV), and lo, behold, the FROGGER theme came up! Yaaay!

I ended up putting the two working units back together, and the third, with the bad ROM and two dead controllers. Oh well. At least I still have spare parts – I really wish I had the tools to test segment $1000 to $1FFFF – I fail to see why it tanked like it did.

So, now here I sit, too tired to play nostalgic games, and covered in 24 year old dustbunnies. I’m having a wash and going to bed. 😉