CherryPy: how to read POST data

cherrypy.request.body_params

Advertisements

Patches for Zen-Coding Plug-in for Emacs

Recently I was appointed to become the maintainer of the zen-coding plugin for Emacs after I submitted several patches for it. What the patches do:

  • #id and .classes can now be used without specifying the tag name (it will default to div).
  • Automatically self-close self-closing tags (br, img, input) except if it has child(ren). The latter is useful when you are writing xml that happens to have tags named br/img/input.
  • Support for quoted attribute value (E attr=”value”), useful if the attribute value contains special characters, such as parentheses.
  • Tag expander syntax support (E+) automatically expands tags that have obvious children (table, ol, ul, dl). For example ul+ will be expanded to <ul><li></li></ul>.
  • Improved formatting (indentation and newlines).
  • Added filters support. Implemented filters (other than html) are:
    • c (comments for elements with #id or .classes).
    • haml.
    • hic (clojure’s hiccup).
    • e (escape xml-unsafe characters < > and &).

If you are writing html/haml/hiccup using Emacs, you might find the plugin useful. Check it out. Contributions are welcomed.

jsonify: Django custom template filter

This template filter converts the filtered variable to json. I added comment to that snippet to:

1. Pass a kwarg cls=ModelJSONEncoder to simplejson.dumps to get handling of django.db.models.Model objects (get ModelJSONEncoder here). And as sk1p pointed out, you’ll also get handling of datetime objects and decimals for free.

2. Put jsonify.is_safe=True after register.filter so you don’t need to do {% autoescape off %} or |safe every time you use jsonify.

Using SOAP on BlackBerry

Get ksoap here. It contains the source, the docs, and samples. All that you need.

Simple, isn’t it? Now I don’t get why RIM’s site is so confusing, infos are scattered in PDFs with abstracts, introductions, promotions (shrugs), and all other blabbers while they could just put a simple list of instructions.

I keep thinking that BlackBerries (both the product, the website, and the development tools and documentation) are for PHBs rather than for Dilberts/Asoks.