Popular recipes by Itamar Shtull-Trauring http://code.activestate.com/recipes/users/98053/2001-06-18T04:43:33-07:00ActiveState Code RecipesRun a task every few seconds (Python) 2001-06-18T04:31:57-07:00Itamar Shtull-Trauringhttp://code.activestate.com/recipes/users/98053/http://code.activestate.com/recipes/65222-run-a-task-every-few-seconds/ <p style="color: grey"> Python recipe 65222 by <a href="/recipes/users/98053/">Itamar Shtull-Trauring</a> (<a href="/recipes/tags/threads/">threads</a>). </p> <p>The TaskThread class allows you to create threads that execute a specific action at a specified interval, by subclassing - just override the task() method. You can also shutdown a TaskThread without having to wait for it to finish "sleeping" (due to the use of threading.Event objects as an alternative to time.sleep()).</p> Fetch diary entries from Advogato (Python) 2001-06-18T04:43:33-07:00Itamar Shtull-Trauringhttp://code.activestate.com/recipes/users/98053/http://code.activestate.com/recipes/65223-fetch-diary-entries-from-advogato/ <p style="color: grey"> Python recipe 65223 by <a href="/recipes/users/98053/">Itamar Shtull-Trauring</a> (<a href="/recipes/tags/web/">web</a>). </p> <p>Advogato (<a href="http://www.advogato.org" rel="nofollow">http://www.advogato.org</a>) exports members' diaries in a simple XML format. This script fetches the entries and stores them in a dictionary keyed by date. I assume it can also be used with other virgule sites, such as <a href="http:///www.badvogato.org." rel="nofollow">http:///www.badvogato.org.</a></p> Strip tags and Javascript from HTML page, leaving only safe tags (Python) 2001-03-19T12:58:08-08:00Itamar Shtull-Trauringhttp://code.activestate.com/recipes/users/98053/http://code.activestate.com/recipes/52281-strip-tags-and-javascript-from-html-page-leaving-o/ <p style="color: grey"> Python recipe 52281 by <a href="/recipes/users/98053/">Itamar Shtull-Trauring</a> (<a href="/recipes/tags/web/">web</a>). </p> <p>Sometimes we are getting HTML input from the user. We want to only allow valid, undangerous tags, we want all tags to be balanced (i.e. an unclosed &lt;b&gt; will leave all text on your page bold), and we want to strip out all Javascript.</p> <p>This recipe demonstrates how to do this using the sgmllib parser to parse HTML.</p> Print an expression and its value, along with filename and linenumber (Python) 2001-03-18T15:25:13-08:00Itamar Shtull-Trauringhttp://code.activestate.com/recipes/users/98053/http://code.activestate.com/recipes/52278-print-an-expression-and-its-value-along-with-filen/ <p style="color: grey"> Python recipe 52278 by <a href="/recipes/users/98053/">Itamar Shtull-Trauring</a> (<a href="/recipes/tags/debugging/">debugging</a>). </p> <p>The function printexpr() takes a Python expression, and prints it's value, and the filename and line from which printexpr() is called. This is useful when debugging programs. The code is based off a couple of Usenet postings that I merged into one.</p>