Well-defined
Corner Case (Edge Case)
Instantiate
Nondestructive
Single Point of Failure
Nontrivial
Degenerate Case
Extensible
Integration
Non-Linear
State
Canonical
Default
Category: Uncategorized
Choose your Own Adventure (brief)
You are the CTO of a small tech company
- Try to yank the key out using the keychain as leverage. Go to page 22.
- Take the key off of your keychain, leave it in the lock. Go to page 46.
Page 22
It won’t come out! Now what?!
- Yank out the keys with pliers. Go to page 34.
- Take the key off your keychain, leave it in the lock. Go to page 46.
Page 34
Are you sure? Absolutely sure? You could snap your keys! Don’t do that!
- I don’t care. Snap my keys! I want my keys out. Yank ’em out anyways! Go to page 42.
- Simply remove the key from the keychain – takes 20 seconds! Go to page 46.
Page 42
You pull your keys out, and live happily ever after. You win! Congratulations.
Page 46
You get your keys back, but the next day your key is no longer in the lock. Now every single time you go the bathroom, you keep thinking you have keys, but you don’t. So you have to go back to the office and get the office bathroom key. You’re a loser. You lose. Lose lose lose. Why don’t you just pee your pants, loser. You suck.
PHP Modules
Edit – this is a rant I found while looking through my drafts. I have nothing further to say on the issue. I originally wrote it 4/20/06. I think I might have been angry when I wrote it.
WHAT in the FUCK are you thinking when you try and put a thin thin thin wrapper around your shitty C API and try and pass it off as a PHP API? WHAT THE FUCK!?
Net::DNS – a direct port from Perl, where it was a bad idea there. As opposed to looking up addresses, you have to dick around with handles for things and all kinds of inexplicable crazy crap. “Set flag blibbleblabble on outgoing packet by toggling …” jesus!
PHP Ldap – the only differences between ldap_get_values and ldap_get_values_len and one returns char ** and one returns a null-delimited array of pointers to BER encoded structs…WHO FUCKING CARES! Why should this information be even _getting_ to me. I don’t fucking care! I am in PHP – I have arrays and hashes and shit coming out of my asshole! I don’t need your char ** null delimtied fucking bullshit!
Something I figured out a while ago – more important than anything else is the goddamned programming interface. I don’t care if the innards of your code summon angels to perform, before I even make the call, whatever I request – if the interface to request it is:
poo *CREATE_FART_REQUESTOR(void *)
void APPEND_FART_REQUESTOR(poo *)
void *int (struct char[poo] *&->FINALIZE_FART_REQUSTOR(poo *,int request_id,char ******varglpx_r )
Then no one will care.
Health and fiscal well-being: You Fail It!
So I am fat. Not fat like most people are fat, but uniquely fat, in that my arms, legs, chest, back, thighs, buttocks, neck, and face don't show it, but my belly is massive and spherical. I weigh 180 lbs, where my high-school slightly paunchy weight was 160-165, and my gaunt vegetarian weight was 145.
So what we're trying to do about Problem #1 is to join a gym, and go. I've done the first part pretty well. It's just going that's hard. I target going 3 times a week for 30 minutes each. When I go, I just hop on the cross-country skiing machine and tell it to "fat burn" – this keeps my heart rate at around 122 bpm, and cranks the resistance up or down to hold that same heart rate. It's not really particularly brutal or anything, and when I'm done the machine says I've used around 350 calories.
All in all, easy enough, except I don't go. Here are the excuses that I can remember that I've used:
- Website is down, I can't tell if gym is closed or not.
- I'm sick
- Bead emergency, have to fix something on ebay software.
I have already missed my first scheduled "go" this week – yesterday I used the first excuse up there. I have to do a make-up today, then my regular goes on Wed and Fri – or else I'm going to try another tactic.
Since I can't seem to make it to the gym three times for half an hour each, maybe I can make it twice at 45 minutes? And if even that doesn't work, I can try one mammoth "go" at 1-1/2 hour. According to my research, the first is better than the second, and second better than the third, but it also says that you need to do at least 700 calories of work for it to have any effect. And that's an old-person target, I'm not yet that ancient. So I should be doing 1000 or so calories, at minimum.
Regardless of any numeric hand-waving, my weight has remained constant during my 2 months of gym membership – so this week is the final chance to stick with a normal schedule before I have to switch over to one of the crappier ones I have there.
I understand the binary language of moisture evaporators
Blackberry review
Well, I finally couldn’t stand my crappy pay-as-you-go phone, and got a Blackberry. I am a former Treo user, so I was expecting some growing pains and culture shock.
I didn’t run into much.
The BB is a nice piece of hardware – a big plastic slab. I’m a cheapskate, so I got a simple (cheap) BB 7230. With the crappy screen. And (literally) 16 MB of flash RAM. It feels like you could step on it and it would keep running. It hasn’t crashed yet. It’s performance is – adequate, I’d say. You see the hourglass coming up some times, but it’s never so bad where you’re really bummed about it. You can multitask a little (using some fancy keystrokes), but you don’t really want to do that on this particular model, with its 16MB of Flash and 2MB of actual RAM (ew).
The battery life seems absolutely excellent. The device required more care and feeding than I’d hoped for – I did an OS upgrade, and I had to put in some funny WAP settings I read about somewhere to make the SSH client I grabbed function properly.
The one thing – one thing – which is bad, is in fact so bad that I’m seriously considering whether or not to use the device – is: Blackberry Web Client. (aka BWC, or BIS?) It’s super shitty. First off, it only gets my mail every 15 minutes – which is not very nice, but dealable. The thing that really kills me is that it doesn’t seem to synch whether or not I’ve read an email back to the main server. And a good chunk of what this thingee can be useful for me for is to read email, and have it be marked as ‘read’.
Now, it’s possible that it _is_ marking my mails as read, and I’m not waiting long enough (possibly that whole 15 minutes) to let it do so. If so, then I’m happy. I’ll test soon. In fact, how about now? 3 messages marked unread on the handheld. 1 marked unread on my mail client. Will read all three on handheld, should leave all as ‘read’ in both places. As of 1:41pm. OK. Finished as of 1:43pm. Should be synched (sunc?) by 2pm. Or so. Nope, it’s 2:05pm and a new message has shown up in my desktop client, but not on the BB, and the message that I read on the BB now does not show up as ‘read’ on the desktop client yet. Perhaps we have to wait for the synch… Okay, it’s now 2:13pm and it’s STILL not synch’ed. Crap. I think it just doesn’t work. I have IMAP, they just don’t seem to be accessing my mail account that way. I’ll fiddle on the server-side to see what I can come up with. Edit – OK, I’ve fiddled. This Blackberry service is useless shit. I don’t need to read every email twice. This is no way to work. I have fucking IMAP, there’s nothing stopping you from marking them as ‘READ’ (as in the opposite of ‘unread’). Shitheads. Just being shills for stupid pointless ‘enterprise’ mail systems like Exchange. What fucking crap. I mean, I agree, IMAP is an abysmally designed protocol, whose inevitable adoption was actually stopped by its atrocious design.
The help files on the device are (as a client told me) quite easy to access and read, and very helpful to have handy. Brickbreaker is an extremely lame game which is bundled and mediocre.
And the actual Blackberry service is relatively inexpensive – specifically I’m on T-mobile, I’m paying $20/mo for BB, plus another $30 for 300 minutes (and I’m barely going to scrape by this month on those). Sprint was cheaper, by $5/mo, but I’d get creamed on the phone. Whereas this cheapo t-moble blackberry did not cost me very much at all.
So – I dunno what to do. The new low-end Treos came out and I bet I could do pretty well with them. I think I’m now sold on ‘GSM’ as the phone technology of choice for me – smaller phones, better (seeming) battery life, phone calls automatically interrupt data connections (all good things). And I think I like T-Mobile. I do miss my pay-as-you go plan though. I never felt like I was getting robbed, whereas I’ve gone over (probably way over) my plan this month and it stings like hell. I think I heard that T-Mobile won’t do the Treo (680 I believe?) because they’ve had return problems on the Treo line. I don’t blame them. This Blackberry doesn’t crash. I had to power-cycle it once, when I was doing all kinds of crazy multitasking and stuff (my own fault), its battery life is wonderful. Just this blackberry mail service is fucking shit.
I miss little things like my blog posting software, and camera, and other little trivialities that don’t really add up to much. But, most of all – ChatterMail. Ah, old Chattermail. You crashy, but extremely powerful and useful hunk o’ junk. IMAP accounts, marks as read, instant-push email, slurps battery like it’s going out of style. I miss you so, Chattermail. Please come back to me. Please.
Days of Dead Disks
So I had to recover data from my mom’s iBook a week ago. That took a while, and was a pain in the butt.
Sunday, around 9am, my wife tells me that my mail service isn’t working – so I have to go into the city to fix it. And cancel a U-Haul truck ($50 fee) which was going to haul crap from my old place to my new place. I go in, and my server is reporting both drives (RAID) are gone. I reboot, and it says one is gone. Fine, I put in another disk and let the RAID rebuild.
45 minutes to an hour or so later, I look at the server – and the new disk is dead! WTF!? So luckily, I have another, and I put that in. That fails the rebuild after just a few minutes. I called in reinforcements. Another rebuild attempt on another drive – failed. What the hell is going on?! In a fit of desperation, I decide to move the drives out of that chassis into another. Put in a new disk, the rebuild starts…and…no disk errors! It was a bad chassis.
Next day, I have to do data recovery for a client (his home disk had died, whereas his work disk was dying a few weeks prior, but I think my boss did the fix for that one). I use my time-honored technique (next blog posting, better title for it) to get the data off, and fsck the image, and it looks good. Ready to do the restore, just waiting on a new drive.
My boss shows up with a drive at 5pm (thanks, boss). I try to use asr to copy the data and…failure!
At this point, I’m beginning to doubt myself.
I try several different methods – the image file I just created won’t mount anymore. as a ‘crazy thing to try’ I move the image file off of the firewire disk, and onto the new disk, and figure I can try an in-place recovery. As soon as the data is copied, BLAM, the disk image is mountable again. So the firewire disk was failing.
Disks suck. Fucking suck. I’m surprised we trust our data to such awful, spinning, magnetic demonic devices. and I think my own personal good luck with disks has run its course, and I’m getting payback.
How to recover data from a dead or dying Mac Hard Drive
I’ve done this twice now, so I thought I would document it for Google’s sake.
first, dd the drive
Use Disk Utility to find out the /dev/ name of the disk (/dev/disk0s2, /dev/disk1, etc). Click the disk and hit ‘Info’ to get its name.
sudo dd if=/dev/diskname of=outputfilename.dmg conv=sync
the conv=sync bit makes it put zeros where it can’t read the data.
It will take a long time. The more messed up the disk, the longer it will take. You can use the Finder to see how big your .dmg file has gotten and compare that to the disk size for a very rough estimate.
When done, do:
sudo hdiutil attach outputfilename.dmg -nomount -readwrite
it should spit out a new pseudo-device name, like /dev/disk3, for your thing.
You may be able to get DiskWarrior to run on that pseudodevice (though I had trouble, but that was because my disk image was itself on a bad disk(!)). or you can use:
sudo fsck_hfs -f /dev/pseudodevname (-f forces it if it has a journal)
when done, detach using
hdiutil detach /dev/pseudodevname
Now try mounting the disk. If you’re lucky, it worked.
The restore can be done with Disk utility – choose source, and destination (and for fast and friendly block copy, choose ‘erase destination’).
I do command line, usually, so I try to use:
sudo asr restore --source diskimage.dmg --target /dev/newdisknum --erase
The (Actually Helpful) New York Visitor’s Guide
I originally thought of writing a sarcastic, whiny diatribe against the Tourists who plague my beautiful city.
But then I realized, I could actually say something that would be a little helpful to the Tourists as well as to my fellow city-dwellers:
- The Train is going to lurch – when you hear the “ding-dong”, GRAB A POLE. If you do not, you will fall on one of us. We are used to it, and you will embarassedly apologize all over yourself. We will say something short, simple and sweet, like “it’s ok” or something. So, unless you’ve been here for a while, grab a pole when you hear the door chime. Natives rarely even try to stand up on a train without a handhold.
- Ask for directions more often! but quickly – New Yorkers can actually help you – and most of them, if they’re not in a hurry, will be happy to. But you have to ask quickly. Here’s why:
I remember once a couple coming up to me when I was waiting at the uptown 2/3 station. “I’m really sorry to interrupt, but can I ask you a question?” Or something like that the gentleman asked. Christ. So I expected him to say, “My girlfriend and I have gotten lost in the city, and are trying to get back to our home in Nowheresville. Can I have $20?” Instead, he asked, “Is this the downtown 2 train?” At which point my eyes stopped rolling and I said, “Oh! No, you go up the stairs, go across to the other side, and then you’ll be there!” But I nearly told the guy “Sorry, buddy, I can’t help you.” Be quick. “‘Scuse me, this downtown?” We talk quick.
And more often than not, I see people futzing with maps and stuff. Look, just ask, if you see someone who’s not crazy, homeless, or walking very, very fast, ask them, and they’re happy to help. The stupid questions like “Is this uptown or downtown?” Or “Which way is 6th avenue?” we love to answer, because we know the answer, and it’s helpful to you.
- Do NOT walk wide – We are a city of walkers. What if we drove into your town and started having our cars straddle two or even three lanes? You’d shoot us. And sometimes, we want to shoot you for the same offence. Try and be sensitive to the fact that when you’re on our sidewalk, you’re on our freeway. Pull over to stop. Do not stop in the middle. And, most of the time, you’re not going to be able to walk all 7 of you all in a row. New Yorkers sometimes need to be reminded of this as well.
- Represent, yo – You can make wherever place you come from appear exotic, wonderful, and yourself to appear quant and pleasant. Or you can make us think you are all stupid hicks. That means – #1) Be Tolerant – we are a town of every single race there is, and every sexual preference, gender identification, and who knows what else. You may mock people of type X back at home, but here, you can get your ass kicked. I remember seeing a nice gay couple walking down 23rd st, hand-in-hand, and some stupid dude in a suit with his empty-headed bimbos started mocking them. Had there been some leather-wearing type gay dudes there, I should hope the gentleman would have handed his ass to him. And, needless to say, I didn’t like him and I don’t think any regular-type New Yorker would. #2) Be aware of your surroundings – I saw this chick on a train, and she was being EXTREMELY loud, and extremely Southern. And lots of people on the train are trying to have nice conversations and stuff, and she’s going on about Beyonce’s butt or something inane like that to noone in particular. Eventually, a gentleman told her, “Oh, you need to get on the Q train, across the platform,” to which she said (loudly), “Blah blah blah thanks! blah!” When the gentleman returned to his compatriots, they all gave him high-fives. Because he had told her incorrect instructions so she would get off his train. I hate to admit it, but I was proud of this guy, because I’m trying to play on my Nintendo DS or veg. out or whatever, and this stupid chick is preventing me from doing so.
- Go to the middle of the train – this is something you learn over time. But a frequent train-rider can get into the train, walk all the way into the middle of it (farthest away from the doors), and, at his/her stop, get all the way back out again. Try not to gum up the doors by standing right there because you’re terrified about getting off on time. If you have to do that, then at least wait till you’re one stop away, then start moving towards the doors. OK? And at Big Stops like 42nd street, the whole train may nearly empty and you’ll find it VERY easy to get off, even from the middle of the train.
- Let them off the train, then get on – many New Yorkers need to be reminded of this one. Stand aside from the doors, let them off, THEN get on. I’ve deliberately tossed many an elbow to many a douchebag who has stood in the way of everyone getting off the train.
And I have decided I’m going to keep adding bits to this as I think of it, even though it goes against regular Blogulism.
Addendum 1
- Jaywalk! – A bonus here in New York, is you can cross any time the street is clear. Us natives have this down to a science – so you can use the Sheep Method (follow everyone else) or if you feel adventurous, just look to see if cars are coming and cross. This isn’t legal, but I’ve seen people do it in front of cops and they don’t care. If you get yourself killed though, they might get peeved.
- Times Square – We gave up on this place. You can go ahead and walk however you want – wide and/or slow – or do whatever you want there. We don’t go there. It’s yours. Enjoy. And when we do go there, we will curse and try to walk in the street, but too bad for us. The smarter ones just don’t go there.
- Metrocards – These get you on the subway. Watch how everyone else swipes the card, and you swipe at roughly the same speed. Too fast, it won’t work, too slow, it won’t work. “Swipe Again” means you should try again, maybe at this turnstile, maybe another. “Swipe Again At this turnstile” means swipe again, DO NOT MOVE ELSEWHERE! If you get really screwed, talk to the station person and they will let you in. And if you get the 1-day unlimited, that only works for one person. And you can only use it every 18 minutes – trying to use it again it will say, “JUST USED”. And don’t get in the turnstile until you have the metrocard ready to swipe. I hate people who walk up and insert themselves in the turnstile and _then_ start to fumble around for their metrocards. They prevent people from using it and other people from exiting.
Addendum 2
- Starbucks – yes, we have a lot of them. If you have never been to one, don’t let anyone know, because you’ll sound stupid. Unless you’re one of those anti-corporate Brooklynite baseball-cap wearers with an ironic haircut. In which case, you shouldn’t be reading this, and I hate you. The reason I mention this is because I actually witnessed some fellow American having their Starbucks virginity gently removed from them, and it made me cringe. You don’t have to order in Starbucks-ese (Venti Drip, no room. Iced Grande Caramel Machiatto with Whip), they can translate. I like to order in Starbucks-ese because I’m a weenie.
- Making Conversation, smiling, or eye contact – are expressly forbidden. And we like it that way. This is not because we’re cold, heartless bastards, but because we are sensitive human beings, who live on top of eachother and within eachother’s personal space, all the time. If every time you saw a homeless person, your heart broke, you would die here. And in the same vein, if every person you met on the streets said, “Hi, how are you?!” you’d have to say that 2000 times just getting to work. Like I said, we actually can be nice people. We just talk fast.
Long Time
CTO Can
I watched a client fire their CTO. The guy made some decisions I wouldn’t have made, but was basically a good guy. Much better than me on the ‘presence’ and executive-swagger thing. Now they seem to have kinda given up on having one at all, and elevated one of the programmers to a similar effective spot. I’m curious to see what happens.
Blackberry? Treo? what?
I am thinking about getting a Blackberry. Or a Treo. Or something. I just really would like a mobile ssh and mail terminal, and even some web browsing could be nice. I may see a client today who has them, so maybe we’ll see. Strangely enough, for the amount of phone I use (very little) and the amount of Internet I would use (nearly unlimited), Sprint is actually the best carrier for me. But they don’t subsidize their handsets much, and, well, that’s where I’d need some help… I made a little spreadsheet with the total cost over two years of all of the different options – a t-mobile BB is cheapest, and a somewhat-distant second is the Treo 700p on Sprint. I love the Palm Calendar, and can’t live without it. I didn’t really like the Blackberry one (I used a friend’s one yesterday.)
AppsLink NetServOS Whatever
I wrote a letter to the BizDev dude over at 37signals, the guys who wrote Ruby on Rails and Basecamp and stuff. I thought I would ask about the integration idea thing I mentioned like a gajillion blog postings ago, and see if they would be interested in developing to an API. The guy actually ended up responding – and relatively quickly:
Hi Brad-
close enough
Thanks for emailing us.
We’re entirely consumed by our own work on our own products.
Basecamp and Backpack have APIs and you are free to use
them to integrate with whatever you’d like, but that’s the
extent of what we can do with you right now, sorry.-Jason
Which is interesting, and I think kinda telling. I imagine the answer for lots of different services like these would be the same. So perhaps the federated authentication model isn’t something I need to worry about – for now, at least.
I’m thinking about writing up some documentation on protocols – and some basic explanation of how everything works and why – and maybe we’ll see where that goes. I’ve sketeched out some interesting things, thus far.