1. 2009
    May
    08

    RSS yay?

    I’ve been working on this for a while now, and finally my blog has a functional RSS feed. It’s the super-ghetto RSS2 format, rather than the newer, slicker (and more complex) Atom, though, so nice things like, I don’t know, HTML(!!) are a no-go, and it’s not even W3C standard compliant, but it works with my RSS reader which is good enough to start with. Use at your own risk.

    And not to worry, someday I’ll do this properly and set up an Atom feed.

  2. 2009
    May
    08

    UI confusion

    I’m starting to have moments when I look at my screen and can’t tell whether I’m running Linux or Windows.

    I guess it should be a point of pride for KDE, but this can get pretty darn confusing at times…

  3. 2009
    May
    03

    Are Disney's composers running out of ideas?

    I always used to have a nagging feeling that parts of the songs of different Disney movies sounded oddly similar. Now the intro music for Desperate Housewives (speaking of Desperate Housewives, what’s the point of the Egyptian paintings?) sounds just like the theme from Castle. Both ABC shows. ABC as in the Disney subsidiary.

    What’s up with that?

  4. 2009
    Apr
    26

    Scaled statistical error

    Everyone — and by “everyone” I mean anyone who analyzes discrete random processes on a regular basis (quite an inclusive group, I know) — knows that the statistical error in a random count of events is the square root of the count. (For those of you not in the know, when you’re examining some process in which events occur at random intervals, e.g. the decay of radioactive atoms, if you count the number of events that occur in a minute over and over again for a large number of minutes, you’ll have some average number of decays per minute, and the distribution of counts will have a standard deviation of the square root of that average.)

    But what happens when the quantity you’re really interested in is not the count itself, but something proportional to the count? What’s the statistical uncertainty in that? It’s actually fairly simple to figure out based on the usual formula for error propagation. If the quantity you’re measuring is denoted \(I\) and it’s related to the count by

    $$I = A N$$

    where \(A\) is some constant (or anything independent of the count), then

    $$\delta I = A \delta N = A …
  5. 2009
    Apr
    17

    How much does data weigh?

    An interesting question came up on StackOverflow: does a hard drive weigh more when it’s full than when it’s empty? Or more generally, does the weight of a hard drive change depending on how much (and what) data is stored in it?

    First of all, as far as anyone in the IT industry is concerned, the answer is no. Any change in mass that would result from magnetic alignment is far too small to be measured by even the most sensitive scales in the world — we’re talking about a difference of something like \(10^{-14}\) grams.

    Now, how did I get that number?

    Let’s start from the beginning. Every atom has a property called the magnetic dipole moment, which means it acts like a tiny bar magnet, with a north pole and a south pole. In a ferromagnetic material, the type that’s used to store data in a magnetic hard drive, adjacent atoms tend to align parallel to each other, so that their north poles all point in the same direction. This leads to the formation of magnetic domains, small groups of atoms which are all aligned; each domain acts like one tiny bar magnet …

  6. 2009
    Apr
    16

    The NOW Network

    According to the advertisements, there are 47 million people on Sprint’s NOW network. 23 million of them are currently placing a phone call.

    Does that mean that the average Sprint wireless customer spends 23 / 47 × 24 = 11.7 hours a day on the phone? I think I’ll pass…

  7. 2009
    Apr
    06

    Open-sourcing the graphing calculator

    Why aren’t there flashy calculators for professionals? I’m searching for a new calculator, and since the models available on the market don’t quite cut it for theoretical physics, I’m considering the possibility of sticking some electronics together to build my own. Easier said than done, of course.

  8. 2009
    Mar
    21

    Turning the WTFPL on its head

    By the way, with the WTFPL, can I also…

    Oh but yes, of course you can.

    But can I…

    Yes you can.

    Can…

    Yes!

    …I sue someone for violating my copyright by redistributing a WTFPLicensed program? ;-)

  9. 2009
    Mar
    10

    How to use random_r

    The random_r function, a GNU addition to the standard C library, allows you to use a pseudorandom number generator whose persistent state is stored in an area of memory managed by your program, rather than the system. It’s useful when you want to generate pseudorandom numbers quickly, without taking the time to synchronize access to the PRNG state, among other uses.

    This function is a little esoteric, judging by the fact that I couldn’t find any clear example of how to use it in a multithreaded program when I was trying to fix up a simulation today. Here’s an example (error checking omitted):

    #include <pthread.h>
    #include <stdlib.h>
    #define NTHREADS 4
    #define PRNG_BUFSZ 32
    

    PRNG_BUFSZ stands for “pseudorandom number generator buffer size” which is exactly what it sounds like, the size (in bytes) of the state buffer allocated to each PRNG. Sure, I could have written BUFFER_SIZE but C programmers write in this abbreviated Hebrew-like code so much I’m surprised the language still includes vowels. Anyway, whatever you call it, this number must be at least 8. The larger this size, the more complex the pseudorandom number sequence will be.

    void* thread_run(void* arg) {
        int …
  10. 2009
    Feb
    10

    Greylisting really works

    There are a lot of programs and protocols out there devoted to stopping, or at least reducing, the flow of spam email around the internet. But one of the most effective is also one of the simplest: greylisting.

    In order to understand greylisting, you first need to know that a typical email message on its way through the internet travels through four computers (“nodes”):

    1. The origin client (often a personal computer running a MUA - mail user agent - like Thunderbird, Outlook, Evolution, etc.)
    2. The relaying server (this server would be named in the configuration of Thunderbird, Outlook, Evolution, etc. as the SMTP server)
    3. The destination server (for mail sent to user@example.com, this is the email server for example.com)
    4. The receiving client (often another personal computer running another MUA)

    Greylisting is actually a simple process: the first time node 2 tries to send the email to node 3, node 3 responds with an SMTP 450 error code, which basically means “try again later”. And a standards-compliant mail server will indeed try again later. But a spammer’s server usually won’t. Spammers typically operate their own mail servers which are specially designed to send out as many emails as …