SlideShare una empresa de Scribd logo
1 de 36
Descargar para leer sin conexión
SINATRA
SEQUEL
W2TAGS
Work: SKYEIGHT (S8)
➢



At-Work: monorails/NET 2.0
➢



Outside-Work: ruby/javascript
➢
Sinatra
don't do
 Magic
Sinatra
 basic Concept

Throw URL
     DO Some Stuff
require 'rubygems'
require 'sinatra'

get '/' do 'Hello World' end

Throw URL
          DO Some Stuff
require 'rubygems'
require 'sinatra'

get '/' do 'Hello World' end
            DO Some Stuff
Throw
              Controller
  URL
             Return string
require 'rubygems'
require 'sinatra'

get '/' do
 @data = 'Hello World'
 erb :index                index.erb

end                      <%= @data %>


                           View
 URL      Controller
                       Return string
Simply
Sinatra
Sequel
require 'rubygems'
require 'sequel'
require 'sinatra'
DB = Sequel.connect(....)
class Entry < Sequel::Model
end
get '/' do
          @recs = Entry.all
          erb :index                index.erb
        end
                              <h1>Entry List</h1>
                              <% @recs.each do |r| %>
                                <%= r.title %>
                                <br/>
                              <% end %>
require 'rubygems'
require 'sequel'
require 'sinatra'
DB = Sequel.connect(....)

                              Model
class Entry < Sequel::Model
end
get '/' do
          @recs = Entry.all
          erb :index                index.erb
        end
                              <h1>Entry List</h1>
                              <% @recs.each do |r| %>
                                <%= r.title %>
                                <br/>
                              <% end %>
require 'rubygems'
require 'sequel'
require 'sinatra'
DB = Sequel.connect(....)

                              Model
class Entry < Sequel::Model
end
get '/' do
                              View
          @recs = Entry.all
          erb :index                index.erb
        end
                              <h1>Entry List</h1>
                              <% @recs.each do |r| %>
                                <%= r.title %>
                                <br/>
                              <% end %>
require 'rubygems'
require 'sequel'
require 'sinatra'
DB = Sequel.connect(....)

                              Model
class Entry < Sequel::Model
end
get '/' do
                              View
          @recs = Entry.all
          erb :index                index.erb
        end
                              <h1>Entry List</h1>
                              <% @recs.each do |r| %>
        Controller              <%= r.title %>
                                <br/>
                              <% end %>
require 'rubygems'
require 'sequel'
require 'sinatra'
DB = Sequel.connect(....)

                              Model
class Entry < Sequel::Model
end
get '/' do
                              View
          @recs = Entry.all
          erb :index                index.erb
        end
                              <h1>Entry List</h1>
 R                            <% @recs.each do |r| %>
        Controller              <%= r.title %>
ou                              <br/>
te                            <% end %>
MVC - R
require 'rubygems'
require 'sequel'
require 'sinatra'              Some Stuff
DB = Sequel.connect(....)

                              Model
class Entry < Sequel::Model
end
get '/' do
                              View
          @recs = Entry.all
          erb :index                index.erb
        end
                              <h1>Entry List</h1>
 R                            <% @recs.each do |r| %>
        Controller              <%= r.title %>
ou                              <br/>
te                            <% end %>
Simply
Sinatra
Sequel
W2Tags
require 'rubygems'
require 'sequel'
require 'sinatra'                                 index.w2erb
require 'w2tags'
                                                 %h1 Entry List
require 'w2tags/sinatra_hook'




                                 Auto Generate
                                 Auto Generate
                                                 -each @recs;r
                                                   = r.title
DB = Sequel.connect(....)
                                                   %br/
class Entry < Sequel::Model
end
                                                 index.erb
get '/' do
          @recs = Entry.all     <h1>Entry List</h1>
          erb :index            <% @recs.each do |r| %>
        end                       <%= r.title %>
                                  <br/>
                                <% end %>
W2Tags
   index.w2erb          index.erb

%h1 Entry List <h1>Entry List</h1>
               <% @recs.each do |r| %>
-each @recs;r
                 <%= r.title %>
  = r.title
                 <br/>
  %br/
               <% end %>
See the flow
        clearly
Sinatra
 crud
Entry
Action Method 1            Method 2
 List get '/entries'
 New get '/entries/new'    post '/entries/new'
 Edit get '/entries/:id'   put '/entries/:id'
