All That Jazz An intro to Databases with JazzRecord ORM
A Little About JazzRecord - Library agnostic (originally a MooTools project)   - ORM inspired by ActiveRecord in Rails. Most behaviors directly portable.   - Current Platforms: - Gears - AIR - Titanium PR1 (and beta thanks to @jhaynie!)
Core Features - Finders - Validation - Association loading - Preloading - Post load   - Fixtures and Migrations
Creating Models - Basics var JazzLegend = new Model({ table: "jazz_legends", columns: { name: "text", primary_instrument: "text", years_active: "text" } });
Creating Models - Associations //new version of JazzLegend model JazzLegend = new JazzRecord.Model({ table: "jazz_legends", foreignKey: "jazz_legend_id", hasMany: {albums: "albums"}, columns: { name: "text", primary_instrument: "text", years_active: "text" } }); //associated model Album = new JazzRecord.Model({ table: "albums", belongsTo: {artist: "jazz_legends"}, columns: { title: "text", year: "text", jazz_legend_id: "number" } });
Finders and Record Data var miles = JazzLegend.findBy("name", "Miles"); var louis = JazzLegend.first(); var dizzy = JazzLegend.find(2); miles.primary_instrument //trumpet louis.years_active //1914-1971miles.name = "Miles Dewey Davis III"; miles.save();  
Finders and Record Data - Destroy dizzy.destroy(); //someone must've grown tired of Dizzy! Album.count(); //3 albums so far, all Miles Album.destroyAll(); //like that time you lost all your CDs// when your car was broken into... Album.count(); //0, no more Miles!!
Validations var Programmer = new JazzRecord.Model({ //... validate: { atSave: function() { this.validatesIsString("name",  "You must have a name!"); this.validatesIsFloat("income", "We will gladly pay you a null salary!"); } } }); - Callbacks run at time of create or save (or both) - Several built in validators (based on Rails') - Write your own
Validation Errors p = Programmer.newRecord({name: 42,      income: "spare change"});p.save(); //false p.errors.name ["You must have a name!"]p.errors.income ["We will gladly pay you null salary"]p.name = "Nick"; p.income = null;p.isValid() //true
Association Preloading, Postloading - Defaulted to 1 level deep - Can be overridden at global level or per query - Immediately associated records loaded automatically - Additional records loaded with call to  load(assocName)  var milesRecords = miles.albums; //all of Miles' albums milesRecords.length //3 milesRecords[0].titlemilesRecords[0].load("artist") //miles again
Autolinking miles.albums.push(     Album.newRecord({title: "made up ish",         year: 2009     }) );miles.save(); Any record objects pushed into a  hasMany  array or pushed directly onto a  hasOne/belongsTo  property will be auto linked on save of the base record object.
Auto Unlinking   miles.albums.pop() //so long, fake albummiles.save(); Any records that were previously associated/loaded which are removed become dissociated on save of base record object
Future of JazzRecord - Unavoidable Asynchronous - HTML5 Difficulties, deeply nested structures - Will open up webOS, iPhone, async in AIR/Titanium - Everything callback-based - Initial work in 1 or 2 weeks - no association preloading - No timetable for full preloading -  Need Contributors : coders, docs translators
Project:     www.jazzrecord.org groups.google.com/group/jazzrecord http://github.com/thynctank/jazzrecord/tree/master Me:     thynctank.com [email_address] thynctank (AIM/GTalk/IRC/etc)
JazzFusion BYOM (bring your own model)
Rails inspired, but dead simple Provide a series of controllers, view templates and helper code in a standard file structure and sit back to watch it work.   Initially targeting browsers, AIR, Titanium  Info on writing your own routing mechanism (remote templates, server-generated dynamic content) Info on writing your own view template parsers. Out of box will allow inline script tags + simple string substitution, and/or markdown
Some Nice Features AppController's features inherited across all Controller objects Automatic Hijax for forms/links, passing data to router Before/after filters for keeping code DRY
When? Maybe June. That Burning Question

More Related Content

PDF
Intro to Rails
PPT
Rush, a shell that will yield to you
PDF
Lightweight Webservices with Sinatra and RestClient
PDF
Using Sinatra to Build REST APIs in Ruby
PDF
Rails Sojourn: One Man's Journey - Wicked Good Ruby Conference 2013
PDF
My Robot Poops - In JavaScript (with web sockets)
PDF
Sinatra Rack And Middleware
KEY
Intro to Rails
Rush, a shell that will yield to you
Lightweight Webservices with Sinatra and RestClient
Using Sinatra to Build REST APIs in Ruby
Rails Sojourn: One Man's Journey - Wicked Good Ruby Conference 2013
My Robot Poops - In JavaScript (with web sockets)
Sinatra Rack And Middleware

What's hot (20)

PDF
JSON and the APInauts
PDF
Ansible 202
ODP
Writing webapps with Perl Dancer
PDF
Hacking ansible
PDF
Nginx Workshop Aftermath
PDF
Perl Dancer for Python programmers
PDF
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
PDF
Effective ES6
PDF
Ansible leveraging 2.0
PDF
"Elixir of Life" - Dev In Santos
PPTX
Troubleshooting Puppet
PDF
Introduction to ansible
PDF
V2 and beyond
KEY
PSGI/Plack OSDC.TW
KEY
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
PDF
Your first sinatra app
PDF
Ansible roles done right
PPTX
Word Play in the Digital Age: Building Text Bots with Tracery
PDF
Getting Started with PoolParty and EC2
PDF
PerlDancer for Perlers (FOSDEM 2011)
JSON and the APInauts
Ansible 202
Writing webapps with Perl Dancer
Hacking ansible
Nginx Workshop Aftermath
Perl Dancer for Python programmers
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
Effective ES6
Ansible leveraging 2.0
"Elixir of Life" - Dev In Santos
Troubleshooting Puppet
Introduction to ansible
V2 and beyond
PSGI/Plack OSDC.TW
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Your first sinatra app
Ansible roles done right
Word Play in the Digital Age: Building Text Bots with Tracery
Getting Started with PoolParty and EC2
PerlDancer for Perlers (FOSDEM 2011)
Ad

Viewers also liked (20)

PDF
Syllabus contemporay art
PDF
Eops 2014 10_29
PDF
Arregladores argentinos
PPTX
Chapter V.1-Altered dominants
PPT
Do you want a real or a tonal answer?
PDF
Stevie wonder superstition
PDF
The.real.book.of.blues by vtnau
PDF
AfroCuban Keyboard Grooves
PDF
Unforgettable...the lighter side of jazz for piano solo
PDF
Waller, fats the jitterbug waltz
PDF
Library of musician's jazz
PDF
Tango y cultura popular nº 158
PPTX
Set Works PPT
PDF
Bataille - La historia del ojo
PPT
PDF
jazz improvisation tips
PDF
Cuban fakebook
PDF
My first song book 3 disney
PDF
Phillip Keveren: Disney songs for classical piano
PDF
Piano partituras principiante
Syllabus contemporay art
Eops 2014 10_29
Arregladores argentinos
Chapter V.1-Altered dominants
Do you want a real or a tonal answer?
Stevie wonder superstition
The.real.book.of.blues by vtnau
AfroCuban Keyboard Grooves
Unforgettable...the lighter side of jazz for piano solo
Waller, fats the jitterbug waltz
Library of musician's jazz
Tango y cultura popular nº 158
Set Works PPT
Bataille - La historia del ojo
jazz improvisation tips
Cuban fakebook
My first song book 3 disney
Phillip Keveren: Disney songs for classical piano
Piano partituras principiante
Ad

Similar to All That Jazz (20)

ODP
Ruby off Rails---rack, sinatra and sequel
PPT
Demystifying Maven
KEY
Wider than rails
PDF
Building web framework with Rack
ODP
Asynchronous Threads in Lasso 8.5
PPT
Node js presentation
PPT
Introduction To Ant
PDF
From content to search: speed-dating Apache Solr (ApacheCON 2018)
PPT
JavaOne 2008 - TS-5764 - Grails in Depth
PPT
PDF
All I Need to Know I Learned by Writing My Own Web Framework
ODP
How Xslate Works
PDF
Play vs Rails
KEY
Rapid Prototyping FTW!!!
PDF
Introduction to Apache Beam
PPT
Deploy Rails Application by Capistrano
PDF
Great Developers Steal
PDF
PDF
Rails 4.0
Ruby off Rails---rack, sinatra and sequel
Demystifying Maven
Wider than rails
Building web framework with Rack
Asynchronous Threads in Lasso 8.5
Node js presentation
Introduction To Ant
From content to search: speed-dating Apache Solr (ApacheCON 2018)
JavaOne 2008 - TS-5764 - Grails in Depth
All I Need to Know I Learned by Writing My Own Web Framework
How Xslate Works
Play vs Rails
Rapid Prototyping FTW!!!
Introduction to Apache Beam
Deploy Rails Application by Capistrano
Great Developers Steal
Rails 4.0

Recently uploaded (20)

PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Modernising the Digital Integration Hub
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PPTX
The various Industrial Revolutions .pptx
PPTX
Tartificialntelligence_presentation.pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
DOCX
search engine optimization ppt fir known well about this
PDF
August Patch Tuesday
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Developing a website for English-speaking practice to English as a foreign la...
Assigned Numbers - 2025 - Bluetooth® Document
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
Modernising the Digital Integration Hub
A review of recent deep learning applications in wood surface defect identifi...
DP Operators-handbook-extract for the Mautical Institute
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
The various Industrial Revolutions .pptx
Tartificialntelligence_presentation.pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Enhancing emotion recognition model for a student engagement use case through...
Taming the Chaos: How to Turn Unstructured Data into Decisions
O2C Customer Invoices to Receipt V15A.pptx
A novel scalable deep ensemble learning framework for big data classification...
search engine optimization ppt fir known well about this
August Patch Tuesday
Zenith AI: Advanced Artificial Intelligence
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game

All That Jazz

  • 1. All That Jazz An intro to Databases with JazzRecord ORM
  • 2. A Little About JazzRecord - Library agnostic (originally a MooTools project)   - ORM inspired by ActiveRecord in Rails. Most behaviors directly portable.   - Current Platforms: - Gears - AIR - Titanium PR1 (and beta thanks to @jhaynie!)
  • 3. Core Features - Finders - Validation - Association loading - Preloading - Post load   - Fixtures and Migrations
  • 4. Creating Models - Basics var JazzLegend = new Model({ table: "jazz_legends", columns: { name: "text", primary_instrument: "text", years_active: "text" } });
  • 5. Creating Models - Associations //new version of JazzLegend model JazzLegend = new JazzRecord.Model({ table: "jazz_legends", foreignKey: "jazz_legend_id", hasMany: {albums: "albums"}, columns: { name: "text", primary_instrument: "text", years_active: "text" } }); //associated model Album = new JazzRecord.Model({ table: "albums", belongsTo: {artist: "jazz_legends"}, columns: { title: "text", year: "text", jazz_legend_id: "number" } });
  • 6. Finders and Record Data var miles = JazzLegend.findBy("name", "Miles"); var louis = JazzLegend.first(); var dizzy = JazzLegend.find(2); miles.primary_instrument //trumpet louis.years_active //1914-1971miles.name = "Miles Dewey Davis III"; miles.save();  
  • 7. Finders and Record Data - Destroy dizzy.destroy(); //someone must've grown tired of Dizzy! Album.count(); //3 albums so far, all Miles Album.destroyAll(); //like that time you lost all your CDs// when your car was broken into... Album.count(); //0, no more Miles!!
  • 8. Validations var Programmer = new JazzRecord.Model({ //... validate: { atSave: function() { this.validatesIsString("name", "You must have a name!"); this.validatesIsFloat("income", "We will gladly pay you a null salary!"); } } }); - Callbacks run at time of create or save (or both) - Several built in validators (based on Rails') - Write your own
  • 9. Validation Errors p = Programmer.newRecord({name: 42,     income: "spare change"});p.save(); //false p.errors.name ["You must have a name!"]p.errors.income ["We will gladly pay you null salary"]p.name = "Nick"; p.income = null;p.isValid() //true
  • 10. Association Preloading, Postloading - Defaulted to 1 level deep - Can be overridden at global level or per query - Immediately associated records loaded automatically - Additional records loaded with call to load(assocName) var milesRecords = miles.albums; //all of Miles' albums milesRecords.length //3 milesRecords[0].titlemilesRecords[0].load("artist") //miles again
  • 11. Autolinking miles.albums.push(     Album.newRecord({title: "made up ish",         year: 2009     }) );miles.save(); Any record objects pushed into a hasMany array or pushed directly onto a hasOne/belongsTo property will be auto linked on save of the base record object.
  • 12. Auto Unlinking   miles.albums.pop() //so long, fake albummiles.save(); Any records that were previously associated/loaded which are removed become dissociated on save of base record object
  • 13. Future of JazzRecord - Unavoidable Asynchronous - HTML5 Difficulties, deeply nested structures - Will open up webOS, iPhone, async in AIR/Titanium - Everything callback-based - Initial work in 1 or 2 weeks - no association preloading - No timetable for full preloading - Need Contributors : coders, docs translators
  • 14. Project:   www.jazzrecord.org groups.google.com/group/jazzrecord http://github.com/thynctank/jazzrecord/tree/master Me:   thynctank.com [email_address] thynctank (AIM/GTalk/IRC/etc)
  • 15. JazzFusion BYOM (bring your own model)
  • 16. Rails inspired, but dead simple Provide a series of controllers, view templates and helper code in a standard file structure and sit back to watch it work.   Initially targeting browsers, AIR, Titanium Info on writing your own routing mechanism (remote templates, server-generated dynamic content) Info on writing your own view template parsers. Out of box will allow inline script tags + simple string substitution, and/or markdown
  • 17. Some Nice Features AppController's features inherited across all Controller objects Automatic Hijax for forms/links, passing data to router Before/after filters for keeping code DRY
  • 18. When? Maybe June. That Burning Question