Perfect Pocket Square Fold

There are many intricate pocket square folds that can adorn the pocket of your jacket. Some consider these folds as a form of art, or more simply a way to express one’s individual character. Typically a thin silk material is easiest to work with and maintain the fold. When working with a heavier cloth, this may not be as easy to achieve. I am by nature a troubleshooter, so when faced with a problem I look for a solution. One day I had a bit of trouble stuffing my jacket pocket with a thicker material pocket square. I looked for something around my office that would allow me to easily stuff the square in its proper place, and maintain the form of the fold. My solution was a metal binder clip found at any office supply store. This is a very inexpensive way to hold and maintain that perfect pocket square fold.

Pocket Square

Do you have any tips or tricks? Please post in the comments. I love to hear what others come up with!


Provisioning Profiles

If you are an iOS developer and submitted apps to the app store then you will know the pains that provisioning profiles can pose. They can get downright confusing wether it is a development, App Store, or enterprise provisioning profile. Luckily Craig Hockenberry has felt this pain before and decided to create a tool that can help. The tool is a Quick Look plug-in that will display the provisioning profile’s information in a nice convenient window. Do yourself a favor and go to his website, download, and install the plug-in.


Update Ruby on Yosemite

I recently ran into some issues with the version of CocoaPods installed on my laptop, so it was natural that I update it. Since the latest version of CocoaPods required a new version of Ruby, I had to update that as well. As much as I have tweaked Ruby code in the past, I by no means am a Ruby developer. With that being said, how does one install or update Ruby? Luckily I found two great websites (listed below) with detailed instructions on how to do this for Yosemite.

Here is the command to download and install:

$ \curl -L | bash -s stable --ruby

From there I just followed the steps outlined in this Stackoverflow accepted answer to update CocoaPods.



Becoming Published

iOS 8 by Tutorials

It is official, I am now a published author. I am one of a group of authors which wrote iOS 8 by Tutorials. This wonderful experience has challenged me to become a better writer and developer. I am very grateful for the opportunity to write two chapters for the book, and work with such a great team.

A few years ago my friend Mark Dalrymple asked me if I would be interested in technical reviewing an iOS development book. I took him up on the offer and so begun my journey in technical reviewing Mac and iOS development books. This has been a very enjoyable experience for me and I am very thankful for it. More recently I have wondered why shouldn’t I be the one writing books on this subject matter, and thus it became a goal of mine. There is quite an amount of effort that goes along with writing any thing on a technical subject. You need to take time to research, develop an idea for an app, create the app, separate the app into sections, and then finally start writing. Since I’ve written tutorials for web I though it would be a fairly easy transition to print, however this proved to be a bigger challenge than I anticipated.

When you are one of multiple authors you need to make sure the writing style is similar and consistent with the other authors of the book. Some authors write in a style that guides the reader along a journey and gently nudges them to perform certain tasks. Other authors write in first person and definitively instruct readers to perform tasks. There are no right or wrong styles to write in, it is simply a matter of being consistent. While I was writing for iOS 8 by Tutorials I was also technical reviewing Beginning iPhone Development with Swift. These books had two completely different writing styles, so I found myself blending the two styles while writing. This caused the reviewers and myself additional work to correct the inconsistencies.

Apple threw a huge curveball with the introduction of the Swift programming language. I had to learn a new language in addition to researching the latest and greatest APIs and code changes from Apple. This takes time, a lot of time. If you are unfamiliar with a product lifecycle, there are multiple non-public releases of the product known as beta releases. An additional beta release is created once bugs are fixed and additional progress is done on the product. In Apple’s case there are around six or seven of these beta releases before the product is ready for a public release. So with each new beta release of development tools and API changes, there were also changes with Swift. This meant going back and re-working the app to fix anything that was now broken with the latest release, then updating the chapter to reflect the changes. This became an additional amount of time that was added to the mix.

The best thing about my experience writing iOS 8 by Tutorials was the co-authors, reviewers, and other team members who help put together the book. In any experience in life, it is the people who make the difference. Ray Wenderlich has put together an amazing group of people who are knowledgeable, wonderful to work with, and are dedicated to bringing their readers the best possible content. It is no wonder that it has become such a valuable resource for Mac and iOS development.


NSLog and Structs

NSLog is a valuable debugging tool. When running your app, it can provide you a print out of whatever you wish in the console. Most of the time it is used to quickly see values of an object. I recently stumbled upon some methods which have made life a little easier when dealing with CGSize, CGPoint, CGRect and other structs.

