Assigning a static reference to an instance method call could be perilous. Let’s take a look at an example Java class to examine why:
/**
* Foo.java
*/
public class Foo {
public static String foo = Config.getInstance().getFoo();
}
Seems pretty innocuous in itself, but ostensibly we’re just assigning static reference in Foo
to a Config
singleton call. For our purposes, assume Config
has both setters and getters for values we want to store configurations for. …
I’m returning to university, and it just so happens that it’ll be during a global pandemic. Granted, I’m only going half-time as I have a full-time job, and it is an online course so the material itself probably won’t be different pandemic-or-none. Regardless, interesting enough to warrant a new blog series on the topic.
You might be wondering: Why return to school at all? You’re already a software engineer, what’s there to gain? Well, unfortunately, the answer to that question requires exposition.
In 2001, at the age of 13, I was given the choice of either continuing to attend my…
Getting your blog post to play nicely with Safari Reader—my preferred way of consuming blogs—isn’t always obvious. This post documents my findings in how to optimize a blog for Safari Reader if you’re publishing outside of Medium (e.g. Jekyll).
<article>
tagSafari Reader will look for a couple of container tags, but for a blog post <article>
makes the most semantic sense. I recommend wrapping all content that you would want to appear in the reader. For example, You'll notice that my header image is inside of my <article>
tag, which informs Safari Reader to include it.
<h1>
tagAdditionally, it should be the…
There’s been some significant infrastructure changes under the hood of Quasars and I wanted to talk about them here.
In another blog post I had talked about how Quasars uses Blue/Green Deployments, but as of today, that is no longer the case. In reality, very little has changed. Instead of having two web servers being toggled between with a floating IP, these two web servers fulfill requests behind a load balancer.
Quasars is a hobby project. As such, it serves an important role of being a conduit in which I can learn new technologies. Kubernetes is one of these technologies…
I am the creator and administrator of quasa.rs, a social link-sharing web application (like reddit or hackernews) for astrophysics. It’s a fun side project that keeps me from getting rusty with Ruby on Rails because, sadly, I don’t use Ruby for my day job anymore. Plus I get to talk and think about space! What’s more fun than that?
Because quasa.rs is a side project, it was important to keep its server costs low. However, just having a single box wasn’t an acceptable solution either: Quasa.rs does have some users, so I need to have some way to prevent downtime…
MIT’s OpenCourseWare is an amazing resource—I often can’t believe that it exists at all. For the unfamiliar: OpenCourseWare is a collection of some of MIT’s classes, often complete with lecture videos, problems sets, quizzes, and answers. Oh, it’s also completely free.
There’s a significant drawback though (well, two drawbacks considering you can do all of these classes and never get a degree): You’re left to your own devices to choose what classes to take and in what order. …
Years ago I was working on a very large Ruby on Rails codebase that used constants to hold lists of credit card transaction states. For example:
# example 1
class Txn
ACTIONABLE_STATES = [:authenticated, :to_settle]
DONE_STATES = [:settled, :declined]
# ...
end
However, we had a bug in which a settled transaction could pass a txn.state.in? ACTIONABLE_STATES
check. After hours of searching, we found the offending code in a completely different part of the codebase.
# example 2
all_states = ACTIONABLE_STATES.concat(DONE_STATES)
all_states.each do |state|
# ...
end
If you’re already knowledgeable of the Ruby Array
class, you’ve probably spotted the…
I could argue (to varying degrees of success) that pair programming isn’t productive. Productivity of a practice is an easy thing to attack because, in our capitalist dystopia, it’s the end-all-be-all metric. But I hate pair programming, and it’s not just because I don’t feel productive. It’s a lot more than that.
Five years ago I was an unpaid intern with a twinkle in my eye. Every technology and every practice was new and exciting and my brain was a sponge. As I progressed out of the internship some of these practices (e.g. testing, version control, continuous integration) became invaluable…
How likely it is for each digit of pi to appear? Let’s find out by charting the digits of pi into a frequency graph.
The more data I can collect, the more apparent patterns (if any) will appear. I wrote this Python script (below) that searches for each instance of each digit. For this project I will analyze 1,000,000 digits of pi.
import matplotlib.pyplot as plt import numpy as np with open('pi.txt') as f: read_data = f.read() # 0 1 2 3 4 5 6 7 8 9…
In 2012 I, with two other nerdy roommates, switched to Dvorak. Five years later (four of them spent as a Software Engineer) I am switching back to Qwerty. In fact, I am struggling at 30 WPM (a 70% reduction in speed) to write this post now.
Patrick is a software engineer from New England. Today, he resides in the Emerald City, waiting patiently for the Kraken to be released.