Learning the dark side

About a year and a half ago, my manager suggested that I learn Android development, so I played around with the SDK for a few days and then got distracted by real work. Now that my role at work has changed, my manager again encouraged me to learn it and said that I could goto a class if it would help. So, this past week, I went to a class given by Big Nerd Ranch outside of Atlanta, GA. The class was quite informative, I learned a little Java and a lot more about Android than I probably needed to know.

I currently have no plans to write Android apps, but knowing a bit about it should help me better understand the other half and make it easier for me to communicate with my Android counterparts.

The biggest thing that I think is a stumbling block for learning Android is the development tools. Many developers use the Eclipse IDE. Any iOS developer that complains about Xcode, needs to use Eclipse for a day. Eclipse and the Android tools are extremely unpolished, buggy, and hacky. I’ve realized that this is probably the reason I didn’t get very far in the past; I like high quality developer tools and they just don’t seem to exist for Android.

Is it a telling sign that the instructor carries an iPhone?

Marketing doesn’t meet reality

While it should come as no surprise to anyone, marketing departments usually aren’t very technical. Today I was reading an article about slow Internet performance and it sparked me to test my connection. I’m getting about 15-20 Mbps down and about 1 Mbps up. Unfortunately I have no idea what I pay for as the plan I’m on is so old, it isn’t listed on Time Warner’s website. I did, however, goto their website to see the current offerings and saw this table.

Internet Table

Obviously they want you to purchase the Ultimate Internet experience and getting 50 Mbps would be nice, but is it really true that with up to 10 Mbps you can’t watch streaming movies, video conference, or use multiple devices in your house? Netflix recommends 5 Mbps for HD streaming. We watch Netflix all the time, have a ton of devices connected, do video conferencing and do VOIP over our connection. According to Time Warner’s marketing department, we should have one of the top two tiers of service.

I’d love to get a faster connection, but is it worth the money? If I were in Kansas City, I’d sign up for Google’s gigabit service in a heartbeat, but going from about 20 Mbps to 30 or 50, would I be able to justify the cost? Time Warner won’t tell you on their website the exact cost, but if you build a bundle, the Standard Internet (10 Mbps) is $40/month and the Turbo Internet (20 Mbps) is $53/month. Currently I pay $50/month for my service.

Struggling with graphics

One area of writing code that I’ve never been good at is graphics. I partially attribute this to my lack of artistic ability, but also my distaste for advanced math. For the last day, I’ve been working on a problem to rotate some buttons and move the buttons at the same time. Rotating the buttons is easy:

self.myButton.transform = CGAffineTransformRotate(flashTransform, degrees * M_PI/180);

Moving the button turned out to be hard for me. I tried all kinds of translations and transforms, but came up with nothing. The transforms are matrix math and that just makes me want to turn the other way and run. I searched and searched, tried different things, stayed up late and still couldn’t solve it. This morning I was chatting with a colleague and he suggested just to do the rotation which I knew how to do and then move the buttons. OK, that seemed simple and I know I had tried it. Turns out you can’t move a view using the frame property if there is a non-identity transform on it; however, you can set the center which is just as good, but requires a small extra step. You have to convert the origin point you want to the center.

CGPoint center;
center.x = newOrigin.x + self.button.bounds.size.width / 2;
center.y = newOrigin.y + self.button.bounds.size.height / 2;

Definitely not hard to do, but it tripped me up. The other thing that tripped me up is that in order to resize the button, you have to use the bounds and not the frame if a transform is applied. So with those 2 hints, I was able to finish my task in about 15 minutes. Hopefully next time I won’t be so thick header about this.

What is “work product”?

Up until fairly recently, my job was mostly writing code and it was quite easy to measure how I did each day by how much code I wrote. On days that I didn’t write much code, I didn’t think I was all that productive. Work product was simple to define; it was the code that I produced and the applications I wrote.

This past spring, my role at work (and possibly my career route) has changed such that writing code is now only a small part of what I do. I’m now overseeing some projects, designing how things work, and provide guidance to other developers about the projects I oversee. I can no longer measure a successful day on how much code I write as some days I don’t write any code (or even documentation)! This is a huge change for me and is making me come up for a new definition of “work product”. My success is now basically measured on the success of others; if I help other projects succeed, then I can be considered successful as well. However, that still doesn’t help me with my definition. What is my daily “output”?

While code is not tangible, there is at least a clear definition. My “work product” is now thoughts and conversations; that’s a pretty big change that is going to take some time for me to become comfortable with it.

Interview technique – crash logs

I periodically have to interview people and I find that I struggle to come up with ways to adequately determine a candidate’s technical knowledge. While they can present their resume and what they’ve done in the past, it is hard to tell how they really think. I don’t ask questions that I couldn’t answer myself as I don’t think that is fair. Many people ask basic computer science questions that I’d probably get wrong as I don’t have a computer science background; so I tend to ask questions to see how a candidate would handle a situation.

So far I’ve had mixed results in weeding out the good from the bad. One skill that I think is of utmost important for a developer is debugging. You might be saying that all developers do that, but some are far better at it than others. Debugging is one of my best skills and I’ve had a ton of experience at it inheriting other people’s projects. With that in mind, I came up with one technical test that could actually tell me if a candidate could debug and that skill goes a long way in development.

Now you ask, what is the question? The other day as I was poking through crash logs, a few stood out at me. Take a look at the following logs and see if you can spot why the apps crashed:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib            0x35cab054 semaphore_wait_trap + 8
1   libdispatch.dylib                 0x342961c0 _dispatch_semaphore_wait_slow + 184
2   libdispatch.dylib                 0x342961f4 dispatch_semaphore_wait$VARIANT$mp + 32
3   libxpc.dylib                      0x3200e89a xpc_connection_send_message_with_reply_sync + 206
4   SystemConfiguration               0x374f5be6 _reach_server_target_status + 938
5   SystemConfiguration               0x374f6d56 __SCNetworkReachabilityServer_targetStatus + 14
6   SystemConfiguration               0x374dfaee __SCNetworkReachabilityGetFlags + 198
7   SystemConfiguration               0x374e0f7a SCNetworkReachabilityGetFlags + 190
8   MSNBC                             0x000cb9ec 0x1000 + 829932
9   MSNBC                             0x0006f998 0x1000 + 453016
10  MSNBC                             0x0006abfa 0x1000 + 433146
11  MSNBC                             0x00014d54 0x1000 + 81236
12  MSNBC                             0x0006ab6e 0x1000 + 433006
Last Exception Backtrace:
0   CoreFoundation                    0x3567188f __exceptionPreprocess + 163
1   libobjc.A.dylib                   0x37a18259 objc_exception_throw + 33
2   CoreFoundation                    0x356713b3 __NSFastEnumerationMutationHandler + 163
3   EmSea                             0x001f9c2b 0xe2000 + 1145899
4   EmSea                             0x00199bed 0xe2000 + 752621
5   EmSea                             0x00223453 0xe2000 + 1315923
6   EmSea                             0x002239c9 0xe2000 + 1317321
7   Foundation                        0x351b6c29 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 17
8   Foundation                        0x3510e6d9 -[NSURLConnectionInternalConnection invokeForDelegate:] + 29
9   Foundation                        0x3510e6a3 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 199
10  Foundation                        0x3510e5c5 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 61

On the first one, the hint is that the app failed to launch in time. I’m going to use these crash logs as a test to see if a candidate can tell me what went wrong. Neither app is mine and while I can’t see the code, I can immediately spot the problems.

In the first crash log, the app calls SCNetworkReachabilityGetFlags on the main thread. This call is a blocking call which means it won’t return until it is done; this call can take a significant amount of time to return and should never be called on the main thread, especially at app startup.

In the second crash log, it isn’t as obvious. What the developer has done is something like:

for (NSString *string in someMutableArray)
{
    if ([string isEqualToString:@"Yuck"])
    {
        [someMutableArray removeObject:string];
    }
}

The array is getting modified while it is being enumerated. The fix is pretty simple.

NSMutableArray *deleteArray = [NSMutableArray array];
for (NSString *string in someMutableArray)
{
    if ([string isEqualToString:@"Yuck"])
    {
        [deleteArray addObject:string];
    }
}

[someMutableArray removeObjectsInArray:deleteArray];

