Thoughts and tutorials on programming

Saturday, November 22, 2008

how to nice processes [decrease priority] using ruby, in windows

garnered from a few entries:

download 'nice.exe' for windows:

require 'win32ole'
loop {
procs = WIN32OLE.connect("winmgmts:\\\\.")
procs.InstancesOf("win32_process").each do |p|
if =~ /ruby/
command = ".\\nice -i -p #{p.processid}" # i for idle
print "running #{command}\n"
sleep 1

in that directory will always force your ruby's to idle.

sorry it's not all ruby :)

rails error report

C:/dev/bridal/vendor/rails/railties/lib/commands/dbconsole.rb:47:in `exec': No such file or directory - mysql.exe
from C:/dev/bridal/vendor/rails/railties/lib/commands/dbconsole.rb:47
from c:/ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/dbconsole:3

meant "you need to go into dbconsole and force it to 'exec' the full path name of mysql.exe, not just 'mysql.exe'"

also if it says
Couldn't find database client: mysql. Check your $PATH and try again.
but mysql IS in your path, no fear, edit dbconsole.rb and add mingw wherever it does =~ /win32/

hp t43 is very soft quiet

So...break open your new ibm T43 and the volume is very low? there's little buttons at the top that [annoyingly] might be making it so. Try it!

binary executables from gems don't show up in the path with ubuntu

nope--they don't for some reason. No idea where ubuntu's default "apt-get install rubygems1.8" installs it binaries, but it's not in the path.
install rubygems from source, then it will install the binaries in the right spot after that.

rubyforge broken with windows

yep--use linux [install a virtualbox, etc. ugh] for this to work, it least in a friendly way...

virtualbox woe

click install guest additions does nothing

might mean "unmount your currently mounted cdrom first!