Recently, we’ve had reports on our apps that users are getting 400 Bad Request errors from our servers. On checking out our log files, there was nothing to see! All is working well. Yet the reports continue. What’s going on?
We’re using nginx 0,6,34, and the reports the users are seeing mention this. These errors are definitely coming from our servers, but still nothing in the error logs for the server.
After a lot of head scratching and diagnosing, it seems that we have a number of large cookies being set, and the users who are getting these large cookies are the ones having problems. Lets check the interwebs for some help here. Here’s a relevant post on the Ruby Forum
It seems that we need to increase the size of the header space that nginx needs to process headers. The setting for this is large_client_header_buffers, and the size part of this needs to be big enough to handle the entire cookie header being sent.
I just got a new laptop to replace my 3 year old E1505. Its orange.
I’ve been looking at getting a Dell M6400 Mobile Workstation, and had got the configuration setup just the way I wanted: 8GB Ram, fast dual core CPU, SSD, 17" 1920×1200. I liked the color of the Covet version, but Dell is offering 10% off the regular one, and the Covet configured the way I wanted was $1,100 more at $4,600!
When poking around looking for discounts, I saw a link to the Dell Outlet store, and here’s the page I found for the M6400 Outlet – when I first visited, there were 3 pages, now I’m typing this, there are 8 computers total! The availability changes fast, and what you see is what’s available.
We’ve been building Offbeat Creations for over a year now, and we just managed to find enough time to actually put together a web site for the company!
We’re using the Radiant CMS to run this, to allow us to change the content quickly and easily. I’m still not very comfortable with the way Radiant works, but it does get the job done.
Check us out at Offbeat Creations
Lisa got me a few cool t-shirts for my birthday. I think my favorite is the Rock-Paper-Scissors-Lizard-Spock shirt pictured left. This shirt can be got from ThinkGeek
, so you too can have the best geek shirt in town!
I’ve been using Rails for so long without caring about how Time Zone’s are processed, that when I recently built a new application with Rails 2.3, I decided that I needed to care about the support for Time Zones since Rails 2.1
Technically, my new app doesn’t really care about time zones, so I could have just left the whole thing alone, but I wanted to see how these worked and get some experience.
The first big surprise is that dates are stored in the database as UTC time. Well, duh! This is usually seamless, but I noticed this detail when my custom code to group by created date on a set of objects suddenly started showing items for tomorrow at about 5pm Pacific time.
I was interested in using the new Rails Metal system for a project I’ve been building. What I want this code to do is take parameters out of the URL and write a record to my database to record these parameters.
This is my first application built with Rails 2.3, and the first application in my company to use Rails Metal in a production environment.
Here’s what I wrote:
If you’re using the will_paginate Rails plugin to manage the amount of data that you show to the user on a single page, there is a gotcha that comes into play as your data gets bigger.
The default display of the pagination buttons for shows links that can take you to the last page of the set. If you only have a few thousand records, you’ll never notice the problem, but try it with a million records and check out the MySQL slow log file.
The SQL query generated by your paginate call will look something like:
In the mysql-slow.log file you’ll eventually start seeing an entry that looks like this:
I ran into a problem today where I had SQL queries taking a really long time to execute and I had pages timing out. After a lot of investigation, I found a strange behavior that I didn’t expect that was killing my application.
I’m using Rails 2.1.1 and I have a named scope that looks like this:
The limited scope adds a “limit X” to the query to reduce the number of rows returned
In my view, I have some code that looks like this:
My current desktop computer just had a power supply failure due to having a too powerful graphics card in the machine. Due to it being a non-standard Dell, replacing the power supply doesn’t solve my problem, and I can’t put a bigger one in that machine.
Time to build a new PC!
Recently, Intel introduced their new i7 processor. Quad core, 2.66 – 3.2 Ghz, tri-channel memory, built in memory controller and a new X58 chipset. Off to Google and NewEgg to get some parts together.
Intel i7 2.66 Ghz for $299 for the retail version
Why on earth would I want to run a Facebook application on my laptop? Surely these apps are meant to be used by lots of users and they shouldn’t stop running when I turn my computer off!
The only reason you’ll need to do this is during development. I run my apps on my laptop, behind a firewall, either at home, or on the road – so my IP address isn’t static. This allows me to make changes locally and immediately test them out without needing to copy to a server.
For this technique, you do need to have access to a unix server of some sort that does have a static IP address (or a fixed DNS name) that allows you to create SSH tunnels. With SSH client access, this should be possible with the low end hosting providers. Dreamhost costs less than $10 per month.
Now we setup to get the remote server machine to listen on port 15000 and forward requests to this machine on port 5000.