Instead of writing something like this:

NSLog(@"rect x:%f y:%f w:%f h:%f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);

You can write this:

NSLog(@"rect: %@", NSStringFromCGRect(rect));

Quick, easy, and definitely offers convince!

Here are other methods which will convert structs to strings:

  • NSStringFromCGAffineTransform
  • NSStringFromCGPoint
  • NSStringFromCGRect
  • NSStringFromCGSize
  • NSStringFromUIEdgeInsets
  • NSStringFromUIOffset

More on this can be found in Apple’s documentation.


Suit Tailoring

One of the best things is putting on clothes that are specifically fit for you. It boosts your confidence because they help you look your best. While I was stationed in Okinawa Japan, I had the opportunity to purchase a bespoke suit for slightly less than the typical price. This suit is without question the best fitted thing I own, and it shows.

The majority of men, including myself, do not have the means to buy tons of these suits. There are now plenty of made-to-measure suit manufactures which produce suits that fit nearly as good as a bespoke, but for a fraction of the price. These suits are great if you can afford them, and are in the market. However, we all have bought a suit from “off the rack” which fits decently but never is 100 percent. You can take your style to the next level by having the “off the rack suit” altered by a good tailor. The cost of the alterations are well worth it to help you look your best!

Typical Alterations:

  • Waist of pants
  • Length of pants
  • Length of jacket sleeves
  • Waist of jacket

When looking for a tailor make sure to put in some effort. Be sure to avoid the quick, easy, or express places, you will save time and money in the long run. I speak from experience. Here is a great article I found which can help you to find your tailor. If you would rather watch a video on the subject, then you can check out this video from The Gent’s Lounge.


Custom Fonts

Using custom fonts on the iOS platform has became easier with each passing year. However they can still pose problems. The biggest problem I have had is dealing with the baseline or ascender of a font. I decided to take a simpler approach since a specific font was giving me issues in only two places.

One troublesome place was segmented controls. Here is the fix to adjust the baseline:

[[UISegmentedControl appearance] setTitleTextAttributes:@{NSFontAttributeName: @"Custom-Font-Name", NSBaselineOffsetAttributeName: @-0.5} forState:UIControlStateNormal];

Another place was with a custom badge label. To fix this issue I created an attributed string then set the label’s attributedText property to the newly created attributed string.

NSAttributedString *attributedBadgeCount = [[NSAttributedString alloc] initWithString:@"7" attributes:@{ NSBaselineOffsetAttributeName : @-0.01 }];

Typically the custom font would pose issues throughout the app, however this wasn’t the case. If I wanted to adjust the font file itself, then I would have followed these or these other instructions.


Intended Audience

There is no doubt Benjamin Franklin lived an interesting life. Something struck me immediately when I started to read his autobiography. Franklin wasn’t writing his life’s story for the masses to enjoy, he was targeting a very specific person or group of people (his family).

Without having read Franklin’s autobiography, I knew he had a troubled relationship with his son, William, later in his life. The relationship issues stemmed from the differing allegiances during the Revolutionary War. I feel Franklin was trying to share his life with his son, and this was his way of doing so. With this thought of Franklin’s reasoning, does this change how you would read the literary work? Are there specific life lessons he is trying to pass on to his son through story of his life?

Final Thoughts

Having just started reading the autobiography, there are many things regarding the intended audience which can be contemplated. While you can read this work purely for pleasure, should you also read it with keeping Franklin’s intended purpose in mind?


Multiple directories with genstrings

Not too many developers pay the proper attention to localizing their apps. Number one, it is very simple to do. Number two, it will save you time when it is part of your coding routine and you need to add additional languages to your app. Any time a string is used, the appropriate steps should be take to ensure the proper language will show up. Here is an example:

someLabel.text = NSLocalizedString(@"Your string value here.", @"Description for the translator about your string.");

If you search online for how to grab all of these types of strings from your method files and place them into Localizable.strings, you will find the following terminal command:

genstrings -o en.lproj *.m

This command will only search the method files in the current directory. To include subdirectories run this command:

find ./ -name "*.m" -print0 | xargs -0 genstrings -o en.lproj

NOTE: There are quotation marks around *.m, otherwise you will receive a “genstrings: couldn’t connect to output directory en.lproj” error.