Thursday, October 16, 2014

Software Development is Obviously Hard

Look at Apple's recent iOS 8.0.1 release that broke cellular.
Look at (any company's I have used) Wi-Fi or Bluetooth stack and how flaky it is every other release.

The technology we use, rely on, love, and spend a lot of money on each day is a big let down when it fails. For non-techies I hear them blaming themselves. They must not be using it right.

Here's a secret though, most times when it is not working, but it worked yesterday or 5 minutes ago, it isn't you, it's the gadget. How many times have you cycled your WiFi or Bluetooth off/on to try to fix connectivity? Too many.

I feel for the people that don't know this much (you sometimes have to reset things).

It used to be a big joke, and I made it plenty of times, that you had to restart your Windows PC daily or whenever it started to act strange.

The bigger joke today is that we have to do that to the device in our pocket more often than we care to admit.

I always think, maybe it's me and the stuff I am interfacing with each day. Bluetooth headsets, in-car bluetooth, switching multiple networks, installing/uninstalling apps. My day to day usage of mobile devices is a little more extreme than the average user I figure and so I run into "edge cases" all the time.

Or maybe, we just need to spend some more time polishing our software before pushing it out the door.

Friday, October 10, 2014

DerivedData and xcodebuild

If you use Xcode you know about DerivedData. If you don't know DerivedData, you don't know Xcode.

If you are setting up xcodebuilds from the command line, say for continuous build and integration (CI), then you want to make sure you are using that command line the best way possible. Some things I keep running into as I see people's build systems are:
  • Running out of space due to a backup of old DerivedData.
  • Build performance hanging, due to a backup of old DerivedData.
  • Unexplainable build failure, solved by deleting, you guessed it, DerivedData.

If you use the command line for builds then save yourself a lot of trouble in the future. Start using the xcodebuild option -derivedDataPath.

Here are the docs on it:
-derivedDataPath PATH                     specifies the directory where build products and other derived data will go

That one option huge significance. Here are some reasons why I use it and convert build systems over to this option:
  • I can store the DerivedData in the temporary source workspace of automated builds (like CI builds, automated test runs, etc.) When the workspace is cleaned up the DerivedData goes away and net disk space should be 0 at the end of the build.
  • With no shared DerivedData between builds the build performance does not drop due to large DerivedData folders.
  • Without a shared DerivedData folder I see much lower instances of unexplainable build errors. This means less cleanup, less build host reboots, etc.

Personally, I am very interested in how remote builds with Mac OS X Server and Xcode have improve the build process for automated builds. Until I get the chance to put such a system together, for now and for legacy build systems, I will use xcodebuild -derivedData to improve build systems I have to work with.

Wednesday, October 8, 2014

Make a Swift Based iOS App Crash

I am writing an app for a contract where one of the deliverables is that the app must demonstrate various crashes.  Of these various crashes, one must be an application crash.

On top of that I am writing the app in Swift (about 80% Swift, 20% Objective-C libraries not ported to Swift).

It shouldn't be too hard to crash a Swift app hey? Well, if you follow Swift guidelines your app should be pretty stable since the language has been designed to force devs to be safer in their use of the language. That's not to say that misunderstanding the language or forced unwrapping of optionals that could be nil will make your app any less crash prone.

So let's break the rules, get unsafe in our use of Swift and crash this app.

I decided to go with this piece of code:
var crashWithMissingValueInDicitonary = Dictionary<Int,Int>()
let crashInt = crashWithMissingValueInDicitonary[1]!
This produces a crash with the following error:
fatal error: unexpectedly found nil while unwrapping an Optional value
The reason is this:

  • Line 1 is creating an empty dictionary with Int keys and Int values.
  • Line 2 is Force Unwrapping the optional dictionary value with a key of 1. Nothing has been added to our dictionary yet though so this means we will get a nil. Assigning this nil to a constant value (let) and we get a runtime exception, crashing the app.
So, there is one way to write a bug intentionally to crash your app.

Monday, September 29, 2014

The Walking Dead

Well, I finally caught up on The Walking Dead. I read a number of the comics and figured I was
good. I read the comics, what would I get from the show. Being that I watch little to no TV I had no real desire to watch the show.

Then too many people told me it was different and it was worth seeing. I finally gave in and started to binge watch it this summer while Michele and the kids were on a trip and I was stuck home painting the house and working at a new job (no vacation time for me).

My summary of the first season is. This is just a drama with Zombies thrown in. Look, people not getting along. Tension. Zombies. Tension. Not a real, hook me season but it was good enough and I was told wait for Season 3. Also, pretty similar to the comic.

Ok, Season 2, now we are talking. Things still similar to the comic. Enough divergences that I was wondering when Shane would die. Giving me a big hook. I liked how they started to amp up the tension and the season finale was excellent. I was so glad I did not have to wait long to start Season 3.

30 seconds later, hit Season 3, Episode 1 on Netflix and we were in. Season 3 did not disappoint.

It was great. The addition to the story with the competing Woodbury was excellent. I liked the twists it added.

Now one aside. I do like to think that humanity would not turn to such shit as in the show.

What I found interesting throughout the seasons is that the characters meant to be most unlike me, Daryl and his Brother (but more Daryl) are the ones I truly connect with. They aren't stupid. While all the other "city-folks" are running around crying about the end of the world, these guys are scavenging and killing Zombies without a blink of an eye. The world has changed and you better drop your I'm too good for this quick or die is what they show. I like to think people would react this way, but maybe that is just me.

I guess by this admission, there is more Redneck in me than I figure. In reality, it's just the writers trope that people are stupid and would take a long time to adjust to a fight for survival. The counter-point for most of the characters are two guys who seem simple but in fact have their shit together. So, ya it's TV and the stupidity makes for tension and "good TV" I guess.

I finished Season 3 a week or so ago and I am getting the shakes from missing "my show." But last night, Season 4 was unleashed on Netflix in prep for the return of The Walking Dead, Season 5.

So, now I am binging again, waiting for the next season. Who will survive?

Thursday, September 25, 2014

Describe yourself in an eye-catching 150 chars or less

I just applied to a full time position that wanted me to describe what makes me unique in 150 characters or less.

Here's my shot at that:
I've flown a plane with an electrical failure at night, watched life float pass pinned to the bottom of a river, and I still got the job done.
I've written about the night flight electrical failure in an earlier post. The river story is for another day ;-)


Wednesday, September 24, 2014

Here's a Surprise, I am Behind The Tech Curve

There used to be a picture of me in the dictionary under early adopter. I stood in line for game console launches, game launches, device launches, etc. I had Model 1 of lots of products.

My wife, being a Marketer, was amazed when she discovered this. She was both surprised that Early Adopters were real and she was married to one. I never told her I played D&D until after we were married. ;-)

