Rails 2.3 Upgrade Tips
Today Rails 2.3 was pushed. Upgrading some applications created a couple of issues.
NameError (uninitialized constant ApplicationController)
In previous versions of Rails, the generator would create application.rb for the Application Controller. In 2.3 the file is now properly named application_controller.rb.
NameError (uninitialized constant ActionController::Caching::Sweeper)
This is a bug that is part of the 2.3 release. The fix is was supposedly resolved according to this ticket previous to 2.3 but something is still off.
$PATH when Using Passenger (mod_rails) aka BJ does work with Rails 1
Phusion Passenger has become my default Rails setup lately. Today I had issues when using BJ on a production box, and it came down to two issues. The first was Bj not working quite right with Rails Time. The gist of that fix is to change every reference of Time.now to Time.now.utc. The next however was tougher to track down. I was getting error messages in my email:
no bj found in ["RAILS_ROOT/script", "/sbin", "/usr/sbin", "/bin", "/usr/bin"]
I jumped into the console, and ENV["PATH"] reported the correct paths, including /usr/local/bin. It turns out that passenger inherits the $PATH of apache, so I manually set the path in environment.rb and my problem was solved.
ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin"
RHEL5 Getting The Rails Console Working
If you compile Ruby from scratch you may get this error when starting a script/console session:
`require': no such file to load -- readline (LoadError)
To solve this you need to install the readline ruby extension. Here I assume you are using the 1.8.7 Ruby.
sudo yum install ncurses-devel readline-devel cd ~ mkdir src cd src wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz tar zxvf ruby-1.8.7-p72.tar.gz cd ruby-1.8.7-p72.tar.gz/ext/readline ruby extconf.rb make sudo make install
SWFupload with Flash 10 Fix 3
It took me a while to reproduce errors that users were reporting with the SWFUpload plugin, but I finally traced it to users using Flash 10. Flash 10 changes how javascript and flash are allowed to interact thus breaking the html upload button that calls javascript to present the file choosing dialog box. If you run SWFUpload in debug mode you will get Error #2176. To fix:
- Download SWFUpload v2.2.0 Beta 3 Core.zip
- (optional) Backup your swfupload.js and your swfupload.swf file
- Unzip and overwrite your existing swfupload.js and your swfupload.swf file. You might need to rename the swf to match your swf name. If you try the uploader at this point you will receive a javascript error: SWFUpload Could not find the placeholder element.
- Create a button image that will be used instead of the upload html input.
Adjust your JavaScript to include the following attributes:
button_placeholder_id : "spanSWFUploadButton", button_image_url : "http://www.yourdomain.com/yourbutton.png", button_width : 61, button_height : 22
Add a span tag with the element ID you specified above.
Update: In order for your image to work properly, it must have 4 states. Refer to this post.
If things are still not working for you, be sure to turn debug: true and review the javascript error log. Hope this helps others.
Android Speed Test 2
Rally 2
"RALLY STOP STEALING MY #$%^(*& FOCUS."
and more recently:
"RALLY IS THE WORST FUCKING PROJECT MANAGEMENT SOFTWARE I HAVE EVER USED. FIX THE UI ALREADY, THIS IS 2008."
Now I must admit that the second tweet was knee jerk and in the heat of frustration. Rally has developed a product to help with Agile Development practices and it has allowed a team I work with to organize and complete a very large project. I appreciate their representative getting in touch with me after the nasty tweet and offering to help me out with some training. I like training, but feel that quality web applications these days have labored over their UI to provide a dead simple interface so that it can help and not hinder productivity. To quote a master in this art, 37signals, "Simple interfaces are easier to use, easier to understand, more intuitive, faster loading, and easier to maintain". I would like to offer Rally some constructive criticism, a much better alternative to cursing on Twitter.
My first tweet, "RALLY STOP STEALING MY #$%^(*& FOCUS.", was in reference to my session timing out. When this happens Rally pops a javascript dialog box stealing focus. Furthermore the default session time is EXTREMELY short at 30 minutes. You can increase this up to 4 hours in your profile, however software should have reasonable defaults. Rally is supplemental software to my day, it will be open ALL day, so don't keep kicking me out.
![]() |
The actions menu is out of tune with its context. If you are on the Tasks page for a User Story the most likely thing to do is add new tasks. HOWEVER that menu includes all the actions for a story, INCLUDING making a new story. The "New Task" item is at the bottom of the list. I cannot tell you how many times I have created several "tasks" only to realize I hit the wrong option and now have added several unnecessary stories. Another small issue I have with this screen is that navigation items on the left do not emphasize the current page as you move around. |
| You can set the status at both the Story level and the Task level. The two do not seem to interact well and will sometimes result in stories that are marked complete that actually have tasks still in progress. A story should not be marked as complete until all tasks within the story are marked complete. |
|
I would be interested to know if others out there share any of these issues, feel free to leave your comments.
Netgear WNR834B to WNR834B Internet Connection Briding
A friend of mine had horrible reception at the far end of his house for his wireless network. He purchased matching WNR834B Netgear routers and needed to bridge them. Let me start by saying, the below setup CAN BE DONE, but it is not straight forward, well documented, or easy to do. This is the setup I finally got working
Internet Modem -wired- WNR834B (master router) -wireless- WNR834B (wireless repeater)
Here are some tips to get it going:
- Setup the first router and make sure everything is working properly
- When setting up the wireless repeater, wire your computer to it and statically set your IP address, do not try to set it up wirelessly
- Turn off the DHCP server of the wireless repeater
- Meet all the requirements in section 4-12 of this document
Optimize Large MySQL Table Queries with Indexes 1
1. Turn on slow query logging in your my.cnf (most likely in /etc/mysql/my.cnf). Most like you will just have to uncomment this line:
log_slow_queries = /var/log/mysql/mysql-slow.log
2. Examine your logs and then use the mysql EXPLAIN query to see why it is performing slowly. This query needs to look at almost the ENTIRE table to find a result.
mysql> EXPLAIN select * from network_tests where user_id = 1; +----+-------------+---------------+------+---------------+------+---------+------+--------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+------+---------------+------+---------+------+--------+-------------+ | 1 | SIMPLE | network_tests | ALL | NULL | NULL | NULL | NULL | 264559 | Using where | +----+-------------+---------------+------+---------------+------+---------+------+--------+-------------+ 1 row in set (0.00 sec)
3. Add indexes to the columns that you are querying on most:
mysql> ALTER TABLE network_tests ADD INDEX(user_id,test_key); Query OK, 285075 rows affected (1 min 7.14 sec) Records: 285075 Duplicates: 0 Warnings: 0
4. Run explain again, see how many rows now need to be checked for this query? VERY NICE!.
mysql> EXPLAIN select * from network_tests where user_id = 1; +----+-------------+---------------+------+---------------+---------+---------+-------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+------+---------------+---------+---------+-------+------+-------------+ | 1 | SIMPLE | network_tests | ref | user_id | user_id | 5 | const | 118 | Using where | +----+-------------+---------------+------+---------------+---------+---------+-------+------+-------------+ 1 row in set (0.00 sec)
iPhone Optimized Olypic Medal Totals 1
After my initial surfing on my iPhone for Olympic medal totals, I found no immediate results for an optimized mobile experience. I wrote up a quick site after which I immediately found NBC's mobile site. Mine is super simple, and can be found at iPhone Olympic Medal Counts. CHEERS.
George Carlin

May 12, 1937 – June 22, 2008


