<?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>silentYak &#187; Tips and Tricks</title>
	<atom:link href="http://www.silentyak.com/category/tips-and-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.silentyak.com</link>
	<description>...a universal platform for global junk...</description>
	<lastBuildDate>Sun, 09 Oct 2011 07:19:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Code Comments, Documentation</title>
		<link>http://www.silentyak.com/2009/12/06/code-comments-documentation/</link>
		<comments>http://www.silentyak.com/2009/12/06/code-comments-documentation/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 22:16:22 +0000</pubDate>
		<dc:creator>RRI</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Documentation]]></category>

		<guid isPermaLink="false">http://www.silentyak.com/?p=983</guid>
		<description><![CDATA[Writing code tends to be harder than it needs to, because there’s a constant need to please a bunch of other people who want to read and understand it. Sometimes, the person who writes the code needs to worry about being able to understand it several months later. Conventional wisdom holds that the solution to [...]]]></description>
			<content:encoded><![CDATA[<p>Writing code tends to be harder than it needs to, because there’s a constant need to please a bunch of other people who want to read and understand it. Sometimes, the person who <em>writes</em> the code needs to worry about being able to understand it several months later.</p>
<p>Conventional wisdom holds that the solution to the problem is documenting the code appropriately. Conventional wisdom is wrong. Reasons are manifold, and quite obvious once you start to think about it.</p>
<p><strong>Documentation is always out-of-date.</strong> It’s impossible to have anyone and everyone who updates code to update the comments and documentation accurately. Sure, you could try, but to a large extent, this is simply beyond your control. Typically, this means you need to assume the documentation is wrong and <em>read the code in detail</em> anyway, so you might as well simply start by reading the code.</p>
<p><strong>Reading the code is the only way to figure out what it is doing.</strong> Documentation only tells you what somebody <em>thinks</em> the code is doing. It is quite possible that they’re wrong, or only partially correct. Besides, it’s better to build up a model of what you think the code is supposed to do, than to be <em>told</em> what to expect.</p>
<p><strong>Code is more concise.</strong> If the code is well-written and self-documented, it is generally faster to read the code and understand what’s going on than to read the comments (which are, by definition, more verbose than the code they attempt to explain). And if you can’t trust the programmer to write good code, you can’t trust the guy to write good documentation either.</p>
<p>There are some situations where documentation <em>is</em> necessary, of course. Examples would be when you are attempting to explain the motivations or structure of your design at a larger scale, or if you want to explain what the code is <em>not</em> — why you decided to something one way and not the other.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.silentyak.com/2009/12/06/code-comments-documentation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dictionary Attack</title>
		<link>http://www.silentyak.com/2008/11/23/dictionary-attack/</link>
		<comments>http://www.silentyak.com/2008/11/23/dictionary-attack/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 07:15:38 +0000</pubDate>
		<dc:creator>RRI</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Cracking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.silentyak.com/?p=656</guid>
		<description><![CDATA[If you’re running an SSH server on a machine exposed to the Big Bad Internet, it is best to disable password authentication. Public-key authentication is a far safer option. Here’s a typical snippet of my server logs that explains why: Nov 20 10:24:01 [sshd] Invalid user backup from 203.239.105.2 Nov 20 10:24:03 [sshd] Invalid user [...]]]></description>
			<content:encoded><![CDATA[<p>If you’re running an SSH server on a machine exposed to the Big Bad Internet, it is best to disable password authentication. Public-key authentication is a far safer option. Here’s a typical snippet of my server logs that explains why:</p>
<pre style="padding-left: 10px;"><span style="color: #606060;">Nov 20 10:24:01 [sshd] Invalid user backup from 203.239.105.2
Nov 20 10:24:03 [sshd] Invalid user info from 203.239.105.2
Nov 20 10:24:04 [sshd] Invalid user shop from 203.239.105.2
Nov 20 10:24:06 [sshd] Invalid user sales from 203.239.105.2
Nov 20 10:24:07 [sshd] Invalid user web from 203.239.105.2
Nov 20 10:24:09 [sshd] Invalid user www from 203.239.105.2
Nov 20 10:24:11 [sshd] Invalid user wwwrun from 203.239.105.2
Nov 20 10:24:12 [sshd] Invalid user adam from 203.239.105.2
Nov 20 10:24:14 [sshd] Invalid user stephen from 203.239.105.2
Nov 20 10:24:15 [sshd] Invalid user richard from 203.239.105.2
Nov 20 10:24:17 [sshd] Invalid user george from 203.239.105.2
Nov 20 10:24:19 [sshd] Invalid user michael from 203.239.105.2
Nov 20 10:24:20 [sshd] Invalid user john from 203.239.105.2
Nov 20 10:24:22 [sshd] Invalid user david from 203.239.105.2
Nov 20 10:24:23 [sshd] Invalid user paul from 203.239.105.2
Nov 20 10:24:27 [sshd] Invalid user angel from 203.239.105.2
Nov 20 10:24:30 [sshd] Invalid user pgsql from 203.239.105.2</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.silentyak.com/2008/11/23/dictionary-attack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pretty Fonts</title>
		<link>http://www.silentyak.com/2008/11/04/pretty-fonts/</link>
		<comments>http://www.silentyak.com/2008/11/04/pretty-fonts/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 07:19:02 +0000</pubDate>
		<dc:creator>RRI</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.silentyak.com/?p=616</guid>
		<description><![CDATA[If you install Linux for the first time and are greeted with an ugly set of fonts - Make sure you install all the popular TrueType fonts (Microsoft’s common fonts are generally available via your distribution’s repositories). Remember to enable anti-aliasing of fonts. Anti-aliasing can be turned on through the desktop-environment’s configuration, for example, KDE’s [...]]]></description>
			<content:encoded><![CDATA[<p>If you install Linux for the first time and are greeted with an ugly set of fonts -</p>
<ol>
<li>Make sure you install all the popular TrueType fonts (Microsoft’s common fonts are generally available via your distribution’s repositories).</li>
<li>Remember to enable <em><strong>anti-aliasing of fonts</strong></em>. Anti-aliasing can be turned on through the desktop-environment’s configuration, for example, KDE’s Control Center.</li>
<li>Set the <em><strong>hinting</strong></em> to ‘medium’ while enabling anti-aliasing of fonts.</li>
<li>Change the user-interface fonts to something that looks good, like Verdana, DejaVu or Calibri. Firefox also comes with an ugly set of default fonts, so you may also want to change those defaults too.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.silentyak.com/2008/11/04/pretty-fonts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minimizing Downtime</title>
		<link>http://www.silentyak.com/2008/10/08/minimizing-downtime/</link>
		<comments>http://www.silentyak.com/2008/10/08/minimizing-downtime/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 16:26:34 +0000</pubDate>
		<dc:creator>RRI</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Downtime]]></category>

		<guid isPermaLink="false">http://www.silentyak.com/?p=559</guid>
		<description><![CDATA[Now that this site is hosted on my own server, I wanted ensure that the server is up and running most of the time. Although five 9’s is not my availability target, I needed some mechanism by which changes and updates that I made to the site were not reflected in the production website (can [...]]]></description>
			<content:encoded><![CDATA[<p>Now that this site is hosted on my own server, I wanted ensure that the server is up and running most of the time. Although five 9’s is not my availability target, I needed some mechanism by which changes and updates that I made to the site were not reflected in the production website (can I call it that?) until the right time.</p>
<p>The solution is a simple one: run a development website in parallel, so that all changes can be tested on that first. Updating the primary website would be like flipping a switch. Here’s how I managed this:</p>
<ol>
<li>Set up a new virtual host for the development site.</li>
<li>Set up a new database for the development site and populate it with existing records.</li>
<li>Update the WordPress configuration file to select a different database based on the current working directory.</li>
<li>Set up server authentication for the development website.</li>
<li>Write an <strong>init<em> </em></strong>script to copy (<em>rsync</em>) all the files from the development site to the primary one. Exclude the authentication files like <code>htpasswd</code>, of course.</li>
<li>Set up a dependency on the new script in Apache, so that restarting the service also restarts Apache (this is useful at times).</li>
</ol>
<p>It’s as simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.silentyak.com/2008/10/08/minimizing-downtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roller Skating Crash Course</title>
		<link>http://www.silentyak.com/2008/10/04/roller-skating-crash-course/</link>
		<comments>http://www.silentyak.com/2008/10/04/roller-skating-crash-course/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 18:24:27 +0000</pubDate>
		<dc:creator>RRI</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Quad Skates]]></category>
		<category><![CDATA[Roller Skating]]></category>
		<category><![CDATA[Sports]]></category>

		<guid isPermaLink="false">http://www.silentyak.com/?p=489</guid>
		<description><![CDATA[Disclaimer: I skated for the first time in my life this week, for not more than an hour. Everything I say in this post is based on personal experience, so use your own judgment before doing something silly and injuring yourself. The responsibility is all yours. The ‘quad’ roller skates are simply shoes with four [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Disclaimer:</strong> I skated for the first time in my life this week, for not more than an hour. Everything I say in this post is based on personal experience, so use your own judgment before doing something silly and injuring yourself. <em>The responsibility is all yours.</em></p>
<hr />
<p><a  href="http://www.silentyak.com/uploads/figure-roller-skates.jpg" class="thickbox no_icon" rel="gallery-489" title="Roller Skates"><img class="alignleft size-thumbnail wp-image-490" title="Roller Skates" src="http://www.silentyak.com/uploads/figure-roller-skates-150x150.jpg" alt="" width="150" height="150" /></a>The ‘quad’ roller skates are simply shoes with four wheels underneath. You wear the shoes and, instead of walking, you skate (or fall).</p>
<p>They say practice makes perfect, which is certainly true to some extent. <em>However</em>, like any other sport, there is a technique to doing it right that is far more important. Here’s a breakdown of what <em>I</em> discovered this week:</p>
<p><strong>Bend your knees<br />
</strong></p>
<p>This is true for almost any sport. Bending your knees automatically forces you into a crouching position, moving your weight <em>ahead</em> of your feet. This ensures that you don’t fall backward, which is painful and dangerous. The instinctive reaction to falling <em>forward</em> is to put one foot ahead and stop the fall, which is exactly what you need to do to start skating.</p>
<p><strong>Gather momentum</strong></p>
<p>The simplest and probably the only way to gather momentum is to put one foot ahead and put your weight on that single foot. You have your knees bent, right? The trick here is to apply pressure on the foot <em>not directly straight ahead</em> but towards the side. That is, you push your right foot forward and towards the right, and then your left foot forward and towards the left alternately. This provides some control over your motion.</p>
<div id="attachment_491" class="wp-caption aligncenter" style="width: 376px"><a  href="http://www.silentyak.com/uploads/footprints.png" class="thickbox no_icon" rel="gallery-489" title="Footprints"><img class="size-full wp-image-491" title="Footprints" src="http://www.silentyak.com/uploads/footprints.png" alt="Moving your feet" width="366" height="300" /></a><p class="wp-caption-text">Moving your feet</p></div>
<p><strong>Don’t straighten up</strong></p>
<p>…unless you know what you are doing. If you are moving slowly, it is alright to straighten up temporarily, but you need to bend your knees again before stepping again.</p>
<p><strong>Don’t put you weight on both feet</strong></p>
<p>Consider your normal walk: your front foot presses against the ground, while your back foot provides support. It’s the same principle at work here. Naturally, you can’t put pressure on both feet, otherwise your feet will drift wider and wider apart until you do the splits.</p>
<p>A possible misunderstanding by the novice is to imagine that the wheels would magically carry him ahead. In reality, the best analogy to roller skating is <em>walking</em>, except that the ground is rolling away behind you. Ergo, you need to lift up one foot at a time and place it ahead.</p>
<p><strong>P.S.</strong> — How often do you get to use the word “ergo” in your posts?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.silentyak.com/2008/10/04/roller-skating-crash-course/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Idempotence In System Architecture</title>
		<link>http://www.silentyak.com/2008/10/03/idempotence-in-system-architecture/</link>
		<comments>http://www.silentyak.com/2008/10/03/idempotence-in-system-architecture/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 08:01:30 +0000</pubDate>
		<dc:creator>RRI</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[FSM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[System Architecture]]></category>

		<guid isPermaLink="false">http://www.silentyak.com/?p=483</guid>
		<description><![CDATA[A useful paradigm that should be considered when a stateful software system is to be designed is idempotence. Leaving aside its exact definition in mathematics and computer science, idempotence can be roughly described as a system characteristic whereby, calling an operation multiple times is equivalent to doing it exactly once. For instance, setting the value [...]]]></description>
			<content:encoded><![CDATA[<p>A useful paradigm that should be considered when a stateful software system is to be designed is <em>idempotence</em>. Leaving aside its exact definition in mathematics and computer science, idempotence can be roughly described as a system characteristic whereby, calling an operation multiple times is equivalent to doing it exactly once.</p>
<p>For instance, setting the value of a variable <em>X</em> is an idempotent operation, because setting its value to be <em>Y</em> several times has the same effect as setting it just once. On the other hand, <em>incrementing</em> its value is not an idempotent method because the result depends on the number of times the operation is called.</p>
<p><strong>Implementation</strong></p>
<p>Before delving into <em>why</em> you might want to have idempotence, let’s have a look at how it can be implemented. One way of doing it is like this:</p>
<p><em><strong>Design a state machine<br />
</strong></em></p>
<p>A <a  title="FSM" href="http://en.wikipedia.org/wiki/State_machine">state machine</a> identifies every unique state that the system can exist in, with a clear indication of which states the system can transition to from any given state, and under what conditions.</p>
<p><em><strong>Design a minimal API</strong></em></p>
<p>An <a  title="API" href="http://en.wikipedia.org/wiki/API">application programming interface</a> is the gateway for external systems to interact with the service. We start by designing a <em>minimal</em> API, identifying all the methods <em>that could change the state of the system</em>. It is best not to clutter the API with non-critical methods at this stage.</p>
<p>Expressed differently, an API method represents a single transition in the state diagram. For example, a system could have states such as <em>ReadyToPurchase</em> and <em>TaxAdded</em>. The <em>addTax()</em> method, if successful, provides the transition from the first state to the second. This method can never be applied a second time, because by then the system has already moved on to the next state.</p>
<p>An important restriction on the API is that if the state has some attributes, they must be maintained meticulously and checked against incoming requests. Suppose the <em>addTax()</em> method takes a parameter called <em>amount</em>. If the method is called again with the same <em>amount</em>, then the expected response is success, since the system is indeed in a state that the function call was <em>supposed</em> to move it to. However, if <em>amount</em> is different, then the response should be a failure, or at least some kind of partial failure — otherwise, the client will assume that the <em>new</em> tax amount had been added. A state should never change its internal attributes once they have been set.</p>
<p><em><strong>Transitions should be atomic</strong></em></p>
<p>It goes without saying that transitions need to be atomic, so that multiple requests do not corrupt the state <em>while the system is transitioning</em>. This can be achieved easily by acquiring a lock on a <a  title="Mutex" href="http://en.wikipedia.org/wiki/Mutex">mutex</a> at the start of a transition, and releasing it on completion.</p>
<p><strong>Why Idempotence?</strong></p>
<p>Naturally, it is a good idea to ask why we are putting in so much effort. While this may seem inordinately complex at first, you will soon discover that such a design actually <em>simplifies</em> the system tremendously when there is a great deal of concurrency. When there are a large number of processes or threads communicating with each other and the number of messages exchanged is huge, idempotence provides a guarantee of sorts about what the system can or cannot do. The state machine approach allows you to simply worry about the system in its current state, rather than the system as a whole. As a debugging technique, the developer simply needs to say, “<em>This</em> was the previous state A, and now it has moved into this new state B — what combination of parameters caused such a transition?” Idempotence makes this approach even more robust, ensuring that the system works in the face of message duplication and errors.</p>
<p>This robustness also allows the design to sacrifice a reliable communication layer in exchange for speed. For example, TCP (which has a larger overhead) can be replaced with UDP, since the application is resilient to message loss and duplication.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.silentyak.com/2008/10/03/idempotence-in-system-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Quick GIMP Beveled Logo Guide</title>
		<link>http://www.silentyak.com/2008/10/01/a-quick-gimp-beveled-logo-guide/</link>
		<comments>http://www.silentyak.com/2008/10/01/a-quick-gimp-beveled-logo-guide/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 07:02:48 +0000</pubDate>
		<dc:creator>RRI</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Gimp]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Logo]]></category>

		<guid isPermaLink="false">http://www.silentyak.com/?p=448</guid>
		<description><![CDATA[This is the no-nonsense guide to creating your very own awesome beveled logo using GIMP, something that looks like the image shown here. There are detailed guides floating around in the series of tubes known as the Internet, but this is for those who are put off by tedious explanations and figures. Naturally, you need [...]]]></description>
			<content:encoded><![CDATA[<p><a  href="http://www.silentyak.com/uploads/favicon.png" class="thickbox no_icon" rel="gallery-448" title="Favicon"><img class="alignleft size-thumbnail wp-image-449" title="Favicon" src="http://www.silentyak.com/uploads/favicon-150x150.png" alt="" width="150" height="150" /></a>This is the no-nonsense guide to creating your very own awesome beveled logo using <a  href="http://en.wikipedia.org/wiki/GIMP">GIMP</a>, something that looks like the image shown here. There are detailed guides floating around in the series of tubes known as the Internet, but this is for those who are put off by tedious explanations and figures. Naturally, you need to be know the basics of GIMP if you want to understand this guide.</p>
<p>So here goes:</p>
<ol>
<li>Create a new image slightly larger than the desired image size with a transparent background.</li>
<li>Make a rectangular selection the size of the actual logo, convert it to a round-edged rectangle and fill the selection with the highlight color (for example, the red on the edge of the logo).</li>
<li>Duplicate the layer <em>twice</em>.</li>
<li>Fill the lowermost layer with black, and <em>blur</em> it in order to create a shadow effect. It needs to spill out from behind the main logo slightly. Scale up the layer a few pixels if requried.</li>
<li>Scale down the top most layer by around 10–15 pixels, and apply a slightly darker shade gradient to it. (for example, a darker shade of red). The gradient should be <em>subtle</em> and slightly <em>asymmetrical</em>. Blur this layer just a little, so that it merges with the middle layer which is just below it.</li>
<li>Create a new text or image layer to add your logo to the image foreground.</li>
<li>Save your file.</li>
</ol>
<p>That’s it — you’re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.silentyak.com/2008/10/01/a-quick-gimp-beveled-logo-guide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

