Developer Resources: Programming & Computer Science Books

One of the things those of us who don’t go through a traditional computer science program miss is a strong foundation in the hard science of computers.  I don’t have a really strong algorithm, programming language design, or compiler background, but I want to learn.  A few months ago I was geeking out with Rajeev Pandey, one of our Distinguished Technologists at HP Cloud (and all-around great guy), about how programming languages are like human languages and how they color our perceptions of the world.  Rajeev mentioned that he could probably come up with a list of the top 5 programming language design books he’d read, and I jumped on it.  I got that list from him a few weeks ago, he said it was fine for me to share it, so here it is on Amazon.  I’m especially interested in reading The Recursive Universe and The New Turing Omnibus.  Enjoy!

Meditations on Sleep

How you sleep is a secret.  You can’t tell from walking next to someone on the street if they can drift off in seconds while the lights are on and the TV’s blaring, or if they need a sealed cocoon of solitude kept at an exact temperature with no piercing noises or lights.  Well, sleep doctors might.  I’ll ask mine the next time I see him.

Based on the totally non-scientific notes I’ve taken from since I’ve started dealing with my sleep issues, I can say that a lot of people can’t sleep at night.  Some people have full blown sleep apnea, and I really feel for them, but I think there are a lot more who just can’t shut down at night and drift off.  Maybe ten thousand years ago we could have, but now that we’re in the big cities with the job stresses and the always-available entertainment and the ten thousand projects going at once, we’ve lost that ability.

My journey towards trying to get better sleep started when I moved out of my parents house after high school.  I’d gotten a pretty good gig doing consulting development at Whole Foods, and had some money to spend.  I figured that since I’d probably spend at least a third of my life in it, I went a little crazy, and bought this:

The Bed

This is actually the short version of The Bed (note the capitalization), the first version had full height box springs.  I’m 5′ 10″ and I felt like I needed a ladder to get into it.  Our house in San Marcos at the time was a 800 square foot (if you measured the outside of the building) 2 bedroom.  There was barely enough room in the biggest bedroom to walk around it.  It was the most wonderful thing ever.

I’m one of those people whose brain refuses to shut down.  Given normal everyday stresses, I will lay in bed, awake, till 3 or 4 in the morning before finally falling into a half-sleep.  If there’s something urgent happening early, or I’m wearing something scratchy, or there’s a strange noise, or there’s too much light I might not sleep at all.  I want to, by body likes to be in bed, but when I close my eyes it feels like someone hits fast-forward on the VCR in my brain and I can’t slow it down.

Acquiring The Bed was a great first step in solving some sleep problems.  It was a Serta double-sided pillowtop, and I think it set me back $3,500.  It was probably the best $3,500 I’ve ever spent, but even it wasn’t enough to guarantee sleep.  I still have problems, and between the time I started writing this post and when I actually finished it, there were a lot of nights of no sleep.

So in the interests of helping out someone else who might share my problem, here are a few things I’ve tried, and some comments on them:

Environment

I like it dark and cold.  The colder the better, really, but usually in the high 60’s.  This can be expensive in Texas.  If I were clever I’d have an in-room AC unit and only cool off the bedroom.  White noise is good, but those tinny little white noise generators just don’t do it for me.  I need base, I need rumble.  The circulator fan in our AC unit is right next to the bedroom, and for years I slept about 4 feet away from it.  Now I have a small air purifier next to the bed that I run on medium, which does a decent job.

For a while when our daughter was small and in the same room with us my wife wanted to have a night-light, which drove me up the wall.  Fortunately now our daughter’s in her own room.  The baby monitor we use throws off a really bright light, but some things you can’t avoid.

The Bed

Finding a really good bed can be hard.  The market is designed so you can’t do real comparisons, and even with a 30 or 90 day money back guarantee, who wants to go to the trouble of returning a giant mattress?  We bought The Bed at a dedicated furniture store, and paid a lot of money for it.  We bought our second bed at Sears, and got it on a big sale.  The first bed was great, the second bed isn’t great at all.  You can’t compare list prices between stores, sales don’t really matter if they’ve just marked the cheap one up a bunch.  Go to a reputable place, get some advice from friends, and lay on them for a while.  I like really soft beds, they’re pretty hard to find.  Don’t give up, you’ll be living with that thing for the next 10 years.  Keep your purchase and warranty information.  Scan it, take a picture with your iPhone, whatever.  In 8 years when the springs start popping out the side, you might be able to get a new one free.

