Ajax services again
I am doing some work in PHP at the moment, not a huge amount, connecting things up. I got back to how much I like doing simple things at the Ajax level. One example is I needed to normalise a string, from unicode to plain text, much like Plone currently does. For example turning:
Pdi manjar de veire, me nafrari pas
Into:
podi-manjar-de-veire-me-nafraria-pas
An English ASCII approximation. My first thought was "hey, that's what Plone does". So I grabbed my highly unsophisticated mod_python services framework and wrapped the Plone API from PloneTool.py (which means yes its under GPL) and threw together a quick file (about 20 lines) so that the above comes back as:
<?xml version="1.0" ?> <response> <info author="Andy McKay, ClearWind Consulting" end="Tue Jul 31 14:28:53 2007" length="0.00110411643982" start="Tue Jul 31 14:28:53 2007" version="1.0"/> <result>podi-manjar-de-veire-me-nafraria-pas</result> </response>
Weee, it's a simple manner of now writing Ajax to pull that out and bingo I can do that in Rails, Plone, mod_python and PHP. Assuming the server stays up. The pattern of doing lots of little bits at the browser level is something I really like, having the discipline of using lots of languages forces a different solution. Web services at last.
Service available at: http://www.clearwind.ca/software/normalize/