<?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>The Golden Ratio</title>
	<atom:link href="http://blog.golden-ratio.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.golden-ratio.net</link>
	<description>... of programming, life, math and all the rest</description>
	<lastBuildDate>Sun, 01 Nov 2009 16:05:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>First day of Nanowrimo</title>
		<link>http://blog.golden-ratio.net/2009/11/first-day-of-nanowrimo/</link>
		<comments>http://blog.golden-ratio.net/2009/11/first-day-of-nanowrimo/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 16:05:57 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=108</guid>
		<description><![CDATA[Finally the 1st of November has arrived, the first day of Nanowrimo. Up till today it has been a lot of fun plotting the story and seeing how it has changed during the process. The biggest change is that I first planned for the story to take place a couple of years after a civil [...]]]></description>
			<content:encoded><![CDATA[<p>Finally the 1st of November has arrived, the first day of <a href="http://www.nanowrimo.org" title="National Novel Writing Month">Nanowrimo</a>. Up till today it has been a lot of fun plotting the story and seeing how it has changed during the process. The biggest change is that I first planned for the story to take place a couple of years after a civil war, but when I was writing the background history of the Empire I realised that it would be much more exciting to place it during the build-up and start of the civial war. </p>
<p>There are still some parts of the planned story that doesn&#8217;t quite work as well as I want them to. Even after multiple changes there are parts of the main character&#8217;s traits that still seem a bit forced, and some choices he has to make that need better reasoning. My hope is that those things will solve themselves as I write and learn more about the characters and the world. </p>
<p>To finish the 50&#8242;000 words within one month I have to write 1&#8242;667 words each day on average. Since I hope to have some time for other things as well during November I&#8217;m planning on writing 2&#8242;000 words the days that I manage to write, which should free up some time for days without writing or at least writing less than 1&#8242;667 words. </p>
<p>So far today I&#8217;ve managed to write 2&#8242;246 words. It went a lot easier than I had feared. Once the first sentence was written the rest just came naturally. Hopefully I can get some more words written as well later on tonight, maybe even breach the 2&#8242;500 word count on the first day!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2009/11/first-day-of-nanowrimo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternate Xubuntu &#8211; encryption and install problems</title>
		<link>http://blog.golden-ratio.net/2009/10/alternate-xubuntu-encryption-and-install-problems/</link>
		<comments>http://blog.golden-ratio.net/2009/10/alternate-xubuntu-encryption-and-install-problems/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 13:56:56 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=102</guid>
		<description><![CDATA[The newest version of Ubuntu was just released, so I decided to do a fresh install on my laptop. 
Yesterday I installed a fresh copy of Xubuntu on my laptop. I opted to go for Xubuntu instead of the default Ubuntu since I&#8217;m going to try out a tiling window manager, specifically Xmonad, so it [...]]]></description>
			<content:encoded><![CDATA[<p>The newest version of <a href="http://www.ubuntu.com" title="Ubuntu homepage">Ubuntu</a> was just released, so I decided to do a fresh install on my laptop. </p>
<p>Yesterday I installed a fresh copy of Xubuntu on my laptop. I opted to go for <a href="http://www.xubuntu.com" title="Xubuntu homepage">Xubuntu</a> instead of the default Ubuntu since I&#8217;m going to try out a tiling window manager, specifically <a href="http://www.xmonad.org" title="Xmonad - a tiling window manager">Xmonad</a>, so it felt like a waste to install all the default Gnome applications when I won&#8217;t be using them. To make the installation even more different I installed from the Alternate CD so I could get my whole system encrypted. I probably don&#8217;t need the encryption, but it feels better to know that it is encrypted when I drag the computer around with me and keep work related stuff on it. </p>
<p>Installing from the Alternate CD almost worked as easy as it should have. It started up just fine, and in the start phase there was an option to partion and encryption the entire disk. All fine and dandy so far. The problem arrived alittle bit later when the installation process was nearing the end. During the &#8220;Setting users and password&#8221;-phase the installation suddenly stopped. I checked the <code>/var/log/syslog</code> file, and the last logged message from the installer was <code>user-setup: Done</code>, but after that nothing happened. When I tried to reinstall again the same thing happened. This time I decided to ignore the problem, and reboot from another tty-terminal. The sytem then managed to boot the new Xubuntu, and everything seems to be working fine. I&#8217;ve been using the system for a couple of hours now and I haven&#8217;t noticed anything missing. I am a bit curious about which part of the installation process I skipped over, and when that will come back and bite me. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2009/10/alternate-xubuntu-encryption-and-install-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting with Haskell</title>
		<link>http://blog.golden-ratio.net/2009/10/starting-with-haskell/</link>
		<comments>http://blog.golden-ratio.net/2009/10/starting-with-haskell/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 13:41:15 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[rwh]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=96</guid>
		<description><![CDATA[Recently I&#8217;ve taken it upon myself to learn Haskell. I haven&#8217;t had much time lately to work on programming projects at home, so I felt it was time to start something again. I decided to learn Haskell since I&#8217;ve never truly learnt a functional programming language. I&#8217;ve tried some functional programming some during a couple [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve taken it upon myself to learn <a href="http://www.haskell.org" title="Haskell homepage">Haskell</a>. I haven&#8217;t had much time lately to work on programming projects at home, so I felt it was time to start something again. I decided to learn Haskell since I&#8217;ve never truly learnt a functional programming language. I&#8217;ve tried some functional programming some during a couple of University courses, but I&#8217;ve never got to the point where I truly understood it and naturally thought of functional solution to problems. </p>
<p>To help with the learning I bought the <a href="http://book.realworldhaskell.org/read" title="Online version of Real World Haskell">Real World Haskell book</a>, and I&#8217;ve decided to do most of the exercises in the book and post my solutions to them here. </p>
<p>The first chapter didn&#8217;t have any proper programming questions of interest, so I&#8217;m skipping those and going straight to chapter two instead where we&#8217;re asked to create a <code>lastButOne</code> function that retrieves the penultimate element in a list.</p>
<p>After a bit of thinking I came up with the following solution:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">lastButOne xs <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">if</span> <span style="font-weight: bold;">null</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">tail</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">tail</span> xs<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
    <span style="color: #06c; font-weight: bold;">then</span> <span style="font-weight: bold;">head</span> xs
    <span style="color: #06c; font-weight: bold;">else</span> lastButOne <span style="color: green;">&#40;</span><span style="font-weight: bold;">tail</span> xs<span style="color: green;">&#41;</span></pre></div></div>

<p>It isn&#8217;t the most elegant solution, since it doesn&#8217;t work for empty lists, but it gets the job done. Enough to make me happy at this stage of Haskell-learning. What it does is check if the list is empty if two elements are removed; if it is then the first element in the list is the penultimate, if not it removes the first element and tries again.</p>
<p>Now I&#8217;m off to take on the third chapter, about data types and some other stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2009/10/starting-with-haskell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Queues and easier flight in Aion</title>
		<link>http://blog.golden-ratio.net/2009/10/queues-and-easier-flight-in-aion/</link>
		<comments>http://blog.golden-ratio.net/2009/10/queues-and-easier-flight-in-aion/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 14:28:56 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Aion]]></category>
		<category><![CDATA[Gaming]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=91</guid>
		<description><![CDATA[Seems that Aion has been a pretty successful start. At least if you can measure success in queue length. When I got home from work yesterday I was greeted by the follow message:

Almost 3000 people waiting to log on?! I thought the old World of Warcraft queues where bad when I had to wait an [...]]]></description>
			<content:encoded><![CDATA[<p>Seems that Aion has been a pretty successful start. At least if you can measure success in queue length. When I got home from work yesterday I was greeted by the follow message:<br />
<img src="http://blog.golden-ratio.net/wp-content/uploads/2009/09/aion-queue.png" alt="Queueing for Aion: 2879/2919" /><br />
Almost 3000 people waiting to log on?! I thought the old World of Warcraft queues where bad when I had to wait an hour. At least the queue times give me plenty of time to get others things done at home. </p>
<p>The times I have managed to log onto Aion I&#8217;ve figured out part of the problem with the strange steering while flying. In China and Korea they seem to use mouse-clicking to move, so Aion was coded for that to begin with. When they released it for the Western markets they added the option to have the mouse change the view- and movement-direction similar to how it is done in World of Warcraft and Age of Conan. But there still seems to be some bugs around this. One of them being the awkward steering while flying. <strong>The reason for the bug is that you cannot pan the camera when the mouse is hovering over the sky!</strong> Once I figured that out it all worked a bit better, since I just kept the mouse focused on my character which solved the problem. It isn&#8217;t the best solution, but it makes flying a lot easier until they fix the bug. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2009/10/queues-and-easier-flight-in-aion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preparations begin for NaNoWriMo</title>
		<link>http://blog.golden-ratio.net/2009/09/preparations-begin-for-nanowrimo/</link>
		<comments>http://blog.golden-ratio.net/2009/09/preparations-begin-for-nanowrimo/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 18:11:04 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=86</guid>
		<description><![CDATA[It is just over one month left until this year&#8217;s big writing adventure begins. I&#8217;m thinking about NaNoWriMo, or National Novel Writing Month as it is acutally called. I&#8217;ve never entered before, but I&#8217;ve thought about it a couple of times. First it was too close to my final exams, then work was to busy [...]]]></description>
			<content:encoded><![CDATA[<p>It is just over one month left until this year&#8217;s big writing adventure begins. I&#8217;m thinking about <a href="http://www.nanowrimo.org/" title="National Novel Writing Month">NaNoWriMo</a>, or <em>National Novel Writing Month</em> as it is acutally called. I&#8217;ve never entered before, but I&#8217;ve thought about it a couple of times. First it was too close to my final exams, then work was to busy during November, then some other random excuse was fabricated to justify why I didn&#8217;t enter. </p>
<p>This year I&#8217;ve decided to give a try. I&#8217;ve always loved reading books, and writing has always facinated me. My fiction writing urge used to be filled by planning roleplaying characters or sessions, but even when doing that I&#8217;ve always wanted to write a real novel &#8211; or at least a short story. The biggest hinderance to me actually writing that novel of mine has been that I never write any fiction, the stories always stays firmly locked in my head. Coming up with other stuff to fill the time has always been too easy. The plan now is that Nanowrimo will give me that extra inspiration I need to get started. </p>
<p>In anticipation of Nanowrimo I&#8217;ve already start to write a little bit each day. At least a sentence or two to get used to structuring my story ideas on paper. To begin with it took a lot of energy to sit down and get those sentences down, but lately it has been easier and easier. It has even gotten to the point wher I can&#8217;t just write two sentences, once I start writing I can see how the story should continue so I just have to write down the next bit as well. </p>
<p>That feeling of creating a story is amazing. Especially when you don&#8217;t really know what twist and turns it will take next, you just know the general direction it is going. Earlier I always found that a bit strange, how could a writer not know what was going to happen in advance? He was writing the story after all! But now that I&#8217;ve experience a little bit of it I start to see it, and appriciate the joy that it brings to writing. Giving your characters and setting enough life so that they can actually make descisions on their own. The latest example of that was when the main character in my story was going to visit his uncle. I thought he was going to live in an old appartment building, but once I started to write it felt much better for him to live in an old house just outside of the city center. A minor change, but still something I didn&#8217;t anticipate until the words had been written. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2009/09/preparations-begin-for-nanowrimo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aion &#8211; first impressions</title>
		<link>http://blog.golden-ratio.net/2009/09/aion-first-impressions/</link>
		<comments>http://blog.golden-ratio.net/2009/09/aion-first-impressions/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 14:24:56 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Aion]]></category>
		<category><![CDATA[Gaming]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=66</guid>
		<description><![CDATA[My newest interest in computer gaming is Aion. World of Warcraft is still enjoyable, but it has become a little bit stale lately so I decided to try something new.

I only had time to test Aion for a couple of hours during the open beta, so logging into the released version this week was my [...]]]></description>
			<content:encoded><![CDATA[<p>My newest interest in computer gaming is <a href="http://www.aiononline.com" title="Aion Homepage">Aion</a>. World of Warcraft is still enjoyable, but it has become a little bit stale lately so I decided to try something new.<br />
<a href="http://blog.golden-ratio.net/wp-content/uploads/2009/09/pretty-colors.png" title="A large picture of scenery in Aion"><img src="http://blog.golden-ratio.net/wp-content/uploads/2009/09/pretty-colors-mini.png" alt="Scenery in Aion" /></a></p>
<p>I only had time to test Aion for a couple of hours during the open beta, so logging into the released version this week was my first proper experience with the game. The first thing that struck me was the graphics and animations of the characters. They have done a great job with the graphics engine. It looks gorgeous, and it runs without any problems &#8211; even with a horde of characters on the screen. The animations of the characters is also amazing. When standing still in the rain for a couple of seconds your character will pull out a big leaf to hide under. If she is standing in a hot area she will pull out a little fan and wave it to cool herself down. All of these small little animations that you don&#8217;t really think about, but make it all so much more immersive than just having the characters standing around doing nothing.</p>
<p><img src="http://blog.golden-ratio.net/wp-content/uploads/2009/09/fanning.png" style="float: right" alt="Polyhymnia fanning herself" /></p>
<p>The character creation does deserve a mention as well. Most other reviews I&#8217;ve read mention it as one of the biggest pluses, but I&#8217;ve never been that fascinated with character customization. It is great that I can create a good looking character that doesn&#8217;t look like 20% of the population, but I can&#8217;t bring myself to spend much more than five minutes on character customization. I want to play this character and kill stuff, not fiddle with the size of her right eyelid!</p>
<p>Playing the game is very familiar to World of Warcraft, and most other fantasy MMOs as far as I&#8217;ve seen. Bars at the bottom with your various attack options, standard paper doll screens for equipping gear and an inventory that is way too small. Even the general actions you go through to kill a mob are the same. Aion has a bit more timings around attack animations than World of Warcraft has, but that might also be because I&#8217;m playing a melee character in Aion instead of a caster as I play in World of Warcraft. </p>
<p>When playing you do notice a couple of things that indicate that this is a new game that haven&#8217;t ironed out all of the minor bugs. Compared to the starting week of Age of Conan this game is almost flawless, but when you&#8217;re used to playing World of Warcraft that has been fine tuned for many years the little things stand out. The camera controls are a bit awkward, especially when flying. Something you can turn the camera around when holding left mouse button down, sometimes not. I&#8217;ve also had some problems with getting quest mobs to count towards quest completion. There have been a couple of other minor things as well, but nothing big enough to remove the enjoyment of the game.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2009/09/aion-first-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ressurection</title>
		<link>http://blog.golden-ratio.net/2009/09/ressurection/</link>
		<comments>http://blog.golden-ratio.net/2009/09/ressurection/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 12:36:02 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Blogging]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=62</guid>
		<description><![CDATA[Almost ten months have passed since the last post here. Winter, spring and summer gone. I&#8217;ve thought about restarting the blog countless times during that period. Either continuing where I left off with a blog focused solely on Linux and computer programming, or broadening the horizon of the blog to cover my other hobbies as [...]]]></description>
			<content:encoded><![CDATA[<p>Almost ten months have passed since the last post here. Winter, spring and summer gone. I&#8217;ve thought about restarting the blog countless times during that period. Either continuing where I left off with a blog focused solely on Linux and computer programming, or broadening the horizon of the blog to cover my other hobbies as well. </p>
<p>The fact that I haven&#8217;t written anything new here for so long indicates that the previous focus was a bit too narrow to give me enough topics to write about. Or, maybe it wasn&#8217;t too narrow, but the fact that writing a technical post like the previous ones takes a tremendous amount of time, something I seem to have less and less off. </p>
<p>But I want to blog. I enjoy writing, and I want to give something back to the internet communities that have given me so much. Wow, that came out more cheesy than planned. </p>
<p>The conclusion is at least that I&#8217;ve decided to pick up the blog again, but now I&#8217;ll write about everything that interests me &#8211; from theoretical programming to fiction writing to gaming. Hopefully this will result in me blogging more, and thus covering the topics more frequently. Though that shouldn&#8217;t be too hard, considering that my current record is about ten posts a year. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2009/09/ressurection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simplifying everyday use of SSH</title>
		<link>http://blog.golden-ratio.net/2008/12/simplifying-everyday-use-of-ssh/</link>
		<comments>http://blog.golden-ratio.net/2008/12/simplifying-everyday-use-of-ssh/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 16:01:06 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=39</guid>
		<description><![CDATA[In a previous blog post about organization of ssh connections I introduced SSHMenu. SSHMenu started out as a way to organize SSH connections in a panel applet in GNOME, and that origin is still clear when you use it &#8211; even if you use the non-GNOME version.
Edit on 8th of December: It should be noted [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous blog post about <a href="http://blog.golden-ratio.net/2008/03/30/sshmenu-easy-organization-of-ssh-connections/" title="SSHMenu - Easy Organization of SSH Connections">organization of ssh connections</a> I introduced <a href="http://sshmenu.sourceforge.net/" title="SSHMenu">SSHMenu</a>. SSHMenu started out as a way to organize SSH connections in a panel applet in GNOME, and that origin is still clear when you use it &#8211; even if you use the non-GNOME version.</p>
<p><em>Edit on 8th of December: It should be noted that the ssh configuration described in this post doesn&#8217;t interfere with SSHMenu in any way. So it is possible to have both options available, command line execution for the standard ssh sessions and SSHMenu for those occasions where the extra features supplied are required.</em></p>
<p>Lately I have been trying to make my work sessions in front of the computer as mouse-less as possible. Creation of SSH sessions is an action I do frequently, so I had to find something else than SSHMenu assist me with those actions. SSHMenu worked fine, but it did require using the  mouse for interaction.</p>
<p>I decided to go back to standard command line based SSH usage. Some research into the SSH programs supplied by the default Ubuntu installation showed that all the features I required was available with a little bit of configuration.</p>
<h3>Passwordless login</h3>
<p><em>Edit on 8th of December: As pointed out by <a href="http://blog.golden-ratio.net/2008/12/07/simplifying-everyday-use-of-ssh/#comment-129">Grant McLean</a> in the comments the following setup for password less login works perfectly fine with SSHMenu as well, so everyone should take a look at it to make their everyday computer use easier.</em></p>
<p>The first step was to enable password less login, since retyping (and remembering) passwords on a dozen different servers is very tedious. The programs needed for this is installed by default on almost every *nix system, they are <code>ssh-keygen</code> and <code>ssh-add</code>. </p>
<p>To create the login key which will replace our password we need to use <code>ssh-keygen</code>. This is a very simple program that creates a set of keys, one public and one private, required to login on remote servers. This key combination is password protected so even if someone else gets hold of your keys they won&#8217;t be able to use them without cracking your password. The first step in creating your keys is to issue the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa</pre></div></div>

<p>It is possible to specify <code>dsa</code> instead of <code>rsa</code> as key type, but <code>rsa</code> showed to be the stronger one from my research. Following that a series of questions about storage location and passphrase will be asked. A stanard key generation session will look as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa
Generating public<span style="color: #000000; font-weight: bold;">/</span>private rsa key pair.
Enter <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">which</span> to save the key <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>michael<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa<span style="color: #7a0874; font-weight: bold;">&#41;</span>:
Enter passphrase <span style="color: #7a0874; font-weight: bold;">&#40;</span>empty <span style="color: #000000; font-weight: bold;">for</span> no passphrase<span style="color: #7a0874; font-weight: bold;">&#41;</span>:
Enter same passphrase again:
Your identification has been saved <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>michael<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.
Your public key has been saved <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>michael<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub.
The key fingerprint is:
f6:<span style="color: #000000;">61</span>:a8:<span style="color: #000000;">27</span>:<span style="color: #000000;">35</span>:cf:4c:6d:<span style="color: #000000;">13</span>:<span style="color: #000000;">22</span>:<span style="color: #000000;">70</span>:cf:4c:c8:a0:<span style="color: #000000;">23</span> michael<span style="color: #000000; font-weight: bold;">@</span>hyrule</pre></td></tr></table></div>

<p>In this session I decided to use the default storage location, so I just pressed enter when asked about that. For the passphrase I did enter a password, but as usual no characters were printed as I typed it. As we see from line 6 and 7 two files were created, <code>.ssh/id_rsa</code> and <code>.ssh/id_rsa.pub</code>. </p>
<p>The <code>.ssh/id_rsa</code> is your private key file. This file should be kept secret, since it is used to authenticate you when you log in on the remote server.</p>
<p>The <code>.ssh/id_rsa.pub</code> contains your public key which will be registered on the servers you want to login on. As such this key file can be made public without a negative effect on your security. Having this file, or at least the contents of it, public will also make it easier for server administrators to give you ssh access. There are two standards way to register your authentication key on a remote machine. </p>
<p>The first way is to use the <code>ssh-copy-id</code> command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ssh-copy-id <span style="color: #660033;">-i</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub user<span style="color: #000000; font-weight: bold;">@</span>remote.com</pre></div></div>

<p>This command will register the <code>~/.ssh/id_rsa.pub</code> on your account on the remote machine (<code>user@remote.com</code>).</p>
<p>The manual way of doing the job of the <code>ssh-copy-id</code> is a bit more work, but still very easy. First you have to log in on the remote machine. Then you need to open the <code>~/.ssh/authorized_keys</code>. At the end of this file (or on the first line if you just created the file) you should append the contents of your local <code>~/.ssh/id_rsa.pub</code> file. This should be a single line filled with lots of random characters, though the first word should be <em>ssh-rsa</em> and the last word should be your local username and computer name.</p>
<p>Once that is done you should now be able to log in on that remote server without using your password on that server, instead you&#8217;ll be asked for the passphrase used when you created you <em>ssh-rsa</em> key. This doesn&#8217;t really help much though, you only have to remember one password for all your ssh servers but you still have to type it when you log in. As with every tedious work process there is a way to automate this on Linux. The magic command for this is <code>ssh-add</code>. </p>
<p>The <code>ssh-add</code> command without any paramters will add your private keys to the current <code>ssh-agent</code> session. On Ubuntu the <code>ssh-agent</code> session is started by default, but on other system you&#8217;ll have to execute that command yourself when you log in. When you run the <code>ssh-add</code> command you&#8217;ll be asked for the password for each personal key registered. If you didn&#8217;t have any keys when you started reading this post you&#8217;ll only be asked for the password for a single key. From now on you should be able to log in on your remote server without needing to enter any passwords. </p>
<p>For each remote server you need access to you should register your ssh key using the <code>ssh-copy-id</code> command. This will enable you to log into them without enter a password once you have run the <code>ssh-add</code> command. I&#8217;ve setup my system to run the <code>ssh-add</code> command when I start Ubuntu, so once I have typed the password once I can create SSH sessions without typing another password. </p>
<h3>Shorthand for adresses, ports and other stuff</h3>
<p>We are now able to log in on any remote server without typing our password, but still we need to remember the various host names, different usernames and possibly strange port numbers. To alleviate this problem you can register the hosts in your local <code>~/.ssh/config/</code> file. This file can contain a list of ssh hosts, and specialized options for each one. An entry for a single host looks as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Host <span style="color: #000000; font-weight: bold;">*</span>test01
HostName test01.web.com
User testman
Port <span style="color: #000000;">4022</span></pre></div></div>

<p>The first line defines the local name given to the host settings that are following, in this case the name is <code>test01</code>. Here I have registered the host name of the server (<code>test01.web.com</code>), my username on that server (<code>testman</code>) as well as a custom port (<code>4022</code>) to use. The only line required is the <code>Host *...</code> to give the settings a local name, and the <code>HostName ...</code> line to tell what server to log into.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> test01</pre></div></div>

<p>The above command is now all that is needed to log in on the remote server, with the username, host adress and port number defined in the <code>~/.ssh/config</code> file. Assuming we have run the <code>ssh-copy-id</code> command with that server as target we won&#8217;t even be asked for a password when we log in. Adding more servers to the <code>~/.ssh/config</code> file is as easy as adding more blocks similar to the first one, one after another. There are also other options available to set for each server, but the ones gives above are the only ones I&#8217;ve found usefull so far. </p>
<p>Another nice thing bonus with setting up SSH this is that <code>scp</code> inherits the same configuration, so copying files between remote computers becomes (almost) as easy as copying files locally.</p>
<p>With all of this done we can now write our password once per session (thanks to <code>ssh-agent</code>), and then log on to costum ssh servers using a costum name which is easy to remember. No more remembering special information about each and every server used!</p>
<p class="simpletags">Technorati Tags: <a href="http://technorati.com/tag/ssh" rel="tag">ssh</a>, <a href="http://technorati.com/tag/linux" rel="tag"> linux</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2008/12/simplifying-everyday-use-of-ssh/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ctags for PHP 5</title>
		<link>http://blog.golden-ratio.net/2008/11/ctags-for-php-5/</link>
		<comments>http://blog.golden-ratio.net/2008/11/ctags-for-php-5/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 22:45:46 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[ctags]]></category>
		<category><![CDATA[php 5]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=29</guid>
		<description><![CDATA[In an earlier post I wrote about how to use Ctags with Vim. Unfortunately ctags doesn&#8217;t support PHP 5 yet. The creators of ctags anticipated a scenario of unknown languages, so they made it easy to customize the parsing behaviour.  A blog post about a similar solution can be found at the Phly, boy, [...]]]></description>
			<content:encoded><![CDATA[<p>In an earlier post I wrote about how to use <a href="http://blog.golden-ratio.net/2008/09/16/using-ctags-with-vim/" title="Using Ctags with Vim">Ctags with Vim</a>. Unfortunately ctags doesn&#8217;t support PHP 5 yet. The creators of ctags anticipated a scenario of unknown languages, so they made it easy to customize the parsing behaviour.  <em>A blog post about a similar solution can be found at the <a href="http://weierophinney.net/matthew/archives/134-exuberant-ctags-with-PHP-in-Vim.html">Phly, boy, phly</a> blog.</em></p>
<p>The main feature available to make this possible is the <code>--regex-&lt;LANG&gt;=/<em>regex</em>/<em>replacement</em>/<em>flag</em></code> option. The <code>LANG</code> is replaced with the language name of your choice, <code><em>regex</em></code> is a standard regex for finding the function or class name, <code><em>replacement</em></code> is the name we will associate with the tag (usually the name captured in the regex part). The last <code><em>flag</em></code> part is used to give meta information about the search &#8211; in this case either <code>c</code> for class or <code>f</code> for function.</p>
<p>Instead of going around and remember the usage of that option, as well as the other ones needed, I created little script, <code>ctags_php</code>, to do it all for me. The code for the script is given below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">pushd</span> . 
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-lt</span> <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;usage: $0 &lt;path to project base dir&gt; &lt;ctags file name&gt;&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> $<span style="color: #000000;">1</span>
ctags-exuberant <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.vim<span style="color: #000000; font-weight: bold;">/</span>tags<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #000000;">2</span> \
<span style="color: #660033;">-h</span> <span style="color: #ff0000;">&quot;.php&quot;</span> <span style="color: #660033;">-R</span> \
<span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;\.svn&quot;</span> \
<span style="color: #660033;">--totals</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> \
<span style="color: #660033;">--tag-relative</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> \
<span style="color: #660033;">--PHP-kinds</span>=+cf \
<span style="color: #660033;">--regex-PHP</span>=<span style="color: #ff0000;">'/abstract class ([^ ]*)/\1/c/'</span> \
<span style="color: #660033;">--regex-PHP</span>=<span style="color: #ff0000;">'/interface ([^ ]*)/\1/c/'</span> \
<span style="color: #660033;">--regex-PHP</span>=<span style="color: #ff0000;">'/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Ctags-file for $1 saved to $2&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">popd</span></pre></td></tr></table></div>

<p>Usage of the script is very simple. If the base path of my project files are at <code>/home/michael/project/world_domination</code> I would use the follow to index all of the files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ctags_php <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>michael<span style="color: #000000; font-weight: bold;">/</span>project<span style="color: #000000; font-weight: bold;">/</span>world_domination world_domination</pre></div></div>

<p>First argument is the path to the project, and the second part is the name given to the ctags file which is later stored in <code>~/.vim/tags</code>. It is important that the <code>~/.vim/tags/</code> directory is created before running the script, otherwise it won&#8217;t work. To load those tags into Vim I would then use <code>:set tags=~/.vim/tags/world_domination</code>.</p>
<p>You might also noticed that I&#8217;m piping the error output from the <code>ctags-exuberant</code> command to <code>/dev/null</code>. This is because it has a tendency to create some annoying errors about invalid references that I&#8217;ve been unable to remove. Luckily they can safely be ignored. If the script doesn&#8217;t give the proper tags, you might want to remove the <code>2&gt; /dev/null</code> parts so you can read through the error messages to discern the reason. </p>
<p class="simpletags">Technorati Tags: <a href="http://technorati.com/tag/ctags" rel="tag">ctags</a>, <a href="http://technorati.com/tag/php" rel="tag"> php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2008/11/ctags-for-php-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Ctags with Vim</title>
		<link>http://blog.golden-ratio.net/2008/09/using-ctags-with-vim/</link>
		<comments>http://blog.golden-ratio.net/2008/09/using-ctags-with-vim/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 21:45:53 +0000</pubDate>
		<dc:creator>Michael Plikk</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[ctags]]></category>

		<guid isPermaLink="false">http://blog.golden-ratio.net/?p=22</guid>
		<description><![CDATA[An important feature that all modern IDEs have is the ability to go directly to the definition of a function, or class, from where it is used. This feature is naturally available in Vim as well. 
Vim doesn&#8217;t have any built-in project feature, so an external program has to be used to create the function [...]]]></description>
			<content:encoded><![CDATA[<p>An important feature that all modern IDEs have is the ability to go directly to the definition of a function, or class, from where it is used. This feature is naturally available in Vim as well. </p>
<p>Vim doesn&#8217;t have any built-in project feature, so an external program has to be used to create the function and class list used. The program used for this is <a href="http://ctags.sourceforge.net/" title="ctags man page">ctags</a>. As input it takes a bunch of source files, and it will output a <code>tags</code> file which can then be loaded by Vim. Ctags has support for a lot different languages as default, and when required the search patterns can be extended with regular expressions. In <a href="http://blog.golden-ratio.net/2008/11/05/ctags-for-php-5/" title="Ctags for PHP 5">Ctags for PHP 5</a> I explain how to use these options to support PHP 5&#8217;s object oriented syntax.</p>
<p>The default use of ctags is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ctags <span style="color: #660033;">-Ro</span> project.tags <span style="color: #000000; font-weight: bold;">*</span>.py</pre></div></div>

<p>The <code>-R</code> option tells ctags to search for files recursively while the <code>-o</code> option implies that the file name following is the output file. The last part, <code>*.py</code>, is a standard file search &#8211; which in this case will find all the python files. </p>
<p>Once the tag-file has been created we need to load it into Vim. This is done by issuing the <code>:set tags=/path/to/project.tags</code>. After that Vim knows which words are associated with already defined functions and classes, and where those definitions can be found.</p>
<p>Jumping from the usage to the definition is done with the <code>CTRL-]</code> command when you have the cursor over the word you which to search for. The opposite command of this that I recently found was the <code>CTRL-T</code>, which will take you back to the previous place you used the <code>CTRL-]</code> command. </p>
<p>So if you have three functions, <code>a()</code> which calls <code>b()</code>, which again calls <code>c()</code>. For instance:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> a<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    b<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> b<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    c<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> c<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;do fancy stuff!&quot;</span></pre></td></tr></table></div>

<p>With the cursor on <code>b()</code> on line 2 we can use <code>CTRL-]</code> to go to line 4, where <code>b()</code> is defined. Once there we can either use <code>CTRL-T</code> to go back to <code>a()</code> and line 2, or we can use move the cursor to the <code>c()</code> part of line 5 and press <code>CTRL-]</code> to find the definition of <code>c()</code>. When we have found <code>c()</code> in this manner we can use <code>CTRL-T</code> two times to return to <code>a()</code>, the first usage takes us to <code>b()</code> (line 5) and the second usage puts us back in <code>a()</code> (line 2) where we began. </p>
<p>As I had been programming for quite a while without using these features it took me a while for them to become second nature. But now that I&#8217;ve become to used them they save a lot of time, especially when jumping between different files in a large project. </p>
<p class="simpletags">Technorati Tags: <a href="http://technorati.com/tag/vim" rel="tag">vim</a>, <a href="http://technorati.com/tag/ctags" rel="tag"> ctags</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.golden-ratio.net/2008/09/using-ctags-with-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

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