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:
http://members.ozemail.com.au/~markhurd/SomeProgs.html
then

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

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

sorry it's not all ruby :)
references:
http://ask.slashdot.org/article.pl?sid=06/09/03/2231244
http://groups.google.com/group/ruby-talk-google/browse_thread/thread/6b6d1a0909932f2b?pli=1

rails error report

C:/dev/bridal/vendor/rails/railties/lib/commands/dbconsole.rb:47:in `exec': No such file or directory - mysql.exe
(Errno::ENOENT)
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.
Fix:
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 appears...at least in a friendly way...

virtualbox woe

click install guest additions does nothing


might mean "unmount your currently mounted cdrom first!

Contributors

Followers