SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
Introduction
      Ruby On Rails
             NoSQL
         Conclusion




Breizhcamp - Nosql - Ruby

          Nicolas Ledez
   from.slideshare@ledez.net


           17 Juin 2011




                                                   logo


      Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                Ruby On Rails
                       NoSQL
                   Conclusion


Nicolas Ledez




                     <me>


                                                             logo


                Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                Ruby On Rails
                       NoSQL
                   Conclusion


Nicolas Ledez




                Depuis bientôt 5 ans

                                                             logo


                Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                Ruby On Rails
                       NoSQL
                   Conclusion


Nicolas Ledez




    Chef de projet technique


                                                             logo


                Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                    Ruby On Rails
                           NoSQL
                       Conclusion


Nicolas Ledez




                http ://www.breizhcamp.org/
                       Cloud et NoSQL
                                                                 logo


                    Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                     Ruby On Rails
                            NoSQL
                        Conclusion


Nicolas Ledez




                http ://www.rennesonrails.com/
                      Coding Dojo & Confs



                                                                  logo


                     Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                  Ruby On Rails
                         NoSQL
                     Conclusion


Nicolas Ledez




                 http ://www.granit.org/
                Forum Graphotech Cloud


                                                               logo


                   Nicolas Ledez   Breizhcamp - Nosql - Ruby
Introduction
                Ruby On Rails
                       NoSQL
                   Conclusion


Nicolas Ledez




                    </me>


                                                             logo


                Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                       Ruby On Rails
                              NoSQL
                          Conclusion


Plan


  1    Introduction

  2    Ruby On Rails

  3    NoSQL

  4    Conclusion



                                                                    logo


                       Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                                       Sondage
                      Ruby On Rails
                                       NoSQL
                             NoSQL
                                       Ruby & Rails
                         Conclusion


Qui connaît ?



     NoSQL
         SQL
         Clé/valeur
         Document
     Ruby On Rails
         Ruby
         Rails




                                                                   logo


                      Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                          Sondage
         Ruby On Rails
                          NoSQL
                NoSQL
                          Ruby & Rails
            Conclusion


NoSQL




        Not Only SQL



                                                      logo


         Nicolas Ledez    Breizhcamp - Nosql - Ruby
Choix du moteur
Ruby & Rails




     Ruby
         Plusieurs VM Ruby (MRI, JRuby, MacRuby, Rubinus)
         24,898 gems (en juin 2011)
         +185 000 projets Ruby sur Github
     Rails
         DRY
         Convention over Configuration
         MVC, migrations, Active Record, etc
Ruby On Rails - i18n



  $ cat config/locales/fr.yml
  fr:
    listing_tickets: "Liste des tickets"
    name: "Nom"
    unknown: "Inconnu"
    back: "Retour"
    are_you_sure: "Etes-vous sur ?"
    editing_ticket: "Edition du ticket"
  $ grep listing_tickets app/views/tickets/index.html.
  <h1><%= t(’listing_tickets’) %></h1>
Ruby On Rails - generators


  $ rails generate model ticket name:string
    description:text
  $ cat db/migrate/20110602142024_create_tickets.rb
  class CreateTickets < ActiveRecord::Migration
    def change
      create_table :tickets do |t|
        t.string :name
        t.text :description

        t.timestamps
      end
    end
  end
Ruby On Rails - Active Record



  $ cat app/models/ticket.rb
  class Ticket < ActiveRecord::Base
    validates_presence_of :name
    validates_presence_of :status
  end
  $ rake db:migrate
  -- create_table("tickets", {:force=>true})
     -> 0.0696s
  DB -> Model -> Controller -> Vue
Introduction
                           Ruby On Rails    Redis
                                  NoSQL     MongoDB
                              Conclusion


Redis



        Manipulation de clés / valeurs
        Commandes simples
        Valeurs : string, list, set, sorted set, hashes
        Expiration des clés possible
        Utilisation : cache, session, compteurs, queue




                                                                        logo


                           Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                   Ruby On Rails    Redis
                          NoSQL     MongoDB
                      Conclusion


Redis exemples


 Clé/valeur        List                                 Sets
 SET key "value"   LPUSH key 1                          SADD key 1
 GET key           LRANGE key 0 -1                      SMEMBERS key
 DEL key           RPOP key                             SISMEMBER key
 INCR key          LLEN key                             2
 EXPIRE key 5      LTRIM key 0 1                        SRANDMEMBER
 EXPIREAT key                                           key
 <timestp>                                              SREM key 3
 TTL key


                                                                        logo


                   Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                       Ruby On Rails    Redis
                              NoSQL     MongoDB
                          Conclusion


