<?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>Katipo Developers Blog &#187; kieran</title>
	<atom:link href="http://blog.katipo.co.nz/author/kieran/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.katipo.co.nz</link>
	<description></description>
	<lastBuildDate>Fri, 04 Jun 2010 02:39:27 +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>Kakama Technical Overview</title>
		<link>http://blog.katipo.co.nz/2010/06/04/kakama-technical-overview/</link>
		<comments>http://blog.katipo.co.nz/2010/06/04/kakama-technical-overview/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 02:39:27 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=122</guid>
		<description><![CDATA[I&#8217;ve just posted a technical overview of how Kakama functions. You can view it at Kakama.org
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just posted a technical overview of how Kakama functions. You can view it at <a href="http://kakama.org/en/documentation/topics/show/18-how-kakama-works-a-quick-technical-overview">Kakama.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2010/06/04/kakama-technical-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using git feature branches to make your master branch commits list concise</title>
		<link>http://blog.katipo.co.nz/2010/03/18/using-git-feature-branches-to-make-your-master-branch-commits-list-concise/</link>
		<comments>http://blog.katipo.co.nz/2010/03/18/using-git-feature-branches-to-make-your-master-branch-commits-list-concise/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 23:18:37 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[commits]]></category>
		<category><![CDATA[squash]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=112</guid>
		<description><![CDATA[When you&#8217;re starting off, it&#8217;s fairly easy to commit to the master branch. But once your application is released, you probably want to keep things stable on the master branch. So use feature branches.

You do all your work in a feature branch, then pull it into the master branch. There are numerous topics on the [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re starting off, it&#8217;s fairly easy to commit to the master branch. But once your application is released, you probably want to keep things stable on the master branch. So use feature branches.</p>
<p><span id="more-112"></span></p>
<p>You do all your work in a feature branch, then pull it into the master branch. There are numerous topics on the web for this.</p>
<p>But there is a problem with this approach. When you run `git pull origin my_branch`, you end up creating merge commits. Some get around this with `git rebase`, but then you end up rewriting commit shas. So how do you get a clean history without messing up the master branch?</p>
<p>Use `&#8211;squash`. Here is a simplified example:</p>
<pre>
<div class="codesnip-container" >git checkout -b my_branch
touch File1
git commit -a -m "File 1"
touch File2
git commit -a -m "File 2"
git push origin my_branch
git checkout master
git pull --squash origin my_branch
git commit -a -m "File 1 and 2"</div>
</pre>
<p>Note the last two steps. We use &#8211;squash to compact the feature branch commits. This leaves all changes in the other branch in an uncommitted state (which you can then do one final review on). We then go ahead and make a commit.</p>
<p>The result? One commit in master, containing all code from the feature branch.</p>
<p>Now, the caveat: If you have multiple developers who made commits on this branch, you probably want to leave the commits apart for credits sake. But if you&#8217;re the only one who&#8217;s committed, and you don&#8217;t mind squashing the history, this works great!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2010/03/18/using-git-feature-branches-to-make-your-master-branch-commits-list-concise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three ways to increase New Relic RPM&#8217;s usefulness</title>
		<link>http://blog.katipo.co.nz/2010/03/03/three-ways-to-increase-new-relic-rpms-usefulness/</link>
		<comments>http://blog.katipo.co.nz/2010/03/03/three-ways-to-increase-new-relic-rpms-usefulness/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 04:13:07 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[new relic]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rpm]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=104</guid>
		<description><![CDATA[Three recent and little known features of New Relic RPM which help increase usefulness.]]></description>
			<content:encoded><![CDATA[<p>Here at Katipo, we&#8217;re using New Relic RPM to monitor our deployed <a href="http://kete.net.nz">Kete</a> applications, to help make things as fast as possible. In order to make New Relic as useful as possible, I&#8217;ve been trying out three New Relic RPM features, some available in only the latest versions of RPM, on one of those sites. These recent and little-known features aren&#8217;t enabled by default, so I&#8217;m going to run you through them and how to set them up in this post.</p>
<p>If you don&#8217;t yet use New Relic RPM, you can get a Lite account for free by going to <a href="http://newrelic.com">newrelic.com</a>, where you can also test drive New Relic RPM on a real application. <span id="more-104"></span></p>
<p><strong>Custom request parameters</strong></p>
<p>New Relic does it&#8217;s best to record as much information about the current request as possible. The URL, split down into controller, action, id etc, the request referrer, GET and POST data&#8230;. but there is data that it doesn&#8217;t know about. Things like the current locale, the user who is currently logged in, or custom session params. Thankfully, there is a solution.</p>
<p>New Relic RPM contains a method for adding custom data to each transaction or error that is sent to it&#8217;s servers. Utilize this method inside of a before_filter in your application controller, and you&#8217;ll be gathering that extra data in no time. Here is the code we use.</p>
<blockquote>
<pre># Collect additional debug details for New Relic RPM is available
# Do this after all other before filters so details are present
before_filter :set_new_relic_custom_parameters
def set_new_relic_custom_parameters
  return unless defined?(NewRelic)
  NewRelic::Agent.add_custom_parameters(
    :locale =&gt; (I18n.locale if I18n.locale),
    :account =&gt; (logged_in? ? current_user.login : 'guest'),
    :return_to =&gt; (session[:return_to] if session[:return_to])
  )
end
private :set_new_relic_custom_parameters</pre>
</blockquote>
<p>Now, whenever RPM sends information about slow web requests or error reports, you&#8217;ll have more data to help replicate the issue.</p>
<p><strong>Passenger Queue Wait</strong></p>
<p>Sometimes the slowness might not be your app, but your app server. How do you tell if it&#8217;s serving requests fast enough? New Relic RPM now has the ability to report how long your visits were waiting in the &#8216;queue&#8217;, that is, the time between requesting the site and Apache actually processing that request. Getting this working is fairly simple.</p>
<blockquote><p>RequestHeader set X-REQUEST_START &#8220;%t&#8221;</p></blockquote>
<p>Simply set that in either your main apache.conf file, the VirtualHost directive, or a Directory directive.</p>
<p>Also, ensure that the headers Apache module is enabled. On Debian, you can do this by running the following as root.</p>
<blockquote><p># a2enmod headers</p></blockquote>
<p>That&#8217;s all it takes. Now, when RPM sends along information, it&#8217;ll send how long each request stayed in the queue, and display it at New Relic RPM&#8217;s web interface, on all graphs as &#8216;Queue Wait&#8217;. This should give you an indication of whether your application server is performing well.</p>
<p><span style="text-decoration: underline;"><span style="color: #000000;">Important Note:</span></span> If you run your application across multiple machines, each machine needs this header, and the clock on each machine must be synced with NTP or similar, or you&#8217;ll end up with very incorrect queue times. Users who run the entire site off one box need not worry about this issue.</p>
<p><strong>Garbage Collection delays</strong></p>
<p>I&#8217;m not going to go into much detail about Ruby Garbage collection here. Google &#8216;Ruby Garbage Collection&#8217; if you want to know more. Put simply though, in Ruby, while Garbage Collection runs, it stops the processing of your app. This could lead to slow page requests if it garbage collector, or GC, runs multiple times in the same request.</p>
<p>There are ways to tweak this using settings, but how do you know if it&#8217;s a problem to begin with? If you use Ruby Enterprise Edition, or another version of Ruby with the Railsbench GC patches compiled in, then all you need is the following line in your application.</p>
<blockquote><p>GC.enable_stats if defined?(GC) &amp;&amp; GC.respond_to?(:enable_stats)</p></blockquote>
<p>For Ruby on Rails users, you can stick that at the bottom of your config/environment.rb file. Basically, if GC is defined, and responds to the correct method, then use it. RPM will send this information back to New Relic, where you can view how long GC took in each of your requests, and deal with it accordingly.</p>
<p><strong>Conclusion</strong></p>
<p>Well, that&#8217;s all for now. Please feel free to share any additional features which help make New Relic even more useful in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2010/03/03/three-ways-to-increase-new-relic-rpms-usefulness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating from Github to Gemcutter</title>
		<link>http://blog.katipo.co.nz/2010/01/19/migrating-from-github-to-gemcutter/</link>
		<comments>http://blog.katipo.co.nz/2010/01/19/migrating-from-github-to-gemcutter/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 02:53:29 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[gemcutter]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=100</guid>
		<description><![CDATA[Quick quote to migrating your gem list from Github to Gemcutter, the newest (and soon, only) gem hoster on the scene.]]></description>
			<content:encoded><![CDATA[<p>For those of you who follow this sort of thing, <a href="http://github.com">Github</a> shut down their gem building. Thankfully, a newer and easier gem hoster, <a href="http://gemcutter.org">Gemcutter</a>, appeared on the scene not long before that happened. The idea behind it, for those who haven&#8217;t heard of it, is that you manage your own gem building. Gemcutter doesn&#8217;t wait for your Gem spec to change before it makes a new gem. You simply build it locally, and push it to Gemcutter, using a handy gem they provide that extends Rubygems &#8216;gem&#8217; console command.</p>
<p>But Github was building gems for some time, and due to it&#8217;s continuing popularity, many well known Ruby on Rails developers and companies switched permanently to Github for their gem building/hosting at the time, so it&#8217;s likely that quite a few gems you&#8217;ve got installed are from Github.</p>
<p>To help transition over from Github to Gemcutter, <a href="http://github.com/maxim">Maxim Chernyak</a> wrote a great utility called <a href="http://github.com/maxim/off_github">off_github</a>, which looks at your list of gems, and tells you which ones you&#8217;re installed from Github, and whether they can be reinstalled from Gemcutter. It saves a lot of time and effort  than having to do it manually. So here&#8217;s how to get started&#8230;.</p>
<p><span id="more-100"></span>Firstly, lets get the latest version of Rubygems. This may not be needed for the off_github gem to function, but it pays to keep this up to date to prevent any issues with newer gems. Usually, you&#8217;ll want Rubygems version 1.3.0 or higher. At the time of this post, the current version is 1.3.5.</p>
<blockquote><p>$ gem &#8211;version<br />
1.2.1<br />
$ [sudo] gem update &#8211;system<br />
&#8230;&#8230;<br />
$ gem &#8211;version<br />
1.3.5</p></blockquote>
<p>Once that&#8217;s done, install the off_github gem. To do that, add Gemcutter as a source and run the gem install command.</p>
<blockquote><p>$ gem sources -a http://gemcutter.org<br />
$ [sudo] gem install off_github</p></blockquote>
<p><strong>Note: </strong>Rubyforge gems now points to Gemcutter, so the gem source adding isn&#8217;t technically needed to install off_github. That said, the off_github gem still checks for the Gemcutter source (it&#8217;s a bit outdated) and won&#8217;t work without it, so to get around it, install it before running, and you can remove it afterwards.</p>
<p>Now go ahead and run the off_github command. If you don&#8217;t use sudo to install gems, then be sure to add &#8211;no-sudo the end.</p>
<blockquote><p>$ off_github [--no-sudo]</p></blockquote>
<p>This&#8217;ll go ahead and return a list of gems that were installed from Github, what there Gemcutter gem name is, and the action it&#8217;ll take on that gem (usually reinstall). It&#8217;ll then ask you if you want to install. Type &#8216;Y&#8217;, hit enter, and then choose y/n/a at each prompt.</p>
<p>If everything went smoothly, you&#8217;re all done. You can now go ahead and delete both the Github and Gemcutter sources.</p>
<blockquote><p>$ gem sources -r http://gems.github.com<br />
$ gem sources -r http://gemcutter.org</p></blockquote>
<p>So know, you should have Rubyforge as your only gem source.</p>
<blockquote><p>$ gem sources<br />
*** CURRENT SOURCES ***<br />
http://gems.rubyforge.org</p></blockquote>
<p><strong>Additional Material:</strong></p>
<ul>
<li><a href="# http://www.rubypulse.com/episode-0.16_off_github.html">http://www.rubypulse.com/episode-0.16_off_github.html</a></li>
<li><a href="# http://www.rubypulse.com/episode-0.16.1_off_github_revisited.html">http://www.rubypulse.com/episode-0.16.1_off_github_revisited.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2010/01/19/migrating-from-github-to-gemcutter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE7 and IE8 cannot support URI&#8217;s with underscores</title>
		<link>http://blog.katipo.co.nz/2009/09/28/ie7-and-ie8-cannot-support-uris-with-underscores/</link>
		<comments>http://blog.katipo.co.nz/2009/09/28/ie7-and-ie8-cannot-support-uris-with-underscores/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 23:19:14 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=93</guid>
		<description><![CDATA[Stumbled upon this. If you&#8217;re going to make a URI (domain or sub domain) with an underscore, think twice. IE7 and IE8 do not support these URI&#8217;s when dealing with cookies.
For more details, see this blog post, detailing the symptoms.
http://blog.patrick-morgan.net/2008/09/problems-with-ie7-sessions-not-saved-in.html
]]></description>
			<content:encoded><![CDATA[<p>Stumbled upon this. If you&#8217;re going to make a URI (domain or sub domain) with an underscore, think twice. IE7 and IE8 do not support these URI&#8217;s when dealing with cookies.</p>
<p>For more details, see this blog post, detailing the symptoms.</p>
<p><a href="http://blog.patrick-morgan.net/2008/09/problems-with-ie7-sessions-not-saved-in.html">http://blog.patrick-morgan.net/2008/09/problems-with-ie7-sessions-not-saved-in.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2009/09/28/ie7-and-ie8-cannot-support-uris-with-underscores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have fun testing your application with Cucumber</title>
		<link>http://blog.katipo.co.nz/2009/09/04/having-fun-testing-your-application-with-cucumber/</link>
		<comments>http://blog.katipo.co.nz/2009/09/04/having-fun-testing-your-application-with-cucumber/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 04:13:40 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=73</guid>
		<description><![CDATA[My experience with Cucumber. It's simple and has such a flexible style of feature testing, that writing tests hasn't been easier!]]></description>
			<content:encoded><![CDATA[<p>When I started on a new Ruby on Rails project at Katipo Communications, I evaluated a range of testing libraries, and decided on <a href="http://cukes.info/">Cucumber</a>. It&#8217;s simple and has a flexible style of feature testing. For more info about it, see the <a href="http://wiki.github.com/aslakhellesoy/cucumber">Cucumber Wiki Documentation</a>. In this post, I&#8217;ll detail some of my experiences with it for other developers who are considering using it.</p>
<p><span id="more-73"></span></p>
<p><strong>Experience with Cucumber</strong></p>
<p>Cucumber has been working out really well, and was very easy to get started with.</p>
<pre>
<div class="codesnip-container" >sudo gem install cucumber
cd ~/Work/app
script/generate cucumber</div>
</pre>
<p>That&#8217;ll install a new environment with the config.gem lines needed. It&#8217;ll also setup a features directory. Open that up, and start writing specs for your app. Simple!</p>
<p>Once I had all the basic step definitions for logging in, logging out, and various paths setup for login page, homepage, etc, writing new features was fairly easy, and executing them is just as easy (rake cucumber). Take for example, the following feature relating to session management.</p>
<pre>
<div class="codesnip-container" >Scenario: Login with correct details
  When I go to login
  And I fill in "Username" with "jane"
  And I fill in "Password" with "test"
  And I press "Login"
  Then I should see "Successfully logged in."</div>
</pre>
<p>Very straightforward and easy to read. And as such, the natural language of it means clients and other developers are able to see exactly what has been implemented, and that it is working as expected.</p>
<p>It&#8217;s running the entire test suite is fairly fast too (granted, it&#8217;s still quite small). I&#8217;m testing the core functionality of the new application so far, and it only takes ~40s to run all the features when using &#8216;progress&#8217; output (the  F..F..E  style output that test/unit does). The more verbose &#8216;pretty&#8217; output is nice, but quickly fills the terminal, so very easy to miss errors as they happen until the end, and also adds processing time (10s cut off when I switched to progress mode).</p>
<p>At one point in development, I had to test outgoing emails. Thankfully, Cucumber has a really great addition, called <a href="http://github.com/bmabey/email-spec">email-spec</a> by Ben Mabey. Writing a Cucumber feature for these emails was painless. Here is a snippet from one of the password reset features.</p>
<pre>
<div class="codesnip-container" >Scenario: Request Reset with correct email
  When I request a password reset for "example@example.com"
  Then I should receive an email
  When I open the email
  And I follow "Continue to reset your password" in the email
  Then I should see "Change My Password"</div>
</pre>
<p>I&#8217;ve made a few contributions to the email-spec project, which have been included in the latest release, enabled email testing for people other than yourself  ( When they open the email&#8230; Then they should see &#8230;  etc). Makes writing tests even easier.</p>
<p><strong>Other Thoughts</strong></p>
<p>I did find that you duplicate a lot when it comes to adding paths because Cucumber is framework independent. For example, if you have a &#8216;<em><strong>map.resources :events</strong></em>&#8216; Cucumber won&#8217;t provide you with paths like &#8216;the events index&#8217; or &#8216;add a new event&#8217; automatically. Would make a handy Cucumber addition though. In addition, because Cucumber uses Webrat, which has no idea how to interact with Javascript, you still need to fall back to the slow Selenium testing if you&#8217;re application relies on Javascript.</p>
<p><strong>Conclusion</strong></p>
<p>Cucumber has been really great and I&#8217;m happy to keep using it. If you&#8217;ve used Cucumber before, or are going to try it, or perhaps your didn&#8217;t like it and went with something else, let me know in the comments. I&#8217;m always happy to hear other peoples experiences.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2009/09/04/having-fun-testing-your-application-with-cucumber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collecting a list of current MySQL index in a database</title>
		<link>http://blog.katipo.co.nz/2008/09/11/collecting-a-list-of-current-mysql-index-in-a-database/</link>
		<comments>http://blog.katipo.co.nz/2008/09/11/collecting-a-list-of-current-mysql-index-in-a-database/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 02:45:52 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=51</guid>
		<description><![CDATA[In MySQL, there is an easy way to get all index of a particular table.
SHOW INDEX FROM table_name;
But what if you want to list all index&#8217;s from all tables in a database so you can find out what you have and where you&#8217;re missing some? If you have 20 or more tables it&#8217;ll get tiring [...]]]></description>
			<content:encoded><![CDATA[<p>In MySQL, there is an easy way to get all index of a particular table.</p>
<blockquote><p>SHOW INDEX FROM table_name;</p></blockquote>
<p>But what if you want to list all index&#8217;s from all tables in a database so you can find out what you have and where you&#8217;re missing some? If you have 20 or more tables it&#8217;ll get tiring after a while running the SHOW INDEX command on each.</p>
<p>Thankfully, the information is stored in another table MySQL uses called information_schema. You can get a list of all the index&#8217;s, along with the table name and field names, by running the following (change &#8220;your_database&#8221;).</p>
<blockquote><p>SELECT table_name, column_name, index_name FROM information_schema.statistics WHERE index_name != &#8216;primary&#8217; and table_schema = &#8216;your_database&#8217;;</p></blockquote>
<p>That&#8217;s it. A list of what table, what field, and the name that each index applied to. Happy indexing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2008/09/11/collecting-a-list-of-current-mysql-index-in-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading Git on Debian Etch</title>
		<link>http://blog.katipo.co.nz/2008/07/31/upgrading-git-on-debian-etch/</link>
		<comments>http://blog.katipo.co.nz/2008/07/31/upgrading-git-on-debian-etch/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 01:12:37 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=47</guid>
		<description><![CDATA[When you want to use git on Debian its as easy as &#8220;apt-get install git-core&#8221;&#8230;&#8230; or is it? The version on the stable debian repositories (1.4.4) is very old. It lacks many of the features git users use on a regular basis. So how do you upgrade git? Well the simplest approach for getting the [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to use git on Debian its as easy as &#8220;apt-get install git-core&#8221;&#8230;&#8230; or is it? The version on the stable debian repositories (1.4.4) is very old. It lacks many of the features git users use on a regular basis. So how do you upgrade git? Well the simplest approach for getting the most recent version, for those that know how, is to wget the source, unpack, cd, configure, make, and make install. Takes about 5 minutes, and you&#8217;re up and running. But what if you don&#8217;t know how to compile, or you want to maintain package only install for your system, so upgrading and uninstalling will be easy? Where do you find a newer package?</p>
<p><span id="more-47"></span></p>
<p>Well, the testing and unstable repositories require you to update nearly your entire system, which is not ideal for just one package. But thanks to the clever maintainers, a backports repository has just what we need. ssh into your host, and make sure you have sudo access. The following instructions require root access.</p>
<p>Start by adding a new source to your apt-get sources. Open up /etc/apt/source.list as root, and add the following line:</p>
<blockquote><p>deb ftp://ftp.nz.debian.org/backports etch-backports main contrib non-free</p></blockquote>
<p>Next, we&#8217;ll install the keyring needed to install software from this server</p>
<blockquote><p>sudo apt-get install debian-backports-keyring</p></blockquote>
<p>Once this is done, we need to clear some space for the update command to work properly.</p>
<blockquote><p>sudo apt-get clean</p></blockquote>
<p>And then we can pull the information of new sources</p>
<blockquote><p>sudo apt-get update</p></blockquote>
<p>If the update command doesn&#8217;t work (you get warnings like &#8216;Dynamic MMap ran out of room&#8217;), refer to <a href="http://www.linuxquestions.org/questions/debian-26/dynamic-mmap-ran-out-of-room-error-when-adding-new-apt-source-list-233417/#post1188874">this forum post</a>. Keep increasing the cache limit by 100,000 until it works).</p>
<p>Before we install, make sure you dont have a previous version (it could cause problems). Uninstall Git by running</p>
<blockquote><p>sudo apt-get remove git-core git-svn git-doc</p></blockquote>
<p>And you&#8217;re set to install. Because backports are disabled by default, we need to pass apt-get the -t option, to specifiy where to get it from.</p>
<blockquote><p>sudo apt-get -t etch-backports install git-core git-svn git-doc</p></blockquote>
<p>And once again, clean the tmp directory of apt-get leftovers, so you dont get disk full problems</p>
<blockquote><p>sudo apt-get clean</p></blockquote>
<p>Now, if you run &#8216;git &#8211;version&#8217;, you should see you have Git 1.5.6 installed. It&#8217;s not the most recent version, but its certainly better than 1.4.4.  Now you can enjoy all the new features of Git.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2008/07/31/upgrading-git-on-debian-etch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Migrating from Phpwiki to Kete (part 2)</title>
		<link>http://blog.katipo.co.nz/2008/07/31/migrating-from-phpwiki-to-kete-part-2/</link>
		<comments>http://blog.katipo.co.nz/2008/07/31/migrating-from-phpwiki-to-kete-part-2/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 23:58:59 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=46</guid>
		<description><![CDATA[In the previous part of this guide, we created an export script which produced an XML formatted output of the current versions of pages in your phpwiki installation. If you havn&#8217;t done that yet, please read the first part of this guide. Now we are going to take that file, and import it into Kete, [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous part of this guide, we created an export script which produced an XML formatted output of the current versions of pages in your phpwiki installation. If you havn&#8217;t done that yet, please read the <a href="http://blog.katipo.co.nz/?p=43">first part of this guide</a>. Now we are going to take that file, and import it into Kete, maintaining as much as the information as possible. We&#8217;re going to cover system settings, topic types, extended fields, privacy controls and import synonyms. So lets get started.</p>
<p><span id="more-46"></span></p>
<p>We&#8217;ll start by uploading that records.xml file we made in Part 1 to the server. Using an SFTP client (or scp if you use the console), copy records.xml to a folder inside the imports folder in the root of you Kete installation. The final location will look something like</p>
<blockquote><p>/home/kete/app/your_app/imports/phpwiki/records.xml</p></blockquote>
<p>(with the first 4 folders differing depending on your setup). Make sure you upload as the kete user (or whatever account is running your Kete installation) or Kete will have problems accessing/writing to that folder. If you can&#8217;t upload as the user, as root (if you can access that), run something like</p>
<blockquote><p>chown -R kete /home/kete/app/your_app/imports/phpwiki</p></blockquote>
<p>With that uploaded, lets then create a new basket to put these Phpwiki pages into. Login as an admin and at the bottom of the page, in the Administrators Toolbox, click add basket. Enter a title that will help easily recognize where these pages came from. The rest of the options should be fine if you are importing public topics, but if you exported the XML with the WILL_IMPORT_AS_PRIVATE constant in parseWikiToHtml.php set to true, then you will need to set Privacy controls to enabled at the very least. Finish creating the basket.</p>
<p>Now you need to set up some important synonyms for the import. These map what fields in the XML file go into the fields in your database. In the case of this import, we want pagename to be the title, and content to be the description of the topics it will be making. To set these, as an admin, click Reconfigure Site in the Administrators Toolbox, go to Advanced Settings, and then to Import. In the Description Synonyms, enter the following:</p>
<blockquote><p>['content']</p></blockquote>
<p>and then enter the following for the Title Synonyms:</p>
<blockquote><p>['pagename']</p></blockquote>
<p>If you already have synonyms in place, you may need to join then together like so:</p>
<blockquote><p>['existingsynonym', 'othersynonym', 'pagename']</p></blockquote>
<p>Once they&#8217;re entered, hit Save, and because you changed system settings, you&#8217;ll need to restart mongrels and backgroundrb processeses for the import to work correctly. If you&#8217;ve read this far, I&#8217;m going to assume you have a Kete installation you setup and you know how to restart your server. If not, check out the documentation at http://kete.net.nz/ .</p>
<p>Once restarted, we need to setup a few extended fields. In the Administrators toolbox, head to extended fields, an create three new ones with the following details:</p>
<blockquote><p><strong>Label:</strong> Author<br />
<strong>Import Synonyms:</strong> author</p>
<p><strong>Label:</strong> Creator<br />
<strong>Import Synonyms:</strong> creator</p>
<p><strong>Label:</strong> Last Modified<br />
<strong>Import Synonyms:</strong> lastmodified</p></blockquote>
<p>Leave the rest of the fields as their default. When all three are saved, the next step is to create a new topic type these topics will be imported as. Once again, in the Administrators Toolbox, click on topic types, and add a sub type of Topic. Give it a name and description that will clearly identify what these articles are. Create it, and scroll down to the section &#8220;Available form fields&#8221;. Tick all three of the new extended fields you added (Last Modified, Created, and Author) as optional, add them, and scroll down to reorder them how you want them to be shown.</p>
<p>Everything is now ready to be imported. Head to the basket you setup, and at the bottom, in the &#8220;Tools for basket&#8221; box select &#8220;import content into basket&#8221; and then &#8220;start new import&#8221;. After the initial instructions on how to import (which I wont explain) you&#8217;ll reach the form, where you can enter the following details:</p>
<blockquote><p><strong>Name of import folder:</strong> phpwiki<br />
<strong>Delay between records:</strong> 10  (higher if you have a slow computer, lower if you have a computer with lots of memory)<br />
<strong>Import type:</strong> Simple XML Topics<br />
<strong>XML Path to Record:</strong> pages/page<br />
<strong>Applicable Topic Type:</strong> [the new topic type you made]<br />
<strong>Default Privacy Setting:</strong> [as before, make private if you exported the XML with the WILL_IMPORT_AS_PRIVATE constant in parseWikiToHtml.php set to true]</p></blockquote>
<p>Fill in the rest of the fields to what you want, and hit Import. And you&#8217;re done. If everything was set correctly, within 30 seconds you should see the page update informing you how many records have been processed. If you set a high processing delay, it can take well over an our depending on how many records you wiki has. Once its finished, your topics will be accessible. That said, there are a few gotchas with this process.</p>
<ol>
<li>Importing private topics does not, as of writing this article, update the zoom records correctly. So after importing any private topics, you will need to rebuild your zoom index&#8217;s. Check out the last 3 steps of <a href="http://kete.net.nz/documentation/topics/show/140-troubleshooting">this troubleshooting guide</a>.</li>
<li>Links that used to work on the old wiki don&#8217;t know where to point to, so in the export process, it changes the links to searches within Kete (which it knows how to perform). So whenever you click a link in an imported topic, it will be searched for, rather than being taken directly to it.</li>
<li>The import process messes with links which contain an ampersand (which if you import as private will be all links). To fix this, you can run a set of console commands in a production console. Enter the console by running  &#8217;script/console production&#8217; in your Kete root directory, and copy and paste the following lines one by one (might take a while): <a href="http://gist.github.com/3359">http://gist.github.com/3359</a></li>
</ol>
<p>Any question? Feel free to ask.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2008/07/31/migrating-from-phpwiki-to-kete-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating from Phpwiki to Kete (part 1)</title>
		<link>http://blog.katipo.co.nz/2008/07/29/migrating-from-phpwiki-to-kete-part-1/</link>
		<comments>http://blog.katipo.co.nz/2008/07/29/migrating-from-phpwiki-to-kete-part-1/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 03:24:43 +0000</pubDate>
		<dc:creator>kieran</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://blog.katipo.co.nz/?p=43</guid>
		<description><![CDATA[(the following article and code applies only to phpwiki version 1.1.x and 1.2.x. Previous and future versions of this software use different methods of formatting and so will require changes to the scripts used here)
If you have a set of articles on a phpwiki that you can&#8217;t afford to lose, and want to move to [...]]]></description>
			<content:encoded><![CDATA[<p>(the following article and code applies only to phpwiki version 1.1.x and 1.2.x. Previous and future versions of this software use different methods of formatting and so will require changes to the scripts used here)</p>
<p>If you have a set of articles on a phpwiki that you can&#8217;t afford to lose, and want to move to Kete then theres a simple two part process you can follow to do just that. Over the next two blogs posts, I&#8217;m going to show you just how it&#8217;s done.</p>
<p><span id="more-43"></span></p>
<p>Kete can import text using a simple XML import. And in some cases, it can be as simple as exporting your mysql table to an XML formatted file, and sending it to Kete. But in the case of Phpwiki, special markup is stored in the database which Kete doesn&#8217;t know how to interpret. So while the bulk of the text would be imported, all styling and links you have will no longer work, and if you have a lot of articles, then it would get annoying to have to update each one.</p>
<p>So to get around this, we write our own XML export script, which takes the special syntax, runs it through Phpwiki&#8217;s transform.php file, which returns an HTML formatted string we can then use. But we have another problem. Phpwiki&#8217;s transform file is executed procedurally, which means it starts with something at the top, works its magic, and then outputs what it has at the end. It also has one function in the file, so including the file multiple times would cause problems.</p>
<p>file_get_contents is the answer. We have a main script that loops through the records and gets each current entry. When it comes to outputting the content, we send the title of the page we want returned to another script, which gets the contents of that page using a modified version of phpwiki&#8217;s display.php, assigns it to the right variable and includes the transform file near the end. The resulting HTML is brought back to the original script, and inserted into the XML, before it loops to the next entry and repeats the process.</p>
<p>Add in a few lines of code to fix search links, remove annoyingly placed Phpwiki developer comments, and escape content, and the export script works like a charm, producing an XML formatted file with the latest content which can now be imported into Kete. You can check out the finished source code of the exporter online at MediaFire.</p>
<ul>
<li>exportToHtml.php: <a href="http://www.mediafire.com/?dv9zug1g0rz">http://www.mediafire.com/?dv9zug1g0rz</a></li>
<li>parseWikiToHtml.php: <a href="http://www.mediafire.com/?yapjdul1jt0">http://www.mediafire.com/?yapjdul1jt0</a></li>
</ul>
<p>To use the scripts, open each file and edit the defined constants at the top of the scripts. Then upload those to the base of your wiki (http://yoururl.com/wiki/ for example), and navigate with your browser to http://yoururl.com/wiki/exportToHtml.php . The resulting XML document is what you&#8217;ll use to import in the next step. Save this file to your desktop by going to File &gt; Save page As, and name it records.xml.</p>
<p>Stay tuned for part 2 where I explain how to import this XML file into Kete.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.katipo.co.nz/2008/07/29/migrating-from-phpwiki-to-kete-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
