Monday, September 30, 2013

Baby!

Did I mention I had a baby? I wrote this on my phone - because when will I have time to use a computer?
On Monday, Sept 16th, we went in for an ultrasound and non-stress test to make sure everything was going okay with our late sleeper MiniChaos. The docs said that MrsChaos had low fluid and so we should move to labor/delivery, because we would be leaving the hospital with a baby.  It was surreal.MrsChaos  wasn't in labor or anything, but they were going to induce. 
The Pitocin started up around 2am Tuesday morning and pretty quickly full power contractions started going. Pitocin is a tough labor. Rather than having a gradual ramp up, you just get smacked with full strength contractions. So MrsChaos was basically stuck in bed with full power contractions from 2am until around 4pm.  At that point our doctor told us she had made progress, but wasn't close. So rather than run the marathon, we paused for the night to eat, walk, sleep.
At 5am Wednesday we kicked off again. It didn't take long for MrsChaos to get an epidural. After what we had been through Tuesday, there was no way she could take another twelve hours of that and still have any strength or will to push at the end. After the epidural things became very relaxed and could talk, nap, etc. Wednesday was night and day compared to Tuesday and so much better. Modern medicine and science, you are awesome.
Around 6:30pm it was time to push. 7:48pm or so we has a baby. When MiniChaos came out the doc said "his umbilical cord is wrapped" and I got scared. But it was wrapped around his arm. Then "his umbilical cord is wrapped," but it was wrapped around his leg. Then "his umbilical cord is wrapped," but it was wrapped around his other leg. What a gymnast.
We moved to post-partum by around 11pm and they said we would stay 24 hours and could do a late discharge Thursday. It was a super unrestful night. People kept popping in to take vitals from MrsChaos and MiniChaos. I feel like we got woken up every 2-3 hours.
We asked the daytime shift about our evening departure and they said no. MrsChaos had one high temperature on Wednesday, so they wanted us to stay through the night to make sure all was well, but we would leave first thing Friday.
Friday... ohh Friday. During the shift change the night nurse said we were ready to leave and they should give us the earliest checkout time. The day nurse said, "hmm... we'll see."  We'll see?  Our pediatrician came by and said things looked good. He just wanted the nurse to run the jaundice numbers.
The nurse came back 15m later and said that MiniChaos had a lot of risk factors for jaundice and needed to stay another day.  And... we... broke... down.  It was such a horrible experience of one nurse saying we would be able to leave, and then a shift change, and the next nurse saying we couldn't leave.
I pushed the nurse to explain the risk to me and she showed me the numbers. Did MiniChaos have jaundice? No. Was MiniChaos' bilirueben levels in the high risk area for jaundice? No.  He had some of the risk factors checked: asian, male, breast feeding. Yet we couldn't leave. We felt like we were being held hostage by a proactive nurse. Boy and breast feeding seemed like it should be super common, it was the asian heritage that was pushing us over the edge. (Note: my later research shows the Asian factor only applies if the father is Asian... sigh...).
So we spent one more night there with MiniChaos naked and blindfolded inside the bili light machine. If you search, you'll find pictures of babies soundly sleeping under the lights. Those are lies. When you strip a baby naked, blindfold him, and cannot comfort him - he cries. He cries constantly. So we had 16 hours of MiniChaos screaming. Oh man... oh man...
And it seemed like every nurse/doctor who checked levels was confused why we were there. Ya know, because he didn't have high risk levels. I even walked over to our pediatricians office Friday afternoon and said, "please - is there any option that let's us go home?  Anything at all?!?"  He tried to get us a home biliblanket, but it didn't work out.  After the doctor cleared us on Saturday morning, he said he wanted us to stay until 4pm to get as much light as possible. We decided we were done with the big contraption and just cuddled together as a family with the blanket.
Anyway - we went home Saturday. Finally. Would he have ever moved into a high risk zone?  Who can say. 

Sunday, September 15, 2013

Post Due

Dad... You were like a father to me. - Ethan (Due Date)

