Popular recipes tagged "meta:loc=180"http://code.activestate.com/recipes/tags/meta:loc=180/2016-04-08T01:42:01-07:00ActiveState Code RecipesProjectile Motion (Python) 2016-04-08T01:42:01-07:00Tage Burnetthttp://code.activestate.com/recipes/users/4193902/http://code.activestate.com/recipes/580638-projectile-motion/ <p style="color: grey"> Python recipe 580638 by <a href="/recipes/users/4193902/">Tage Burnett</a> (<a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/physics/">physics</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>This program calculates the characteristics of a projectile in a vacuum at several different locations in our solar system.</p> SystemMutex (Python) 2015-01-09T10:14:15-08:00Fabio Zadroznyhttp://code.activestate.com/recipes/users/4180406/http://code.activestate.com/recipes/578998-systemmutex/ <p style="color: grey"> Python recipe 578998 by <a href="/recipes/users/4180406/">Fabio Zadrozny</a> (<a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/filelock/">filelock</a>, <a href="/recipes/tags/lock/">lock</a>, <a href="/recipes/tags/mutex/">mutex</a>). </p> <p>This module provides a way to create a mutex which is valid for the system (i.e.: it can be seen by multiple processes).</p> <p>Note that the mutex is kept until release_mutex() is called or when it's garbage-collected.</p> Proof-of-concept for a more space-efficient, faster-looping dictionary (Python) 2013-01-17T09:28:24-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/578375-proof-of-concept-for-a-more-space-efficient-faster/ <p style="color: grey"> Python recipe 578375 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/compact/">compact</a>, <a href="/recipes/tags/dictionary/">dictionary</a>). Revision 20. </p> <p>Save space and improve iteration speed by moving the hash/key/value entries to a densely packed array keeping only a sparse array of indices. This eliminates wasted space without requiring any algorithmic changes.</p> POSIX Semaphore (FreeBSD) (Python) 2011-04-14T17:54:16-07:00David Naylorhttp://code.activestate.com/recipes/users/4177661/http://code.activestate.com/recipes/577655-posix-semaphore-freebsd/ <p style="color: grey"> Python recipe 577655 by <a href="/recipes/users/4177661/">David Naylor</a> (<a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/freebsd/">freebsd</a>, <a href="/recipes/tags/semaphores/">semaphores</a>, <a href="/recipes/tags/signal/">signal</a>, <a href="/recipes/tags/threads/">threads</a>). </p> <p>POSIX Semaphore bindings for FreeBSD. </p> Perl Script to obtain data file in a desired format (Perl) 2011-02-19T23:18:01-08:00ilon asolothttp://code.activestate.com/recipes/users/4177080/http://code.activestate.com/recipes/577582-perl-script-to-obtain-data-file-in-a-desired-forma/ <p style="color: grey"> Perl recipe 577582 by <a href="/recipes/users/4177080/">ilon asolot</a> . </p> <p>This discusses about using Perl, how we can obtain a data file in a particular desired format, given a data file in a random format. By format, we refer to the order of columns in the input data file. Using this Perl script, we obtain output data file in a particular format and we get another file having discarded data lines, based on some filtering condition.</p> Starting several context managers concurrently (Python) 2010-08-11T14:27:01-07:00Carlos Valientehttp://code.activestate.com/recipes/users/4174637/http://code.activestate.com/recipes/577352-starting-several-context-managers-concurrently/ <p style="color: grey"> Python recipe 577352 by <a href="/recipes/users/4174637/">Carlos Valiente</a> . </p> <p>This recipe implements the <code>parallel</code> context manager, which executes the <code>__enter__</code> and <code>__exit__</code> method of its arguments concurrently.</p> Perl Script to obtain data file in a desired format (Perl) 2007-03-11T07:30:50-07:00Rajkumar Jainhttp://code.activestate.com/recipes/users/4040865/http://code.activestate.com/recipes/502298-perl-script-to-obtain-data-file-in-a-desired-forma/ <p style="color: grey"> Perl recipe 502298 by <a href="/recipes/users/4040865/">Rajkumar Jain</a> . </p> <p>This discusses about using Perl, how we can obtain a data file in a particular desired format, given a data file in a random format. By format, we refer to the order of columns in the input data file. Using this Perl script, we obtain output data file in a particular format and we get another file having discarded data lines, based on some filtering condition.</p> Decorator for BindingConstants at compile time (Python) 2010-11-16T08:36:38-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/277940-decorator-for-bindingconstants-at-compile-time/ <p style="color: grey"> Python recipe 277940 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/programs/">programs</a>). Revision 9. </p> <p>Decorator for automatic code optimization. If a global is known at compile time, replace it with a constant. Fold tuples of constants into a single constant. Fold constant attribute lookups into a single constant.</p> Quantum Superposition (Python) 2003-11-14T18:13:04-08:00Stephan Diehlhttp://code.activestate.com/recipes/users/774251/http://code.activestate.com/recipes/252125-quantum-superposition/ <p style="color: grey"> Python recipe 252125 by <a href="/recipes/users/774251/">Stephan Diehl</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>This lets treat you a python sets.Set as a scalar (number,string,...) The german linux magazine featured an article about the PERL module "Quantum::Superpositions": <a href="http://www.linux-magazin.de/Artikel/ausgabe/2003/12/perl/perl.html" rel="nofollow">http://www.linux-magazin.de/Artikel/ausgabe/2003/12/perl/perl.html</a> This sounded like fun and I implemented it in Python (probably not everything). Perl code lines: over 700 Python code lines: 100</p>