Are you good at reading crash logs?

Review: LaCrosse Technology Wireless Weather Station

Everyday my son comes in first thing and asks “what is the weather going to be?”. He wants to know so that he can pick his clothes. Granted, we live in San Diego, so the weather doesn’t change drastically one day to the next, but I always answer him. We were in Costco several weeks ago and I saw an inexpensive weather station, so I picked it up and decided to give it a try.

I setup it up and put it on my desk. The temperature for both indoor and outdoor seemed accurate enough, but the forecast was pretty far off. The box said that the forecast was 70-75% accurate based on the relative humidity. That may be true in other places, but we live about a mile from Mission Bay and tend to have some moisture in the air at least in the mornings. The station said about half the time that it was going to rain. It hasn’t rained in months, so either it knew something I didn’t or it was useless.

After a week or so of getting annoyed at it because it had rain clouds on the display when it was perfectly sunny out, I took it back to Costco. I love the concept of a weather station, but I think the next one I look for will only give me readings and not try to predict. I investigated some Internet connected ones, but the reviews were pretty bad, so I haven’t done anything.

Pros

  • Nice display.
  • Works as an alarm clock.
  • USB charging port on back.
  • Displays indoor and outdoor temperatures.
  • Easy to setup.

Cons

  • Forecast is completely inaccurate.

Summary

Don’t waste your money on this; I think the cheap weather stations do a terrible job predicting weather at least here in San Diego. If you want the readings for the weather, get a device that lacks the forecasting feature as it is just annoying because it is so inaccurate.

Review: MobileMount

I’ve been looking for the perfect way to hold my iPhone on my desk while I work so that it is in reach and screen is visible. A lot of times, I need to test on a device, so this is crucial. There have been a number of stands on Kickstarter and I’ve back a few. I wrote about the poorly designed Oona which I threw out and then about The Jack I’ve been using because the Oona was a waste. While The Jack works well, I was looking for something adjustable and came across the MobileMount on Kickstarter. It looked well designed and the twist lock to push the extra air out of the suction cup seemed like a great idea as it works well on my RAM mount in my car.

After many delays, I finally received the MobileMount (it was a learning experience for the person behind the MobileMount as he never dealt with manufacturing before and didn’t know how long it would take. In addition, he seemed very meticulous about making sure the suction cups were to his satisfaction). Since my main goal was to use it with my iPhone, I attached it to my iPhone and the other end to the base of my monitor which has a nice, shiny surface. The mount stuck to the base very well, but the iPhone kept sliding off it after awhile. The mount came with 4 clear stickers to help deal with devices that have a matte finish like the iPad; I didn’t want to put one on my iPhone.

I thought that I was going to give up on it and chalk it up to another experience, but then I started doing some iPad work. I put the clear stickers on my iPad (I put 3 on it so I could orient the iPad in different ways), stuck on the MobileMount and it is working incredibly well. I have my iPad at just the right angle at my desk and the iPad hasn’t slipped off, yet.

One really great thing about the MobileMount vs the Smart Cover is that I can position the angle of the iPad; the Smart Cover angle (when folded up) just doesn’t work for me.

Pros

  • Strong suction cups.
  • Can be adjusted to many positions.

Cons

  • Didn’t work well for me on my iPhone.
  • In order to stick well on my iPad, I had to put clear stickers on it.
  • A little pricey (it was $25 on Kickstarter; it is now $40).

Summary

There are lots of different holders for the iPad and iPhone out there. The MobileMount didn’t work well for my iPhone, but is working well for my iPad. If I were looking for an iPad mount (which I wasn’t), I’d look elsewhere first. In particular, I’d look for a stand that the iPad set into and was adjustable.

Review: Winegard FlatWave Antenna

Many years ago, I had no desire to get cable TV, so I suffered with various antennas trying to tune in a picture. Of course, I never had a great signal and was always fiddling with the antenna to watch TV. At some point, I got tired of this game and subscribed to local basic cable which was the over-the-air channels, but delivered to a cable. My hassles of trying to get a clear picture were over. However, this convenience cost me about $15 per month.

When the digital TV transition happened, I started thinking about antennas again. I’d either get channels or not; there would be no more fuzzy pictures. A few times, I was tempted to get an antenna, but due to where we lived, I would have had to mount the antenna on the roof or in the attic and that required effort!

