• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
What to do when things go wrong
 

What to do when things go wrong

on

  • 2,353 views

Tips and tricks for the desperate souls.

Tips and tricks for the desperate souls.

Statistics

Views

Total Views
2,353
Views on SlideShare
2,331
Embed Views
22

Actions

Likes
0
Downloads
30
Comments
2

3 Embeds 22

http://www.slideshare.net 18
http://www.linkedin.com 3
http://www.lmodules.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

12 of 2 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Para os que tiveram que escrever a configuração contida no slideshare na mão (Porque ele retira as barras invertidas) mas não querem fazer isso de novo, segue o link http://paste.pocoo.org/show/399475/
    RIP @dorneles
    Are you sure you want to
    Your message goes here
    Processing…
  • para que serve history -a?
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    What to do when things go wrong What to do when things go wrong Presentation Transcript

    • 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
    • Agenda • Shell • Buildout • ZMI • Debug 2 quarta-feira, 25 de novembro de 2009
    • .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
    • .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
    • .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
    • .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
    • .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
    • .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
    • .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
    • ipython / bpython Do I need to say anything? :-) 10 quarta-feira, 25 de novembro de 2009
    • .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
    • 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
    • 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
    • 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
    • Problematic packages: compatibility with 3.x plone.recipe.zope2instance = 3.6 Products.CMFCore = 2.1.2 Products.Marshall = 1.2.1 Products.Archetypes = 1.5.13 Products.validation = 1.6.3 Products.LinguaPlone = 2.4 Products.TextIndexNG3 = 3.2.17 Products.GenericSetup = 1.4.5 Products.PortalTransforms = 1.6.4 Products.MimetypesRegistry = 1.6.4 15 quarta-feira, 25 de novembro de 2009
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • Helpful packages • Products.Clouseau • Products.Gloworm • Products.DocFinderTab • Products.PDBDebugMode 26 quarta-feira, 25 de novembro de 2009
    • Reloading & Freezing • plone.reload • mr.freeze • non-debug: stack, pony • debug: freeze, freeze [file] [line #] • planned: reload code, reload zcml 27 quarta-feira, 25 de novembro de 2009
    • Firefox Plugins • Firebug • Firecookie • Firediff • YSlow • FirePython • Web Developer 28 quarta-feira, 25 de novembro de 2009
    • 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
    • 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
    • That’s it! • Thank you! • Dorneles Treméa • dorneles@tremea.com 31 quarta-feira, 25 de novembro de 2009
    • 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