Browsed by
Category: Problem solutions

Out of Source Builds

Out of Source Builds

Build systems are certainly not the sexy parts of software development. However, no part of the development process impacts your team so much as it’s build system. Build systems that perform poorly, regularly break, or generate inconsistent or confusing output files are one of the fastest ways to introduce bugs, slow releases, and bring a whole team to a screeching halt. That’s why automated reproducible builds are a keystone of agile development.

Out-of-source builds are one way to improve your build system. Out-of-source building is a practice that keeps the generated/compiled intermediate and binary files out of the source file directories. Traditionally, most build systems would generate object, binary, and intermediate files mixed right next to their source files. This leads to a confusing hierarchy of files that made getting a consistent picture of your build and source nearly impossible on big projects.

It turns out CMake can help you create our of source builds with just a few little tricks. Unfortunately, there were few examples and many of them were overly complex. So, to help get folks started, I wrote up a very simple sample. It’s the perfect starting point for your next project. It works with both Linux and Visual Studio builds.

https://github.com/mattfife/BasicOutOfSourceCMake

Optimal Battleship

Optimal Battleship

Nick Berry, president of DataGenetics, meticulously analyzes different strategies to play the classic board game Battleship (he also has done Chutes & LaddersCandyland and Risk)

It’s a great example of how computer scientists often work. He explores a host of techniques and analyzes the results by calculating how often you’ll get a perfect game, median number of guesses, and how bad it gets in the worst case.

He examines 4 major strategies:

  1. Pure random searching
  2. Hunt and Target – Hunt randomly until you get a hit, then proceed methodically to sink the hit ship.
  3. Hunt and Target with parity – since the minimum length of a ship is 2 units, you need only search even or odd squares
  4. Hunt and Target with parity combined with a probability density function.

His fourth approach is the most fascinating. The system calculates every possible configuration of the remaining ships, and then sums up the probability of a ship on each square. At the beginning, all the squares are basically equally probable, but as more and more guesses are made, the number of possible configurations decreases. If you continually calculate the sum of these possibilities, pick the square with the highest probability and repeat this process, you get significantly better results.

How much better? Purely random guessing gives you a median of 97 moves. Using parity with the hunt+target method averages 64 moves. But using the probability density function increases that to a staggering 42 moves on average.

Turns out, I discussed the use of this kind of probability density function by speedrunners who used the same technique to beat the splosh-kaboom minigame in the Legend of Zelda Wind Waker.

Copyright free chill/ambient music

Copyright free chill/ambient music

Are you slapping together that next big startup idea pitch reel? Want to become a streamer or Youtube star? At some point, you’re going to need some background music to fill dead spaces, set the tone, etc. But how does one avoid a dreaded DMCA takedown?

While there are lots of online shops that will sell you royalty-free music, I usually find myself running off to find the amazing amounts of free stuff out there – like this.

Hooking 2 modems together without an active phone line

Hooking 2 modems together without an active phone line

Land lines are getting hard to find these days. Almost as hard to find as old modems.

Back when I was a kid, I wanted to play a network game between two computers in my own house. I achieved this by hooking the modems up in a daisy chain. One modem plugged into the phone line like normal. On the ‘out’ port of the modem, I ran another line from it to the IN line of the 2nd modem. I then had the 2nd modem call our home phone number – which caused our phone to ring, the other modem picked up, and they made their normal connection sounds and connected! I could then unplug modem 1 from the phone line and the computers stayed in contact without issue.

At the time, I thought I needed a dialtone generator or line generator. Little did I know, I could have done it with a simple 9 volt battery and the right sized resistor. Skip along to 8:25 to see how to wire them together.

TP-Link OneMesh Network configuration and speed testing

TP-Link OneMesh Network configuration and speed testing

I recently bought the highly recommend TP-Link AC1750 Smart WiFi Router when my old one started acting up and generally being horribly out of date. Modern routers have some great features.

I also have some TP-Link RE220 range extenders (repeaters). The question was – how should one set these up? There’s a lot of different configuration options.

Turns out that Behfor’s channel on YouTube has answered my questions with some excellent testing. The first video covers the RE220, the second video covers the different ways to set these up using OneMesh – and which are the best for both connectivity and for throughput.

Beating splosh-kaboom minigame in Legend of Zelda: Wind Waker

Beating splosh-kaboom minigame in Legend of Zelda: Wind Waker

It took them about 10 years to build this speed running tool, but here it is. How it helps you win is even more fascinating than the minigame itself. Random number generators on consoles are notoriously simple and have been exploited for some time – but this takes it to a whole new level.

It’s a beautiful example of how a computer scientist would break down and solve a problem. It’s also a perfect example of why cryptographically secure random number generators are essential to computer security.

I think I might use this question in future interviews…