<?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>Eriky.com &#187; Programming</title>
	<atom:link href="http://www.eriky.com/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.eriky.com</link>
	<description>Just another geek with a blog</description>
	<lastBuildDate>Fri, 16 Dec 2011 23:04:27 +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>Note to self: randomly drop lines in a text file</title>
		<link>http://www.eriky.com/2009/02/note-to-self-randomly-drop-lines-in-a-text-file</link>
		<comments>http://www.eriky.com/2009/02/note-to-self-randomly-drop-lines-in-a-text-file#comments</comments>
		<pubDate>Wed, 25 Feb 2009 14:40:37 +0000</pubDate>
		<dc:creator>Erik-Jan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[awk]]></category>

		<guid isPermaLink="false">http://www.eriky.com/?p=81</guid>
		<description><![CDATA[<a href="http://www.eriky.com/2009/02/note-to-self-randomly-drop-lines-in-a-text-file" title="Note to self: randomly drop lines in a text file"></a>If you ever need to drop lines from a stream of text randomly, you can use this simple and short awk command: Example: cat file &#124; awk '{if (int(rand()*100) &#60; 10) print $0;}' This example keeps only 10%. You can &#8230;<p class="read-more"><a href="http://www.eriky.com/2009/02/note-to-self-randomly-drop-lines-in-a-text-file">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.eriky.com/2009/02/note-to-self-randomly-drop-lines-in-a-text-file" title="Note to self: randomly drop lines in a text file"></a><p>If you ever need to drop lines from a stream of text randomly, you can use this simple and short awk command:</p>
<pre>Example: cat file | awk '{if (int(rand()*100) &lt; 10) print $0;}'</pre>
<p>This example keeps only 10%. You can change the 10 to any other percentage to drop more or less.</p>
<p>As an example, I use this to warmup my MediaWiki installation before doing a real WikiBench benchmark:</p>
<pre>cat benchmarks/1pct.trace | head -n 100000 | grep "\-$" | \
awk '{if (int(rand()*100) &lt; 10) print $0;}' | ./start_controller.sh -verbose</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.eriky.com%2F2009%2F02%2Fnote-to-self-randomly-drop-lines-in-a-text-file&amp;title=Note%20to%20self%3A%20randomly%20drop%20lines%20in%20a%20text%20file" id="wpa2a_2"><img src="http://www.eriky.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.eriky.com/2009/02/note-to-self-randomly-drop-lines-in-a-text-file/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Return home early</title>
		<link>http://www.eriky.com/2009/02/return-home-early</link>
		<comments>http://www.eriky.com/2009/02/return-home-early#comments</comments>
		<pubDate>Sun, 15 Feb 2009 11:48:28 +0000</pubDate>
		<dc:creator>Erik-Jan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.eriky.com/?p=46</guid>
		<description><![CDATA[<a href="http://www.eriky.com/2009/02/return-home-early" title="Return home early"></a>OK this is a bit old but I wanted to link to it anyway, just in case you haven&#8217;t heart about this programming style yet. It is called &#8220;return home early&#8221; and it basically means that you can change the &#8230;<p class="read-more"><a href="http://www.eriky.com/2009/02/return-home-early">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.eriky.com/2009/02/return-home-early" title="Return home early"></a><p>OK this is a bit old but I wanted to link to it anyway, just in case you haven&#8217;t heart about this programming style yet. It is called &#8220;return home early&#8221; and it basically means that you can change the logic of your code in such a way that you get less nesting. I tend to think about this when I see lots of curly braces and it often helps me reduce code size and complexity. If it sounds interesting enough for you, read about it <a title="Return home early" href="http://debuggable.com/posts/programming-psychology-return-home-early:4811de9f-ae28-49c2-a7dc-2f154834cda3">here</a>!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.eriky.com%2F2009%2F02%2Freturn-home-early&amp;title=Return%20home%20early" id="wpa2a_4"><img src="http://www.eriky.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.eriky.com/2009/02/return-home-early/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 25 Most Dangerous Programming Errors</title>
		<link>http://www.eriky.com/2009/01/top-25-most-dangerous-programming-errors</link>
		<comments>http://www.eriky.com/2009/01/top-25-most-dangerous-programming-errors#comments</comments>
		<pubDate>Wed, 14 Jan 2009 10:27:37 +0000</pubDate>
		<dc:creator>Erik-Jan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.eriky.com/?p=33</guid>
		<description><![CDATA[<a href="http://www.eriky.com/2009/01/top-25-most-dangerous-programming-errors" title="Top 25 Most Dangerous Programming Errors"></a>Top 25 Most Dangerous Programming Errors is a list of the most significant programming errors that can lead to serious software vulnerabilities. They occur frequently, are often easy to find, and easy to exploit. They are dangerous because they will &#8230;<p class="read-more"><a href="http://www.eriky.com/2009/01/top-25-most-dangerous-programming-errors">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.eriky.com/2009/01/top-25-most-dangerous-programming-errors" title="Top 25 Most Dangerous Programming Errors"></a><blockquote><p><a title="Top 25 programming errors" href="http://cwe.mitre.org/top25/">Top 25 Most Dangerous Programming Errors</a> is a list of the most significant programming errors that can lead to serious software vulnerabilities.  They occur frequently, are often easy to find, and easy to exploit.  They are dangerous because they will frequently allow attackers to completely take over the software, steal data, or prevent the software from working at all.  The list is the result of collaboration between the SANS Institute,  MITRE, and many top software security experts in the US and Europe.</p></blockquote>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.eriky.com%2F2009%2F01%2Ftop-25-most-dangerous-programming-errors&amp;title=Top%2025%20Most%20Dangerous%20Programming%20Errors" id="wpa2a_6"><img src="http://www.eriky.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.eriky.com/2009/01/top-25-most-dangerous-programming-errors/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

