tag:paul.geek.nz,2008:/postsPaul Chilton2011-08-15T04:34:58ZEnkiPaul Chiltonpaul.chilton@gmail.comtag:paul.geek.nz,2008:Post/142011-07-25T10:59:19Z2011-07-25T10:59:19ZCommenting on comments<p>I’ve had a lot of comments on my blog. Unfortunately they all seem to be spam bots. So I’ve removed commenting from my posts. If you’d like to contact me, use the reverse of: com (dot) gmail (at) chilton (dot) paul</p>tag:paul.geek.nz,2008:Post/132011-07-06T08:37:24Z2011-07-06T08:37:24ZGit, gitosis-admin and git flow<p>Both git and gitosis covered well by the <a href="https://help.ubuntu.com/community/Git">Ubuntu help for Git</a></p>
<p><a href="http://nvie.com/posts/a-successful-git-branching-model/">git flow</a> makes branching a pleasure to use.</p>tag:paul.geek.nz,2008:Post/32011-06-13T11:13:15Z2011-06-13T11:13:15ZRubyrep with PostgreSQL DB syncing<p>I’m using <a href="http://www.rubyrep.org/">Rubyrep</a> to sync databases between a pair of PostgreSQL instances for this blog. Thought I would share the process that I used with you.</p>
<h3>Install Rubyrep</h3>
<p><code>sudo gem install rubyrep</code></p>
<h3>Configuration</h3>
<p>Use the following of <code>scripts/rubyrep.conf</code> with:</p>
<pre><code>
RR::Initializer::run do |config|
config.left = {
:adapter => 'postgresql',
:database => 'example_development',
:username => 'example',
:password => 'example',
:host => '127.0.0.1',
:port => 5432,
}
config.right = {
:adapter => 'postgresql',
:database => 'example_production',
:username => 'example',
:password => 'example',
:host => '127.0.0.1',
:port => 5555,
}
config.options[:auto_key_limit] = 2
config.options[:rep_prefix] = 'rr_example'
config.include_tables 'schema_migrations', :key => 'version'
config.include_tables /./, :sync_conflict_handling => lambda { |sync_helper,conflict_type,rows|
time_left = rows[0]['updated_at'].to_i
time_right = rows[1]['updated_at'].to_i
if time_left > 0 and time_right > 0 and time_left != time_right
if time_left > time_right
sync_helper.update_record(:right, sync_helper.right_table(), rows[0])
else
sync_helper.update_record(:left, sync_helper.left_table(), rows[1])
end
end
}
end
</code></pre>
<p>This gives a local <i>left</i> connection, and a remote <i>right</i> connection when configured with <span class="caps">SSH</span> tunneling. Conflict resolution is based on the updated_at column of the database.</p>
<h3><span class="caps">SSH</span> Tunneling</h3>
<p>I already have <span class="caps">SSH</span> keys setup on the remote host. Using the following to create a connection locally on port 5555 that connects to the remote PostgreSQL port of 5432</p>
<pre><code>ssh -f -N -T -C -L 5555:localhost:5432 example@example.com</code></pre>
<h3>Scan and sync</h3>
<p>I do the scan and sync manually, rather than continual replication.</p>
<pre><code>
rubyrep scan -c scripts/rubyrep.conf
rubyrep sync -c scripts/rubyrep.conf
</code></pre>
<h3>Fun things with replication</h3>
<p>It is possible to have a master-master replication setup where databases are not always connected. Requires:</p>
<ul>
<li>Application aware that databases are synced intermittently.</li>
<li>Unique ID columns. I’ve used <span class="caps">GUID</span> values. Even/odd sequences may work.</li>
<li>Use of updated_at column, for resolving conflicts.</li>
<li>Do not delete rows. These will sync back into existence.</li>
</ul>
<p>There are some significant constraints on what can be done, but it does enable some unique applications.</p>tag:paul.geek.nz,2008:Post/22011-06-12T10:39:43Z2011-06-12T10:39:43ZThe games I play<p>Currently playing <a href="http://www.esdao.com/"><span class="caps">ESDAO</span></a> – a turn based strategy game. Long turns, so I can play it in the background over a long period of time. For example I’m playing a 60 turn game with 24 hour turns, so could take a couple of months. Runs faster if everyone sets their turns earlier on.</p>
<p>On my iPhone I’ve been playing Sudoku. I’ve found that Sudoku is a good game to play during a train ride, in terms of the time to play through a game, and being able to start/stop it easily. Previously I’ve played Tower Madness, but found that games take longer, and interruptions not as easy to deal with.</p>tag:paul.geek.nz,2008:Post/12011-06-09T12:16:00Z2011-06-09T12:16:47ZEnki based blog<p>It has been a while since I did any postings to my blog. Restarting on an <a href="http://www.enkiblog.com/">Enki</a> based blog, will start to post on a regular basis to improve my writing and communication skills.</p>
<p>Inspired by a post by Jeff Atwood about <a href="http://www.codinghorror.com/blog/2011/02/how-to-write-without-writing.html">writing without writing</a></p>tag:paul.geek.nz,2008:Post/42010-09-19T22:54:29Z2011-07-01T05:07:23ZStaycation in Wellington<p>Took a week off to have a break. Thought we would spend some time in Wellington and see some local sights. Spent most of a day in Masterton, an evening in Martinborough, and an afternoon in the Botanical Gardens.</p>
<p>Spent some quality time at home working on a new pet project. Thought I would try to avoid using a computer for a week, instead I built a website I’ll be polishing up and launching in a few weeks.</p>
<p>Nice to take some time out, catch up with people and bring some fresh perspective to things.</p>
<p>Good food. Good company. Good times.</p>tag:paul.geek.nz,2008:Post/52010-07-16T15:20:00Z2011-07-01T05:10:01ZI heart PivotalTracker<p><a href="http://www.pivotaltracker.com/">Fantastic task management.</a></p>tag:paul.geek.nz,2008:Post/172010-07-07T12:00:00Z2011-08-15T04:34:58Zmod_rewrite<p>Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo.</p>tag:paul.geek.nz,2008:Post/62010-07-05T22:53:00Z2011-07-01T05:11:43ZPixelPaint<p>PixelPaint:http://www.pixelpaint.co.nz/</p>
<p>Large format print on canvas. Great quality. Don’t like it don’t pay. New Zealand only for now.</p>
<p>Website under development but processing orders now.</p>tag:paul.geek.nz,2008:Post/162010-07-05T12:00:00Z2011-08-15T04:33:39Zluck<p>The harder I work, the luckier I get.</p>tag:paul.geek.nz,2008:Post/72009-11-13T18:00:00Z2011-07-01T05:13:25ZMovember 2009<p>Another year, another Mo. Donate below.</p>
<p><a href="https://www.movember.com/nz/donate/your-details/member_id/16670/">Paul Chilton Movember 2009</a></p>tag:paul.geek.nz,2008:Post/82009-09-03T16:00:00Z2011-07-01T05:15:49ZPDF Development<p>Whenever doing development that has <span class="caps">PDF</span> as an output, the way to preview it in a browser is with:<br />
http://www.example.com/file.pdf<strong>#view=fitV</strong></p>
<p>Refresh in browser doesn’t seem to flow through, so usually best to timestamp the <span class="caps">URL</span>.</p>
<p>Best tool I’ve found for turning <span class="caps">XHTML</span>/<span class="caps">CSS</span> into <span class="caps">PDF</span> files: PrinceXML:http://www.princexml.com/. (expensive, but very good)</p>tag:paul.geek.nz,2008:Post/92009-07-27T16:00:00Z2011-07-01T05:17:08ZHoliday in Rotorua<p>Went up to Rotorua for a three day weekend. Driving up through Taihape was suprised to see random breath tests going on, at 2:15 in the afternoon. Fairly long drive up from Wellington, but eventually got there. The hotel room was nice, with lake views. Had chicken fettucine for dinner, then collapsed into bed.</p>
<p>Next morning had breakfast in town, and that is when it started feeling like a holiday. Purchased a cheap pair of sunglasses (having previously snapped earlier ones in a seating accident), and headed up to the Luge. Went on the first run down, a lot of fun! Coming back up we managed to get a few bus loads of tourists coming through, so went to the cafe. Food was pretty nasty. Second run down took the scenic track, which was more fun than the intermediate track.</p>
<p>Headed to the Polynesian Spa, deluxe private pools. Lovely view across the lake, and very relaxing. Afterwards went across the waterfront, watched part of the sunset, and felt pretty good about the world. Stone grill dinner later on, and an Italian dessert on the way back to the hotel.</p>
<p>Next morning started back on the way to Wellington. Stopped in at Huka Falls in Taupo, and had a go on the jet boat. Wicked fun, with spins and splashes to go along with it. Quick bite to eat in Taupo, then a long drive back home.</p>
<p>Nice to get away for a long weekend. Brings back some balance into life.</p>tag:paul.geek.nz,2008:Post/102009-07-01T16:00:00Z2011-07-01T05:19:57ZFirefox Extension list<p>Yet another firefox plugin extension listing. Used to keep a track of common plugins for when I rebuild my computer.</p>
<ul>
<li><a href="http://adblockplus.org/en/">AdBlock Plus</a></li>
<li><a href="http://getfirebug.com/">FireBug</a></li>
<li><a href="http://flashblock.mozdev.org/">FlashBlock</a></li>
<li><a href="http://brh.numbera.com/software/jsonview/">JSONView</a></li>
</ul>tag:paul.geek.nz,2008:Post/112007-03-13T17:00:00Z2011-07-01T05:22:13ZBSD vs GPL for web applications<p>There are a lot of open source licenses available, and when I looked at how to open source a couple of web applications the obvious choices seemed to be either the <span class="caps">BSD</span> or the <span class="caps">GPL</span>.</p>
<p>The first thing people seem to do is try out a web application. If it looks interesting enough, download and install it on a convenient host. If they really like it, they might start looking at themes, plugins and customizations. Which they can opt to share with the community.</p>
<p>This is something that should be encouraged in a helpful and positive way.</p>
<p>However, what happens if people don’t want to share with the community? They might want to keep their changes in house to start with, possibly distributing them at a later date.</p>
<p>Under the <span class="caps">GPL</span>, you are obliged to provide sources if you distribute binaries to anyone. So things like a packed distribution would include customizations. But since its a web based application, there is nothing forcing people to distribute it. The <span class="caps">GPL</span> doesn’t have practical enforcement (under version 2 at least) for changes made to a web application to be made available to the community.</p>
<p>Under <span class="caps">BSD</span>, you can do a lot more with the code. Including keeping your customizations to yourself, distributing packages as you like. There is a lot more freedom to do what you want with the code. Might as well start out with the code with more freedoms in place.</p>
<p>There is the <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html"><span class="caps">GNU</span> affero <span class="caps">GPL</span></a> which is a variant that ensures distributing of code for whenever a web application is made available to the public. It does provide for more freedom for the code, but less for the users to be involved in Open Source at their own pace.</p>