Monthly Archives: February 2010

SILT: Reverse templates, the pixels, and swig

The Final Frontier

In case you've been wondering where I've been. (space, duh.)

Wow, it has been a while. Sorry for the silent treatment, it’s been a busy time. I’ve been learning lots, so hopefully I’ll process that queue in a blaze of consistency. Bring on the MEAT:

  • Recently I had to do a whole load of data processing. Not a one-time deal, but good old XML processing for API integration. It occurred to me that just as Web 2.0 and its myriad frameworks have brought a new age of templates, it seems that there should be a complementary reverse template. As in, I specify a template, and a string, and I get a map of variables back (as opposed to template+map = string). This would seriously be the most beautiful thing.
    And as it turns out, for once, Perl schools all other languages, because it has it. Template::Extract. If someone made this happen in Python and/or PHP, I would probably engage in an illicit tryst with them.¬†Until then, I have to do xpath-style stuff. Which is fine, I guess, but you’d agree that it’s harder to read and maintain.
  • Back when I started doing serious web frontend stuff last summer, I was pretty sure the pragmatic among us were on the same page: px is the way to go for CSS. Everything pixels. em was a hack for IE6, and we’re done with that now, to the point that I’m even exasperated by dead-horse pages like this.
  • For my next project, which will be depriving y’all of blog posts soon enough, I’m planning on using the crap out of swig. Use it to call C/C++/Objective C from basically any scripting language (in my case Python, again). I’m not yet sure of its advantages with PHP as I use it, because it’s really not hard to write your own C++ PHP extension. If all goes well, I’ll be following up on this.

OK, three is good. I save the rest in drafts as they come, in case you were wondering.

Advertisements