Seven Years later: What I Learned from Building an AI Chatbot – Part 1

A detailed illustration of a human head in profile, filled with gears and circuits, representing a blend of mechanical and electronic elements.

Seven years ago, I embarked on an ambitious attempt to build a rudimentary rule-based AI chatbot. Frustrated by the limitations of Apple’s Siri and motivated by exciting updates to Apple’s Natural Language Processing APIs, I dreamed of building something that could understand complex queries, construct mental models of objects, and seamlessly interact with users using just their voice. Siri was merely a fancy voice control toy; I wanted to perform calculations, manipulate data and leverage the dynamic power of language to build a tiny virtual world inside my iPhone, just like an intelligent computer system from Star Trek.
Continue reading

Encrypt data using AES and 256-bit keys

AES stands for Advanced Encryption Standard and is an industry-standard algorithm for encrypting data symmetrically which even the US government has approved for SECRET documents. If you don’t know what symmetrical encryption is, it means that you use the same key or password to encrypt the data as you do to unencrypt it. So you need to keep the key extremely secret however it’s still incredibly useful. I’ll show you how to use openssl to encrypt some data and decrypt it using the Common Crypto libraries on iOS.
Continue reading

Quick way of cleaning HTML for iOS apps

For some reason HTML is always dirty, it’s usually full of Analytics tags, JavaScript or contains nested HTML tags. This is usually fine for displaying in browsers but at some point an iOS app will need to display HTML content and usually when it does, you need it to display clean HTML or only a small subset of HTML tags… all it takes is an unexpected tag and the whole document layout could be ruined. So here is a way of quickly and easily stripping HTML content down.
Continue reading

How to build a Ghostbuster Proton Pack

Ghostbuster Proton Pack laying flat on a table in a dark room

I decided to go as a Ghostbuster for a fancy dress party recently. Of course all Ghostbusters need fully working Ghostbuster proton packs complete with animated LED displays and electroluminescent glowing wires, so here are the details on how I built mine. It took about 3 or 4 evenings to build and involved Arduinos, lots of hot glue and over 92 LEDs! It is just a shame I missed out on the best fancy dress award that night because it looked ‘too realistic’!

Ghostbusters-pack-in-dark

The Ghostbusters proton pack lit up in the dark

Continue reading

Beautifully-formatted Times and Numbers

Example of rendered proportional numbers and monospaced numbers

Example of rendered proportional numbers and monospaced numbers

Not all font instances are created equally! In iOS text is mostly displayed using proportional fonts, meaning each character width is trimmed and varies depending on each character. This makes the text easier to read and feel more natural and you’ll notice this on characters such as ‘i’ which will often be the thinnest character compared to say an ‘m’ character. However for numbers displayed in a tabular format such as times, figures and currencies you’ll want monospaced characters so you can tidy up the layout and visually scan the data quickly. So how do you do this?
Continue reading