Wednesday, February 16, 2011

Project Euler–Problem 2

Description

From Project Euler:
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even valued terms.

Wednesday, February 2, 2011

Project Euler–Problem 1

In my constant effort to learn more, I’ve run into  a number of road blocks with my progression with YABE. Why? Because I’m trying to write my blog engine in Ruby on Rails, while I have little real experience with Ruby, Rails, RSpec, Gems, etc. etc. So I am trying to rectify this by at least getting the basics of the “Ruby way” down. My solution? Well simple really. I am going to go through and start implementing the problems from Project Euler in Ruby and testing my solutions using RSpec. I’ve already completed a few of the problems, which you can see here

Friday, October 8, 2010

Regenerating a decompiled database

With all of the work done to decompile the database it was time to take the big leap: reversing the procedure. Most of this wasn’t particularly difficult.

Sunday, September 26, 2010

WshBuild(ing) Relationships

So far our meta-data file contains some very basic information about the databases type, name, properties, and linked tables The next item on my agenda was relationships. Now I was of two minds about this, and I still am. But here is how I went about implementing it anyway.

Friday, September 24, 2010

How to output properties and remove imaginary tables

After my work getting the WshBuild to output a Project.xml file, I needed to start populating the data in it. There were three things that I wanted to do from the very start in this file. First, I wanted information about the database itself: it’s name, type, etc. Second, I needed the project properties. Finally, I wanted to eliminate the linked tables from the source export.

Thursday, September 23, 2010

WshBuild Progress – Sort of…

This past week I decided that I would indeed modify WshBuild to be able to regenerate a database from it’s exported source. Some of the things I came across were easier than anticipated, but others are turning out to be more difficult than I had initially imagined.

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.