Thursday, July 17, 2014

Some Old TV Show is Always the Most Recent on My Apple TV

In January, I purchased a copy of the 'Culture Shock' episode of 90 Day FiancĂ©.  And ever since it's been shown as the most recent episode whenever I select the TV Shows section on my Apple TV. Finally got sick of seeing it enough that I investigated, and it turns out that somebody mistyped 01/19/14 as 01/19/24 which means that unless somebody edits it, it'll be the most recent for the next 9½ years.

I contacted iTunes support and they got back to me wanting my order number for some reason when they could have just searched for the problem. Oh well, I hope they fix it.

[Update: after 5 e-mail exchanges, being asked to re-download the show (which made no sense) and 2 consultations with a manager, iTunes tech support let the producers of the show know about the error, and now my Apple TV is showing the appropriate image for the most recent TV show.]

Friday, June 06, 2014

Something in /var/folders is Preventing My Mac from Booting

A couple months ago, my MacBook Pro stopped booting reliably. It would just sit at the Apple screen and spin, sometimes all night. I could use the repair partition to re-install OS Mavericks and get back to work after a couple hours of downloading, installing, but it would get back to this bad behavior the next time I needed to reboot, which thankfully is not often. And safe mode booting didn't help same symptoms, so the problem wasn't in a cache known to safe mode.

I read on the support forums talk about the /var/folders directory which is used by the OS for some sort of caching. So this morning, when my son left my MacBook without its charger and drained it to the point of needing to reboot, I got another hang, and instead of two hours of reinstalling, I booted into the recovery partition, launched the Terminal app, cd into my normal boot partition, found the boot partition's /var/folders and deleted it.

And I then rebooted normally. So something in that folder is hanging up the boot process, I just don't know what.

Tuesday, May 20, 2014

On Making Sure You Test Against the iOS Versions You Support

I am not used to getting 1 star reviews against TV Towers USA. My small niche of RV enthusiasts are usually a happy lot. However, I made the big mistake of pushing an update (I guess the first one was 1.6) which was marked as supporting iOS 5.1 (i.e. the last for the original iPads) without testing against either a device—which I don't own—or the iOS 5 simulator—which Apple no longer provides. And it crashed on first launch, and if it had survived that crash it would have crashed again, and if it survived to finish launching it would have crashed on showing a detail page.

My father, of all people, had an iPod Touch still running iOS 5 that one of my sisters had given him, and he was nice enough to overnight it to me. It's not his favorite device; an iPhone without the phone he calls it.

Crash number one was probably the issue of iOS 5 not handling binaries which include a 64-bit compile. I had fixed that one in TV Towers USA 1.6.2 when I was blindly trying to fix the app.

Crash number two was at the linking stage. My own SVGgh library included a routine to build up an attributed string version of an SVG path and it had included a reference to the NSForegroundColorAttributeName constant string. Which wasn't available under iOS 5 and caused the app to exception out during launch with a symbol not found error. It isn't even used in this app, but the linker doesn't know that.

Crash number three was that some of my xibs were marked to be of the 6.0+ format instead of 5.0+ format.

And crash number four was that the table data source in the tower detail pane was using the category on NSIndexPath that returns an item instead of the archaic row property. This is a bit of syntax sugar made for use with UICollectionViews, so it, of course is not available under iOS 5.

Everyone of these issues was quickly fixable. And I failed my users by not keeping track of my supported OS versions and at a minimum running through the app before overwriting their existing, working copy.

And, I still don't have an iPad running 5.1.1, so I will just have to pray that there is nothing in the small amount of iPad only code with some similar present for me.

Sunday, May 11, 2014

On Dropping Support for the Original iPad

As an iOS developer, I'm often forced by my development tools to make support decisions. Xcode running on OS X 10.9 no longer allows me to run the iOS 5.1 simulator. Nor will it build an iOS app that simultaneously generates 64-bit instructions and supports iOS 5.1. Therefore, the version of TV Towers USA I just submitted for review (1.6.2) will be the last thing I'm likely to ever write which will run on the original iPad which maxed out at iOS 5.1.1.

I think the decision to limit the original model to 256 MB of RAM turned out to be a poor one on Apple's part as it shortened its usable lifespan hugely. If it had shipped with 512 MB, it would likely have gotten at least to iOS 6.  As it is, the last time I touched an original iPad, I was struck by how unresponsive it was compared even to my iPad Mini. Giving customers such a poor experience is not something Apple usually does, and I hope they've learned their lesson.

