I have left Harvard as of July 1, 2008 to take a position at
NYU.
This website has been cached and left static. Feel free to browse
my
new website,
aka "What the heck is a Clinical Associate Professor?"
05.08.07
Posted in LaTeX, PHP, Web at 2:53 pm by leingang
I just found PhpMathPublisher on the web and it looks kind of interesting. The name pretty much describes it: a PHP package that parses a kind of math input and produces image-based output.
Most packages (such as LaTeXRender) along these lines serve as a front end to TeX or LaTeX, then serve up a generated image file. There are some drawbacks to this:
- TeX and LaTeX are complicated programs with huge distributions, and may not be available to all web programmers
- because these programs can include files, there’s a potential security leak in allowing all web users to effectively execute TeX code on the server.
PhpMathPublisher has a tex-like syntax but seems to parse the input on its own and use GD to assemble a formula. Here’s the markup:
<m>delim{|}{{1/N} sum{n=1}{N}{gamma(u_n)} - 1/{2 pi} int{0}{2 pi}{gamma(t) dt}}{|} <= epsilon/3</m>

In LaTeX we would write
\left|\frac{1}{N}\sum_{n=1}^n \gamma(u_n) - \frac{1}{2\pi}\int_0^{2\pi} \gamma(t)\,dt\right| \leq \frac{\varepsilon}{3}
to get

It does get the job done, and the finished product is not so bad.
Blogged with Flock
Permalink
Comments off
12.05.05
Posted in Books, PHP at 7:36 am by leingang
XML is, depending on who you ask, “One file format to rule them all”
or “most hyped technology” ever. One way to describe it is a
self-documenting file format with a simple syntax inspired by HTML.
But what is it good for?
What isn’t it good for? Anything can be stored in an XML format,
whether it’s web site content, data from an experiment, server logs,
whatever. Word processor and spreadsheet files saved by OpenOffice
are gzipped XML documents. XML can even be used to prescribe how one
XML document should be transformed into another, giving a nice
cross-platform method for (say) converting an OpenOffice file to HTML.
This is XSLT. With a few shell scripts and utilities, an entire web
site can be managed, publishing content in different formats, without
a full-featured scripting language.
But the base XSLT can’t do everything (for instance, insert the
current date), and so it’s nice to have the support of a scripting
language like PHP. PHP has its fans and haters, but its popularity
cannot be denied. It has a simple syntax and data model (in
particular, hashes and lists can be treated pretty equally), it’s easy
to learn, and it has tons of libraries built in, or able to be added.
Combining the strength of XML with the simplicity of PHP, here comes
the aptly-titled No Nonsense XML Web Development
With PHP. The book is by Thomas Myer and is published by the good
folks at SitePoint (The book is generally not available in stores,
but can be purchased through their website). The author aims to
introduce the power and versatility of XML to the beginning web
professional. It’s a fun read, and although the average übergeek
may not learn much from it, it’s certainly worth recommending to a
newbie.
Read the rest of this entry »
Permalink
Comments off
04.01.05
Posted in PHP at 7:11 am by leingang

I’m reviewing a new book on PHP5 and since they wanted me to check it for technical accuracy. The only problem for me was that I haven’t done actual PHP programming for a while and in fact never used PHP5. I was worried about clobbering old PHP4 installations. Luckily, however, it is a cinch to install, even on a Mac, with apxs. All I had to do was follow
these instructions and I was good to go.
Notice the bunny rabbit instead of the PHP logo; that must have been an April Fool’s prank.
Permalink
Comments off