Thomas Lextrait

Sr iOS Developer at Square

Page 2

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 →

Building a Drone With Arduino (p1)

There’s a few things I’ve always wanted to do but never had the time to. One of them is to play with an Arduino. The Arduino is a piece of hardware designed by a team in Italy (the blue board in the picture below).



This little board is truly disruptive because it breaks down several barriers that existed in the hardware world. I’ll illustrate this with an example: in order to develop a hardware product (a drone, a smart thermostat, a phone…) one could buy an ARM processor on a board and program it except…

  • That board costs a lot of money
  • The documentation is very complex and meant for professionals working in big firms that integrate this into consumer products
  • It requires proprietary software and cables in order to load applications into the board

Arduino solves all these issues. First the Arduino UNO costs just $25 from the official store, or much less if bought from a...

Continue reading →

UPC Database

I spent some time trying to find a UPC database. Essentially it is a database that associates bar codes to products and company names. Usually you would pay money to purchase such a database from a company that keeps one updated. However it turns out there is one available for free, right here:

I could be mistaken but I believe it dates back to 2010.

View →

Prime Numbers

Prime numbers are fun and it’s even more fun to come up with ways of finding them. People interested in prime numbers are usually interested in these areas of research:

  • Finding algorithms and formulas that yield a lot of prime numbers
  • Discovering the largest prime number possible
  • Designing algorithms that can evaluate a prime number as fast as possible

In this post I’m just interested in coming up with a very efficient way of finding all the prime numbers up to X. To achieve this, I designed a simple C program that applies a well known algorithm.

 The Algorithm

First, a prime number is a positive and integer number that can be divided only by itself and 1. Such numbers are:

1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29...

Whether 1 is a prime number or not is up to discussion…

The obvious way to find these numbers is to follow the prime number definition and figure out if each and every...

Continue reading →