Monday
Oct102016

Apple Gave Me a Swift Kick

On September 12, 2016, Apple notified me that:

We noticed that your app has not been updated in a significant amount of time.

What can I say? it's true. My app, RetroSketch was initially released on June 24, 2010. Less than a month later, (July 15) v1.0.1 came out to improve performance on the newly released iPhone 4 (and its newfangled Retina screen.) The App was featured in the App Store and thanks to that, I managed to make enough money to buy my wife a laptop, but that was about it.

Since then, I've used the app to show off my skills during job interviews and such. It is actually a neat app for that. Everyone tends to underestimate it at first. But as I reveal the features, people appreciate my attention to details and technical chops. So, even though the app doesn't make any significant profits anymore, it still has value to me.

Through the years, as new devices and iOS revisions have been released, I've always gone back and tested if the app still worked or not. It does. Sure, starting with the iPhone 5, the app got surrounded by black bars. Even before then, since it's very inception, the app never really supported Retina screens… well… kinda. The knobs were always rendered with raw CoreGraphics code which always renders super sharp. So even as recently as 2 weeks ago, as I shared my story with a prominent tech journalist at a conference, she commented my graphics looked sharp. So, yeah, while I know the drawings are rendered non-retina, I know most people judge it by the sharpness of the knobs.

So… does my app look or feel dated? Sure. But seriously, it is called RetroSketch and it still does it's job as well as it ever did. Am I complaining that Apple is kicking me out of the store? Not really. I understand what they are doing. Was my app negatively affecting Apple Users' experience of the store? Hell no, but whatever.

I am now forced to decide, let the app die, or rewrite it?

Rewrite it? Couldn't I just update it to comply with modern standards? No, not really worth it. More than six years have gone by since I wrote the app. Everything has changed. You still had to @synthesize your Objective-C properties (remember declaring ivars in headers?) In 2010 garbage collection was generally disliked and ARC was still a year away, so I stuck to good ol' manual retain and release. CoreMotion didn't exist, so I used UIAccelerometer and rolled my own low pass and high pass filters (one to determine the direction shadows should cast, the other to generate responsive sound effects. I still think RetroSketch is one of the best Maraca simulators in the market) These examples should give you a sense of how out of date the code base is. Don't get me wrong, there are lots of gems, hard fought lessons learned that can be rescued, but there is still a bunch of work to be done.

So to fix RetroSketch means to rewrite it. So… is it worth it?

I think so. I'll never make any significant money from sales, but I still like it as a personal calling card. When I first wrote it, it was as an excuse to learn about CoreGraphics. Now, it can serve a similar purpose again. I'll try to use CALayers this time around instead of using CoreGraphics layers. I'll try rendering shadows with Core Image Filters. Obviousy I should update to CoreMotion and maybe move my old touch handling code to a UIGestureRecognizer.

In the end, I hope RetroSketch 2 will be learning tool and a calling card like its predecessor. I'll let you know how it goes.

Monday
Nov052012

Removing a Shared Branch No Longer In Use

When I first wrote my post on sharing branches, there was something I did not talk about. Namely, how to remove a branch once you're done sharing. (I'll confess I didn't write about it, because at the moment I had not found a way of doing it properly)

But now, thanks to this nice stackflow post, I now know how to do it.

First of all, there are two different scenarios. The first case is when the collaborator you were sharing with, no longer needs their copy of your branch. They might want to remove the branch to tidy up their local repo. This can be done with the following command:

git branch -d <branch>

or to follow in the steps of my old example:

git branch -d superCoolFeature

The lower case -d option will only remove the branch if the branch has not been merged or somehow saved. You can force the removal with the upper case -D option if you're feeling more forceful.

The second case is when you are done using and sharing your branch. You probably have concluded whatever you were trying to do with this branch and merged the result back into master. At this point you might want to remove the temporary branch not only locally, but remotely as well. That can be done with:

git push origin --delete <branchName>

or again, in the case of my example:

git push origin --delete superCoolFeature

And the branch should now be gone from the remote repo. To remove it from the local repo, do the same "branch -d" step as your collaborator did in the first case. Needless to say, please make sure you only erase a branch you were done with.

Tuesday
May242011

triggerGreppy

For the longest time, I have been meaning to brush up on Python. Unfortunately, * I haven't had much need for scripts lately. * When I have needed a script, I've needed it pronto! No time to learn a new language.

The problem is I'm lazy and I don't really want to read a book or website on it. I just want to solve some little problem I might have that needed scripting. You know, just take a sample script and play with it to do something useful to me.

So... after lamenting about this, my friend Mike sent me a sample python script to play with. The sample code he sent me was basically a simple grep clone.

Aha!

I have always wanted a grep-like tool that gave me more context. I know that you can tell grep itself to provide more context, but as far as I know, you can only specify the number of lines before and after your match you want included. This is realistically all one might need for most cases, but I wanted more.