I’ve heard that foam beds are hard to… procreate on.  I’ve never bought one, I don’t really know.  I like giant, squishy but not too squishy pillowtops.

Doggie SleepHaving a good bed is a big deal, and having a good bed-frame can be important, too.  Right now we have a barely-held-together craigslist bed frame, and probably need to trade it in for something more supportive and stable.  If I feel like I’m on an incline or if there’s a weird aberration in the bed, that’ll keep me up.  Like I said, a princess.

The Pillows

Having a good pillow is key.  I like big squish-able down pillows, because I sleep on my stomach or side.  IKEA has a great selection for cheap, so you can try them and not feel guilty.  Buy extras.

Preparation

My sleep doctor’s advice is to keep the bedroom as the place you sleep, don’t watch TV there or play on your devices or read books.  I’m not good at following advice, and pretty much do all of these things.  If you’re having trouble, it could be something to try.  Meditation and breathing exercises work for a lot of people, I haven’t had success with it.  The force is not strong with this one.

Support

Having a partner who gets that you’re lying in bed going crazy every night is a big deal.  For a lot of people sleep issues aren’t something that ebb and flow, every night is a battle.  It can be really hard to be responsible for stuff early if you tossed and turned for hours the night before and only got 3-4 hours of unhappy sleep.

My wife has the ability to fall asleep anywhere.  She’s fallen asleep during conversations with me, while playing games on her iPad, I think she could probably sleep standing up.  I’m incredibly jealous of that ability.

Some couples who aren’t able to deal with sleep problems, especially snoring, sometimes sleep in separate bedrooms.  I get that it’s a solution, but it seems kind of unfortunate.  When we travel I find that we only really fight over the covers, so I always call downstairs and get an extra comforter sent up, and we use two on our bed at home.  The bonus there is that hers has a warmer fill and mine is lighter, so we’re both happy with temperatures.  This isn’t the TV sitcom ideal of mom and dad in the perfectly made bed straight out of the catalog, but it works for us.

I usually get my best sleep, almost lucid-dreaming style, after my wife’s gotten out of bed in the morning.  That means that most of the time she takes care of the baby and gets the household going.  That’s a big deal, and I really appreciate it.

Pharmacology

I was raised to hew to the rugged individualist ideal.  Drugs are a crutch, you came out of the womb the way you should be, etc.  Eventually my wife convinced me to talk to my general practitioner about it, and she prescribed be something called clonazepam.  It’s a great little drug, and for the first time in forever, I felt normal.  I’d just sort of drift off to sleep, no muscle twitching or anything.  Alas, it’s habit forming, so it isn’t prescribed for long-term issues.  Eventually when I started going to the sleep doctor he had me try zolpidem (you might know it as Ambien), it’s probably the most popular option and is available in a generic.  It has a long half-life, though, and it made me feel groggy in the morning.  Eszopiclone (Lunesta) gave me a weird aftertaste.  Eventually we settled on zaleplon (aka Sonata) which has a much shorter half life and is lighter.  My doctor says he uses it if he wakes up during the night and can’t go back to sleep.  The only downside is for those days when your brain’s really going and you have a big presentation or early meeting, it’s pretty much useless.

Food

Food is a killer, and late night eating from sleep issues is a big reason why people gain weight.  It’s really comforting to have a filling snack after laying in bed for 3 hours, your blood goes to your stomach, you get the itis, but it’s terrible for you.  Late night eating is one of the things that concerned my doctor the most.  I’m not sure if I have much advice here, except that we don’t eat things we don’t have.  That leftover fried chicken isn’t lasting till morning, but if the chicken isn’t there, it doesn’t get eaten.  I don’t drive to the store at 3am, I just go back to bed.

Vacations

That Bed is Broken
That Bed is Broken.  Like, literally.

Travelling can be tough when you can’t sleep, but often the increased activity can make it easier to fall asleep.  Don’t forget your meds, like I did on my trip to PyCon.  I felt like a zombie all weekend.  If you don’t know about the hotel chain and have space, pack a pillow.  Hilton’s pretty good at it, as are most boutique hotels.  I always crank up the AC when I go to sleep, both for the noise and for the cold.  I’m lucky enough to be able to afford nice hotels.  When I was in Paris several years ago we booked the cheapest hotel we could find, and when we got to our room the bed was actually broken.  I think we’ve stayed in a few places in Mexico where the beds were almost literally an exercise mat on top of concrete.  Vacations are expensive, book a nice hotel if you can.

