Katipo
Search  
Site Blog
  About  
  Home
About Portfolio Solutions Client Area Contact Us
: : About Us
Awards
Jobs
Our People
What Is A ... ?
Working From Home
News
Photo Gallery
Katipo Blog


Archive for the 'random' Category

Resolving conflicts with git on Mac OS X

Friday, August 29th, 2008

I just had to resolve my first conflict in git. It’s a little more convoluted than with subversion, but slicker overall.

So you run into a conflict during a merge (implied by this git pull command):

$ git pull kete_master master

Auto-merged app/helpers/application_helper.rb
Auto-merged app/views/layouts/application.rhtml
CONFLICT (content): Merge conflict in app/views/layouts/application.rhtml

Automatic merge failed; fix conflicts and then commit the result.

First up, you need to have your git config point at opendiff on Mac OS X. Do the following if you haven’t already (you only have to do this once and it will be set permanently):

git config –global merge.tool opendiff

Then from the shell run this:

$ git mergetool

And then you should see output something like this:

Merging the files: app/views/layouts/application.rhtml

Normal merge conflict for ‘app/views/layouts/application.rhtml’:
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (opendiff):

Hit return and the OpenDiff application should startup with the conflicted file. It will have side by side comparisons of local version of the file and the remote version of the file with nifty highlighted areas where things are different. Select the first highlighted region, go down to the bottom right and choose the appropriate side in the “Action” menu, then proceed on to the next one, and so on until you have taken care of all differences. Then click File > Save Merge.

Back on the shell you are ready to do commit your resolved file. Do “git commit” and you enter an editor to put in your commit message.

Move on to other tasks, you’re done.

Upgrading Git on Debian Etch

Thursday, July 31st, 2008

When you want to use git on Debian its as easy as “apt-get install git-core”…… 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’re up and running. But what if you don’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?

(more…)

Migrating from Phpwiki to Kete (part 2)

Thursday, July 31st, 2008

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’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, maintaining as much as the information as possible. We’re going to cover system settings, topic types, extended fields, privacy controls and import synonyms. So lets get started.

(more…)

Migrating from Phpwiki to Kete (part 1)

Tuesday, July 29th, 2008

(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’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’m going to show you just how it’s done.

(more…)

Not finding a Ruby Gem? Maybe you need to monkey with your sources.

Tuesday, July 29th, 2008

I was trying to install a gem on a client’s machine that I had previously been able to grab successfully, but it failed like this:

$ sudo gem install some_gem
Updating metadata for 475 gems from http://gems.rubyforge.org/

complete
ERROR: could not find some_gem locally or in a repository

I thought perhaps rubyforge was unavailable, so I repeated the command. Still no luck. I did a web search and found a possible answer:

$ gem sources -a http://gems.github.com/ # adds metadata for the gems hosted by github

That actually didn’t do it either. Including github’s gems slowed things down when doing a gem install, so I decided to remove it from the sources list:

$ gem sources -r http://gems.github.com/ # drops github’s gems metadata

So I tried a “gem help sources” and discovered that I could clear the local cache like so:

$ sudo gem sources -c
*** Removed user source cache ***
*** Removed latest user source cache ***
*** Removed system source cache ***
*** Removed latest system source cache ***

Then I tried the gem install again:

$ sudo gem install some_gem
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed some_gem
1 gem installed
Installing ri documentation for some_gem
Installing RDoc documentation for some_gem

Success! Hope this helps someone else.

Overcoming attachment_fu mime-type isues

Monday, July 28th, 2008

When you upload a file using attachment_fu (http://github.com/technoweenie/attachment_fu), for the most part, the upload will work fine. But there are occasions that the mime type will return something that isn’t useful, such as application/octet-stream, application/x-download or a blank mime type. In these cases, it can refuse to upload a perfectly legit file. Allowing octet-stream and x-download to be uploaded, while possible, does create a certain security (permissions) issue. So how do you get around this without causing any more problems?

(more…)

Maintaining an SVN repository after moving to Git

Friday, July 18th, 2008

We at Katipo recently moved our software Kete to Github. But a few existing clients were still tied to the old SVN repository, so we had to find a way to keep the link between them so we could pull changes from git and commit them back to SVN. Using various sources from the web, we were able to do just that. Here’s how… (more…)

How much disk space does your Rails Database use?

Sunday, October 14th, 2007

The other day I was asked how much disk space a particular Kete project’s production database used. I didn’t have an answer, so I started searching for one.

In my case, the db software is MySQL and getting a report about various aspects of a db’s tables boils down to this query:

show table status;

The output of this query has way more information than I need, plus to get the total number of bytes used you have to add all the values up anyway, so I decided to make a rake task to make this repeatable and return something succinct.

I have added the new rake task to the Kete app’s codebase. If you aren’t a Kete user, but need this functionality for your Ruby on Rails app, you can find it here:

http://svn.kete.net.nz/projects/kete/trunk/lib/tasks/db-disk-usage-report.rake

Note there is a formatting method taken from the Rails Helpers, I would love to not duplicate this definition. If anyone has a recommendation for the best way to pull this method into this rake task, I would appreciate it. Probably a simple include statement, but I didn’t get around to figuring out the correct incantation.

I would also love to hear how best to make this handle other database software, for example PostgreSQL, too.

Cheers,
Walter

Server Setup and Deployment for Rails using Capistrano, Mongrel, and Nginx using Mac OS X for Development and Debian Etch for Production

Sunday, October 14th, 2007

As previously mentioned, I have written a guide on how to set up Kete (also applicable to other Rails apps though Kete includes some extra required software and niceties to make it easier) for Development on Mac OS X. This guide also includes best practices for Deployment. So the following guide can be seen as the first half of the story:

http://kete.net.nz/documentation/topics/show/16-creating-a-kete-development-environment-on-mac-os-x

But what about the host that you are deploying to? I cover that for Debian Etch in the following guide:

http://kete.net.nz/documentation/topics/show/15-preparing-a-debian-etch-host-to-be-deployed-to-for-kete

You might also be curious what software Kete requires. Here’s a breakdown:

http://kete.net.nz/documentation/topics/show/19-technical-requirements

Cheers,
Walter

Installing the Kete Stack on Mac OS X, including MacPorts, Ruby on Rails, Ruby-Zoom, and Zebra

Sunday, October 14th, 2007

I’ve added a guide over at Kete.net.nz for how to install Kete for development on Mac OS X. You can find hit here:

http://kete.net.nz/documentation/topics/show/16-creating-a-kete-development-environment-on-mac-os-x

If anything doesn’t work for you, please let me know.

Cheers,
Walter


Katipo
Rachel Snowboarding