zmugfs shows readonly (sub)categories

I kept fighting fuse.Direntry. When I tried:

for n in node.get_nodes():
     yield fuse.Direntry(n.path)

I would get NOTHING! but if I created a simple test list it would work:

f = ['foo', 'bar', 'path', 'cheese']
for i in f:
    yield fuse.Direntry(i)

It was confusing until I notice the only difference was that n.path was a unicode string while my test list were ascii stings. I thought to myself, “nah, that can’t be it”. But what do you know! I made this change:

yield fuse.Direntry(n.path.string('/').encode('ascii'))

Not sure if that will be the final code, IMO fuse.Direntry should work with unicode strings. But none the less, the result is a magnificent readonly view using ls and ls -l.

zmugfs shows ls

python’s default argument values

I’ve been trying to track down a bug for a couple days now with zmugfs. I’m caching the tree structure returned by smugmug.users.getTree. Here’s my Node class:

class Node(object):
    def __init__(self, path, inode=MyStat(), children=[]):
        self.path = path
        self.inode = inode
        self.children = children

To a newbie like me, this looks perfectly fine. If no inode is passed in create an instance of MyStat(), if no children are passed in create an empty list. Well guess what! That’s not how python works with lists. If you do what I did above the children list is shared! Imagine my horror when each Node has a reference to ALL of the children of the other Nodes. EEK! A few minutes of googling and I found this page:
4.7.1 Default Argument Values.

I changed the constructor of the Node class to be as follows:

def __init__(self, path, inode=MyStat(), children=None):
    self.path = path
    self.inode = inode
    if children is None:
        self.children = []
    else:
        self.children = children

This fixed my problem.

Cool Marine

I got this in my inbox this morning. I don’t like to forward these around so I decided to just post it to my blog.


A United States Marine was attending some college courses between assignments. He had completed missions in Iraq and Afghanistan.

One of the courses had a professor who was a vowed atheist and a member of the ACLU.

One day the professor shocked the class when he came in. He looked to the ceiling and flatly stated, “God, if you are real, then I want you to knock me off this platform. I’ll give you exactly 15 minutes.”

The lecture room fell silent. You could hear a pin drop. Ten minutes went by and the professor proclaimed, “Here I am God. I’m still waiting.”

It got down to the last couple of minutes when the Marine got out of his Chair, went up to the professor, and cold-cocked him; knocking him off the platform. The professor was out cold.

The Marine went back to his seat and sat there, silently. The other students were shocked and stunned and sat there looking on in silence.

The professor eventually came to, noticeably shaken, looked at the Marine and asked, “What the hell is the matter with you? Why did you do that?”

The Marine calmly replied, “God was too busy today protecting America’s soldiers who are protecting your right to say stupid shit and act like an asshole. So, He sent me.”

911 Math Call


You have to be very explicit when telling kids what to do and not to do. If the police was not allowed it needed to be listed in the exceptions clause 🙂

The Starfish and the Spider

I finished “The Starfish and the Spider” last week. Most of my friends and family will know how big of an accomplishment this is as I don’t read many books. I usually get bored or distracted by them. I prefer the newspaper and magazines.

The book talks about how starfish organizations (those that are decentralized) can be very powerful and adaptive. While spider organizations are very rigid and have single points of failure.  In short, it describes how companies which need to be centralized like spiders, can take lessons by decentralizing. I highly recommend this book.

Trans Am in the shop again

Friday night on the way home I stopped by McDonald’s to get some food for the family. Because the car overheats in the drive through, I pulled into a parking space. On Monday, the car mysteriously had a difficult time starting, but it has start both in the morning and evening ever since. So I didn’t think much of it that night. Well, after I got the food, the car wouldn’t start 😦 I got the hard to crank noise and the “click click click” of a dead battery.

On Saturday, I went to jump the car but I got nothing. I tried the correct way of jumping: positive and negative on good battery, positive on dead battery, negative on ground. NADA! So I connect the negative to the dead battery as well, again NOTHING! No matter what I tried that day the car wouldn’t start.

My layman’s diagnosis: dead battery and bad starter. Might be a bad alternator, if not I’ll have to return the one I bought Saturday. Now the problem of how to move the car.

I apparently let my AAA membership lapse in 2005 (that’s a good sign which means I haven’t had to tow the car in 2 years) 🙂 I called to renew with the hopes of using the service on Sunday. I was told there would be an additional $35 fee on top of the $10 signup fee plus the cost of membership which runs at $42 for basic and $69 for premium. I had premium service before: $69 for 100 miles free towing is well worth it. My cost for towing would be either: $87 or $114. I decided to call Ronnie White’s towing here in Wake Forest. I was told on the weekend’s it’s a $65 cost. That’s cheaper than my AAA membership, I opted not to renew right now. Ronnie White called back Saturday night and suggested I get it towed on Sunday where he’d do it for $40!!! I replied, “that’s perfectly fine with me! and cheaper than AAA“. The car is now at Wake Tire to get repaired.

It’s unfortunate, but I think most of the problems I’m having with the car that past 2 years all stem from the accident I had in 12/21/04 😦 Here’s a list of the things I think are busted on the car:

  • no A/C
  • clogged catalytic converter (clanging sound around the cat and very poor gas mileage)
  • not a very strong start
    • starter
    • battery
    • alternator (if battery wasn’t charging)
  • ignition related
    • optispark distributor (PITA to replace) 😦
    • ignition coil
    • spark plugs

I have some of the parts already which I was planning on doing sometime ago but never did it. I bought some MSD spark plug wires, NGK spark plugs, and a new MSD ignition coil.

Let’s hope it doesn’t cost too much.

AMD 64 x2 4200

My AMD 64 x2 4200+ CPU came in today. YAY!

Before:
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 47
model name : AMD Athlon(tm) 64 Processor 3200+
stepping : 2
cpu MHz : 2150.005
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up pni lahf_lm
bogomips : 4301.29
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc

After:
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 35
model name : AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
stepping : 2
cpu MHz : 2365.010
cache size : 512 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm cmp_legacy
bogomips : 4731.40
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp
----------------
processor : 1
vendor_id : AuthenticAMD
cpu family : 15
model : 35
model name : AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
stepping : 2
cpu MHz : 2365.010
cache size : 512 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm cmp_legacy
bogomips : 4729.35
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp