Joaquin Tita: What's the iPad resolution?

   Publicado: iPad has a 1024 by 768 resolution.
Just that.

Joaquin Tita: Escaping Charecters in python

   Publicado:
Just an example commonly used
Escaping the "\" with another "\"

>>> with open('C:\\Folder1\\Folder2\\file') as file_handler:
Or just add an "r" before the path (this stands for "raw").

>>> with open(r'C:\Folder1\Folder2\file') as file_handler:

Anthony Lenton: Pala de punta y pala plana

   Publicado:

Pala de punta y pala plana

Mariano Reingart: A new web2py online python debugger

   Publicado: I've finished a new online debugger, based on my previous work on qdb module (bdb/pdb enhancement):

http://code.google.com/p/rad2py/wiki/QdbRemotePythonDebugger

In contrast with pdb, this debugger is based on a client/server model, so it should be more stable and extensible than my previous approach (a piped command line loop, see current debug.py module, a naive attempt to use pdb in a web environment, it is mostly undocumented as it requires some advanced python skills to use pdb commands without blocking the whole web2py server).
In fact, qdb is based on the python bdb debugger framework (borrowing most commands from pdb), and it comes with a CLI, a separate GUI frontend (using wxpython), and for web2py, this totally web based interface.

Although this blog post is about web2py, qdb can be used to make debuggers for other frameworks too, you can use WebDebugger as a base to make controller/views with your favourite web stack.

Currently, this web2py debug implementation uses threads (debug and web ui, automatically managed by default web2py development server) and queues to communicate between them, but this can be extended to use multiprocessing client/listeners or anything with that interface (send, recv and poll, using socket or pipes).

Download:

The web2py package with integrated debugger can be downloaded from my site:

http://www.sistemasagiles.com.ar/soft/web2py_src_debug.zip

The full source code and revisions are in my web2py repo clone in googlecode:

http://code.google.com/r/reingart-web2py/

You can download it with mercurial: 


Also, if you have the latest trunk, you can patch it with:


(the changes are in the default branch so will not create nasty repository effects)

Brief Changelog:

web2py is great because it is small and concise, so most changes are less than 100 lines (and some were trivial):
  • added gluon.contrib.qdb , the debug backend and basic frontend
  • updated gluon.debug to create the qdb client/server debug queues and the web frontend
  • updated applications/admin/controller/debug with interact and breakpoints controllers
  • added applications/admin/views/debug/interact.html and breakpoints.html
  • updated applications/admin/views/default/edit.html to add toggle breakpoint button
  • updated applications/admin/models/menu.py to add top-level debug menu
  • updated applications/admin/js/static/ajax_editor.js (toggle breakpoints) and style.css
  • updated gluon.html.CODE and gluon.highligh to show the context relevant lines 
The full change log is available in the repository here. It took me less than 8 hours to add a debugger to web2py, very nice!

Usage:

Basic interaction (step, next, continue, return, stop, etc.), with the highlighted code, locals/globals and a interactive console to execute python statements in the debug environment.
Access it from the added "Debug" main menu button (or go to http://localhost:8000/admin/debug/interact):



To evaluate an expression, enter it in the second textarea, press enter and it will be executed in the debugger.

The result, if any, will be shown in the upper textarea. You can execute any valid python command, including python assignment statements.

To execute the current statement, press step. If you do not want to enter to functions, press next. To run the program until it finish or a breakpoint is reached, press continue. To cancel execution, press stop.


Breakpoints (including temporary and conditional ones, with hit count) can be accessed from the Breakpoints button at the main debug page (or go to http://localhost:8000/admin/debug/breakpoints):



Temporary breakpoints are deleted automatically after the first hit, and conditional breakpoints only matches if the associated python expression evaluates to True. 
Also, the breakpoint page can show the context source code according to the line number specified.

The breakpoints can also be added and removed from the edit window (new Toggle Button near back/docs, for example, in http://localhost:8000/admin/default/edit/welcome/controllers/default.py):


 


It also can debug exceptions (handled or unhandled, note the exception info and traceback). After you inspect the local or global variables, press continue so normal exception handling will be done:


  


With this changes, web2py can offer a complete online and ubiquitous Integrated Development Environment, so you don't need to learn any external tool to create web sites!

This debugger was tested this on Ubuntu and Windows XP, but it should work in mac and other linux flavours too, as it is pure-python and no third-party dependencies are required.

Future enhancements (supported by the backend, but not implemented already in the web frontend):
  • Jump to line and Run to line
  • Moving Up/down through the stack trace
  • Watch variable list (now they can be manually inspected with the interactive console)
Current drawbacks and limitations:
  • from gluon.debug import dbg;  dbg.do_debug() or dbg.set_trace() should be called from the model/controller to run under debug control (if not, normal web2py dispatch occurs, no breakpoint is honoured). UPDATE: the debugger is automatically started if debug interaction page is opened or breakpoints are set (see wsgibase web2py entry point to run controllers)
  • The debugger is threaded, so beware of apache prefork and similar (the backend supports remote debugging, but it is more trickier to set the breakpoints). This also applies to the current shell and similar tools like paste. See modwsgi Debugging Techniques (Browser Based Debugger). Anyway, I'm working in a full remote multiprocess debugger (that is supported by qdb CLI and GUI right now)
  • Secondary effects can appear if debug more than a function at a time (it will not die, but it is more difficult to follow)
  • I didn't find a way to add markers to editarea yet (ie. a red circle near the line number to indicate a breakpoint)
  • Debugging cannot be limited per application (FILTER_APPS and multi user mode cannot be enforced)
  • Compiled apps cannot be debugged as easily as non-compiled ones (breakpoints must be set manually with set_trace)
  • Some style/layout details are missing

So, if you want to try it, just set breakpoints and execute your controller to start debugging and enjoy ;-)

Anthony Lenton: Cómo distinguir tus gramíneas

   Publicado:

Cómo distinguir tus gramíneas

Joaquin Tita: Using wget to download a page and browse it locally

   Publicado:

Run: [carpincho@bender]$ wget -r --convert-links url
What the arguments do:

  • -r (its the same using --recursive)   Turn on recursive retrieving.   The default maximum depth is 5.

  • -k (its the same using --convert-links) After the download is complete, convert the links in the document to make them suitable for local viewing. This affects not only the visible hyperlinks, but any part of the document that links to external content,such as embedded images, links to style sheets, hyperlinks to non-HTML content, etc.
  • url (obvious :P)
Note: You can run it under any Unix based Os or under Mac Os previouly installing it with macports

Joaquin Tita: Miscellaneous Symbols

   Publicado:
Character
(decimal)
DecimalCharacter
(hex)
HexEntityName
97282600 BLACK SUN WITH RAYS
97292601 CLOUD
97302602 UMBRELLA
97312603 SNOWMAN
97322604 COMET
97332605 BLACK STAR
97342606 WHITE STAR
97352607 LIGHTNING
97362608 THUNDERSTORM
97372609 SUN
9738260A ASCENDING NODE
9739260B DESCENDING NODE
9740260C CONJUNCTION
9741260D OPPOSITION
9742260E BLACK TELEPHONE
9743260F WHITE TELEPHONE
97442610 BALLOT BOX
97452611 BALLOT BOX WITH CHECK
97462612 BALLOT BOX WITH X
97472613 SALTIRE
97482614 UMBRELLA WITH RAIN DROPS
97492615 HOT BEVERAGE
97502616 WHITE SHOGI PIECE
97512617 BLACK SHOGI PIECE
97522618 SHAMROCK
97532619 REVERSED ROTATED FLORAL HEART BULLET
9754261A BLACK LEFT POINTING INDEX
9755261B BLACK RIGHT POINTING INDEX
9756261C WHITE LEFT POINTING INDEX
9757261D WHITE UP POINTING INDEX
9758261E WHITE RIGHT POINTING INDEX
9759261F WHITE DOWN POINTING INDEX
97602620 SKULL AND CROSSBONES
97612621 CAUTION SIGN
97622622 RADIOACTIVE SIGN
97632623 BIOHAZARD SIGN
97642624 CADUCEUS
97652625 ANKH
97662626 ORTHODOX CROSS
97672627 CHI RHO
97682628 CROSS OF LORRAINE
97692629 CROSS OF JERUSALEM
9770262A STAR AND CRESCENT
9771262B FARSI SYMBOL
9772262C ADI SHAKTI
9773262D HAMMER AND SICKLE
9774262E PEACE SYMBOL
9775262F YIN YANG
97762630 TRIGRAM FOR HEAVEN
97772631 TRIGRAM FOR LAKE
97782632 TRIGRAM FOR FIRE
97792633 TRIGRAM FOR THUNDER
97802634 TRIGRAM FOR WIND
97812635 TRIGRAM FOR WATER
97822636 TRIGRAM FOR MOUNTAIN
97832637 TRIGRAM FOR EARTH
97842638 WHEEL OF DHARMA
97852639 WHITE FROWNING FACE
9786263A WHITE SMILING FACE (present in WGL4)
9787263B BLACK SMILING FACE (present in WGL4)
9788263C WHITE SUN WITH RAYS (present in WGL4)
9789263D FIRST QUARTER MOON
9790263E LAST QUARTER MOON
9791263F MERCURY
97922640 FEMALE SIGN (present in WGL4)
97932641 EARTH
97942642 MALE SIGN (present in WGL4)
97952643 JUPITER
97962644 SATURN
97972645 URANUS
97982646 NEPTUNE
97992647 PLUTO
98002648 ARIES
98012649 TAURUS
9802264A GEMINI
9803264B CANCER
9804264C LEO
9805264D VIRGO
9806264E LIBRA
9807264F SCORPIUS
98082650 SAGITTARIUS
98092651 CAPRICORN
98102652 AQUARIUS
98112653 PISCES
98122654 WHITE CHESS KING
98132655 WHITE CHESS QUEEN
98142656 WHITE CHESS ROOK
98152657 WHITE CHESS BISHOP
98162658 WHITE CHESS KNIGHT
98172659 WHITE CHESS PAWN
9818265A BLACK CHESS KING
9819265B BLACK CHESS QUEEN
9820265C BLACK CHESS ROOK
9821265D BLACK CHESS BISHOP
9822265E BLACK CHESS KNIGHT
9823265F BLACK CHESS PAWN
98242660♠ (♠)BLACK SPADE SUIT (present in WGL4 and in Symbol font)
98252661 WHITE HEART SUIT
98262662 WHITE DIAMOND SUIT
98272663♣ (♣)BLACK CLUB SUIT (present in WGL4 and in Symbol font)
98282664 WHITE SPADE SUIT
98292665♥ (♥)BLACK HEART SUIT (present in WGL4 and in Symbol font)
98302666♦ (♦)BLACK DIAMOND SUIT (present in WGL4 and in Symbol font)
98312667 WHITE CLUB SUIT
98322668 HOT SPRINGS
98332669 QUARTER NOTE
9834266A EIGHTH NOTE (present in WGL4)
9835266B BEAMED EIGHTH NOTES (present in WGL4)
9836266C BEAMED SIXTEENTH NOTES
9837266D MUSIC FLAT SIGN
9838266E MUSIC NATURAL SIGN
9839266F MUSIC SHARP SIGN
98402670 WEST SYRIAC CROSS
98412671 EAST SYRIAC CROSS
98422672 UNIVERSAL RECYCLING SYMBOL
98432673 RECYCLING SYMBOL FOR TYPE-1 PLASTICS
98442674 RECYCLING SYMBOL FOR TYPE-2 PLASTICS
98452675 RECYCLING SYMBOL FOR TYPE-3 PLASTICS
98462676 RECYCLING SYMBOL FOR TYPE-4 PLASTICS
98472677 RECYCLING SYMBOL FOR TYPE-5 PLASTICS
98482678 RECYCLING SYMBOL FOR TYPE-6 PLASTICS
98492679 RECYCLING SYMBOL FOR TYPE-7 PLASTICS
9850267A RECYCLING SYMBOL FOR GENERIC MATERIALS
9851267B BLACK UNIVERSAL RECYCLING SYMBOL
9852267C RECYCLED PAPER SYMBOL
9853267D PARTIALLY-RECYCLED PAPER SYMBOL
9854267E PERMANENT PAPER SIGN
9855267F WHEELCHAIR SYMBOL
98562680 DIE FACE-1
98572681 DIE FACE-2
98582682 DIE FACE-3
98592683 DIE FACE-4
98602684 DIE FACE-5
98612685 DIE FACE-6
98622686 WHITE CIRCLE WITH DOT RIGHT
98632687 WHITE CIRCLE WITH TWO DOTS
98642688 BLACK CIRCLE WITH WHITE DOT RIGHT
98652689 BLACK CIRCLE WITH TWO WHITE DOTS
9866268A MONOGRAM FOR YANG
9867268B MONOGRAM FOR YIN
9868268C DIGRAM FOR GREATER YANG
9869268D DIGRAM FOR LESSER YIN
9870268E DIGRAM FOR LESSER YANG
9871268F DIGRAM FOR GREATER YIN
98722690 WHITE FLAG
98732691 BLACK FLAG
98742692 HAMMER AND PICK
98752693 ANCHOR
98762694 CROSSED SWORDS
98772695 STAFF OF AESCULAPIUS
98782696 SCALES
98792697 ALEMBIC
98802698 FLOWER
98812699 GEAR
9882269A STAFF OF HERMES
9883269B ATOM SYMBOL
9884269C FLEUR-DE-LIS
9885269D OUTLINED WHITE STAR
9886269E THREE LINES CONVERGING RIGHT
9887269F THREE LINES CONVERGING LEFT
988826A0 WARNING SIGN
988926A1 HIGH VOLTAGE SIGN
989026A2 DOUBLED FEMALE SIGN
989126A3 DOUBLED MALE SIGN
989226A4 INTERLOCKED FEMALE AND MALE SIGN
989326A5 MALE AND FEMALE SIGN
989426A6 MALE WITH STROKE SIGN
989526A7 MALE WITH STROKE AND MALE AND FEMALE SIGN
989626A8 VERTICAL MALE WITH STROKE SIGN
989726A9 HORIZONTAL MALE WITH STROKE SIGN
989826AA MEDIUM WHITE CIRCLE
989926AB MEDIUM BLACK CIRCLE
990026AC MEDIUM SMALL WHITE CIRCLE
990126AD MARRIAGE SYMBOL
990226AE DIVORCE SYMBOL
990326AF UNMARRIED PARTNERSHIP SYMBOL
990426B0 COFFIN
990526B1 FUNERAL URN
990626B2 NEUTER
Source!!!

Anthony Lenton: Comenzando las clases

   Publicado:

Comenzando las clases

Anthony Lenton: Aceites SAE

   Publicado:

Aceites SAE

Anthony Lenton: Subirse al caballo.

   Publicado:

Subirse al caballo.

Share