MySQL Interlude

Blogged under MySQL by charlieahern on Wednesday 29 August 2007 at 7:58 am

As I got near the end of the Burd book, I kept thinking about the importance of databases and Active Record. However, I hadn’t touched SQL for several years. So, I decided to take a break from Ruby on Rails to study MySQL.

I’ve been working my way through MySQL Crash Course by Ben Forta, published by SAMS. Cover price $19.99.

I’ve completed the first 20 chapters with 10 to go. Usually, about 6 am I put on some quiet baroque or jazz music and work my way through most or all of a chapter, doing all of the examples.

Silicon Valley Ruby on Rails Meetup, 7/26/07

Blogged under Rails by charlieahern on Thursday 26 July 2007 at 10:50 pm

Just attended my first Silicon Valley Ruby on Rails Meetup. I plan to attend future SVRoR Meetups.

The first speakers were from www.wesabe.com, a personal finance (not investments) web app. I’m going to follow up on three topics that they mentioned; ActiveResource, OFX(Open Financial Exchange), and hashed passwords. From a business perspective, I also want to investigate a comment that the banking industry hits consumers with $17 billion in late fees and such.

Several people made “We’re hiring” announcements, which is a good sign.

The second speaker was the bootstrapping, sole proprietor of www.pazap.com. He wasn’t as polished in his delivery, but spoke with conviction about learning and applying RoR as his business platform. I’m glad to see bootstrappers and hobbyists get an opportunity as well as folks from VC-baced startups.

And, thanks for Verisign for the presentation room and pizza for at least 60 attendees.

db:migrate in RadRails?

Blogged under Rails, RadRails, ActiveRecord by charlieahern on Friday 15 June 2007 at 8:09 am

As I work my way through Burd, I’ve hit an important block. Listing 9-3 provides code to add columns to a table;

add_column :photos, :date_created, :date.

However, when I use Rake Tasks - db:migrate, the table doesn’t change. I can add rows, but not columns. The error message that I get is

uninitialized constant ActiveRecord (NameError).

Burd
implies that there may be a bug in the way RadRails handles db:migrate in its Rake Tasks tab. I’m assuming that I’m making a tiny mistake somewhere, but I can’t find it.

ActiveRecord is such an important aspect of Rails that I’ll beat my head against the problem until I resolve it. One path I’ve taken is to ask for help at Rails Weenie. If you want to see how that goes, check out Can’t Add Column to Table.

Ruby in RadRails, Like Java in IntelliJ IDEA?

Blogged under Ruby, RadRails by charlieahern on Wednesday 6 June 2007 at 9:28 pm

For the past few days I’ve been using IDEA, during my day job, to do some simple Java tweaks. As a result of my Ruby (and to a lesser extent RadRails) studies, this has gone a lot smoother than I expected. I don’t pretend to know Java (Head First Java and Head First Design Patterns sit on my bookshelf), but learning the syntax of Ruby hints at the Java syntax.

This fits in a bit with my longer term goal to also learn Java. First, I planned to learn PHP and then Java. Now, I’m learning Ruby as a possible entrance to Java. I say possible because I may find what I need in Ruby, but may want to learn Java ‘cuz everyone does it.

Although most of the Ruby on Rails books recommend RadRails, the original developers recently transferred(?) it to Aptana, a Javascript IDE developer. Although I’m using RadRails to learn RoR, IntelliJ IDEA 6.0 supports Ruby, so I may buy an IDEA license, because then I would use the same IDE at work and at play.

Transcribe Code, Fix Bugs, then Experiment

Blogged under Ruby by charlieahern on Wednesday 30 May 2007 at 8:28 am

As I work my way through the first Ruby chapter in Burd, I’ve developed a pattern that’s interesting, if slow.

