Referencing Substrings Faster, without Leaking Memory

posted by Craig Gidney on December 3, 2013

In this post: computing substrings in less than linear time, without introducing tricky memory leaks. Java Substrings Last month, Java changed how it computes substrings. Previous versions of Java computed substrings by just grabbing a reference to the parent string, and noting the offset/length of the substring within it. This was extremely efficient, taking only […]

Not Crying Over Old Code

posted by Craig Gidney on November 26, 2013

There is a meme in the programming community which goes roughly as follows: I always hate my old code but that’s good because it means I’m improving. I think that’s wrong. Most Improved If you join a team that plays a sport you’ve never played before, you can expect to get a “Most Improved” trophy […]

Exploring Universal Ternary Gates

posted by Craig Gidney on November 19, 2013

In this post: finding a gate that can emulate any other gate when using three-valued logic. Universal Gates Logic circuits are made up of gates connected by wires. Wires hold values, and gates operate on those values. Creating a circuit that computes a particular function is just a matter of running the inputs through the […]

Impractical Experiments #2: Securing Peer to Peer Fog of War against Map Hacks

posted by Craig Gidney on November 12, 2013

In this post: how to beat map hacks, without a server to hide the information on, using cryptography. Map Hacks and Publicly Private Information Map hacks are a common problem in real time strategy games. Most RTS’s use a networking model called lockstepping. When lockstepping, the state of each player’s game is not synchronized so […]

Achieving Exponential Slowdown by Enumerating Twice

posted by Craig Gidney on November 5, 2013

In this post: the cost of iterating over a sequence multiple times. Deferred Danger One of the many useful warnings in ReSharper is “Possible multiple enumeration of IEnumerable“. If you enumerate an enumerable more than once, ReSharper detects that and warns you about it. Although this warning may seem pointless at first, there are two […]

Using Immortality to Kill Accidental Callback Cycles

posted by Craig Gidney on October 29, 2013

In this post: how I ensure consuming futures and cancel tokens from the collapsing futures library can’t introduce space leaks. Human Error Me, you, and humans in general are all terrible at consistently doing anything. Any process that relies on you not making a mistake is fundamentally error-prone. As programmers we spend all day every […]

Cancellation Tokens (and Collapsing Futures) for Objective-C

posted by Craig Gidney on October 22, 2013

In this post: benefits of cancellation tokens, and updates about the Collapsing Futures library. Cancellation Tokens Sometimes you want to cancel asynchronous operations. For example, when a user closes a browser tab before it finishes loading a web page, it is expected that the browser will immediately stop fetching that page (as opposed to letting […]

Visualizing the Eigenvectors of a Rotation

posted by Craig Gidney on October 15, 2013

In this post: a visual understanding of complex eigenvectors. Motivation Did you know rotation can be thought of as a type of scaling? I’ve been trying to fix the fact that my knowledge of quantum computing is not well grounded. To that end, I’ve been slowly working my way through the first couple chapters of […]

Collapsing Futures in Objective-C

posted by Craig Gidney on October 8, 2013

In this post: practical examples of benefits of using collapsing futures in Objective C (library available on GitHub). Experimenting Returning readers may remember I’ve posted in the past about futures. I wondered if separating may-fail-ness from eventual-ness might be fruitful, and if making futures automatically unwrap when nested would be a good idea (in weakly […]

Bug Hunting #1: Garbled Audio from End to End

posted by Craig Gidney on October 1, 2013

“Hello. Hello? Hello!” “I don’t hear anything.” “How about this?” dragging the bottom of the phone along the desk “Whoah, that’s trippy. *Twangs* for days.” “Yeah. I have no idea why it’s happening.” Garbling I was working on making sure our voip app could interop with another voip app. It was going pretty well, all […]

Older Posts Newer Posts

Twisted Oak Studios offers consulting and development on high-tech interactive projects. Check out our portfolio, or Give us a shout if you have anything you think some really rad engineers should help you with.