Tagged with

ruby

About Matthew Wallace

The lowdown on Matthew Wallace:
I’ve been a  software engineer for more than a decade. The technologies and languages I specialize in are many. Problem solving is something I really enjoy.

Languages I work in: Swift, Objective-C, Actionscript, Java, Ruby, Python, C++, Javascript

Niche Technologies that I work in: Video streaming platforms using Wowza (Java), FMS, WebRTC. I also have done realtime alert and chat systems using the same technologies such as FMS, XMPP, and others.

I tend to work in three main areas. Desktop, Web, and Mobile application development.

What you will get out of this:
My website is meant to showcase things I’m working, things I’m learning or interested it and also if you are looking for a software engineer, you’ve come to the right place. Feel free to reach out. I’d love to hear about what you are working on and what need I can fill or problem I can help solve.

Clear mongodb in 3 lines of code using Mongoid

As always I am learning more and more about ruby and rails. Recently I choose to take a stab at using Mongodb as my database and move away from using more traditional DBs such as Sqlite and Postgres.

It has been a little strange not having to run rake tasks such a migrate to setup new database tables and such. If you find yourself needing to clear out all the data in the database and you are using the Mongoid gem such as I am in your rails project then you can run the rails console and do the following to clear everything out. I find this useful if you have been developing and need to clear out all your test data.

Mongoid.database.collections.each do |collection|
      unless collection.name =~ /^system./
        collection.remove
      end
    end

Upgrading to Rails 3.1 step by step.

If you follow the RoR world at all you know that Rails 3.1.0 is about too launch. I like to stay on the bleeding edge of stuff like this so I jump right in and install beta releases. Of course if you have a big production app you should dip your toe in carefully when doing such things but I am still learning ruby and rails so I see doing things like this as a great opportunity to gain a little more knowledge about the language and framework.

First up OS X 10.6.6 is my preferred OS so I am speaking to all you Mac users. My setup by the end of this post will be running ruby 1.9.2 and Rails 3.1.0.rc2. My goal was to get it up and running and also to launch an existing rails app even if I fall back to using rails 3.0 for now, until I get time to migrate the app to the latest version.

A couple of issues I ran into where around sqlite3 drivers and also when installing ruby with RVM, and there are some function names with in the sqlite3 bundle that need to be changes. I am not going to go into great detail but rather point you in the direction buy supplying step by step links that I used after searching on ways to fix each issue I ran into.

Each resource will get you going and is ment to be followed in order. My guess is you will run into issues that I didn’t see but at least you will have a good start and wont have to hunt for some of the solutions like I did.

  1. Upgrade or install ruby 1.9.2 using RVM – http://bit.ly/mqoZps 
  2. Install pre-release Rails 3.1.0.rc2 or whatever version it is gem install rails –pre from the command line. (check rubyonrails.org for more info) 
  3. You may have to fix an issue with your sqlite3 bundle so read this post if you get an error when trying to use sqlite3 http://bit.ly/kLSrMZ 
  4. You will probably run into a driver issue with sqlite3 now that you are using ruby 1.9.2 so you will need to make sure that any projects are using 1.3.1 gem or higher by adding the following line to any projects gem file or just installing the latest gem fromt he command line like so. 

gem ‘sqlite3-ruby’, “>= 1.3.1”, :require => ‘sqlite3’

Read the following post for more info on the sqlite3 gem issue I ran into if you like. It’s addressing a windows user issue but the fix worked for me as well. http://bit.ly/ihiSgU

Take the suck out of Flash development with Sprouts

I have been doing ruby on rails development over the last few weeks and I am loving it. The main thing I love about rails are the generators. My day job mostly consists of doing Flash development so needless to say I was really excited to run across Sprouts.

I have not worked sprouts into my workflow but from what I am reading on the project site the ability to have generators for Actionscript projects is going to be awesome for sure and I look forward to learning and posting more about it in the future.

Project Sprouts is a highly cohesive, loosely coupled collection of features that take some of the suck out of programming.

Sprouts is a modular development platform that takes advantage of Ruby and RubyGems to share code generators, libraries, executables and automated build tasks. It runs anywhere Ruby does, including OS X, Windows, and *nix variants.

Sprouts has been seen working on Mac, Windows and Linux and while it currently targets ActionScript, Flex and AIR development, tools can be easily created to improve any programming environment.


Image courtesy of KatieL366 and the Creative Commons license.

–>

What are are folks saying?

The best thing to happen to Flex since Matt Chotin….

Ryan Stewart, Adobe Flash Platform Evangelist

I swear project sprouts is the most significant single thing in terms of changing my work flow.

Stray, ActionScript developer

Why would someone use Sprouts?

There are lots of reasons to use Sprouts for your projects, here are some of mine:

  • Test-Driven Development is much easier
  • Decouple builds from development tools
  • Consistent environment across any size team
  • Platform independent tool chain
  • Automatically generate project files, directories, classes, test cases, and test suites
  • Continuous Integration simplified