Connecting to Multiple Databases in ActiveRecord

Posted May 8th, 2009 by Daniel
Categories: Ruby, Software, Tips

On occasion, you’ll have the need to connect to multiple databases in ActiveRecord. Here’s a quick example (dare I say ‘tutorial?’) of how to do just that.

Read the rest of this post »

Using ActiveRecord in a Script

Posted May 6th, 2009 by Daniel
Categories: Ruby, Software, Tips

With the introduction of SQLite support to ActiveRecord some time ago, now more than ever, ActiveRecord can be a useful component in medium to complex scripts. Here is a short introduction to using ActiveRecord without Rails in a simple script. Included is a script you can use as boilerplate for your own scripts. It is complete with ActiveRecord usage, and even one way of including RSpec tests right in the same script, so you can develop your script using the BDD methodology.

Read the rest of this post »

The Right Way to Reopen Ruby Classes

Posted May 4th, 2009 by Daniel
Categories: Software, Tips

As with many things in programming, there is “more than one way to skin a cat” where re-opening Ruby classes and extending them is concerned. In this post, I’ll focus on the right way to reopen Ruby classes, so the additions show where they came from, and aren’t lost in a morass of extension code.

Read the rest of this post »

Announcement: wxRubyTemplate

Posted April 18th, 2009 by Daniel
Categories: Software

I’m pleased to announce my new project, the wxRubyTemplate.

The aim of the wxRubyTemplate is to provide a starting structure within which to program your wxRuby project. The template provides a directory structure, a set of Rakefiles to manage, and most importantly, to package your Ruby application for distribution as a standalone program when completed. It also includes an environment to get the application running and provide basic services to the program code. For now, the template only supports packaging for Mac OSX and Windows, although various flavors of Linux should be easily accommodated and are planned for the future.

Audience

This template is initially aimed at Rubyists with some experience. If this is your very first Ruby project, then this template probably is not for you. This is alpha-grade software. As the work progresses, it should become a viable choice for less experienced developers.

Features

  • Packaging for Windows and Mac OSX into a standalone program with an installer.
  • Support for inclusion of specific versions of Ruby Gems. (Active Record is included in the template as an example)
  • Support for including arbitrary files needed to run specific Ruby Gems.
  • A script/console command for interacting with your non-GUI code.
  • Environment code that requires all of the code, and provides basic services to your code.
  • Includes a basic example of creating/reading/deleting objects via ActiveRecord.

Go check it out at Github:

http://github.com/duskhacker/wxruby_template/tree/master

Putting your Shoes on Faster

Posted November 26th, 2008 by Daniel
Categories: Software, Tutorials

Contents [Toggle]

I’ve been using Shoes for the GUI portions of some small side projects I’ve been writing. In the process I’ve written a small template/framework for starting off new Shoes projects that might be of help to others, so I’d like to present it here.

Features

  • Support for ActiveRecord using SQLite3, including -
    • Automatic creation of databases in an automatically created data directory (auto-database creation courtesy SQLite3)
    • Automatic per-environment migrations
    • Automatic per-environment loading of fixtures on empty databases
  • A “Tab Bar” which gives the ability to create an MDI-like Shoes application.
  • Automatic loading of classes placed in the ‘lib’ and ‘lib/shoes’ directory.
  • Automatic loading of libraries in the ‘/vendor’ directory
  • Automatic naming of application based on the filename found in the ‘/bin’ directory
  • Automatic generation of a variable representing the application root directory, accessible through the ‘Environment’ module
  • Automatic creation of an application data directory, accessible through the ‘Environment’ module
  • A console script to allow you to play with your (non-Shoes) classes interactively
  • Support for RSpec testing of non-Shoes classes
  • Rake tasks for running Shoes, RSpec examples and resetting the database.

Read the rest of this post »

ActiveRecord Case Insensitivity in Sqlite3

Posted November 21st, 2008 by Daniel
Categories: Tips

I wanted case insensitive order using ActiveRecord and SQLite3. While this is the default in MySQL, SQLite3 requires just a little more work to get the desired effect. Searching the Internet didn’t bring immediate satisfaction, so a careful reading of the SQLite3 documenation and a (very) little AR know-how brings the solution.

Read the rest of this post »

Who needs Quality Assurance?

Posted October 18th, 2008 by Daniel
Categories: Opinion, Software

Who needs Quality Assurance people (QA’s) that test an application before the business gets ahold of it? Agile development does not. This may be considered anathema in some circles but I’ve seen several projects with no QA’s that were quite successful in spite of, no probably in part because, they had no QA’s.

Read the rest of this post »

Communication is King in Software Development

Posted October 11th, 2008 by Daniel
Categories: Opinion, Software

Does everyone remember the stereotypical programmer in the movie Jurassic Park, Dennis Nedry, artfully portrayed by Wayne Knight? Obese, slovenly, lacking in social skills, greedy and disdainful of plain “users”, Nedry (most likely an anagram for “Nerdy”) epitomizes the public image of a programmer at that time.

Read the rest of this post »

So You Want to Read…

Posted September 21st, 2008 by Daniel
Categories: Ruby, Software, Tips

… a text file, and test it too!

Sometimes you’ll need to read in text files (typically CSVs) and act on a database. I do a lot of that, so I’ve come up with a couple of tricks to make writing these kinds of scripts easier. Since my favorite language is Ruby this example is Ruby based.

Read the rest of this post »

Setting up Wordpress on Mosso

Posted May 26th, 2008 by Daniel
Categories: Tutorials

Contents [Toggle]

Here is a very specific tutorial on setting up Wordpress on Mosso. It will also cover getting and installing WinSCP, which will be used to transfer files from your computer to the Mosso cloud.

This tutorial makes very specific assumptions about your setup and goals, as it is targeted at a very limited audience. If you are not part of the target audience (you will know who you are) these instructions will be of less value.

Let’s get started!

Read the rest of this post »