Tuesday, December 23, 2014

Reusing An Old Mac Mini

At every Mac hardware launch event, Phil Shiller will go through the features of the latest/greatest and towards the end will bring up the Environmental Checklist as at the 2012 WWDC when the MacBook Pro with Retina Display was introduced. “...and of course the glass and high grade aluminum is really desired by recyclers.” I don't know exactly what high grade aluminum means, but the aluminum in beverage cans costs $0.90/lb, so whenever I hear Phil say that I sort of shake my head at the concept of looking forward to turning a $2200 computer into maybe $3 dollars worth of scrap metal and glass.

I think we've all heard the mantra: Reduce, Reuse, Recycle. If we want to tread lightly with our resource usage, this is what we should do, in the order in which we should do it. Reducing is more important than reusing, and reusing is more important than recycling.

So this brings me to my little project to repurpose my wife's 2006 Mac Mini Core Duo. She'd run Windows on it for many years, and it had eventually just got too slow for a variety of reasons—no official Windows 7 BootCamp support, only 2GB of RAM, a bunch of junk getting installed. I replaced it with a 2012 Mini, and we hope to get at least an other 8 years out of the replacement. But this left me with an old Mac Mini which I knew to be slow, capable of at most running OS X 10.6.x, 2GB of RAM and 32-bit only software. It had a nice hybrid 1TB drive but only a SATA 1 bus. It didn't have much of a future, and the lack of software updates made me worried about even putting it on the Internet.

Apple had not gone out of its way to make this computer re-usable. It was close enough to the next years model Mini that it turns out you can just flash the firmware to turn it from a Mini 1,1 to a Mini 2,1 and raise the maximum RAM from 2GB to 3. Yet this is a Internet hack and not an automatic install.

An official Windows 7 Boot Camp driver set would have gone a long way towards keeping it in service in the first place.

The processor was a socketed Intel Core Duo. I was able to find a 64-bit Intel T7600 (2.33 Ghz), refurbished (i.e. reused) on Newegg and swap it out, making it a computer capable of running 64-bit OS X 10.7 Lion, and yet I had to jump through all sorts of hoops to install Lion on this box: I ended up booting my Lion capable early 2011 MacBook Pro off an SD card and mounting the Mini as a targeted Firewire drive to install Lion. Apple could have spent the engineering time to make this all automatic to any Mini with a 64-bit processor regardless of its provenance. It would have extended the lifespan of the Mini and reduced the resources needed to be a Mac user. I bought an extra license for Lion from Apple's website, although they don't send out DVDs anymore, I just downloaded the installer from my previously purchased items. 

Since I'd be in there replacing the CPU and upping the RAM anyway, I bought a Broadcom Crystal HD video decoder on eBay to replace the unused Airport card in the PCI-e slot, and put in a new clock battery. I also managed to break the audio board's ribbon cable port; so I ended up ordering a replacement InterConnect Board. The result is a reasonably fast machine, easily twice what I started with, although the memory access speeds and slow SATA bus keep it from living up to its processor. I'll either make it my daughter's computer, or use it as the HTPC in the TV room. It runs MythFrontend playing 1080p MPEG2 over the air recordings well, with the CPU/GPU temperatures barely above 100°F, extremely quiet. I've been trying a cheap Raspberry Pi running XBMC as an HTPC, and this Mini is more stable, responsive and flexible (it'd better be for the price). 


  • T7600 refurbished $75
  • 2GB SO DIMM DDR2 667MHZ RAM $27 
  • Broadcom Crystal HD Video Decoder $22 
  • Mac OS X 10.7 $20 
  • Thermal Paste, Nylon screws, etc. $5 (or so)
  • Replacement Interconnect Board $32 

So, a total of around $181 for a computer with such niceties as TOSLink out, Gigabit Ethernet, Firewire 400, a line in audio port, an infrared remote, slot loading DVD player, a real Intel 64-bit processor running OS X, but with such obsolete tech as SATA 1, USB 2, slow RAM, DVI and slow Intel integrated graphics. Presumably, I didn't really have to buy a 10.7 license, and I could have not broken my Interconnect Board, and maybe your software doesn't use the decoder. So, maybe $107 for a greatly improved experience. Perhaps you wouldn't buy a computer with these specs these days, but it feels good to reuse it instead of putting it on a shelf till the day comes to junk it. As this Mini doesn't have HDMI out, I needed a DVI+TOSLink to HDMI converter box do that was $30 and another 2W power drain—I already had all the cables.