So, here I am, with an 8 yr old in grade 3 and we have been informed that the school is now allowing (and encouraging) BYOD (Bring Your Own Device) for grade 3 at our school. The personal computers can be used for computer time and for in class research if the teacher allows it. Our teacher is on board and so my wife and I are now left releasing we are one of the late adopters with electronics and our kids.

Part of this is our desire to reduce screen time for our kids. Part is our desire for them to be drawn to outdoor pursuits and finding fun without the need for a terminal.

But now I must admit that culture is moving on and technology is now a requirement for an 8 year old in class.

Frankly I am not surprised and also amazed at the same time that I will be sending my son to school tomorrow with a Surface RT so he can research in class. It's cool and younger me loves the idea. 

The old man in me says, "When we were kids we hauled a Dictionary and a Thesaurus in our backpacks. And no a Thesaurus is not a Dinosaur! Damn young whipper-snappers."

Oh well, technology marches on.

Sunday, September 21, 2014

The Blerch Has Been Beaten, For Now

Friday I was frying with a high fever. Yes, the first school cold is rolling through our house and I felt terrible.

I skipped going to pickup my race kit on Friday and thought I would not make it to the race Saturday morning. When I woke up, I was not a ball of fun. I pulled on my running gear and shuffled out to have some waffles with Nutella (breakfast of running champions).

My kids and wife asked, "Are you going to go run?" I told them, "I don't know. I am going to get my race kit at least and then I will see how I feel when I get there."

I truly felt terrible and did not want to run. But I realized this was The Blerch, inserting excuses. Excuses like, "You didn't train. You feel terrible. You have a fever. Go have a rest, you'll feel better."

Screw that, I knew from past experiences that running will make my cold "disappear" for a couple hours. Once I got to the race start I was starting to think, ok, I can do this.

When I got to race kit pickup and I think they saw I looked like hell. They offered, "Hey, if you want you can downgrade to the 10k."

My willpower and desire to run 13.1 miles (the 1/2 I signed up for) was not there. "Yes Please!"

I now had an extra 30 minutes to hang out and decide to do this.

The 1/2 marathoners were off and we started to lineup for the 10k.

I was in.

I decided to use a tactic I had used before. I went into the back of the pack with the "hope" I would feel good enough to pass people and have that motivation to spur me on. It appeared to work as I passed people and felt propelled by this. I was not sure I'd be able to keep up the pace but it was working well.

I steadily passed people until I hit an equilibrium and stayed pace with the people around me.

Then I ran a good race. I stopped twice to take a walk break, once in mile 4 and then again in mile 5.

The race was super fun with a ton of costumes (Banana Man, Hot Dog Man, many Blerch, fat suits, an Oreo Box, a female Rebel Pilot in Orange dress, the list goes on).

A truly funny part was when a lady dressed as a Blerch called out to me to have some cake as I ran towards her at the 3 mile food station. Near her was a Sasquatch lurking in the woods frightening/taunting people to join a Blerch for Nutella Sandwiches on a couch. It was a bit surreal, like running through an Oatmeal Comic.

If you get a chance, come try it next year. I'll be back.