List Info

Thread: Tutorial idea, and thanks for cgi.rb fix!




Tutorial idea, and thanks for cgi.rb fix!
country flaguser name
United States
2007-03-28 21:16:57
Thanks to whoever fixed cgi.rb ( I think it was George ).  I
was 
planning to fix the dictionary/hash mismatch that was
causing 
nitro/part/admin to fail on posts.

I'm now thinking about how to learn Nitro, and composing my
own 
"outline" that could be expanded into a tutorial
as I go along.  I have 
the advantage of being a newbie -- and thus the perspective
that only a 
newbie can have on how the learning progresses.

I thought I would capture that experience while I'm still
unfamiliar 
with Nitro.   My past experience has shown me that, once I'm
advanced on 
a topic, I lose the perspective that's required to teach a
newbie the 
first steps.

So, that said, here's my idea of how I'll proceed, and if I
record my 
steps, it could be the framework of tutorial.

Only the first two sections seem clear...

I
Simplest possible demonstrations of:

  1) Nitro.start (  examples/hello )
  2) Controllers
  3) Templates ( two or three examples in a single
application )
  4) Og and admin ( a single table )

II
The second set would begin by introducing application layout
(  what gen 
produces ), and
use that to cover the following in more depth:

  1) Move from Nitro to Application, including dispatcher
  2) Multiple controllers
  3) Larger, nicer looking templates, xml, js, etc.
  4) A larger, more useful subset of Og functionality (
relationships, 
etc. )

III
Overview

  1) Libraries and their roles
  2) Configuration, initialization
  3) Architecture
  4) Parts

IV
A Real World Solution
  1) Ajax and Javascript
  2) RSS, XML, etc.
  3) Best practices (?)
  4) Application Design
  5) More Og tricks

V
Advanced Topics
???

Here, for example, is a first-cut at an Og and admin
demonstration for 
the first section:


|
======================
File: ./README
======================
Simple demonstration of Og: Nitro's database layer and ORM.

Invoking "ruby -rubygems app.rb" initializes a
sqlite database
and starts an HTTP server on port 9000.

Due to Nitro's admin scaffolding you can begin working with
the database
immediately.

Assumes you've got sqlite3 and the ruby sqlite3-ruby gem
installed.
If not, and you've got postgres or mysql, modify Og.start in
app.rb:

For mysql
#
#  Og.start(
#    :name => "mydb",
#    :adapter => :mysql,
#    :user => 'root',
#    :evolve_schema => false # true
#  )

For postgres
#
#  Og.start(
#    :name => "mydb",
#    :adapter => :postgresql,
#    :user => "postgres",
#    :password => "postgres",
#    :evolve_schema => false
#  )
|
|
#========================================================
# File: app.rb
# First Og demo  
#========================================================
#
# Demonstrates Nitro's Object-Relational database
# layer.   Similar to ActiveRecord, but much more
# intuitive for OO programmers
#
# Invoke using "ruby -rubygems app.rb"
#
# Should start up instance with WEBrick on port 9000.
#
# Index page will direct you to /admin, which allows
# you to use Nitro's scaffolding to manipulate database
# records.
#
#========================================================


# require glycerin if running from source checkout
#
# glycerin modifies ruby paths to pick up nitro from
repository checkout.
# there may be conflicts if nitro gems are also installed on
machine.
#

require
"#{File.dirname(__FILE__)}/../../script/glycerin"


require 'nitro_and_og'  ## boilerplate require
include Nitro           ## must include module for
functionality

require 'item'            ## Og will recognize 'item' aw our
database 
object ( see item.rb )
require 'test_controller' ## our controller.

#
# admin part serves as scaffold for database editing
#
require 'nitro/part/admin'

#
# Start og.  Database is created if it doesn't already
exist
#
Og.start(
  :name => "items",       ## database name
  :adapter => :sqlite,    ## see README if you don't have
sqlite3
  :evolve_schema => false ## true
)

Nitro.start TestController ## nitro automatically creates
controller 
from class


|
|

#======================
# File: ./item.rb
# data model for Og demo
#======================
#
# A simple 'require' is all that's needed for Og
# to find this file and treat it as a database object
# ( table ) definition.
#
class Item

   # type must be defined for Og to pick up fields
   # Otherwise Og will ignore this -- it won't become a
