mPartsRegistry : small update

I just made a small update to mPartsRegistry, the mobile interface I wrote to make browsing the Registry of Standard Biological Parts a little easier on smartphones.

This update adds a “Random Part” button – it’s mostly just so people who want to play with it without actually knowing a part ID can get some instant gratification. This is in addition to the quiet update I made a few months ago to replace jQTouch with JQuery Mobile, since jQTouch development stagnated for a while and never really properly supported most mobile browsers.

Mako templates in Google App Engine: seems to work for me

For some reason which I can’t really articulate, I’m not a huge fan of Django templating. I’d actually prefer to use Genshi with Google App Engine, but I need to wait until all the kinks are ironed out, since as far as I can tell it’s not quite working painlessly yet. Another templating option is Mako, which I’ve barely used, but I still prefer to Django templates. One nice thing about Mako: it’s faster than most Python templating engines out there. So, here’s a quickie on how I got Mako working with Google App Engine. It wasn’t tricky at all, but I thought I’d document it anyway.

Checkout Mako from SVN and copy the directory mako/lib/mako to the path of your application, eg, on Linux:

$ cp -r mako/lib/mako myapp

(where myapp is the directory that your GAE app lives in).

In your app, obviously you’ll need to import some parts of mako:

from mako.template import Template

Then, whenever you want to render a template as output (say, at the end of a ‘get’ or ‘post’ method .. see the GAE templating example for some context), call something like:

# a dictionary of variables to send to the template namespace
foo, bar = "some", "enthralling text"
template_values = {
  ‘some_foo’: foo,
  ‘some_bar’: bar

# index.mako is the template file in our GAE app directory
path = os.path.join(os.path.dirname(__file__), ‘index.mako’)
# make a new template instance
templ = Template(filename=path)
# unpack the dictionary to become keyword arguments and render

An example of some template text that could go into index.mako could be:

<html><body>${some_foo} likes the ${some_bar}<br/></body></html>

One possible modification: I need to look into it, but defining your Template class (eg templ in the example above) in the main() function (maybe as a global) rather than instantiating it every time it is rendered would probably give better performance.

How do you describe your job as a scientist ?

I’ve always found it interesting how people describe their jobs, particularly scientists. Sometimes I find the “inevitable dinner party question” (“So, what do you do?”) difficult. The answer typically requires knowing the background of the inquirer … if your job description is too technical, it tends to freak people out, and can often cause the evenings conversation to disintegrate into too much science-talk (yes, sometimes it’s possible to have too much science-talk). The safer option, giving a simplified very high-level job description geared toward lay-people, is usually unsatisfying and can even sound a bit insulting if you are unknowingly speaking to someone with experience in your field.

Overall, I think it’s really good practice to be able to describe your job (or “role”, or “work”) as a scientist at many different levels. It certainly helps me understand “what I do”, and can really assist in having the right words on-hand when writing grants, fellowship applications, abstracts and maybe even (gasp) press-releases, each that could be aimed at widely differing audiences.

What got me thinking so philosophically this morning ? A tongue-in-cheek quote I noticed on a lab head’s page describing his role in the research group:

Gets the big pay check, sits around waiting for results, drinks coffee, helps write papers and tells people to work harder.

I’m sure he does a little more than that … but I suspect there’s also a bit of refreshing honesty in that description. Probably every part is true, except the “sits around waiting” part. I wouldn’t try using it to describe your role on a grant application though 🙂

Roll over Google Docs :: MonkeyTeX is here

Okay, so maybe Google Docs still has a (sizable) market, but MonkeyTeX is probably worth knowing about if you are a TeX-nerd like myself 🙂

Essentially, MonkeyTeX allows you to edit, store, share and collaborate on LaTeX documents via a web interface. It supports BibTeX and Sty files, and can render to PDF. I’ve only played with it briefly, but it could be useful on occasions when I get stuck without a working LaTeX installation (such as internet cafes with only Windows machines) but would like to produce a professional looking document. It may be a nice way for people to test and learn LaTeX with minimal barriers to entry too.

Via thekit at LiveJournal