find . -exec grep -n YOUR-TEXT-HERE /dev/null {} \;
Category: Troubleshooting
Randomly Restarting PC
Problem
PC is randomly restarting once every day or two. I could replicate it easily by playing Call of Duty 4 for a couple of minutes.
Cause
I haven’t found the cause yet.
The most likely cause of the shutdowns would be overheating. I took a spare 120mm fan and put it inside the rig’s aluminum case.
Still shuts down when playing COD4.
Tried to double check the heating problem. I downloaded Orthos Stress Prime and Furmark to stress test the rig.
It doesn’t shut down even if the load is a lot higher than what COD4 does to the system.
Power supply problem? I highly doubt it because I’m using a Corsair HX 520 PSU. Just to make sure, I switched the rails used by the video card.
Still shuts down when playing COD4.
Maybe it’s the drivers. So I uninstalled the drivers then used DriverSweeper to scrub the drivers clean. Reinstalled the latest ++ATI Catalyst drivers.
Still shuts down.
Maybe it’s the video card itself. Besides, it is a factory overclocked video card. So I switched it with my old video card, an nVidia 8800GTS 320MB card. Of course, I re-scrubbed the drivers again.
Still shuts down.
Maybe it’s a memory problem. Ran memtest86+ using a Ubuntu installer cd I have lying around.
No memory errors.
—
At this point, the only possible cause for the shutdown I could think of right now is the motherboard itself. It is a quality motherboard, but even high-end devices can have defects later in their lifetime.
Before I could decide to replace the board, I have to try one last risky thing: flashing the mobo BIOS. Downloaded the latest version and flashed the BIOS with it.
Still shut down after 1.5 hours of COD4.
Looks like I’m going to have to buy a new one these next few weeks. Now the board itself is pretty stable and wouldn’t require replacement; I’m just worried that a random shutdown would affect the other hardware (e.g. the Seagate drive I had RMA’ed last week).
[August 14 Update:]
Solution
Bought a new motherboard to replace current one. This time, I was able to run through the first act of CoD4 without experiencing any crashes.
Member Route error "No action responded to"
Problem:
Member routes allow one to create additional routes to existing resources. For example, if you want to add an approve path to your purchases resource, you could do this in your config/routes.rb:
map.resources :purchases, :member => { :approve => :put }
My problem was that the link I made for approving the purchase
<%= link_to "Approve Purchase", approve_purchase_path(@purchase), :confirm => "Proceed with approval?" %>
resulted in the following error:
Unknown action
No action responded to 1. Actions: approve, create, destroy, edit, index, new, show, and update
Cause:
Rails confused the link with a normal get operation.
Solution:
Explicitly declare the HTTP method for the action.
<%= link_to "Approve Purchase", approve_purchase_path(@purchase), :confirm => "Proceed with approval?", :method => :put %>
HTML Line Breaks in Rails Text Fields
Problem:
Rails doesn’t automatically convert newline (“\n“) characters in strings to line breaks (“<br>“) with h.
<%= h @user.address %>
Solution:
Manually replacing the \n with <br> without using h will make your site vulnerable to XSS attacks. The proper approach would be to convert the line breaks after h. Note that Rails already has a method, simple_format, that converts line breaks.
<%= simple_format(h @user.address) %>
Rails Development Server is Slow
Problem:
When developing for Ruby on Rails, the development server (the one used by script/server) feels slow and unresponsive.
Cause:
RoR uses WEBrick as the default server. Based on my experience on a Ubuntu virtual machine with 1GB of RAM, this server doesn’t respond as fast as the web application servers in other web languages (Apache, Tomcat, IIS).
Solution:
Install Mongrel. In Ubuntu 9.04, you can install this using:
sudo gem install mongrel
In case you receive build errors, you might have to install ruby-dev to deal with the dependency issues.
sudo apt-get install ruby-dev
Once installed, Rails will automatically use Mongrel as the application server over WEBrick.
UPDATE: Mongrel’s pretty much dead by now. Use thin instead.
Just add gem 'thin' to your Gemfile and run bundle install.