# Posts

• ## How I Think About Ratio Problems

Describes how I think about ratio problem in a hope that it may help somebody else.
• ## Iff in Swift

Builds a $\Leftrightarrow$ in Swift, a prediate operator meaning "if and only if". This can then be used on booleans in the way that would be expected, especially as it has a lower precedence than comparison operators.
• ## The Best Code Isn't Always the Most Understandable

Looks at the idea that code should be understandable by whoever is reading it. This doesn't fit in with the current abstractions used where we're happy to use libraries and frameworks where we have no idea how they work.
• ## Comparing Floating Point Numbers

Comparing floating point numbers when programming is not as simple as it might seem. This post looks at some of the common pitfalls when comparing floating point number, and explains why they are wrong. It also looks at good ways to compare them for equality.
• ## Recursion

This post looks at recursion, and when it should be used. It shows that it is a useful tool for thinking abou many problems.
• ## C Pointers

C pointers are something that people often get confused about. This is at least in part due to the decision in C to make the $*$ operator a unary prefix operator (when refering to types). This post explains how pointers work in C, and where the confusion about them comes from.
• ## Blocks and Memory Management

This post examines the way that blocks memory is managed, in both Manual Reference Counted environments, and Automatic Reference Counted environments. This is an interesting topic and more complicated than one might imagine. It includes the use of stack objects, which don't normally exist in Objective C.
• ## Great South Run

In 2014 I ran the Great South Run, a ten mile run, for Tourettes Action. This is my post begging for money for that charity. It's a great cause, whilst I don't currently have any plan to run it again, please go and donate anyway!
• ## Xcode 6 Simulator Folders

With the update from Xcode 5 to Xcode 6 the folder structure of the simulator folders because more complex, and harder to navigate. This gives a bash script to find the correct folder based on the simulator and app names.
• ## Horizontal Paging Scroll View with Varying Width in Storyboards

How to make a horizontal paging scrollView with varying widths in storyboards.

Google's polyline encoding encodes series of latitudes and longitudes into an efficient 64bit encoding. The algorithm that does the encoding can be found here, however, it is poorly explained. This post gives a C implementation of the algorithm, and explains what it is doing at each step.
• ## Home Projects

A post about the how to stay motivated and finish coding projects at home.
• ## Code style guides

A bit of a rant about people claiming that one style is better than another. Whilst its useful to follow a style guide, both personally and organisationally, conforming to a different style isn't difficult (unless there is actually something wrong with it).
• ## iOS: What happens when I touch the screen?

This post describes what happens in an applications code when a user taps on the screen. It describes how the UIView/UIViewController that deals with the touch is found, and the methods that are then called.

The description of AddArcToPoint in Apple's documentation doesn't explain what it did very well. So here is a blog post explaining it more clearly.
• ## Make a UIButton move with a CALayer

This is a hack to make a UIButton move around the screen with a moving CALayer. I can't remember the reason this was desirable, but it was fun exploring the relationship between views and layers.
• ## Tool to apply CIKernel

A command line tool to apply a CIKernel to an image and save the result. A CIKernel is a piece of code similar to a OpenGL shader. These can be used to create new filters for images.
• ## Trains

A rant about trains in the U.K.