Popular recipes tagged "encode" but not "demo"http://code.activestate.com/recipes/tags/encode-demo/2013-10-24T11:31:44-07:00ActiveState Code Recipesdynamically changing encoder (for json) with metaclass (class factory) (Python) 2013-10-24T11:31:44-07:00-http://code.activestate.com/recipes/users/4188267/http://code.activestate.com/recipes/578696-dynamically-changing-encoder-for-json-with-metacla/ <p style="color: grey"> Python recipe 578696 by <a href="/recipes/users/4188267/">-</a> (<a href="/recipes/tags/class_factory/">class_factory</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/json/">json</a>, <a href="/recipes/tags/metaclass/">metaclass</a>, <a href="/recipes/tags/metaclasses/">metaclasses</a>). </p> <p>The <em>json.dumps</em> need to be feed with some class (cls =someClass) but what if we want to change the class dynamically? This example can be done by declaring the <em>listOfClasses</em> in class level of course, but the idea is to be changeable. This can be done by the class factory function <em>encoderFacory</em></p> Perl URL encode and decode (Perl) 2010-11-02T17:52:46-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577450-perl-url-encode-and-decode/ <p style="color: grey"> Perl recipe 577450 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/decode/">decode</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/url/">url</a>). </p> <p>URL encode and decode functions for Perl.</p> Novel JavaScript Text Compressor (JavaScript) 2011-01-31T15:41:36-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577557-novel-javascript-text-compressor/ <p style="color: grey"> JavaScript recipe 577557 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/compression/">compression</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/encryption/">encryption</a>). </p> <p>Compression, encryption, and data codecs are all related fields that most programmers will use ready-made solutions for. This recipe is a shallow adventure into the writing of original code and algorithms that explores a combination of those topics. Based on the work of <a href="http://code.activestate.com/recipes/577433/">recipe 577433</a>, the code here is compliant with JavaScript and will run a test of itself when executed. From the program's report, one can gather that the novel procedures compress the source and accurately decompress it again. For those who wish to experiment further with the concept, note that fewer unique characters will yield higher compression ratios.</p> <p>To get a copy of <em>biginteger.js</em> for the program to run and compression algorithm to operator, please go to <a href="http://silentmatt.com/biginteger/" rel="nofollow">http://silentmatt.com/biginteger/</a> and use the latest version of Matthew Crumley's excellent JavaScript big integer library.</p> Text Compressor 3.1 (Python) 2010-10-20T00:50:15-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577433-text-compressor-31/ <p style="color: grey"> Python recipe 577433 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/compression/">compression</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/encryption/">encryption</a>). </p> <p>Compression, encryption, and data codecs are all related fields that most programmers will use ready-made solutions for. This recipe is a shallow adventure into the writing of original code and algorithms that explores a combination of those topics. Based on the work of <a href="http://code.activestate.com/recipes/502202/">recipe 502202</a>, the code here is compliant with Python 3.1 and will run a test of itself when executed. From the program's report, one can gather that the novel procedures compress the source and accurately decompress it again. For those who wish to experiment further with the concept, note that fewer unique characters will yield higher compression ratios.</p> Rot13 Quine (Python) 2009-04-22T10:05:34-07:00Daniel Lepagehttp://code.activestate.com/recipes/users/4160089/http://code.activestate.com/recipes/576724-rot13-quine/ <p style="color: grey"> Python recipe 576724 by <a href="/recipes/users/4160089/">Daniel Lepage</a> (<a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/quine/">quine</a>). </p> <p>A Quine is a program that, when run, prints its own source code (without resorting to easy solutions like reading its code from the filesystem). The rot13 encoding maps every letter 13 places forwards in the alphabet (wrapping around the end and preserving case). Just for fun, I wrote a quine in the rot13 encoding.</p> safe print (Python) 2009-01-02T15:40:30-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/576602-safe-print/ <p style="color: grey"> Python recipe 576602 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/safe/">safe</a>, <a href="/recipes/tags/unicode/">unicode</a>). </p> <p>A replacement for "print" that will safely handle unicode conversion.</p>