Thursday, September 16, 2010

More work on WshBuild?

A while ago I posted about a little project I was working on for work called WshBuild. I’ve slowly been making tweaks to it as I need them at work. I have a couple of addins, one especially for MS Access.  This was the primary reason why I wrote it in the first place, to automate my build process for one of the databases I am in charge of.  I use the Windows Script Host because it makes COM automation a little easier for me. That allows me to control an instances of Access to perform things like mde/ade file generation, compacting databases, and other things.

Sunday, August 29, 2010

Installing Rails 3 on Ubuntu 10.04 (Lucid)

This is mostly just for my purposes as it was not an easy task to get this to work. If it helps someone else, great!

Install GIT

Git needs to be installed in order to use RVM properly. Since the version of Git that is available through debian package is rather old, this is the process to get the latest version of git installed.
  1. Install build dependencies for git:
    $ sudo aptitude build-dep git-core
  2. Download the latest version of git (in this case 1.7.2):
    $ wget http://kernel.org/pub/software/scm/git/git-1.7.2.tar.gz
  3. Extract archive and change to the extracted directory:
    $ tar xvzf git-1.7.2.tar.gz && cd git-1.7.2
  4. Build git from source:
    $ ./configure && make && sudo make install
  5. Verify the installation of git:
    $ git --version
  6. Assuming everything worked, you can now remove the source:
    $ cd ../;rm -rf git-1.7.2 git-1.7.2.tar.gz

Install RVM

Ruby Version Manager (RVM) is the easiest way to install and switch between different versions of Ruby. While apt-get does tend to be easier on Ubuntu, you don’t necessarily get the latest version, which is what I wanted for Rails 3.
  1. Install curl:
    $ sudo aptitude install curl
  2. Install Ruby build dependencies:
    $ sudo aptitude build-dep ruby
  3. Install RVM:
    $ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
  4. Add the following line to your .bashrc to install RVM as a function:
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
  5. Restart your bash terminal and check that RVM is indeed a function:
    $ type rvm | head -n1
    rvm is a function
  6. Check to see what other dependencies you may need (Update: I got this list of dependencies from $ rvm notes, it varies from host to host and which interpreter variants you intend to install):
    $ sudo aptitude install bison build-essential zlib1g zlib1g-dev openssl libssl-dev libreadline5 libreadline5-dev libreadline6-dev libxml2-dev patch subversion autoconf libsqlite3-0 libsqlite-dev sqlite3
  7. Install Ruby version 1.8.7 first:
    $ rvm install 1.8.7
  8. Use Ruby 1.8.7:
    $ rvm use 1.8.7
  9. Install latest version of Ruby (in this case 1.9.2):
    $ rvm install 1.9.2
  10. Use latest Ruby and set as default:
    $ rvm use 1.9.2; rvm --default 1.9.2
  11. Check that Ruby and RubyGems are the proper versions (1.9.2/1.3.7):
    $ ruby -v
    ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
    $ gem --version
    1.3.7
  12. Install Rails 3 (Update 2: Shortly after posting this, Rails 3 was officially released, so the --pre option is no longer necessary):
    $ gem install rails --pre 
After the last step you should have a copy of  Ruby 1.9.2 with the Rails 3 gem installed. Also note that I’m using the user-level install of RVM. It does not require root and is not available to other users on the system. If you need those things, you might want to check out RVM’s install procedures.

Friday, July 16, 2010

Anniversary – 5 years and counting

Just a real quick note. Today marks five years since my wife and I got married. Smile
We are heading off to Atlantic City today, and I will be out of touch for the remainder of the weekend. (Yes, I know this presumes that I would be in touch any other time, but let’s not go there…)
I actually have all of next week off as well, so I will probably be online much more frequently than usual. So I will see you all on Monday.

Thursday, July 15, 2010

Windows Script Host Build System

