Human Factors of XR: Using Human Factors to Design XR Systems
What to do when things go wrong
1. What to do when
things go wrong
Tips and tricks for the desperate souls
http://www.slideshare.net/dorneles/what-to-do-when-things-go-wrong
Dorneles Treméa
Enfold Systems
X3ng
APyB
1
quarta-feira, 25 de novembro de 2009
2. Agenda
• Shell
• Buildout
• ZMI
• Debug
2
quarta-feira, 25 de novembro de 2009
3. .profile
# ~/.profile: executed by the command
# interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile
# or ~/.bash_login exists.
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
3
quarta-feira, 25 de novembro de 2009
4. .bashrc
# ~/.bashrc: executed by bash for non-login shells
# set the env variable used by python
export PYTHONSTARTUP=$HOME/.pythonrc
# Append to and update the history commands
shopt -s histappend
export PROMPT_COMMAND='history -a'
# Don't put duplicate lines in the history
export HISTCONTROL=ignoreboth
export HISTSIZE=50000
4
quarta-feira, 25 de novembro de 2009
5. .bashrc (2)
# user@server, relative path, current time
export PS1='[e[32m][u@h] [e[33mw]n
[e[1;34m][t][e[0m] $ '
[dorneles@plonessa] ~/in/the/main/room
[16:31:45] $
5
quarta-feira, 25 de novembro de 2009
6. .inputrc
# ~/.inputrc: when a program which uses the
# readline library starts up, the key bindings
# and variables are set
# this makes the "delete" key work
# rather than just entering a ~
"e[3~": delete-char
# these allow you to use ctrl+left/right arrow
# keys to jump the cursor over words
"e[5C": forward-word
"e[5D": backward-word
6
quarta-feira, 25 de novembro de 2009
7. .inputrc (2)
# these allow you to start typing a command
# and use the up/down arrow to auto complete
# from commands in your history
"e[B": history-search-forward
"e[A": history-search-backward
# this lets you hit tab to auto-complete a
# file or directory name ignoring case
set completion-ignore-case on
7
quarta-feira, 25 de novembro de 2009
8. .pdbrc
# Enable code completion
import rlcompleter, pdb
pdb.Pdb.complete =
rlcompleter.Completer(locals()).complete
# Print instance variables (usage "pi classInst")
alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",
%1.__dict__[k]
8
quarta-feira, 25 de novembro de 2009
9. .pdbrc (2)
>>> class Foo(object):
... def bar(self):
... return True
...
>>> import pdb; pdb.set_trace()
(Pdb) p Foo
<class '__main__.Foo'>
(Pdb) pi Foo
...
Alternatively, you can also use `ipdb`.
9
quarta-feira, 25 de novembro de 2009
10. ipython / bpython
Do I need to say anything? :-)
10
quarta-feira, 25 de novembro de 2009
11. .buildout/default.cfg
[buildout]
zope-directory=/home/user/cache/zope
download-cache=/home/user/cache/download
download-directory=/home/user/cache/download
eggs-directory=/home/user/cache/eggs
11
quarta-feira, 25 de novembro de 2009
12. When buildout goes
wild...
• bin/buildout -U
• Avoid reading ~/.buildout/default.cfg
• bin/buildout -D
• Drops you in pdb at the point where the
exception happened
12
quarta-feira, 25 de novembro de 2009
13. Environment Variables
environment-vars =
DISABLE_PTS True
TMP ${buildout:directory}/var/tmp
PYTHON_EGG_CACHE
${buildout:directory}/var/.python-eggs
13
quarta-feira, 25 de novembro de 2009
14. Buildout Extensions
• mr.developer
• buildout.dumppickedversions
[buildout]
extensions =
mr.developer
buildout.dumppickedversions
[sources]
my.pack = svn http://foo.com/my.pack/trunk
14
quarta-feira, 25 de novembro de 2009
16. Buildout Recipes:
omelette
• collective.recipe.omelette
[omelette]
recipe = collective.recipe.omelette
eggs = ${instance:eggs}
products = ${instance:products}
packages = ${zope2:location}/lib/python ./
location = ${buildout:directory}/source
16
quarta-feira, 25 de novembro de 2009
17. Buildout Recipes:
ipzope
• collective.recipe.omelette
[ipzope]
# Put a copy of the following inside your $HOME/.ipython directory:
# http://svn.plone.org/svn/collective/dotipython/trunk/ipy_profile_zope.py
recipe = zc.recipe.egg
eggs = ipython ${instance:eggs}
initialization =
import sys, os
os.environ["SOFTWARE_HOME"] = "${zope2:location}/lib/python"
os.environ["INSTANCE_HOME"] = "${instance:location}"
sys.argv[1:1] = "-p zope".split()
extra-paths = ${zope2:location}/lib/python
scripts = ipython=ipzope
17
quarta-feira, 25 de novembro de 2009
18. Managing Zope
• Use the right user:
$ bin/instance start/stop/...
# bin/instance start/stop/...
• It’s different and in certain conditions it can
produce unexpected results: unattached
and zombie processes!
18
quarta-feira, 25 de novembro de 2009
19. Debug Modes
• Zope Debug
• $bin/instance debug
• $bin/instance fg
• Overrides settings from etc/zope.conf
• CSS/JS/KSS Debug
• Better behavior on Plone 4.0
19
quarta-feira, 25 de novembro de 2009
20. Accessing Zope
• Unlock yourself
• $ echo foo:bar > parts/instance/access
• Update the (or create a new) Manager
user in the acl_users folder
• $ rm parts/instance/access (important!)
• ZODB root
• http://.../aq_parent/manage
20
quarta-feira, 25 de novembro de 2009
21. Access Rules
• Plone used to ship with Extensions/
accessRule.py (dropped starting on 4.0)
• Environment variables
• HTTP_MANAGE
• SUPPRESS_ACCESSRULE
• http://.../_SUPPRESS_ACCESSRULE/manage
21
quarta-feira, 25 de novembro de 2009
22. Different users in
the same browser
• http://127.0.0.1/...
• http://127.0.0.2/...
• http://localhost/...
• http://new_alias/...
• Edit /etc/hosts and add as many host name
aliases as you need!
22
quarta-feira, 25 de novembro de 2009
23. portal_setup
• It’s very important to sure to choose
the correct profile when importing
the selected or all the steps!
• Undo is your friend, for sure...
• If everything else fail, you still can try to
import the individual steps from the
correct profiles in the correct order
23
quarta-feira, 25 de novembro de 2009
24. portal_workflow
• Make sure to always click in the mystical
‘Update security settings’ button to update
the EXISTING objects after changing the
security related settings
• New objects will be always created with
the right permissions
• Avoid change individual object permissions
that are managed by workflows
24
quarta-feira, 25 de novembro de 2009
25. Long running processes
• It can be tricky due the way how browsers
handle requests: timeout!
• Use REQUEST.RESPONSE.write instead of
print/return printed, this guarantee that the
browser receives a continuous stream and
don’t timeout
25
quarta-feira, 25 de novembro de 2009
26. Helpful packages
• Products.Clouseau
• Products.Gloworm
• Products.DocFinderTab
• Products.PDBDebugMode
26
quarta-feira, 25 de novembro de 2009
28. Firefox Plugins
• Firebug
• Firecookie
• Firediff
• YSlow
• FirePython
• Web Developer
28
quarta-feira, 25 de novembro de 2009
29. Validators
• http://validator.w3c.org
• http://jigsaw.w3.org/css-validator
• It helps to avoid headaches when
turning off the debug mode
29
quarta-feira, 25 de novembro de 2009
30. And the thanks goes to...
• Alexander Limi
• Jarn (Plone Solutions)
• Enfold Systems
• Plone Foundation
• The fantastic Plone Community!
30
quarta-feira, 25 de novembro de 2009
31. That’s it!
• Thank you!
• Dorneles Treméa
• dorneles@tremea.com
31
quarta-feira, 25 de novembro de 2009
32. Ah... I almost forgot!
I'd like to see a Plone Conference
or Symposium (or whatever!) in
California! ;-)
32
quarta-feira, 25 de novembro de 2009