<?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>Guy Rutenberg &#187; Web Development</title>
	<atom:link href="http://www.guyrutenberg.com/tag/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Sat, 14 Jan 2012 11:30:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Modified Variant Whitespace Template</title>
		<link>http://www.guyrutenberg.com/2011/11/17/modified-variant-whitespace-template/</link>
		<comments>http://www.guyrutenberg.com/2011/11/17/modified-variant-whitespace-template/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 19:16:47 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=889</guid>
		<description><![CDATA[Variant Whitespace is a nice minimalistic template by Andreas Viklund. Andreas chose to put the sidebar above the content, which I prefer not to do. Furthermore as the sidebar was a &#8220;float&#8221; that came before the content, it caused additional inconveniences. E.g. if you had an element with clear: both it would be pushed bellow [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://andreasviklund.com/templates/variant-whitespace/">Variant Whitespace</a> is a nice minimalistic template by <a href="http://andreasviklund.com/">Andreas Viklund</a>.</p>
<p><a href="http://www.guyrutenberg.com/wp-content/uploads/2011/11/variant-whitespace-700x549.png"><img src="http://www.guyrutenberg.com/wp-content/uploads/2011/11/variant-whitespace-700x549.png" alt="" title="variant-whitespace-700x549" width="700" height="549" class="aligncenter size-full wp-image-892" /></a></p>
<p>Andreas chose to put the sidebar above the content, which I prefer not to do. Furthermore as the sidebar was a &#8220;float&#8221; that came before the content, it caused additional inconveniences. E.g. if you had an element with <code>clear: both</code> it would be pushed bellow the sidebar. I&#8217;ve patched it a bit in order to fix those issues. You can find my modified version here: <a href="/wp-content/uploads/2011/11/variant-whitespace.tar.gz">variant-whitespace.tar.gz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2011/11/17/modified-variant-whitespace-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>URL-Safe Timestamps using Base64</title>
		<link>http://www.guyrutenberg.com/2010/04/30/url-safe-timestamps-using-base64/</link>
		<comments>http://www.guyrutenberg.com/2010/04/30/url-safe-timestamps-using-base64/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 17:08:56 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=667</guid>
		<description><![CDATA[Passing around timestamps in URLs is a common task. We usually want our URLs to be as shortest as possible. I&#8217;ve found using Base64 to result in the shortest URL-safe representation, just 6 chars. This compares with the 12 chars of the naive way, and 8 chars when using hex representation. The following Python functions [...]]]></description>
			<content:encoded><![CDATA[<p>Passing around timestamps in URLs is a common task. We usually want our URLs to be as shortest as possible. I&#8217;ve found using Base64 to result in the shortest URL-safe representation, just 6 chars. This compares with the 12 chars of the naive way, and 8 chars when using hex representation.</p>
<p>The following Python functions allow you to build and read these 6 chars URL-safe timestamps:<br />
<span id="more-667"></span></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">base64</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">struct</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> build_timestamp<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Return a 6 chars url-safe timestamp
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">base64</span>.<span style="color: black;">urlsafe_b64encode</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">struct</span>.<span style="color: black;">pack</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;!L&quot;</span>,<span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:-<span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> read_timestamp<span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Convert a 6 chars url-safe timestamp back to time
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">struct</span>.<span style="color: black;">unpack</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;!L&quot;</span>,<span style="color: #dc143c;">base64</span>.<span style="color: black;">urlsafe_b64decode</span><span style="color: black;">&#40;</span>t+<span style="color: #483d8b;">&quot;==&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span></pre></div></div>

<p>These functions work by translating the timestamp into a 4-byte binary form and then encoding it using a URL-safe version of Base64. And finally we strip the padding, which is neither URL-safe nor necessary (as we know the size of the encoded data).</p>
<p>The result looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">In [72]: build_timestamp()
Out[72]: 'S9sNOQ'</pre></div></div>

<p>We got a timestamp in using only 6 URL-safe chars.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/04/30/url-safe-timestamps-using-base64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;CC Yourself&#8221; and Spam</title>
		<link>http://www.guyrutenberg.com/2010/02/09/cc-yourself-and-spam/</link>
		<comments>http://www.guyrutenberg.com/2010/02/09/cc-yourself-and-spam/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 21:27:33 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=624</guid>
		<description><![CDATA[Every good web programmer will note that the following contact form markup is probably flawed &#60;form&#62; ... &#60;input type=&#34;hidden&#34; name=&#34;to&#34; value=&#34;support@example.com&#34; /&#62; ... &#60;/form&#62; as it is likely that if the value of the &#8220;to&#8221; field changes the message will be sent to the modified address. The problem with this kind of functionality is that [...]]]></description>
			<content:encoded><![CDATA[<p>Every good web programmer will note that the following contact form markup is probably flawed</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form&gt;
...
    &lt;input type=&quot;hidden&quot; name=&quot;to&quot; value=&quot;support@example.com&quot; /&gt;
...
&lt;/form&gt;</pre></div></div>

<p>as it is likely that if the value of the &#8220;to&#8221; field changes the message will be sent to the modified address. The problem with this kind of functionality is that it allows a malicious user to send emails from your mail server. More specifically,  it can allow spammers to user your benign server t send their spam (and as a side effect you might be flagged as a spammer yourself).</p>
<p>As this case is pretty obvious one doesn&#8217;t see many real-life uses of it anymore (but careless programmers used it more often n the past until they learned better). However one can achieve similar goals (spam-wise) by utilizing a common feature in contact forms: the &#8220;CC yourself&#8221; checkbox.<br />
<a href="http://www.guyrutenberg.com/wp-content/uploads/2010/02/contact_form.png"><img src="http://www.guyrutenberg.com/wp-content/uploads/2010/02/contact_form.png" alt="" title="CC Yourself" width="425" height="320" class="aligncenter size-full wp-image-632" /></a><br />
<span id="more-624"></span><br />
&#8220;CC yourself&#8221;  is a convention used by some people when mailing, to verify that the email was indeed sent. It had found a place in many contact forms, as people wanted a way to make sure the form indeed works. But contact forms (as well as some mail servers) don&#8217;t verify that the email provided as the &#8220;from&#8221; is indeed owned by whoever fills the form. Combine that with the fact that many contact forms don&#8217;t employ CAPTCHAs (to make the form simpler to use), and you&#8217;ll get a situation much like the one discussed above.</p>
<p>In the first case there was a usability advantage to the programmer (who could easily re-use the form&#8217;s backend for other forms), which can be easily sacrificed for enhanced security. This time it&#8217;s worse as this is a usability feature for the user, which many people believe to be very convinient in contact forms.</p>
<p>I think there are several solutions possible:</p>
<ol>
<li>Adding CAPTCHA to the form. This will make life for the spammers harder, but it also hurt the users by raising the bar for filling out the form. Also, nowadays, it getting harder and harder to find a strong yet easy for humans CAPTCHA.</li>
<li>Removing the &#8220;CC yourself&#8221; feature. this hurts the usability of the contact form.</li>
<li>Seperating verified users and unverified. Keeping the feature for registered users, but at the same time, removing it or adding CAPTCHA for unverified users. This seems like a good trade-off, but it requires more work and registration is not applicable for all websites.</li>
</ol>
<p>In my opinion none of the solutions is perfect. It seems that once again spammers hurt the user experience for everybody else in order to fill our inboxes with unsolicited email.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/02/09/cc-yourself-and-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.296 seconds -->

