I deal with a lot of servers at work, and one thing everyone wants to know about their servers is how close they are to being at max utilization. It should be easy, right? Just pull up top or another system monitor tool, look at network, memory and CPU utilization …| Brendan Long
LLMs Can't See Pixels or Characters | Brendan Long
This might be beating a dead horse, but there are several "mysterious" problems LLMs are bad at that all seem to have the same cause. I wanted an article I could reference when this comes up, so I wrote one. LLMs can't count the number of R's in strawberry. LLMs …| Brendan Long
The United States has a strange (legal) tax loophole where you can double-count capital gains when donating securities (with some restrictions): If you buy a stock, the value goes up, and you've held it for at least a year, you can donate it and claim a tax deduction on the current market value instead of the value of what you paid for it (the cost basis), and you don't pay taxes on the gains.| Brendan Long
I've always found it annoying to have a bunch of keys in my pocket (they're heavy, sometimes poke into you, and create weird bulges), so I try to carry as few as possible. Unfortunately, I've reached a point where I have a fairly large number of keys that need to …| Brendan Long
This is probably obvious to a lot of people, but I thought it still might be useful since I didn't think of it myself for years. Since sometime in college, I've been the kind of person who wakes up groggily at 10 am and then drags myself out of bed. I've always been a late sleeper so I didn't think much about it, but when I stopped taking allergy pills, I fairly quickly became someone who woke up around 8:30 am without much effort (still not early but not crazy-late).| Brendan Long
Elizabeth Warren recently proposed a wealth tax as part of her plan to partially pay for single-payer healthcare. I think this is significantly worse than other methods of raising the same amount of revenue from the same group of people, so this article describes the problems with wealth taxes plus …| Brendan Long
A few jobs ago, I worked at company that collected data from disparate sources, then processed and deduplicated it into spreadsheets for ingestion by the data science and customer support teams. Some common questions the engineering team got were: Why is the data in some input CSV missing in the output? Why is data in the output CSV not matching what we expect? To debug these problems, the process was to try to reverse engineer where the data came from, then try to guess which path that data ...| Brendan Long
In school this week, the idea of finding palindromes in Python came up, as a homework assignment in a class I took last semester. A friend asked me for some guidance in how to do this in Python, so I showed him my "simple" solution: #!/usr/bin/env python3 from …| Brendan Long
In a recent post, Zvi described what he calls "The Most Forbidden Technique":An AI produces a final output [X] via some method [M]. You can analyze [M] using technique [T], to learn what the AI is up to. You could train on that. Never do that.You train on [X]. Only [X]. Never [M], never [T]. The article specifically discusses this in relation to reasoning models and Chain of Thought (CoT): if we train a model not to admit to lying in its CoT, it might still lie in the CoT and just not tell us...| Brendan Long
When you're subject to capital gains taxation, the government shares in some of the upside, but when you have capital losses, the government shares in the downside too. Because of this, the actual risk (and reward) of any given portfolio is lower than it seems. To counteract this, you should consider shifting your allocation toward riskier assets.| Brendan Long
7 years ago (!) I wrote a post comparing ZIP and tar, plus gz or xz, and concluded that ZIP is ideal if you need to quickly access individual files in the compressed archive, and tar + compression (like tar + xz) is ideal if you need maximum compression. Since then, I discovered pixz, which seems to provide the best of both worlds: Maximum compression with indexing for quick seeking.| Brendan Long
Do you have an insatiable hunger for potatoes? Do you have a fully-sated hunger for complicated recipes and having to cook all the time? This version of Pommes Anna, simplified and altered to an extent that will make French people cry, might be the recipe for you!| Brendan Long
Psyllium husk is a non-fermenting (no gas or bloating) soluble dietary fiber that improves both constipation and diarrhea (such as with IBS), normalizes blood sugar, reduces LDL ("bad") cholesterol, and can help with weight loss. Each type of dietary fiber has different effects, and a "high fiber" diet in general won't necessarily provide the same benefits, especially for conditions like Irritable Bowel Syndrome.| Brendan Long
Car side and rear-view mirrors are designed to give you a view around your car, but they typically don't show you the two spots directly to the side of your car (the "blind spots"). Luckily, you can increase the field of view of your side mirrors by over 200% and virtually eliminate blindspots by adding aftermarket blind spot mirrors.| Brendan Long
When writing code to interact with a third party like a SaaS provider, you typically need to write both code to handle the API the third party uses, and translate their data model into your data model. One thing I've found that makes this easier is to do each step separately: First write a library to interact with their API using their own data model, then separately write code to translate between your data model and theirs.| Brendan Long
I've been subscribed to Interview Cake for years, and today they had a really interesting question: Given a list of n + 1 integers in the range 1...n, find one of the duplicates (there is guaranteed to be at least one) in O(n) time and O(1) additional space. The answer is really interesting, and I recommend trying it, but I don't think it makes sense to care about additional space rather than total space, and I still think using a set is the best solution in practice.| Brendan Long
There's a common programming interview question that asks you to find the single non-duplicated value in a list of duplicated integers. This can be done in O(n) time and O(1) space by XOR'ing the values, and doing so is almost always the wrong answer. A better solution when you can afford to do it is to use a hash table to count occurrences.| Brendan Long
To make your data faster to lookup, you can either store it in an order that makes it easier to search, or add one or more indexes. For practical work, you can let your file system do this for you, or use a pre-built database (either relational or not). I'll describe from the lowest-level to highest level so you can understand what I'm suggesting, but my real-world answer is that I would store most kinds of data in a relational database like PostgreSQL and put indexes on any column that I wan...| Brendan Long
When you're documenting a project so other people can use it, whether it's a library or web service, one important thing to do is to give people good examples to work with. Not only does this save people time trying to cobble together their first working program, but it's also a good way to show how the library is meant to be used, instead of just what's technically possible.| Brendan Long
Core.Command (and the closely-related Async.Command) is an OCaml library for creating command line programs with nice interfaces (including help text and argument parsing). This article is an overview of Command.Param, the newer interface for defining your command's arguments.| Brendan Long
This is a short post to document an issue we ran into at work so it will show up in search results for people who have this problem in the future. Use FreeTDS 1.0 if you can. If you're stuck on FreeTDS 0.91 (and possible other pre-1.0 versions), don't use any TDS version above 7.0.| Brendan Long
I recently finished a basic XLSX reader for OCaml and I thought it would be a good time to summarize what's necessary to make a library like this, since the documentation is complicated and sometimes hard to find. Documentation If you're planning to read XLSX files, you probably want to …| Brendan Long
From a non-theoretical engineer perspective, a monad is a kind of container that you can apply functions to to get a new monad. In particular, you need a way to put something into your monad and a way to apply changes to it. These are called return and bind. There is also a third operation, map, which is a combination of the two. Note that monads are allowed to be empty, which will make bind and map not do anything; and they can also contain more than one thing (in which case bind and map wil...| Brendan Long
I've been working on an OCaml library to read XLSX files, and something I thought was odd is that all strings in an Excel workbook are listed in a "shared strings" file and then referenced by index. This seemed strange to me, since I would expect the compression algorithm to do this kind of work for you, but thinking about it made me better understand why that's necessary, and also what the advantages and disadvantages of the ZIP and tar + compression formats are.| Brendan Long
One of the hardest parts of learning OCaml is figuring out what the infix operators do, since they're just a string of symbols and you can't find them with a Google search. This is my attempt to make a cheatsheet for whenever you're wondering what a random series of symbols means.| Brendan Long
I've been keeping a computer setup page on my website for a while, describing the exact steps needed to make a computer work how I want after a new OS install. I've also had a note there for years saying eventually I should use Ansible for this. This weekend I finally got around to it, and learned a little bit about Ansible while I was at it.| Brendan Long
My girlfriend and I both replaced our mattresses this fall. Because we have different sizes of mattresses and different preferences, and neither of our first picks worked for us, I ended up trying out almost all of the popular online mattresses. I also spent some time learning about mattresses before making my second pick, so this post will be a guide to how to pick a mattress, with some specific advice regarding the mattresses we tried.| Brendan Long
My hobby recently has been making website scale better on phones, but I ran into a problem on several of them: The viewport meta tag assumes that a website either has a fixed width or that it scales to any possible width. I investigated several solutions and eventually settled on an (apparently) novel one: Check the screen size, and if it's too small, add a new meta tag with a fixed viewport. I also wrote a JavaScript polyfill that lets me just set a min-width in the viewport tag.| Brendan Long
This machine runs a lot of services and I don't use all of them. After breaking several of them and not noticing (again), I decided to finally set up service monitoring. After some research, Monit was relatively easy to set up and seems to meet my needs. I figured other people might want some examples of how to use it, so this post describes how to set it up and you can see my config file at the end.| Brendan Long
There's an open source project you want to use, but it's missing a feature you need, or has a bug you need fixed. You can implement it yourself, but you want to make sure the patch will be accepted by the project's maintainers. This guide will explain how best to minimize wasted effort and improve the chances of your code being accepted.| Brendan Long
In the last few days, I've needed to set up several long-running services and I just wanted to take a minute to talk about how helpful systemd's user services have been. The things I wanted to run are: A Node.js server which is started with npm run A Node …| Brendan Long
If you want to disable Wi-Fi Direct on the Roku 2, follow these steps: Go to home Settings System Advanced system settings Device connect Disable Device connect If you're monitoring local networks, you should see the Roku network disappear. On my network, the Roku network was hidden, but I was …| Brendan Long
It's that time of year again: Time to make needless improvements to my website. This time, I was annoyed about how my pages were showing up in Google, so I added Microdata to my articles. One thing lead to another, and I ended up with Microdata, Open Graph, a better sitemap, fewer useless pages, and much improved reading mode support.| Brendan Long
I've been using Alljoyn recently, but only the sources are distributed, and it's fairly difficult to compile programs against it. The recommended way to handle this seems to be to manually copy various files into your root filesystem, but I prefer not to do that for obvious reasons. Instead, I'm going to build Alljoyn packages, using fpm.| Brendan Long
This is part two in a series on MPEG-DASH. The previous post described the structure of an MPEG-DASH MPD. This post describes informative metadata, like labels, languages, and copyright information. I plan to write one more post in this series, about less visible data like asset identifiers.| Brendan Long
Earlier today, I stumbled upon CircleCI and I was curious about how it compared to continuous integration products I've used in the past (Jenkins and Bamboo). So far I'm impressed. Testing a Node.js project After connecting CircleCI to my GitHub account, the only repo I owned that had tests …| Brendan Long
While writing unit tests for my C code, I decided it would be nice to run the tests in Valgrind, so I could check for memory leaks too. It turned out to be easier than I expected, but still a lot harder than it should have been.| Brendan Long
I recently finished (in terms of features) a major code project, but I'm not happy with the quality of the yet. Besides the usual ways code can be buggy, it's especially easy to crash a program written in C (which can be exploited if the program is available online, as this one probably should be).| Brendan Long
I emailed the IETF HTTP group about my timeout header idea, and a few people said that RFC 7240's "wait" preference" does what I want. I'm not entirely convinced that this is what was intended by that spec, but it's close enough. In response, I've updated my Express middleware to support the "Prefer" header and "wait" preference.| Brendan Long
I've been participating in MPEG's DASH group, and currently a lot of work has been focused on reducing live streaming latency. The latency problem in DASH is that clients have to poll servers to check for new media segments. If they poll too slowly, it introduces latency, but if they poll too quickly, it increases server load. When MPD's are dynamic, a client needs to poll the server until it finds a new MPD, then request newly available segments, then only after the segment has downloaded en...| Brendan Long
The MPEG-DASH Media Presentation Description (MPD) is an XML document containing information about media segments, their relationships and information necessary to choose between them, and other metadata that may be needed by clients. In this post, I describe the most important pieces of the MPD, starting from the top level (Periods) and going to the bottom (Segments).| Brendan Long
Most web browsers only support a few ancient image formats (mainly PNG, JPEG and GIF), but video formats have improved significantly since those formats were defined. Google is attempting to fix this with their WebP image format, based on VP8. Unfortunately, this only works with Google Chrome and Opera. Since what we want is to encode an image using the advancements in VP8 or h.264, I thought it would be interesting to try encoding single-frame videos and using them as images.| Brendan Long
I just finished book 6 of Mizuni-san's Prince of the Dark Kingdom (Harry Potter fanfiction). I've been using an auto-generated EPUB, but the quality was pretty bad, since it didn't understand the formatting. To fix that, I decided to make my own EPUB using some Python and some Pandoc.| Brendan Long
I need to build Chromium on a machine that runs Fedora 20 today, and I had some trouble due to this error: [12269/24399] LINK gles2_conform_support FAILED: c++ -Wl,-z,now -Wl,-z,relro -Wl,--fatal-warnings -pthread -Wl,-z,noexecstack -fPIC -B/home/blong/workspace/chromium/src/third_party/binutils/Linux_x64 …| Brendan Long
I just got my Geeksphone Revolution in the mail. Since no one else seems to have a real hands-on review, I figured I'd do a quick one myself. Unfortunately, I'm about to switch to a Sprint-based carrier, so I won't actually get to use this phone very long, but it'll …| Brendan Long
Today I installed Minecraft on a new computer and the textures all looked terrible and blurry: Since the fix wasn't terribly obvious, I figured I'd document it here in the hopes that search engines pick it up. After a lot of trial and error, I determined that the problem was …| Brendan Long
Lifehacker recently featured a deal where you can buy a battery pack for $20 (now $28). $20 is my "not real money" limit, and when I spend the day reading at my favorite tea store, the battery on my phone tends to die. I got the battery on Friday and …| Brendan Long
If you read this blog, you might assume it doesn't update because I have nothing to talk about. The truth is, I have a lot I want to say, but I usually don't feel like writing when I'm at my computer. One thing I post a lot of is commentary …| Brendan Long
On August 26th, I posted several feature requests for Feedbin. On August 27th, Feedbin became open source. Since the timing was just too perfect to ignore, I decided to fix some things myself. The first big improvement has been fixing Feedbin's mobile interface, which previously looked like this: And now …| Brendan Long
I've been reading about BitMessage, an anonymous, encrypted peer-to-peer email protocol. Unfortunately, there are some major problems: BitMessage addresses are 36-character hashes, which isn't very user friendly. Since the address is the hash of your public key, there's no way to change your keys without creating a new address. All …| Brendan Long
I've been working on GStreamer a lot recently, and I'm slowly becoming comfortable with debugging problems with gdb. I assume this could be useful for other people, so this is part of one of a series on debugging GStreamer. Using gdb to debug crashes I recently had a problem with …| Brendan Long
This program was written to demonstrate how to correctly encrypt and decrypt files, using PBKDF2-SHA1, AES, and HMAC-MD5.| Brendan Long
Note: I updated my Pebble review to mention that I got a replacement for my defective Pebble. The support process took longer than I would have liked, but the new Pebble works perfectly. --- My roommate just moved into a new apartment about 10 miles away, and I plan to continue …| Brendan Long
The first large and expensive project I backed on Kickstarter was the Pebble E-Paper Watch, which I got in black. My watch finally arrived about a week ago, so I figured I should do a review, since it gives me something to write about it, and someone might find it interesting.| Brendan Long
My last update made this site render better on small screens, but didn't look right on Android. It looks like the problem is that mobile browsers do weird things on the assumption that website developers are idiots (generally a valid assumption). MDN has an article about how to fix it …| Brendan Long
I decided a couple of days ago that this site really needed a responsive design, since it's the cool thing to do and stuff. diff --git a/themes/brendanlong/static/css/style.css b/themes/brendanlong/staticindex 96a16b4..eb493b9 100644--- a/themes/brendanlong/static/css/style.css+++ b/themes …| Brendan Long
There's a popular question on the Programmers Stack Exchange site asking, "Are unit tests really that useful?" and the second answer seems to be responding to a straw-man version of automated testing. The comments show that a lot of people seem to think it's a reasonable description, so I thought …| Brendan Long
A friend of mine recently convinced me to take a class on quantum computing. The class just started, but I'm already learning interesting things. For example, one student linked to a lecture on quantum physics which explains it as a generalization of probability theory which allows for complex numbers (although …| Brendan Long
Today, I found an interesting article about password timing attacks. The basic point is that if you check a password one character at a time, the amount of time it takes to recieve a "bad password" response tells you how many characters you got right.| Brendan Long
This weekend, my roommate asked me to make a website for him. I wrote it in PHP so I could just make some templates and he could import them, but it bothered me that I was rendering a static website with PHP. The easiest solution seemed to be running every …| Brendan Long
Doing linear algebra homework reminds me why I love NumPy so much. Instead of doing a 2-page homework assignment and then finding out at the end that something is wrong, I can check at every step. For example, to reduce a matrix A to the identity, using only elementary matrices …| Brendan Long
I set up an SSL certificate for this site today and it was surprisingly easy. Last time I wanted a free certificate, it was a huge pain. This time it was actually easy. A Google search for "ssl certificates stackoverflow" lead me to the Cheapest web certificates question, which has …| Brendan Long
My roommate's computer's clock has been broken since we first installed Linux on it. It was never a big deal, but it's been annoying me for a long time. Recently, my laptop started to have a similar problem. A friend had used Windows on it, and so the clock was …| Brendan Long
I recently spent several days improving the OCaml FreeTDS C bindings for work, and I thought it might be useful to share the problems I ran into and how to solve them. I tried to order things so the most likely issues are listed first, but if you're trying to debug some C binding crashes, I recommend just reading the whole thing. This post will assume you're already familiar with the official documentation.| Brendan Long