Worthless router

Ended up woken up around 0930 (yippee, 3 hours sleep) due to a power outage; then dragged out shopping 🙁

When I got home and finally on the computer, I noticed for the first time in a LONG time my laptop couldn’t get a wireless connection: usually my BSD system is queen of the WLAN. A quick bit of investigation showed that during the power outage, the router reset itself totally. It’s a good thing my laptops Ethernet port has been supported since ~FreeBSD 6.4. Dug up an old Ethernet cable and plugged into the router. Sure enough the piece of crap got reset to factory defaults during the power outage stuff this morning.

Reconfigured the router and upgraded the encryption: only to find out my mothers PC couldn’t handle it, despite having the same hardware as my desktop. A quick search of Google turned up what I suspected, menu option added in an update; and her box was running XP Home SP2 / IE6 / .NET 1.1 lol. Updates are almost finished, and now every machines back on the network

My mothers been badgering me to try charters atypical power cycle suggestion: which I know could be done for years and years and wouldn’t change jack shit; she’s got no logical concept of networks. Some how, I think understanding helps troubleshoot stuff then trying the Microsoft Ritual Solution (MSRS). In my experience it works fine for Win32, but UNIX and networking equipment in general seems to follow a more sane pattern 😉

Tom Knight and the Lisp Machine; The Jargon File, version 4.4.7

A novice was trying to fix a broken Lisp machine by turning the power off and on.

Knight, seeing what the student was doing, spoke sternly: “You cannot fix a machine by just power-cycling it with no understanding of what is going wrong.”

Knight turned the machine off and on.

The machine worked.

I always think about that old koan when having such trouble lol.

What I hate about programming

Some months ago when it reached Kris Moore’s attention (late as usual) that I had brought up security issues with his Firefox3 PBI, he changed it to something almost as bad. A couple weeks ago, I heard back from Kris that he had [naively] changed the code for making Fx3 the users default browser would no longer run as “root”. After a little more conversation he split it off to something better.

Originally it was a part of the script that runs during PBI installation (and worse then the below script), probably tired of my replies he made an extra wrapper around the Firefox3, that asks the user if they want Firefox3 set default or not, rather then workin’ the user database at install time. (I refuse comment on the following scripts predecessors: if you want to know more, read his SVN). The solution he came up for that wrapper, was to invokes the following code as the user when necessary:

#!/bin/sh
# Helper script to make FF the default browser for a user
##############################################################################

# Get the users homedir
USER="`whoami`"
HOMEDIR="`cat /etc/passwd | grep ^${USER}: | cut -d ":" -f 6`"

if [ -e "${HOMEDIR}/.kde4" ]
then
KDEDIR=".kde4"
else
KDEDIR=".kde"
fi

if [ ! -e "${HOMEDIR}/${KDEDIR}/share/config/kdeglobals" ]
then
echo "ERROR: No kdeglobals file for $USER"
exit 1
fi


TMPKFILE="${HOMEDIR}/.kdeglobals.$$"
TMPKFILE2="${HOMEDIR}/.kdeglobals2.$$"
rm ${TMPKFILE} >/dev/null 2>/dev/null

cat ${HOMEDIR}/${KDEDIR}/share/config/kdeglobals | grep -v '^BrowserApplication' > ${TMPKFILE}

rm ${TMPKFILE2} >/dev/null 2>/dev/null
touch ${TMPKFILE2}
while read line
do
if [ "$line" = "[General]" ]
then
echo "$line" >> ${TMPKFILE2}
if [ "${KDEDIR}" = ".kde4" ]
then
echo "BrowserApplication[$e]=!/Programs/bin/firefox3" >> ${TMPKFILE2}
else
echo "BrowserApplication=!/Programs/bin/firefox3" >> ${TMPKFILE2}
fi
else
echo "$line" >> ${TMPKFILE2}
fi
done < ${TMPKFILE}

# all finished, now move it back over kdeglobals
rm ${TMPKFILE}
mv ${TMPKFILE2} ${HOME}/${KDEDIR}/share/config/kdeglobals

exit 0

which is more secure then the original implementation, and more efficient also. Tonight I sent Kris a casual (read: adapt to need, don’t take as is) suggestion from yours truly:

#!/bin/sh
# Helper script to make FF the default browser for a user
# Should work for KDE3 and KDE4.
##############################################################################

PROG="!/Programs/bin/firefox3"
FILE="./share/config/kdeglobals"

for D in "${HOME}/.kde" "${HOME}/.kde4"
do
cd $D 2>/dev/null || break;

if [ ! -e "$FILE" ]
then
echo "ERROR: No kdeglobals file, unable to set $PROG as default"
exit 1
fi