table

   attr_accessor :content, String
   attr_accessor :source, String
   attr_accessor :title, String

   ## "name" is helpful for scaffolding library.
   ##  admin part displays 'name' when listing records

   def name
      title
   end
end

#============================
# File: ./test_controller.rb
#
# For convenience, http://localhost:9000/
# provides a link to admin functionality
#
#============================

class TestController
   def index
      render_text "<a
href='/admin'>Admin</a>"
   end
end

|

_______________________________________________
Nitro-general mailing list
Nitro-generalrubyforge.org
h
ttp://rubyforge.org/mailman/listinfo/nitro-general
  
Re: Tutorial idea, and thanks for cgi.rb fix!
country flaguser name
Germany
2007-03-29 06:06:33
Hi,


> I'm now thinking about how to learn Nitro, and
composing my own
> "outline" that could be expanded into a
tutorial as I go along.

> So, that said, here's my idea of how I'll proceed, and
if I record my
> steps, it could be the framework of tutorial.

I absolutely _love_ your outline.  This has the potential to
grow
into _THE_ standard tutorial for Nitro/Og.

Nitro deserves a 'complete' tutorial.  If you need any
information, I'd
be more than happy to provide details.
I have some pictures (graphs) here, describing some features
of Nitro/
Og.  Would you be interested in those?


Sidenote:  why did you set :evolve_schema to false in your
example
            Og configuration?


Jo
PS:  if you consider using Oxywtf as framework for your
Tutorial but
deem it lacking 'something', just go ahaid and ask!

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

_______________________________________________
Nitro-general mailing list
Nitro-generalrubyforge.org
h
ttp://rubyforge.org/mailman/listinfo/nitro-general

Re: Tutorial idea, and thanks for cgi.rb fix!
user name
2007-03-29 07:01:58
This tutorial idea seems nice. In the next version of Nitro
i plan to
offer a single but complete demo of Nitro, the new blog
example. It
will be extremely easy to follow and will demonstrate the
new advanced
features of nitro 0.50.0 If you need any help with the
tutorial,
please contact me.

-g.

On 3/29/07, Jonathan Buch <johnoxyliquit.de> wrote:
> Hi,
>
>
> > I'm now thinking about how to learn Nitro, and
composing my own
> > "outline" that could be expanded into a
tutorial as I go along.
>
> > So, that said, here's my idea of how I'll proceed,
and if I record my
> > steps, it could be the framework of tutorial.
>
> I absolutely _love_ your outline.  This has the
potential to grow
> into _THE_ standard tutorial for Nitro/Og.
>
> Nitro deserves a 'complete' tutorial.  If you need any
information, I'd
> be more than happy to provide details.
> I have some pictures (graphs) here, describing some
features of Nitro/
> Og.  Would you be interested in those?
>
>
> Sidenote:  why did you set :evolve_schema to false in
your example
>             Og configuration?
>
>
> Jo
> PS:  if you consider using Oxywtf as framework for your
Tutorial but
> deem it lacking 'something', just go ahaid and ask!
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

> _______________________________________________
> Nitro-general mailing list
> Nitro-generalrubyforge.org
> h
ttp://rubyforge.org/mailman/listinfo/nitro-general
>


-- 
http://georgeandstella.com

http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
_______________________________________________
Nitro-general mailing list
Nitro-generalrubyforge.org
h
ttp://rubyforge.org/mailman/listinfo/nitro-general

Re: Tutorial idea, and thanks for cgi.rb fix!
country flaguser name
Germany
2007-03-29 08:45:13
Hi,

> This tutorial idea seems nice. In the next version of
Nitro i plan to
> offer a single but complete demo of Nitro, the new blog
example. It
> will be extremely easy to follow and will demonstrate
the new advanced
> features of nitro 0.50.0 If you need any help with the
tutorial,
> please contact me.

the more tutorials the better.  ^___^

Jo

-- 
Feel the love
http://pinkjuice.c
om/pics/ruby.png
_______________________________________________
Nitro-general mailing list
Nitro-generalrubyforge.org
h
ttp://rubyforge.org/mailman/listinfo/nitro-general

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )