1. 2010
    Oct
    11

    Phygg

    This looks like an interesting idea: Phygg, a cross between the arXiv and Digg. The idea is that people submit papers (to arXiv, as usual), and then Phygg lets its members vote them up or down. Presumably, the papers that are most worthy of your attention will wind up with the highest vote totals.

    Here’s my thought, though: what really qualifies as worthy of your attention? It depends on who you ask: someone working on the mathematical foundations of quantum gravity, for example, will be interested in a whole different type of publications than an experimentalist searching for extrasolar planets. The way Phygg is set up right now, it’s hard to separate those different fields out, so when you look at the top voted papers, you get a whole bunch of results that aren’t relevant to you, simply because they’re off-topic for whatever you’re researching. This isn’t such a big issue for Digg, because when it comes to random website links, most people are interested in the same stuff. But I think what science needs more than a voting system is a reliable categorization system. Easier said than done, of course.

    What I think …

  2. 2010
    Sep
    29

    Hall Pong: Doubles

    I bought a set of four new hall pong paddles today, and you know what that means… or maybe not. It was time to try out 2v2 hall pong!

    Since its inception early this year, hall pong has always been a 1-on-1 sport. (Simply because we always had only 2 paddles) The thing is, when playing 1-on-1, whenever you work the ball up the court, you’re abandoning the defense of your goal, which means that if you don’t score, your opponent has a clear shot. It tends to lead to rather quick points. Besides, there’s only so much creativity involved in the kinds of plays you can make — basically it’s just a matter of how close you’re willing to get to your opponent’s goal before you decide to spike it on them. Either you take a long shot, which is easy to block, or you get up close and then it turns into a struggle for who can get a lucky hit on the ball in one direction or another.

    Adding another person to each side introduces a whole new level of strategy, though. When you’re playing doubles, you still have the same …

  3. 2010
    Sep
    28

    Convolution and the Fourier transform

    One of the neat properties of the Fourier transform is that if you want to convolve two functions, an easy way to do it is to multiply their Fourier transforms together and then take the inverse Fourier transform of the result. It’s often said as “convolution in normal space corresponds to multiplication in Fourier space.” I think I’ve always accepted this on faith, but today I had occasion to actually come up with a proof.

    To start with, let’s make some definitions. The convolution of two functions \(f(x)\) and \(g(x)\) is the result of shifting and scaling one function by each point of the other. It’s usually used in applications where one of the functions is a Gaussian distribution, or some other function that has a peak at some point, and in that case you can think of it like this: suppose \(g(x)\) is the function with the peak. For each point \(\bigl(y,f(y)\bigr)\), make a copy of \(g(x)\), and shift it over so that the peak is at \(y\). Then multiply it by the value of \(f(y)\). The sum of all those scaled and shifted peaks is …

  4. 2010
    Sep
    27

    Hall Pong: Now with tougher balls

    One of the things you’ll notice if you ever play hall pong is that ping pong balls will break, and fairly easily, too. (Especially the tournament quality 3-star balls) The logical way to get around that is of course to use harder balls, like whiffle-style practice golf balls. They’re made of much tougher plastic, so you can use just one for a long time.

    But using a different ball also changes the dynamics of the game significantly. For one thing, they’re more massive, so they don’t slow down as much while flying. A hall pong court is just long enough that you can hit a ping pong ball from one end to the other and have it arrive at a reasonably slow speed, but these practice golf balls can seem to come at you like bullets. It makes defense a lot harder and really tests your reflexes.

    The other thing about the heavier balls is that they don’t seem to bounce as well. Or rather, they bounce and keep going just about as fast as they were going before. So on defense, you’ll have a tendency to be jabbing your paddle at the ground …

  5. 2010
    Sep
    04

    Totally dropping custom scripting and using jQuery

    jQuery, the Javascript framework, is like the ecstasy of web development: everybody’s doin’ it these days. (Well actually ecstasy was big in the 80’s, but a few months is like 25 in internet years. Just go with it.) When no two browsers seem to implement Javascript the same way, a framework is practically a necessity. But for a long time I held out and insisted on writing my own Javascript.

    Why? Well, for starters, most of this site didn’t even use much Javascript, and the parts that did were only really important to one person: me. I used Konqueror as my main web browser, and its admittedly crappy JS support didn’t handle frameworks like jQuery correctly, so if I wanted the pages to work for myself, I had to write my own scripts. Besides, I wanted to support W3C standards. A simple way to do that is just to write code that conforms to the standard — at least, as well as anyone can tell what it means — so if you came to my site with a non-standard-compliant browser (*cough* IE *cough*) and it didn’t work, tough. Maybe it’d convince someone to use a better …

  6. 2010
    Aug
    23

    Website maintenance with git, the pro way

    Since the beginning of version control, people have been using VCSs to manage websites. It works pretty well, because the process of web development is similar to the process of programming. Heck, with the advent of dynamic websites these days, often half of web development is programming. But web developers have one peculiar requirement that most other programmers do not: they have to maintain one particular copy of the site which gets continuously updated, but not always with the latest changes.

    Typically, when you set up a version control system to handle your website, it works like this: you have a working copy on your computer, a repository on your server, and another “live” working copy on the web server which is the actual website content. Whenever you want to update the website, you push (or commit) changes from your computer to the repository, and have a hook script set up that makes the VCS update the live working copy with the latest changes. That’s the approach I found described in a couple of websites: http://danielmiessler.com/blog/using-git-to-maintain-your-website and http://toroid.org/ams/git-website-howto.

    But once your site turns into a moderately complicated system, this doesn’t …

  7. 2010
    Aug
    15

    WTF is an einbein anyway?

    I just realized that in my last post I sort of neglected to address the main question. So what is an einbein? Turns out the answer is on the next page of the Green, Schwartz, and Witten textbook: the einbein is the induced metric, normally written \(h_{\alpha\beta}\), where \(\alpha\) and \(\beta\) range over the coordinates in the parametrization of the worldline/worldsheet/whatever. A one-dimensional worldline is parametrized by only one coordinate, \(\tau\), so the induced metric has only one component, \(h_{\tau\tau} \equiv -e^2\).

    Naturally, all this emerges from the general string/brane action,

    $$S = -\frac{T}{2}\int\udc^{n+1}\sigma\sqrt{\abs{h}}h^{\alpha\beta}g_{\mu\nu}\partial_\alpha X^\mu \partial_\beta X^\nu$$

    The set of brane coordinates \(\sigma\) is just \(\tau\), the induced metric determinant is \(h = -e^2\), and the inverse induced metric has only the one component, \(h^{\tau\tau} = -e^{-2}\). Also, \(\dot{x}^2\) is equal to

    $\dot{x}^2 = g_{\mu\nu}\partial_\tau X^\mu \partial_\tau X^\nu

    Substituting all this in,

    $$S = \frac{T}{2}\int\udc\tau e^{-1}\dot{x}^2$$

    Now I just have to arbitrarily …

  8. 2010
    Aug
    14

    The origin of the einbein

    You know that feeling you get when you’re reading a textbook and the authors start pulling equations out of thin air on the second page of the second chapter? No? Well then, my congratulations on having a life.

    But seriously, I came across a gem of this sort in Superstring Theory volume 1 by Green, Schwartz, and Witten. Starting with the action for the relativistic point particle,

    $$S = -m\int\udc s = -m\int\udc\tau\sqrt{-\dot{x}^2}$$

    they introduce an “einbein” \(e(\tau)\) to eliminate the problems that (1) the formula has a square root and (2) it doesn’t apply to massless particles. Fine, but WTF is an einbein anyway? And where do you come up with the equation in the very next sentence,

    $$S = \frac{1}{2}\int\bigl(e^{-1}\dot{x}^2 - em^2\bigr)\udc\tau$$

    I’ve been wondering about this for far too long. Here’s an explanation: we know experimentally that massless particles travel at the speed of light, along null geodesics. But the spacetime interval \(\udc s\) along a null geodesic is zero. So when you try to compute the classical point-particle action \(-m\int \udc s …

  9. 2010
    Aug
    08

    Running GUI apps as root

    I just ran into a funny problem where I was unable to run GUI apps as root, although I had no trouble using KDE and its applications as my normal non-root user. I’d get various sorts of error messages, like “unable to open display :0” or “cannot connect to X server :0” depending on how I tried to run the program (with su, sudo, etc.). Turns out the solution was to do this:

    xhost +si:localuser:root
    

    xhost is the program that lets you alter the access control list that governs connections to the X server. When invoked with no arguments, it prints out the current list, which in my case was

    INET:acetylene09
    SI:localuser:diazona
    

    acetylene09 is the hostname of my computer. You’d think that having the hostname in the list would be enough to allow connections from it, but no, X is fickle. I had to add an explicit directive to allow connections being made by root, in addition to the one that was already there to allow connections from my regular username.

  10. 2010
    Aug
    07

    More Python voodoo: optional-argument decorators

    I’ve just been doing something that probably should never be done in Python (again), and I figured it might be useful to record this little snippet for posterity. Many Python programmers are probably familiar with decorators, which modify functions by wrapping them with other functions. For example, if you want to print ‘entering’ and ‘exiting’ to trace when a function’s execution begins and ends, you could do that with a decorator:

    def trace(func):
        def wrapper(*args, **kwargs):
            print 'entering'
            func(*args, **kwargs)
            print 'exiting'
        return wrapper
    
    @trace
    def f(a,b):
         print 'in f: ' + str(a) + ',' + str(b)
    

    Note that in practice there are better ways to do this, but it’s just an example.

    Anyway, it’s also possible to customize the behavior of decorator itself by providing arguments, for instance if you wanted to print different strings instead of ‘entering’ and ‘exiting’. But in that case, your “decorator” function is actually a wrapper that creates the real decorator and returns it:

    def trace(enter_string, exit_string):
        def _trace(func):
            def wrapper(*args, **kwargs):
                print enter_string
                func(*args, **kwargs)
                print exit_string
            return wrapper
        return _trace
    
    @trace('calling f', 'returning')
    def f(a,b):
         print 'in f: ' + str …