Delete                     delete '/entries/:id'
Sinatra                    get '/entries' do
                                                    1
                             erb :entries_index


 crud                      get '/entries/new' do
                                                    2
                             erb :entries_new

Entry                      post '/entries/new' do
                             redirect '/entries'
Action Method 1           Method 2 do
                         get '/entries/:id'       3
 List get '/entries'       erb :entries_edit

 New get '/entries/new'put '/entries/:id' do
                          post '/entries/new'
                           redirect '/entries'
 Edit get '/entries/:id' delete '/entries/:id' do
                          put '/entries/:id'
Delete                    delete '/entries'
                           redirect '/entries/:id'
Sinatra crud
Display   Action
Sinatra
Simply
Magic
1     2      3



    W2Tags
    Simply
    Magic
Auto Generate
                1
Auto Generate
                1
Auto Generate
                2
Auto Generate
                3
Resources
Sinatra : http:/github.com/bmizerany/sinatra
Sequel : http:/github.com/jeremyevans/sequel
W2Tags : http:/github.com/wharsojo/w2tags
Demo : http:/github.com/wharsojo/demo_sinatra

              Thank you!
        slideshare.com/wharsojo...
rack


            Ec = New EventContex
          Ec.request = New Rack::Request
        ●


          Ec.response = New Rack::Response
        ●



                                                               Array of
                                                              code-block
                         before   Sinatra.application.filters all will be
     When error do
Sinatra.application.error                                      execute
or select .errors

                   Lookup Event
                                            Sinatra.application.events
            (post,delete,put,get,head) or
              do/raise error not_found                           Array of
                                                               code-block
                                  Code-block/render Execute    first match
                                  inside instance object of       will be
                       Render     EventContext                   execute
                     W2Tags/Erb
                   ●


                     Haml, Sass
                   ●


                     Builder                                   wh/id-ruby
                   ●
erb.hot
sinatra_table.hot
                                          5
                                                   11
                 1                        6
                             2
                     3
             1                       11
     1

                                          8
         2
                     4                    7
                             5
                                                   9
     4

         3                                             12
                                 6            12
                         7
                 8
9                                         10
10
sinatra_form2.hot
Sequel – DB Toolkit
DB[:tabel] #Dataset chainable method, return:Dataset
where, filter, exclude, order, reverse_order, uniq, limit,
paginate, join, inner_join, left_outer_join,

DB[:tabel]...all   #records (Array of record)
DB[:tabel]...first #record (Hash of field_name / value)
DB[:tabel]...order(:field).last #record
DB[:tabel]...map :field #Array of value

DB[:tabel]...[Integer / Hash]
Integer=> ...limit(Integer).all
Hash   => ...where(Hash   ).first

DB[:tabel]...[     2] #eq DB[:tabel].limit(     2).all
DB[:tabel]...[:id=>2] #eq DB[:tabel].where(:id=>2).first

#Summarizing: result Number
...count, max, min, avg, sum

#Manipulation
DB[:tabel]...delete, ...update, insert, <<

Más contenido relacionado

La actualidad más candente

Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
CGI With Object Oriented Perl
CGI With Object Oriented PerlCGI With Object Oriented Perl
CGI With Object Oriented PerlBunty Ray
 
Node.js for PHP developers
Node.js for PHP developersNode.js for PHP developers
Node.js for PHP developersAndrew Eddie
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJWORKS powered by Ordina
 
Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4Javier Eguiluz
 
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur..."How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...Fwdays
 
Javascript good parts - for novice programmers
Javascript good parts - for novice programmersJavascript good parts - for novice programmers
Javascript good parts - for novice programmersManohar Shetty
 
Hardened JavaScript
Hardened JavaScriptHardened JavaScript
Hardened JavaScriptKrisKowal2
 
(Parameterized) Roles
(Parameterized) Roles(Parameterized) Roles
(Parameterized) Rolessartak
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceJesse Vincent
 
STC 2016 Programming Language Storytime
STC 2016 Programming Language StorytimeSTC 2016 Programming Language Storytime
STC 2016 Programming Language StorytimeSarah Kiniry
 
Curso Symfony - Clase 2
Curso Symfony - Clase 2Curso Symfony - Clase 2
Curso Symfony - Clase 2Javier Eguiluz
 

La actualidad más candente (19)

Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
CGI With Object Oriented Perl
CGI With Object Oriented PerlCGI With Object Oriented Perl
CGI With Object Oriented Perl
 