And, I have to ask the question, what could Apple do to help me use less resources? Making computers that are easier to recycle or computers that are more easily reused? 




Update:
One major thing to take into account that I hadn't thought of earlier is energy efficiency. The 2014 Mac Mini is admirably energy efficient for an Intel system, drawing 6W idle. This hacked Mini running a non-approved firmware/OS and an unexpected processor draws 19W both while idle and asleep. Assuming I use it to replace my HTPC Raspberry Pi which draws 2W at most, I'm not being as resource conserving as I could or perhaps should. Which would be another benefit of Apple providing an official software stack update for this machine, I'd hope they could have gotten it closer to the 14W idle that a similar 2009 Mac Mini uses. 

At one time, I had a Dell Pentium 4 here in the house that I repurposed as a Linux server, but I felt obliged to replace it, not because it couldn't do that task,  but because its 110W idle power draw was ridiculously energy intensive. Any savings in money and manufacturing resources from keeping it was swamped by the long term cost to just keep it running. In that case, it made sense to me to replace it. This Mini, for instance, would have made a fine replacement for that P4 Dell as it is faster and has ⅙ᵗʰ the power draw at idle.

Another Update:
With the release of the fourth generation Apple TV, I can get a box capable of running a MythTV frontend that draws only about 1.5W maximum, so for now this old Mac Mini has been retired again. 

Friday, November 07, 2014

How to Insert Superscripts and Subscripts in Pages for iPhone

I'm trying to find customers for my Chemistry Keyboard extension for iOS 8, so I've been doing things like searching for questions people have asked on the web, the answer of which would be "Buy Chemistry Keyboard", and the title of this post would be one of the more common questions with that answer. I've tried it out on both my iPhone and iPad, and my keyboard will indeed insert superscripts and subscripts into Pages for iPhone and iPad.

So get it and you'll soon be quickly generating strings like:
2•Fe²⁺+2•H₂O→2Fe³⁺+H₂+2•OH⁻ 

Friday, October 31, 2014

Chemistry Keyboard - an iOS Keyboard Extension for Chemists


To learn a computer language, you have to write something in that language, just reading the book doesn't help much. So when Swift was introduced at WWDC, I had to assign myself a project to learn the language. As Apple also announced keyboard extensions, and I've long been kicking around the idea of a keyboard specifically made for Chemists—my degree field is Analytical Science, a branch of Chemistry—it seemed like a small enough project to get done in my limited free time.




Not that it was always smooth trekking. I could most certainly have written it faster in Objective-C, the Swift tools took a while to settle down; for a while I was killing the background syntax checking process every few minutes. But,  in many ways, Swift makes life easier; I'm particularly enamored with Swift enumerations, which turned out to be a powerful way to model my keyboard, and make my code extensible to writing different keyboards with just a few changes.

As for writing a Chemistry keyboard, I imagined what it would be like to write inorganic formulae such as:
2•Fe²⁺+2•H₂O→2Fe³⁺+H₂+2•OH⁻
So the first thing was figuring out what characters would be needed. Subscripts and superscripts of the numbers, +, -, (, ), and some arrows. And since I wouldn't want the user to waste time switching between keyboards, the common elements. Since Carbon is so common, along with Oxygen and Hydrogen, they'd get their own keys, but the other elements would have to be packed together in related groups or in one big grid.

So the Halogens, the common ones, would share a key:
Just tap the key and slide right to choose one, or don't slide and get Chlorine.

And as for superscripts and subscripts,
This is a tap and either a drag down for a subscript, or a drag up for a superscript. Very fast. You'll notice that the characters themselves are on a long tab, so as to not be hidden by the tapping finger. The appearance of the keyboard mimics the standard iOS keyboard, supports both regular and dark appearances, and even makes use of the 51 separate keyboard localizations for the word 'space' and the various name for the return key. Everything from 3 different flavors of Portuguese to Cherokee. 

