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 https://get.rvm.io | 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.


Shoes Without Breaking the Bank

In today’s society tennis shoes appear to be the normal everyday shoe of choice. They are comfortable and come in various assortments of style and color. I never was a fan of wearing tennis shoes and felt that something a tad more presentable should be worn. In my opinion, nothing looks smarter than a nice set of shoes coupled with a pair of jeans and button down shirt. This past week I found myself looking for a new set of shoes. The shoes I had in mind were a set of light brown wingtips versatile enough to wear with a suit or casual attire.

A set of good quality shoes with proper maintenance will last for years, however buying nice shoes doesn’t have to involve spending a lot of money. I typically only purchase things when there are sales or while shopping at outlet malls. I found the perfect set of Cole Haan wingtip shoes after browsing through a few stores at a particular outlet mall . Best of all the shoes were about $100 off of the original sale price.

Cole Haan Wingtip Shoes

If you have a limited budget there are some fairly inexpensive pairs of shoes that also look well. Here are a set of Wingtip shoes from DSW which look similar to the ones I purchased for even less (the color varies depending on selection).

DSW Wingtip Shoes

Final Thoughts

Dressing smart or dapper doesn’t have to be an activity limited to people who spend a lot of money on clothing. If you stick with with interchangeable classic items you won’t have to buy as many shoes, shirts, suits, etc. Always keep an eye out for deals and stores which offer quality clothing at a discounted price, any chance to save money should be taken advantage of.


Speed Reading

I have always struggled with reading fast, and would say that I read slightly slower than the normal person. It has always been something I wish I could do better, but just dealt with. After embarking upon my literary journey this year, I have come to find that the main thing which holds me back from reading faster is mouthing words as I read them. This shouldn’t necessarily be looked at as something bad, because it also has its benefits. It has made me an efficient technical reviewer since I think about what is written while it allows my mind time to process. However if the goal is strictly to read fast, then it definitely hinders me.

About mid February I came across an article on the Art of Manliness website titled “How to Speed Read Like Theodore Roosevelt.” This article intrigued me for different reasons. Since I love learning about history, it appealed to my intrigue to learn more about a past president. Did you know he would read a book every day before breakfast? It is amazing to learn that Theodore Roosevelt read tens of thousands of books in his lifetime.

This brings me to the other reason, speed reading in an effort to increase my own reading pace. It’s quite interesting that the first point the article makes on vocalizing is exactly what slows my reading down. After reading the article I decided to give a few of the tips a go. By using my finger to pace my reading I have substantially increased my reading speed. This tip has also forced me to stop vocalizing the words I read. If you are interested in improving your reading speed then you should definitely read the article and try out the Spreeder website.