In Conclusion

If you have sleep issues, you’re not alone.  There are sleep doctors, and some good options.  There’s no magic bullet, though, so if your partner has sleep issues, give them a little slack and support them.  It’s a tough thing to live with, and it can make living a normal life really hard.

If you have some tips or tricks, please share them in the comments.  If there are a few, I’ll add them to this post, if there are a bunch I’ll do another one and link it from here.

Sweet dreams.

Post Script

This post originally had a different opening and title.  I was curious how people would react to it, as I’m stretching myself more as a writer.  I think the general reaction was ‘”That’s probably spam,” or “Good grief, I really don’t want to read that.”  Whoever would have gotten the joke probably has, so I tweaked the intro to be more on point.  In any case, here it is:

I’m a Little Princess

I’ve always known I was different.  I know regular people.  I see them all the time on TV and in movies.  They talk about their normal lives, their simple problems that seem so solvable, and I just can’t relate.  I wonder if they know how lucky they are, to be exactly who they need to be, to not be plagued by this.

I’m lucky too, I guess.  I have a job that lets me work from home and pass for normal.  My wife’s very understanding, probably more than a lot of women would be.  I know other people share my secret.  I read between the lines in their tweets, or see their living situations.  I’ve seen doctors, and taken medications, and it helps a little.

When I finally moved out of my parents house, I made some bad decisions.  I thought I could get a cheap fix, just some slapped together left over parts, but it was awful.  Finally I had a run of good paychecks, and I went to the store and plopped down more money than I’d paid for anything but a computer or a car to buy the ultimate solution… this:

Being Burgled

I don’t ask for audience participation very often, but today I’d like you to do me a favor.  The next time you’re home, walk around and take pictures of every room in your house with your cell phone.  Pretend you’re documenting the place for when they make a movie of your life.  Feel free to cast your favorite Hollywood stars as the main characters.

These photos will be really valuable if (or perhaps just when) someone kicks open your front door and steals your stuff.  It doesn’t happen very often, but in our zip code it happened 541 times in 2011.  There are about 35,000 residences in our zip code, which means about a 1 in 65 chance a given house will be broken into.  Last Tuesday it happened to us, while I was presenting about Software Bot Platforms at SXSW Interactive.

While you’re taking pictures of everything, make sure you have photos of everything that’s worth over a hundred bucks or so, especially those TVs, PlayStations, Xboxes, and the like.  I’d suggest you flip those things over and take pictures of the serial numbers, too.  That information’s really hard to dig up once they’re gone.

Front DoorLets say someone does decide to break into your house and steal your stuff.  Most burglaries happen through the front or back door, just kicking the thing in (or finding the key you left under the mat or rock).  If you’re like most people, when you installed your front door you might have used the cheap screws and shallow deadbolt.  If you don’t know, unscrew the screws.  If they’re shorter than 3 inches, replace them with nice strong 3 or 3 1/2 inch screws from the hardware store.  If you’re leaving the house, always lock the deadbolt.  The handle latch can be pried open with a screwdriver, or kicked open with one swift kick.  Most burglaries happen between 10am and 3pm, prime “I’m just going to leave for a few minutes” time.  If you have a really cheap deadbolt, think about upgrading to a grade 1 or grade 2 deadbolt.  If you’d really like to secure your front door, consider a metal reinforcing strip.  They make them for french doors, too.  If it takes more than a few minutes to get your door open, they’re probably going to leave.  You can drive yourself crazy researching bump key resistant locks, but if you really want the best, you can spend quite a bit.

I’d guess the people who broke into our house were inside less than five minutes.  They look for houses that are easy to get away from.  We live on a corner two blocks from major north/south and east/west arteries.  They’re probably going to hit your bedroom first, they’ll pull out the drawers in your night stands (looking for jewelry or guns or small electronics).  Maybe like our break in, they’ll grab a random bag to store their loot.  Maybe a bag with a lot of memories to you.  After the break in you’ll marvel at the things they didn’t take, the jewelry box they didn’t find, the cameras or hard drives, but some things will still be gone, and inevitably they will be things you care about.

