Popular recipes tagged "meta:loc=38"http://code.activestate.com/recipes/tags/meta:loc=38/2016-02-18T17:26:50-08:00ActiveState Code RecipesBatch download all the pinned pictures in your Pinterest board to a local folder (Python) 2016-02-18T17:26:50-08:00Alfred Wanghttp://code.activestate.com/recipes/users/4193275/http://code.activestate.com/recipes/580611-batch-download-all-the-pinned-pictures-in-your-pin/ <p style="color: grey"> Python recipe 580611 by <a href="/recipes/users/4193275/">Alfred Wang</a> (<a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/download/">download</a>, <a href="/recipes/tags/picture/">picture</a>, <a href="/recipes/tags/pinterest/">pinterest</a>). </p> <p>Batch download all the pinned pictures in your Pinterest board to a local folder. Be noted: you have to keep your internet browser signed in your Pinterest account first.</p> Convert Excel to PDF with xlwings and xtopdf (Python) 2015-02-22T10:42:18-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579026-convert-excel-to-pdf-with-xlwings-and-xtopdf/ <p style="color: grey"> Python recipe 579026 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/excel/">excel</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/xlwings/">xlwings</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to get the text content from an Excel file and convert it to PDF, using the xlwings and xtopdf Python libraries. It also shows how to create an Excel file programmatically using xlwings.</p> Animated raster graphics demo in Tkinter (Python) 2015-05-05T20:26:41-07:00Antoni Gualhttp://code.activestate.com/recipes/users/4182514/http://code.activestate.com/recipes/579052-animated-raster-graphics-demo-in-tkinter/ <p style="color: grey"> Python recipe 579052 by <a href="/recipes/users/4182514/">Antoni Gual</a> (<a href="/recipes/tags/animation/">animation</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). Revision 4. </p> <p>EDITED: A small animated graphics demo in Tkinter, displaying a 1990's style Rotozoom, more interesting than the TV snow I posted previously. The Tkinter management part is just the same. The code is a little longer as some trig tables must be precalculated for speed. The window size corresponds to the resolution of the old DOS screen 13, as I originally coded the demo for Qbasic. </p> Topological Sort (Python) 2012-09-27T12:21:23-07:00Sam Dentonhttp://code.activestate.com/recipes/users/4172262/http://code.activestate.com/recipes/578272-topological-sort/ <p style="color: grey"> Python recipe 578272 by <a href="/recipes/users/4172262/">Sam Denton</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/sort/">sort</a>, <a href="/recipes/tags/sorting/">sorting</a>, <a href="/recipes/tags/topological/">topological</a>, <a href="/recipes/tags/toposort/">toposort</a>). </p> <p>A topological sort (sometimes abbreviated topsort or toposort) or topological ordering of a directed graph is a linear ordering of its vertices such that, for every edge uv, u comes before v in the ordering. For instance, the vertices of the graph may represent tasks to be performed, and the edges may represent constraints that one task must be performed before another; in this application, a topological ordering is just a valid sequence for the tasks. A topological ordering is possible if and only if the graph has no directed cycles, that is, if it is a directed acyclic graph (DAG).</p> longest common substring (Python) 2013-03-05T19:22:31-08:00yotahttp://code.activestate.com/recipes/users/4184815/http://code.activestate.com/recipes/578465-longest-common-substring/ <p style="color: grey"> Python recipe 578465 by <a href="/recipes/users/4184815/">yota</a> (<a href="/recipes/tags/longest_common_substring/">longest_common_substring</a>). Revision 4. </p> <p>Return, more than the substring itself, the position of the said substring, relative to each string passed in parameter.</p> <p>String is a generic term. Here, it is an array, any object with __getitem__() method should work.</p> Engineering notation. (Python) 2012-08-08T23:32:51-07:00Yannig Roberthttp://code.activestate.com/recipes/users/4183149/http://code.activestate.com/recipes/578238-engineering-notation/ <p style="color: grey"> Python recipe 578238 by <a href="/recipes/users/4183149/">Yannig Robert</a> (<a href="/recipes/tags/engineering/">engineering</a>, <a href="/recipes/tags/ipython/">ipython</a>). </p> <p>eng(x) returns a string representing x using the "engineering notation"</p> Komodo JS Macro - Add CSS3 Prefixes (JavaScript) 2012-05-25T20:02:50-07:00Keegan Brownhttp://code.activestate.com/recipes/users/4182206/http://code.activestate.com/recipes/578145-komodo-js-macro-add-css3-prefixes/ <p style="color: grey"> JavaScript recipe 578145 by <a href="/recipes/users/4182206/">Keegan Brown</a> (<a href="/recipes/tags/css/">css</a>, <a href="/recipes/tags/macro/">macro</a>). </p> <p>Simple macro to add vendor prefixes to a CSS declaration under the cursor. Isn't smart and doesn't know what needs a prefix and what doesn't, just adds all the prefixes. </p> Geocoding Lists via Google Maps (Python) 2012-05-11T05:06:27-07:00Mano Bastardohttp://code.activestate.com/recipes/users/4182040/http://code.activestate.com/recipes/578126-geocoding-lists-via-google-maps/ <p style="color: grey"> Python recipe 578126 by <a href="/recipes/users/4182040/">Mano Bastardo</a> (<a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/coordinates/">coordinates</a>, <a href="/recipes/tags/geocode/">geocode</a>, <a href="/recipes/tags/geocoding/">geocoding</a>, <a href="/recipes/tags/google/">google</a>, <a href="/recipes/tags/google_maps/">google_maps</a>, <a href="/recipes/tags/lat/">lat</a>, <a href="/recipes/tags/latitude/">latitude</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/list_comprehension/">list_comprehension</a>, <a href="/recipes/tags/lng/">lng</a>, <a href="/recipes/tags/longitude/">longitude</a>, <a href="/recipes/tags/map/">map</a>, <a href="/recipes/tags/web/">web</a>). Revision 2. </p> <p>A simple script written as an experiment in geocoding addresses in a database. A list of addresses in the form of "100 Any Street, Anytown, CA, 10010" is passed to a Google Maps URL, and the latitude/longitude coordinates are extracted from the returned XML.</p> <p>XML methods are not used in this script, but simple string searches instead.</p> Dragon Fractal Using Iteration Method (Python) 2012-01-07T05:31:10-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/578002-dragon-fractal-using-iteration-method/ <p style="color: grey"> Python recipe 578002 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>). </p> <p>This method uses inverse IFS transformations and it does not use a random number generator.</p> Python Enum and/or named-integer class (Python) 2011-11-29T10:04:41-08:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577921-python-enum-andor-named-integer-class/ <p style="color: grey"> Python recipe 577921 by <a href="/recipes/users/4172291/">Graham Poulter</a> (<a href="/recipes/tags/enum/">enum</a>). Revision 6. </p> <p>Recipe for Python Enum class that builds on the "FOO = 1" pattern by adding a printable name. </p> <p>In other words, an Enum instance is a named integer.</p> Apply decorators to all functions in a module (Python) 2011-06-09T22:51:28-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/577742-apply-decorators-to-all-functions-in-a-module/ <p style="color: grey"> Python recipe 577742 by <a href="/recipes/users/4177816/">Eric Snow</a> (<a href="/recipes/tags/decorators/">decorators</a>, <a href="/recipes/tags/import/">import</a>, <a href="/recipes/tags/modules/">modules</a>). Revision 2. </p> <p>Use my modulehacker recipe (<a href="http://code.activestate.com/recipes/577740/">recipe 577740</a>) to apply decorators to any number of modules, or even (nearly) all of them.</p> Export Oracle Database to CSV using cx_Oracle (Python) 2010-07-11T19:49:42-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577304-export-oracle-database-to-csv-using-cx_oracle/ <p style="color: grey"> Python recipe 577304 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/csv/">csv</a>, <a href="/recipes/tags/database/">database</a>). </p> <p>Creates a CSV file for each table in the target Oracle database.</p> Recursive Functional State Machine (Python) 2011-05-20T13:46:48-07:00Stefan Tunschhttp://code.activestate.com/recipes/users/4178042/http://code.activestate.com/recipes/577709-recursive-functional-state-machine/ <p style="color: grey"> Python recipe 577709 by <a href="/recipes/users/4178042/">Stefan Tunsch</a> (<a href="/recipes/tags/functional/">functional</a>, <a href="/recipes/tags/recursion/">recursion</a>, <a href="/recipes/tags/state_machine/">state_machine</a>). </p> <p>This is a simple state machine that takes a functional approach. It requires trampoline from pysistence.func to avoid the recursion limit.</p> <p>Namedtuples are used to define the different states. globals() is used to reference the states. (This could also be done putting states into a separate module and getting them through getattr.)</p> <p>In this recipe the functions called in the different states need to return a boolean, which defines the success or failure event.</p> Validate ABNs (Australian Business Numbers) (Python) 2011-05-13T03:22:12-07:00Steven D'Apranohttp://code.activestate.com/recipes/users/4172944/http://code.activestate.com/recipes/577692-validate-abns-australian-business-numbers/ <p style="color: grey"> Python recipe 577692 by <a href="/recipes/users/4172944/">Steven D'Aprano</a> (<a href="/recipes/tags/abn/">abn</a>, <a href="/recipes/tags/validation/">validation</a>). </p> <p>This is a validation function for Australian Business Numbers (ABNs). It tests whether an integer or string is a valid ABN (but not whether it is a <em>legal</em> ABN, i.e. if it belongs to the person or business entity that is quoting it).</p> Manage environment variables on Windows (Python) 2011-03-31T18:27:57-07:00Sridhar Ratnakumarhttp://code.activestate.com/recipes/users/4169511/http://code.activestate.com/recipes/577621-manage-environment-variables-on-windows/ <p style="color: grey"> Python recipe 577621 by <a href="/recipes/users/4169511/">Sridhar Ratnakumar</a> (<a href="/recipes/tags/environment/">environment</a>, <a href="/recipes/tags/pywin32/">pywin32</a>, <a href="/recipes/tags/windows/">windows</a>). Revision 7. </p> <p>This recipe facilitates getting and setting of both "user" and "system" environment variables on Windows. It uses PyWin32 (included in ActivePython) ... and works on both Python 2 and Python 3.</p> Get columns of data from text files (Python) 2010-10-28T16:18:19-07:00aliniumhttp://code.activestate.com/recipes/users/4175605/http://code.activestate.com/recipes/577444-get-columns-of-data-from-text-files/ <p style="color: grey"> Python recipe 577444 by <a href="/recipes/users/4175605/">alinium</a> (<a href="/recipes/tags/columns/">columns</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/parsing/">parsing</a>). </p> <p>Read in a tab-delimited (or any separator-delimited like CSV) file and store each column in a list that can be referenced from a dictionary. The keys for the dictionary are the headings for the columns (if any). All data is read in as strings.</p> Feigenbaum constant calculation (Python) 2010-11-16T06:00:51-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577464-feigenbaum-constant-calculation/ <p style="color: grey"> Python recipe 577464 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>). </p> <p>Feigenbaum constant calculation.</p> <p>For more info:</p> <p><a href="http://en.wikipedia.org/wiki/Feigenbaum_constant" rel="nofollow">http://en.wikipedia.org/wiki/Feigenbaum_constant</a></p> Area Under the Curve using Monte Carlo method (Python) 2010-06-17T03:54:27-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577262-area-under-the-curve-using-monte-carlo-method/ <p style="color: grey"> Python recipe 577262 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/random/">random</a>). Revision 5. </p> <p>Calculating area under the curve using Monte Carlo method for any given function.</p> Numerical Integration using Monte Carlo method (Python) 2010-06-16T19:31:17-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577263-numerical-integration-using-monte-carlo-method/ <p style="color: grey"> Python recipe 577263 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/random/">random</a>). Revision 2. </p> <p>Numerical Integration using Monte Carlo method.</p> Locate thumbnail file (Python) 2009-11-02T06:22:33-08:00Rajahttp://code.activestate.com/recipes/users/4172172/http://code.activestate.com/recipes/576942-locate-thumbnail-file/ <p style="color: grey"> Python recipe 576942 by <a href="/recipes/users/4172172/">Raja</a> (<a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/thumbnail/">thumbnail</a>). Revision 2. </p> <p>On unix systems following the free desktop standards, locate the thumbnail image for any file, if present. Needs Python 2.5.</p>