background preloader

Popular Python recipes

A jQuery inline form validation, because validation is a mess « When it comes to form validation, it’s hard to have a versatile solution that works with every form. Figuring out how to display errors is not a simple task. This is something I tried to remedy with this script. Download the source code View demo Validations range from email, phone, url to more complex calls such as ajax processing. **Important**: v2 is a significant rewrite of the original 1.7 branch. Legacy 1.7 documentation and download can be found under package when you hit download on github Installation 1. Running the Demos Most demos are functional by opening their respective HTML file. 1. References First link jQuery to the page Attach *jquery.validationEngine* and its locale Finally link the desired theme Field validations Validations are defined using the field’s **class** attribute. For more details about validators, please refer to the section below. Instantiation The validator is typically instantiated by using a call of the following form: Actions init validate hide hideAll Options Ajax

Python - Notes Python Programming Language – Official Website PyQt4 tutorial This is PyQt4 tutorial. The tutorial is suited for beginners and intermediate programmers. After reading this tutorial, you will be able to program non trivial PyQt4 applications. PyQt5 tutorial is the successor of this tutorial. Table of contents E-book A unique e-book covering advanced features of the PyQt4 library: Advanced PyQt4 tutorial. Related tutorials To refresh your knowledge of the Python language there is a Python tutorial on ZetCode. wxPython tutorial, PyGTK tutorial and Tkinter tutorial are tutorials for other popular Python GUI bindings. Dive Into Python jQuery forms, 100 best 5 years ago, web developers and most programmers were forced to do tons of things in order to program accordingly a website, from the basic layout to defining all the different variables and actions that give life to the site. Developers often utilized JavaScript in some part of the process to facilitate the construction of many different webpages; though JS definitely helped out developers, there were still a lot of things that made them consume dozens of time and achieve minimal results. But since the debut of the powerful framework jQuery, things changed forever. jQuery can be used for many things, from developing fancy animations to simply spice up ordinary designs that were previously difficult to do. jQuery was created with the specific purpose of enhance the standard JavaScript faculties and help designers and developers generate prettier interfaces and web elements without spending hours working with code. Our top selection jFormer – Added April 29 / 2011 Niceforms FormBox SheepIt!

Hidden features of Python Charming Python: Using state machines What is Python? Python is a free, high-level, interpreted language developed by Guido van Rossum. It combines a clear syntax with powerful (but optional) object-oriented semantics. Python is widely available and highly portable. Back to top What is a state machine? An overly accurate description of a state machine is that it is a directed graph, consisting of a set of nodes and a corresponding set of transition functions. But an abstract mathematical description (like the one I just gave) does not really illustrate what use a state machine might serve in practical programming problems. Let's try using an example more appropriate to the actual task at hand. Following this example, let's look at a practical heuristic definition of a state machine. The state machines discussed in this article are high-level machines intended to demonstrate a programming solution to a class of problems. A text-processing state machine myObject = SomeClass(this, that, other) When not to use a state machine

Writing a Package in Python Home by Tarek Ziadé Intents of this article are: To shorten the time needed to set up everything before starting the real work, in other words the boiler-plate codeTo provide a standardized way to write packagesTo ease the use of a test-driven development approachTo facilitate the releasing process It is organized in the following four parts: A common pattern for all packages that describes the similarities between all Python packages, and how distutils and setuptools play a central role How generative programming ( can help this through the template-based approach The package template creation, where everything needed to work is setSetting up a development cycle A Common Pattern for All Packages The easiest way to organize the code of an application is to split it into several packages using eggs. Applications for a given company can have a set of eggs glued together with a master egg. setup.py, the Script That Controls Everything sdist test

Python for Software Design: How to Think Like a Computer Scientist How to Think Like a Computer Scientist by Allen B. Downey This is the first edition of Think Python. Buy this book at Amazon.com Download Think Python in PDF. Read Think Python in HTML. Example programs and solutions to some problems are here (links to specific examples are in the book). Description Think Python is an introduction to Python programming for beginners. Some examples and exercises are based on Swampy, a Python package written by the author to demonstrate aspects of software design, and to give readers a chance to experiment with simple graphics and animation. Think Python is a Free Book. If you have comments, corrections or suggestions, please send me email at feedback{at}thinkpython{dot}com. Other Free Books by Allen Downey are available from Green Tea Press. Download Precompiled copies of the book are available in PDF. Python 3.0 Most of the book works for Python 2.x and 3.0. Michael Kart at St. Earlier Versions Translations and adaptations

WebFrameworks A Web framework is a collection of packages or modules which allow developers to write Web applications (see WebApplications) or services without having to handle such low-level details as protocols, sockets or process/thread management. The majority of Web frameworks are exclusively server-side technology, although, with the increased prevalence of AJAX, some Web frameworks are beginning to include AJAX code that helps developers with the particularly tricky task of programming (client-side) the user's browser. At the extreme end of the client-side Web Frameworks is technology that can use the web browser as a full-blown application execution environment (a la gmail for example): see Web Browser Programming for details. Generally, frameworks provide support for a number of activities such as interpreting requests (getting form parameters, handling cookies and sessions), producing responses (presenting data as HTML or in other formats), storing data persistently, and so on.

Package Index : Isomyr 0.1 A Python Isometric Game Engine. <><> I S O M Y R <> A Python Isometric Game Engine i-so-myr: (n) Any of one or more scenes with the same measurements in foreground and background, that have different properties and can exist in any of several game worlds for a measurable period of time. Isomyr is an isometric game engine based on Pygame, and written in Python. Actors: used for player and monster game objects. Development If you want to develop for txSpore or use the latest code we're working on, you can install from the sources. $ bzr branch lp:isomyr $ cd isomyr $ sudo python setup.py install Easy Install You can use the setuptools easy_install script to get txSpore on your system: $ sudo easy_install Isomyr Manual Download You can manually download the source tarball from the Python Package Index by visiting the following URL: You'll need to untar and gunzip the source, cd into the source directory, and then you can do the usual: $ sudo python setup.py install

Related: