Quantcast
Channel: [In]effective Theory
Browsing latest articles
Browse All 53 View Live

Go Isn't C

Come to think of it, most languages aren't. (All but one, if I'm not mistaken.) Let me start off on another tack, though. It's always tempting to over-engineer - to build the internals of a system up...

View Article


Functors in Go

Go's interface{} - equivalent, for our purposes, to (void *) in C - allows us enough leniency in the type system to implement a perversion of haskell's perversion of category theory's concepts of...

View Article

This is the Problem (and what can be done)

Today being today (wow! It worked (so far)! Even after months of eager, happy speculation, I still feel so good!), I spent a good deal of time watching C-SPAN. Not much about SOPA - the House spent the...

View Article

Do Small Things

The amazing thing about technology, as pointed out by Justin Rosenstein, is that it "empowers small groups of passionate people with an astonishing degree of leverage". Quite true. One often sees...

View Article

You Don't Need Generics (Or, Idiomatic Go Without Generics)

Go's lack of generics can make some programming shortcuts harder to take. For example, there is no direct way to write a typesafe sort function that takes as arguments an array and a comparison...

View Article


You Are Not Special

Everyone has their own delusions of grandeur. The ill-conceived notion that somehow, this editor, mail client, web app, or game I just conceived of 15 minutes ago is going to make it big. Before I...

View Article

Migrated This Blog

I've just finished migrating this blog to jekyll - all migrated posts (coming from wordpress) are in HTML - this post and all future ones are stored just as markdown.

View Article

First Languages Don't Matter

Any hacker with his salt can debate for hours the question "what programming language should I learn first". Everyone certainly has enough practice - at least once a week, someone asks #golang-nuts if...

View Article


A Lighter Pommed

One of my main gripes with running linux (Arch w/ dwm) on a macbook pro is that the hotkeys handler daemon is a bloated, half-decade-old, mildly bitrotted clunker from debian: pommed. The two major...

View Article


"Corruption Hurts the Corrupt, Too (Re: Megaupload)"

You would think, that prosecuting those running a set of websites almost universally recognized as a major hub for piracy - a set of websites serving almost no other purpose - would be pretty damn...

View Article

Uninstalling X11 on OpenBSD

X11 is distributed on OpenBSD as an optional part of the core system, rather than as its own set of packages; therefore, there is no pkg_delete available to automate uninstallation. Fortunately, the...

View Article

That's Not Groupthink

Persuasion isn't always "here's the facts, you're either an idiot or you're not" - it's "here are the facts and here is a sensitivity to your state of mind", and it's the facts plus the sensitivity,...

View Article

Technology-Minded

An argument occasionally used against the claim that the advent of the Internet has been the biggest thing since electricity (or the steam engine, or the printing press), is that a man from a...

View Article


The Fallacy of Choice

People like choice.Well, that's not quite true. It would be more correct to say that we don't like to loose choice. Few people actively seek situations in which they'll have more freedom, but almost...

View Article

Flexible Format Strings in Haskell

One of my continual frustrations with most programming languages is the lack of facilities for creating quick'n'easy parser. C has scanf, but that's unbelievably fragile, and not particularly useful...

View Article


Inverted Scrolling on Linux

