| Home | Business | Personal | Contact |
||
Max S. Dunn...when there is a will, there is a way |
||
On one computer, Ruby was installed in /usr/local/lib but MySql was in /usr/lib. So running “gem install mysql” gave an error. Here is the command used:
gem install mysql -- --with-mysql-config=/usr/lib/mysql/mysql_config
The normal debug prompt shows the object that you are currently in. Normally, this is fine but sometimes when you are debugging an HTML or RedCloth object, it can be very long. To get back to a normal debug prompt use:
conf.prompt_mode = :SIMPLE
However, this needs to be typed in every time, which is a pain. So a better solution is to create an .irbrc file in the Rails root that contains:
IRB.conf[:PROMPT_MODE] = :SIMPLE
http://www.bigbold.com/snippets/posts/show/600
ruby script/console
irb> require 'action_controller/test_process'
irb> require 'application'
irb> require 'site_controller'
irb> request = ActionController::TestRequest.new
irb> response = ActionController::TestResponse.new
irb> request.env['REQUEST_METHOD'] = 'GET'
irb> request.action = "late_employee"
irb> InfoController.process(request,response)
FastCGI on Apache tends to create zombie processes. To keep these pruned, add this line to a cron job:
pkill -9 -u `whoami` -f dispatch.fcgi
Here is a longer way to do this with a Ruby script:
#!/usr/bin/ruby
#Modified from Julik's original code posted to TextDrive forums.
def kill_fcgi_proc(line)
its = line.strip.split(/\s+/)
pid = its[0]
puts "KILLING #{line}"
`kill -9 #{pid}`
sleep(3)
end
pstab = `ps ww -u maxdunnc`
pstab.scan(/^.*dispatch\.fcgi\s*$/) do |line|
kill_fcgi_proc line
end
<%= javascript_include_tag 'prototype' %>
<% if ENV['RAILS_ENV'] == 'development' %>
<div id="debug" style="margin: 40px 5px 5px 5px;">
<a href="#" onclick="Element.toggle('debug_info');return false" style="text-decoration: none; color: #ccc;">Show Debug Info ➲</a>
<div id="debug_info" style="display : none;">
<%= debug session %>
<%= debug params %>
</div>
</div>
<% end %>
Somehow we got a bunch of weird UTF escape sequences in many web pages. To clean them up, use:
sed 's/\\x..//g' infile >outfile