JavaScript Basics and Trends
JavaScript Basics and TrendsJavaScript Basics and Trends
JavaScript Basics and Trends
 
Lazy Data Using Perl
Lazy Data Using PerlLazy Data Using Perl
Lazy Data Using Perl
 
Jquery 1
Jquery 1Jquery 1
Jquery 1
 
Node.js for PHP developers
Node.js for PHP developersNode.js for PHP developers
Node.js for PHP developers
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
 
PerlScripting
PerlScriptingPerlScripting
PerlScripting
 
PerlTesting
PerlTestingPerlTesting
PerlTesting
 
Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4
 
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur..."How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...
 
Javascript good parts - for novice programmers
Javascript good parts - for novice programmersJavascript good parts - for novice programmers
Javascript good parts - for novice programmers
 
Hardened JavaScript
Hardened JavaScriptHardened JavaScript
Hardened JavaScript
 
(Parameterized) Roles
(Parameterized) Roles(Parameterized) Roles
(Parameterized) Roles
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
Introduction to JQuery
Introduction to JQueryIntroduction to JQuery
Introduction to JQuery
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
 
STC 2016 Programming Language Storytime
STC 2016 Programming Language StorytimeSTC 2016 Programming Language Storytime
STC 2016 Programming Language Storytime
 
Curso Symfony - Clase 2
Curso Symfony - Clase 2Curso Symfony - Clase 2
Curso Symfony - Clase 2
 

Similar a fast prototyping with sinatra sequel w2tags

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientAdam Wiggins
 
Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009bturnbull
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On RailsWen-Tien Chang
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous MerbMatt Todd
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amfrailsconf
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About RailsAdam Wiggins
 
Ruby on Rails Intro
Ruby on Rails IntroRuby on Rails Intro
Ruby on Rails Introzhang tao
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with CucumberBen Mabey
 
Damage Control
Damage ControlDamage Control
Damage Controlsintaxi
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the TrenchesXavier Noria
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkBen Scofield
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2Rory Gianni
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon RailsPaul Pajo
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On RailsSteve Keener
 

Similar a fast prototyping with sinatra sequel w2tags (20)

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 
Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amf
 
Flex With Rubyamf
Flex With RubyamfFlex With Rubyamf
Flex With Rubyamf
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About Rails
 
Ruby on Rails Intro
Ruby on Rails IntroRuby on Rails Intro
Ruby on Rails Intro
 
Sphinx on Rails
Sphinx on RailsSphinx on Rails
Sphinx on Rails
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
Damage Control
Damage ControlDamage Control
Damage Control
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the Trenches
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon Rails
 
Sinatra
SinatraSinatra
Sinatra
 
Jsp 01
Jsp 01Jsp 01
Jsp 01
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On Rails
 

Último

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Último (20)

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