Redis avec Ruby On Rails - backend

  Ajout de "gem ’redis’" dans le Gemfile
  $ cat config/initializers/i18n_backend.rb
  I18n.backend = I18n::Backend::KeyValue.new(
    Redis.new)
  $ cat config/initializers/i18n_backend.rb
  TRANSLATION_STORE = Redis.new
  I18n.backend = I18n::Backend::Chain.new(
    I18n::Backend::KeyValue.new(TRANSLATION_STORE),
    I18n.backend)

                                                                    logo


                       Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                     Ruby On Rails    Redis
                            NoSQL     MongoDB
                        Conclusion


Redis avec Ruby On Rails - frontend

  $ cat app/controllers/translations_controller.rb
  class TranslationsController < ApplicationController
    def index
      @translations = TRANSLATION_STORE
    end

    def create
      I18n.backend.store_translations(params[:locale],
        {params[:key] => params[:value]}, :escape => false)
      redirect_to translations_url,
        :notice => "Added translations"
    end
  end
                                                                  logo


                     Nicolas Ledez    Breizhcamp - Nosql - Ruby
Redis avec Ruby On Rails - hack ROR 3.1 rc1 1/3

  $ cat config/environment.rb
  # Load the rails application
  require File.expand_path(’../application’, __FILE__)

  module I18n
   module Backend
    class KeyValue
      module Implementation
       def store_translations(locale, data, options = {})
          #@store[key] = ActiveSupport::JSON.encode(value) unless
          @store[key] = ActiveSupport::JSON.encode([value]) unless
         end
       end
      end
    end
   end
  end
Redis avec Ruby On Rails - hack ROR 3.1 rc1 2/3


  module I18n
   module Backend
    class KeyValue
      module Implementation
      protected
       def lookup(locale, key, scope = [], options = {})
        #value = ActiveSupport::JSON.decode(value) if value
        value = ActiveSupport::JSON.decode(value)[0] if value
       end
      end
    end
   end
  end

  # Initialize the rails application
  Tickets::Application.initialize!
Redis avec Ruby On Rails - hack ROR 3.1 rc1 3/3
Introduction
                   Ruby On Rails    Redis
                          NoSQL     MongoDB
                      Conclusion


MongoDB




    Base orientée documents (BSON)
    Un système de requêtes évolué
    Scalable
    Hautes performances
    Sans schéma




                                                                logo


                    Nicolas Ledez   Breizhcamp - Nosql - Ruby
Introduction
                     Ruby On Rails    Redis
                            NoSQL     MongoDB
                        Conclusion


MongoDB exemples 1/2


  show dbs
  use db_name
  show collections

  db.foo.find();

  db.foo.save({ name : "sara"});

  person = db.people.findOne( { name : "sara" } );
  person.city = "New York";
  db.people.save( person );
                                                                  logo


                     Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                  Ruby On Rails    Redis
                         NoSQL     MongoDB
                     Conclusion


MongoDB exemples 2/2



  db.foo.drop()

  db.foo.remove()
  db.foo.remove( { name : "sara" } )

  db.foo.getIndexKeys()
  db.foo.ensureIndex({ _field_ : 1 })



                                                               logo


                  Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                        Ruby On Rails    Redis
                               NoSQL     MongoDB
                           Conclusion


Avec Rails - config


  config/initializers/mongo.rb
  MongoMapper.connection = Mongo::Connection.new(’localhost’, 270
  MongoMapper.database = "#myapp-#{Rails.env}"

  if defined?(PhusionPassenger)
      PhusionPassenger.on_event(:starting_worker_process) do |fork
        MongoMapper.connection.connect if forked
      end
  end




                                                                     logo


                        Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                       Ruby On Rails    Redis
                              NoSQL     MongoDB
                          Conclusion


Avec Rails - model



  app/models/note.rb
  class Note
    include MongoMapper::Document

    key :title, String, :required => true
    key :body, String
  end




                                                                    logo


                       Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction
                    Ruby On Rails    Redis
                           NoSQL     MongoDB
                       Conclusion


Avec Rails - à la place d’Active Record




     Pas de migration du schéma de la BDD
     Tolérance du modèle




                                                                 logo


                     Nicolas Ledez   Breizhcamp - Nosql - Ruby
Introduction   Conclusion
               Ruby On Rails    Questions
                      NoSQL     Sources
                  Conclusion    Licence


Conclusion




  Conclusion




                                                            logo


               Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction   Conclusion
                Ruby On Rails    Questions
                       NoSQL     Sources
                   Conclusion    Licence


Questions




  Questions ?




                                                             logo


                Nicolas Ledez    Breizhcamp - Nosql - Ruby
Introduction   Conclusion
                      Ruby On Rails    Questions
                             NoSQL     Sources
                         Conclusion    Licence


Sources



     http ://blog.nahurst.com/visual-guide-to-nosql-systems
     http ://nosql-database.org/
     http ://www.camilleroux.com/2010/08/16/pourquoi-ruby-on-
     rails-est-genial-1-sur-2/
     http ://railscasts.com/episodes/256-i18n-backends
     http ://www.slideshare.net/karmi/redis-the-ak47-of-
     postrelational-databases



                                                                   logo


                       Nicolas Ledez   Breizhcamp - Nosql - Ruby
Introduction   Conclusion
          Ruby On Rails    Questions
                 NoSQL     Sources
             Conclusion    Licence


Licence




              CC BY-NC-SA




                                                       logo


          Nicolas Ledez    Breizhcamp - Nosql - Ruby

Contenu connexe

Similaire à Breizhcamp NoSQL

Úvod do Ruby on Rails
Úvod do Ruby on RailsÚvod do Ruby on Rails
Úvod do Ruby on RailsKarel Minarik
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Coursepeter_marklund
 
070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイド070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイドTomoki Maeda
 
Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Jean-Michel Garnier
 
Ruby on Rails workshop for beginner
Ruby on Rails workshop for beginnerRuby on Rails workshop for beginner
Ruby on Rails workshop for beginnerUmair Amjad
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsManoj Kumar
 
Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivationjistr
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)scandiweb
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 
Jaoo Michael Neale 09
Jaoo Michael Neale 09Jaoo Michael Neale 09
Jaoo Michael Neale 09Michael Neale
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Railsousli07
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction Tran Hung
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfssusercd195b
 

