Posted on 22/4/2007, 11:36 am, by Colin Charles, under
MySQL.
Have you taken a look at the MySQL Conference 2007 schedule yet? With just one day to start, I’d advise you to take a gander. So many interesting things, that my only complaint (well, a suggestion) is that I hope that these talks get a video recording and they should be given to attendees via the web. Apple have done this for WWDC, and linux.conf.au did a great job in 2007 to record every session.
Why video recording? Because each block of time, have 8 sessions, in where about 3-5 sessions on average can be interesting. Last I checked, I couldn’t split myself.
Sure the slides will make it online eventually, but the talk itself is where most interest really is at, I believe.
Posted on 22/4/2007, 8:12 am, by Colin Charles, under
General.
More so that I will remember, the 2nd Annual Silicon Valley Ruby Conference 2007 have some interesting web links.
- sv ruby conf on Tumblr – looks like Twitter for groups? They sell it as “blogs with less fuss”, but I’m definitely not signing up for yet another blogging platform.
- Conference Meetup site for svrc2007 – this is pretty cool. People logs, make connections, upload presentations, plan gatherings. This is something conferences should definitely look at having running. Its just cool stuff.
I’m sure if you search on Flickr or Technorati for svrc2007 or something similar, that tag will be used…
Technorati Tags: ruby, svrc2007, links
Posted on 22/4/2007, 12:57 am, by Colin Charles, under
General.
ActiveRecord, by Rabble.
- Rails ActiveRecord is mostly database agnostic.
- Good subset of the SQL standard is supported, so you can migrate very easily (this is what OS X Leopard will do – develop using sqlite on your workstation, then migrate to mysql on the server).
- Integer primary keys, and classname_id foreign keys. Single table inheritance is what really works well.
- What ActiveRecord doesn’t like:
- views
- stored procedures
- FK constraints
- cascading commits
- split/clustered DBs
- enums
- Complexity is best located in the code, not in the database, according to the Rails developers.
- Avoid SQL injection with find. Use an array or let it do the quoting for you. By itself, it allows you to do stupid things – so avoid cross site scripting, etc.
- Joins are very rarely used, you use ActiveRecord relationships.
- Some associations:
- has_one – when the FK is in the OTHER table
- belongs_to – when the FK is in THIS table
- has_many
- has_and_belongs_to_many
- DBAs like FK constraints, but the Rails way is to really just use validations.
- ActiveRecord returns enumarable objects, which look like arrays
- ActiveRecord also allows for output formats – like to_yaml, to_xml, to_json. So your database records can become XML pretty easily.
- find_by_sql – use it when you’re finding ActiveRecord isn’t suitable for you, i.e. you’re doing something that is not very standard.
Rabble also gave us an anecdote from his Odeo days. They thought that grabbing feeds should be done in parallel. Which is when they used RubyThreads. And suddenly, they were getting some horrendous database problems, duplicate records and so on. Moral of the story: RubyThreads and ActiveRecord don’t mix. A member of the audience mentioned that using find_by_sql consumed about 1MB of memory in his application, however, using ActiveRecord to do the same thing was costing about 20MB per thread.
Technorati Tags: ruby, svrc2007, database, sql, mysql, ActiveRecord