Twitter Updates

Wednesday 28 October 2009

Hugin for panoramas

hugin seems to be quite a good open source program for joining photos together for panoramas etc.

My first attempt joining 3 photos.
morganp-20091028-Hugin-3-EdinClouds

Wednesday 21 October 2009

OpenOffice Annoying auto correct

I often have to document small snippets of code and other case sensitive things so often find it very annoying when my editors decide to auto correct these things for me.

Currently I have been trying to use OpenOffice Impress to prepare a slide show.

To disable auto sentence capitalisation: OpenOffice main toolbar 'Tools' --> 'AutoCorrect Options ...' --> 'Options' tab and deselect 'Capitalize first letter of every sentence'

Thursday 15 October 2009

Edit with SciTE right click menu option

If you are a windows scite user there is a dll which you can use to give you an "edit in SciTE" right click menu option.

download from: http://www.burgaud.com/scite-context-menu/

instructions for Windows XP: all included in the readme

copy the correct dll 32 or 64bit to your scite directory probably "C:\Program Files\wscite".
start -> run -> cmd
cd "C:\Program Files\wscite"
regsvr32 wscitecm.dll

Sunday 11 October 2009

Rails Simple Pages

Ruby on Rails good for handling data models and folowing an MVC framework but there seems to be a lack of documentation for adding simple pages, I did find asmallguide on the has_many :through blog
with only a few omissions that some one new to rails might not know.

First setup the routes so that when entering http://127.0.0.1:3000/about it knows which controller to use.

config/routes.rb
 map.root :controller => 'home'
map.home ':page', :controller => 'home', :action => 'show', \
:page => /about|contact/


Now setup the controller.

app/controllers/home_controller.rb
class HomeController < ApplicationController
def index
# render the landing page
end

def show
render :action => params[:page]
end
end


Now create the 'home' folder. so we have a apps/views/home to put about.html or about.html.erb in.

Linking to this page can now be don via:
 link_to 'About', home_path('about') 


This tutorial was very closely based on 'Has many :through simple pages'

Saturday 3 October 2009

Rails Menus using Partials

I have struggled to find a good tutorial on this, probably would not need it if I knew Rails better though. I would like to make a menu which is used through out my Ruby on Rails site, partials seem to be the correct thing to use.

under
app/views/
create a new folder 'shared'
and create a new file called _menu.rhtml.
'app/views/shared_menu.rhtml'

which contains the menu something like (sorry for the extra spaces only way I could stop it rendering):
< id="menu">
< class="menubar">
< class="menubar">< href="http://127.0.0.1:3000/">Home< / a>< / l i>
< class="menubar">< href="http://www.blogger.com/Posts">Posts< / a>< /l i >
< class="menubar">< href="http://www.blogger.com/Tags">Tags< / a>< / l i>
< / u l>
< / d i v>
Then add <%= render(:partial => "shared/menu") %> to all default layouts. in:
'views/layouts/*.html.erb'

Firefox redirect mailto links to gmail

If you use Firefox as your browser and gmail as a web based email client then this is a really nice setting that was added in firefox 3. In firefox open the preferences, Applications tab and find 'mailto' in the 'Content Type'. Then just select 'Use Gmail' as the 'Action'.

Now when click on email links on web pages an new tab will open and start composing an email from your currently logged in gmail account.

Firefox-mailto-gmail

Friday 2 October 2009

Ruby on Rails

I found this [1] tutorial to be a very good introduction to ruby on rails 2.0.

[1] http://akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial

I only really followed it far enough to get a working blog with comments, That next step would be to get a working many to many relationship setup for tagging. There is a lot of confusion over how todo tagging with many different gems and plugins. Since the introduction of rails 2.x there much better ways to do the many to many relationships and except in the case of tag clouds setting up tags are relatively straight forward.

This [2] was the best tutorial I found for setting up many to many relationships and [3] was very good for describing the different relationships.

[2] http://dagobart.wordpress.com/2008/06/18/for-purpose-of-reference-doing-many-to-many-relationships-in-rails/
[3] http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association

Some tips for ~/.inputrc

If you use the command line alot on Unix, Linux or Mac (I know it is a unix) you might be interested in some options that you can set in your ~/.inputrc file.

If the file does not exist you can just create it.
$ cd ~
$ vim ~/.inputrc

My favourite option is (just enter it any where in the file):
set completion-ignore-case on

This makes tab completion non-case sensitive, since discovering this I have cut down massively on the amount of backspace I have to type to get the tab completion I wanted.

Another option that may be useful is:
set match-hidden-files off

Which stops tab completion using hidden files, but since I edit my .bashrc .inputrc etc alot I often do want to tab complete hidden files.

For more info on options just have a look at:
man readline