The Original Jelani Harris The one and only

29May/113

Installing Ruby on Rails 3 in Windows

So last week I got a little tired of having to reboot my computer to dual-boot in a linux environment so that I could work on Rails stuff. Then I decided to try using Rails in Windows. Here's a step by step guide on how to install rails in Windows.

Install Ruby 1.9

To install ruby on our windows machine we will be using RubyInstaller. RubyInstaller is the easiest way to install ruby in windows. It includes the Ruby execution environment and documentation.

First download and install The RubyInstaller.  Installing it to C:\Ruby192 is perfectly fine. I would not recommend installing Ruby to a place that has spaces in it, like the Program Files folder.

From here you can also download the DevKit as well. It allows you to have RubyGems build C-based gems. If you decide to get the DevKit, just install it to the C:\Ruby192\devkit folder for now.

So as you're installing the RubyInstaller, Be sure to select, "Add Ruby Executables to your Path"

Now let's verify that Ruby has been correctly installed. Get to your command prompt (Via Start -> Run -> type in cmd). Then type in:

ruby -v

Then it should reply with something similar to:

ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

Now with your command prompt still open, let's check to see that RubyGems was installed as well:

gem -v

Hey that wasn't so difficult was it? I told you that RubyInstaller was easy 🙂

Install SqlLite3

So when running rails we would like to have a database to start off with without having to set up a local database connection. And of course, Windows does not support SqlLite right out of the box. Thus we will have to get it ourselves.

Go to the SQLite download page and find the precompiled binaries for windows section and download the sqlite-dll-win32-x86-3070603.zip

After unzipping that file, you should end up with the files sqlite3.dll and sqlite3.def. Copy both of those files into the C:\Ruby192\bin directory.

Also, while you're still at the SqlLite download page you should pick up the shell file (sqlite-shell-win32-x86-3070603.zip) as well. The command line shell is useful for looking around in your sqlite3 databases. Copy the executable in the zip also to the C:\Ruby192\bin directory. You can verify that this is installed by typing:

sqllite3 -version

Now we should install the ruby bindings to SQLite3

gem install sqlite3

 

Install Rails 3

Rails is distributed by RubyGems. When you install Ruby, the RubyGems system is also installed. This makes it really easy to install Rails.

Install Rails by typing:

gem install rails

This should take a few minutes because it is installing several of the Rails dependencies (ActiveRecord, ActionPack, ActiveSupport, etc).

When that is done installing, verify that the correct version of Rails was installed by typing

rails -v

And it should respond with 3.0.7 or higher

 

Creating a Rails application

Go into your development directory and type in:

rails new project_name

Replace the project_name with the name of your new application. You should see it create a bunch of new directories and files

Now we need to install the gems we are going to use with this project. You can install the gems using:

bundle install

Once those gems are installed, we need to create the sqlite3 database in your project directory by typing in:

rake db:migrate

Once that is done, start your rails server by using the commands

rails server

And then navigate to http://localhost:3000/ to view your application. It should look something similar to this:

 

Now get out there and start working on your web projects!

Filed under: Uncategorized 3 Comments
26Feb/090

No more updates to Google Notebook

One of the only Google app (apart from Gmail) that I use the most Google Notebook will have no more updates. Before I signed up to Google I used to keep all of the websites that I thought were useful in my bookmarks and that became really messy really quickly. Also with the useful firefox extension I can now just right click and add to notebook if I ever run across a website that I want to return to later.

Google notebook isn't perfect. I just wish they would continue making it a better product. But now that I think about it, Google is an company that makes most of it's revenue selling advertisements online (that I hardly see due to AdBlock) and I don't see how they could've made their Notebook app a profitable endeavor. I know that I wouldn't pay for a "pro" version, and that their ads  would be GreaseMonkey'd out or plain ignored - all I want is a list of bookmarks not solicitations!

Now I'm going to search online for other alternatives to replace and to transfer all of my bookmarks to. I'm looking at delicious right now - I just don't like sharing my bookmarks with the world too much. But maybe I'll let it go once I get my lifestream properly set up on here.

Filed under: Uncategorized No Comments
6Oct/080

Using overflow:auto for a tbody tag in IE 6.0

Guess what? It's not possible! in Opera 7.20, IE 5.5 or IE 6.0. Instead what happens is that it's treated like a regular table without the scrollbars. Also, the styling specified for the tbody is applied to every tr row. How lame.

Another reason why we all should just stop supporting IE 6.0.

8Aug/088

Remove Anchors from a Url in Javascript

Here is something useful that I discovered in my programming for the Apparatus Complex. I needed to strip out the anchor portion of a link and leave the rest of the url intact. For example I wanted:

http://jelaniharris.com/I-love-apple-pies#comments

To look like:

http://jelaniharris.com/I-love-apple-pies

Here's the ideal way to do this with Javascript:

	//Grab our current Url
	var url = window.location.toString();
	//Remove anchor from url using the split
	url = url.split(“#”)[0];

It doesn't get any easier than that. What this code does is grab the URL from the current window, and then splits the string where a '#' is. Whether or not if the '#' exists in the string, it'll truncates the string up to the '#' or return the whole url.

Thanks to Jonathan Rochkind in the comments for this simpler version.

Filed under: Uncategorized 8 Comments
27Jun/080

Old domain, new language

So I've been the proud owner of a new website that I was surprised to get: http://crimsonize.com. I've actually had it for awhile and nothing is there except an outdated version of WordPress, and a blank hello world page. I'm surprised that it hasn't been spammed (or hacked) to hell now. But now I need to do something with it.

I was considering making it a personal art portfolio, but now I'm leaning towards making it an art community where people share and critique each other's artwork. The only thing I'm concerned with is that I don't want people stealing art from deviantArt and claiming them as their own and having people complain to me about it. It's just one of those things I sorta don't want to deal with, and that I know I'm going to deal with when Apparatus Complex gets  popular in the future - when it's complete.

Of course before I actually go through with this community website I have to look at all of the "competition" and see what they do right and what they do wrong and then capitalize on those issues. That's business and research I suppose. Having facts and history and repeating it doesn't guarantee that a site will be popular.

Also, I do plan on creating this website in a new language. I've heard a lot of good things about Ruby on Rails (and not-so good things). I also just found out that my webhost, Site5, completely supports rails so there's no reason now why I shouldn't be learning this popular and new language.

The best way that I learn a new language is to have a project - or a goal - in mind so that I can visualize what my goal is and what I take the steps I need to do to get there. I'm not really one of those programmers that can just do all of the examples in a book and claim that I know the language. I have to get really deep into the planning of the project, and notice the parallels between the new language I'm learning and the old languages I already know. Like just skimming through some sample code, I notice that the way Ruby is structured it looks like Python with Java sprinkles. Or maybe, more like Java Flakes cereal with Ruby marshmallows.

(That actually sounds kinda delicious. I'm in the mood for Lucky Charms now.)

They say that once you learn/master one programming language, all of the other languages you want to learn get easier. I think that's 100% true.

Tagged as: , No Comments