<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>I ♥ computer» I ♥ computer</title>
	
	<link>http://iheartcomputer.com</link>
	<description>... and I hope you ♥ this blog!</description>
	<lastBuildDate>Sat, 19 Dec 2009 16:16:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/iheartcomputer" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="iheartcomputer" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Sort packages by size on Arch Linux – Bash one-liner</title>
		<link>http://iheartcomputer.com/bash-scripting/sort-packages-size-arch-linux-bash-oneliner/</link>
		<comments>http://iheartcomputer.com/bash-scripting/sort-packages-size-arch-linux-bash-oneliner/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 16:16:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Bash scripting]]></category>

		<guid isPermaLink="false">http://iheartcomputer.com/?p=61</guid>
		<description><![CDATA[As an Arch Linux user I am pretty fond of pacman, the distro's package manager. However, it lacks the functionality of listing packages sorted by their installed size. Such a listing would be useful when freeing space on your hard drive, for example. Here is my try on writing a bash one-liner that generates the [...]]]></description>
			<content:encoded><![CDATA[<p>As an Arch Linux user I am pretty fond of pacman, the distro's package manager. However, it lacks the functionality of listing packages sorted by their installed size. Such a listing would be useful when freeing space on your hard drive, for example. Here is my try on writing a bash one-liner that generates the desired list.<span id="more-61"></span></p>
<blockquote>
<pre>paste &lt;(pacman -Q | awk '{ print $1; }' | xargs pacman -Qi | grep 'Size' | awk '{ print $4$5; }') &lt;(pacman -Q | awk '{print $1; }') | sort -n | column -t</pre>
</blockquote>
<p>The command should output a list ending in something like this:</p>
<blockquote>
<pre>...
73536.00K   kdelibs
78620.00K   xulrunner
87324.00K   qt
94400.00K   jre
97432.00K   bin32-wine
113672.00K  boost
113784.00K  kdebase-workspace
139448.00K  kernel26
202428.00K  xampp
346420.00K  openoffice-base</pre>
</blockquote>
<p>As you can see, openoffice takes the most disk space, followed by xampp and the kernel. You can use this list to get an idea of the biggest space hogs among the installed software on your system.</p>
<p><em>Did you seize the opportunity to free some disk space? Do you know a better one-liner, perhaps without repeating </em><tt>"pacman -Q | awk '{ print $1; }'"</tt><em>? <a title="Leave a comment!" href="#respond">Leave a comment</a>! And if you like this blog, why not <a title="The I ♥ computer RSS feed" href="http://feeds.feedburner.com/iheartcomputer">subscribe</a>?</em></p>
]]></content:encoded>
			<wfw:commentRss>http://iheartcomputer.com/bash-scripting/sort-packages-size-arch-linux-bash-oneliner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Column manipulation</title>
		<link>http://iheartcomputer.com/bash-scripting/column-manipulation/</link>
		<comments>http://iheartcomputer.com/bash-scripting/column-manipulation/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 20:48:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash scripting]]></category>

		<guid isPermaLink="false">http://iheartcomputer.com/?p=46</guid>
		<description><![CDATA[On the Linux command-line, columned data is used frequently. For scripting purposes, knowing how to manipulate this type of data can come in quite handy. This article lists some common operations and gives examples on how to do them.
Extract one or more columns
Sometimes you only need a single column but you get many. Let's use [...]]]></description>
			<content:encoded><![CDATA[<p>On the Linux command-line, columned data is used frequently. For scripting purposes, knowing how to manipulate this type of data can come in quite handy. This article lists some common operations and gives examples on how to do them.<span id="more-46"></span></p>
<h2>Extract one or more columns</h2>
<p>Sometimes you only need a single column but you get many. Let's use an example file containing this text as an example:</p>
<blockquote>
<pre>1  Foo    Joe
2  Bar    Tom
3  Stuff  Fred</pre>
</blockquote>
<p>To get only the second column, we can use awk, like this:</p>
<blockquote>
<pre>cat examplefile | awk '{ print $2; }'</pre>
</blockquote>
<p>Which will output:</p>
<blockquote>
<pre>Foo
Bar
Stuff</pre>
</blockquote>
<p>Easy, huh? Awk is pretty good at guessing columns. However, it lacks an easy syntax to specify column ranges. Therefore, to extract multiple columns, we use cut instead:</p>
<blockquote>
<pre>cat examplefile | tr -s ' ' | cut -d ' ' -f 2-3</pre>
</blockquote>
<p>This seems a little more complicated, so I'll explain: cut is not good at guessing columns, so we use tr to reduce the multiple spaces to single ones. Then we ask cut to output the second and third column, telling it that columns are separated by a single space.</p>
<p>Note that this does not preserve the pretty table formatting. If you want the result to be nicely lined up, let the column command fix it:</p>
<blockquote>
<pre>cat examplefile | tr -s ' ' | cut -d ' ' -f 2-3 | column -t</pre>
</blockquote>
<h2>Remove one or more columns</h2>
<p>For column removal, the cut command is most suited. We'll use this example text:</p>
<blockquote>
<pre>1  Foo    Joe   123  some
2  Bar    Tom   456  sample
3  Stuff  Fred  789  data</pre>
</blockquote>
<p>To remove the third column, we use the following command:</p>
<blockquote>
<pre>cat examplefile | tr -s ' ' | cut -d ' ' -f -2,4-</pre>
</blockquote>
<p>Which will output:</p>
<blockquote>
<pre>1 Foo 123 some
2 Bar 456 sample
3 Stuff 789 data</pre>
</blockquote>
<p>The <tt>-2</tt> means "all columns up to and including the second one", and <tt>4-</tt> means "all columns starting from the fourth". To remove multiple columns, we can adjust this range:</p>
<blockquote>
<pre>cat examplefile | tr -s ' ' | cut -d ' ' -f -2,5-
cat examplefile | tr -s ' ' | cut -d ' ' -f 1,3,5</pre>
</blockquote>
<p>The above lines remove columns 3 &amp; 4 and 2 &amp; 4, respectively.</p>
<h2>Add one or more columns</h2>
<p>To insert another column, we use the paste command. We will use the following example texts:</p>
<blockquote>
<pre>1  Foo    Joe
2  Bar    Tom
3  Stuff  Fred</pre>
</blockquote>
<p>And:</p>
<blockquote>
<pre>123
456
789</pre>
</blockquote>
<p>Adding the column all the way on the right is easy, just give the example files to paste:</p>
<blockquote>
<pre>paste examplefile1 examplefile2</pre>
</blockquote>
<p>Which outputs:</p>
<blockquote>
<pre>1  Foo    Joe   123
2  Bar    Tom   456
3  Stuff  Fred  789</pre>
</blockquote>
<p>Nice command, isn't it? Now the more complicated action: adding the new column between the old ones. Here we can use cut again:</p>
<blockquote>
<pre>paste &lt;(cat examplefile | tr -s ' ' | cut -d ' ' -f -2) examplefile2 &lt;(cat examplefile | tr -s ' ' | cut -d ' ' -f 3)</pre>
</blockquote>
<p>Quite a long line, right? What we actually do is giving paste the first two columns of examplefile1, then the column of examplefile2, then the last column of examplefile1. The <tt>&lt;(...)</tt> is just a bash syntax to give command output as a file.</p>
<h2>Swap columns</h2>
<p>For switching a pair of columns, awk has a simple syntax. The example text:</p>
<blockquote>
<pre>1  Foo    Joe
2  Bar    Tom
3  Stuff  Fred</pre>
</blockquote>
<p>To switch the first and the third column, we can use:</p>
<blockquote>
<pre>cat examplefile | awk '{ temp=$1; $1=$3; $3=temp; print; }'</pre>
</blockquote>
<p>We save the first column to a variable, copy the third column to the first, and then copy the first column to the third, using the saved version.</p>
<p><em>Are you missing an operation here that'd you'd like to see explained? Do you know a shorter way to insert a column between others? <a title="Leave a comment!" href="#respond">Leave a comment</a>! And if you like this blog, why not <a title="The I ♥ computer RSS feed" href="http://feeds.feedburner.com/iheartcomputer">subscribe</a>?</em></p>
]]></content:encoded>
			<wfw:commentRss>http://iheartcomputer.com/bash-scripting/column-manipulation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Why does OpenOffice open my document read-only?</title>
		<link>http://iheartcomputer.com/openoffice/openoffice-open-document-readonly/</link>
		<comments>http://iheartcomputer.com/openoffice/openoffice-open-document-readonly/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 19:22:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenOffice]]></category>

		<guid isPermaLink="false">http://iheartcomputer.com/?p=21</guid>
		<description><![CDATA[You might be one of the people wondering why OpenOffice nowadays gives you a read-only document if you open a file from the internet. Maybe it even prevents you from editing it. Here's a solution to that, accompanied by an explanation.
To be able to edit a document that was opened read-only, click the button similar [...]]]></description>
			<content:encoded><![CDATA[<p>You might be one of the people wondering why OpenOffice nowadays gives you a read-only document if you open a file from the internet. Maybe it even prevents you from editing it. Here's a solution to that, accompanied by an explanation.<span id="more-21"></span></p>
<div id="attachment_38" class="wp-caption alignright" style="width: 266px"><img class="size-full wp-image-38" title="readonly" src="http://iheartcomputer.com/wp-content/uploads/2009/11/readonly1.jpg" alt="The button to edit a read-only document in OpenOffice" width="256" height="116" /><p class="wp-caption-text">The button to edit a read-only document in OpenOffice</p></div>
<p>To be able to edit a document that was opened read-only, click the button similar to the one you see in the image. OpenOffice may complain a little about the object not being accessible and ask if you want to edit a copy of the document; just click Ok and Yes. Now you should be able to change the document to your heart's content.</p>
<p>The reason why OpenOffice opens your document this way is that files opened from the web are stored in a temporary location, which may be wiped any moment. If OpenOffice would just let you edit the document, you would have to save the document in a meaningful place by using File -&gt; Save as. Experience learns that users tend to forget this. Therefore, the document is opened read-only, forcing you to edit and save the file explicitly. If you know the frustration of losing hours of hard work, you also know why a feature like this is useful.</p>
<p><em>Did this post save your day? Do you know more tricks with read-only documents? <a title="Leave a comment!" href="#respond">Leave a comment</a>! And if you like this blog, why not <a title="The I ♥ computer RSS feed" href="http://feeds.feedburner.com/iheartcomputer">subscribe</a>?</em></p>
]]></content:encoded>
			<wfw:commentRss>http://iheartcomputer.com/openoffice/openoffice-open-document-readonly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tune your guitar using the command-line</title>
		<link>http://iheartcomputer.com/linux/tune-guitar-commandline/</link>
		<comments>http://iheartcomputer.com/linux/tune-guitar-commandline/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 18:57:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://localhost/local/wordpress/?p=19</guid>
		<description><![CDATA[Sometimes you need to get your guitar back to standard pitch, but you don't have a tuner ready. Fortunately, you can also tune with style using your linux command-line!
To use this method, first install the sox utility using your favorite package manager. Now you can issue the following command to produce a nice A:
play -n [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to get your guitar back to standard pitch, but you don't have a tuner ready. Fortunately, you can also tune with style using your linux command-line!<span id="more-19"></span></p>
<p>To use this method, first install the <a title="The homepage of SoX" href="http://sox.sourceforge.net/"><em>sox</em></a> utility using your favorite package manager. Now you can issue the following command to produce a nice A:</p>
<blockquote><p>play -n synth sine 220</p></blockquote>
<p>Press Ctrl + c to stop the tone. Admittedly, this way of tuning requires you to use your ears, but it does the job, doesn't it? What about this one-liner:</p>
<blockquote><p>for freq in {164.81,220,293.67,392,493.88,659.26}; do play -n synth sine $freq; done</p></blockquote>
<p>This will give you the lower E, then an A, then a D and so on until the higher E, after which it will terminate. Press Ctrl + c every time you finish tuning a string. Ain't that nice for just one line of shell script?</p>
<p>Edit: brendan fahy came up with a much nicer version of the line that should work with newer versions of sox and gives an actual guitar sound:</p>
<blockquote><p>for n in E2 A2 D3 G3 B3 E4; do play -n synth 4 pluck $n repeat 2; done</p></blockquote>
<p>Pretty nifty, isn't it?</p>
<p><em>Did you like this solution? Do you know of an even better way to tune your guitar using the command-line? <a title="Leave a comment!" href="#respond">Leave a comment</a>! And if you like this blog, why not <a title="The I ♥ computer RSS feed" href="http://feeds.feedburner.com/iheartcomputer">subscribe</a>?</em></p>
]]></content:encoded>
			<wfw:commentRss>http://iheartcomputer.com/linux/tune-guitar-commandline/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Hello and welcome!</title>
		<link>http://iheartcomputer.com/blog/hello-and-welcome/</link>
		<comments>http://iheartcomputer.com/blog/hello-and-welcome/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 15:37:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://localhost/local/wordpress/?p=14</guid>
		<description><![CDATA[If you're reading this, the website is up and running. So what's this all about, you might ask? Read the about page to find out! Anyway, I should be writing helpful articles right now, so please forgive me the short intro post.
]]></description>
			<content:encoded><![CDATA[<p>If you're reading this, the website is up and running. So what's this all about, you might ask? Read the <a title="The about page of this blog" href="http://iheartcomputer.com/about/">about page</a> to find out! Anyway, I should be writing helpful articles right now, so please forgive me the short intro post.</p>
]]></content:encoded>
			<wfw:commentRss>http://iheartcomputer.com/blog/hello-and-welcome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
