Installing Postgresql on Mac – again

November 22nd, 2011 by Brian filed in work has no comments

PostgreSQL

About a year ago I posted about installing Postgres 9.0 on my Mac. We’ll since then I lost a hard drive and am just re-installing Postgres now. This time 9.1. Here’s what I did:

1.  Download postgres for Mac

  • Don’t sign up for enterprise db crap, the download will start in a sec

2. Install postgres

  • This may require reboot to set some syscontrol settings (it did for me)
  • I created the “postgres” user with “postgres” as the password (so I could remember it)

3. Start postgres to create the defaults in the data directory

$ sudo su – postgres
$ . ./pg_env.sh
$ pg_ctl restart

4. Modify Postgres to use “trust” authentication, so we don’t need to supply a password when connecting to the database.

$ vi /Library/PostgreSQL/9.1/data/pg_hba.conf

4.1 For each entry, change METHOD “md5″ to “trust” (this should only be done on your developer machine!)

5. Restart postgres to pick up the conf changes

$ sudo su – postgres
$ . ./pg_env.sh
$ pg_ctl restart

6. Beer time!

 

This setup requires you to su – postgres whenever you want to restart the database, but for now it’ll work.

Tags: , ,

Refinery on Dreamhost

October 4th, 2011 by Brian filed in work has no comments

refinery logoLooking around for a Rails based CMS because I am sick of working in PHP (Drupal). RefineryCMS looks like the best of the bunch.

Here are some notes from my installation of it on my Dreamhost account:

1) ssh to your host

2) a simple ‘gem install refinerycms’ just hung & I didn’t feel like waiting around so a quick Google search came up with this answer:

In your tmp directory, create a temporary Gemfile with the following contents:

source ‘http://rubygems.org’
gem ‘refinerycms’

then run ‘bundle’

The bundle command failed for me, even though ‘gem list’ showed it was installed. So I ran ‘gem install bundle –no-rdoc –no-ri’ which installed a newer version & also setup the binary so I could successfully execute ‘bundle’.

3) Next thing to do is delete the temporary Gemfile and cd to your home directory.

4) From your home directory, execute the following (using your desired [sub]domain name):

refinerycms cms.olore.net

5) Then, create a new subdomain in Dreamhost via http://panel.dreamhost.com (same as above, I called mine cms.olore.net), click the checkbox for ‘Passenger (Ruby/Python apps only):’ and let it add ‘public’ to the end of your web directory – this will point to the public directory of the rails app that you just created.

Give Dreamhost a minute or two, then hit your site with a browser. You should see the initial screen for RefineryCMS asking you to create a new user.

Possible problems … with solutions!

a) When first accessing your site, you may get a Passenger error about rack versions. You may need to modify Gemfile.lock to use rack 1.2.1. If you make this change, simply ‘touch tmp/restart.txt’ to tell Passenger to restart, then hit the URL in the browser again.

b) When first accessing your home page you may get a 500 error. I resolved this by running ‘RAILS_ENV=production rake db:migrate’ followed by ‘touch tmp/restart.txt’

 

Good luck!

Tags: , , ,

First iPad app

March 22nd, 2011 by Brian filed in play has 2 comments

Wrote my first iPad application tonight. Took me longer to redo the signer cert and provisioning profiles than to write the code… but it was worth it.

I used Titanium Mobile which I’ve played with in the past.

The goal of this app is to teach my kids the positions on the baseball field.

Here it is in all it’s glory

var win1 = Titanium.UI.createWindow({
  top: 0,
  left: 0,
  backgroundColor:‘#fff’
});

var webview = Titanium.UI.createWebView({
  top: 20,
  left: 0,
  height: ’75%’,
  url:‘./baseball_diamond.jpg’
});

var label = Titanium.UI.createLabel({
    text:‘Where is Right Field?’,
    bottom: ’50px’,
    height:‘auto’,
    width:‘auto’,
    shadowColor:‘#aaa’,
    shadowOffset:{x:5,y:5},
    color:‘#900′,
    font:{fontSize:48},
    textAlign:‘center’
});

webview.addEventListener(‘singletap’, function(e) {
  point = e.globalPoint;
  if (point.x > 480 && point.x < 766 && point.y > 382 && point.y < 624) {
    label.text = "Right!";
  } else {
    label.text = "WRONG!";
  }
});

win1.add(webview);
win1.add(label);
win1.open();
 

Tags: , ,

H&R Block 2011 won’t install

February 23rd, 2011 by Brian filed in work has 2 comments

If you tried to install H&R Block 2011 (formerly TaxCut) on your windows machine you may have been greeted by a useless error message that says the install failed.

To get around this problem, in windows explorer, click on the D: (or wherever your CD/DVD is) and then right click on the .exe file and select “Run as administrator”

This solution was next to impossible to find on the Google, so I am hoping this helps someone!

Installing PostgreSQL on my Mac

November 30th, 2010 by Brian filed in work has 1 comment

PostgreSQL

1.  Download postgres for Mac

  • Don’t sign up for enterprise db crap, the download will start in a sec

2. Install postgres

  • This may require reboot to set some syscontrol settings (it did for me)
  • I created the “postgres” user with “postgres” as the password (so I could remember it)

3. Add stuff to your ~/.bash_profile

export PATH=$PATH:/Library/PostgreSQL/9.0/bin
export PGDATA=/Library/PostgreSQL/9.0/data

4. Execute the profile

$ . ~/.bashrc

5. Modify Postgres to use “trust” authentication, so we don’t need to supply a password when connecting to the database.

$ sudo vi /Library/PostgreSQL/9.0/data/pg_hba.conf

5.1 For each entry, change METHOD “md5″ to “trust” (this should only be done on your developer machine!)

6. Restart postgres to pick up the conf changes

$ sudo su – postgres
$ . ./pg_env.sh
$ pg_ctl restart

7. Beer time!

All of the above was done solely so I could run some ActiveRecord tests, so here’s how we do that:

$gem install pg
$ git clone git://github.com/rails/rails.git
$ cd rails/activerecord
$ rake postgresql:build_databases
$ rake test_postgresql TEST=test/cases/base_test.rb
(in /Users/brian/dev/ruby/rails/activerecord)

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -w -I"lib:test:test/connections/native_postgresql" "/Users/brian/.gem/ruby/1.8/gems/rake0.8.7/lib/rake/rake_test_loader.rb" "test/cases/base_test.rb"
Using native PostgreSQL
Loaded suite /Users/brian/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
…………………………………………………………………………………………………………………..
Finished in 3.321415 seconds.
131 tests, 336 assertions, 0 failures, 0 errors

SUCCESS!

Tags: , ,