Active Record is a popular Object Relational Mapping system (ORM) that many web developers find themselves using at some point or another. A lot has been said about the benefits and drawbacks of ORMs in general, and Active Record shares all of them. Regardless of how you feel about it, using Active Record will be […]
Some error messages, like C++ template errors, are inscrutable, and some, like the venerable favorite “segmentation fault,” are uselessly vague. But the merely unhelpful messages aren’t the worst. It’s the misleading error messages that take the prize.
With over 50 college juniors and seniors taking part, Atomic Games 2017 was a great success. This year’s participants built AIs to play a custom RTS written in-house here at AO. Since we had so much fun building and playing the game, we decided to open-source it: Space Battle 2: Resource Collectors.
Ruby makes it easy to extend its built-in classes, which can be very convenient and lead to more readable code—but it can also be dangerous. This practice, known as “monkey patching,” is common in the Ruby world, and since Ruby 2, it’s been possible to mitigate some of the risks using refinements.
The number-one, easiest way to make Ruby threads communicate and synchronize is to use the built-in Queue class. You can even see this in the Ruby docs: This class provides a way to synchronize communication between threads. Unfortunately, a Queue isn’t always what we want. So, how can we build our own primitives that are […]
In my dabbles into game development, I’ve loved the expressiveness of Ruby, but longed for the performance of a compiled language. (Anyone else in that boat?) I recently heard about a newer language that promised “The beauty of Ruby with the speed of C.” Its name is Crystal.
In this post, I will review options for parsing Excel files using Ruby. I’ll discuss the different types of Excel files and introduce some of the Ruby libraries that exist for working with them. Note that I focus mostly on reading Excel files in this post, but there is some discussion around writing/updating them as […]
It seems that on every Rails project I work on, I end up writing utility scripts that make changes to the production data in some way or another. Perhaps it’s pre-loading hundreds of user accounts for a customer that wants to provide a spreadsheet of users, or populating an account with fake data that can […]
Heroku provides a convenient command line interface for executing snippets of Ruby code remotely. One-liners can easily be piped into the heroku run console command. But what about much longer scripts that you write locally and want to execute in a remote Heroku environment? In this post, I’ll show you how to execute a long […]
I recently came across a situation where I needed to be able to upload a file to a Rails server with Active Admin. I did a quick search on Google and found this post by Job, a fellow Atom. Our use cases were a little bit different, though. He was storing the file contents directly […]