One thing about gestures is that to select a character there does not have to be a one-to-one correspondence between movement and location. You don't have to drag your finger all the way across the screen to get to the last character in a flyout. The fact is that dragging is more accurate than tapping, given the right amount of feedback a drag can be half as long as the distance your selection covers. The user will quickly figure it out. 

Unlike many keyboard extensions, it doesn't need a network connection and switching out is a simple tap, not some complicated unlocking. I'm sure that it will take some more refining, but it actually came out pretty well.










Saturday, October 25, 2014

Why I Bought a 2012 Mac Mini over the new 2014 Mac Mini

Apple announced a new Mac Mini last week. I had been waiting for the news as my current situation leads me to program at my desk 95% of the time, making a desktop viable, and yet I don't feel I can justify a Mac Pro or the new Retina iMac. And as for a non-Retina iMac, I already have a beautiful Thunderbolt display, so there would be redundancy. So, I quickly bought the best Mac Mini available for my needs, the 2012 i7 quad core. Best Buy still had plenty of stock, but I doubt that will last, and the next day there was refurbished stock at the Apple refurbished store which was quickly gone (and presumably is mostly now on eBay) so I'm sorry I didn't wait.

As to why the 2012 is better for me than the 2014.

First of all, I'm coming from using an Early 2011 MacBook Pro 13.

Geekbench as measured by me on my own MacBook Pro i5 dual core @2.3Ghz

  • 64-bit Single-Core 2222
  • 64-bit Multi-Core 4819
In retrospect, being someone who makes a living coding, I probably should have gotten the i7 version of this computer. 

Look at the Mac Mini 2012 i7 quad core @2.3Ghz, again measured by me
  • 64-bit Single-Core 3110
  • 64-bit Multi-Core 11998
Primate Labs estimates the Mac Mini 2014 build to order i7 dual core @3.0Ghz
Pretty obviously, the 2012 quad core beats the pants off the 2014 dual core at multi-core and is almost identical at single core. And this is with a 2014 custom build to order that costs $1199 (with a 1TB Fusion Drive and 8 GB of RAM) versus a stock 2012 that costs $749 (with a 500GB spinning platter and 4 GB of RAM). 