So that is what me new script does. (You can find a copy of my script here) You provide three search terms:

  • trigger: the main term you are looking for.
  • begin: something pattern that describes the beginning of the block you want to print out.
  • end: The end pattern for the block.

For example: I exported an xml file from my iTunes library that describes all of my media. I can now search for the name of an author for example and get The full dictionary entry for the song. (output listed below.)

I hope this is useful to some one else or at least serves as a starting point for your own exploration of python.

% triggerGreppy Tacuba "<dict>" "</dict>" Library.xml

    <dict>
        <key>Track ID</key><integer>7587</integer>
        <key>Name</key><string>Bar Tacuba</string>
        <key>Artist</key><string>Café Tacuba</string>
        <key>Album Artist</key><string>Café Tacuba</string>
        <key>Album</key><string>Café Tacuba</string>
        <key>Genre</key><string>Alternativo &#38; Rock Latino</string>
        <key>Kind</key><string>MPEG audio file</string>
        <key>Size</key><integer>4703278</integer>
        <key>Total Time</key><integer>233221</integer>
        <key>Track Number</key><integer>13</integer>
        <key>Year</key><integer>1992</integer>
        <key>Date Modified</key><date>2010-09-27T20:44:49Z</date>
        <key>Date Added</key><date>2010-08-03T04:30:10Z</date>
        <key>Bit Rate</key><integer>160</integer>
        <key>Sample Rate</key><integer>44100</integer>
        <key>Normalization</key><integer>2381</integer>
        <key>Artwork Count</key><integer>1</integer>
        <key>Persistent ID</key><string>E467DC7506CA7184</string>
        <key>Track Type</key><string>File</string>
        <key>Location</key><string>file://localhost/Volumes/Attic/Music/iTunes/iTunes%20Music/Cafe%CC%81%20Tacuba/Cafe%CC%81%20Tacuba/13%20Bar%20Tacuba.mp3</string>
        <key>File Folder Count</key><integer>4</integer>
        <key>Library Folder Count</key><integer>1</integer>
    </dict>

---------------------
    <dict>
        <key>Track ID</key><integer>7753</integer>
        <key>Name</key><string>Las Flores- Cafe Tacuba</string>
        <key>Artist</key><string>Various Artists</string>
        <key>Album</key><string>Hace Calor  Pop &#38; Rock</string>
        <key>Genre</key><string>General Rock</string>
        <key>Kind</key><string>MPEG audio file</string>
        <key>Size</key><integer>2752097</integer>
        <key>Total Time</key><integer>136881</integer>
        <key>Track Number</key><integer>3</integer>
        <key>Date Modified</key><date>2010-08-19T05:00:31Z</date>
        <key>Date Added</key><date>2010-08-19T04:58:27Z</date>
        <key>Bit Rate</key><integer>160</integer>
        <key>Sample Rate</key><integer>44100</integer>
        <key>Play Count</key><integer>1</integer>
        <key>Play Date</key><integer>3370023481</integer>
        <key>Play Date UTC</key><date>2010-10-16T01:38:01Z</date>
        <key>Normalization</key><integer>2518</integer>
        <key>Persistent ID</key><string>52FAE1944A13F3EE</string>
        <key>Track Type</key><string>File</string>
        <key>Location</key><string>file://localhost/Volumes/Attic/Music/iTunes/iTunes%20Music/Various%20Artists/Hace%20Calor%20%20Pop%20&#38;%20Rock/03%20Las%20Flores-%20Cafe%20Tacuba.mp3</string>
        <key>File Folder Count</key><integer>4</integer>
        <key>Library Folder Count</key><integer>1</integer>
    </dict>

---------------------

[I removed furthere matches for brevity]
Sunday
May012011

Sharing Git Branches Remotely

I usually have two branches when working on a project with a team. The master branch tracks origin/master, and I do most of my work on my local development branch.

Every now and then, I work an experimental feature. When I start on it, I'm not sure if it will work out and wether or not it should make it into the master branch someday. In those cases, I will make a new local branch to play with the idea. Lets say I called it superCoolFeature. At some point of the development of this feature, I might need to share this branch with one of my team members. How do do I do that?

Well... I just figured that out recently and I thought I'd post it here in order to remember it the next time I need it.

It turns out to be a two step process. First you need to push your local branch onto your remote (usually your remote is origin, but you can type git remote to see a list of remotes.) After that, you will need to make your local branch track your remote branch. Here are the commands that do just that:

Note: You need to be on a different branch before you execute the second command, so you might want to do a git checkout master first.

git push origin <branch>
git branch -f <branch> origin/<branch>

or to be more specific to my example:

git push origin superCoolFeature
git branch -f superCoolFeature origin/superCoolFeature

Once you've done that, you should have a new branch on your remote and your local branch should track it. Now you need to tell your teammate to create his own local branch that tracks the remote branch. They can do that with the following:

git branch -t <branch> origin/<branch>

