SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Vim Script Programming
Vim Script ProgrammingVim Script Programming
Vim Script Programming
Lin Yo-An
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
tobiascrawley
 

Was ist angesagt? (20)

Concurrency in go
Concurrency in goConcurrency in go
Concurrency in go
 
RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
 
Minimal MVC in JavaScript
Minimal MVC in JavaScriptMinimal MVC in JavaScript
Minimal MVC in JavaScript
 
Vim Script Programming
Vim Script ProgrammingVim Script Programming
Vim Script Programming
 
Happy Go Programming
Happy Go ProgrammingHappy Go Programming
Happy Go Programming
 
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
 
Unit Testing Lots of Perl
Unit Testing Lots of PerlUnit Testing Lots of Perl
Unit Testing Lots of Perl
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
C++ Core Guidelines
C++ Core GuidelinesC++ Core Guidelines
C++ Core Guidelines
 
Modern Objective-C @ Pragma Night
Modern Objective-C @ Pragma NightModern Objective-C @ Pragma Night
Modern Objective-C @ Pragma Night
 
HipHop Virtual Machine
HipHop Virtual MachineHipHop Virtual Machine
HipHop Virtual Machine
 
Demystifying the Go Scheduler
Demystifying the Go SchedulerDemystifying the Go Scheduler
Demystifying the Go Scheduler
 
Inheritance compiler support
Inheritance compiler supportInheritance compiler support
Inheritance compiler support
 
Slides
SlidesSlides
Slides
 
VIM for (PHP) Programmers
VIM for (PHP) ProgrammersVIM for (PHP) Programmers
VIM for (PHP) Programmers
 
Sdl Basic
Sdl BasicSdl Basic
Sdl Basic
 

Ähnlich wie What to do when things go wrong

Im trying to run make qemu-nox In a putty terminal but it.pdf
Im trying to run  make qemu-nox  In a putty terminal but it.pdfIm trying to run  make qemu-nox  In a putty terminal but it.pdf
Im trying to run make qemu-nox In a putty terminal but it.pdf
maheshkumar12354
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell Scripting
Raghu nath
 

Ähnlich wie What to do when things go wrong (20)

あなたの知らないネットワークプログラミングの世界
あなたの知らないネットワークプログラミングの世界あなたの知らないネットワークプログラミングの世界
あなたの知らないネットワークプログラミングの世界
 
One hour application - PHP Quebec Conference 2009
One hour application - PHP Quebec Conference 2009One hour application - PHP Quebec Conference 2009
One hour application - PHP Quebec Conference 2009
 
Bash is not a second zone citizen programming language
Bash is not a second zone citizen programming languageBash is not a second zone citizen programming language
Bash is not a second zone citizen programming language
 
Paexec -- distributed tasks over network or cpus
Paexec -- distributed tasks over network or cpusPaexec -- distributed tasks over network or cpus
Paexec -- distributed tasks over network or cpus
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
 
Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation
 
Background Processing in Ruby on Rails
Background Processing in Ruby on RailsBackground Processing in Ruby on Rails
Background Processing in Ruby on Rails
 
Unix tips and tricks
Unix tips and tricksUnix tips and tricks
Unix tips and tricks
 
Lets make better scripts
Lets make better scriptsLets make better scripts
Lets make better scripts
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation
 
Yapc::NA::2009 - Command Line Perl
Yapc::NA::2009 - Command Line PerlYapc::NA::2009 - Command Line Perl
Yapc::NA::2009 - Command Line Perl
 
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneruJak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
 
2010 Smith Scripting101
2010 Smith Scripting1012010 Smith Scripting101
2010 Smith Scripting101
 
Exploring Code with Pry!
Exploring Code with Pry!Exploring Code with Pry!
Exploring Code with Pry!
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to you
 
Im trying to run make qemu-nox In a putty terminal but it.pdf
Im trying to run  make qemu-nox  In a putty terminal but it.pdfIm trying to run  make qemu-nox  In a putty terminal but it.pdf
Im trying to run make qemu-nox In a putty terminal but it.pdf
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell Scripting
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Kürzlich hochgeladen (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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
  • 15. 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
  • 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
  • 27. 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
  • 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