Transcribe
I copy the code from the book, rather than using the available code files. This forces me to be aware of whether I should enter a {, (, or [. It also makes me more aware of indentation and why it should be used at certain points.

Fix Bugs
After I’ve entered the code, I run it, knowing that it probably contains typos. Ruby displays error messages. Then, I try to read and understand those to fix the typo bugs in my code.

Experiment
Once the sample Listing works, then I play around a bit. What happens when you use [a, b, c] rather than (a, b, c) for the parameter on an array.push? Sometimes typos suggest interesting experiments. It also helps to have Dave Thomas’s PickAxe book handy as you experiment.

Value Substitution (an Interpolated Expression?)

Blogged under Ruby by charlieahern on Monday 28 May 2007 at 9:22 am

Ruby provides a few ways to include a value in a string,

Substitution
name = "charlie"
puts "The blogger's name is #{name}."

Or, you could have some math in the string,
puts "A baker's dozen is #{12 + 1}."

Note that the string must use double-quotation marks (”) to perform the substitution.

to_s Method
name = "charlie"
puts 'The blogger\'s name is ' + name.to_s + '.'
If you use single quotation marks for the string, the backslash allows the single quote in blogger's.

As far as I can tell, Pine doesn’t introduce the concept of substitution. He uses single quotes as shown above, which prevents substitution.

I got a bit confused about “interpolated expression,” as used by Burd and Thomas-Prog. Substitution appears to be a form of “interpolated expression.” I’m not certain I understand “interpolated expression,” but I’ll work on it.

First Rails Scaffold … for Dummies

Blogged under RadRails, MySQL by charlieahern on Saturday 26 May 2007 at 8:42 am

Just finished Chapter 3 of Ruby on Rails for Dummies, by Barry Burd.

Now, I have my first Rails app up, thanks to RadRails, which does feel a bit automagic. Or, perhaps I’ve done my first fifteen-minute Rails demo. Having spent the past few weeks writing Ruby code in SciTE and running the code from the Windows command prompt, I needed a bit of instant gratification. Not that the old white-on-black command line isn’t effective, but I have to confess to being a GUI guy.

I particularly liked seeing the employees table in the MySQL Table Editor. Very automagic.

Problem Starting WEBrick…and Solutions(s)

Blogged under Servers, RadRails by charlieahern on Thursday 24 May 2007 at 8:46 am

Using:

RadRails 0.7.2, Windows XP Media Center Edition, Norton Internet Security.

Problem:

This was particularly frustrating for a newbie. In RadRails’ Servers view, click on the Globe icon to start the browser and the WEBrick server. RadRails displays “Starting Server” and the green progress bar activates, but the WEBrick server doesn’t start. Take a look at the Console tab, you’ll see:

Cannot find gem for Rails =1.1.6:
Install the missing gem with 'gem install -v=1.1.6 rails', or
change environment.rb to define RAILS_GEM_VERSION with your desired version.

  • Update: Aptana has logged this as bug 4422.

I updated environment.rb, but still got hung up at “Starting Server.” The Console showed I was hung up at

[2007-05-24 08:17:42] INFO WEBrick::HTTPServer#start: pid=5912 port=3000

Solution(s):

1. In Rails Navigator, go to [project name] > config.

2. Double-click environment.rb to open the file.

3. In the line RAILS_GEM_VERSION, change the version number to your current Rails version. For example, I changed mine from RAILS_GEM_VERSION = '1.1.6' to RAILS_GEM_VERSION = '1.2.3'

To check your Rails version number, at a command prompt, enter:
ruby rails -v

4. (optional) Then, WEBrick got hung up by Norton Internet Security. If you have NIS installed and running, turn it off for a few minutes to allow the WEBrick server to start. I’ll have to figure out how to tell NIS that WEBrick is a good guy.

Why Learn Ruby on Rails?

Blogged under Ruby, Rails by charlieahern on Saturday 12 May 2007 at 9:51 am

My interests include databases and web applications. I’d like to build a web app that takes advantage of a database, specifically MySQL.

Java in Eclipse seemed too general purpose, too cryptic, too industrial-strength. PHP attracted my attention; scripting as the front-end to a database for a web app.

While waiting for a functional spec review to start, I mentioned my plan to Nathan, one of the founding developers of the company that I work for. He recommended skipping PHP and to go for Ruby on Rails.

I still plan to tackle Java some day. (The books are on the shelf.) And, I will also give Python a closer look. But, for now…Ruby on Rails.

Hint: Norton Internet Security Conflict with WEBrick

Blogged under Servers, RadRails by charlieahern on Friday 11 May 2007 at 7:17 am

For some reason NIS was preventing WEBrick from starting up in RadRails. Turning off NIS allowed WEBrick to start, but that wasn’t a great solution.

For a few weeks I focused on Chris Pine’s book Learn to Program, so I didn’t pay attention to Rails issues. When I came back to Rails, I reinstalled InstantRails. Now, WEBrick starts up inside RadRails without a problem.

Early sysdmin error probably caused the problem. When I first installed RadRails and InstantRails (which seems a bit redundant), to avoid some problems I tried other approaches to get something working. Once I had Ruby available in the Windows XP Command Prompt, I worked with SciTE and the Command Prompt for a while.

Not all problems must be immediately solved.

Next Page »
Powered by Wordpress 2.1.3 - Theme: Triplets Id Band 2.0 by neuro