Now that we moved, it’s been on the back of my mind to try again. A few weeks ago, I saw the Winegard FlatWave Antenna at Costco, so I decided to give it a try.

When I got it home, I plugged it in, scanned the channels and it picked up all the channels we watched. I was completely amazed as I just put it on the window and it wasn’t line of sight to any broadcast tower. I was all set to cancel cable when I decided to actually watch TV and see the performance. The picture was crystal clear, but instead of a fuzzy picture, we saw the picture stutter and drop frames. I tried to adjust the antenna and finally gave up. The antenna (or maybe a more powerful antenna) has a lot of promise now that we have all digital signals.

I can’t fault the antenna as I simply placed it in a westerly facing window. According to AntennaWeb, I should have aimed the antenna northwest and southwest to get the channels I want. (I suspect that since the signals were basically opposite, I received some signal.)

So when we move and purchase a house, I’m going to look into an attic antenna or an outdoor antenna; I suspect I would need a large one given the decent results with this very small antenna.

Pros

  • Small footprint.
  • Easily to install.
  • Long cable.
  • Low price.

Cons

  • Design of antenna may only work in some situations.

Summary

If you only watch the basic channels, giving this antenna a try is worth your time. However, I’d purchase it from some place that has a return policy. Your mileage is going to vary based on physical location.

Good people still exist

With our modern world where there is so much hustle and bustle, at times it seems like people don’t slow down or take the time to help others. A few weeks ago, a group of people restored my faith in people helping people.

I was driving to Costco early one evening when I came upon the traffic light before Costco where I saw a car turned on its side. I didn’t see any emergency lights, so I knew that the accident happened a few minutes ago (average response time in San Diego is not great, but is still less than 10 minutes). I pulled over, got out of my car and went over to see what I could do to help. Already, there were at least 5 men holding up the car and trying to get the last passenger out (the 3 other occupants from the overturned car were out and the 4 from the other vehicle were also out). I made sure that someone was calling 911 and started to assess the situation (just as a side note, always make sure that someone has called and don’t assume that in a group anyone will do it). A number of other people came over to try to free the last passenger by using a baseball bat to pry open the door; luckily the passenger was able crawl out on her own. At the same time, other people were making sure that the 7 people already out had something to eat, drink and weren’t injured.

Once the woman was out of the car, someone had already setup a folding chair for her and she sat down. I went to my car and got my first aid bag and with the assistance of another good samaritan, I bandaged the wound on the woman. A woman came over and said she was a nurse offering to help and another man was in the intersection (the 2 cars were in the middle of the intersection) starting to direct traffic around the accident.

By the time police and fire arrived, the bystanders had started to disperse. It was almost amazing to see so many bystanders come together and help complete strangers. While I don’t want accidents to happen, I hope that as many caring and selfless people come out and assist.

Can’t believe everything you read

Two years ago, I wrote about open source saying it wasn’t always the answer. I was recently reminded of this when I was searching for a good networking stack for use in an application. While we have a killer (in my opinion) stack that I enjoy using at work in a bunch of our applications, it isn’t open source and therefore I can’t use it. I looked at a bunch of iOS networking stacks and found some too complex, some no longer supported, and some that were good candidates.

After reading the explanation of each one carefully, I came to the conclusion, that one of them completely made up at least part of his explanation on why his stack was better than the rest. The author claimed that the maximum number of simultaneous TCP connections over a 3G connection was 2. This I find incredibly hard to believe. Palm OS had a limit of 1 connection (I believe) and that was eons ago. Could 3G be so bad that we only doubled this? Could/would 3G carriers enforce this? I was unable to find any material supporting what the author said.

I’ve been working with cellular data for over 15 years and have never heard of this kind of limit on any device; there are, of course, bottlenecks when you try to open too many connections and certain OSes have limits to the number of connections.

While the networking stack looked interesting, I immediately stopped reading and completely discounted it. The author’s story sounded compelling, but as far as I can tell is a complete work of fiction.

I did end up using a very simple network stack that a colleague had developed on his own time; it doesn’t do everything I’d like, but it meets my immediate needs.