Using Ruby with Postgres on Ubuntu 10.04 LTS

Installation of PostgreSQL on Ubuntu is straightforward, see http://library.linode.com/databases/postgresql/ubuntu-10.04-lucid

To create a simple database with its own user use the command line:

appenv=myapptst
psql <<EOF
  create user ${appenv} createdb password '*****';
EOF
createdb --username=postgres --owner ${appenv} ${appenv}

To access the database from Rails use pg

gem install pg

Entries in database.yml should look like

development:
  adapter: postgresql
  username: myappstst
  password: mypwd
  database: myapptst

Domain Registration

The most popular domain registrars are ranked by Webhosting.info The most popular registrar by far is GoDaddy.com, which rents dot-com domains for less than $12/yr. and includes free DNS management, email and a simple website wizard that can build a basic landing page. Other large online registrars include Enom and Network Solutions. Tucows is a wholesaler and does not sell registrations online. Lifehacker readers recently recommended namecheap.

Building a Windows 7 Image for Dell ImageDirect

ImageDirect is a Dell service that allows you to customize the software on a Dell PC before it ships from Dell’s manufacturing facility. In a distributed organization ImageDirect saves PC support staff from unboxing new PCs, ‘staging’ the PC with preferred configuration settings and software, and boxing and reshipping the PC to its final destination.

With Windows XP the ImageDirect process was as simple as uploading a disk image created with Symantec Norton Ghost, but with Vista and Windows 7 the process has become more sophisticated – and complex. The main benefit of the newer approach is that the customizations are merged with the latest Dell drivers for a given machine model, so one customization image can be applied to multiple models, and it will stay current as newer hardware revisions are shipped by Dell. The drawback is that the customization image has to be more carefully prepared in accordance with Dell’s guidelines (eg. only Professional edition or higher is supported), and can only be used on hardware specifically supported by Dell’s ImageDirect service.

The steps can be summarized as follows:

  • Use only supported hardware to build the customization image. Turn off various BIOS settings as instructed in Dell’s documentation.
  • Discard any software already on the machine. Reinstall Windows 7 from Dell’s OEM media. Delete any factory installed recovery partition.
  • Download and install only the NIC driver from Dell’s support site. Don’t install any other Dell device driver software.
  • After installation enable the Local Administrator account (net user administrator /enable:yes).
  • Log into the local administrator account and delete the account created during the installation process.
  • Customize the local administrator account and install software as required. Check for and install any updates then turn off further automatic updates.
  • Unconfigure any network interfaces (ipconfig /release)
  • Make a system backup.
  • Install and run the Dell Windows 7 Capture tool from DVD.

Once a customization image has been uploaded it has to be retrieved and audited by applying it to a sample machine, possibly the same machine that was used to prepare the image in the first place. Make sure any NIC has an Ethernet cable attached as otherwise the restore may fail.

My first experience with ImageDirect was not as positive as I had hoped for. Dell direct sales has limited familiarity with how ImageDirect works. The upload/download process for 4+GB files is time consuming. The high speed file transfer utility provides better transfer rates using UDP, but there was no way to recover if a transfer was interrupted. The ImageDirect build process can take several hours to prepare an installation image based on an uploaded customization image. The imaging installation process has bugs: troubleshooting issues can wipe out the savings promised by the factory automation. In summary this offering has great potential for larger deployments but be prepared for an upfront investment in time and effort that may not be worthwhile for smaller deployments.

Firefox or Chrome?

Nine months ago the official launch of Chrome Extensions marked a significant milestone in its competition with Firefox. Now Lifehacker is reporting a significant shift in it’s readership from Firefox to Chrome.  What struck me, however, are the areas where Firefox still wins, including extensions like Firebug, NoScript and Adblock Plus.  I now use Chrome for UIs like GMail, Yahoo Mail and Outlook Web Access, but improved speed is not enough incentive to wean myself onto a new set of browser features and extensions for general use.

Google Apps Sync

Used to be I always worked in a corporate environment where someone else was responsible for providing email with Microsoft Exchange and everyone used Microsoft Outlook.  Email was not my problem, life was good.

