Category-specifc RSS feeds from WordPress

October 24th, 2008

I subscribe to some topic-specific blog aggregation feeds, and I get mildly annoyed me when posts appear on those things that actually don’t have anything to do with the aggregation’s topic.  I found this off-topic spamming surprising because blogs always have these categories and tags on every message, so what’s the point of all that if you can’t subscribe to a specific category?

It’s not exactly obvious, but it turns out that at least with WordPress blogs (like this one) you can subscribe to a particular category.

First you have to figure out the category number for the topic you’re interested in.  You can usually do that by clicking on the link for the category you’re interested in an looking at the url.  It’ll have part that says something like “cat=4″.   Then you append that onto the regular feed url.  Now you append that onto the base RSS url for the blog.  Like for this blog the base is:

http://www.billbaxter.com/techblog/wp-rss2.php

Use a “?” to tack on the category string and voila!

http://www.billbaxter.com/techblog/wp-rss2.php?cat=4

you have a category-specific feed url (in the case above, for my “code” topic, which current includes D, C++ and Python sub-categories.

So here are some category-links for my blog here:

Inverse Kinematics

October 24th, 2008

Just got a nice email from a guy named Nate Warner who said he used my inverse kinematics presentation to figure out how to make a nifty ragdoll physics demo in some sort of Flash 3D thingy.

I wrote that presentation for the Comp 290 physically based modelling grad course at UNC-Chapel Hill in the first or second year of my Masters/Ph.D.  It looks a little quaint to me now, but I’m pretty proud by how well it explains some things.  Maybe that’s only me, but anyway, some things like the intuition behind multi-dimensional non-linear optimization that I put in there have really stuck with me.

What really gets me tickled is that this class presentation has been the top hit for “fast inverse kinematics” ever since I wrote it lo these 8 years ago.

[edit]  I say it looks quaint because the problem is really a straight-up non-linear optimization problem, and the right way to tackle it is with a non-linear optimizer of some sort.  The CCD, Jacobian Transpose, and PseudoInverse methods are all just hacks in one way or other trying to avoid using a more apropriate optimization strategy.  IK problems all tend to be relatively low-dimensional, too, so for most apps the speed of a good robust optimizer would not be a problem.   Actually Nate’s blog there has some links to other more recent methods like Selectively Damped Least Squares for Inverse Kinematics.  Having done a lot of least squares stuff lately, some sort of non-linear least squares solution is what I’d try these days too.

D library merger looking imminent

October 10th, 2008

Check out this change log from Phobos.  Looks like Sean Kelly is very nearly done with the work to move the two D-standard libraries to share one common core runtime.

Hooray!

Background for those who need it: in the world of the D programming language right now, there are two incompatible “standard” libraries.  The original Phobos library that ships with the DMD compiler, and the Tango project, a community-developed library that sprang up largely over dissatisfaction with the semi-closed and somewhat disorganized process of Phobos development.

This has really been a thorn in D’s side for a good while now — more than a year.  In a recent poll on the D newsgroup, this Phobos/Tango split was the #1 thing that people listed as needed fixing with D.  And finally it looks like it’s happening.  Happy day for D.

The D roadmap

September 7th, 2008

Someone on the D newsgroup today proposed a small feature that would help make the language more orthogonal, but in the end dismissed the issue as “perhaps not important enough”.  The yardstick for importance in D since I’ve been around has always been whether the addition would allow you to do things that are impractical or impossible today.  That’s a fine yardstick for measuring importance.  But it’s essentially a very brutal kind of feature triage.  There are scores of small issues that lay festering because, individually, they are not critical.  They are like mere grains of sand in the way of progress, easily side-stepped.

But enough grains of sand and you start to have a sizable obstacle. And D has a fair number of such grains. Pretty soon D needs to move out of feature triage mode and start working on polish, completing or cleaning up the features that do exist, and resolving issues with the tool chain. I thought that phase was about to begin now that const is basically settled, but now the goal posts seem to have moved again. Now it appears that cleanup won’t be a focus until until after the multicore problem is solved.  And given that multicore is not a solved problem in general, I think that could be a while.

Maybe the problem is just that Walter is not, and never will be, interested in working on small details. One can always find some new shiny holy grail feature on the horizon that’s more interesting to work on than, say, package visibility rules.  Features in D seem to get to the stage where they’re basically usable, then stagnate.  Like __traits, or like the non-overrideable $ in indexes (or rather overrideable only with the undocumented __dollar hack), or like associative arrays, or uniform call syntax that works only on built-in arrays.  If you’ve used D for any amount of time, I’m sure you’ve got your own favorite examples.  Language features in D never quite seem to reach that “insanely great” stage.

Here’s my pet theory about why that is so.  I think it comes down to dogfood.  Walter and the majority of the “D inner circle” basically don’t write code in D.  They spend their days writing C++, not D.  So shortcomings and annoyances in day-to-day D usage just don’t show up as major blips on the radar with these guys.   No associative array initializers?  Eh, no big deal, you can still initialize them in a loop.  So it’s not critical.  That’s easy to say, but when you’re the guy who actually has to write that loop, it starts to get annoying after the 10th time.  I think it’s universally recognized that to make great products it helps to eat your own dog food.  Unfortunately the core team working on D doesn’t.

With one exception — Andrei A. seems to have been writing a lot of D code.  And the result shows.  Things like fixing the limitation with IFTI came about directly because Andrei complained that it was too hard to write his libraries in the way they should be written with IFTI as it was.  Unfortunately I’m worried that Andrei’s influence in the D community will be drastically reduced now that he has left Seattle.  Walter seems to have trouble maintaining lines of communication when face-to-face meets at the coffee shop aren’t possible.

But back to dogfood.  In contrast to the core D folks, the Tango team seems to be deep in their own dogfood.  And really I think that right there explains the existence of Tango.   The Tango folks are actually using D and they got fed up trying to work with stuff that wasn’t built with that kind of in-the-trenches knowhow.

The current situation leaves me uneasy about D’s future.  How do we make sure D not only survives but becomes insanely great?  I have no silver bullet, but it seems to me like Walter is always going to be more interested in new and shiny than solid and complete.  That’s fine, really.  Somebody does need to be looking at the next big thing.  So I think what D really needs is a #2 guy who is both a heavy D user and a compiler writer and who’s main interest is making D polished.   I’m hoping that LLVMDC will somehow help there.  Lindquist and Kamm have been making great strides on that alternative D compiler, and have already proposed fixes for things like cross-module symbol visibility.  Hopefully they will be able to communicate effectively with Walter about these things, otherwise the ultimate result may be a forked language.  I know no one really wants that to happen, but it’s happened with the runtime already, and I don’t see any evidence that the environment that gave rise to that fork has significantly changed.

[update Sept 9, 2008]

Don’t count Andrei out of the running yet!  A day after I wrote the above, Andrei came out with a proposal for for iterators/ranges in D, what could become std.range for D2 Phobos.  What’s more, to implement it he has requested that Walter implement reference return values, and Walter has apparently agreed.  Well, this is exactly the kind of practical, day-to-day bread-and-butter programming stuff that D desperately needs.  Exactly the kind of polish and completeness issue I was talking about above.   The deficiencies of opApply and the lack of reference return values have long been on the top of my D peeves list.  So I’m really happy to see this development.  Maybe there’s still hope for D after all.

D executable sizes over time

August 5th, 2008

Lionello Lunesu went to the trouble to compile an executable with the 38 of most recent releases of D to see how exe sizes have changed.

It’s a shame to let that effort go to waste without at least making a graph out of it.  So here it is:

Minimal D exe sizes over time

Minimal D exe sizes over time

Yup, that’s a pretty big leap at the end.

LaTex in WordPress with PHP5.x

July 31st, 2008

I’ve been using the wp-latexrender plugin on my WordPress blogs on DreamHost here for a while now.  The other day something prompted me to switch my DreamHost account to use PHP5 instead of the default PHP4.  Today I come to work and find equations in new posts are all full of garbage text with words like “ormulabox” and “ormulawidth” and “ormulaheight”.

Turns out PHP5.2 added “\f” as a special escape sequence.  So the php code that was working fine with LaTeX commands like “\formulabox” in double quoted strings, suddenly started breaking.  The \f’s became formfeeds, and what’s left (“ormulabox”, etc.)  was being interpreted by LaTeX as just regular words to put in the output.

So you could fix it by just turning those \f’s into \\f’s, but that would break latexrender on PHP4 installs.

So the fix to keep things working with both PHP4 or 5 is to put the bulk of those strings in single quotes.   So replace the wrap_formula function in wp-content/plugins/latexrender/class.latexrender.php with the following:

    function wrap_formula($latex_formula) {
        $string  = "\documentclass[".$this->_font_size."pt]{".$this->_latexclass."}\n";
        $string .= '\usepackage[latin1]{inputenc}' ."\n";
        $string .= '\usepackage{amsmath}' ."\n";
        $string .= '\usepackage{amsfonts}'."\n";
        $string .= '\usepackage{amssymb}'."\n";
        $string .= '\pagestyle{empty}' ."\n";
        $string .= '\newsavebox{\formulabox}' ."\n";
        $string .= '\newlength{\formulawidth}' ."\n";
        $string .= '\newlength{\formulaheight}' ."\n";
        $string .= '\newlength{\formuladepth}' ."\n";
        $string .= '\setlength{\topskip}{0pt}' ."\n";
        $string .= '\setlength{\parindent}{0pt}' ."\n";
        $string .= '\setlength{\abovedisplayskip}{0pt}' ."\n";
        $string .= '\setlength{\belowdisplayskip}{0pt}' ."\n";
        $string .= '\begin{lrbox}{\formulabox}' ."\n";
        $string .= "$\\ ".$latex_formula."$\n";
        $string .= '\end{lrbox}' ."\n";
        $string .= '\settowidth {\formulawidth}  {\usebox{\formulabox}}' ."\n";
        $string .= '\settoheight{\formulaheight} {\usebox{\formulabox}}' ."\n";
        $string .= '\settodepth {\formuladepth}  {\usebox{\formulabox}}' ."\n";
        $string .= '\newwrite\foo' ."\n";
        $string .= '\immediate\openout\foo=\jobname.depth' ."\n";
        $string .= '    \addtolength{\formuladepth} {1pt}' ."\n";
        $string .= '    \immediate\write\foo{\the\formuladepth}' ."\n";
        $string .= '\closeout\foo' ."\n";
        $string .= '\begin{document}' ."\n";
        $string .= '\usebox{\formulabox}' ."\n";
        $string .= '\end{document}' ."\n";

        return $string;
    }

And that does the trick.  This was a problem as of Aug 1, 2008, with version v0.8 of class.latexrender.php.

Hello world!

July 29th, 2008

Hello, this blog, in contrast to my other blog, will be about tech stuff, research ideas, and other geeky stuff.