Upate Ruby Gems on Mac OS X 10.5 Article

This nice article describes how to update Ruby Gems on Mac OS X Leopard 10.5:

Updating_to_RubyGems_1.3.0_on_Mac_OS_X_Leopard_10.5.4

Comments (4)

Git Cloning and Git Forking Differences

Git Cloning and Git Forking differences are described in this article

Git Cloning

Cloning is to make a copy of a remote repository into your local development environment.

Git Forking

Forking is to clone an entire remote repository into another remote repository.

Comments (3)

How to Think About Git

I thought this article about setting up a new Rails app with Git provided a good way to think about Git repositories:

Git repository’s are a-dime-a-dozen. There’s no such thing as a working copy, everything’s just a git repository containing copies of other git repositories. When you develop locally you’re committing to a local git repository, stored in the .git directory of your project.

Comments (3)

Create A Rails App With Passenger Phusion On Mac OS X Leopard

This article guides you through the process of creating a Ruby on Rails application using Passenger Phusion (mod_rails) on a Mac OS X Leopard. The article assumes that both Rails and MySQL have already been installed.

Here are the 11 steps to get a Passenger Phusion based Rails app going:

Step 1 - Stop Apache

System Preferences >> Sharing

Uncheck Web Sharing

Step 2 - Install Passenger Gem

$ gem install passenger

Step 3 - Install Apache Module

$ passenger-install-apache2-module

Step 4 - Apache Config Edits

edit /etc/apache2/httpd-conf and add the following three lines:

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.0.6
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Step 5 - Create Virtual Host

This step allows us to access a local Wordpress blog from http://wp.local

Edit /etc/hosts and add the following line:
127.0.0.1 railstestapp.local

Edit /etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
ServerAdmin webmaster@railstestapp.local
DocumentRoot "/Users/user/Sites/railstestapp/public"
RailsEnv development
ServerName railstestapp.local
ServerAlias *.railstestapp.local
ErrorLog "/private/var/log/apache2/railstestapp.local-error_log"
CustomLog "/private/var/log/apache2/railstestapp.local-access_log" common
</VirtualHost>

The RailsEnv development line is required to run the Rails app in development mode. Also, note that the document root is the public directory.

Step 6- Start Apache

System Preferences >> Sharing

Uncheck Web Sharing

Step 7 - Create a Rails App


$cd /Users/user/Sites
$rails railstestapp

Step 8 - Connect Rails With MySQL Database

Edit your database.yml file in your Rails app so it looks like this:


development:
adapter: mysql
database: railstestapp_development
username: root
password: password
socket: /tmp/mysql.sock

test:
adapter: mysql
database: railstestapp_test
username: root
password: password
socket: /tmp/mysql.sock

production:
adapter: mysql
encoding: utf8
database: railstestapp_production
username: root
password: password
socket: /var/run/mysqld/mysqld.sock

Step 9 - Create the Database


rake db:create

Step 10 - Create Model/Controller/View


ruby script/generate scaffold Post title:string body:string

Step 11 - Try It


http://railstestapp.local/posts

References

The following article gave me the clue on how to set the Rails app in development mode:
http://benr75.com/2008/04/12/setup-mod_rails-phusion-mac-os-x-leopard

Installing Passenger Phusion instructions at: http://www.modrails.com/install.html

Comments (1)

Installing Wordpress 2.7 On Mac OS X Leopard

This post shows you how to install Wordpress 2.7 on a Mac OS X Leopard. The post assumes that MySQL and PHP have already been installed. Here are the six steps to get Wordpress installed on your Mac, so you can tweak a theme or create some widgets and plugins:

Step 1 - Configure MySQL Database


$ mysql -u root -p
Enter Password: {ROOTPASS}
> create database wordpress;
> grant all privileges on wordpress.* to wpuser@localhost identified by 'password';
> quit

Change the password in the grant command to whatever you want the password to be.

Step 2 - Download & Extract Wordpress

- Download and Wordpress from here: http://wordpress.org/latest.zip
- Move the Wordpress zip file (wordpress-2.7.1.zip) to /Users/user/Sites
- Unzip the zip file in /User/user/Sites

You should see a Wordpress folder now in /Users/user/Sites

Step 3- Configure Wordpress To Connect to MySQL

cd /Users/user/Sites/Wordpress
cp wp-config-sample.php wp-config.php

edit wp-config.php and set the following configuration variables:

define('DB_NAME', 'wordpress'); // The name of the database
define('DB_USER', 'wpuser'); // Your MySQL username
define('DB_PASSWORD', 'password'); // …and password
define('DB_HOST', '127.0.0.1');

Note: I needed to change “host” to 127.0.0.1 to get Wordpress to connect to my MySQL database.