I wrote an AppleScript at work that updates my instant messenger status each day with a count down to the due date. Last Friday it started updating to "T-Minus -1 Days." I read that 48% of first time mothers deliver before their due date; the rest deliver on or after. We are the rest category.

It must have been so much harder in the days before the internet. Mrs.Chaos asks me "is it normal" questions all the time and its easy for me to find scientific papers on the answers. While friends and family are quick to supplying anecdotal stories or advice, the truth is just a web search away.

Every morning I wake up, look over and ask "are you in labor?" She replies, "Nope. You have to go to work today." My coworkers are going to be excited on Monday, "T-Minus -4 Days."

Monday, August 19, 2013

eBay Gripes

It was, however, not so obvious that PayPal would taste its first major success by helping people sell Beanie Babies on eBay. - Eric Ries

I've never sold or bought anything on eBay.  I've had lots of people ask me about how it works and I've always told them I don't know, because I don't know.  Many years later I've gotten around to listing 1st Generation Apple TV and my 17" PowerBook G4 on there.

When comparing to other similar listings it makes me sad.  People get a lot of money for these things by filling them with illegal content.  So I see AppleTVs overflowing with pirated movies or PowerBook G4's overflowing with Microsoft Word, Adobe Creative Suite 4, etc.  They selling description lovingly details all of the illegal content and then says, "Content/Software is unlicensed and for demo purposes only.  It is the buyer's responsibility to remove it."

My devices are completely wiped with a fresh install.  The PowerBook G4 has Panther, complete with pinstripes.  I listed them and I even got a $49.99 bid on my AppleTV.  I was stoked about this.  Then 3-days into my auction they got delisted and I was told to call eBay.

I called and they asked me a bunch of identify verification questions and some basic questions about the items I was selling to see if I stole them or not.  Seriously?  I'm selling 5-9 year old electronics with their original boxes for very little money.

They relisted my items - but they are new actions and the bids were lost.  I sure hope someone will bid again.

Sunday, August 18, 2013

Home for the Max

Most people who work at home find they do not have the benefit of receptionists - Judith Martin

I finished up my last week going into the office until Max shows up. Ever since coming back from the Hawaii vacation, I have been going into the office every single week to try and keep on top of the loads of work that keeps piling on. But no more.

Mrs.Chaos is about T-Minus 28 days from the due date - so I'm here to keep a close eye on her. We're working on the final touches at home. The cosleeper is installed next to the bed and it's great for holding my iPad. The carseat base is installed into the back of her car. The hospital bags (labor and post-partem) are both packed and ready. Since the beginning of the year we've joked that if a baby showed up we had a room to put him. Now if a baby shows up - we're prepared for his entrance.

The only thing left on the schedule to complete is Mrs.Chaos' ambitious cityscape cabinet. It's doing great. Everything is cut. Most things are painted. She just a few more layers of paint to go and then it will be time to screw the entire thing together - and that will be the most exciting part. Hopefully we can get it done in the next week or two.

Wednesday, August 14, 2013

Episode.Next and Web Workers

I finished up all the main development tasks for Episode.Next and submitted for Facebook and Dropbox approval.  Both systems approved the app within 24 hours.  I was expecting Facebook to give me a harder time.  Reading through all of their usage guidelines for the "Watch" action, it is really meant for a website like Netflix or Hulu to post the action and provide a link to where you can watch the show.  I am redirect to TheTVDB.  Anyway, it passed.

As I was once taught as an engineer, get it working first, then optimize.  After I got it working there were two major performance issues related to syncing: 1) calling to the Dropbox API to sync everything there and 2) calling to TheTVDB to check for new episodes.  Each of those was taking about thirty seconds.  JavaScript is, by definition, single threaded.  So while those things were doing their thirty second sync, the entire UI was blocked.
I thought I could use Web Workers to solve this problem.  This was the promise of web workers.  Have a long background task you need to execute?  Just use web workers.  The challenge I ran into was that Web Workers exist in their own security context without any access to the document and can only communicate with the main thread by posting Strings back and forth.  I wasn't able to get the Dropbox JavaScript libraries to work inside of the web worker, so I gave up on that approach and went back to the tried and true method.  I made all the syncing operations iterative.  Then I would do one iteration and use setTimeout to surrender control and get it back as soon as the UI thread did some stuff.  I'm still having some problems, so I'm thinking of increasing the log.
I'm still having a great time.