or again, more specifically:

git branch -t superCoolFeature origin/superCoolFeature

As always, you should proceed with caution. Have backups of your repo before performing a new command for the first time (In general backups are a good idea, regardless of what you're up to.)

Also for future reference, here is the list of blog post on the subject I found while investigating this:

Wednesday
Nov032010

Kinesis Advantage Keyboard - First Impressions

Motivation

About ten months ago, I had a sharp pain in my wrist. In that occasion, it happened after an accident while I was playing racquetball. I visited the doctor and he said I should wear a wrist brace. I did so on and off for about six to eight weeks. While I was in pain, I noticed that the slew of keyboard shortcuts I use on a regular basis were killing me (in particular those involving the control modifier, so I swapped control and caps lock.) I did get better and life came back to normal and stopped using the brace.

A few weeks ago, my left wrist started bugging me again. This time I remembered I had gone through this five years ago (I know, my memory is legendarily crappy.) That time the pains went away when I started using a Microsoft ergonomic keyboard. I used it until I switched to using mac laptops. So now that the pain was starting up again, I decided to get a new ergonomic keyboard.

Choosing a model

I could have gotten another Microsoft keyboard, but I was never crazy over the build quality of my last one (which BTW was not a USB model so I couldn't use my old one.) and besides, the Microsoft keyboard is obviously very biased towards Windows (can't blame them for that.)

So after investigating a bit, I found the Kinesis Advantage Contoured Keyboard. There are several less radical options out there, even Kinesis has some split in two halves keyboards, that are otherwise rather "normal." I decided that if I was going to get used to an ergonomic keyboard, I might as well get one that goes out all the way and redesigns the whole thing from scratch. (What can I say? I believe engineers do their best work when they can rid themselves of legacy constraints.) The only legacy that I decided to keep was the Qwerty layout.

Foot Switch

So I just got and I'm typing on it right now. It feels freaking weird. But first things first. I got the regular Advantage model in black. I could have gone for the Pro, but I wanted to get the three-way foot switch. I found the websites a bit confusing. Clearly, the Pro model is differentiated by its silver color and expanded macro memory, but what I missed for a while was the fact that it also includes a single-way foot switch. I was set on trying the three-way foot switch and I could not find a way online to upgrade to that with the pro without paying for a superflous one-way switch.

If you decide to get the keyboard and the foot switch, make sure you don't buy the more expensive USB foot switch. The USB models are standalone, and could work in theory with any other keyboard. If you get the pedalboard that only works with Kinesis keyboards, you will save some money, but I also believe you will enjoy tighter integration. The model that I got connects to the keyboard with a telephone style cable (RJ-45?) With this model, you supposedly can reprogram the foot switch, just like you can any other key.

First Impressions

OK, so right off the box, I have to say I'm happy with my perceived build quality. It feels solid. We shall see if it remains like this over time.

Hooking it all up was pretty straight forward. It has a little USB hub in the back with two ports. I hooked up my old mouse's wireless dongle. The ports are kind of in a cave underneath the keyboard. This is perfect for things that don't get moved around (like my mouse wireless link) It probably would not be very useful for memory sticks and such.

Right now, typing anything requires my full concentration. I'm sure that this will improve over time (in fact, just as I write this post I can start to feel the difference in my head.)

A lot of keys (mostly modifiers) get moved over to the thumbs. I expect this to be big win on the long run, but right now I feel like I'm all thumbs (pun fully intended.) In particular, my right thumb is in charge of space and my left thumb does backspace (or delete in true mac parlance) Unfortunately, I'm used to hitting space with my left thumb so now instead of getting spaces between words, I keep nuking the last letter of the previous word.

This keyboard is carefully crafted with the motion of every finger in mind. It certainly feels that way. My fingers feel less stressed than they usually do when typing something this long (sorry about the length of this post, but I need the practice.) But there is another side effect that I did not anticipate: this keyboard hilights all my bad typing habits. Apparently, I tend to hit some characters that are in the pinky column with my ring finger. The problem is that, since the column is calibrated for the pinky, using the wrong finger results in much hilarity.

I can see this will take a while to get used to. It probably would go easier if I were a better typist. I tend to depend too much on occasionally seeing the keys, that will get me into trouble with this keyboard. I do think think that sticking it out with this keyboard will make me a better typist.

So far I am liking using the foot switch for shifting, but I'm not sure if I will eventually get to use all three switches. Right now I'm working hard just to remember one. Only time will tell how well modifiers work for me on my thumbs. Right now, I can already feel my thumbs growing tired.

Finally, I can also feel my back starting to get tired. I believe that my chair doesn't provide me enough height (besides it's kind of broken.) I also think that I need to raise my table about an inch or two. This keyboard demands good posture. Again, that feels weird right now, but I believe it will bear fruits in the long run.

Sorry, for the super long post. I do plan on writing a follow up after I've had a few days with it.