Archive for May, 2007

Using SVN to Manage a Website

Thursday, May 31st, 2007

We've tried several ways of using SVN to manage Answerbag. Here's a brief overview. We work out of the trunk for very small projects (under a few hours) We create branches to deal with larger projects, and merge those changes back into the trunk when they are done and tested. When we ...

Calculating the queries per second average in Mysql

Wednesday, May 30th, 2007

I didn't find any simple ways to determine how hard our mysql database was working, so I whipped this up. It uses a 10 second delay to figure out the queries per second average. time=10 orig=`mysql -e "show status" | awk '{if ($1 == "Questions") print $2}'` sleep $time last=`mysql -e "show status" ...

Helpful SVN Script For Adding all Unknown files to Repository

Wednesday, May 30th, 2007

I use SVN from the command line a lot. I also hate typing things over and over. I wrote this script to add all files to a repository that are not already in there. svn status | awk '{if ($1 == "?") print $2 }' | xargs svn add I ...

How to use CURL to Hit a Web Api Using HTTP Basic Authentication

Wednesday, May 30th, 2007

Curl is a fantastic application. The most basic use of curl is very straightforward, just put in a web site's url: curl http://twitter.com If you copy and paste the above code, you'll get the HTML output of twitter's home page. In order to demo this, I created a twitter account. You can sign ...

MySQL does not support variables with LIMIT in stored procedures

Thursday, May 17th, 2007

After banging my head against a wall for a while, I finally found this thread from June 2005 in the MySQL support forums regarding using variables in the LIMIT clause. They don't support it yet. There's no time table that indicates when it will be supported either. ...

Database tip: Only Counting Certain Values in an Aggregate Query

Wednesday, May 2nd, 2007

Aggregates are awesome. But sometimes you want to do 2 counts in a query, and have one of them be more restrictive than the other. Lets say our database focuses on pictures, and rating them on a scale from 1-100. We want to know the average rating, ...

Manly Diaper Bag

Tuesday, May 1st, 2007

We never get ads that make any sense when developing answerbag, since we're behind a firewall and the crawler can't figure out our content. Edit: This is not happening with our live server, the screenshot is from DEV.