SQL

Girl Power at Engine Yard

It was a wet and windy weekend in San Francisco - brrrrrrr! Luckily I was warm and dry - tucked up at the Engine Yard offices with 23 other women sharing a common mission to get our first taste of coding with Rails. DevChix and RailsBridge delivered another of their excellent free Ruby on Rails workshops for women and we were delighted to host them this past weekend at Engine Yard.

I am super supportive of this program as I have long been a supporter of getting more women into software engineering.

Schema-Free MySQL vs NoSQL

Amidst the cambrian explosion of alternative database engines (aka, NoSQL) it is almost too easy to lose sight of the fact that the more established solutions, such as relational databases, still have a lot to offer: stable and proven code base, drivers and tools for every conceivable language, and more features than any DBA cares to learn about.

Rails 3 Beta is Out — A Retrospective

The Rails team has finally released the Rails 3 beta, after more than a year since the Rails and Merb teams started working on this release. You can read all about it at the official Rails blog, but I figured I’d take the opportunity to share my take on the release.

First of all, you’re probably sick of hearing this, but we’ve done far, far more than we ever expected. A lot of that happened in the last few weeks.

MySQL slow query improvements

We’ve just pushed some updates to the MySQL slow query warning interface in the Brightbox control panel, which includes two main improvements.

Firstly, where the same (or very similar) query occurs more than once, they are aggregated together rather than being recorded as individual slow queries. The user interface displays the count so you can see exactly how many times this slow query occurred in the last 7 days.

Secondly, the full SQL query is now displayed, so customers now have more information with which to optimise their applications.

Conditional duplicate key updates with MySQL

In one of our larger Rails apps the sheer volume of data we process means we’ve had to rely more and more on direct SQL queries, denormalised tables and summary tables to speed things up. When updating summary tables we typically use ON DUPLICATE KEY UPDATE, a MySQL extension to INSERT statements since version 4.1, that allows a record to either be inserted or updated in one query.

For example, with this table:

Upgrading the script/console in Windows VISTA environment

If you haven’t been actively using script/console – you should start it now. It allows you to test things out in the environment of your project with a direct feedback. So, if you want to check those quirky database queries or how a new plugin works, run the script/console and start coding.

However, as seemingly everything in Ruby Rails, the console is a bit buggy in Windows. This calls for a console upgrade. At the same time we will include some further improvements as well to make your console the best firend.

vote_fu to work in Heroku (Postgres)

In order to make vote_fu work in Heroku’s PostgreSQL you need to make a slight modification in the tally method, to follow a classical SQL notation:

Add this method in acts_as_voteable.rb just after options_for_tally method:

	def column_names_for_tally
	   column_names.map { |column| "#{table_name}.#{column}" }.join(", ")
	end

In options_for_tally method find line that starts with “group_by =” and replace it with:

Hosting your Rails app – first look at Heroku

Introduction: You should really get professional help

I am building an app and needed to show an unfinished version to some guy. As I am building on a local (windows!) box, I decided that it’s time to invest some time in finding out what options there are to host a Rails app.

How We Made GitHub Fast

Now that things have settled down from the move to Rackspace, I wanted to take some time to go over the architectural changes that we’ve made in order to bring you a speedier, more scalable GitHub.

There is no magic, there is only awesome (Part 3)

This is the third article in a series titled “There is no magic, there is only awesome.” The first article introduced the “four cardinal rules of awesomeness”. The second article discussed knowing your tools.

Syndicate content