PHP COMPILE ERROR ON CENTOS INSTALL
I installed CentOS 5 on my VMWare a few days ago. I installed gcc via yum, compiled and installed libxml2. I then tried to install PHP 5.2.3 and received this error: configure: error: installation or configuration problem: C++ compiler cannot create executables. It took me forever to figure this out, but I had to install the g++ library, then it compiled fine. yum install gcc-c++
MORE RIDICULOUS ADS
I can’t even handle these sometimes. This is off violentacres, a blog I like to read every now and then because the author is such an asshole. Edit: I accidentally used the thumbnail when I was editing the post originally. My bad.
INNODB PERFORMANCE ON WINDOWS?
Let me first state that I’ve only run MySQL on Linux and MacOS X, never Windows. This is the first I’ve heard of Innodb having massive performance issues. Check out Karl Seguin’s blog post.
USING SVN TO MANAGE A WEBSITE
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 do a code push, we always push a branch called “production”. When it’s time to push, we run a script called “mkprod” that will rename the existing production branch, and create a new production branch off of the trunk.
CALCULATING THE QUERIES PER SECOND AVERAGE IN MYSQL
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” | awk ‘{if ($1 == “Questions”) print $2}’ diff=expr $last - $orig avg=expr $diff / $timeecho "$avg"
HELPFUL SVN SCRIPT FOR ADDING ALL UNKNOWN FILES TO REPOSITORY
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 have this saved in my ~/bin folder as “addall”, which I’ve added to the $PATH variable, which gets set in ~/.
HOW TO USE CURL TO HIT A WEB API USING HTTP BASIC AUTHENTICATION
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 up for one on your own. Now, to hit their api and update your status, they require you use HTTP Basic Authentication.
MYSQL DOES NOT SUPPORT VARIABLES WITH LIMIT IN STORED PROCEDURES
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. It’s very unfortunate, I was looking forward to benchmarking the difference between our ad hoc code and the stored proc version. This code will not work: SELECT field from table LIMIT limit_var
'DATABASE TIP: ONLY COUNTING CERTAIN VALUES IN AN AGGREGATE QUERY'
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, the minimum rating, the max, the number of ratings, and the number of ratings over 75. First let’s setup the tables. create table rating ( picture int not null, userid int not null, rating int not null, primary key (picture, userid) ) engine=innodb;
MANLY DIAPER BAG
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.