<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wil Tan &#187; webeng</title>
	<atom:link href="http://dready.org/blog/category/webeng/feed/" rel="self" type="application/rss+xml" />
	<link>http://dready.org/blog</link>
	<description>musings on internationalized identifiers: domain names, OpenID, TLDs</description>
	<lastBuildDate>Thu, 15 Dec 2011 03:42:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Tornado with VirtualEnv and Pip Quickstart</title>
		<link>http://dready.org/blog/2009/10/09/tornado-with-virtualenv-and-pip-quickstart/</link>
		<comments>http://dready.org/blog/2009/10/09/tornado-with-virtualenv-and-pip-quickstart/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 08:50:37 +0000</pubDate>
		<dc:creator>wil</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[webeng]]></category>
		<category><![CDATA[tornado]]></category>

		<guid isPermaLink="false">http://dready.org/blog/?p=243</guid>
		<description><![CDATA[Friendfeed&#8217;s open source Tornado web server is great, and is incredibly easy to get up-and-running. Just install tornado, write your app and run it. At some point, however, you&#8217;d want more structure in your project and manage dependencies to ease deployment. This is where virtualenv and pip shines. For a few more steps, you can [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Friendfeed&#8217;s open source <a href="http://www.tornadoweb.org/">Tornado web server</a> is great, and is incredibly easy to get up-and-running. Just install tornado, write your app and run it.</p>
<p>At some point, however, you&#8217;d want more structure in your project and manage dependencies to ease deployment. This is where <a href="http://pypi.python.org/pypi/virtualenv">virtualenv</a> and <a href="http://pypi.python.org/pypi/pip">pip</a> shines. For a few more steps, you can bootstrap your project and have the warm fuzzy feeling that you can easily deploy the stuff when the code is ready.</p>
<h3>Installing <code>virtualenv</code> and <code>pip</code></h3>
<p>If you haven&#8217;t set up virtualenv, do so (as root):</p>
<pre class="code">
# easy_install virtualenv
</pre>
<p>Decide where you&#8217;d put your project directory. I&#8217;ll use <code>/path/to/myapp</code> for now. The next step is to create a virtualenv where all your Python packages are stored. I like to use the convention of a directory called <code>root</code> where all dependencies are installed. I&#8217;d generally also use it as the prefix for any <acronym title="./configure &amp;&amp; make &amp;&amp; make install">cmmi</acronym> packages that I&#8217;d like to contain within the project.</p>
<pre class="code">
$ cd /path/to/myapp
$ virtualenv --no-site-packages root
</pre>
<p>Activate the environment that we just created:</p>
<pre class="code">
$ . root/bin/activate
(root)[wil@wasabi /path/to/myapp]$
</pre>
<p>From now on, all packages installed with <code>easy_install</code> will be placed in this virtualenv.</p>
<p>Next, we will install <code>pip</code> into this virtualenv:</p>
<pre class="code">
(root)[wil@wasabi /path/to/myapp]$ easy_install pip
</pre>
<p>Once <code>pip</code> is installed, as long as you&#8217;ve got your virtualenv activated, anything installed with <code>pip</code> will also go into the right place (without your having to remember to use the <code>-E</code> command line argument.)</p>
<h3>Installing Tornado</h3>
<p>Tornado (as of the current version) needs two mandatory dependencies, i.e. <a href="http://pycurl.sourceforge.net/">pycURL</a> and <a href="http://pypi.python.org/pypi/simplejson/">simplejson</a>. Make sure you have the right libcURL version installed on your system (using <code>apt-get</code> or other mechanism) and pick the compatible pyCURL version.</p>
<pre class="code">
(root)[wil@wasabi /path/to/myapp]$ pip install pycurl==7.16.4
(root)[wil@wasabi /path/to/myapp]$ pip install simplejson
</pre>
<p>Now we&#8217;ll install tornado proper. I chose to go with the bleeding edge and ask <code>pip</code> to install from the git trunk.</p>
<pre class="code">
(root)[wil@wasabi /path/to/myapp]$ pip install -e \
  git+git://github.com/facebook/tornado.git#egg=tornado
</pre>
<p>Should you not want that, you can tell <code>pip</code> to install from the tarball URL instead (at least until tornado gets added to PyPI.)</p>
<pre class="code">
(root)[wil@wasabi /path/to/myapp]$ pip install \

http://www.tornadoweb.org/static/tornado-0.2.tar.gz
</pre>
<p>Tornado is installed!</p>
<p>Every now and then, it&#8217;s a good idea to save your pip dependencies by running</p>
<pre class="code">
(root)[wil@wasabi /path/to/myapp]$ pip freeze > pip-req.txt
</pre>
<h3>Start your project</h3>
<p>What I like about this is that the project directory has all the dependencies contained within a single directory (<code>root</code>). This is really just my convention; I&#8217;d create a <code>src</code> directory where my application code lives.</p>
<pre class="code">
(root)[wil@wasabi /path/to/myapp]$ mkdir src
(root)[wil@wasabi /path/to/myapp]$ cd src
(root)[wil@wasabi /path/to/myapp/src]$
</pre>
<p>Let&#8217;s test drive Tornado:</p>
<pre class="code">
(root)[wil@wasabi /path/to/myapp/src]$ cp ../root/src/tornado/demos/helloworld/helloworld.py .
(root)[wil@wasabi /path/to/myapp/src]$ python helloworld.py
</pre>
<p>From browser, visit your host at port <code>8888</code> to verify.</p>
<p>That&#8217;s it!</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dready.org/blog/2009/10/09/tornado-with-virtualenv-and-pip-quickstart/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Multipart Web Requests</title>
		<link>http://dready.org/blog/2007/10/02/multipart-web-requests/</link>
		<comments>http://dready.org/blog/2007/10/02/multipart-web-requests/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 03:28:44 +0000</pubDate>
		<dc:creator>wil</dc:creator>
				<category><![CDATA[http]]></category>
		<category><![CDATA[webeng]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://dready.org/blog/2007/10/02/multipart-web-requests/</guid>
		<description><![CDATA[Andy Skelton posted a proposal for a mechanism by which a web server could send related objects to a resource in response to a single request. It&#8217;s quite an interesting idea, although I&#8217;m not sure how much we could gain given that most clients today do HTTP pipelining. It could reduce loads on the server, [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://andy.wordpress.com/">Andy Skelton</a> posted a proposal for a <a href="http://andy.wordpress.com/2007/10/01/proposal-multipart-web-requests/">mechanism by which a web server could send related objects to a resource</a> in response to a single request. It&#8217;s quite an interesting idea, although I&#8217;m not sure how much we could gain given that most clients today do HTTP pipelining.</p>
<p>It <em>could</em> reduce loads on the server, but I&#8217;m not sure either. Most static content is served very efficiently on the server using the <a href="http://www.freebsd.org/cgi/man.cgi?query=sendfile&#038;sektion=2">sendfile (2)</a> system call. By mixing static content with dynamic (the HTML which has to know what its embedded objects are), it may be difficult to implement efficiently.</p>
<p>That said, it could have some merits, and a more in-depth analysis would be needed and I&#8217;d be interested to see how it pans out.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dready.org/blog/2007/10/02/multipart-web-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Proposal: IDNA Browsers Advertising Capability in User-Agent header</title>
		<link>http://dready.org/blog/2006/07/12/proposal-idna-browsers-advertising-capability-in-user-agent-header/</link>
		<comments>http://dready.org/blog/2006/07/12/proposal-idna-browsers-advertising-capability-in-user-agent-header/#comments</comments>
		<pubDate>Tue, 11 Jul 2006 21:14:05 +0000</pubDate>
		<dc:creator>wil</dc:creator>
				<category><![CDATA[idn]]></category>
		<category><![CDATA[webeng]]></category>

		<guid isPermaLink="false">http://blog.dready.org/2006/07/12/proposal-idna-browsers-advertising-capability-in-user-agent-header/</guid>
		<description><![CDATA[This is a proposal to the major browser producers supporting IDNA to advertise their IDN capabilities. One way of doing it is to include a token in the User-Agent HTTP request header. According to RFC2616, the User-Agent header is used for &#8220;statistical purposes, the tracing of protocol violations, and automated recognition of user agents for [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This is a proposal to the major browser producers supporting IDNA to advertise their IDN capabilities. One way of doing it is to include a token in the User-Agent HTTP request header. According to <a href="http://www.ietf.org/rfc/rfc2616.txt" title="HTTP/1.1 Standard">RFC2616</a>, the User-Agent header is used for </p>
<blockquote><p>&#8220;statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations.&#8221;
</p></blockquote>
<p>This will serve at least 2 purposes:</p>
<p>1. Allows web sites to encode anchor URLs in the native page encoding or HTML entities (&amp;#xXXXX;) for clients that advertises IDNA support. For other clients, punycode can be used for baseline compatibility.</p>
<p>2. Provides IDN versioning information. There have been sprouts of discussions over the next version of Nameprep profile (or even a new IDNA, maybe even a new IDN solution). This would be a good preparation for things to come, regardless of which direction the future takes us.</p>
<p>Below are some examples of popular browser User-Agent strings I pulled from my logs (and my proposed addition):</p>
<p>Firefox: <strong>*</strong><br />
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 IDN/RFC3490</p>
<p>Googlebot (which I believe is IDNA compliant):<br />
Mozilla/5.0 (compatible; Googlebot/2.1;+http://www.google.com/bot.html) IDN/RFC3490</p>
<p>Internet Explorer 6:<br />
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) IDN/RFC3490</p>
<p>Opera:<br />
Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.11 [en] IDN/RFC3490</p>
<p>Safari:<br />
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6 IDN/RFC3490</p>
<p>Other possibilities for advertising this capability exists, such as a custom header <code>X-IDN-Version</code>. The same information could possibly be exported to Javascript via the <code>navigator.userAgent</code> field, or some other custom Javascript API (this is more an example of what should NOT be done rather than a recommendation.)</p>
<p><strong>*</strong> To achieve the result in Firefox, type this into the URL bar (in a single line):<br />
<font size="-2"><code><br />
javascript:Components.classes["@mozilla.org/preferences-service;1"].getService()<br />
.QueryInterface(Components.interfaces.nsIPrefBranch)<br />
.setCharPref("general.useragent.extra.idna","IDNA/RFC3490");<br />
</code></font></p>
<p>This should take effect immediately. Go to <a href="http://www.wannabrowser.com/">http://www.wannabrowser.com/</a>  and verify that &#8220;IDNA/RFC3490&#8221; is displayed in the &#8220;HTTP User Agent&#8221; box.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dready.org/blog/2006/07/12/proposal-idna-browsers-advertising-capability-in-user-agent-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