Step 4 - Create a Virtual Host for Wordpress

This step allows us to access a local Wordpress blog from http://wp.local

Edit /etc/hosts and add the following line:
127.0.0.1 wp.local

Edit /etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
ServerAdmin webmaster@wp.local
DocumentRoot "/Users/tdewell/Sites/wordpress"
ServerName wp.local
ServerAlias *.wp.local
ErrorLog "/private/var/log/apache2/wp.local-error_log"
CustomLog "/private/var/log/apache2/wp.local-access_log" common
</VirtualHost>

Step 5 - Restart Apache

Click:
System Preferences >> Sharing

uncheck and then check again the Web Share checkbox:

websharing1

Step 6 - Install Wordpress

http://wp.local/wp-admin/install.php

Make sure you save the admin password somewhere.

Step 7 - Start Blogging

http://wp.local/wp-admin

References

This post is mostly based on this article:

Leopard How To Install Wordpress

I’ve modified the instructions to allow multiple projects and websites in the /Users/user/Sites folder.

I hope this article was of some benefit to you!

Comments (12)

Getting phpMyAdmin Working On Mac OS X Leopard

I already had MySQL installed and up and running on my Mac for developing Rails apps. I installed MySQL using MacPorts using the
following instructions.

I got phpMyAdmin working with these instructions. Make sure you do the following steps from the article just listed to be able to login to your MySQL database with phpMyAdmin

Open the file config.sample.inc.php and enter a random string to the following line, afterwards you should rename the file to config.inc.php.

$cfg['blowfish_secret'] = ”; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Look for:

$cfg['Servers'][$i]['host'] = ‘localhost’;

change it to:

$cfg['Servers'][$i]['host'] = ‘127.0.0.1′;

Leave a Comment

Images In An Unstructured List (UL) Wont Display Horizontally With IE

I had a little bit of trouble getting the layout of sbhsdonsbaseball.com working with Internet Explorer.

In the image below you will see the photos lined up vertically instead of horizontally as they should be.

sbhs_photo_layout_prob_ie

Here is the original HTML markup for the photo block:

<div class="photoBlock">
<ul>
<li class="even"><a href="" /><img src="images/photoBlock-1.jpg" alt="Photo"/></a></li>
<li class="odd"><a href="" /><img src="images/photoBlock-2.jpg" alt="photo"/></a></li>
<li class="even"><a href="" /><img src="images/photoBlock-3.jpg" alt="photo"/></a></li>
<li class="odd"><a href="" /><img src="images/photoBlock-4.jpg" alt="photo"/></a></li>
<li class="even"><a href="" /><img src="images/photoBlock-5.jpg" alt="photo"/></a></li>
<li class="odd"><img src="images/photoBlock-6.jpg" alt="photo"></img></li>
</ul>
</div>

Here is the original CSS for the photo block:


.photoBlock { overflow: hidden; border-bottom: 3px solid #B69E65;}
.photoBlock ul { overflow: hidden; }
.photoBlock ul li { display:table-cell; height:230px; text-align:center; vertical-align:middle; width:160px;}
.photoBlock ul li.even { background: #000; }
.photoBlock ul li.odd { background: #FFF;}
/* HACK below got rid of background in li */
.photoBlock ul li img {margin: 0 0 -3px 0; }

To get the images to line up horizontally, the HTML markup was simplified:

<div class="photoBlock">
<img src="images/photoBlock-1.jpg" alt="Photo"/>
<img src="images/photoBlock-2.jpg" alt="photo"/>
<img src="images/photoBlock-3.jpg" alt="photo"/>
<img src="images/photoBlock-4.jpg" alt="photo"/>
<img src="images/photoBlock-5.jpg" alt="photo"/>
<img src="images/photoBlock-6.jpg" alt="photo"/>
</div>

We also changed the CSS to support the new markup:

.photoBlock { overflow: hidden; border-bottom: 3px solid #B69E65;}
.photoBlock img{margin:-3px -3px -3px 0;}

For some as of yet unknown reason, images had margin between them, so negative margin was added to the top, right and bottom sides of the images. The result is shown below:

sbhs_photo_layout_good_id

Comments (2)

Fresh Start with Fresh

Like I said in the last post, there will be lost of experimentation, so now I am trying the Fresh Theme from Ilemoned.

It’s bright and cheerful and fresh.

Comments (2)

Woot for Woo Themes

Themes from Woo Themes seem to be the best I’ve found so far. I’m sure that over the next few days you might see might see me experiment with a bunch of different themes.

Comments (1)

Hello World (from Todd Dewell)

This is my first post from a hosted Word Press blog.

Leave a Comment