Similaire à Breizhcamp NoSQL (20)

Bhavesh ro r
Bhavesh ro rBhavesh ro r
Bhavesh ro r
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Úvod do Ruby on Rails
Úvod do Ruby on RailsÚvod do Ruby on Rails
Úvod do Ruby on Rails
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイド070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイド
 
Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)
 
Ruby on Rails workshop for beginner
Ruby on Rails workshop for beginnerRuby on Rails workshop for beginner
Ruby on Rails workshop for beginner
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivation
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
 
Dev streams2
Dev streams2Dev streams2
Dev streams2
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
Jaoo Michael Neale 09
Jaoo Michael Neale 09Jaoo Michael Neale 09
Jaoo Michael Neale 09
 
Rails01
Rails01Rails01
Rails01
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction
 
Web application intro
Web application introWeb application intro
Web application intro
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 

Dernier

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Dernier (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Breizhcamp NoSQL

  • 1. Introduction Ruby On Rails NoSQL Conclusion Breizhcamp - Nosql - Ruby Nicolas Ledez from.slideshare@ledez.net 17 Juin 2011 logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 2. Introduction Ruby On Rails NoSQL Conclusion Nicolas Ledez <me> logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 3. Introduction Ruby On Rails NoSQL Conclusion Nicolas Ledez Depuis bientôt 5 ans logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 4. Introduction Ruby On Rails NoSQL Conclusion Nicolas Ledez Chef de projet technique logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 5. Introduction Ruby On Rails NoSQL Conclusion Nicolas Ledez http ://www.breizhcamp.org/ Cloud et NoSQL logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 6. Introduction Ruby On Rails NoSQL Conclusion Nicolas Ledez http ://www.rennesonrails.com/ Coding Dojo & Confs logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 7. Introduction Ruby On Rails NoSQL Conclusion Nicolas Ledez http ://www.granit.org/ Forum Graphotech Cloud logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 8. Introduction Ruby On Rails NoSQL Conclusion Nicolas Ledez </me> logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 9. Introduction Ruby On Rails NoSQL Conclusion Plan 1 Introduction 2 Ruby On Rails 3 NoSQL 4 Conclusion logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 10. Introduction Sondage Ruby On Rails NoSQL NoSQL Ruby & Rails Conclusion Qui connaît ? NoSQL SQL Clé/valeur Document Ruby On Rails Ruby Rails logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 11. Introduction Sondage Ruby On Rails NoSQL NoSQL Ruby & Rails Conclusion NoSQL Not Only SQL logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 13. Ruby & Rails Ruby Plusieurs VM Ruby (MRI, JRuby, MacRuby, Rubinus) 24,898 gems (en juin 2011) +185 000 projets Ruby sur Github Rails DRY Convention over Configuration MVC, migrations, Active Record, etc
  • 14. Ruby On Rails - i18n $ cat config/locales/fr.yml fr: listing_tickets: "Liste des tickets" name: "Nom" unknown: "Inconnu" back: "Retour" are_you_sure: "Etes-vous sur ?" editing_ticket: "Edition du ticket" $ grep listing_tickets app/views/tickets/index.html. <h1><%= t(’listing_tickets’) %></h1>
  • 15. Ruby On Rails - generators $ rails generate model ticket name:string description:text $ cat db/migrate/20110602142024_create_tickets.rb class CreateTickets < ActiveRecord::Migration def change create_table :tickets do |t| t.string :name t.text :description t.timestamps end end end
  • 16. Ruby On Rails - Active Record $ cat app/models/ticket.rb class Ticket < ActiveRecord::Base validates_presence_of :name validates_presence_of :status end $ rake db:migrate -- create_table("tickets", {:force=>true}) -> 0.0696s DB -> Model -> Controller -> Vue
  • 17. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion Redis Manipulation de clés / valeurs Commandes simples Valeurs : string, list, set, sorted set, hashes Expiration des clés possible Utilisation : cache, session, compteurs, queue logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 18. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion Redis exemples Clé/valeur List Sets SET key "value" LPUSH key 1 SADD key 1 GET key LRANGE key 0 -1 SMEMBERS key DEL key RPOP key SISMEMBER key INCR key LLEN key 2 EXPIRE key 5 LTRIM key 0 1 SRANDMEMBER EXPIREAT key key <timestp> SREM key 3 TTL key logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 19. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion Redis avec Ruby On Rails - backend Ajout de "gem ’redis’" dans le Gemfile $ cat config/initializers/i18n_backend.rb I18n.backend = I18n::Backend::KeyValue.new( Redis.new) $ cat config/initializers/i18n_backend.rb TRANSLATION_STORE = Redis.new I18n.backend = I18n::Backend::Chain.new( I18n::Backend::KeyValue.new(TRANSLATION_STORE), I18n.backend) logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 20. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion Redis avec Ruby On Rails - frontend $ cat app/controllers/translations_controller.rb class TranslationsController < ApplicationController def index @translations = TRANSLATION_STORE end def create I18n.backend.store_translations(params[:locale], {params[:key] => params[:value]}, :escape => false) redirect_to translations_url, :notice => "Added translations" end end logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 21. Redis avec Ruby On Rails - hack ROR 3.1 rc1 1/3 $ cat config/environment.rb # Load the rails application require File.expand_path(’../application’, __FILE__) module I18n module Backend class KeyValue module Implementation def store_translations(locale, data, options = {}) #@store[key] = ActiveSupport::JSON.encode(value) unless @store[key] = ActiveSupport::JSON.encode([value]) unless end end end end end end
  • 22. Redis avec Ruby On Rails - hack ROR 3.1 rc1 2/3 module I18n module Backend class KeyValue module Implementation protected def lookup(locale, key, scope = [], options = {}) #value = ActiveSupport::JSON.decode(value) if value value = ActiveSupport::JSON.decode(value)[0] if value end end end end end # Initialize the rails application Tickets::Application.initialize!
  • 23. Redis avec Ruby On Rails - hack ROR 3.1 rc1 3/3
  • 24. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion MongoDB Base orientée documents (BSON) Un système de requêtes évolué Scalable Hautes performances Sans schéma logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 25. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion MongoDB exemples 1/2 show dbs use db_name show collections db.foo.find(); db.foo.save({ name : "sara"}); person = db.people.findOne( { name : "sara" } ); person.city = "New York"; db.people.save( person ); logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 26. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion MongoDB exemples 2/2 db.foo.drop() db.foo.remove() db.foo.remove( { name : "sara" } ) db.foo.getIndexKeys() db.foo.ensureIndex({ _field_ : 1 }) logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 27. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion Avec Rails - config config/initializers/mongo.rb MongoMapper.connection = Mongo::Connection.new(’localhost’, 270 MongoMapper.database = "#myapp-#{Rails.env}" if defined?(PhusionPassenger) PhusionPassenger.on_event(:starting_worker_process) do |fork MongoMapper.connection.connect if forked end end logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 28. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion Avec Rails - model app/models/note.rb class Note include MongoMapper::Document key :title, String, :required => true key :body, String end logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 29. Introduction Ruby On Rails Redis NoSQL MongoDB Conclusion Avec Rails - à la place d’Active Record Pas de migration du schéma de la BDD Tolérance du modèle logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 30. Introduction Conclusion Ruby On Rails Questions NoSQL Sources Conclusion Licence Conclusion Conclusion logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 31. Introduction Conclusion Ruby On Rails Questions NoSQL Sources Conclusion Licence Questions Questions ? logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 32. Introduction Conclusion Ruby On Rails Questions NoSQL Sources Conclusion Licence Sources http ://blog.nahurst.com/visual-guide-to-nosql-systems http ://nosql-database.org/ http ://www.camilleroux.com/2010/08/16/pourquoi-ruby-on- rails-est-genial-1-sur-2/ http ://railscasts.com/episodes/256-i18n-backends http ://www.slideshare.net/karmi/redis-the-ak47-of- postrelational-databases logo Nicolas Ledez Breizhcamp - Nosql - Ruby
  • 33. Introduction Conclusion Ruby On Rails Questions NoSQL Sources Conclusion Licence Licence CC BY-NC-SA logo Nicolas Ledez Breizhcamp - Nosql - Ruby