Want to use the {% url %} template tags in Jinja2?
https://github.com/dcramer/coffin/blob/master/coffin/template/defaulttags.py
Want to use Jinja AND the Django template (for backwards compat with the admin screen)?
https://gist.github.com/472309
Thursday, April 28, 2011
'delete' doesn't trigger keypress events in JavaScript
http://unixpapa.com/js/key.html
Some browsers avoid this problem by not generating keypress events for special keys. A good case can be made that this is the right thing to do, since these keystrokes are arguably not character events. But such arguments are weakened by the arbitrariness of the division between normal and special keys. Why should the keyboard Backspace key have a keypress event, but not the keypad Delete key? Is Tab really fundamentally different than right arrow?
| pecial Keys | ||||||
| Key | ASCII | Mozilla keycodes | IE keycodes | Opera keycodes | pseudo ASCII codes | exceptions |
|---|---|---|---|---|---|---|
| Insert | - | 45 | 45 | 45 | 45 | Konqueror: 0 Opera < 9.0: 0 |
| Delete | - | 46 | 46 | 46 | 46 | Konqueror: 127 Opera < 9.0: 0 |
| Home | - | 36 | 36 | 36 | 36 | Opera < 9.0: 0 |
| End | - | 35 | 35 | 35 | 35 | Opera < 9.0: 0 |
| Page Up | - | 33 | 33 | 33 | 33 | |
| Page Down | - | 34 | 34 | 34 | 34 | |
| Function Keys F1 to F12 | - | 112 to 123 | 112 to 123 | 112 to 123 | 112 to 123 | |
| Keypad Keys | ||||||
Some browsers avoid this problem by not generating keypress events for special keys. A good case can be made that this is the right thing to do, since these keystrokes are arguably not character events. But such arguments are weakened by the arbitrariness of the division between normal and special keys. Why should the keyboard Backspace key have a keypress event, but not the keypad Delete key? Is Tab really fundamentally different than right arrow?
keypress events event.keyCode event.which event.charCode Internet Explorer (Windows) normal: ASCII code undefined undefined special: no keypress events for special keys Internet Explorer (Mac) normal: ASCII code undefined ASCII code special: no keypress events for special keys Gecko normal: zero ASCII code ASCII code special: Mozilla keycode zero zero WebKit ≥ 525 normal: ASCII code ASCII code ASCII code special: no keypress events for special keys WebKit < 525 normal: ASCII code ASCII code ASCII code special: extended ASCII code extended ASCII code extended ASCII code Opera ≥ 10.50 (all platforms) normal: ASCII code ASCII code undefined special: Mozilla keycode, except keypad and branded keys give Opera keycodes zero undefined Opera ≥ 9.50 (all platforms)
Opera 7 (Windows)normal: ASCII code ASCII code undefined special: Mozilla keycode, except keypad and branded keys give Opera keycodes zero for arrows, function keys, PageUp, PageDown
same as event.keyCode otherwiseundefined Opera 8.0 to 9.27 (Windows) normal: ASCII code ASCII code undefined special: Opera keycode zero for arrows, function keys, PageUp and PageDown,
same as event.keyCode otherwiseundefined Opera < 9.50 (Linux & Macintosh) normal: ASCII code ASCII code undefined special: Opera keycode zero for arrows, function keys, PageUp and PageDown,
same as event.keyCode otherwiseundefined Konqueror 4.3 normal: ASCII code ASCII code ASCII code special: Pseudo-ASCII code Pseudo-ASCII code zero Konqueror 3.5 normal: ASCII code ASCII code ASCII code special: Pseudo-ASCII code zero zero Konqueror 3.2 normal: ASCII code ASCII code undefined special: no keypress events for special keys
Chrome Better Pop Up Block (v2.1.6) interferes with Hotmail
http://optimalcycling.com/other-projects/better-pop-up-blocker/
It is this popup blocker 2.16 that prevents from opening up Hotmail within Chrome browser.
With all my other extensions and plugins enabled or turned on, when the popup is enabled, email messages could not open Hotmail but could if it is disabled.
Surprisingly, Hotmail actually works very well with Chrome and is tacitly recommended by Microsoft to use!
It is this popup blocker 2.16 that prevents from opening up Hotmail within Chrome browser.
With all my other extensions and plugins enabled or turned on, when the popup is enabled, email messages could not open Hotmail but could if it is disabled.
Surprisingly, Hotmail actually works very well with Chrome and is tacitly recommended by Microsoft to use!
Wednesday, April 27, 2011
Process vs. threads
Andrew Tridgell's slide writeup: http://www.samba.org/~tridge/talks/threads.pdf
Wednesday, April 20, 2011
Pylint and maximum recursion depth errors
Ever see these error messages in your pylint?
This bug was filed here: https://bugs.launchpad.net/pylint/+bug/456870 The solution seems to just upgrade Pylint using pip install instead of the Ubuntu Lucid package.
Exception RuntimeError: maximum recursion depth exceeded while calling a Python object
This bug was filed here: https://bugs.launchpad.net/pylint/+bug/456870 The solution seems to just upgrade Pylint using pip install instead of the Ubuntu Lucid package.
sudo apt-get remove pylint sudo apt-get remove python-logilab-common sudo pip install pylint
pylint --version No config file found, using default configuration pylint 0.23.0, astng 0.21.1, common 0.55.0 Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3]
do...and and {} in Ruby
http://www.troubleshooters.com/codecorn/ruby/basictutorial.htm
This issue is similar to the problem reported in http://stackoverflow.com/questions/5513531/ruby-do-end-vs-braces
Difference Between {} and do/end
As mentioned, there's one small difference between brace enclosed blocks and do/end enclosed blocks: Braces bind tighter. Watch this:
#!/usr/bin/ruby
my_array = ["alpha", "beta", "gamma"]
puts my_array.collect {
|word|
word.capitalize
}
puts "======================"
puts my_array.collect do
|word|
word.capitalize
end
[slitt@mydesk slitt]$ ./test.rb
Alpha
Beta
Gamma
======================
alpha
beta
gamma
[slitt@mydesk slitt]$
The braces bound tightly like this:
puts (my_array.collect {|word| word.capitalize})
Whereas do/end bind more loosely, like this:
puts (my_array.collect) do |word| word.capitalize} end
This issue is similar to the problem reported in http://stackoverflow.com/questions/5513531/ruby-do-end-vs-braces
Tuesday, April 19, 2011
Relative paths in PYTHONPATH breaks Nose tests
http://wingware.com/pipermail/wingide-users/2008-September/005878.html
What you're seeing is the affect of the current working directory being different when tests are run versus when the main debug file is run. By default, the initial current working directory is the directory that the file run in in -- this applies to either the main debug file or the individual test files.Another observation is that your HUDSON_HOME should be properly set too...otherwise Nose will not know to look for the right imports if you use $WORKSPACE in your PYTHONPATH.
Subscribe to:
Posts (Atom)