Saturday, May 10, 2014

A Developer of Code Taking the SalesForce Dev Certification

For reasons I won't get into, I took the Salesforce Dev Certification exam this week. Salesforce, for those who don't deal in enterprise software, is a cloud based solution for providing ways for companies and other organizations to keep track of things like sales leads, or the effectiveness of marketing campaigns. It's practical, focused and unsentimental. Salesforce developers normally create custom apps by "clicks not code" using the web interface to build up data models and work flows. Salesforce provides a series of certification exams, the Dev certification having a reputation as being the easiest to take.

Therefore, I spent much of the last few weeks reading, watching videos and walking through tutorials and workbooks. And for a developer who creates custom apps through code, and then more code, it was darn hard. Harder for an experienced coder because Salesforce co-opts common programming terms for new usages all the time. Think you know what an 'object' or a 'field' or a 'record type' is? Well think again. Think a 'checkbox' is a kind of a widget, well how quaint.

And it is all so arbitrary, 2 Master-Detail fields per object max, 3 External IDs per object, workflows can create Tasks but not Events, or is it Events but not Tasks...

I've been trying to polish up an explanation for programming constructs that are nearly universal, unchanging and therefore transferable from system to system: those made by God like the for loop or the delegate pattern, and those constructs that are ad hoc, arbitrary, and require memorizing every corner because there is no pattern to recognize, those made by Men like, oh I don't know, the Win32 API. I was taught to be a scientist, I got through college and graduate school not through memorizing every little thing, but in learning the patterns and principles of the universe and applying them. You can do a lot in an hour's Physics test with Newton's laws of motion and courage.

Getting ready for a test by rote memorization is not my thing.

Which is not to say that Salesforce is bad. In fact, for what it does it's kind of great. While I was studying away, I could observe my wife manually preparing to cold call a large number of organizations to sell them on a new (let's say) product. A big mess of phone numbers and eMail address she was gathering and putting into Excel. I realized how better organized and efficient she'd be if I just took what I was learning and made a few customizations to a Salesforce 'org'. And that would be for just a one-woman sales team. The network efficiencies for a large team would be huge. Same thing with my Dad's private plane brokering service, if I could get him better organized, he'd sell more planes.

So I went to the local proctored test center, took the test and by some miracle of preparation and methodical mastery of the multiple-choice form, I passed.

Wednesday, April 16, 2014

On Writing an Over the Air TV Schedules App

Apple has been kind enough to accept my iOS App for reading TV schedules from an HDHomerun network TV tuner: Schedules GH. The first question that comes to mind, is why would I do such a thing? People have always connected Internet connections and the Internet is filled with TV schedule data. For instance, my MythTV server gets its listings from Schedules Direct, and I also go to Titan TV when that isn't available. So, I will admit this is a niche product, useful to OTA enthusiasts and the handful of people who take their HDHomeruns RVing.

Sometimes, you write an app just to show what you can do. It is not a beginners task, to walk line by line through the ATSC spec, to figure out the packet structure, implement a Huffman decompressor, decode various odd flavors of text, and know what every bit of a data blob means.  And then to turn around, and make an attractive, iOS7 themed app which scrolls at 57 fps, can call (at least five) multiple tuners concurrently, has a pleasant on-boarding experience all with a consistent color palette.  Earlier in the year, I'd been doing the rounds looking for a job, and what I heard from companies was a need full-stack app developers, especially with the new hot topic being energy-efficient Bluetooth LE. So I concentrated on finishing a product which would showcase my overall skills. On interviews, I'd bring out an HDHomerun and a Leaf-style antenna and show them what I was up to.

Schedules GH
The idea to write a scheduling app came out of the shelved idea of writing a TV audio app. I had read about Silicon Dust releasing a transcoding version of the HDHomerun, the HDTC-2US, and I thought it'd be interesting to write a player app, concentrating on audio listening. However, what I had assumed was that the tuner would not only transcode video but would also transcode Dolby Digital, and it doesn't, at least not yet. Well, Dolby takes both an arm (upfront license fee) and a leg (per unit royalty) to legally decode their audio data. So I'll wait on Silicon Dust updating the firmware.

 But I'd already explored various ways to get schedule data into my app. I couldn't get it from Schedules Direct as I wasn't planning on open sourcing the app, and while I did talk to a pleasant man at Tribune Company owned Zap2It Labs, I wasn't going to have the volume to make it worth their while. So, I reasoned, why not just get the information from the device itself.

