As your company grows, it is natural to move from Heroku to AWS. What about the reverse?

“Migrating from Amazon EBS to Heroku”, with logos of each service
“Migrating from Amazon EBS to Heroku”, with logos of each service

Why switch to Heroku?

I migrated my Django-based website from AWS ElasticBeanstalk to Heroku for three reasons:

  1. Test/Prod environment parity. Regardless of which Continuous Integration service you use, your test environment will be different from production. Among other disparities, AWS doesn’t provide any test platforms which validate your directory.
  2. Simplicity. If you’re a small team, the complexity of AWS is probably not worth it. …

A quick tutorial to get you started with a MaxBotix Ultrasonic Sensor and a Raspberry Pi. These ultrasonic sensors are an inexpensive way to detect the distance to the nearest object in the line of sight.

Image for post
Image for post

If you’re here, you may have already tried following the MaxBotix tutorial and found that your data is garbled. Rather than the data looking like “R102” representing 102 inches, you’ll see something like “+\X04\X02\X04”. The issue is that some sensors write TTL data, and others write RS232 data. The Raspberry Pi’s RxD serial pin cannot read RS232 data — it’s inverted, and no, you can’t just flip the bits in software! You’ll need to flip the bits in hardware. …

Running a Twitter Bot on AWS Lambda is almost certainly free — the Twitter API rate limits are low enough that you’re likely not going to exceed the 3.2 million seconds of free compute time per month.

To make the @realBigBoyTrump TwitterBot, I needed to read each of Trump’s tweets and translate them to babyspeak:

Every two minutes, my bot polls Trump’s twitter account for any new tweets. How can we keep track of which tweets are new since our last check?

  1. Bad idea: just check for tweets sent in the last two minutes
    This will miss tweets that were just over two minutes old (but that your last poll missed), and you’ll never get tweets back on any failed runs. …

A standard election allows you to vote for one candidate. Your ballot looks like this:

An election with four candidates: Vanilla, Strawberry, Banana, Blackberry. Strawberry is checked.
An election with four candidates: Vanilla, Strawberry, Banana, Blackberry. Strawberry is checked.

The results of such an election are easy to understand, too:

Overcoming the surprisingly stringent thread-unsafety of Qt

Writing parallel code is always a challenge, but there are extra precautions you must take when multithreading with the Qt framework. Failing to heed these precautions will lead to race conditions which cause random, hard-to-track and hard-to-reproduce crashes.

What “thread-safe” means to Qt

Most objects in Qt are not thread-safe. In other contexts, an object that is not thread-safe means that only one thread can read to or write from that object at a time. Practically speaking, Qt has a more stringent definition: only a single special thread, known as the “GUI thread,” may touch it.

In Qt, the GUI thread runs the main event loop. Because of some hidden global state kept by Qt, even seemingly-isolated Qt objects have pointers to resources which are not kept thread-safe. This means that most Qt objects may not be touched by any other thread, even if they are completely isolated to that thread. …


Armin Samii

Building products using computer graphics and data visualizations. Ranked-Choice Voting enthusiast. Pittsburgh, PA.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store