Not a very big project, but this was something I needed for work. I have to maintain a number of Access databases at work that the company will not allow us to upgrade to full blown applications.  Some of these are becoming fairly non-trivial. As such I wanted a simple build system in place to automate tasks such as compiling MDE/ADE files, updating version numbers, and deploying to targets.
I know I could have used any of a number of build systems, and honestly, I really wanted to use psake, but unfortunately we run Windows XP without PowerShell at work (and corporate will not allow me to install it). Most of the other systems out there (like Nant, Ant, MSBuild, etc.) don’t offer any support for Office automation. So I wrote this very basic build system in VBScript using Windows Scripting Host. It allows easy access to automation so I can do tasks like compacting/repairing databases and compiling.

Wednesday, July 14, 2010

Did you ever get the feeling your doing it wrong?

I am well aware that I am not the best application developer in the world. I have a driving need to learn, but I’m not a professional programmer. As such, I have no mentors other than those I find online. I also have only limited time to devote to both learning and actually putting that learning in to practice.
Where am I going with this? I’ve come to the conclusion today that I am trying to do my testing all wrong. I am trying to use test first development with Cucumber style tests (using NBehave) for the ASP.Net MVC version of Yabe.  Trouble is, I’m trying to unit test in this manner. And that is just not working. So I’m going to scrub my existing tests (note: not the test specifications, just the actual tests). The plan is to convert my existing specification tests into integration level tests and start a whole new collection of unit tests using the simpler arrange/act/assert within a fixture style testing.
The new structure will hopefully allow me to reuse some of my existing code (just rearranging it somewhat).  The biggest thing is going to be having to find a framework that will allow me to actually spin up ASP.Net and test it. I am thinking of possibly using IIS Express or Cassini to spin up a web server, then use WatiN to actually run the tests.

Monday, May 3, 2010

Yabe – Where to start?

OK, so I haven’t been as diligent as I had hoped, but I’m starting to code now. If you check out the github repository, you can see the change log. 

Thursday, March 4, 2010

Yabe – Take 1

So after a lot of initial prep work (which probably wouldn’t have taken so long if I had more than an hour a day to devote), I now have a very simple test server in place and a repository on Github. As of right now, it only contains stubs for all three editions (ASP.Net MVC, Ruby-on-Rails, and PHP-on-Trax).  I have started a simple tutorial for Ruby-on-Rails that is translating well to the PHP-on-Trax (at least for the moment), but I fully intend to start diverging the two as I get more accustomed to the “proper” way to write PHP.
I’ve opted to maintain all three editions in the master branch as apposed to giving each it’s own branch. This was done because I don’t see the three as being branches of the same code base, I see them as different editions of the same software. Hopefully this works out well, but if not… well git makes it very easy to correct this if I decide to go another route later. Happy
Finally, I’ve set up some project management software to keep all of my user stories. I’ve opted for Agilefant installed in a virtual Apache server. I’m going to use this to track the features I have implemented and what I’ve yet to do. For bug tracking, however, I intend to use the system that Github provides for me.

Wednesday, February 10, 2010

The cost of doing things the right way…

Sometimes, it just pays to do a little cost/benefit analysis on the things your trying to do. I was reminded of this today in a rather stark way.
I did some data entry in a web application that I was running on a Windows server. It took me about 4 hours to enter all of this data. I am in the process of trying to get rid of this server instance, however. So in an attempt to save work, I moved the web application and database over to my new Linux server. Here is what happened:
  1. It took approximately 2 hours to export all of the data from SQL Server and import it into my MySQL database.
  2. Another hour was spent configuring Apache for the web application and configuring the web application to talk to MySQL.
  3. I’ve now spent over 9 hours on porting all of the SQL statements and trying to fix all of the compatibility issues. There are a number of assumptions that were made (like what the path seperator character is) that were based on it being on a Windows server. I still have several required areas of the application that have not been ported yet.
That is a total of 12 hours invested in porting this application to Linux, and it isn’t even close to being done. A day and a half (actually, since I only actually work on this for two hours a day, it is more like a week) down the drain. Now compare this to:
  1. Research and download a new web application written specifically for Linux (Apache/MySQL). About an hour.
  2. Install said application. Another hour.
  3. Reinput all of my data from a print out made from the original application. Another four hours.
I spent 12 hours trying to avoid a problem that would have only taken me six to do correctly in the first place. Not a very productive use of my time. Sad