Monday, July 13, 2009

My Wheelchair Ride to El Camino

On last Saturday, I went to Nijiya in Mountain View, CA. I actually missed Bus 54 which takes Mathilda ave. And I drove my chair to El Camino to get Bus 22. I love driving my chair and cruising cities, parks, and mountains, sometimes.

Here is the route I took on Saturday. It took just 30 minutes.

link tofrom my place to El Camino for larger map.

Bus 22 runs from early morning to late night. You can let me know if there are good public lectures, people gathering, or for just having a drink! Smile.

In theory, my char goes as far as 30 miles per charge. And I charge it each night, so ...

Thursday, July 9, 2009

Note: my first Inatant Rails app

I'm taking a Ruby class in this summer. In this class, We're learning how to build web applications using Ruby on Rails. I'm creating this blog post just as my cheating sheets for the class and recording what I did on my laptop before I forget.

So as my first entry of this series (whether I'm making this series or not) I put how I tested scaffold in this time. Scaffold is the simplest way creating M-V-C app. We just need to specify a table as model. Controller (list, new, edit, and delete) and Views (which is the presentation layer of app) are created automatically. So, let me start!
  1. Start Instant Rails by clicking the Icon or whatever
  2. Open a Terminal from Instant Rails
    (click [I]->Rails Applications -> Manage Rails Applications, and click "Create New Rails App..." button at the bottom of the new window.

  3. In the Terminal, type
    rails -d mysql app_name
    ... like rails -d mysql namelist
    This creates a batch of files under app_name

  4. check \config/database.yml for connection to DB.
    Notepad doesn't quite work, so use another text editor. (I'm using ConTEXT as my professor recommended.)

  5. In the Terminal,
    cd app_name .......... entering app dir
    rake db:create ........ create database named app_name_development
  6. In the Terminal,
    ruby script\generate scaffold table_name col_name:type...
    ... like ruby script\generate scaffold user name:string contact:string
    Technically, this creates a model which is actually a table in DB.
  7. In the Terminal,
    rake db:migrate ................ This creates the table in DB
    You can check it by entering mysql from another Terminal
    (show databases, use database, show tables are a few of mysql commands.)
  8. In Managing Rails App Window,
    click refresh, check your app, and click start with Morgel
    This starts your app.

  9. To test your app, in a browser, go to;
    http://localhost:3000/table name/new
    ... like http://localhost:3000/users/new
    I saw a couple of errors from Ruby console window being created as the app started. But after reloading the URL a few times, it went through.