Devchat.tv Episode Roundup

Devchat.tv Episode Roundup

Download on the App Store

All Devchat.tv Episode Roundup episodes

  • Interview with Josh Berkus – Part 2

    In this episode we discussed:

    • MongoDB
    • Standardization of NoSQL databases
    • Portability between non-relational databases
    • CouchDB
    • PostgreSQL
    • AGPL license
    • PostgreSQL license (like the BSD license)
    • MySQL is GPLv2
    • Drizzle has rewritten their MySQL driver so it’s not GPL
    • Oracle’s behavior toward products they own that compete
    • InnoDB MySQL engine
    • Microsoft SQL – The price hike and bug report that drove Josh to PostgreSQL
    • Customer expectations vs Intended functionality
    • GreenPlum
    • Alexa
    • Implementing the minimum feature set and getting feedback.
    • Transactional DDL – All operations are transactional except create database.
    • Database Migrations – PostgreSQL can do migrations with no downtime.
    • Memcached
    • Redis
    • Solr
    • ElasticSearch
    • Foreign Data Wrappers – a driver for external data sources that can then be managed through PostgreSQL
    • Lucene
    • Hadoop HBase
    • Cassandra
    • Project Voldemort
    • HyperTable
    • Riak
    • Amazon Cap Theorem Papers
    • VoltDB
    • 59 min
    • Model Associations
      ActiveRecord models are based upon tables in relational databases. This, of course, means that they can be relational. Models can associate in three main ways: one to many, one to one, and many to many.
      One to many is usually achieved by calling has_many on the model representing the “one” to state that it “has many” of its counterparts. The model that represents the “many” calls
      belongs_to . Here’s an example:
      class User < ActiveRecord::Base
      has_many :posts
      end
      class Post < ActiveRecord::Base
      belongs_to :user
      end
      In addition, the model that represents the “many” needs a reference column or foreign key for the “one”. In this case, the posts table would have a user_id column.
      One to one works the same way one to many works except it uses has_one instead of has_many.
      Many to many is implemented in one of two different ways. The first--and generally default--way of doing this is has_and_belongs_to_many. As you can imagine, this is used just like has_many or belongs_to except you call it in both models.
      class Tag < ActiveRecord::Base
      has_and_belongs_to_many :posts
      end
      class Post < ActiveRecord::Base
      has_and_belongs_to_many :tags
      end
      11 min
    • Cassandra Basic Schema and Ruby Gem
      You can get cassandra at cassandra.apache.org and the ruby gem by running:
      gem install cassandra
      I did run into a problem with the trift_client gem when installing. If you get a Load Error, run this.
      sudo chmod 644 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/*.rb
      sudo chmod 755 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/connection
      Here are some of the Cassandra commands from the video:
      #connects to the cassandra server using the Twitter keyspace
      store = Cassandra.new(“Twitter”)
      # create a new column family in the Twitter keyspace called Users
      cf_def = CassandraThrift::CfDef.new(:keyspace => “Twitter”, :name => “Users”)
      store.add_column_family(cf_def)
      # add or create a row to the column family
      store.insert(“Users”, “cmaxw”, {“name” => “Charles Max Wood”, “description” => “Awesome coder”})
      # remove a column from a row
      store.remove(“Users”, “cmaxw”, “description”)
      Download 17.2 MB
      Download (iPod & iPhone) 20.9 MB
      Take the 2011 Readers Survey
      0 min
    • Cassandra Basic Schema and Ruby Gem
      You can get cassandra at cassandra.apache.org and the ruby gem by running:
      gem install cassandra
      I did run into a problem with the trift_client gem when installing. If you get a Load Error, run this.
      sudo chmod 644 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/*.rb
      sudo chmod 755 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/connection
      Here are some of the Cassandra commands from the video:
      #connects to the cassandra server using the Twitter keyspace
      store = Cassandra.new(“Twitter”)
      # create a new column family in the Twitter keyspace called Users
      cf_def = CassandraThrift::CfDef.new(:keyspace => “Twitter”, :name => “Users”)
      store.add_column_family(cf_def)
      # add or create a row to the column family
      store.insert(“Users”, “cmaxw”, {“name” => “Charles Max Wood”, “description” => “Awesome coder”})
      # remove a column from a row
      store.remove(“Users”, “cmaxw”, “description”)
      Download 17.2 MB
      Download (iPod & iPhone) 20.9 MB
      Take the 2011 Readers Survey
      0 min
    • Cassandra Basic Schema and Ruby Gem
      You can get cassandra at cassandra.apache.org and the ruby gem by running:
      gem install cassandra
      I did run into a problem with the trift_client gem when installing. If you get a Load Error, run this.
      sudo chmod 644 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/*.rb
      sudo chmod 755 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/connection
      Here are some of the Cassandra commands from the video:
      #connects to the cassandra server using the Twitter keyspace
      store = Cassandra.new(“Twitter”)
      # create a new column family in the Twitter keyspace called Users
      cf_def = CassandraThrift::CfDef.new(:keyspace => “Twitter”, :name => “Users”)
      store.add_column_family(cf_def)
      # add or create a row to the column family
      store.insert(“Users”, “cmaxw”, {“name” => “Charles Max Wood”, “description” => “Awesome coder”})
      # remove a column from a row
      store.remove(“Users”, “cmaxw”, “description”)
      Download 17.2 MB
      Download (iPod & iPhone) 20.9 MB
      Take the 2011 Readers Survey
      0 min
    • TMTC 66 Josh Berkus (PostgreSQL Core Team)

      Here’s a list of several of the things we discussed:

      • How PostgreSQL got started
      • Ingres
      • The Apache Foundation
      • The PostgreSQL core team and it’s role.
      • Data Warehousing
      • It’s community property like Linux
      • The SQL Query Language
      • The C Programming Language
      • gcc
      • Standardization
      • Google Summer of Code
      • XML Indexing
      • XPath Support
      • ISN/ISBN Data Type
      • Array Data Types
      • HStores (Dictionary or Hash)
      • Full Text Search
      • Tri-grams
      • Sphinx
      • Lucene
      • Why people switch from MySQL
        • Performance
        • Reliability
        • Special Features
        • Supports really complex queries
        • Worry about the future of MySQL
        • Skype – 200 Postgres servers
        • Sky tools clustering platform
        • Heroku
        • San Francisco PostgreSQL User Group
        • Differences between MySQL and PostgreSQL
          • MySQL was originally written to please web developers
          • Postgres was written by DBA’s
          • Postgres will throw out a feature they can’t stabilize
          • MySQL will accept a feature and then try to stabilize it
          • Postgres really allows you to run code inside the database
          • Postgres is more reliable and secure
          • Lowers admin cost due to better uptime
          • Rails was originally built around MySQL
          • You can get some boosts by bypassing the ORM and going directly to the database
          • Full JSON support is upcoming
          • Django
          • The PostgreSQL Ruby driver
          • ByteA binary data type
          • Simplified data types (Text data type)
          • Why people switch from PostgreSQL to MySQL
            • MySQL has been commercially successful longer than postgres
            • Vendor tools
            • Cheap hosting for MySQL
            • A lot of things are designed to work out of the box with PostgreSQL
            • PGSQL Novice list
            • Postgres Open
            • Postgres has a new version coming out soon (changelog)
            • Postgres 9.2
            • Multi-core support
            • Postgres included documentation
            • Beginning Databases with Postgres – Dated but gives the basics
            • To hire Josh’s guys, go to http://pgexperts.com.

              Download 6.08 MB

              Download (iPod & iPhone) 4.61 MB

              56 min
            • Rails Controllers: Before, After, and Around Filters
              In your Rails controllers you have filters you can place on incoming requests, outgoing responses, or wrap around your actions.
              Before filters are run on requests before the request gets to the controller’s action. It can return a response itself and completely bypass the action.
              The most common use of before filters is validating a user’s authentication before granting them access to the action designated to handle their request. I’ve also seen them used to load a resource from the database, check permissions on a resource, or manage redirects under other circumstances.
              After filters are run after the action completes. It can modify the response. Most of the time if something is done in an after filter, it can be done in the action itself, but if there is some logic to be run after running any of a set of actions, then an after filter is a good place to do it.
              Generally, I’ve seen after and around filters used for logging.
              Around filters may have logic before and after the action being run. It simply yields to the action in whatever place is necessary. Note that it doesn’t need to yield to the action and may run without doing so like a before filter.
              You can use around filters for exception handling, setup and teardown, and a myriad of other cases.
              8 min
            • ActiveRecord Callbacks
              You can get a full list of the ActiveRecord callbacks here.
              Callbacks are a handy way of insuring specific behaviors on your models as well as managing the events that follow the callbacks.
              For example, a before_destroy callback can be called to destroy associated objects. (This is best done on the association with :dependent => :destroy, but it makes sense here too.)
              You can also stop the destroy process if you have dependent objects you can’t destroy by returning false.
              I’ve used ActiveRecord Callbacks to:
              Set default values
              Format specific fields (like phone numbers)
              Send emails when an object is updated or deleted
              Create child objects from comma delimited lists in a string
              Change an object’s state
              9 min