Now that I've started using OS X Lion at work, I've quickly grown to like the more intuitive inverted scrolling it uses. (For those who don't know (or pay attention to) any apple fans, the direction...

View Article

The Simplest Recursive Function

GHC's Data.Function package provides an interesting function fix, defined as:fix f = f $ fix f Wait, what? This thing's supposed to be useful?The purpose of this function (a "fixed-point combinator")...

View Article


SSH - A Miniature VPN

One of my more frustrating experiences as a programmer - and more generally, computer user - is setting up some large, feature-heavy piece of software with the full knowledge that 90% of what it does I...

View Article

malloc_info

Today I ran across a curious function in glibc - malloc_info, which is intruduced in the manpage as follows:The malloc_info() function exports an XML string that describes the current state of the...

View Article

Why Object-Oriented Programming Is Great - From an FP Fanatic

Speaking as a Lisp and Haskell fan currently diving into Agda: after strong type systems, object-oriented programming is the next best thing.A common complaint about OOP is that it (presumably...

View Article

Git tricks: stash

Git's stash functionality is something that you won't need very often (in my experience, ever) if you're just hacking away at something in private. However, as soon as you introduce other factors - a...

View Article


Git Tricks: Find Most Recent Occurrence

Git aficionados will know of git grep, which is effectively just grep, limited to tracked files. This avoids the auto-generated crud that tends to pollute large projects, speeds up the search, and is...

View Article


cgiserve v0.2

A couple nights ago, I needed to set up gitweb (a story for another post), and learned that no, nginx did not support CGI, and fcgiwrap was a little annoying to get working on OpenBSD. So I did what...

View Article

Leaving Github

I've done it, I've ditched github, for good. All updates to current and old projects, and all new projects (save precisely one - long story) are being self-hosted on this server. The switch was...

View Article

Readable Man Pages

One of the weird things about typesetting is that if you don't know what to look for, you won't notice what's wrong. Kerning is famous for this, but it applies to other areas too - if you haven't...

View Article


Announcing reposloc

For some time now, I've nurtured a small hack I call sloc, which serves basically the same purpose as the venerable ohcount and David Wheeler's sloccount, but does so with great simplicity (it's about...

View Article

Frustration

I, like so many others, have an almost obsessive passion for fine-tuning my computing environment. I haven't quite reached the neurotic level of posting self-congratulatory videos and screen-shots...

View Article

A pointer is just a number

By far the most frustrating part of learning C - and teaching it - is understanding pointers. For some reason, they present a monad-sized roadblock to learning the language. To a certain extent, this...

View Article

systemd: Don't act on lid events

After the latest Arch systemd upgrade, I found that my computer attempted to suspend whenever I shut the lid. Of course, suspend doesn't currently work properly, so it just ended up crashing. This was...

View Article



Thoughts on Distributed Bug Tracking

One of the unsolved, but seemingly obvious, problems associated with the widespread growth of DVCSs is the need for correspondingly structured bug tracking tools. A standard model (centralized) bug...

View Article

Linking raw data with C code

Generally speaking, the unix design philosophy dictates that one use external files for most resources (images, help files, etc...). This is good advice when possible, but it's sometimes just much...

View Article

Quirk of resolv.conf

I'm jotting this down here so I don't forget it - I've been bit for the third time by this same not-quite-bug which is almost impossible to debug if you don't already know what's causing it.The DNS...

View Article

Weechat isn't lightweight

Weechat is often billed as the not-so-fat cousin to irssi. I'm not entirely sure where people got the idea that irssi was bloated, but it's out there, and it creates a niche that weechat supposedly...

View Article


Injecting code into a running program

This trick may not be widely applicable - it's rarely the case (at least in my experience) that it's too difficult or inconvenient to shut a program down, and its behaviour must be modified live....

View Article

Resizing a LUKS-encrypted partition

Since gparted does not support encryption, the resizing process for LUKS-encrypted partitions has to be completely manual. It looks scarier than it is, since the sizes of the partition, the encrypted...

View Article

Visualizing audio hacks

The other day, an interesting hack came up on #archlinux:echo "main(i){for(i=0;;i++)putchar(((i*i>>8&46&i>>8))^i&i>>13);}" | gcc -x c - && ./a.out | aplay It's a...

View Article


Battery mode with custom systemd targets

Systemd's targets are essentially glorified runlevels: they're the chosen mechanism for easily grouping various services together, and succinctly describing the mode of operation of a system. Like all...

View Article


Trivial HTTP Proxy in Go

One nice aspect of Go's standard http library is that the asymmetry between the client and the server is kept to a minimum. For example the same Request object is used for both, with (nearly) identical...

View Article

Congressional Word Count

The congressional record - dating back to 1994 - is available for download from the government printing office, in both PDF form and HTML - not the pinnacle of machine-readability, but good enough to...

View Article

Some kernel hacking: dumping physical memory

In the good old days, /dev/mem provided direct read/write access to physical memory on linux. This was a fun toy, but also enormously helpful for writers of rootkits, so it's since been restricted by...

View Article

Cold-boot attacks are overrated

Since the publication of Lest We Remember in 2008, "cold-boot attacks" where the attacker can read the RAM of a recently shut-down computer have been considered the bane of full-disk encryption (along...

View Article


Nothing to hide: Why privacy matters

Q. Do you subscribe to any papers?A. Yes.Q. What papers?...A. I used to get a Cronaca Sovversiva.[Defense objects]COURT. What is your objection?DEFENSE. My objection is that the question is immaterial;...

View Article

Switched to Hakyll

I've migrated this entire site to Hakyll, which (almost) entirely replaces the hacky mess of shell scripts that previously glued things together. Aside from an excuse to use haskell more, Hakyll's...

View Article


Contextual error reporting in Haskell

The conventional error-reporting mechanism in Haskell is using Either String as a monad. A successful operation will yield Right val, and if there is an error, Left err will be returned instead. This...

View Article

gron: a 500-line tron clone (OpenGL demo for go)

The impression one gets from reading the golang-nuts mailing list is that about half of all go code is tied up in web services, and the other half is re-implementations of JSON (usually not fully...

View Article


Restoring Clipping Region in R Graphics

R's default graphics package (bundled with all installations) is a powerful enough low-level tool, but it's often not immediately obvious how to accomplish certain ends. In particular, although most...

View Article

Autodetecting correct quote direction in TeX

\(\small\TeX\) annoyingly lacks the ability to automatically detect whether a straight quote (") should be rendered as a left quote (“) or a right quote (”). Instead, it treats straight quotes in the...

View Article

Haskell functors versus "real" functors

Haskell's Functor type class is inspired by the notion of a functor from category theory, but expresses a rather more limited concept.A category, conceptually, is a set of "objects" that are linked by...

View Article

Wraith: A Bananagrams™ Variant

First, for those who haven't heard of Bananagrams: it's Scrabble without the board. At any time each person has an equal number of pieces as any other player, and the first player to finish using all...

View Article


P = NP doesn't matter

For the last half-century, every practicing programmer has explored the space of efficient algorithms, trying to find ways to make computers be useful, faster. In the United States, there were about...

View Article

Browsing latest articles
Browse All 53 View Live