ed -s "$FILE" <<EOF
/[General]/
/BrowserApplication.*=/
s/=.*/=${PROG}/
wq
EOF
# write your own error handlers
done

exit 0

which should work as far as I can test; since I lack a working KDE install (compiling KDE4.2+ is on my todo list). It’s not perfect, but it sure is nicer then what he had a few months back. I included the a diff of the two scripts in my last message, which may very well go against my decision to “never” send these people patches. But I really don’t care if he accepts it or not, because while I believe in being helpful, I also I do not like doing peoples jobs for them.

I’m a lazy good for nothing creep, but I am lazy of muscle – not lazy of mind. The most productive code I have ever written, is the code I was smart enough /not/ to write in the first place.

I came here to live

I grew up in a town where tough was a cigarette
And a souped up car on a county road
Nothin’ much to do back then
So we’d make bets
On how much drink a guy could hold
And I held my own
Learn to hold my own

Daddy works some dead-end job at the concrete plant
Mama taught the Sunday bible class
For eighteen years I remember thinkin’
There was more to life than that
So I ran the streets to beat the Devil
Goin’ just as fast as I could fly
‘Cause I came here to live
I didn’t come here to die

Mama used to wait for me with the porch light on
Worried about her little boy ’til I got home
Daddy he’d say listen son
But back then there wasn’t much
That I didn’t already know

I reckon I was doing close to 80
When I felt the tire slip out from under me
And I never set out lookin’ for Jesus
So I guess Jesus come lookin’ for me
And He found me upside down in a ditch
Smokin’ gas in my eyes
And He said son you came here to live
You didn’t come here to die

Sunday morning I got up and I went to church
That summer I got a job and I went to work
Met a girl in town put some money down
On a little house with a yard

Our little boy was due in September
But he came early in July
For eighteen days all I remember
Was settin’ there at his side
Sayin’ son open up your eyes
Just open up your eyes
‘Cause you came here to live
You didn’t come here to die
Son you came here to live

— I can Here to Live, Trace Adkins

Clear with a vengeance!

Ok, I can take the lag, I can almost stand a 9x19mm P228 compact pistol packing a harder punch then a 7.62x67mm (.300 Cal) Winchester Magnum WA 2000 sniper rifle with half the stopping power of the 9mm…. but this is just to much.

Teammate trew a frag into the room I’m in, stampedes the tangos and flushes me right into them.

I can stand the tangos, but if y’all want to start frag-flushing me into a 4 on 1 dance off… I ain’t getting on my dancin’ shoes, I’m gettin’ a bigger freakin’ gun.

H&K 23, 5.56x45mm NATO Light Machine Gun —> room cleared with a vengeance like no other baby!

(and no, I didn’t shoot the idiots on my team, I shot that tangos lol)

Darn it, I had my mail down to under a 100 messages in the queue…. few months of busyness and it’s over 700 lol. Oh well, weekends are good for something 🙂

merging the new code into master

After 3~4 days of coding, I’ve just merged the parserlexer branch back into master; I love coding 🙂

 commit 9857e5e9556f31543075fb4a74350dbda97a42e5
Merge: c9a8ae4... bb425eb...
Author: Terry ....snip...
Date: Wed Apr 8 07:23:19 2009 +0000

Merge branch 'parserlexer'

The new parser, lexer, and quote expansion code (+ a few bugfixes) has
finally been merged into the mainline of development (branch 'master').
This marks the new sh_eval(), tpsh_parse(), expand_quotes, tpsh_lex()
functions in such a way that they should be considered 'stable' for
general usage.

some nice things that come with this:

a sane way of quoting stuff; but not sh compatible (”’ = ‘, not an error), more then one set of quotes on the line; and things like `cd /foo; vi bar` finally work xD. In the course of the necessary bug smashin’ for the merge, I’ve also cleaned out a few pains in the todo file, that have been there since last month++ lol.

things that remain to be done: pluggable completion; make completion play nicer with perl/gnu readline backends; restore support for pipes (critical); handling of keybinding (likely painful across perl/gnu/zoid Term::ReadLine backends; but at least zoid is nice…). In the more long term: control flow, (subshells), better `handling`, {anonymous macro/grouping}, more advanced I/O redirections (i.e. only >, >>, and < currently work lol); making `fc -l` and `history list` use a format for display rather then print(); make &do_getopt able to be configured by callers (so fc can accept negative indexes, etc); give a way to turn off shell options (set - and set + currently turn on, only lol); and who knows what else that I can't remember atm.
and to abuse {erls idea of objects and verbs: eval { $spidey sleep $now };