Damn the torpedos, full speed ahead!

Time for a rest, I can’t go no more with out hitting the mental afterburners.

I’ve kicked out most of the code base for this program, and filed todos for things that are just to rough to implement immediately. And I have the necessary springboards to finish up what remains. All in all, the past 2 runs of coding, has been more productive for this project, then since the last project meeting; and that only consisted of an overview on the flow-charts! lol.

I think I’m going to hit daemonforums.org, then power down and hit the PS2 before dinner. Find a game to play, that reminds me of this.

Hole in Adobe software allows free movie downloads

This reminds me, the Flash v7 plugin for Linux, stores it’s files in a common format until the plugin exits; that can be easily played in with mplayer /tmp/plugintmp-

That reminds me, I’ve still need to write a cronjob to nuke the temp files, since one of the music streams I use, is flash based, and /tmp is nly ~512mb lol.

Run sleepy, run forever

Sigh… Thanks to interruptions, I ain’t got as much done as I desired… Still, it is about 3 or 4 * the amount of work I’ve gotten done in the past few months lol.

almost 0530Q, I could keep on coding until around 0700, but my stomach is to damn hungry… and I keep typing hhhhh every time I need to move my cursor to fix a typo. I need to find a quick snack, and hit the hay. And resume coding tomorrow, when I can still pay attention without /having/ to look up things in the flowcharts.

Sleep… food…. sleep… sleep

h = vi movement key for moving the cursor to the left one space

After a massive interruption, I managed to catch the end of the War of the Roses. Now that, is what I would call, the divorce from hell lol. The movie is funny, but it’s not pretty.

The whole thing goes to pot, when the husband thinks he’s having a heartattack and is rushed to the hospital. The wife is feels ‘happy’ at the thought of being free of him; never mind the sweet deathbed note he wrote, thinking he was dying lol. Which in turn leads to the divorce, both want the house and won’t give it up… To the point, that they’ve worked on a system for dividing the house between them, in the words of the lawyer, “Does this seem rational to you both?”, “I have more square footage >_>”.

She denies him pills, he runs over her cat trying to drive to the store. She locks him in the sauna, he ‘snots’ the soup at her dinner party and pisses on the fish course (lmao!). She runs him over, monster-trucking over his Morgan with her big-ass SUV. Attempts to patch it up fail, ending with a waging war across the house (and a couple $100,000 in damage)… Including her trying to drop the chandelier on him, him trying to rape her turning into a more ‘natural’ moment, until she tries to bite his dick off loool (stupid bastard, should’ve seen it coming!). And more destruction of property, until finally they both end up sitting in the chandelier, as friends come to the rescue……

The cables holding the chandelier up, give way, since she loosed the cable, and they both fall to their death before help arrives.

If I ever get married, remind me to never get divorced!

Coding like a drunken spider-monkey

Finally home from work, with (hopefully) a three day weekend free — TGIF !!!

The plan of attack is to take these days off regualr ps, and go ape on my task list. Because if I don’t, I’m never going to get to work on homework lol.

  1. Operation BlackWidow: An overdue project that a few of us at forums.pcbsd.org have planned
  2. Operation Rooster: Finish the site mock ups for Rouge
  3. .

  4. Operation CleanSweep: Tidy ${HOME}, add more stuff to CVS as needed, revise my SOE scripts, and deploy necessary code in the right places
  5. .

I’ve always found it easier to name a project, then have to stop and think, The “uh X,Y, to the Z, and whatever” thing; both in mind and notation!

I’ll be posting my absence message on SAS shortly, along with my cntact data. My primary goal, is to work on my own projects and standing SAS-projects. I really need to keep my head out of the servers, and on what I’m doing… So it’s best if I essentially, lock myself in front of the laptop for the weekend lol. I figure, get the work done, get the stuff that’s building up done, maybe watch a bit of TV for a change (when my head needs a rest).

This is as close to a vacation as I’m going to get, and it’s a coding vacation lol.

The way this day heads up

So far, I’ve been hit in the face with a falling mirror. It almost scored a perfect T-Shot, right between the eyes… Then slide halfway down my noise before I had hands free.

Hit in the head with the Vacuum — don’t ask lol.

And spun out of a fall, that almost twisted an ankle :

I think I’m going to sit down, and not move, until work tomorrow!

Slithering around an aging question

Hmm, it seems if I can sort a suitable SQL-interface (beyond the standard issue sqlite3 module) that Python will become my primary language.

It seems, no matter how much I try to circumvent it, Python is the best choice all around : And I’ve tried to knock it down to size lool.