Thus I started a journey down into A/65:2013. the technical standard in the United States for broadcast digital TV. LibHDHomerun is a bit helpful, in that you can tell it to filter and deliver kinds of packets, but the sample code is about extracting video streams, not reading data packets, so all the locating the various tables in the spec: the master table, the terrestrial channels table, the system time table, the event record, the extended text table was up to me. It took the longest time to work right; I was particularly vexed by missing that over a certain packet size (188 bytes) tables would have to be stitched back together before calculating a validating CRC.  I leaned heavily on unit tests, and I can at least say that my code works for the stations in the greater Boston area.


I hadn't heard the term on-boarding before WWDC 2012, but it makes sense, the user's experience the first time they load the app is critical towards them knowing what the app does and how to use it. With a hardware tied app, its absolutely necessary (and yes, the next version of Signal GH will have an on-boarding sequence).

So, the onboarding is just a 3 step process of choosing an initial tuner, scanning for channels and sub channels, and finally choosing which tuners to call to get schedule information. If I had done this on my Signal GH app, I'd have a lot fewer confused users. 

UI Niceties

In the old days of iOS development, we'd get details about a table item by sliding over to a detail view. It seems like the fashion these days is to do more inline. So tapping on a schedule listing, just animates an expansion of the table, revealing the whole description text, and some action buttons.
You'll notice I'm using a green stripe to indicate a show that is on right now. No need to hit the user over the head.

I experimented with using pull to refresh instead of the refresh button, but pull to refresh requires me to be at the top of the table, which I might likely not be. So I went with the refresh button. 

All the graphics, given that I wrote it, are of course in vectored SVG format including the network logos. So I don't worry much about scaling. I drew all the artwork that wasn't a network logo with my SVG Paths app and I think everything turned out nicely. 

In general, the UI does not try to extend the boundaries of app design. Just execute a recognizable, flat design and keep out of the way. I review a lot of apps tied to devices on Amazon through the Amazon Vine program and I wish others would follow this guidance.

Submitting to Apple

As this is an app tied to a specific device, and I'm not actually sure how Apple reviews Signal GH (do they have an in-house HDHomerun?), I asked Apple reviewing for guidance and they told me to ship them hardware, so I shipped them my cheapest HDHomerun with an attached antenna. Which they promptly lost for a week, apparently, but eventually the app was reviewed, and became available yesterday night. 

Hopes and Dreams

Well, I don't expect a lot of income out of this app. It will likely be extremely useful to a handful of people in specific circumstances. And other, more hobby minded, people will likely find it interesting what TV stations put into their data stream. It was a nice demo when I was job hunting, although in the end, the job I did get didn't even involve a face to face interview. And the code will be used in other apps in the future. So a decent use of my time.

Thursday, January 30, 2014

Announcing SVGgh - A library for rendering SVG in iOS

I've spent the last several days putting the finishing touches on open-sourcing my code for rendering SVG: SVGgh. This is the first time I've put anything public up on GitHub, and I hope my fellow developers can find it and make use of it. It's under MIT license, so I expect there will be no problems using it in your projects or extending it for your own uses, or even just as a tutorial for understanding Core Graphics or Core Text.

Here are a few highlights:

  1. SVGDocumentView - A view to replace UIImageView with a nice, crisp, re-scaleable SVG image. Configurable from a Storyboard or nib.
  2. GHButton - A UIControl button which can draw a nice chrome appearance, and have an embedded SVG icon.
  3. SVGRenderer - A class capable of rendering an SVG into a CGContextRef, so if you wanted to convert an SVG to a PDF or some bitmap format, that would be doable. 
  1. It doesn't do everything in the SVG spec. No animations, SVG Fonts, filter effects.
  2. It has code that needs some bug fixing. Just today, I realized my gradients weren't working properly with entities that had a transform attribute set.  But in general, I've been using this code for over a year in my own apps and it's been fine. 
  3. It's not necessarily the best code for making an editor.
I've cleaned the code like crazy the last couple days. Renaming classes, cleaning up parameters, adding Doxygen style header comments, and moving code around to have better organization. It should be in good shape for others to just pop in and use.