Monday, August 17, 2009
Firefox 3.5 = Blank tooltips everywhere
--UPDATE--
To Fix: uninstall GoogleToobar; reinstall new version of GoogleToolbar (For me-5.0.20090813W)
Tuesday, August 11, 2009
Wednesday, July 22, 2009
Dork Haus - Case Mods? Furniture Mods?
Is it a case mod, or are you just making your otherwise useful furniture much more dorky? We have 2 Dork Haus examples. The motivation is that in the Man Cave there are a lot of tools and servers, and the servers have media files on them that we dorks may want to enjoy. The Dork Haus Man Cave is not one of these TV sissy man caves with comfy chairs, carpet and football paraphernalia. We put the "cave" back in "man cave" where it belongs (tools and servers, babe).
Great, but I would rather relax in the den and the bedroom, hence the need for computers in those rooms. Computers are ugly (yes, even your mac... especially where the finish is worn off from you petting it) or if not ugly at least inappropriately styled for most decor. I don't want to make the computer more of an issue (e.g. these case mods). I want the computer, the blinking, the noise (Oh God, the noise!) to go away.
With the release of the new ATOM based motherboards I decided to revisit the idea of making a very small unobtrusive computer. I had tried earlier with a VIA board that turned out to be too anemic to playback video but still got its case hot, scary hot.
The Den of Dork:
She does make a little noise as the motherboard has a fan and the hard drive is a real hard drive (that spins), and so far I haven't made a nice switch, so you have to open the drawer to reach a switch scavenged from an old tower-style PC. This is probably for the best, as you want to leave the drawer cracked when it's on for ventilation. Pictures of the back.
It's running windows XP, which is probably about as much as that processor can handle. One thing that is nice about running Windows it that it works with Netflix "Watch Instantly." Also the networking is brain-dead simple with SAMBA running downstairs on FreeBSD 7.2. I have to say that Rhapsody runs very poorly on this setup; but other players (including WMP) work great and it is more than up to the job of video playback with any codec over the ~800x600 s-video line. The last picture is Internet Explorer at my Google Reader page.
The Master Dork Bedroom:
Observe: an armoire. She is an old and relatively nice armoire, and has been doing a fine job holing up a TV while containing clothes within. This particular item used to be my brother Neal's, and it ended up moving with us to Salt Lake City at the near insistance of my mom. It is about 5 feet tall and it is made mostly of thick boards (not plywood). We like it a lot - thanks mom!
Obviously the computer would need to go in or on the armoire. There is a hatch on the upper right that opens up to reveal a mirror and a generous area to hold your razor or something. I bolted a mother board to the back of that space with 1" standoffs. This board only requires 12VDC for power which simplifies things considerably. Also this set up has no fan and I'm using a solid state hard drive. If the speakers are off, it makes no noise that I can hear.
Julie, the She-Dork, recommend that rather than make lots of little holes and connections I make a single simple hole and pass the cables right through. This was much easier and required much less abusing of the furniture. I made a single rectangular hole about 1"X1.5", and that easily accommodates the 120VAC cord for the power brick, the CAT5e, HDMI, USB and stereo audio cables. One more hole allowed a sweet little power switch on the back of the armoire.
Thursday, July 16, 2009
Phifer the kitten
Tuesday, June 30, 2009
tee functionality with python subprocess PIPEs
One example application is dumping large databases with storage engine that can't give you a time of last modification, e.g. mysql, using innodb. Then I want the chksum of the dump, and if that is the same as the dump before, I'll unlink the older one and symlink it to the new dump. I also want to check the dump stream to make sure it has finished properly. And for good measure lets compress the stream on the fly. SURE, you could do all this after the dump completes but then you have to wait for a lot of disk I/O that the pipes avoid.
If you are like me, you'll want to use python. Note that if you take the stdout from one pipe and read it with more that one (n) other process, each process will only get a fraction of the data, ~1/n. So use a buffer to store the data and write it to each process that needs it.
__version__ = [int(x) for x in "$Revision: 1.2 $".split()[1].split('.')]
__author__ = "Kael Fischer <kael.fischer@gmail.com>"
.
.
.
syslog.syslog(syslog.LOG_ERR,"INFO: Starting mysqldump of %s on %s" % (db,host))
try:
# make output files
outFile = file(outfileName,'w')
digFile = file(digestName,'w')
# make pipes
dumper= subprocess.Popen(["mysqldump","--opt","--skip-dump-date",
"--single-transaction","--quick",db],
stdout=subprocess.PIPE)
grepper = subprocess.Popen(["grep", '-q','^-- Dump completed$'],
stdin=subprocess.PIPE,stdout=sys.stdout)
digester = subprocess.Popen(["md5", "-q"],stdin=subprocess.PIPE,stdout=digFile)
bziper = subprocess.Popen(["bzip2"],
stdin=subprocess.PIPE,stdout=outFile)
while dumper.poll() == None:
# use os.read NOT file.read
# file.read blocks.
# copy output from mysqldump to a buffer
buf=os.read(dumper.stdout.fileno(),5000)
# write buffer contents to 3 different processes
grepper.stdin.write(buf)
digester.stdin.write(buf)
bziper.stdin.write(buf)
# after dumper finishes,
# explicitly shut down input streams
# to other jobs
grepper.stdin.close()
digester.stdin.close()
bziper.stdin.close()
while grepper.poll() == None:
# wait if needed (shouldn't be)
time.sleep(1)
if grepper.returncode != 0:
raise RuntimeError("End of dump not found: grep returned - %s"%
grepper.returncode)
except BaseException, e:
# dump's no good, KeyboardInterrupt, whatever
syslog.syslog(syslog.LOG_ERR,"ERROR: %s : %s" % (type(e),e))
syslog.syslog(syslog.LOG_ERR,"ERROR: mysqldump of %s on %s failed" % (db,host))
# unsuccessful
# put files back where they were
# and exit
# exercise for reader
syslog.syslog(syslog.LOG_ERR,"INFO: mysqldump of %s on %s finished" % (db,host))
Monday, June 29, 2009
python subprocess based parallel processing
This is a jiffy to run a shell command on a number of hosts.
#!/usr/local/bin/python -u
#
# runAllOver.py
# Run a shell command on several machines using ssh
#
__version__ = tuple([int(x) for x in
'$Revision: 1.2 $'.split()[1].split('.')])
__author__ = "Kael Fischer"
import sys
import time
import optparse
from subprocess import Popen, PIPE
HOSTS = ["nfs1","nfs2","compute1","compute2","db1" ]
def main(sysargs):
oneLineUsage = "Usage: %prog [options] '<remote command>'"
op = optparse.OptionParser(
oneLineUsage,
version="%prog " + '.'.join([str(x) for x in __version__]))
(opts,args) = op.parse_args(sysargs)
try:
if len(args) == 0:
raise RuntimeError, "No remote command specified."
except Exception, eData:
print >> sys.stderr, ("\nUsage Error: %s\n" %eData.message)
print >> sys.stderr, op.format_help()
return 1
cmd = ' '.join(args)
print cmd
# make one running pipe object per host
pipes = [remotePipe(h,cmd) for h in HOSTS]
# report the results in turn
for i,p in enumerate(pipes):
print HOSTS[i] +':'
while p.poll() == None:
time.sleep(0.5)
print p.stdout.read()
return(0) # we did it!
def remotePipe(host,cmd,block=False):
p=Popen("ssh %s '%s'" %(host, cmd),shell=True,stdout=PIPE)
if block:
while p.poll() == None:
time.sleep(1)
return p
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
What's cool about that? Well all the processes are running on the hosts simultaneously and that makes it go fast.
Isn't that insecure? Could be, depending on the context. For ways to secure that kind of thing more, read this article by Brian Hatch: http://www.hackinglinuxexposed.com/articles/20021211.html. It was the basis for the intermachine communication in the PHABRIX and most especially prun was built using his authprogs as a starting concept (with greater flexibility and extra security layers added).