Pythons str and list classes, I actually quite like; although I don’t care much for dict (Pythons associative array class), that might change come Python 3. Most of the stuff built into Python, I like using. The regular expression support, well what can I say… I don’t like any stuck on OOP or procedural interfaces, after having used Perl. The =~, s//, [m]//, and related $symbolic_vars in Perl are just to useful!!!! But Pythons ‘re’ module is good enough for stuff, I guess. Between the built in xml.* and the third-party lxml interface to libxml2, that routes pretty much a snap. I get along well with Pythons IPC offerings about as well as I do with posix’s C offerings. The zlib, gzip, bz2, zipfile, and tarfile modules are enough for the compression/archive formats I may eventually need to operate on. For network related operations, Python provides a lot of stuff plus a familiar sockets interface; I don’t have no problems with sockets programming (although I rarely get a chance to use it in C), I just don’t have time to say, implement FTP! For GUI toolkits, basically offered is TKinter, GTK+, WxWidgets, and Qt. And it looks like GTK+ will probably be my new default kit… The epydoc program also seems to provide the style of documentation I’m used to (Javadoc-style) with good options hehe.

Not to mention the best parts of using Python as my standard language (I and II)

This is how I relax…. lol.

Having taken some time to analyze the mailcap and mime.types files, which map media types to handler programs and file extensions respectively. I’ve decided to implement something, uhh…. more “fun” out of it, for my own usage. I’ll use mailcap and mime.types to setup a suitable mime/file associations to desire, and a mixture of m4 and environment varables to make it more useful hehe. I’ve also setup a small wrapper around Pythons mailcap and mimetypes modules, so I’m happy !

Since I need a handler that includes a web browser, rather then creating an if x is probably running … script, to just use $BROWSER. But since, there is a shitload of apps that don’t understand it, I’ve created quick python script to handle it. Thus, mailcap will execute this script, which will “figure it out”. Once I realized how much I could use such a quickie, I added a little more abstraction to it; making it usable with other variables. And used getopt for a simple interface to it.

#!/usr/bin/env python

import sys, os, getopt

# default values for -e and -s options
envvar = "BROWSER"
envsep = ":"
# skip executing program
noexec = False

# accepted options, usage statement, and manual page
shortopts = "hme:s:n"
longopts = [ 'help', 'man', 'environment=', 'separator=', 'no-exec' ]
def usage():
print """
usage: %s [options] file ...

Parse a field delimited list of programs, executing each in turn, until the
specified application has opened the indicated file(s).

Options:

-h,--help display this useless message
-e,--environment the environment variable to look up, default to BROWSER
-s,--separator the field separator for -e VAR, defaults to :
-m,--man view this manual page
-n,--no-exec do not execute any programs, useful if parsing $PATH

--long-options may be abbreviated.

Exit Status:

The return status of the last executed program handler. If no program was
executed, return with a non-zero exit status.

Caveats:

A non-zero exit status is considered a successful execution.

Programs found by parsing the environment variable, are passed onto the
system shell UNMODIFIED. This is not secure, but it is flexible.
""" % sys.argv[0]
sys.exit(1);


try:
opts, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
except getopt.GetoptError, e:
print(str(e))
usage()

for opt, arg in opts:
if opt in ('-h', '--help'):
usage()
elif opt in ('-m', '--man'):
# XXX works on unix, dos, winnt, osx
os.system("%s -h | $PAGER || more" % sys.argv[0])
sys.exit(0)
elif opt in ('-e', '--environment'):
envvar = arg
elif opt in ('-s', '--separator'):
envsep = arg
elif opt in ('-n', '--no-exec'):
noexec=True
else:
assert False,"unhandled option: %s" % opt

# exec handlers until success, abort, or exit
try:
browser = os.environ[envvar]
apps = browser.split(envsep)
for handler in apps:
# just print it, don't execute it
if noexec:
print handler
continue

ret = os.system(handler)
if not ret == 0:
print("Bad handler -- %s" % (str(handler) % " ".join(args)))

except KeyError:
print("No %s set!!!" % envvar)
sys.exit(1)
except Exception, e:
print("Un-handled exception! -- %s" % e.message)

One of the common questions of a language, is how to parse command line options? I’ve tried several interfaces in differing languages, but I know one thing… The getopt(3) routine in C on unix is awesome for short options. Give something more portable and with (easy) support for long options, and I’ll have a big grin on my face >_>. But if I have to wade through 20 pages of documentation for a comparable OOP-Interface, I’ll be snoring before I get to writing usage().