Now I have my own business and I manage email for clients with limited resources.  Life, or at least email, is a lot messier.

Common options these days are

  • Run your own Microsoft Exchange on Windows Server.
  • Use a hosted Exchange solution, eg. from Rackspace.
  • Use Google Apps.

My experience with Google Apps Sync has not been as seamless as I had hoped for: calendars didn’t seem to sync quite right, and including iPhones with ActiveSync just made it worse.  Then there was all the confusion around Apps Sync wanting to remove emails from in-boxes over 2-4 GB – maybe justifiable but it just didn’t work in the same way as Exchange, and sometimes trying to introduce change in an organization is simply not worth it.  My client is now happy with hosted exchange from Rackspace: not as cheap as Google Apps, but cheaper for a mid-sized organization than administering email in-house.

Installing Phusion Passenger on Ubuntu 10.04 LTS

Before installing Phusion Passenger you will need a working installation of Rails:

apt-get install ruby rubygems # distro packages rubygems 1.3.7
gem install rubygems-update
PATH=$PATH:/var/lib/gems/1.8/bin
update_rubygems
gem install rails -v=2.3.4 # or whatever

The Phusion installation script builds an Apache loadable module by linking various libraries. Make sure these libraries are installed before running the script.

apt-get install build-essential ruby1.8-dev libopenssl-ruby
apt-get install apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev
apt-get install libcurl4-openssl-dev

gem install passenger
passenger-install-apache2-module # compilation dependencies satisfied above

The Passenger installation script displays a message to add some lines to your Apache configuration script. One way to do this with Apache2 on Ubuntu is:

cat > /etc/apache2/mods-available/passenger.load <
   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15
   PassengerRuby /usr/bin/ruby1.8
EOF
a2enmod passenger
/etc/init.d/apache2 restart

pgLoader

One of the weaknesses of PostgreSQL compared to Oracle is the lack of a strong bulk loader utility like sqlldr. Natively Postgres offers only the COPY command, which does not include suppport for a bad file and reject log. EnterpriseDB have acknowledged the need for a better tool but it has not been a priority. There is, however, a Python based utility called pgloader available through pgFoundry that wraps COPY and provides a usable bulk loader. Using Python with Postgres requires psycopg2: for Windows an installable package is downloadable from Stickpeople,  for Ubuntu installation can performed with:

apt-get install tcllib libpgtcl-dev python-psycopg2

pgLoader itself is simply a collection of scripts in some folders so download and untar as follows:

wget http://pgfoundry.org/frs/download.php/2294/pgloader-2.3.2.tar.gz
tar zxvf pgloader-*.tar.gz

Ruby, Python & ODBC

I recently tried extracting data from an Access database using Ruby and ODBC.  The first challenge is that Windows ODBC drivers can be either 32 or 64-bit.  On a 64-bit host only the 64-bit configuration panel is present in the control panel, and the 32-bit panel must be accessed directly by invoking C:WindowsSysWOW64odbcad32.exe.  More seriously, however, the ruby-odbc home page only lists Win32 binaries compiled using Microsoft Visual C, but the popular RubyInstaller for Windows distribution is compiled with MinGW making the two effectively incompatible.

Contrast this with Python which has pyodbc downloads compatible with the canonical distribution from python.org, even if trailing the latest release.  For enterprise applications there is even a commercial ODBC driver supported by egenix.

Both Ruby and Python also have DBI interfaces, but Python DBI has been deprecated, and for Ruby the DBD-ODBC implementation relies on the same underlying ruby-odbc package.  For now it looks like I’ll be sticking with Python for ODBC.

OpenSolaris is Dead

Looks like concerns about Oracle’s Sun acquisition are being fulfilled.  After suing Google using a loophole in the Java license and losing James Gosling Oracle has now cut back significantly on the openness of Solaris development.  Whether or not this was a good business decision this is surely damaging to Oracle’s reputation amongst supporters of FOSS, and great news for Microsoft.  Like MySQL and MariaDB there is already now a community effort sponsored by Nexenta to fork OpenSolaris outside Oracle.

Posts navigation

1 2 3 4 5 6 7 8 9 10 11 12 13
Scroll to top