Sunday, August 11, 2013

The Wire Watcher

You can write amazing Web 2.0 and Ajax apps that look exactly and behave exactly like apps on the iPhone. - Steve Jobs
You know how Infomercials start out the same way? "Does this happen to you every time you want to make an omelet?" and then someone tries to flip an omelet and the egg explodes across the entire kitchen and catches on fire. I feel like app pitches start off by saying, "you know how you always have a problem?"  Generally you hear that and think, "I don't have that problem."  Then you tune out.
I built an app.  I built a "scratch your own itch" app.  I watch a bunch of different shows across various sources: Netflix, Hulu.com, NBC.com, ABC.com, etc.  What I needed was a way to keep track of all the shows I was watching, what was the next episode I wanted to watch, and let me know if that episode has aired yet.  Oh - and one more thing, when I mark it was watched I want to post that to Facebook--the same way GoodReads posts when I read a book.  I figured this would be a pretty easy app to build and I whipped together the first version in about two weeks (maybe 20-30 hours).
It's a webapp - but I'm working extremely hard to make it look and feel like a native iOS app.

HTML5 Boilerplate - I started with the HTML5 Boilerplate template which gives a basic HTML layout that is optimized for mobile websites.  It contains links for all the iOS startup screens, Windows Phone 7 Series, all that good stuff.  I've used it as my starting point for my web projects.
Dropbox Datastore JS - While I'm using HTML5 Local Storage for most of the local stuff, I wanted a place off of the device to dump the data and to be able to sync between devices.  I'm using Dropbox Datastore JS to do this and it's fantastic.  It syncs across devices, it's all JavaScript, and I don't have to write an authentication layer or host any server-side code for it to work.
The TVDB -  Love these guys.  This is a creative commons, open source, community managed television database.  It contains episodes, images, and a full API for access.  The challenge with it is that all the pages and the API don't have CORS headers, so I can't make direct calls to it from my webapp.  The pages don't have Facebook Open Graph tags, so I can't post Facebook "Watch" actions directly to it.
Google App Engine - To work around the two limitations of The TV DB I'm using Google App Engine.  I have a very bare minimum of code hosted there.  I proxy the calls to The TV DB from my web app and insert in my API key on the backend.  This is nice because it protects my API key.  I also proxy all the pages to the individual shows and episodes so that if they are requested by the Facebook OG crawler they return proper tags and if you click on them from any other browser they just take you to the TV DB.
For now everything is working properly.  I've submitted it to Facebook for them to approve the OG action.  My expectation is that FB will deny it, but we'll see how it goes.  For now I'm excited.  It's been a long time since I wrote an app that was more than a simple utility.

Sunday, August 4, 2013

I Love You Dropbox Datastore!

With the Datastore API, structured data like contacts, to-do items, and game state can be synced effortlessly. - Dropbox
I had been meaning to play with the Dropbox API and I did and it's awesome.  These days the main types of apps I build for fun are client web apps that run entirely on the phone.  I use HTML5 local storage to fake having a place to store stuff.  That works okay for little bits of data, but I can't really store a lot because you might switch to another phone or you might clear you cache.  What I've always wanted was a nice place on the web where it was really easy for me to just cram some user settings.
So when Dropbox mentioned they had released an app API and that there was a JavaScript API interface my heart raced!  RACED!  It's been out for a few weeks, but I finally got a chance to give it a spin and it is EXACTLY what I have always wanted.  It's amazing!

I've been working on a web app that lets me tracked all of the TV shows that I'm watching and what episode I am on and I've needed a way to sync it across devices.  I was going to build some simple back-endy stuff on Google App Engine, but this just solved my problem.  Within about 15 minutes of work I had Dropbox API working and was syncing my app data into Dropbox.  SO AWESOME!