cherrypy.request.body_params
Showing spinner when loading fancybox iframe
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.
CSRF token missing or incorrect
- In your template:
- put
{% csrf_token %}
inside your<form>
eg:<form> {% csrf_token %} ... </form>
- put
- In your view:
from django.template import RequestContext
- pass
context_instance=RequestContext(request, {})
torender_to_response
I put Martin’s django-captcha on github
git: fatal: $HOME not set
Go to Control Panel -> System -> Advanced -> Environment Variables -> New.
Variable name: HOME
Variable value: C:\Documents and Settings\your-username
Click OK, OK, OK.
Reopen your command prompt.
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.
sqlite3.OperationalError: unable to open database file
Check your settings.py DATABASE_NAME, ensure that:
– The path is absolute path, don’t use ~ $HOME etc, and
– The path exists, and
– The database file exists (if it doesn’t, use manage.py syncdb), and
– Webserver has read and write access to the file, and
– Webserver has read and write access to the directory containing the file.
Anything else?
Sorry, you must have a tty to run sudo
1. Open /etc/sudoers
2. Comment the line “Defaults requiretty”
3. Save