buy clomid online

Archive for November, 2009

Ruby + Postgres on fedora

November 27th, 2009 | Category: geek,linux,Ruby

For persons who want to use postgres database on a Ruby program, a package are available.
To install this package use this command :

  1. yum install ruby-postgres

You can use this sample of code to test installation :

  1. #!/usr/bin/ruby
  2. require ‘postgres’
  3.  
  4. conn = PGconn.connect("host", 5432, , , "database", "user", "password")
  5.  
  6. res  = conn.exec(‘select tablename, tableowner from pg_tables’)
  7.  
  8. res.each do |row|
  9.         row.each do |column|
  10.                 print column
  11.                 (20-column.length).times{print " "}
  12.         end
  13.         puts
  14. end
  15.  

Ruby Extention :
http://rubyforge.org/projects/ruby-postgres/

No comments

The Google Story

November 20th, 2009 | Category: geek