Merry Christmas

So day after Thanksgiving is when you break out Christmas stuff, right? Well in keeping with my little thing (I won't call it a tradition), last year, I've changed up my blogger template to a Christmast theme. except this year I have a ton more knowledge of CSS, and so I've been able to pull off some pretty funky effects. And besides that I created a new background image (the star), so it isn't so boring now.

I will STILL not break and use cute pastel backgrounds and things, because that's lame. Nor will I upgrade to the new Rails-style templates that they have in the blogger template builder. I'm sticking with the old Minimal Black style by Douglas Bowman, and changing up the css colors and background images. So enjoy! I've got backups of my old style, so that'll be coming back in about a month and a half. ;)

Pandora Music

Pandora.. Great selection of music, stays on topic and all that. But there a way to prevent the computer inactivity timeout? Stops playing, starts giving me whiny messages of "Are we playing to an empty room? It costs us to play these songs so we don't want to be playing to nobody."

However, I've got my computer set up with a Kensington FM transmitter so I can listen upstairs (bad laptop won't support hardly anything streaming, bad sound card, etc.). So no, Pandora, you're NOT playing to an empty room. You're playing IN an empty room. But yes we are all still listening.

Running a short test right now to see if that notification is based on website or computer inactivity. If computer inactivity (mouse movement, screensaver, etc.), I'll just keep mouse jiggler running when I want to run Pandora, and that should keep it live. If not, I'm screwed. Either that or I'll just by a Wi-Fi media player one day. When I have actual money that is.

Initially I had hoped that they might have something like an open API which would allow me to develop (with more effort than I'm willing to put into it), an application which would let me control playback from a remote machine. But alas. No... However I did find a plugin hack to play Pandora in Winamp. I'll look into that. Hopefully if that works, I can set up a few Winamp tools to work with it and be able to control it remotely from there. However, this hack uses Pandora Mini, which I believe is a scaled down, no controls version. Well, maybe it's like mobile with Like, Dislike and Fastforward. We'll see. I'll have to try it out later, but right now I'm blogging. Come on!!

Ruby on Rails for Windows

It was only recently that I FINALLY figured out just what Ruby on Rails is. From most of the posts I saw all I could make of it was "it's the thing that runs Twitter." what's it DO?

Well as it turns out, from what I can make of it, Rails is a new web framework designed to streamline web design...BETTER than PHP/ASP/Javscript. So basically it's a new kind of webserver.

Well I decided that I wanted to try it out. Unfortunately, I don't run on Linux, and every time I do I get very frustrated. So I decided to try and get it going on Windows (XP to be exact). And I did it! Of course, I had to use an online tutorial (which is fairly outdated by about 2 years) located at All About Ruby on Wordpress.

And with a few modifications and updates to the main system, I was able to get it to work as is right now!

And this is as follows:

Install MySQL (or any other SQL engine, but I already have MySQL installed, so that's nice.)

Install Ruby (I had an old version 1.8.7, so I upgraded to 1.9.3p0. The tutorial says you'd also need to install gems, but I didn't have to. 1.9.x came with it pre-loaded. The installer for Windows is located at RubyInstaller. I installed to C:\Ruby\ (they recommended C:\Ruby193\, but I might want to upgrade. And what's next? Ruby194? Ruby200?).

I also made sure I included C:\Ruby\ in the windows path, and associated *.rb files. I also installed the TCL/TK addon, which I doubt I'll ever need, but hey, it's America where more is better!

One thing I also noticed later on in the installation was that I needed the optional DevKit located on the same page at RubyInstaller. At the time of this writing, the file is called DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe. Otherwise the "gem" (a friendly name for ruby add-on methods).

The GitHub tutorial states that DevKit was written under MinGW. Now I'm not too happy with Linux frameworks in Windows (MinGW, Cygwin, etc), so I was a little worried that I'd have to install the actual framework. Not so! If you look at the GitHub tutorial, you'll see it has installing boiled down into three nice easy steps.

Unzip (from 7zip format) into a nice friendly Ruby-Dev folder (I chose C:\ruby-dev\) and navigate in via cmd window. By the way, I've learned it's never good to run ruby scripts from Windows Explorer. If it fails, the resulting command window closes automatically and you never see what's going on, so it's better to Start/Run/cmd.exe and navigate in via the DOS window.

Once in the Ruby-Dev directory, you could run
ruby dk.rb.

This by itself will just display a help screen with what you're actually supposed to do.

ruby dk.rb init
This generates a config.yml (a configuration file which in this case just tells the installer where the actual Ruby installation is located). You can open this config.yml in a text editor and see what's going on. There should be an entry near the bottom that says something like
- c:/ruby
or some such. If this line doesn't match your Ruby installation, change it so that it does. Remember you only want to go as deep as Ruby's top-level directory, not "bin" or anything deeper.

Next you run:
ruby dk.rb review
and get to see exactly what it's going to do based on your config.yml. It's not too detailed, so you could just skip this step and go straight to:
ruby dk.rb install

It worked for me, even when I did the confirmations listed in the Devkit tutorial on Github, but I won't tell you how to do that here. You can just read it for yourself (see the link above).

With this done, I could now begin the Rails installation. Remember rails is simply a new way of web developing. Basically, underneath all of the sparkles, it's nothing more than a webserver. Sure a webserver with a completely new way of writing the actual pages, but a webserver nonetheless.

According to Rails On Windows, you can now install the Rails gem. Remember gems are just add-ons for Ruby, much like you can install Android development kits to implement for the Java language. Except gems are just little default programs that can be called from any other program you write yourself to add functionality.

So anyway, install the Rails gem with dependencies included by running from the command window:
gem install rails --include-dependencies

If all goes well, the script should download all of the gems required to run rails out of the box, plus all of the documentation (ri and rDoc).

Once this is done, you'll be able to create a new directory for your rails project(s) (I put mine in C:\Rails), navigate there and run:
rails firstproject

This will set your project up and hopefully not stall out and crash when it tries to install JSON support (it did when I tried, but that's why I set up the DevKit detailed before, and after I did, it worked fine).

Once it's completed and you have received the 'finished successfully' message, you can now navigate into that project folder (cd firstproject), and run:
ruby ./script/rails server

Rails will now start up and you should see a few messages such as:

=> Booting WEBrick
=> Rails 3.1.1 application starting in development on
=>Call with -d to detach
=>Ctrl-C to shut down server
[2011-11-12 13:17:03] INFO  WEBrick 1.3.1
[2011-11-12 13:17:03] INFO  ruby 1.9.3 (2011-10-30) [i386-mingw32]
[2011-11-12 13:17:03] INFO  WEBrick::HTTPServer#start: pid=952 port=3000
It may take a while for all of these messages to appear, but once they have, you can now go into your browser and navigate to http://localhost:3000 and HOPEFULLY see a 'Congratulations and welcome to Ruby on Rails' or some such title screen.

That's the extent of THIS tutorial. I still have yet to figure out how to set up the database and tables and make it all come together that way, but at least I got the server up and running and displaying something nice in my browser!