Draco Torre

David G Shrock

iTunes Not-So-Bad Design

In response to a post on The Atlantic, “iTunes Really Is That Bad” by Robinson Meyer, I cover an issue I have with one of the given examples supporting the claim of poor design of Apple’s iTunes. The author asks the reader to examine the horizontal navigation bar starting within the music library.

So if you’re in your own iTunes Library, then click on “For You,” you’ll find the entire navigation bar has shifted under your mouse: Your mouse is now hovering over “Playlists,” as the software has inserted forward and back buttons on the far left.

I tried it on my Mac, and the buttons didn’t move. My mouse remained hovering over the “For You” button. As a software developer, I immediatly knew the reason my experience differed: the author’s iTunes window is much narrower than mine. I had to reduce my iTunes width to the mininum in order to duplicate the given example.

Cards Art

I created these playing cards for Draco Calculation using Procreate and a stylus over the course of two months. Since the playing cards may appear small on a phone screen and larger on a tablet, my goal was a design that would scale well and have a playing card feel. The card lettering seen in the above collection of face cards (hi-res) is for the French deck. The game includes English lettering and also numbers with the same artwork.

Programming in iOS: imageNamed vs imageWithContentsOfFile

One easy way to load an image by name (from assets or from nib) is to use imageNamed method from UIImage. Without reading the UIImage reference, it may not be immediately understood that this also places the image into a cache. For single-use images, this may lead to unnecessary memory growth, especially for large images such as backdrops that the user may update several times. Here I’m loading an image named, “MarbleWhite” from a PNG file.

load image by name into a cache
1
UIImage *image = [UIImage imageNamed:@"MarbleWhite"];

Checking the “Quick Help” in Xcode or the reference for “+ (UIImage )imageNamed:(NSString )name” reveals the cache warning:

This method looks in the system caches for an image object with the specified name and returns that object if it exists. If a matching image object is not already in the cache, this method locates and loads the image data from disk or asset catelog, and then returns the resulting object.

The reference offers an alternative:

If you have an image file that will only be displayed once and wish to ensure that it does not get added to the system’s cache, you should instead create your image using imageWithContentsOfFile:. This will keep your single-use image out of the system image cache, potentially improving the memory use characteristics of your app.

If using our own cache for memory management, or for loading single-use image such as a backdrop, better to load from a file as suggested.

load image by name into a cache
1
UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"MarbleWhite" ofType:@"png"]];

It always pays to check the programming documentation.

Two Calderas

Oregon is home of two notable calderas, Crater Lake and Newberry Caldera at Newberry National Volcanic Monument, both within a 80 miles of each other. Crater Lake, famous for its size at 5 miles accross and 1,943 feet deep, formed 7,700 years ago when Mount Mazama erupted. Newberry is known for its “Big Obsidian Flow” which formed 1,300 years ago, from Oregon’s youngest lava flow. The panaroma above shows Crater Lake with Wizard Island taken with iPhone 6. Click image for higher resolution. Newberry Caldera contains two lakes, Paulina Lake and East Lake as seen from Paulina Peak (elevation 7,984 feet) in the image below.

Problem: Validate a Phone Number

Validating and searching for a phone number is a common task for user entry or content searching. A person may enter their phone number in a number of formats making the task slightly more difficult, but the important part concerns recognizing a number with correct number of digits with allowed prefixes. For this task we’ll create a regular expression that can be used to validate a US phone number an entry or search for US phone numbers within a body of text.

observations

In the US, a phone number must be 10 digits (area code followed by 7 digit-number) and may be prefixed by the international or long-distance code (+1 or 1). Breaking up a US phone number into parts, we have area code of 3 digits followed by central office code (CO code, also known as exchange code) of 3 digits followed by four digits. Obviously beginning an area code or CO code with the international prefix of ‘1’ would be confusing, so these cannot begin with 1. Zero is for the operator, so that’s out as the first digit of area or CO codes. Certain prefixes are reserved in North America such as 911 and 411. What else is reserved? According this Wikipedia entry, all n11 combinations are reserved such that if the second digit is a ‘1’ then third digit cannot be a ‘1’ which makes things a bit easier for matching area and CO codes.

What about fictional characters with “555” CO code? It turns out only a range is set aside for fiction (555-0100 to 555-0199), so “555” is acceptable.

Phone numbers commonly appear with separators other than hyphen such as spaces, periods, or none at all such as (907) 555-0123, 1-907-555-0123, 907.555.0123, 907 555 0123, or 9075550123.