<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments for Evan Fosmark</title>
	<atom:link href="http://www.evanfosmark.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evanfosmark.com</link>
	<description>Hopefully I'll write a new post soon.</description>
	<pubDate>Thu, 11 Mar 2010 10:49:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>Comment on Cross-platform file locking support in Python by Vinay Sajip</title>
		<link>http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/#comment-4127</link>
		<dc:creator>Vinay Sajip</dc:creator>
		<pubDate>Sat, 20 Feb 2010 08:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=47#comment-4127</guid>
		<description>@John Giotta: There's a simpler version of this which I wrote back in 2007, which works on older Pythons but has no bells/whistles/context manager. See here: http://code.activestate.com/recipes/519626-simple-file-based-mutex-for-very-basic-ipc/

Note that it writes the PID of the locking process to the file, so you can see who's got it (and this also allows cleanup - e.g. if there's no such process).</description>
		<content:encoded><![CDATA[<p>@John Giotta: There&#039;s a simpler version of this which I wrote back in 2007, which works on older Pythons but has no bells/whistles/context manager. See here: <a href="http://code.activestate.com/recipes/519626-simple-file-based-mutex-for-very-basic-ipc/" rel="nofollow">http://code.activestate.com/recipes/519626-simple-file-based-mutex-for-very-basic-ipc/</a></p>
<p>Note that it writes the PID of the locking process to the file, so you can see who&#039;s got it (and this also allows cleanup - e.g. if there&#039;s no such process).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Why do so many websites fail with password restrictions? by Stephen P. Schaefer</title>
		<link>http://www.evanfosmark.com/2009/06/why-do-so-many-websites-fail-with-password-restrictions/#comment-3954</link>
		<dc:creator>Stephen P. Schaefer</dc:creator>
		<pubDate>Wed, 10 Feb 2010 02:28:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=59#comment-3954</guid>
		<description>The actual reason is simple: too many programmers are incapable of guaranteeing that their data won't get evaluated at some point, e.g., in a regular expression match.  I've seen code like (perl)

$test=qr/something $password something/;
if (grep { /$test/; } @bad_passwords) { ... }

What if $password was (?{`rm -rf /`})

(If this site goes down after this comment, I'll know why...&#62;:-})

It's not just perl.  I could pull that stunt in nearly any language.

They're not sure of their own code and they don't trust their libraries.  Of course that means that their code and their libraries are incompetent, but that's not so unusual.</description>
		<content:encoded><![CDATA[<p>The actual reason is simple: too many programmers are incapable of guaranteeing that their data won&#039;t get evaluated at some point, e.g., in a regular expression match.  I&#039;ve seen code like (perl)</p>
<p>$test=qr/something $password something/;<br />
if (grep { /$test/; } @bad_passwords) { &#8230; }</p>
<p>What if $password was (?{`rm -rf /`})</p>
<p>(If this site goes down after this comment, I&#039;ll know why&#8230;&gt;:-})</p>
<p>It&#039;s not just perl.  I could pull that stunt in nearly any language.</p>
<p>They&#039;re not sure of their own code and they don&#039;t trust their libraries.  Of course that means that their code and their libraries are incompetent, but that&#039;s not so unusual.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on rot13 in Python 3.x by iDontGiveMyNameToRandomSitesOnTheInternet</title>
		<link>http://www.evanfosmark.com/2009/01/rot13-in-python-30/#comment-3949</link>
		<dc:creator>iDontGiveMyNameToRandomSitesOnTheInternet</dc:creator>
		<pubDate>Tue, 09 Feb 2010 19:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/2009/01/rot13-in-python-30/#comment-3949</guid>
		<description>The simplest way to do this would probably be:

import codecs
codecs.encode("text to be rot13()'ed", "rot13")</description>
		<content:encoded><![CDATA[<p>The simplest way to do this would probably be:</p>
<p>import codecs<br />
codecs.encode(&#034;text to be rot13()&#039;ed&#034;, &#034;rot13&#034;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Why do so many websites fail with password restrictions? by Peter Hickman</title>
		<link>http://www.evanfosmark.com/2009/06/why-do-so-many-websites-fail-with-password-restrictions/#comment-3945</link>
		<dc:creator>Peter Hickman</dc:creator>
		<pubDate>Tue, 09 Feb 2010 15:57:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=59#comment-3945</guid>
		<description>It depends on where you are. I can enter a euro symbol as part of my password because I have a european keyboard then when I go to America I will probably not be able to enter my password on a US keyboard. So limiting you to those characters that you probably enter from any keyboard in the world, remember its not just finding it on the keyboard its also the encoding, then it would be a good thing.

I'm not saying that this is the reason why, but it sounds good :)</description>
		<content:encoded><![CDATA[<p>It depends on where you are. I can enter a euro symbol as part of my password because I have a european keyboard then when I go to America I will probably not be able to enter my password on a US keyboard. So limiting you to those characters that you probably enter from any keyboard in the world, remember its not just finding it on the keyboard its also the encoding, then it would be a good thing.</p>
<p>I&#039;m not saying that this is the reason why, but it sounds good :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cross-platform file locking support in Python by Matt Chaput</title>
		<link>http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/#comment-3770</link>
		<dc:creator>Matt Chaput</dc:creator>
		<pubDate>Fri, 29 Jan 2010 21:41:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=47#comment-3770</guid>
		<description>This (and directory creation, which is also atomic and IMHO makes for clearer code) will leave behind a stale lock file/directory if your code doesn't delete it (e.g. if you get an error and the process quits), preventing anyone else from locking the resource until you clean it up manually.</description>
		<content:encoded><![CDATA[<p>This (and directory creation, which is also atomic and IMHO makes for clearer code) will leave behind a stale lock file/directory if your code doesn&#039;t delete it (e.g. if you get an error and the process quits), preventing anyone else from locking the resource until you clean it up manually.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating fake words: a pseudoword generator by emmanuel</title>
		<link>http://www.evanfosmark.com/2009/07/creating-fake-words/#comment-3318</link>
		<dc:creator>emmanuel</dc:creator>
		<pubDate>Sun, 27 Dec 2009 23:07:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=61#comment-3318</guid>
		<description>Take a look at http://crr.ugent.be/Wuggy. This is a pseudoword generator creating very nice pseudowords for different languages. It's written entirely in Python (and with a WxPython interface).</description>
		<content:encoded><![CDATA[<p>Take a look at <a href="http://crr.ugent.be/Wuggy" rel="nofollow">http://crr.ugent.be/Wuggy</a>. This is a pseudoword generator creating very nice pseudowords for different languages. It&#039;s written entirely in Python (and with a WxPython interface).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Markov Chains and how to use them by Evan</title>
		<link>http://www.evanfosmark.com/2009/11/python-markov-chains-and-how-to-use-them/#comment-2817</link>
		<dc:creator>Evan</dc:creator>
		<pubDate>Wed, 11 Nov 2009 04:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=67#comment-2817</guid>
		<description>@Guillaume,

For some reason, Akismet flagged your comments. I've re-instated them now.</description>
		<content:encoded><![CDATA[<p>@Guillaume,</p>
<p>For some reason, Akismet flagged your comments. I&#039;ve re-instated them now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Markov Chains and how to use them by Eric</title>
		<link>http://www.evanfosmark.com/2009/11/python-markov-chains-and-how-to-use-them/#comment-2813</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 10 Nov 2009 23:27:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=67#comment-2813</guid>
		<description>I find better results with a third element in the Markov state.  (A fourth generates a few too many real words for my taste.)   A quick generalization of your code allows that:
&lt;pre lang="python"&gt;
    class MarkovChain(collections.defaultdict):
        """ Yet another markov chain implementation.
            This one differs in the sense that it is able to better support
            huge amounts of data since the weighted randomization doesn't rely
            on duplicates.
        """
        
        # Sentinels 
        # Discussion here: http://stackoverflow.com/questions/1677726
        class START(object):pass
        class END(object):pass
        
        def __init__(self, level=2):
            self.level = level
            collections.defaultdict.__init__(self, DynamicDie)
        
        def add(self, iterable):
            """ Insert an iterable (pattern) item into the markov chain.
                The order of the pattern will define more of the chain.
            """
            prefix = [MarkovChain.START] * self.level
            for item in iterable:
                self[tuple(prefix)].add_side(item)
                prefix.append(item)
                prefix.pop(0)
            self[tuple(prefix)].add_side(MarkovChain.END)
        
        def random_output(self, max=100):
            """ Generate a list of elements from the markov chain.
                The `max` value is in place in order to prevent excessive iteration.
            """
            output = []
            prefix = [MarkovChain.START] * self.level
            for i in range(max - self.level):
                item = self[tuple(prefix)].roll()
                if item is MarkovChain.END:
                    break
                output.append(item)
                prefix.append(item)
                prefix.pop(0)
            return output
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I find better results with a third element in the Markov state.  (A fourth generates a few too many real words for my taste.)   A quick generalization of your code allows that:</p>

<div class="wp_syntax"><div class="code"><pre class="python">    <span style="color: #ff7700;font-weight:bold;">class</span> MarkovChain<span style="color: black;">&#40;</span><span style="color: #dc143c;">collections</span>.<span style="color: black;">defaultdict</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot; Yet another markov chain implementation.
            This one differs in the sense that it is able to better support
            huge amounts of data since the weighted randomization doesn't rely
            on duplicates.
        &quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;"># Sentinels </span>
        <span style="color: #808080; font-style: italic;"># Discussion here: http://stackoverflow.com/questions/1677726</span>
        <span style="color: #ff7700;font-weight:bold;">class</span> START<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:<span style="color: #ff7700;font-weight:bold;">pass</span>
        <span style="color: #ff7700;font-weight:bold;">class</span> END<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:<span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, level=<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
            <span style="color: #008000;">self</span>.<span style="color: black;">level</span> = level
            <span style="color: #dc143c;">collections</span>.<span style="color: black;">defaultdict</span>.<span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, DynamicDie<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">def</span> add<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, iterable<span style="color: black;">&#41;</span>:
            <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot; Insert an iterable (pattern) item into the markov chain.
                The order of the pattern will define more of the chain.
            &quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
            prefix = <span style="color: black;">&#91;</span>MarkovChain.<span style="color: black;">START</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">*</span> <span style="color: #008000;">self</span>.<span style="color: black;">level</span>
            <span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> iterable:
                <span style="color: #008000;">self</span><span style="color: black;">&#91;</span><span style="color: #008000;">tuple</span><span style="color: black;">&#40;</span>prefix<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>.<span style="color: black;">add_side</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>
                prefix.<span style="color: black;">append</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>
                prefix.<span style="color: black;">pop</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
            <span style="color: #008000;">self</span><span style="color: black;">&#91;</span><span style="color: #008000;">tuple</span><span style="color: black;">&#40;</span>prefix<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>.<span style="color: black;">add_side</span><span style="color: black;">&#40;</span>MarkovChain.<span style="color: black;">END</span><span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">def</span> random_output<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #008000;">max</span>=<span style="color: #ff4500;">100</span><span style="color: black;">&#41;</span>:
            <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot; Generate a list of elements from the markov chain.
                The `max` value is in place in order to prevent excessive iteration.
            &quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
            output = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
            prefix = <span style="color: black;">&#91;</span>MarkovChain.<span style="color: black;">START</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">*</span> <span style="color: #008000;">self</span>.<span style="color: black;">level</span>
            <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">max</span> - <span style="color: #008000;">self</span>.<span style="color: black;">level</span><span style="color: black;">&#41;</span>:
                item = <span style="color: #008000;">self</span><span style="color: black;">&#91;</span><span style="color: #008000;">tuple</span><span style="color: black;">&#40;</span>prefix<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>.<span style="color: black;">roll</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">if</span> item <span style="color: #ff7700;font-weight:bold;">is</span> MarkovChain.<span style="color: black;">END</span>:
                    <span style="color: #ff7700;font-weight:bold;">break</span>
                output.<span style="color: black;">append</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>
                prefix.<span style="color: black;">append</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>
                prefix.<span style="color: black;">pop</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">return</span> output</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Markov Chains and how to use them by Guillaume</title>
		<link>http://www.evanfosmark.com/2009/11/python-markov-chains-and-how-to-use-them/#comment-2778</link>
		<dc:creator>Guillaume</dc:creator>
		<pubDate>Fri, 06 Nov 2009 10:45:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=67#comment-2778</guid>
		<description>I'm wondering why my post about some optimisation and profiling does not appear ?

Basicely, it's interesting to see that the solution runs quicker (10%) on python3 than python2, I'm wondering why.</description>
		<content:encoded><![CDATA[<p>I&#039;m wondering why my post about some optimisation and profiling does not appear ?</p>
<p>Basicely, it&#039;s interesting to see that the solution runs quicker (10%) on python3 than python2, I&#039;m wondering why.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Markov Chains and how to use them by Evan</title>
		<link>http://www.evanfosmark.com/2009/11/python-markov-chains-and-how-to-use-them/#comment-2776</link>
		<dc:creator>Evan</dc:creator>
		<pubDate>Fri, 06 Nov 2009 06:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.evanfosmark.com/?p=67#comment-2776</guid>
		<description>Nice catch, Marius. I had planned to update it before I posted, but I forgot.</description>
		<content:encoded><![CDATA[<p>Nice catch, Marius. I had planned to update it before I posted, but I forgot.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
