Category Archives: Uncategorized

Lula’s Visit

Today’s visit with Lula went great! When I walked in she scampered down the stairs to greet me. You could tell she wanted someone to play with. Sure thing, Lula, I’d be happy to!


She was playful and wanted attention. That little rascal! We played for a bit in the living room before getting her food all ready. Kitty is feisty!


Next, she went to the window to watch her friends play. She wanted to play with them so badly! Sweet Lula, she’d never hurt a soul.



Lula is so funny! When I was feeding her she asked to add some Cholula hot sauce (her favorite!) to the bowl. Haha! Sure thing Lula! Here you go!


Finally, after a long day playing and eating it was time to rest. Thanks for the visit Lula! See you next time!


Working with UIScrollView and Autolayout

Over the last few days I’ve read many, many posts on how to work with UIScrollView and Autolayout. Everything (including Apple’s documentation) is nothing but a convoluted mess. This article aims to provide the definitive source on using UIScrollViews within the Autolayout world. You can check out the source code to this demo application here.

Note that this article does assume some prior familiarity with the Autolayout system.

Embedding a view’s content within a UIScrollView is Apple’s recommended way for adjusting a view to compensate for the onscreen keyboard. Traditionally, this adjustment has been done with the use of frames. The introduction of Autolayout meant abandoning most use of frames but the need still exists to move content around on the screen with a UIScrollView and Autolayout. Here, I describe the steps involved to use these two technologies together.

To begin, there’s two ways to do it (well, really only one correct way to do it) but I’ll only be documenting one of them. The first method relies on adding subviews directly to the UIScrollView with no Container View. This is a pain because you must rely on tricks with the superview to make sure things align properly. It’s not fun.

However, the proper way to do it is easy and makes sense — once you understand it, of course!. Let’s dive right in.

1) Begin by creating a new ViewController in your project and add a UIScrollView to it.


2) Now, create constraints by CTRL-dragging from the UIScrollView to the View. You’ll want to create 4 constraints (hold the SHIFT key to select multiple): Leading, Trailing, Top, and Bottom constraints. Important: hold the OPTION key while doing this to align the UIScrollView to the Container (not the Container Margin).

3) Add a UIView to the UIScrollView and set up the same constraints as before: Leading, Trailing, Top, and Bottom. Notice that these constraints will already default to the Container (not the Container Margin). It’s handy to rename this newly added UIView to Content View for easier referencing later.

4) Now we’re going to add a few temporary constraints to make Interface Builder happy and for ease of understanding on our end. Add a constraint to the Content View for width and height and check the property Remove at build time:



This Remove at build time property will allow Interface Builder to fully compute our layout but the app will remove the constraints at runtime as they will be generated dynamically.

5) Finally, we can get to adding some content to our views. Drag a UIImageView out onto the Content View and make it 250pts wide and 250pts high, 20pts from the top, and centered along the Content View’s X axis. Additionally, make sure to add a sample image to the project so we can see something onscreen:



6) With this now setup add a UILabel centered on the image and spaced 500pts below it. Now, very carefully add one of the most important constraints: from the label to the Content View’s bottom. When you do this you can either set the Constant value to 0 or to Standard, whichever makes the most sense for your app. Adding these constraints should look something like this:



7) Next, add an Outlet from the Content View to a property within the ViewController class that is backing the Storyboard. I’ve named my property contentView. Like so:



8) Finally, you’ll add the following code to the viewDidLoad method of the ViewController class. This code binds the Content View’s Leading and Trailing edges to the root UIView’s edges. This allows the UIScrollView to implicitly calculate it’s contentSize and render the view appropriately. Run the app and you should have a label below your image and scrolling working as expected!

Following these steps should result in a functioning UIScrollView with Autolayout. I won’t cover the steps involved to show and hide the keyboard but that’s all covered in the aforementioned article by Apple.

UIImage File Extension

The UIImage class is a bit tricky to use when instantiating images from the Assets Catalog in Xcode. The tricky part is specified in the imageNamed class method of the UIImage class (

On iOS 4 and later, if the file is in PNG format, it is not necessary to specify the .PNG filename extension. Prior to iOS 4, you must specify the filename extension.

So, you may see sample code that does not specify the extension when creating new images. This shortcut is only valid for PNG files so all other extension types need to specify. What makes it tricky is that the class method will return nil if the image is not found and the UIImageView.image property will accept this nil without complaining making it seem like everything is working.

UIFont Families

For my own future reference, here’s a list of all available UIFont Family names in iOS 8:

Academy Engraved LET

Al Nile

American Typewriter

Apple Color Emoji

Apple SD Gothic Neo


Arial Hebrew

Arial Rounded MT Bold


Avenir Next

Avenir Next Condensed

Bangla Sangam MN


Bodoni 72

Bodoni 72 Oldstyle

Bodoni 72 Smallcaps

Bodoni Ornaments

Bradley Hand

Chalkboard SE





Courier New

DIN Alternate

DIN Condensed


Devanagari Sangam MN


Euphemia UCAS



Geeza Pro


Gill Sans

Gujarati Sangam MN

Gurmukhi MN

Heiti SC

Heiti TC


Helvetica Neue

Hiragino Kaku Gothic ProN

Hiragino Mincho ProN

Hoefler Text

Iowan Old Style


Kannada Sangam MN

Khmer Sangam MN

Kohinoor Devanagari

Lao Sangam MN

Malayalam Sangam MN


Marker Felt





Oriya Sangam MN



Party LET

Savoye LET

Sinhala Sangam MN

Snell Roundhand



Tamil Sangam MN

Telugu Sangam MN


Times New Roman

Trebuchet MS


Zapf Dingbats


Javascript Library Includes

While this may be extremely obvious to most people I’ve seen enough questions on StackOverflow and the like to warrant a mention:

When you’re using a Javascript library that depends on JQuery (or any other library for that matter), include the JQuery library before all others

Now, most people who get stuck with this problem may be coming from an IDE background where we have fancy tools to help negotiate dependencies. Most of time time, the browser can be smart about how it does resource-gathering but in this case Javascript doesn’t work like that. You’ll get strange errors that seemingly have nothing to do with your code.

So, for reference, include your depended-upon libraries first:


What I want to say to clients: “Yo son, this wild-ass update is maddd faster n’ shit.”

What I have to say to clients: “Hi, this new version is now much faster.”

I think all application developers must feel this way at some point.

How To Use Amazon MWS To Download Unshipped Order Reports

After spending many hours trying to understand Amazon’s API for accessing reports, I’ve finally come up with a solution. Below is one way to download an unshipped orders report.

Hopefully this example will help others trying to do something similar. Please let me know if you have any questions and I’ll do my best to help.

Converting Visual Basic to C#

For work I’m having to convert about 1600 lines of Visual Basic code to C#. What this code does is attempt to automate our order processing in a unidirectional fashion: it scrapes Amazon for our latest unshipped orders and generates emails or XML (depending on what the distributor requires on their end) for each order. This is a huge pain because nearly each function of the VB is hard-coded and needs to be reworked. While it shouldn’t be that grueling to rework we’re on a tight deadline to integrate it into our existing C# application so that our new customer service representative can use just a single solution instead of many.