Latest recipes tagged "framework"http://code.activestate.com/recipes/tags/framework/new/2015-06-30T03:24:07-07:00ActiveState Code RecipesConsumer Application Skeleton (Python) 2015-06-30T03:24:07-07:00Vovanhttp://code.activestate.com/recipes/users/4192447/http://code.activestate.com/recipes/579074-consumer-application-skeleton/ <p style="color: grey"> Python recipe 579074 by <a href="/recipes/users/4192447/">Vovan</a> (<a href="/recipes/tags/application/">application</a>, <a href="/recipes/tags/consumer/">consumer</a>, <a href="/recipes/tags/daemon/">daemon</a>, <a href="/recipes/tags/framework/">framework</a>). Revision 2. </p> <h4 id="consumer-application-skeleton">Consumer Application Skeleton</h4> <p>This is very basic skeleton for data processing application implementing consumer pattern:</p> <pre class="prettyprint"><code>while is_running(): task = get_next_task_from_queue() if task: submit_task_for_processing(task) else: sleep_for_a_moment() </code></pre> <p>Here's an example:</p> <pre class="prettyprint"><code>class ExampleApp(ConsumerAppBase): def _get_next_task(self): # Get next task from the queue. return self._queue.next() def _run_task(self, task): # This code's being executed in separate worker thread of # ThreadPoolExecutor return task / 2 def _on_task_done(self, task, future): # Once worker thread finished - task results are available # in _on_task_done() callback as a concurrent.futures.Future object. self._log.info('Task done. Result: %s', future.result()) </code></pre> A small python script to detect .net framwork versions installed on your local windows machine (Python) 2012-05-23T15:33:13-07:00Yong Zhaohttp://code.activestate.com/recipes/users/4182173/http://code.activestate.com/recipes/578143-a-small-python-script-to-detect-net-framwork-versi/ <p style="color: grey"> Python recipe 578143 by <a href="/recipes/users/4182173/">Yong Zhao</a> (<a href="/recipes/tags/dotnet/">dotnet</a>, <a href="/recipes/tags/framework/">framework</a>, <a href="/recipes/tags/python_scripts/">python_scripts</a>, <a href="/recipes/tags/windows_registry/">windows_registry</a>, <a href="/recipes/tags/_winreg/">_winreg</a>). </p> <p>This small script uses the _winreg module to find out the .net framwork versions installed on your local machine. tested using IronPython 2.7.1.</p> processing (Python) 2012-01-09T02:23:35-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578004-processing/ <p style="color: grey"> Python recipe 578004 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/experiment/">experiment</a>, <a href="/recipes/tags/framework/">framework</a>, <a href="/recipes/tags/gui/">gui</a>). </p> <p>This module was inspired by <a href="http://processing.org/" rel="nofollow">http://processing.org/</a> . The code is meant to mimic an extremely small subset of this high-performance library. After seeing how easy it was to accomplish certain task in the Java framework, a desire was created to have a simple starting point to create little graphical experiments that would be easy to program without haveing to know a lot of details regarding setup, timing, et cetera. This is the result of that desire.</p> Attribute-based Framework 2: Notifications (Python) 2010-07-23T20:12:10-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577330-attribute-based-framework-2-notifications/ <p style="color: grey"> Python recipe 577330 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/framework/">framework</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/simulation/">simulation</a>). Revision 2. </p> <p>I am adapting Prof. David Cheriton's OO software methodology to Python. It's an approach for building industrial-strength code with a disciplined architecture, consistent naming conventions, and a rigorous division of interface from implementation. I'll be adding more of his techniques in further recipes. These recipes are based on Cheriton's CS249a course at Stanford.</p> Attribute-based Framework 1: Basics (Python) 2010-07-21T21:40:54-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577327-attribute-based-framework-1-basics/ <p style="color: grey"> Python recipe 577327 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/educational/">educational</a>, <a href="/recipes/tags/framework/">framework</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/simulation/">simulation</a>). Revision 2. </p> <p>I am adapting Prof. David Cheriton's OO software methodology to Python. It's an approach for building industrial-strength code with a disciplined architecture, consistent naming conventions, and a rigorous division of interface from implementation. I'll be adding more of his techniques in further recipes. These recipes are based on Cheriton's CS249a course at Stanford.</p>