fast prototyping with sinatra sequel w2tags

  • 2. Work: SKYEIGHT (S8) ➢ At-Work: monorails/NET 2.0 ➢ Outside-Work: ruby/javascript ➢
  • 3.
  • 5. Sinatra basic Concept Throw URL DO Some Stuff
  • 6. require 'rubygems' require 'sinatra' get '/' do 'Hello World' end Throw URL DO Some Stuff
  • 7. require 'rubygems' require 'sinatra' get '/' do 'Hello World' end DO Some Stuff Throw Controller URL Return string
  • 8. require 'rubygems' require 'sinatra' get '/' do @data = 'Hello World' erb :index index.erb end <%= @data %> View URL Controller Return string
  • 10. require 'rubygems' require 'sequel' require 'sinatra' DB = Sequel.connect(....) class Entry < Sequel::Model end get '/' do @recs = Entry.all erb :index index.erb end <h1>Entry List</h1> <% @recs.each do |r| %> <%= r.title %> <br/> <% end %>
  • 11. require 'rubygems' require 'sequel' require 'sinatra' DB = Sequel.connect(....) Model class Entry < Sequel::Model end get '/' do @recs = Entry.all erb :index index.erb end <h1>Entry List</h1> <% @recs.each do |r| %> <%= r.title %> <br/> <% end %>
  • 12. require 'rubygems' require 'sequel' require 'sinatra' DB = Sequel.connect(....) Model class Entry < Sequel::Model end get '/' do View @recs = Entry.all erb :index index.erb end <h1>Entry List</h1> <% @recs.each do |r| %> <%= r.title %> <br/> <% end %>
  • 13. require 'rubygems' require 'sequel' require 'sinatra' DB = Sequel.connect(....) Model class Entry < Sequel::Model end get '/' do View @recs = Entry.all erb :index index.erb end <h1>Entry List</h1> <% @recs.each do |r| %> Controller <%= r.title %> <br/> <% end %>
  • 14. require 'rubygems' require 'sequel' require 'sinatra' DB = Sequel.connect(....) Model class Entry < Sequel::Model end get '/' do View @recs = Entry.all erb :index index.erb end <h1>Entry List</h1> R <% @recs.each do |r| %> Controller <%= r.title %> ou <br/> te <% end %>
  • 15. MVC - R require 'rubygems' require 'sequel' require 'sinatra' Some Stuff DB = Sequel.connect(....) Model class Entry < Sequel::Model end get '/' do View @recs = Entry.all erb :index index.erb end <h1>Entry List</h1> R <% @recs.each do |r| %> Controller <%= r.title %> ou <br/> te <% end %>
  • 17. require 'rubygems' require 'sequel' require 'sinatra' index.w2erb require 'w2tags' %h1 Entry List require 'w2tags/sinatra_hook' Auto Generate Auto Generate -each @recs;r = r.title DB = Sequel.connect(....) %br/ class Entry < Sequel::Model end index.erb get '/' do @recs = Entry.all <h1>Entry List</h1> erb :index <% @recs.each do |r| %> end <%= r.title %> <br/> <% end %>
  • 18. W2Tags index.w2erb index.erb %h1 Entry List <h1>Entry List</h1> <% @recs.each do |r| %> -each @recs;r <%= r.title %> = r.title <br/> %br/ <% end %> See the flow clearly
  • 19. Sinatra crud Entry Action Method 1 Method 2 List get '/entries' New get '/entries/new' post '/entries/new' Edit get '/entries/:id' put '/entries/:id' Delete delete '/entries/:id'
  • 20. Sinatra get '/entries' do 1 erb :entries_index crud get '/entries/new' do 2 erb :entries_new Entry post '/entries/new' do redirect '/entries' Action Method 1 Method 2 do get '/entries/:id' 3 List get '/entries' erb :entries_edit New get '/entries/new'put '/entries/:id' do post '/entries/new' redirect '/entries' Edit get '/entries/:id' delete '/entries/:id' do put '/entries/:id' Delete delete '/entries' redirect '/entries/:id'
  • 23.
  • 24.
  • 25.
  • 26. 1 2 3 W2Tags Simply Magic
  • 31. Resources Sinatra : http:/github.com/bmizerany/sinatra Sequel : http:/github.com/jeremyevans/sequel W2Tags : http:/github.com/wharsojo/w2tags Demo : http:/github.com/wharsojo/demo_sinatra Thank you! slideshare.com/wharsojo...
  • 32. rack Ec = New EventContex Ec.request = New Rack::Request ● Ec.response = New Rack::Response ● Array of code-block before Sinatra.application.filters all will be When error do Sinatra.application.error execute or select .errors Lookup Event Sinatra.application.events (post,delete,put,get,head) or do/raise error not_found Array of code-block Code-block/render Execute first match inside instance object of will be Render EventContext execute W2Tags/Erb ● Haml, Sass ● Builder wh/id-ruby ●
  • 34. sinatra_table.hot 5 11 1 6 2 3 1 11 1 8 2 4 7 5 9 4 3 12 6 12 7 8 9 10 10
  • 36. Sequel – DB Toolkit DB[:tabel] #Dataset chainable method, return:Dataset where, filter, exclude, order, reverse_order, uniq, limit, paginate, join, inner_join, left_outer_join, DB[:tabel]...all #records (Array of record) DB[:tabel]...first #record (Hash of field_name / value) DB[:tabel]...order(:field).last #record DB[:tabel]...map :field #Array of value DB[:tabel]...[Integer / Hash] Integer=> ...limit(Integer).all Hash => ...where(Hash ).first DB[:tabel]...[ 2] #eq DB[:tabel].limit( 2).all DB[:tabel]...[:id=>2] #eq DB[:tabel].where(:id=>2).first #Summarizing: result Number ...count, max, min, avg, sum #Manipulation DB[:tabel]...delete, ...update, insert, <<