livingroom

Then they’ll hit the living room.  They’ll grab things that are easy to sell, like your TV, your Xbox and Playstation.  They’ll clear out your collection of Xbox games.  Later you’ll realize that while the TV and devices are replaceable, the save games sitting on that Xbox’s hard drive are not.  The three playthroughs of Borderlands 1 and 2 you did with your wife, with all the awesome characters and loot?  All gone.  The hours you spent with your team in Mass Effect, and how you were a couple hours from the end, eagerly awaiting the last DLC?  Gone.  You’re probably not going to finish Assassin’s Creed 3 now, and thank goodness you never even started Skyrim.

Your daughter may point at the place the TV was and say “uh oh”.  The first couple of times it’s cute, but it’s also painful.  Just be glad she wasn’t there when they broke in.  You’ll probably also spend some time wondering why they would bother to take her new pair of red sneakers.  But then you’ll realize that the people who broke into your house might have kids too, and then you’ll just be sad for the world.

They’ll do really strange things, like take the Xbox from your living room but leave the power supply, and take the power supply for your other Xbox in your daughters room but leave the console.  Of course, the power supplies are different, so you don’t even have one working Xbox anymore.  It’s kind of senseless.

They’ll grab the work laptop off your desk in the office, making a giant mess in the process (as if your office wasn’t a mess enough already).  But they’ll graciously pull your USB VPN key out of it, and drop it on the floor before they leave, which almost makes you think that this was a Jason Bourne-esque black bag job and they’ve installed keyloggers and microscopic cameras everywhere to infiltrate your work accounts.  That would explain why they didn’t touch your wife’s laptop on the desk opposite.  But now you’re just talking crazy.

When you get the call that someone broke into your house and took all your computers, you immediately think the worst, that everything is gone and in the hands of mafioso or triad hackers who intend to destroy you digitally as well.  This is a good way to think, because it probably isn’t far from the mark, and certainly won’t be over the next decade.

In our case we were lucky.  Irma’s personal laptop was covered by papers, so they didn’t grab it.  My main work laptop was entirely encrypted, and my other work laptop didn’t have anything loaded on it.  They didn’t get my Time Machine backup drive, from which they could have reconstructed my entire life.  My laptop was with me, as were our iPads.  They got an old phone we were using for audio streaming, and the old iPad we used as a white noise generator for our daughter, but those didn’t have anything special on them.  They didn’t steal our network attached storage device, which would probably be a treasure trove to the wrong people.  In the end, we were very lucky.

But this could just as easily happen to any of you, so please, do me a big favor…

Your To-Do List

1. Reinforce your doors.  Always use your deadbolt when you leave the house.  Both front and back doors.  If you have a sliding glass door in the back, figure out a way to secure that thing.  Don’t leave any of your windows unlocked.  Don’t leave a spare key out in anything like an obvious place.  Lock the door into your garage when you leave, garage door openers are easy to fake out and even manual ones are really easy to open.

2. Catalog all your stuff, it’ll make the insurance process easier, and you can do it in a half an hour with your iPhone.  Serial numbers for anything that has them.  Entire room shots.  You never know what they’ll take.  If you can, set a reminder to do it again in 6 months.  Google Calendar is great for that.  Back up those pictures on a PC or in the cloud.  Make sure you have a passcode lock on your phone, those things are slipperier than a bucket full of eels.  Same with your iPads or other personal electronic devices.

3. Make sure you back up your machines.  We use CrashPlan.  It’s money well spent.  If you have a Mac and have a Time Machine backup (and you should), be sure to encrypt it (if it’s local) or hide the drive in an inconspicuous place (if it’s over a network). If you have a Mac, also turn on FileVault, so even if they get your computer, they can’t read the contents of your hard drive.  Always require a password to wake from sleep or screen saver or login on boot.  Pick a good password, something you don’t use anywhere else.  Make sure someone else knows it, in case you get hit by a truck.  If you have a PC, here’s an article that may help.  If you have an Xbox and an Live Gold account, turn on Cloud Saves and use them.

4. Make sure Find My Device is turned on for all your iPhones, iPods, iPads, and Macs.  You can wipe a machine remotely if it gets out of your hands and is still connected to wifi.  Make sure you can login to iCloud and all your stuff is listed.  One of my friends recommends Cerberus for Android.