I want to recreate the other specs of my MacBook, so I will move my 480GB SSD and 1TB hybrid drive over (I have a 2nd hard drive in the MacBook's optical bay). And I want to upgrade to 16GB. With the 2014, I can't do that. I can't put 2 2½ inch drives in the new mini. I guess I could order a 512GB SSD with the 2014 and void the warranty by installing my 2½ inch 2nd drive, I think. But this would bump the price up to $1499. 

Then there's the matter of the RAM. I have to buy it from Apple with the 2014. Bump the price to $1699.

To summarize.
With 2012 (and 2 drives I already own)
  • Stock i7 quad core $749
  • 16GB of RAM $136
  • OWC 2nd Drive Kit $29
  • 480 GB SSD (already own)
  • 1TB hybrid (already own)
  • Total $914
  • End product: Faster, 1 Thunderbolt port, 480GB SSD, 1TB hybrid, Intel Graphics 4000
If you don't already own the drives, this will be more expensive. 

With 2014 (and 1 drive I already own, which I can apparently install while voiding the warranty).
  • Build to order i7 dual core $1699
  • 1TB hybrid (already own)
  • End Product: Slower, 2 Thunderbolt ports, Intel Iris Graphics, 512GB SSD, 1TB Hybrid
The one thing that I wish I could get is 4K display support. The new Mini has Intel Iris graphics which are not only considerably faster depending on how you use them, but are also capable of driving 3840×2160@30Hz and  4096×2160@24Hz. The 2012 maxes out at 2560×1600@60Hz. [A commenter on Google+ points out that there is a hack to drive a 4K display with a 2012 Mac Mini.] As an Amazon Vine member, I get sent monitors for evaluation occasionally, and it'd be nice to be able to accept a 4K display. Regardless, no Mac Apple currently ships is future proof against the inevitable Retina Thunderbolt Display that will ship after Apple/Thunderbolt starts supporting DisplayPort 1.3, so the 2014 Mac Mini will not be driving 5K Retina displays. 

I don't care about the loss of the FireWire port.  I don't care about the improved WiFi as this will be hooked up via Ethernet. Another Thunderbolt port would be nice for driving either 2 largish monitors or getting maximum data throughput, but Thunderbolt is daisy chain able. And presumably, the PCIe SSD in the new Mini will be faster than the SATA III SSD I'll be using. 

Given what I'll be using it for: computationally intensive, non-graphically or throughput intensive Xcode development, the 2012 model was far and away the better value, and I'm almost saddened that Apple couldn't put together the kind of hot rod that a user like myself would find compelling.

[Update: I spent a couple hours this morning migrating my old hard drives into the new Mac Mini, and it is now my primary computer. Some quick performance tests versus my old MacBook Pro 13:


  • Case 1: A moderately sized Objective-C iOS Project from scratch (cleaned and caches deleted)
    • MacBook Pro i5 dual core  @2.3Ghz 44s
    • Mac Mini 2012 i7 quad core @2.3Ghz 27s
  • Case 2: A moderately sized Swift iOS project from scratch (cleaned and caches deleted)
    • MacBook Pro i5 dual core at @2.2Ghz 47s
    • Mac Mini 2012 i7 quad core @2.3Ghz 22s
So, my compiling/linking performance is on the order of twice as fast using the same hard drives, but different CPUs/RAM/SATA connectors. So, I'm pretty happy I went with the quad core. Sorry I don't have any measurements against the 2014 Mini.

Oh, and here is a screenshot of the Activity Monitor applications 'CPU Usage' window when compiling an app, so the ability of the quad core CPU to have 8 concurrent threads is really getting a workout by Xcode 6.

]


Wednesday, September 03, 2014

On .Net Rocks Talking about the Swift Language

Last week, I recorded an episode of .Net Rocks about what it's like learning Apple's new Swift language. I think it went well enough, although I wish I could go 10 seconds without saying "you know", and I did go into the weeds giving my impressions of what motivates Apple.

An hour is just not long enough for the topic, and we only just did a very impressionistic coverage of the language.

Regardless, I thought it went fairly well, and worth the time to listen to.


Saturday, August 30, 2014

My Thunderbolt Display Started Flickering and Going Blank...

I had a strange experience over the week involving my local, Nashua, NH, Apple Store. It all started when my Apple Thunderbolt Display started flashing black rectangles and then going blank. As it did this with both my MacBook Pro and the family MacBook Air, I figured it was something wrong with the display. So, I booked a Genius Bar appointment.

I boxed up the display and took it to the mall. Sitting it on the Genius Bar, we weren't able to recreate the problem immediately with the Store's Air, so they took it into the back for observation. The next day calling to tell me that the panel had failed which would be an $833 repair, as this would be on a display that I could probably find for $900 if I searched online, and I would end up with a used Thunderbolt Display, I told them to scrap it and set about rearranging my home monitor situation. I have a Viewsonic monitor with an even nicer panel than the Thunderbolt that I could repurpose as my primary monitor, although I was not happy about losing the Thunderbolt's docking capability. 

And here comes the strange part. A couple days later, the Apple Store calls back to tell me that since they had the parts anyway, they had decided to try switching out the motherboard instead of the panel, and the resulting display was no longer showing the failure even after 6 hours of testing. So I could have my monitor back for $185. I jumped at that. I had been missing it. 

At the store, the Genius who took me my display told me the odd story that the original diagnosis of a bad panel was just the worst case scenario, and they hadn't been sure at the time. Which is definitely not what they had told me when I'd told them to scrap it. I had thought the symptoms I was seeing were pretty strange for a bad panel, and I'd argued at the time with the woman on the phone that it might be a bad power supply, and at the time she was adamant that it was the panel. So I had accepted the Store's diagnosis. 

So, I have my monitor back. Time will tell if the repair worked. I'm glad the Apple Store repair people didn't scrap it, and had taken the time to try something even after I had given up hope, but I have to wonder why they gave me such a bum diagnosis in the first place.

 [Update: well I've had it on my desk for a few hours and it's starting to go directly to a blank screen every few minutes, which is different than what I had been experiencing before where it was mainly large black rectangles followed by sometimes going blank . Plugging and unplugging brings it back. So maybe it wasn't the motherboard, or maybe this motherboard is going bad too. Hooking up a spare Thunderbolt cable to the Thunderbolt port on the display allows me to drive the monitor 'backwards', and I have not seen any blanking in a couple hours, so my current diagnosis is that the integrated cable is bad.]

[Update: After several days of driving the monitor 'backwards', I have seen zero problems. So I'll be heading back to the Apple Store to ask them to replace the Thunderbolt cable and give them a suggestion about testing before telling someone their $900 monitor is scrap worthy.]

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 for 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.

Onboarding

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. 
Limitations:
  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. 

Monday, January 13, 2014

Signal GH app Reviewed by Solid Signal Blog

One of the multitude of problems with alerting potential users to my apps is getting independent reviews, and when an app requires special hardware, as is the the case with my Signal GH app to monitor the signal quality of over the air digital TV streams, that problem is multiplied. So I eMailed Stuart Sweet, the author of the Solid Signal Blog, if he'd review my app if I were to ship him my own HDHomerun, and he kindly agreed. He was also agreed to ship it back, I paid for all this Fed-exing, which he promptly did; thankfully my wife gets a good deal on shipping. Luckily, between Christmas and New Years, there isn't much on broadcast TV, and my other single tuner HDHomerun was able to grab all but 2 shows I'd otherwise have watched.

And he gave it a positive review, saying  "This app is a total must-have for the HD HomeRun user...". so the trouble was well worth it.

The near-irony here is that as a top-500 Amazon reviewer, I get requests nearly daily to review someone's gadget, iPhone case, or book and I nearly always refuse due to either time constraints, the fact that I don't review novels, or not feeling comfortable taking something that I might have to slam in my review. (I have no problems slamming products I get through Amazon's own Vine program, as I don't get those directly from the manufacturer.)

Anyway, thanks to Stuart for taking the trouble to review Signal GH in his fine blog.

Wednesday, November 27, 2013

Writing an iOS Kids App-Frog Draw

I recorded an episode of The Tablet Show this week where I talked about what I've learned about writing an app for the Kids section of the App Store, the kid's shape drawing app, Frog Draw.

The Parental Gate

Apple rejected my app three times. The first was because of sloppy layout issues on my part, but the last two were because of the Parental Gate. Basically, apps in the kids section have to ask for parental permission every time the kid wants to buy something or interact with the wider Internet. I somehow missed this, so the second rejection was because I'd missed this requirement. So, no gate on purchasing my beautiful stickers, and no gate on sending artwork via e-mail; bam another 5 days in the review queue. 

So I looked around at what that actually meant, and found these examples at Dreambot Studios. Amazingly, Apple didn't provide a standard API for providing a secure gate. I'd have expected there would have been an API that provided a localized challenge string, and a cryptographically secure method of validating a response. Instead, developers have to roll there own method to differentiate between a 12 year old and an adult. I chose a math problem I didn't think my precocious 8 year old could solve:

Frog Draw's Parental Gate

.

Apple provides a mercifully short set of guidelines for iOS app submissions and here is the entire relevant guideline for the need for a parental gate:
 24.3 Apps primarily intended for use by kids under 13 must get parental permission or use a parental gate before allowing the user to link out of the app or engage in commerce
So given this directive, I thought it would be easiest on the parent to provide a convenient one stop location for all the parental controls, so that the  parent could allow or disallow purchases, allow for making a quick trip to the App Store to rate the app, and turn on various means of sharing the drawings. All of these were off by default.
My Rejected Parental Controls Pane
I even put some Emoji characters in there so that non-English speakers could tell what they were agreeing to. And I submitted it to Apple and it was (I wish I could say promptly, but it was another 5 days) rejected. Why? Because while the guidelines make no mention of this, Apple has a rule that you cannot permanently enable a gated feature. Their rule is that the parent has to agree to its use each and every time.

I was pretty upset about this, but I kept calm and appealed the ruling to the review board, and was promptly told my appeal was rejected; this was indeed how the review team interprets rule 24.3. Two things, one I don't like arbitrary rules ruining my beautiful app with user hostile behaviors; I want to empower my users to have fun and draw some silly images.  And two, as a parent, I am not feeling empowered. As a parent, I would likely want to disallow in-App purchases even though Frog Draw only sells non-consumable clipart/stickers—I still remember spending $35 on Smurfberries—and allow e-mails. I don't care either way about rating the app. And turn off everything else.  But it's Apple's playground, so I did it their way.

Can Kids Apps be non-Skeuomorphic? 

As an adult with something approaching design taste, I am happy with iOS 7's lack of chrome and general removal of fake analog reality. I wish buttons had just a little bit of chrome, but otherwise, I'm a happy iOS user. But do children need something more? I guess I'll find out.
Here's my iPhone layout while displaying its color toolbox:
Frog Draw with Color Buttons
You'll notice that I am using recognizable buttons, but with light chrome. Also that the artwork projects into the status bar; this is under the user's control. Want to see what time it is? Draw something light under the clock. I'm using a light highlighting to show which tab is active, and in general I'm following the rule that controls should not be visually distracting. The important part should be the art. 
Frog Draw with Stickers

I hope this applies to kids too, and they don't require Fisher-Price controls and fuzzy bunny cartoons wasting space and distracting them; or more importantly for downloads that parents don't have a pre-existing view of what kids apps look like.

In my first version of this interface, I thought it would be cool to have iOS 7 style squircles behind my shapes. But testing with my kids revealed that children are already hard coded to tap on that shape (instead of what I want them to do, drag a copy off). So I removed the squircles which led me to change the color of my toolbox, which led me to change the color of my toolbox tab bar, which lead me to change my highlighting color which led to my final design, which I love.

An Early Design that had Issues. I missed Halloween.

The design choice I made which I'm most unsure of is the icon. On the one hand, modern iOS icons are geometrically simple, clean lined, abstract pieces of art. On the other hand it's hard to make a happy smiling abstract frog, it'll look too much like a duck. If my app doesn't sell, I'll blame the icon.

[Update: I've changed my mind on the icon. I'll dial back the cold inaccessible look and add some humanity to the 1.1 version's icon.

]


Kids and Gestures

I've already covered the importance of gestures in a modern interface but a few words about kids. Kids are more adept than we old folks at picking up gestures. They get the visual cues, they know what worked in other apps and they don't have a lifetime of mousing to unlearn. In fact, my daughter asked me the other  day, "what is a mouse?" when she was trying to figure out a Flash game on PBSKids (we use Magic Trackpads with our Macs). Kids pick up gestures if you give them enough clues or a visual explanation of what will happen when you do what. My major concern is communication with the user about the non-discoverable gestures like my 2 finger up down swipe to change the order of shapes. Thus, the importance of having a decent on boarding screen for the first time the app gets run. As I have the ability to animate the whole creation process of a Frog Draw document, my on boarding window has an animation of some gestures, and I hope this is enough, but I'll likely revisit this.

Make a Quality App

There is nothing about writing for kids that means you can cut corners. My son knows what a good app looks like and how it acts. Last night, he was making sure I knew I should have a longer tutorial/level  up section just like his best games have. At release of 1.0, I have a good app. I've profiled it to look for speed bottlenecks, I've rejected my own submissions to Apple more times than I'd like to count when something came up which would result in a child having a bad experience. The last month of development has humbled, but I think the end product is worthy. 

I don't know if people value this, but I do. The packaged up App is only 4MB. It would have been under 3MB, but at the last minute I had to add 64-bit support or Apple's face recognition functions wouldn't have worked on A7 based iOS devices. This was all possible because pretty much every pixel in the interface is drawn either in code or by rendering lightweight SVG, and not with bulky bitmap images. I hope potential customers don't see the small download size and think there's something missing, I value efficient use of a user's limited space. Being bulky will get an app booted off my iPad if I don't use it daily.

Frog Draw 1.0 Free in the App Store, no Ads, no consumable in-app purchases, just some child-friendly vector clip art. Thanks. [Update: now the app is $.99 and there are no in-app purchases. I'm trying different ways to make money. Still no ads.]


Sunday, November 24, 2013

Change of Distribution Policy for Signal GH

Today I saw this review for Signal GH my HDHomerun utility: Don't buy if you're in Europe 1 Star Bought this without detecting that it is USA only. I wasted my money. Should have said on the App Store. Ripped off. Now obviously, this user didn't write me to try and resolve his problem. And I don't know if he didn't notice there was a setting for using the European TV standard, or if he did and it didn't work, or if he was upset that US users got the benefit of a map of broadcasters, but the fact of the matter is I don't know that Signal GH works in the UK or not; I just assumed it would. So, I am stopping distribution in Europe (excepting Denmark where I've been distributing for years without complaint). If someone in the UK or any other European country would like to try it out, let me know and I'll turn distribution back on temporarily. And users of the App Store should know they can contact Apple support shortly after purchase for refunds. [Update: Apparently the version I just put on the App Store 1.4.1 is broken for people who haven't done an initial scan and this is probably the problem the U.K. user saw. I've removed it from distribution and will be posting a 1.4.2 update presently]. [Update 2: I've submitted a 1.4.2 update to the App Store, and I apologize for the bad impression I've given to new users over last week. It was my error in not testing a clean install.]

Sunday, November 03, 2013

Touch GUI and Replacing Buttons With Gestures

I've been thinking a lot about gestures lately. I submitted a kids drawing app, Frog Draw, to the App Store this week, and while I'm proud of it, it certainly ended up different than the plan in my head when I first sat down in Xcode and started coding it. Much of this, comes because of a gradual realization that gestures are better than buttons. Here for instance was my first thought for a interface for modifying objects:
The idea behind this was that the user would tap an onscreen object, a square perhaps, and this item would appear to give options in button form, including a rotation button which would follow the finger in a circle as he twirled the whole edit ring and object around. I had it all worked out that the buttons would rotate with the ring's rotation. I was quite proud of the geometric perfection of its layout; it was a perfect hexagon inside a perfect ring. And then I actually tried to use it.
The ring was in the way of things, preventing me from selecting other objects. And what if the object was up in a corner, obscuring a button, which required redundant buttons such as the doubled X delete buttons in the above. No, this would never do.

So I went with gestures. Translating via dragging a finger and pinch and scale gestures could be easily enough done, but what was the gesture to delete something? At first, and for much of the development cycle, I went with an analogous gesture to the Mail app's delete swipe, a quick leftward flick.
But that turned out to be too unreliable, as it was hard to both distinguish between a normal leftward translation and a delete, so half the time, I just ended up moving the object a bit to the left, or worse, an unintended deletion. Yes, I have unlimited undo, but still. In the end, I just accepted a drag of both the finger and the object into the toolbox area as a delete. Easy to do and easy to understand.

Which brings up another idea, the unimportance of direct manipulation. In the real world, if you wanted to drag a card around on a table top you'd put your finger down on the card and move it around, the finger always obscuring some of the card. In the digital world of the touch screen the programmer has a choice. If I have a selected object, why do I have to have my finger over it, preventing me from seeing where exactly I want it to go. Oh, I could bring up a loupe view to show what's under my finger, and perhaps magnify it, but won't that take up even more precious screen space? So, I decided that I could pinch, rotate and translate anywhere in my document view and it would change the selected object.
As I was testing my app, it became more and more obvious I needed an easy way to change the front to back order of objects. Many times, I'd draw a mask (maybe a frog's face) and want to put a photographic face behind it, peering through a hole. In the old days of desktop apps, this would be a menu item or a button or both, but not in mobile where space is precious. For a long time, I was intending to have a table of all the objects in a document layer, and the user would manipulate z-order by dragging one object cell to a different position (and I still might do this) but it seemed like this was a good opportunity for another gesture, and the easiest that came to mind was a 2 finger up or down drag.
This worked out quite well, as I could bring an object up or down several levels in a single swipe. I even used the same mechanism to re-order layers if no object was selected. What I'm giving up here is discoverability, few users will discover this behavior on their own. I put a diagram in the initial onboarding dialog, but time will tell if that's enough.
Not that the button is dead, I had thoughts of dragging color swatches onto objects, but that was just too much to ask of the user in terms of consistency, so I just have simple buttons to apply colors or other style settings to the selected object. Look for Frog Draw in the App Store next week.

Thursday, September 19, 2013

Typing iOS Icons in SVG

I know many people when faced with the task of making an icon will fire up Photoshop and start pushing pixels. But lately, when graphics are needed, I've been jumping into my text editor, BBEdit, and creating an SVG document from scratch. Like this one for—appropriately—my new iOS app about learning and playing with SVG paths called SVG Paths:



  
  
  
 

  
    
   
    
    
    
    
    
    
    
   



Sorry about what my code formatter is doing to the rect element in the above.

I can then open the result in iDraw, scale the drawing down to the appropriate size for an iOS icon and save it out as a PNG.  For smaller icon sizes, 29 pixels? really?, I might tweak it a bit to emphasize just one sub-element. The advantage for me is I get exactly what I expect with mathematically pure shapes. And it's a lot simpler than the times I've programmed graphics in raw Postscript. It wouldn't necessarily be a good way to make an elaborately textured icon, but with the flat simplicity mantra of iOS 7 the stark clean lines of SVG are a good fit.

Oh, and here's an animated GIF my new app can generate of me drawing the icon:

Wednesday, September 18, 2013

Solid Signal Blog Likes TV Towers USA

I heard about Solid Signal Blog on the HTGuys podcast, and sent them a copy of my TV Towers USA app, and they gave it a very positive review. I bought both my home's antenna and pre-amp from Solid Signal and they work great so it's mutual.

Tuesday, September 17, 2013

Why I Raised My Apple TV Rating from 4 to 5 Stars on Amazon

I take product reviewing seriously, and my Top 500 Reviewer badge on Amazon (#200 as of this morning but steadily getting worse) means more to me than it should. I'm the kind of reviewer who will go back and reevaluate a product over time, often for the worse, but sometimes, gratifyingly for the better. And so, as I revised my review of the third generation Apple TV this morning to include the fact Amazon's Instant Video app now supported Airplay streaming, I came to the realization that the Apple TV was now a 5 star product. It had somewhat snuck up on me due to continual, gradual feature improvements by Apple.

I owned the original, big, hot, Apple TV and that was definitely not a 5 star product. Limited, energy inefficient, a means to watch rented TV shows (remember that) and a few other things. When the 2nd generation came out I gave my original to my brother and my 2nd and 3rd generation Apple TVs have been happily getting updates ever since as they benefit from being an iOS device with all of the work Apple puts into improving and adding features to iOS devices and the iOS ecosystem.

Starting with:

  • Energy efficiency. I have a 30W Intel Atom home theatre PC which overheats and doesn't give as smooth an interface as a 1 W Apple TV.
  • Consistent Interface. Apple TV apps/channels all look about the same. You don't have to learn anything switching from Netflix to YouTube.
  • Connectivity. I love that the Apple TV comes with Gigabit Ethernet in addition to Wi-fi. 
  • TOSLink. Not everyone has a HDMI capable receiver, but if you've got a 5.1 speaker setup Apple has you covered with optical sound if needed.
  • Basic content like Netflix, YouTube, iTunes purchases.
  • Free TV shows, a couple times a week, I go and see what's new in the list of free TV shows. I've ended up buying several shows I like this way, like the series of Mickey Mouse short films.
And then Apple started adding features:

  • Bluetooth Keyboard support. I don't even know where my Apple TV remote is. It's so nice being able to type in searches and passwords from a real keyboard. Any Bluetooth keyboard will do, from a cheap iHome to an actual Apple Bluetooth keyboard.
  • iOS remote App. For when you can't find the keyboard or are too lazy to find it. 
  • Airplay. Here's something I do frequently. I listen to podcasts in the shower on my Airport Express connected shower speaker; I get out of the shower and switch the podcast to the speakers in my basement Apple TV. 
  • Airplay Video: I use mirroring from my MacBook to get content unavailable on the Apple TV itself, such as MPEG2 streams I recorded off my antenna. When OS X Mavericks comes out this will be even better as the Apple TV will come up as 2nd separate non-mirrored monitor.
  • PhotoStream. Yes. My wife takes a picture on her phone and it magically appears on the Apple TV's screen saver.
  • More content: Separate apps for the NBA, trailers, Japanese anime, MLB, Flickr... Plus services I don't have access to without a cable plan like HBO, or things I wouldn't pay for like Hulu. 
  • 3rd party app support. As I said, the support for Amazon Prime videos via Airplay pushed me over the edge from 4 to 5 stars. 
  • 720p and then 1080p video. There isn't a huge difference between the two if your TV has a good scaler, but it blows away the video quality from before Apple started streaming HD. I had to upgrade my Internet connection to use it, but it's been worth it. Compare with the horrible "digital downloads" that you redeem in iTunes from many Blu-rays.


So, it snuck up on me. This little Apple hobby has become a great product.