Posted on 04/23/2008, 3:40 am, by aaron, under
All.
Problem
With high volume Rails applications, entities with unique constraints are expensive and error prone to create/update. ActsAsInsertOrUpdate helps solve that problem (if you’re using MySQL), by leveraging the “INSERT … ON DUPLICATE KEY UPDATE” functionality.
Scenario
Lets say you have a Person, and Entity, and a Rating. Each user can rate each entity only once, and [...]
Posted on 04/14/2008, 9:00 pm, by warren, under
All.
For analytics purposes, we ended up storing JSON-encoded data as a column in a mysql table. Although we don’t often need to query it directly, from time to time, it makes things a bit easier/faster. Below is a MySQL stored function that takes two parameters (a JSON encoded string, and the name of [...]
Posted on 04/08/2008, 6:21 pm, by aaron, under
All,
Rails.
Curb is a ruby binding for libcurl. We’ve had sporadic issues with Net::HTTP, which this might aleviate via native dns, native timeouts, performance improvements, etc. It wouldnt be hard to re-implement ActiveResource, rfacebook, myspace-ruby, etc to use it instead. Anyone using this already?
sudo gem install curb
require ‘rubygems’
require ‘curb’
require "net/http"
require ‘benchmark’
iterations = 40
Benchmark.bm [...]