Integrate Rails app and PHP on Apache

January 5, 2012

Here is one method of how to integrate a Ruby on Rails application and a PHP application or even just static HTML using Apache webserver. One reason for doing this could be (in this website’s case) that your main website application is Rails but you want to use WordPress or[...]

Rails: Dynamic page titles

December 21, 2011

Here is how I have been creating dynamic page titles, page descriptions, etc (anything you want really) using Rails.   In app_root/app/helpers/application_helper.rb create the following method # Format and return a title on a per-page basis def display_title base_title = “mysite.com” if @title.nil? base_title else “#{@title} – #{base_title}” end end[...]

Website upgrade 2011

December 19, 2011

< 17 December 2011: This website, robertomurray.co.uk was PHP and running (slowly) on a shared hosting server. > 17 December 2011 The website is now on a new server and the site is mainly Ruby on Rails Switchover OK, here there are two major changes; 1) Migrating to new server[...]

Postgresql: find next available IP addresses

November 5, 2011

Postgresql has the inet and cidr datatypes and some great functions for these types, very useful for storing and manipulating data for IP addresses and networks. As a basic example, say you were storing hostnames and IP addresses, basic example table below: id ip_address hostname 1 10.10.100.15 server01 If I[...]

Rails: fix ActiveAdmin CSS over-riding problem

November 3, 2011

For some reason the ActiveAdmin gem, a great administration framework for rails apps, has its own CSS files loaded for ALL other views (only trying in dev env). Quite annoying and will over-ride your styles. To fix I have just moved the app/assets/stylesheets/active_admin.css.scss to vendor/assets/stylesheets/active_admin.css.scss – It is only loaded[...]

Stumbling onto Agile development

June 27, 2011

I read a very interesting post from one of the founders of github.com who had heard a great metaphor for Agile development; Imagine you’re tasked with building a computer controlled gun that can accurately hit a target about 50 meters distant. That is the only requirement. One way to do[...]

Get string of boolean value in PHP

April 15, 2011

PHP has the function string strval($var) to return a string value from the variable which is great but the string value of a boolean is either 1 or 0 so this will not return the string “true” or “false”. This simple little example and function shows this and is great[...]