How would you – most elegantly – crop out the center square of an image, preserving the aspect ratio and output the image with a given size?
That’s a good question. There is a “classic” and a “modern” method to achieving this.
Chapter 6 in my book deals with how to build a solid wrapper around a RESTful web service and how to unit-test it. I thought I had finished principal writing on my book when I handed in chapter 7, soon too appear in the Manning Early Access Program (MEAP) for readers who have preordered.
I walk you through implementing a wrapper – using NSURLSession – for searching for CDs on Discogs by scanned barcode. Until now the Discogs search API did not require any sort of authentication, which made it ideal for this example. Then a fateful email arrived on Friday, June 20th.
I extracted all E-Mail addresses from my archive, dating back almost 6 years. From the resulting 7303 I filtered all that didn’t seem to address individual people. That left 5466.
For a while I considered sending an email to all of these via Mailchimp. I even wrote the letter below, in English because I figured that most people would understand that. But then I decided against sending a mass e-mail, fearing that it would cause me more trouble than positive outcomes.
Instead I’m posting it on my blogs. Much less of a nuisance …
For the ProductLayer sign-up form I wanted to make sure that the user can only send a sign up if the email address is valid. If you google for ways to validate an email address you most often solutions involving regular expressions. But since I don’t trust a RegEx unless I know it by heart, I implemented the validation with Apple’s own NSDataDetector for links.