5. You can secure your stuff a bit.  If I’d had a cable lock on my TV, and they hadn’t been able to just lift it off the wall mount, it would probably still be here.  There are also locks for your laptop, but that’s a pain if you like to be mobile.  If your laptop lives on your desk, it might be worth it.  Some larger TV wall mounts have holes for locks.  If yours doesn’t, you might be able to thread a cable lock through it and make it harder to pull off the wall.

6. If you live near Austin and would like to fix up your security but don’t know how to do any of this stuff, are scared of screwdrivers, have a phobia of the hardware store, etc, let me know and we’ll get it done.

Ergo

In the next day or two we’ll pick up a new TV to replace the one from the living room.  My daughter will be able to watch Sesame Street again.  We’ll probably get another Xbox, and maybe another copy of Borderlands 2.  I don’t think I’ll ever go back to Mass Effect.  That save game was their world, I can’t re-create that.  We’re probably going to install a camera in our entry way that watches the entry way and street, something that even keeps running when the power’s cut.  Of course then there’s the back door, or a window.  Your home isn’t a castle, it’s a barely held together shed with a bunch of memories and possessions inside that anyone with a reciprocating saw and 2 minutes of time could compromise.  If someone wants your stuff, there isn’t much you can do to stop them, which in the end is the terrifying thing, because all we’d really like back is our peace of mind.

Killing Hung OSX VPN Connections

This thing is a menace:

The endlessly scrolling disconnection state when OSX’s Network Connect VPN client goes sideways.  You can’t reconnect because it just sits there trying to disconnect.  You can’t kill it in the gui, but it turns out, you can get rid of it.  Just kill -TERM or kill -9 the ppp process in the terminal.  Then you should be able to reconnect without rebooting your machine or switching network locations.  It probably leaves some messy stuff sitting around your routing tables, but that’s what regular reboots are for.

A $229.95 Nearly-Fanless Router PC

Sometimes you need a machine to pass network traffic from one interface to another and fiddle with it.  You may need to route traffic to your network, or inspect network traffic in a transparent bridge.  In my case I needed a fake DHCP client to hold on to public IPs from AT&T U-Verse so I could assign IPs at will behind it.  Whatever you need to do, the requirements brief is generally the same:

  • Low Power Utilization
  • Quiet Operation
  • As Few Moving Parts as Possible
  • Small Size
  • Near Wire-Speed Performance for Gigabit Network Traffic
  • Cheap

There are plenty of embedded systems with multiple network ports that can run stripped down versions of linux and boot off a CFcard.  They win in the small category, but they’re all consistently more than $300 or are older devices that can’t approach gigabit speeds.

An older PC would work fine, especially if it’s onboard ethernet was gigabit and wired to a PCI Express bus.  The theoretical speed limit of a 32bit, 33mhz PCI card is just under the theoretical throughput for Gigabit Ethernet, so if you throw more cards on the PCI bus, you’ll increasingly limit your throughput.  That goes double if you’re using a PCI based drive controller with any kind of real traffic.  An older PC probably won’t be small, though, and it’ll have lots of moving parts.

I ended up spending $229.95 on my solution.  It features the following:

There are cheaper options for nearly all of these components, but this felt like the best price/performance compromise.  The box is fast enough that if I wanted to, I could re-purpose it into nearly anything.  It also has enough performance overhead that I could give it an additional task without worrying about crippling my network performance.  I installed Ubuntu 11.04 Server on it (via a temporary CD-ROM Drive), so I can apt-get install anything else I need.

Installation is fairly straightforward, though I’m not sure if I’d use the same case if I did it again.  I needed a case with a PCI slot (there are PCI Express Mini Full ethernet cards, but they’re really expensive and rare), and there aren’t many that don’t include a full-size CD-ROM bay.  The case is probably twice as big as it needs to be.  You mount the motherboard with four screws, plug in two power supply connectors, slot the PCI card, slot the memory, plug in the front-panel connectors and the SSD’s SATA cable, mount the SSD somehow (I just screwed it in on one side), plug an SATA power cable into the SSD and you’re done.

The system’s quiet enough that I can’t tell if it’s really making noise.  There’s one large fan on the underside of the power supply.  It’s the only moving part in the system.  The system uses around 28 watts of power when operating, and from power button to login prompt is around 23 seconds.  A good half of that is in the bios.

Some pictures: