Popular Python recipes tagged "control"http://code.activestate.com/recipes/langs/python/tags/control/2016-07-23T22:17:29-07:00ActiveState Code RecipesCreate PDF control break reports with itertools.groupby and xtopdf (Python) 2016-07-23T22:17:29-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580692-create-pdf-control-break-reports-with-itertoolsgro/ <p style="color: grey"> Python recipe 580692 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/control/">control</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/grouping/">grouping</a>, <a href="/recipes/tags/iterators/">iterators</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportgeneration/">reportgeneration</a>, <a href="/recipes/tags/reporting/">reporting</a>, <a href="/recipes/tags/sql/">sql</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to create the classic control break style of report (a staple of data processing) using Python along with the groupby function from the itertools module, and xtopdf, a Python toolkit for PDF creation.</p> Offline Version Control (online with dropbox) (Python) 2013-07-07T15:18:51-07:00commentator8http://code.activestate.com/recipes/users/4182761/http://code.activestate.com/recipes/578592-offline-version-control-online-with-dropbox/ <p style="color: grey"> Python recipe 578592 by <a href="/recipes/users/4182761/">commentator8</a> (<a href="/recipes/tags/control/">control</a>, <a href="/recipes/tags/version/">version</a>). </p> <p>A basic form of version control that when used in combination with dropbox and notepad++ (optional) provides reliable backup with tags of files/folder.</p> <p>Files mode can be used for individual files, in practice i used it with python files primarily. Folder mode allows for backup of folders, especially useful for a class split over various files with __init__.py in root of a folder.</p> Control your mouse with the Microsoft Kinect using OpenKinect (Python) 2012-03-19T21:28:08-07:00Alexander James Wallarhttp://code.activestate.com/recipes/users/4179768/http://code.activestate.com/recipes/578082-control-your-mouse-with-the-microsoft-kinect-using/ <p style="color: grey"> Python recipe 578082 by <a href="/recipes/users/4179768/">Alexander James Wallar</a> (<a href="/recipes/tags/computer/">computer</a>, <a href="/recipes/tags/control/">control</a>, <a href="/recipes/tags/freenect/">freenect</a>, <a href="/recipes/tags/kinect/">kinect</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/microsoft/">microsoft</a>, <a href="/recipes/tags/mouse/">mouse</a>, <a href="/recipes/tags/numpy/">numpy</a>, <a href="/recipes/tags/openkinect/">openkinect</a>, <a href="/recipes/tags/vision/">vision</a>, <a href="/recipes/tags/xlib/">xlib</a>). </p> <p>This is a simple code that uses the Kinect in order to simulate the mouse on the screen. In order for this code to work you must have a Linux machine, the freenect module from OpenKinect, NumPy, and Xlib. The last three can be downloaded and installed by running sudo apt-get install {PROGRAM NAME HERE}. Freenect needs to be downloaded and installed for python using the terminal and there are good instructions here how to do it <a href="http://openkinect.org/wiki/Getting_Started" rel="nofollow">http://openkinect.org/wiki/Getting_Started</a>. You will also need to install the python wrapper. This can be done by following the instructions on this site: <a href="http://openkinect.org/wiki/Python_Wrapper" rel="nofollow">http://openkinect.org/wiki/Python_Wrapper</a>. To run the code you must first cd into the directory in which the code resides and then in the terminal run the command sudo python {THE NAME YOU STORED THE CODE BELOW AS}.py. This should run the code. The code needs superuser privileges. Also if you wonder why the mouse will stop tracking your hand, there are two reasons. 1) This code is not super sophisticated, all it does is find the minimum point in the depth image and scales the coordinates to the size of the screen and moves the mouse there so if your stomach is the closest thing to the screen it will track it and place the mouse there. The other reason the mouse might stop tracking is because there is a counter in the that will only let it run 10000 iterations. This is just a safety precaution in case you are not able to control the mouse and the computer freaks out. The last thing you need to know to run this code is that the main_mouse() function takes to arguments, the first is the x dimension of your screen and the second is the y dimension. THE CODE WILL NOT FUNCTION PROPERLY ON MULTIDISPLAY COMPUTERS. Thank You</p> Minimal Dependency Injection Container (Python) 2010-06-05T13:50:03-07:00Alan Franzonihttp://code.activestate.com/recipes/users/4169882/http://code.activestate.com/recipes/577254-minimal-dependency-injection-container/ <p style="color: grey"> Python recipe 577254 by <a href="/recipes/users/4169882/">Alan Franzoni</a> (<a href="/recipes/tags/container/">container</a>, <a href="/recipes/tags/control/">control</a>, <a href="/recipes/tags/dependency/">dependency</a>, <a href="/recipes/tags/di/">di</a>, <a href="/recipes/tags/dic/">dic</a>, <a href="/recipes/tags/injection/">injection</a>, <a href="/recipes/tags/inversion/">inversion</a>, <a href="/recipes/tags/ioc/">ioc</a>, <a href="/recipes/tags/iocc/">iocc</a>). </p> <p>An example of a minimal dependency injection ( aka Inversion of Control ) container for Python.</p>