Most viewed recipes by Anand http://code.activestate.com/recipes/users/760763/views/2010-03-17T07:27:15-07:00ActiveState Code RecipesChat server & client using select.select (Python) 2007-09-28T08:57:53-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/531824-chat-server-client-using-selectselect/ <p style="color: grey"> Python recipe 531824 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/network/">network</a>). Revision 3. </p> <p>This recipe demos how to write a simple command line chat server &amp; client using multiplexing using select.select. The server uses select call to multiplex multiple clients and the client uses it to multiplex command line &amp; socket I/O.</p> List classes, methods and functions in a module (Python) 2008-10-22T08:15:26-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/553262-list-classes-methods-and-functions-in-a-module/ <p style="color: grey"> Python recipe 553262 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/programs/">programs</a>). Revision 5. </p> <p>The recipe provides a method "describe" which takes a module as argument and describes classes, methods and functions in the module. The method/function description provides information on the function/method arguments using the inspect module.</p> Python text to pdf converter (Python) 2004-02-25T11:45:48-08:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/189858-python-text-to-pdf-converter/ <p style="color: grey"> Python recipe 189858 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/text/">text</a>). Revision 8. </p> <p>Python port of a very popular implementation of text2pdf in the C programming language. I ported this to python because it could be used as a script instead of executable which is the case with the original program. Most of the options remain the same.</p> A python replacement for java.util.Properties (Python) 2006-07-28T08:52:19-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/496795-a-python-replacement-for-javautilproperties/ <p style="color: grey"> Python recipe 496795 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/files/">files</a>). Revision 5. </p> <p>This recipe provides a quick and easy way to process Java properties files using pure Python. Of course, Jython can always be used, but in situations where Jython cannot be used, this recipe provides a sure-fire drop-in replacement. The Properties class is modelled to duplicate the behaviour of the original as closely as possible.</p> Backup your files (Python) 2008-04-08T10:16:26-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/191017-backup-your-files/ <p style="color: grey"> Python recipe 191017 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/files/">files</a>). Revision 5. </p> <p>Makes backup versions of files</p> Python robocopier - Advanced Directory Synchronization module (Python) 2003-12-04T08:04:57-08:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/231501-python-robocopier-advanced-directory-synchronizati/ <p style="color: grey"> Python recipe 231501 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/files/">files</a>). Revision 6. </p> <p>This program is an advanced directory synchronization and update tool. It can be used to update content between two directories, synchronize them, or just report the difference in content between them. It uses the syntax of the 'diff' program in printing the difference.</p> Clean up a directory tree (Python) 2003-04-03T08:06:50-08:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/193736-clean-up-a-directory-tree/ <p style="color: grey"> Python recipe 193736 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>This recipe can be used to clean up a directory tree irrespective of whether the directory tree contains non-empty directories. As long as the user has permission to remove the files, this will work.</p> Simple XML serlializer/de-serializer using Python dictionaries and marshalling (Python) 2005-06-07T09:13:40-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/415983-simple-xml-serlializerde-serializer-using-python-d/ <p style="color: grey"> Python recipe 415983 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/xml/">xml</a>). Revision 2. </p> <p>This recipe presents a way of serializing &amp; de-serializing XML using the marshal module. The XML is converted to an equivalent Python dictionary first, which is marshaled to serialize it. De-serialization first unmarshals the dictionary from the file, and constructs the original XML.</p> Multiple replace in a string (Python) 2003-04-17T09:01:48-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/194373-multiple-replace-in-a-string/ <p style="color: grey"> Python recipe 194373 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>A hack to quickly replace multiple characters/strings in a string with characters from another string.</p> Pretty-print XML (Python) 2009-05-13T07:47:45-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/576750-pretty-print-xml/ <p style="color: grey"> Python recipe 576750 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/xml/">xml</a>). </p> <p>One-liner to pretty print an XML file using xml.dom.minidom.</p> Basic Exception handling idiom using decorators (Python) 2005-04-06T04:25:10-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/408937-basic-exception-handling-idiom-using-decorators/ <p style="color: grey"> Python recipe 408937 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/shortcuts/">shortcuts</a>). Revision 2. </p> <p>A basic exception handling idiom using decorators which allows you to re-use the exception handler for different functions, while customizing your handlers using arguments passed to an exception handling "decorator".</p> Pyscanlogger - Python Port scan detector (Python) 2010-03-17T07:27:15-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/576690-pyscanlogger-python-port-scan-detector/ <p style="color: grey"> Python recipe 576690 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/programs/">programs</a>, <a href="/recipes/tags/security/">security</a>). Revision 5. </p> <p>A pure Python program to detect network port scanning attacks. Currently logs different TCP port scans. Can run in the background like a daemon and log attacks to a log file.</p> Simple File Splitter/Combiner module (Python) 2003-11-06T07:14:42-08:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/224800-simple-file-splittercombiner-module/ <p style="color: grey"> Python recipe 224800 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/files/">files</a>). Revision 4. </p> <p>This module can be used to split any file, text or binary to equal sized chunks. It can also combine the chunks back to recreate the original file.</p> Amaze - An object-oriented maze generator/solver in Python (Python) 2006-07-26T15:04:50-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/496884-amaze-an-object-oriented-maze-generatorsolver-in-p/ <p style="color: grey"> Python recipe 496884 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 10. </p> <p>This is a simple maze generator &amp; solver written in Python. It is written as a game, consisting of classes which can read mazes from STDIN or a file. It provides a a random maze generator game, which can generate mazes of any dimension and solve it. Use it for fun and learning.</p> Twisted XML RPC server with basic HTTP authentication (Python) 2007-08-09T09:48:48-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/526625-twisted-xml-rpc-server-with-basic-http-authenticat/ <p style="color: grey"> Python recipe 526625 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/web/">web</a>). Revision 3. </p> <p>This recipe illustrates an XML RPC server using twisted with support for HTTP basic client authentication.</p> wxPython Graphics - Drawing rubberbands over a canvas (Python) 2003-12-30T05:43:10-08:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/189744-wxpython-graphics-drawing-rubberbands-over-a-canva/ <p style="color: grey"> Python recipe 189744 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/graphics/">graphics</a>). Revision 2. </p> <p>This recipe talks about how to implement rubberbanding code for canvas objects in a wxPython application. Canvas classes in wxPython include wxPanel, wxStaticBitmap, wxGlCanvas etc.</p> Text to PDF Converter (rewrite) (Python) 2007-09-26T13:32:30-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/532908-text-to-pdf-converter-rewrite/ <p style="color: grey"> Python recipe 532908 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/text/">text</a>). Revision 3. </p> <p>This is a rewrite of my text2pdf converter posted as recipe #189858, which can be used to convert pure text files to PDF.</p> A basic time profiler (Python) 2006-08-03T20:39:37-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/496938-a-basic-time-profiler/ <p style="color: grey"> Python recipe 496938 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/shortcuts/">shortcuts</a>). </p> <p>This recipe provides a very simple time profiling module which helps you to measure actual execution time for blocks of Python code without peppering your code with many time.time() statements.</p> Mini-commands using subprocess (Python) 2006-09-26T07:38:58-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/498137-mini-commands-using-subprocess/ <p style="color: grey"> Python recipe 498137 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). Revision 2. </p> <p>A set of template classes which allows to develop custom "mini-command" classes which allow to execute any system command and customize the execution using template strings.</p> Composite design-pattern using dictionaries (Python) 2006-11-07T08:39:25-08:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/498249-composite-design-pattern-using-dictionaries/ <p style="color: grey"> Python recipe 498249 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/oop/">oop</a>). Revision 2. </p> <p>The recipe illustrates the composite design pattern by using hierarchical dictionaries. It can be used to process hierarchical, tree-based data structures using Python dictionaries.</p>