Thomas Lextrait

Sr. iOS Developer at Google

Page 2

Drone Hardware For The Rest Of Us

Coming from a software background I learned a few things about hardware while working on my Arduino drone. Much of what I learned is probably very simple and obvious and often that means it is not discussed much online as it’s considered common knowledge. However the landscape is changing: with Arduino, the barrier of entry has been lowered and people (such as me) who are not electrical engineers or hardcore hobbyists are able to build things. In this post I’ll go over a few things I learned and I hope it can save a few people many hours of research and trial & error.

CW and CCW propellers

I always knew propellers could be designed to rotate either clockwise or counter clockwise.


However when I bought a set for 4 propellers on Amazon, I didn’t expect half of them to be clockwise and the other counter clockwise. It wasn’t mentioned on the listing at all. It is obvious now, quadcopter...

Continue reading →

Generic UI: Input<T>

Generic User Interface

For quite some time I’ve been bothered by the small use of generics in Apple’s iOS libraries. Third party libraries also typically make little use of generics. Generic typing is a fantastic feature of Objective-C and Swift. It allows developers to write code that is incredibly re-usable. The point of generics is really to write less code yet make it even more robust and less prone to errors.

TL;DR GitHub Generic UI

What Are Generics? (or skip this to the next part)

For those who don’t use statically-typed languages much or just don’t know about generics, the simplest example is that of the array:

class Array<Element> { ... }

In this example the generic type is Element. The person who created the Array class made it so you can customize it for your own use. You can supply – at compile-time – the type of element the array will store. So if you make an Array<String> you will know...

Continue reading →

Find All Images With Given Attributes

I’m an iOS developer and with the release of Xcode 8 came a little issue. Apple introduced wide-color support on iOS 9. This meant that if you had 16 bit images then you couldn’t target older iOS versions, otherwise you would see something like this:

ERROR ITMS-90682: Invalid Bundle - The asset catalog at ‘Payload/XXXXX/’ can’t contain 16-bit or P3 assets if the app supports iOS 8 or earlier.

So this prompted the need for me to easily find 16-bit images. Apple did help with that but it was really Xcode-project specific and I wanted to have something more generic.

Note For iOS Devs (Others can skip)

For those of you who are finding this page because you’ve had this error, do also check this page: and note the following:

If your Deployment Target is set to either 8.3 or 8.4 and you have an asset catalog then you will...

Continue reading →

Source Code Is Only Half the IP

Nowadays every company needs to be making some kind of software. Every company needs a website, a mobile app maybe or more. Because of that most companies, including non-tech companies have either adopted a team of developers or have allocated a budget for outsourced software development.

We have all come to realize that source code becomes stale very quickly if it is not maintained and updated. Libraries, API’s, plugins, smart phones all change and applications that depend on those eventually stop working if they’re not updated. This means we live in a world where you can’t just pay a team of developers to build a website or an app and then it’s just “done”. Software development is a never-ending process.

Because software development is never ending, projects typically last years if not eternity. People rarely stick around for the whole lifespan of a software project. Software...

Continue reading →

The Developer’s Dilemma

Screen Shot 2016-10-18 at 10.53.47 AM.png

I often see developers, team leads, development managers and so on who say they don’t have time for non-programming activities. Because of an aggressive schedule (I don’t know any company that doesn’t have an aggressive software development schedule), there is no time for:

  • Documentation
  • Recruiting
  • Blogging
  • Experimenting with new frameworks and tools
  • Building experimental features
  • Looking into new processes
  • Doing security audits
  • Fixing security issues that nobody knows about
  • the list goes on…

All these things though are crucial in the long term to ensure the success of the project and the company. Many recognize that and often the complaint is: “my boss (who may be a lead, a manager, director, VP Engineering or CEO even) doesn’t give me the time and flexibility I need”.

My theory and of course it’s just my own and I very well may be mistaken, is that when given the choice between...

Continue reading →

Road Trip Calculator Update

Some time ago I created the road trip calculator and wrote a post that went over the calculation of the true cost of driving from Boston to New York City in a $25,000 car.

Today I am making a small update to the calculator. Aaditya Prakash, a good friend of mine who is pursing his PhD in Computer Science at Brandeis pointed out a small flaw in the calculation. Aaditya reminded me that owning a car has a fixed cost and taking a road trip has no impact on that cost. Therefore in order for you to know how much your road trip is costing you, and I mean the road trip alone, then the pro-rated ownership cost needs to be subtracted from the calculator’s result.

Car Ownership Costs

In order to really focus on the fixed ownership costs – meaning costs that don’t vary based on your driving – let us assume you’re not driving your car at all. What do you need to pay for?

  • Insurance
  • Excise tax –...

Continue reading →

Arduino: Power Consumption Compared

When I first started working on my Arduino drone, I decided I wanted to evaluate, understand and compare components before selecting them. Then I would be able to come up with an optimal combination of components, or if not then at least I would understand where my design is lacking.

Something I thought is fundamental is understanding the power consumption of every component so I could design a drone with a long range. However I couldn’t find a lot of data on the power consumption of the most key component of my drone: the Arduino.

At first I was tempted to just get the “best” Arduino, meaning the one with the best specs and most inputs/outputs. But why base the drone on the Arduino Mega for example, if it could run just fine on an Arduino board that consumes less power? And actually, the real question is: which one will consume the least power versus the specs it provides?

I thought...

Continue reading →

Boston to New York: The True Cost of Driving

It is no secret that I love to drive. It may sound insane to many but I actually enjoy my 30-minute morning commute to work. For me it’s a privileged time when I’m alone, comfortable and can catch-up on podcasts and audio books. Anyhow this post isn’t about that, it’s about the true cost of road trips.

I have flown, taken the train, taken the bus and driven to New York many times. No surprise there: driving is my favorite because it’s the mode of transport that provides the most freedom. So what does it really cost to drive from Boston to New York and back?



Let’s assume you own an average German car that’s worth $25,000 and has 15,000 miles. It doesn’t matter what brand or what options it has. We know that when it reaches 30,000 miles it will be worth $20,000 (Edmunds). That’s essentially a depreciation of 30 cents per mile. I know it’s not linear but let’s assume it is...

Continue reading →

Displaying Custom Pins on MKMapView for iOS

Update: Please note this post is not up to date and today I no longer recommend this approach for customizing pins for iOS Maps. Apple now makes it much easier to customize map pins, please read this.

Please forgive minor inaccuracies since this is my very first iOS development post! email me with your suggestions. Also, this should work with at least iOS 7 and 8.


I have found a few articles on the web that explain how to customize map pins but it turns out that a few issues arise when one does. Additionally an important use-case that I haven’t read a lot about is when pins need to contain dynamic elements such as text, which would be unique to one pin. I thought that I’d consolidate all this information in one post.

First, when designing custom UI elements I always prefer implementing a separate class. Therefore I recommend sub-classing either MKAnnotationView or...

Continue reading →

Marriage in Vietnam

Thanks to my wife Nhi for helping me write this post

Traditional Wedding Ceremony (“Lễ Vu Quy”), December 31, 2014

This winter I got married in Vietnam and did a traditional ceremony. It was fun and I wanted to share some of the details and intricacies such a wedding entails.


On the day of the ceremony, the groom organizes a procession that travels from his house to the bride’s – Obviously I don’t live in Vietnam so we used a hotel in Saigon. The procession is led by two representatives: a married elder couple who is chosen to help organize and respect the traditions. They are followed by the groom, the groom’s parents and family, and the groom’s friends.

Procession, Gifts & Significance

In the procession, the groom, his family and friends bear decorated boxes covered in red cloth. These boxes contain gifts representing the wealth that the groom’s family will bring to the bride’s...

Continue reading →