<?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>W-Shadow.com &#187; Applications</title>
	<atom:link href="http://w-shadow.com/blog/category/applications/feed/" rel="self" type="application/rss+xml" />
	<link>http://w-shadow.com</link>
	<description>Slightly Advanced Computer Stuff (and some magic)</description>
	<lastBuildDate>Fri, 20 Nov 2009 16:32:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Auto-Highlight New Items With The Newslight UserScript</title>
		<link>http://w-shadow.com/blog/2009/10/12/newslight-greasemonkey-script/</link>
		<comments>http://w-shadow.com/blog/2009/10/12/newslight-greasemonkey-script/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 14:46:20 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[greasemonkey script]]></category>
		<category><![CDATA[highlight changes]]></category>
		<category><![CDATA[highlight new items]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[localStorage]]></category>
		<category><![CDATA[userscript]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=1333</guid>
		<description><![CDATA[Newslight is a Greasemonkey script that you can use to automatically highlight new posts, new blog comments, recent product listings or any other kind of new content that has been added to your favourite website(s) since you last visited.
The way it works is simple : when you see a web page you&#8217;d like to keep [...]]]></description>
			<content:encoded><![CDATA[<p><em>Newslight</em> is a Greasemonkey script that you can use to automatically highlight new posts, new blog comments, recent product listings or any other kind of new content that has been added to your favourite website(s) since you last visited.</p>
<p>The way it works is simple : when you see a web page you&#8217;d like to keep track of (e.g. an interesting forum discussion), click a button to save the current version of that page. Then, when you revisit that page at a later time, simply click another button to instantly highlight all the new text and images that have been added since your previous visit. You can also configure the script to do one or both of those steps automatically for all pages of a specific site.</p>
<h3>Screenshots</h3>
<div id="attachment_1347" class="wp-caption alignleft" style="width: 310px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: left;"><a href="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-screenshot1.png"><img class="size-medium wp-image-1347" title="Newslight screenshot : Automatically highlighting a new comment" src="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-screenshot1-300x237.png" alt="Automatically highlighting a new comment" width="300" height="237" /></a><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">Highlighting a new comment</p></div>
<div id="attachment_1357" class="wp-caption alignleft" style="width: 310px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: left;"><a href="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-screenshot-Deviantart.jpg"><img class="size-medium wp-image-1357" title="Newslight screenshot : new images on DeviantArt" src="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-screenshot-Deviantart-300x199.jpg" alt="Highlighting new images" width="300" height="199" /></a><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">Highlighting new images</p></div>
<div id="attachment_1350" class="wp-caption alignleft" style="width: 310px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: left;"><a href="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-screenshot-Reddit.png"><img class="size-medium wp-image-1350  " title="Newslight in action on the Reddit front-page" src="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-screenshot-Reddit-300x198.png" alt="The script doesn't work so great on complex, frequently updated sites. Yet." width="300" height="198" /></a><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">The highlighting algorithm doesn&#39;t work that great on complex or frequently updated sites, yet.</p></div>
<div id="attachment_1351" class="wp-caption alignleft" style="width: 310px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: left;"><a href="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-GM-menu.png"><img class="size-medium wp-image-1351" title="Newslight Greasemonkey menu" src="http://w-shadow.com/wp-content/uploads/2009/10/Newslight-GM-menu-300x94.png" alt="Newslight's Greasemonkey menu" width="300" height="94" /></a><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">Newslight&#39;s Greasemonkey menu</p></div>
<h3 style="clear: both;">Download</h3>
<p><a href="http://w-shadow.com/files/newslight/newslight.user.js"><strong>Install Newslight.user.js</strong></a> (15 KB, requires FF 3.5+)</p>
<p>Once installed, you can access the script&#8217; s features by right-clicking the Greasemonkey icon on your status bar and selecting &#8220;User Script Commands&#8230;&#8221; from the pop-up menu :</p>
<ul>
<li><strong>Remember this version of the page</strong> &#8211; stores the current version of the page for later reference.</li>
<li><strong>Highlight changes</strong> &#8211; compares the contents of the current page to the latest saved version and highlights any new text/images. Clicking this again will toggle the highlighting on/off.</li>
<li><strong>Automatically remember pages on example.com</strong> (on/off) &#8211; automatically remember the contents of every page that you visit on this site.</li>
<li><strong>Automatically highlight changes on example.com</strong> (on/off) &#8211; automatically highlight new items on all pages of this site.</li>
</ul>
<p>You can also use these two bookmarklets to quickly access the script&#8217;s main functions without going through the Greasemonkey menu. Just drag them to your bookmark bar :</p>
<ul>
<li><a title="Save the current page state so that it can be used later to highlight changes" href="javascript:if(typeof window.NewslightSavePageState == 'function') { NewslightSavePageState(true); } else { alert('The Newslight userscript is not installed or is disabled!'); }">Remember this page</a></li>
<li><a title="Highlight new items detected on the current page" href="javascript:if(typeof window.NewslightToggleHighlights == 'function') { NewslightToggleHighlights(true); } else { alert('The Newslight userscript is not installed or is disabled!'); }">Highlight changes</a></li>
</ul>
<h3>How It Works</h3>
<p>I&#8217;ll be the first to admit that the highlighting algorithm is very primitive. For example, changing a single word in a paragraph will make the script highlight the entire paragraph, whereas swapping two paragraphs of an article will go completely undetected and un-highlighted. The reason it happens is the way the userscript works : instead of using complex tree manipulation or advanced stuff like revision tracking, it grabs all the text and image nodes from the web page and dumps them into a big lookup table (removing duplicates in the process). Then, when you ask it to highlight changes, it just loads up the aforementioned table and checks the current version of the page against it. Anything that&#8217;s not in the table gets highlighted. The actual algorithm for finding new items takes only a couple dozen lines.</p>
<p>For those interested in the technical details, here&#8217;s a quick run-down :</p>
<ul>
<li>The lookup table is just a simple wrapper around a plain JS object <a href="http://www.quirksmode.org/js/associative.html">being used as an associative array</a>.</li>
<li>The table is encoded in JSON and stored in a <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage</a> database (available in FF 3.5 and up). I&#8217;m using the <a href="http://pablotron.org/?cid=1557">PersistJS</a> library to handle the particulars, which should make it easier to port the userscript to other browsers eventually.</li>
<li>I tried various ways of fetching all text nodes from a DOM tree, but using the &#8220;//text()&#8221; XPath expression turned out to be the fastest and most straightforward approach, at least in this case.</li>
<li>Miscellaneous stuff, like adding/removing the CSS classes and showing pop-up notifications, is done either via direct DOM manipulation or jQuery.</li>
</ul>
<p>There&#8217;s certainly a lot of room for improvement &#8211; e.g. configurable highlight colours, converting the script to a proper FF addon,  better UI etc. &#8211; but the inherent simplicity of the algorithm is quite intentional. It&#8217;s not meant to precisely pinpoint new items on a site, but rather to serve as a useful hint as to where you might find them;  an imperfect but handy filter.</p>
<p>Why do it this way? Because determining what counts as new is ultimately an AI-hard problem &#8211; you&#8217;d need software with near-human intelligence to solve it. Sure, you could probably get a decent approximation by devoting a few weeks to research, but I&#8217;d rather have something up and running <em>now</em>, so I can collect some feedback and see if it&#8217;s worth doing that research <img src='http://w-shadow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/10/12/newslight-greasemonkey-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Fluid Simulation With Cellular Automata</title>
		<link>http://w-shadow.com/blog/2009/09/01/simple-fluid-simulation/</link>
		<comments>http://w-shadow.com/blog/2009/09/01/simple-fluid-simulation/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 19:48:33 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cellular automata]]></category>
		<category><![CDATA[fluid dynamics]]></category>
		<category><![CDATA[fluid simulation]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[water dynamics]]></category>
		<category><![CDATA[water simulation]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=1285</guid>
		<description><![CDATA[Last week I couldn&#8217;t use my regular dev. machine (broken graphics card), so all my WordPress-related plans were on hold. To pass the time, I built a simple water simulation in Processing. Today I&#8217;m going to show you this little application and explain how it works. Online demo and source code are included.
Big Words, or [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I couldn&#8217;t use my regular dev. machine (broken graphics card), so all my WordPress-related plans were on hold. To pass the time, I built a simple water simulation in <a href="http://processing.org/">Processing</a>. Today I&#8217;m going to show you this little application and explain how it works. Online demo and source code are included.</p>
<h3>Big Words, or The Theoretical Part</h3>
<p>Fluid dynamics is a complex topic. If you so much as <a rel="nofollow" href="http://en.wikipedia.org/wiki/Computational_fluid_dynamics">look it up in Wikipedia</a>, you will be immediately assaulted by integrals, differentials  and other agents of mathematical insanity. To accurately model a fluid you would need a quite an in-depth understanding of physics and calculus. And while that&#8217;s certainly not something one couldn&#8217;t figure out given enough time, &#8220;proper&#8221; fluid simulation is still extremely rare in non-academic applications and games because it&#8217;s <strong>slow</strong>.</p>
<p>One way to create a faster (though less accurate) simulation is by using <a rel="nofollow" href="http://en.wikipedia.org/wiki/Cellular_automata">cellular automata</a> to represent the water. A cellular automaton is basically a grid where each cell can be in one of a finite number of states, plus a set of rules that determine how a cell can change from one state to another. The rules are typically local &#8211; that is, they consider only the current cell and it&#8217;s direct neighbours when determining the new state. During each step of the simulation, you simply loop through the entire grid and apply the rules to each cell.</p>
<p>When simulating water or other fluids it can more appropriate to store a continuous value (e.g. water mass) in each cell, instead of using discrete states.</p>
<h3>CA-Based Water Simulation</h3>
<p>Before we go into details, lets take a look at the promised online demo. It will give you a good idea about what you can achieve with this approach :</p>
<p><a href="http://w-shadow.com/files/water_sim/"><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-large wp-image-1291" title="Click to run the simulation" src="http://w-shadow.com/wp-content/uploads/2009/09/Water-Simulation1-490x513.png" alt="Click to run the simulation" width="490" height="513" /></a> <em>(klicken Sie auf das Bild; Java required)</em></p>
<p>Alright, on to the code stuff. Lets try simulating the most common fluid &#8211; water.</p>
<p><strong>The basic data structure</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Map dimensions</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> map_width <span style="color: #339933;">=</span> <span style="color: #cc66cc;">16</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> map_height <span style="color: #339933;">=</span> <span style="color: #cc66cc;">16</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Block types</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> AIR <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> GROUND <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> WATER <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Data structures</span>
<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> blocks <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span>map_width<span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>map_height<span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">float</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> mass <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">float</span><span style="color: #009900;">&#91;</span>map_width<span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>map_height<span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span>,
          new_mass <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">float</span><span style="color: #009900;">&#91;</span>map_width<span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>map_height<span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I use two two-dimensional arrays to represent the simulation world. The <code>blocks</code> array defines a basic &#8220;map&#8221; where each cell can contain ground (solid, stops water flow), air (an empty cell, water can flow in) or water. Each water cell also has a corresponding entry in the <code>mass</code> array that defines how much water it contains. All water cells/blocks start out with one unit of water.</p>
<p>There&#8217;s also a third array &#8211; <code>new_mass</code> that is used to store intermediate mass values when running the simulation. Operating directly on the <code>mass</code> array is unadvisable because you would get various sideffects like water spreading at different speeds depending on the order in which you update the cells.</p>
<p><strong>Overall algorithm</strong></p>
<p>The main idea is to treat water as a slightly compressible liquid, as described in <a href="http://home.comcast.net/~tom_forsyth/papers/cellular_automata_for_physical_modelling.html">this article</a>. In terms of implementation, this means that if there are two or more water cells stacked vertically, the bottom cells will be able to hold slightly more water than normal. This way we don&#8217;t need to explicitly track pressure to make the water level equalize in communicating vessels &#8211; we can just look at how much excess water a cell has, and move it upwards if required.</p>
<p>Lets set up the exact fluid properties as constants :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Water properties</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">float</span> MaxMass <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1.0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//The normal, un-pressurized mass of a full water cell</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">float</span> MaxCompress <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.02</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//How much excess water a cell can store, compared to the cell above it</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">float</span> MinMass <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0001</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//Ignore cells that are almost dry</span></pre></div></div>

<p>For example, if one cell contains 1.0 units of water, the cell below it should contain up to 1.02 units, the cell below that one should contain 1.04, the next one 1.06, and so on. There is one however special case that we need to consider to get a plausible simulation &#8211; what if the if the top cell contains less than <code>MaxMass</code> units of water? In my implementation the bottom cell will contain a proportionally smaller excess amount, not the usual <code>mass_of_the_cell_above + MaxCompression</code> units.</p>
<p>Based on the above, we can simulate water movement by looping over the <code>mass</code> array and applying these cellular automaton rules to each cell :</p>
<ol>
<li>Take the mass of the current cell and the cell <strong>below</strong> it and figure out how much water the bottom cell should contain. If it has less than that, remove the corresponding amount from the current cell and add it to the bottom cell.</li>
<li>Check the cell to the <strong>left</strong> of this one. If it has less water, move over enough water to make both cells contain the same amount.</li>
<li>Do the same thing for the <strong>right</strong> neighbour.</li>
<li>Do the same thing as in step 1., but for the cell <strong>above</strong> the current one.</li>
</ol>
<p>While doing this you also need to keep track of how much water the current cell still has remaining, or you could end up with negative-mass water blocks.</p>
<p>After the new mass of each cell has been calculated, you can safely copy over the new values to the <code>mass</code> array. You also need to update the <code>blocks</code> array so that cells that are now dry get marked as empty and vice versa.</p>
<p>Here&#8217;s the simulation code :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">void</span> simulate_compression<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">float</span> Flow <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">float</span> remaining_mass<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//Calculate and apply flow for each block</span>
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> x <span style="color: #339933;">&lt;=</span> map_width<span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> y <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> y <span style="color: #339933;">&lt;=</span> map_height<span style="color: #339933;">;</span> y<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <span style="color: #666666; font-style: italic;">//Skip inert ground blocks</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> blocks<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> GROUND<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//Custom push-only flow</span>
       Flow <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
       remaining_mass <span style="color: #339933;">=</span> mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> remaining_mass <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//The block below this one</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>blocks<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> GROUND<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         Flow <span style="color: #339933;">=</span> get_stable_state_b<span style="color: #009900;">&#40;</span> remaining_mass <span style="color: #339933;">+</span> mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
         <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Flow <span style="color: #339933;">&gt;</span> MinFlow <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
           Flow <span style="color: #339933;">*=</span> <span style="color: #cc66cc;">0.5</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//leads to smoother flow</span>
         <span style="color: #009900;">&#125;</span>
         Flow <span style="color: #339933;">=</span> constrain<span style="color: #009900;">&#40;</span> Flow, <span style="color: #cc66cc;">0</span>, min<span style="color: #009900;">&#40;</span>MaxSpeed, remaining_mass<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+=</span> Flow<span style="color: #339933;">;</span>   
         remaining_mass <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
&nbsp;
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> remaining_mass <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//Left</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> blocks<span style="color: #009900;">&#91;</span>x<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> GROUND <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         <span style="color: #666666; font-style: italic;">//Equalize the amount of water in this block and it's neighbour</span>
         Flow <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> mass<span style="color: #009900;">&#91;</span>x<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
         <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Flow <span style="color: #339933;">&gt;</span> MinFlow <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> Flow <span style="color: #339933;">*=</span> <span style="color: #cc66cc;">0.5</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
         Flow <span style="color: #339933;">=</span> constrain<span style="color: #009900;">&#40;</span>Flow, <span style="color: #cc66cc;">0</span>, remaining_mass<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+=</span> Flow<span style="color: #339933;">;</span>
         remaining_mass <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
&nbsp;
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> remaining_mass <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//Right</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> blocks<span style="color: #009900;">&#91;</span>x<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> GROUND <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         <span style="color: #666666; font-style: italic;">//Equalize the amount of water in this block and it's neighbour</span>
         Flow <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> mass<span style="color: #009900;">&#91;</span>x<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
         <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Flow <span style="color: #339933;">&gt;</span> MinFlow <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> Flow <span style="color: #339933;">*=</span> <span style="color: #cc66cc;">0.5</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
         Flow <span style="color: #339933;">=</span> constrain<span style="color: #009900;">&#40;</span>Flow, <span style="color: #cc66cc;">0</span>, remaining_mass<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+=</span> Flow<span style="color: #339933;">;</span>
         remaining_mass <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
&nbsp;
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> remaining_mass <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">//Up. Only compressed water flows upwards.</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> blocks<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> GROUND <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         Flow <span style="color: #339933;">=</span> remaining_mass <span style="color: #339933;">-</span> get_stable_state_b<span style="color: #009900;">&#40;</span> remaining_mass <span style="color: #339933;">+</span> mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Flow <span style="color: #339933;">&gt;</span> MinFlow <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> Flow <span style="color: #339933;">*=</span> <span style="color: #cc66cc;">0.5</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
         Flow <span style="color: #339933;">=</span> constrain<span style="color: #009900;">&#40;</span> Flow, <span style="color: #cc66cc;">0</span>, min<span style="color: #009900;">&#40;</span>MaxSpeed, remaining_mass<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
         new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+=</span> Flow<span style="color: #339933;">;</span>   
         remaining_mass <span style="color: #339933;">-=</span> Flow<span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
     <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//Copy the new mass values to the mass array</span>
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> x <span style="color: #339933;">&lt;</span> map_width <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> y <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> y <span style="color: #339933;">&lt;</span> map_height <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> y<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> new_mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> x <span style="color: #339933;">&lt;=</span> map_width<span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> y <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> y <span style="color: #339933;">&lt;=</span> map_height<span style="color: #339933;">;</span> y<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <span style="color: #666666; font-style: italic;">//Skip ground blocks</span>
       <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>blocks<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> GROUND<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
       <span style="color: #666666; font-style: italic;">//Flag/unflag water blocks</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> MinMass<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         blocks<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> WATER<span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
         blocks<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> AIR<span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
     <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//Remove any water that has left the map</span>
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> x <span style="color: #339933;">&lt;</span> map_width<span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    mass<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>map_height<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> y <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> y <span style="color: #339933;">&lt;</span> map_height<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> y<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    mass<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    mass<span style="color: #009900;">&#91;</span>map_width<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And here&#8217;s the function that calculates how to distribute a given amount of water between two vertically adjacent cells :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Returns the amount of water that should be in the bottom cell.</span>
<span style="color: #000066; font-weight: bold;">float</span> get_stable_state_b <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">float</span> total_mass <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> total_mass <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> total_mass <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">*</span>MaxMass <span style="color: #339933;">+</span> MaxCompress <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>MaxMass<span style="color: #339933;">*</span>MaxMass <span style="color: #339933;">+</span> total_mass<span style="color: #339933;">*</span>MaxCompress<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>MaxMass <span style="color: #339933;">+</span> MaxCompress<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>total_mass <span style="color: #339933;">+</span> MaxCompress<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Full source code</strong></p>
<ul>
<li><a href="http://w-shadow.com/files/water_sim.zip"><strong>Download the source</strong></a> (23 KB)</li>
<li>You will need the Java-based <a href="http://processing.org/">Processing programming language</a> to run the code.</li>
</ul>
<p>I didn&#8217;t discuss how to render the water, or how to handle user interaction, but the source code also includes a simplistic implementation of those things.</p>
<h3>Conclusion</h3>
<p>CA-based algorithms have both advantages and disadvantages. On the one hand, they&#8217;re relatively fast and the simulation quality is often good enough for games and software toys. On the other, they can produce behaviour that is very unrealistic &#8211; for example, water falling into a basin will form a little &#8220;hill&#8221; and spread out slowly, instead of near-instantly as real water would. Whether this is an acceptable downside depends on your application.</p>
<p>For a different take on simulating fluid dynamics with cellular automata, check out this <a href="http://www.gamasutra.com/view/feature/3549/interview_the_making_of_dwarf_.php?page=9">interview with the author of Dwarf Fortress</a>.</p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/09/01/simple-fluid-simulation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changelog Generator For WordPress Plugins</title>
		<link>http://w-shadow.com/blog/2009/08/20/changelog-generator-for-wordpress-plugins/</link>
		<comments>http://w-shadow.com/blog/2009/08/20/changelog-generator-for-wordpress-plugins/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 19:25:55 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[changelog]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[plugin directory]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Trac]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress plugins]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=1276</guid>
		<description><![CDATA[A few months ago, WordPress.org introduced a new feature available to plugins hosted in the Plugin Directory &#8211; changelogs. Having an easily accessible changelog is certainly a usability plus, but I felt it created unnecessary work for plugin developers. Personally, I usually provide meaningful log messages (example) when uploading a new version of a plugin [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, WordPress.org introduced a new feature available to plugins hosted in the Plugin Directory &#8211; <a href="http://westi.wordpress.com/2009/06/20/changelogs-changelogs-changelogs/">changelogs</a><span>. Having an easily accessible changelog is certainly a usability plus, but I felt it created unnecessary work for plugin developers. Personally, I usually provide meaningful log messages (</span><a href="http://plugins.trac.wordpress.org/log/broken-link-checker">example</a><span>) when uploading a new version of a plugin to the repository, so updating the changelog with pretty much the same information seems redundant.</span></p>
<p><span>This gave me the idea to write a PHP script that can generate a wordpress.org-compatible changelog from the revision log. It works for any plugin hosted in the official plugins directory and <span class="hiddenGrammarError">can be</span> a handy starting point for adding a changelog to plugins that don&#8217;t have it yet :</span></p>
<ul>
<li><strong><a href="http://w-shadow.com/wpchangelog/"><span>Run the changelog generator</span></a></strong></li>
<li><a href="http://w-shadow.com/files/wpchangelog.zip">Download the source code</a> (97 KB, requires PHP 5)</li>
</ul>
<p>For those too lazy to click one of the above links, here&#8217;s a screenshot :</p>
<p><a href="http://w-shadow.com/wpchangelog/"><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-1278" title="Changelog generator for WordPress plugins" src="http://w-shadow.com/wp-content/uploads/2009/08/Changelog-Generator.png" alt="Changelog generator for WordPress plugins" width="490" height="205" /></a></p>
<p>And I really do need to stop making these small hacks <img src='http://w-shadow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/08/20/changelog-generator-for-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Minecraft Serverlist Sorter</title>
		<link>http://w-shadow.com/blog/2009/08/05/minecraft-serverlist-sorter/</link>
		<comments>http://w-shadow.com/blog/2009/08/05/minecraft-serverlist-sorter/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 17:55:32 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[greasemonkey script]]></category>
		<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=1228</guid>
		<description><![CDATA[Minecraft is a huge waste of time. By which I mean, of course, that it&#8217;s a hugely addictive browser-based multiplayer game (see my mini-review) that makes people stay up till 5 AM every daycycle just so they can finish the latest megaproject. 
But if we&#8217;re wasting time we should at least waste it efficiently, right? [...]]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://w-shadow.com/wp-content/uploads/2009/08/Minecraft_Sand_Temple-300x209.jpg" alt="Till 5 AM, I tell you!" title="Till 5 AM, I tell you!" width="300" height="209" class="alignright size-medium wp-image-1232" />Minecraft is a huge waste of time. By which I mean, of course, that it&#8217;s a hugely addictive browser-based multiplayer game (see <a href="http://w-shadow.com/blog/2009/06/15/minecraft-review/">my mini-review</a>) that makes people stay up till 5 AM every daycycle just so they can finish the latest megaproject. </p>
<p>But if we&#8217;re wasting time we should at least waste it <em>efficiently</em>, right? One of the inefficiencies of this game is that <a href="http://minecraft.net/servers.jsp">the serverlist</a> is not sortable &#8211; if you want to find a populated server you have to look over the entire listing that typically contains 50-100 active server at any given moment.</p>
<p>That&#8217;s why I made a <a href="https://addons.mozilla.org/firefox/addon/748">GreaseMonkey</a> script that lets you sort the Minecraft serverlist as you like. It adds two new links to the serverlist &#8211; &#8220;Sort by players&#8221; and &#8220;Sort by name&#8221;. The default is to sort by the number of active players which will put the most populated servers at the top of the page (this can be easily changed by editing one line in the script). </p>
<p><strong><a href="http://w-shadow.com/files/minecraft_serverlist_sort.user.js">Download userscript!</a></strong></p>
<p><em>P.S.<br />
I&#8217;m aware that blog updates have been lacking lately. I hope to remedy with this unfortunate situation in the nearest future.</em></p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/08/05/minecraft-serverlist-sorter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AutoPagerize For Opera</title>
		<link>http://w-shadow.com/blog/2009/07/23/autopager-for-opera/</link>
		<comments>http://w-shadow.com/blog/2009/07/23/autopager-for-opera/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 19:46:04 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[autopager]]></category>
		<category><![CDATA[greasemonkey script]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[userscript]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=1218</guid>
		<description><![CDATA[AutoPagerize for Opera is a userscript that will automatically load the next page of a website inline when you reach the end of a page. This makes browsing paged search results or multi-page articles much more seamless as you don&#8217;t need to click &#8220;Next&#8221; all the time. The full version of the script supports hundreds [...]]]></description>
			<content:encoded><![CDATA[<p><strong>AutoPagerize for Opera</strong> is a userscript that will automatically load the next page of a website inline when you reach the end of a page. This makes browsing paged search results or multi-page articles much more seamless as you don&#8217;t need to click &#8220;Next&#8221; all the time. The full version of the script supports hundreds of sites, including basic staples of the contemporary Internet like Google Search, Twitter and Reddit.</p>
<p>Basically, this is a partial port of the popular Firefox-only script <a href="http://userscripts.org/scripts/show/8551">AutoPagerize</a>. I had to leave out some of the original&#8217;s features (like automatic updates) that were impossible to implement due to Opera&#8217;s limitations, but the main functionality is still there and the modified userscript supports all the sites that AutoPagerize does.</p>
<h3>Download</h3>
<p>The script is available in two versions &#8211; &#8220;Full&#8221; and &#8220;Mini&#8221;. They only differ in the number of sites they support out of the box.</p>
<ul>
<li> <strong>Full : <a href="http://w-shadow.com/files/autopager/AutoPagerizeOpera-full.user.js">AutoPagerizeOpera-full.user.js</a></strong> (370+ KB)<br />
This is a dynamically generated file that includes all the site configurations listed in the <a href="http://wedata.net/databases/AutoPagerize/">AutoPagerize database</a> at the time when you download it.</li>
<li><strong>Mini :<a href="http://w-shadow.com/files/autopager/AutoPagerizeOpera.user.js">AutoPagerizeOpera.user.js</a></strong> (22 KB)<br />
This version only supports Google Search by default. Useful if you want a smaller and slightly faster version that you can later extend to support only the sites you need.</li>
</ul>
<h3>Installation</h3>
<p>If you haven&#8217;t used user-scripts in Opera before, here&#8217;s how to set it up :</p>
<ol>
<li>Create a new folder (anywhere). Name it something like &#8220;Opera User Scripts&#8221;.</li>
<li>Download the script file and place it in that folder.</li>
<li>In Opera, go to <em>Tools -&gt; Preferences -&gt; Advanced -&gt; Content -&gt; JavaScript options</em> and select the folder created in step #1.</li>
<li>Click &#8220;OK&#8221;. The script will be automatically executed the next time you navigate to a new page (you don&#8217;t need to restart Opera).</li>
</ol>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/07/23/autopager-for-opera/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Highlight Search Terms WordPress Plugin</title>
		<link>http://w-shadow.com/blog/2009/04/13/highlight-search-terms-plugin/</link>
		<comments>http://w-shadow.com/blog/2009/04/13/highlight-search-terms-plugin/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 09:05:23 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[configurable colors]]></category>
		<category><![CDATA[highlight keywords]]></category>
		<category><![CDATA[search query]]></category>
		<category><![CDATA[search terms]]></category>
		<category><![CDATA[wordpres]]></category>
		<category><![CDATA[WordPress plugins]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=1043</guid>
		<description><![CDATA[Highlight Search Terms is a WordPress plugin that can highlight search terms on your blog&#8217;s search page. The plugin is based on a tutorial by Thaya Kareeson, but it also includes several additional features not present in the tutorial and better browser compatibility.
Features

Multiple colors : Each word of the search query is higlighted in a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Highlight Search Terms</strong> is a WordPress plugin that can highlight search terms on your blog&#8217;s search page. The plugin is based on a <a href="http://weblogtoolscollection.com/archives/2009/04/10/how-to-highlight-search-terms-with-jquery/">tutorial by Thaya Kareeson</a>, but it also includes several additional features not present in the tutorial and better browser compatibility.</p>
<h3>Features</h3>
<ul>
<li><strong>Multiple colors</strong> : Each word of the search query is higlighted in a different color, for up to five user-configurable colors. The colors will &#8220;wrap around&#8221; if there are more than five words in the query, i.e. the sixth keyword will have the same color as the first, and so on.</li>
<li><strong>Phrase highlighting</strong> : The plugin understands more advanced search queries like <em>&#8220;wordpress plugin&#8221; screenshot</em> and will treat a quoted phrase as a single search term. See the screenshots below for an example.</li>
<li><strong>Browser compatibility</strong> : Tested and works in FF 3.0.8, Opera 9.64, Chrome 2.0.173.1 and IE 8. The settings screen is also usable in all of the above, but it works slightly better in FF/Opera.</li>
<li><strong>Simple configuration</strong> : Just a few boxes and <a href="http://www.eyecon.ro/colorpicker/">a neat color picker from Eyecon</a> <img src='http://w-shadow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<h3>Screenshots</h3>
<p>The admin interface :<br />
<img style=' display: block; margin-right: auto; margin-left: auto;'  src="http://w-shadow.com/wp-content/uploads/2009/04/hls-admin-screenshot-21.png" alt="The admin interface" title="The admin interface" width="440" height="260" class="aligncenter size-full wp-image-1047" /></p>
<p>The color picker :<br />
<img style=' display: block; margin-right: auto; margin-left: auto;'  src="http://w-shadow.com/wp-content/uploads/2009/04/jquery-colorpicker.png" alt="Javascript color picker" title="Javascript color picker" width="376" height="185" class="aligncenter size-full wp-image-1049" /></p>
<p>To demonstrate how it all looks in action, I searched my test blog for <em>&#8220;text classification&#8221; php &#8220;machine learning&#8221; AI spam</em>. Here&#8217;s the result :<br />
<img style=' display: block; margin-right: auto; margin-left: auto;'  src="http://w-shadow.com/wp-content/uploads/2009/04/highlighted-search-results.png" alt="Search results with search terms highlighted" title="Search results with search terms highlighted" width="480" height="140" class="aligncenter size-full wp-image-1044" /></p>
<h3>Download</h3>
<p><a href="http://w-shadow.com/files/highlight-search-terms.zip"><strong style='font-size:larger;'>highlight-search-terms.zip</strong></a> (58 Kb)<br />
Extract the archive and upload it to <code>/wp-content/plugins</code>, preserving directory structure.</p>
<h3>Installation</h3>
<p>In addition to uploading and activating the plugin, you will also need to tell it where you want the search terms to be highlighted. Go to <em>Settings -&gt; Highlight Search Terms</em> and enter the HTML tag ID of the area that contains the search results. You can find the ID either by examining the HTML source code of your search page or by using a webdesign-oriented Firefox extension like <a href="https://addons.mozilla.org/en-US/firefox/addon/6622">DOM Inspector</a>.</p>
<p>In case you have no idea what the above paragraph means, you could just enter &#8220;body&#8221; (sans quotes) in the &#8220;Content ID&#8221; field. This setting will make the plugin highlight the search terms <em>anywhere</em> on the search page, including the sidebar and footer.</p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/04/13/highlight-search-terms-plugin/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>7 Firefox Addons For Viewing The Web Your Way</title>
		<link>http://w-shadow.com/blog/2009/03/28/7-firefox-addons-for-viewing-the-web-your-way/</link>
		<comments>http://w-shadow.com/blog/2009/03/28/7-firefox-addons-for-viewing-the-web-your-way/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 21:08:18 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firefox extension]]></category>
		<category><![CDATA[lists]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=1014</guid>
		<description><![CDATA[The Web is big. You just won&#8217;t believe how vastly, hugely, mind-bogglingly big it is. I mean, you may think it&#8217;s a long way down the road to &#8230; oops, wrong reference.
Still, the Web really is huge, and in addition to all the well-designed and accessible sites you use every day (right?), there are also [...]]]></description>
			<content:encoded><![CDATA[<p><em>The Web is big. You just won&#8217;t believe how vastly, hugely, mind-bogglingly big it is. I mean, you may think it&#8217;s a long way down the road to &#8230; oops, wrong <abbr title="Douglas Adams, The Hitchhiker's Guide to the Galaxy">reference</abbr>.</em></p>
<p>Still, the Web really is huge, and in addition to all the well-designed and accessible sites you use every day (right?), there are also some that make your eyes hurt. The vast majority of webpages are of course somewhere in between the two extremes of &#8220;perfection&#8221; and &#8220;brain damage&#8221; &#8211; some could use a better colour scheme, others lack intuitive navigation, and some are just too long or cluttered for your tastes. However, with a few client-side tweaks the experience can be much improved.</p>
<p>Here&#8217;s a list of Firefox extensions that let you view the Web <em>your way</em>.</p>
<h3>1. <a href="https://addons.mozilla.org/en-US/firefox/addon/6965">Default FullZoom level</a></h3>
<p><img src="http://w-shadow.com/wp-content/uploads/2009/03/default-fullzoom-level.png" alt="Default FullZoom Level screenshot" title="Default FullZoom Level screenshot" width="480" height="252" class="alignnone size-full wp-image-1021" /></p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/6965">Default FullZoom level</a> is a simple extension that lets you set a custom zoom level on a per-site basis. This can be very helpful if you some of your favourite sites look tiny and unreadable on a high-res display. You can choose whether to zoom all page elements or only text. The extension also displays the current zoom ratio in the status bar and includes a &#8220;Fit To Window&#8221; function.</p>
<h3>2. <a href="https://addons.mozilla.org/en-US/firefox/addon/521">Remove It Permanently</a></h3>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/521">RIP</a> lets you permanently hide content from webpages. Say there&#8217;s an annoying opt-in box, a distracting announcement rendered in huge red letters, or something else your trusty AdBlock can&#8217;t catch &#8211; Remove it Permanently will get rid of it. You only need to right-click the offending object and select &#8220;Remove this permanently&#8221; from the popup menu. You can also use the advanced configuration editor to specify the removed elements using XPath.</p>
<p>There&#8217;s also an alternative version of RIP that&#8217;s called <a href="https://addons.mozilla.org/en-US/firefox/addon/7211">Yet Another Remove It Permanently</a>. <a href="https://addons.mozilla.org/en-US/firefox/addon/7211">YARIP</a> introduces a few additional features like filtering content via regular expressions and white-listing. It&#8217;s not as stable as RIP, but some users prefer the YARIP&#8217;s interface.</p>
<h3>3. <a href="https://addons.mozilla.org/en-US/firefox/addon/2108">Stylish</a></h3>
<p>If zooming pages and hiding unwanted content isn&#8217;t enough flexibility for you, take a look at the <a href="https://addons.mozilla.org/en-US/firefox/addon/2108">Stylish</a> extension. Basically, Stylish is like Greasemonkey for CSS &#8211; it gives you the ability to define user stylesheets and extensively customise the looks of any website. In addition to that, you can even tweak the Firefox UI itself with a custom stylesheet. And don&#8217;t worry if you don&#8217;t know much about CSS &#8211; you can find a lot of user-created styles in the <a href="http://userstyles.org/">userstyles.org</a> catalogue.</p>
<h3>4. <a href="https://addons.mozilla.org/en-US/firefox/addon/7203">HeadingsMap</a></h3>
<p><img src="http://w-shadow.com/wp-content/uploads/2009/03/headingsmap_sm.png" alt="HeadingsMap view of the &quot;Creating Friendly AI&quot; document" title="HeadingsMap view of the &quot;Creating Friendly AI&quot; document" width="495" height="165" class="alignnone size-full wp-image-1016" /></p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/7203">HeadingsMap</a> generates an index of a web page using the heading elements (H1, H2, H3 and so on). HeadingsMap displays this index in a sidebar and enables you to quickly navigate to any portion of the document. The extension might also be of use to web designers as it will also display headings that have no contents and highlight heading elements that skip a level in the heading structure. Oh, and it even works with frame-based pages.</p>
<h3>5. <a href="https://addons.mozilla.org/en-US/firefox/addon/5321">GreatSummary</a></h3>
<p><img src="http://w-shadow.com/wp-content/uploads/2009/03/greatsummary.png" alt="GreatSummary popup menu" title="GreatSummary popup menu" width="466" height="99" class="alignnone size-full wp-image-1018" /></p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/5321">GreatSummary</a> can create a short summary of any page. You only need to right-click anywhere on the page, click &#8220;Summarize this page&#8221; and select the number of sentences you want returned. The addon then opens a new tab containing the summary.</p>
<p>While this is a neat feature in theory, the summariser can yield less than perfect results in practice. For one, the generated summary comprises simply a bunch of sentences (extracted from the original text) that the algorithm judged as sufficiently &#8220;important&#8221;, without much internal coherence. Also, sometimes the summariser can get confused and include various non-content elements (i.e. menu titles and the like) in the summary.</p>
<h3>6. <a href="http://lab.arc90.com/experiments/readability/">Readability</a></h3>
<p><img src="http://w-shadow.com/wp-content/uploads/2009/03/readability.png" alt="Readability" title="Readability" width="305" height="114" class="alignnone size-full wp-image-1015" /></p>
<p><a href="http://lab.arc90.com/experiments/readability/">Readability</a> is a very clever script that can process a webpage and present it in a more readable format. It will hide any distracting page elements like ads and menus and apply a custom stylesheet to make the actual content look clean and crisp. You can choose between several styles (Newspaper, Novel, etc) and configure text size and margin width.</p>
<p>Oh, and I cheated a bit with this post&#8217;s headline &#8211; <em>Readability</em> isn&#8217;t an addon. It&#8217;s actually a bookmarklet, so it will work in most modern browsers and not just Firefox <img src='http://w-shadow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>7. <a href="https://addons.mozilla.org/en-US/firefox/addon/4925">AutoPager</a></h3>
<p><a href="http://w-shadow.com/wp-content/uploads/2009/03/autopager.png"><img src="http://w-shadow.com/wp-content/uploads/2009/03/autopager-300x291.png" alt="AutoPager screenshot (click for a bigger version)" title="AutoPager screenshot (click for a bigger version)" width="300" height="291" class="alignnone size-medium wp-image-1017" /></a></p>
<p>Of course, this list would be woefully incomplete without <a href="https://addons.mozilla.org/en-US/firefox/addon/4925">AutoPager</a>. This addon will automatically load the next page of content (AJAX-style) when you reach the end of the current page, completely eliminating the need to constantly click &#8220;Next&#8221; to navigate a paged site. It works with most popular sites right out of the box and you can always add a custom configuration for new sites if need be.</p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/03/28/7-firefox-addons-for-viewing-the-web-your-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatically Restart Crashed Or Hanged Applications</title>
		<link>http://w-shadow.com/blog/2009/03/04/restart-on-crash/</link>
		<comments>http://w-shadow.com/blog/2009/03/04/restart-on-crash/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 19:34:24 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[application crashed]]></category>
		<category><![CDATA[application hanged]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[freeware]]></category>
		<category><![CDATA[hang]]></category>
		<category><![CDATA[monitoring tool]]></category>
		<category><![CDATA[restart on crash]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=959</guid>
		<description><![CDATA[Don&#8217;t you hate it when programs hang or crash? I find it especially annoying when a background application like an IM client or a bandwidth monitor silently crashes &#8211; sometimes I only notice the problem hours later when I&#8217;ve already missed a bunch of messages. I&#8217;m sure you&#8217;ve encountered a few &#8220;Not responding&#8221; errors and [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t you hate it when programs hang or crash? I find it especially annoying when a background application like an IM client or a bandwidth monitor silently crashes &#8211; sometimes I only notice the problem hours later when I&#8217;ve already missed a bunch of messages. I&#8217;m sure you&#8217;ve encountered a few &#8220;Not responding&#8221; errors and some irritatingly crash-prone applications yourself.</p>
<p>If you have an unstable program that you absolutely <em>need</em> to run at all times, but don&#8217;t want to waste your time monitoring and manually restarting it every time it croaks, I might have something interesting for you. </p>
<p><strong>Restart on Crash</strong> is an monitoring tool that will watch the applications that you specify and automatically relaunch any program that hangs or crashes. You can add any number of applications to monitor, enable/disable them individually and edit the command line that will be used to restart an application. </p>
<p><em>Restart on Crash</em> doesn&#8217;t require installation and stores all it&#8217;s configuration data in a &#8220;settings.ini&#8221; file in the program&#8217;s folder, so it&#8217;s portable. It should be compatible with most NT-based Windows versions.</p>
<p><strong style='font-size:larger;'><a href="http://w-shadow.com/files/restart_on_crash.zip">Download Restart on Crash</a></strong> (606 Kb)</p>
<h3>Screenshots &#038; Documentation</h3>
<div id="attachment_963" class="wp-caption aligncenter" style="width: 477px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; display: block; margin-right: auto; margin-left: auto;"><img src="http://w-shadow.com/wp-content/uploads/2009/03/roc-main-window.png" alt="Main application window" title="The main window of &quot;Restart on Crash&quot;" width="467" height="260" class="size-full wp-image-963" /><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">The main window</p></div>
<ul>
<li>To add a new application to monitor, click the &#8220;Add&#8221; button or press the <kbd>Ins</kbd> key.</li>
<li>To delete on or more applications from the list, select them and click &#8220;Delete&#8221; or press <kbd>Del</kbd>.</li>
<li>To edit the per-application configuration, double-click the correspoding row. This will open the editing dialog (see below).</li>
<li>You can also access the RoC configuration by clicking &#8220;Settings&#8221; and view the activity log by clicking &#8220;Show Log&#8221;. The log contains information about crashed/hanged applications, executed commands, and so on.</li>
</ul>
<div id="attachment_961" class="wp-caption aligncenter" style="width: 500px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; display: block; margin-right: auto; margin-left: auto;"><img src="http://w-shadow.com/wp-content/uploads/2009/03/roc-edit-application-settings.png" alt="Editing the monitor settings for an application" title="Editing the crash monitor settings for TweetDeck" width="490" height="395" class="size-full wp-image-961" /><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">Editing the monitor settings for an application</p></div><br />
Well, this one should be pretty self-explanatory <img src='http://w-shadow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  One detail to keep in mind is that enabling the &#8220;It isn&#8217;t running&#8221; option will make <em>Restart On Crash</em> treat the application as if it has crashed even if you have purposefully it closed it. You can get around this by disabling the monitoring of the application before you close it.</p>
<p><div id="attachment_962" class="wp-caption aligncenter" style="width: 303px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; display: block; margin-right: auto; margin-left: auto;"><img src="http://w-shadow.com/wp-content/uploads/2009/03/roc-main-configuration.png" alt="The configuration dialog. Yes, that&#039;s it." title="&quot;Restart on Crash&quot; configuration dialog" width="293" height="178" class="size-full wp-image-962" /><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">The configuration dialog. Yes, that's it.</p></div>
<p>&#8220;Grace period&#8221; is how long <em>Restart on Crash</em> will wait before trying to terminate/restart an application that it has just terminated/restarted. This is intended to prevent a scenario where RoC kills a hanged program, restarts it,  decides it has hanged again (e.g. if the program is non-responsive while starting up) and wrongfully terminates it again.</p>
<h3>Known Issues</h3>
<ul>
<li>If you configure RoC to automatically kill a hanged application, it will terminate <em>all</em> instances of that application when doing so. This may be fixed eventually. </li>
<li>When autorun is enabled, RoC will not start minimized or hidden in the system tray &#8211; instead, it will launch as it normally would. I originally wanted to make it load in the systray, but apparently one of the component libraries I use harbors a hard-to-find bug that makes the application behave very strangely when loaded like that.</li>
<li>Overall, this is an initial release &#8211; there are bound to be other bugs. Use at your risk <img src='http://w-shadow.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ul>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/03/04/restart-on-crash/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Anti-Privacy 1.0 (Beta)</title>
		<link>http://w-shadow.com/blog/2009/02/07/anti-privacy-beta/</link>
		<comments>http://w-shadow.com/blog/2009/02/07/anti-privacy-beta/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 17:38:24 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[greasemonkey script]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[net neutrality]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[social experiment]]></category>
		<category><![CDATA[transparent society]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web history]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=870</guid>
		<description><![CDATA[Imagine you are a systems administrator at a major ISP. The company&#8217;s servers log every page your clients visit, and due to your position you have full and unrestricted access to those logs. This comes in handy when troubleshooting network problems, but nobody would find out if you browsed somebody&#8217;s web history for other reasons [...]]]></description>
			<content:encoded><![CDATA[<p><img style=' float: left; padding: 4px; margin: 0 7px 2px 0;'  src="http://w-shadow.com/wp-content/uploads/2009/02/sm2654049085_ebd196b568.png" alt="Somebody is watching" title="Somebody is watching" width="210" height="159" class="alignleft size-full wp-image-876" />Imagine you are a systems administrator at a major ISP. The company&#8217;s servers log every page your clients visit, and due to your position you have full and unrestricted access to those logs. This comes in handy when troubleshooting network problems, but nobody would find out if you browsed somebody&#8217;s web history for other reasons (like curiosity). <strong>Would you do it?</strong></p>
<p>Now imagine you are a typical Internet user. You&#8217;ve got a bit of technical background, so you know that your ISP and some other companies (e.g. Google) could easily track your browsing habbits &#8211; if they wanted to. Imagine you knew <em>for certain</em> that at least one anonymous person was actually tracking what pages you visit. <strong>How would you feel?</strong></p>
<p><strong><em>Anti-Privacy</em> is a little social experiment that gives you the opportunity to explore both of these perspectives. </strong></p>
<p>In more practical terms, it&#8217;s a Greasemonkey script that automatically twitters every URL you visit. You install the script, insert your Twitter credentials into the source code (it&#8217;s beta, remember? <img src='http://w-shadow.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ), and your browsing history becomes public from then on. The script ignores HTTPS sites and localhost by default, but any other page is tweeted as soon as it loads. Welcome to the (semi)transparent society, netizen.</p>
<p>You can see an actual example feed here : <a href="http://twitter.com/antiprivacy">http://twitter.com/antiprivacy</a></p>
<h3>Installation</h3>
<p><strong>Firefox</strong><br />
You will need the <a href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey addon</a> to use this script. Once you&#8217;ve got Greasemonkey up and running, right-click the link below and select &#8220;Install userscript&#8221;.</p>
<div style='text-align:center;'><strong><a href="http://w-shadow.com/files/anti-privacy.user.js">anti-privacy.user.js</a></strong> (6 KB)</div>
<p>To configure the userscript, go to <em>Tools -&gt; Greasemonkey -&gt; Manage User Scripts&#8230;</em>, select the &#8220;Anti-Privacy&#8221; script and click the <em>Edit</em> button. Then change the twitter_username and twitter_password variables to your Twitter credentials.</p>
<p><strong>Opera</strong><br />
I wanted to make an Opera-compatible version because Opera is my favorite browser. However, it&#8217;s userscripting capabilities are very limited, so the script needs a server-side proxy to use TinyURL and post Twitter updates. </p>
<p>The download below includes both the userscript and the PHP proxy script. You should upload the PHP file to your own site and change the .js file to use the new URL. You can also use the proxy script I&#8217;ve installed on this server (the default setting), but be warned that I may take it down without warning.</p>
<div style='text-align:center;'><strong><a href="http://w-shadow.com/files/opera_antiprivacy.zip">opera_antiprivacy.zip</a></strong> (2 KB)</div>
<p>For installation instructions see <a href="http://www.opera.com/browser/tutorials/userjs/using/">Using user Javascript in Opera</a>. You&#8217;ll also need to edit the userscript and insert your Twitter username/password as indicated in the file.</p>
<h3>Disclaimer</h3>
<p>This software is the polar opposite of secure. It&#8217;s also buggy. No sane human should use it. Ever. Well, unless you really want to.</p>
<p><em>Image source : <a href="http://flickr.com/photos/therontrowbridge/2654049085/">Theron Trowbridge @ flickr</a></em></p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/02/07/anti-privacy-beta/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Last.fm Lyrics Tag Cloud</title>
		<link>http://w-shadow.com/blog/2009/02/01/lastfm-lyrics-tag-cloud/</link>
		<comments>http://w-shadow.com/blog/2009/02/01/lastfm-lyrics-tag-cloud/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 18:13:29 +0000</pubDate>
		<dc:creator>White Shadow</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[lyrics]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[song lyrics]]></category>
		<category><![CDATA[tag cloud]]></category>

		<guid isPermaLink="false">http://w-shadow.com/?p=851</guid>
		<description><![CDATA[Here&#8217;s a little mashup I created over the weekend &#8211; a song lyrics tag cloud, built from any user&#8217;s &#8220;Top Tracks&#8221; on Last.fm. You can select the time period, the number of tags to show and the sort order (alphabetic, random or by frequency).
For example, here&#8217;s one I made for my Last.fm account :

.ws_tag { [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little mashup I created over the weekend &#8211; <a href="http://w-shadow.com/last-lyrics-cloud/">a song lyrics tag cloud</a>, built from any user&#8217;s &#8220;Top Tracks&#8221; on Last.fm. You can select the time period, the number of tags to show and the sort order (alphabetic, random or by frequency).</p>
<p>For example, here&#8217;s one I made for <a href="http://www.last.fm/user/w-shadow">my Last.fm account</a> :</p>
<div id='lyrics_tag_wrapper'>
<style>.ws_tag { padding: 2px; letter-spacing: 2px; } .ws_lyrics_tag_cloud { font-family:  Tahoma, Trebuchet MS, sans-serif; display:block; margin: auto; width: 460px; padding: 4px; text-align: center; color: black; font-size: 13pt; } </style>
<div class='ws_lyrics_tag_cloud'><span class='ws_tag' style='font-size: 93%; color: #000;'>mess</span> <span class='ws_tag' style='font-size: 97%; color: #444;'>lost</span> <span class='ws_tag' style='font-size: 143%; color: #111;'>never</span> <span class='ws_tag' style='font-size: 93%; color: #777;'>new</span> <span class='ws_tag' style='font-size: 119%; color: #333;'>light</span> <span class='ws_tag' style='font-size: 91%; color: #888;'>soul</span> <span class='ws_tag' style='font-size: 95%; color: #888;'>spirit</span> <span class='ws_tag' style='font-size: 90%; color: #888;'>higher</span> <span class='ws_tag' style='font-size: 94%; color: #666;'>moon</span> <span class='ws_tag' style='font-size: 119%; color: #333;'>sun</span> <span class='ws_tag' style='font-size: 95%; color: #777;'>give</span> <span class='ws_tag' style='font-size: 95%; color: #222;'>chance</span> <span class='ws_tag' style='font-size: 96%; color: #444;'>think</span> <span class='ws_tag' style='font-size: 123%; color: #777;'>everything</span> <span class='ws_tag' style='font-size: 145%; color: #222;'>day</span> <span class='ws_tag' style='font-size: 91%; color: #777;'>rose</span> <span class='ws_tag' style='font-size: 146%; color: #333;'>love</span> <span class='ws_tag' style='font-size: 91%; color: #222;'>darkness</span> <span class='ws_tag' style='font-size: 125%; color: #333;'>way</span> <span class='ws_tag' style='font-size: 99%; color: #666;'>take</span> <span class='ws_tag' style='font-size: 129%; color: #888;'>life</span> <span class='ws_tag' style='font-size: 92%; color: #666;'>alone</span> <span class='ws_tag' style='font-size: 91%; color: #222;'>bring</span> <span class='ws_tag' style='font-size: 126%; color: #222;'>come</span> <span class='ws_tag' style='font-size: 105%; color: #111;'>fades</span> <span class='ws_tag' style='font-size: 90%; color: #222;'>flames</span> <span class='ws_tag' style='font-size: 103%; color: #444;'>forever</span> <span class='ws_tag' style='font-size: 128%; color: #000;'>find</span> <span class='ws_tag' style='font-size: 102%; color: #444;'>face</span> <span class='ws_tag' style='font-size: 97%; color: #666;'>fly</span> <span class='ws_tag' style='font-size: 91%; color: #333;'>wish</span> <span class='ws_tag' style='font-size: 97%; color: #444;'>die</span> <span class='ws_tag' style='font-size: 119%; color: #111;'>now</span> <span class='ws_tag' style='font-size: 132%; color: #444;'>walk</span> <span class='ws_tag' style='font-size: 117%; color: #333;'>wait</span> <span class='ws_tag' style='font-size: 150%; color: #555;'>time</span> <span class='ws_tag' style='font-size: 130%; color: #444;'>feel</span> <span class='ws_tag' style='font-size: 142%; color: #222;'>know</span> <span class='ws_tag' style='font-size: 102%; color: #444;'>fall</span> <span class='ws_tag' style='font-size: 92%; color: #111;'>name</span> <span class='ws_tag' style='font-size: 106%; color: #555;'>heart</span> <span class='ws_tag' style='font-size: 110%; color: #333;'>end</span> <span class='ws_tag' style='font-size: 200%; color: #333;'>away</span> <span class='ws_tag' style='font-size: 98%; color: #111;'>nothing</span> <span class='ws_tag' style='font-size: 107%; color: #111;'>rain</span> <span class='ws_tag' style='font-size: 109%; color: #666;'>here</span> <span class='ws_tag' style='font-size: 92%; color: #888;'>summer</span> <span class='ws_tag' style='font-size: 103%; color: #555;'>someone</span> <span class='ws_tag' style='font-size: 115%; color: #888;'>world</span> <span class='ws_tag' style='font-size: 94%; color: #333;'>man</span> </div>
</div>
<p><a href="http://w-shadow.com/last-lyrics-cloud/">Make your own!</a></p>
<p>In case you&#8217;re wondering, the mashup uses the <a href="http://lyricwiki.org/LyricWiki:SOAP">LyricWiki API</a> to retrieve the lyrics and a homegrown tag cloud algorithm to visualize them. When calculating the size of each word/tag, it counts how frequently that word occurs in all of the user&#8217;s top tracks <em>and</em> takes into account number of times each song has been played.</p>
<p>The results seem impressively accurate to me. Reflect my general mood, they do.</p>
<hr/>Copyright &copy; 2009 <strong><a href="http://w-shadow.com">W-Shadow.com</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.]]></content:encoded>
			<wfw:commentRss>http://w-shadow.com/blog/2009/02/01/lastfm-lyrics-tag-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
