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
Thoughts and tutorials on programming
Saturday, November 22, 2008
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/
(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.
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!
might mean "unmount your currently mounted cdrom first!
Monday, October 27, 2008
Monday, March 24, 2008
best ruby garbage collector
http://izumi.plan99.net/blog/index.php/2008/01/14/making-ruby%E2%80%99s-garbage-collector-copy-on-write-friendly-part-7/
Has what i would consider the 'best' for its current incantation--which is mark and sweep everything every time. I would recommend against going for it and instead recommend for a generational one.
Has what i would consider the 'best' for its current incantation--which is mark and sweep everything every time. I would recommend against going for it and instead recommend for a generational one.
Friday, June 29, 2007
ruby err
driver.rb:270:in `startServerAndGoAndStop': private method `doAllPeersWithDelta' called for # (NoMethodError)
means "you have an extra end in driver class!"
means "you have an extra end in driver class!"
Thursday, June 28, 2007
ruby-debug ctrl-c
So...you run your ruby app with ruby-debug rdebug and it doesn't catch ctrl-c interrupts anymore? Do not fear. Just run rdebug scriptname then 'catch Interrupt' and it will always catch them from then on.
.bashrc doesn't work
find that ~/.bashrc isn't getting loaded on login? Try renaming it ~/.profile (or creating such page and having it do '. ~/.bashrc'.
Wednesday, June 27, 2007
how to install rmagick to a custom directory (gem)
So..you install rmagick as a gem and it goes to the right gemrepository, but that still doesn't work? I search for RMagick.rb and then added that path to the RUBYLIB path, thus
export RUBYLIB=$RUBYLIB:/home/rdp/i386/gemrepository/gems/rmagick-1.15.7/lib/
(in ~/.bashrc). Voila
export RUBYLIB=$RUBYLIB:/home/rdp/i386/gemrepository/gems/rmagick-1.15.7/lib/
(in ~/.bashrc). Voila
Tuesday, June 26, 2007
how to convert you putty key to linux
So...you use putty agent to login to your linux box, and now you wish you could use the same key within linux? Not a problem. right click on the private key, choose edit, then choose "export" save the file somewhere (anywhere), then eventually copy it over to your ~/.ssh/identity file [may need to change permissions on said file so that it's not readable by anyone]. Voila.
Monday, June 25, 2007
installing rubygems as non root
so...install it and it does this?
rdp@ilab4 ~/downloads/rubygems-0.9.4 $ ruby setup.rb --verbose install
rm -f InstalledFiles
---> bin
mkdir -p /home/rdp/i386/bin
install gem /home/rdp/i386/bin/
install gem_mirror /home/rdp/i386/bin/
install gem_server /home/rdp/i386/bin/
install gemlock /home/rdp/i386/bin/
install gemri /home/rdp/i386/bin/
install gemwhich /home/rdp/i386/bin/
install index_gem_repository.rb /home/rdp/i386/bin/
install update_rubygems /home/rdp/i386/bin/
<--- bin
---> lib
mkdir -p /usr/lib/ruby/site_ruby/1.8
install gemconfigure.rb /usr/lib/ruby/site_ruby/1.8/
setup.rb:633:in `initialize': Permission denied - /usr/lib/ruby/site_ruby/1.8/gemconfigure.r b (Errno::EACCES)
from setup.rb:633:in `open'
from setup.rb:633:in `install'
from setup.rb:1377:in `install_files'
from setup.rb:1376:in `each'
from setup.rb:1376:in `install_files'
from setup.rb:1350:in `install_dir_lib'
from setup.rb:1532:in `__send__'
from setup.rb:1532:in `traverse'
... 7 levels...
from setup.rb:826:in `__send__'
from setup.rb:826:in `invoke'
from setup.rb:773:in `invoke'
from setup.rb:1578
try runing ruby setup.rb install --prefix=/path [though it doesn't say this]
rdp@ilab4 ~/downloads/rubygems-0.9.4 $ ruby setup.rb --verbose install
rm -f InstalledFiles
---> bin
mkdir -p /home/rdp/i386/bin
install gem /home/rdp/i386/bin/
install gem_mirror /home/rdp/i386/bin/
install gem_server /home/rdp/i386/bin/
install gemlock /home/rdp/i386/bin/
install gemri /home/rdp/i386/bin/
install gemwhich /home/rdp/i386/bin/
install index_gem_repository.rb /home/rdp/i386/bin/
install update_rubygems /home/rdp/i386/bin/
<--- bin
---> lib
mkdir -p /usr/lib/ruby/site_ruby/1.8
install gemconfigure.rb /usr/lib/ruby/site_ruby/1.8/
setup.rb:633:in `initialize': Permission denied - /usr/lib/ruby/site_ruby/1.8/gemconfigure.r b (Errno::EACCES)
from setup.rb:633:in `open'
from setup.rb:633:in `install'
from setup.rb:1377:in `install_files'
from setup.rb:1376:in `each'
from setup.rb:1376:in `install_files'
from setup.rb:1350:in `install_dir_lib'
from setup.rb:1532:in `__send__'
from setup.rb:1532:in `traverse'
... 7 levels...
from setup.rb:826:in `__send__'
from setup.rb:826:in `invoke'
from setup.rb:773:in `invoke'
from setup.rb:1578
try runing ruby setup.rb install --prefix=/path [though it doesn't say this]
Tuesday, June 19, 2007
parameters in django templates
It seems that it may be possible to have parameters within called functions in a django template. {% url path.to.some_view arg1,arg2,name1=value1 %} (see http://www.djangoproject.com/documentation/templates/). GL!
Thursday, June 07, 2007
how to host static files in a django app for development
add the following to urls.py (first line optional :)
Then you can access /static_files/filename.jpg and it should work. See the other post for production setup :)
As a side note, "how to change your django app from development to production" is you go to settings.py and change
if settings.DEBUG: # then serve static files here :)
urlpatterns += patterns('',
(r'^static_files/(?P.*)$', 'django.views.static.serve', {'document_root': 'C:/office_in_out/oliver/drb/static_files', 'show_indexes': True}),
Then you can access /static_files/filename.jpg and it should work. See the other post for production setup :)
As a side note, "how to change your django app from development to production" is you go to settings.py and change
DEBUG = True to DEBUG = False. I'm not sure what to do with TEMPLATE_DEBUG after that :)
Wednesday, June 06, 2007
Django static files, using fcgi
On blue host we use fcgi. So here is how to make static subdirectories work.
Django wants to host static files, for example the admin interface uses static files (hosted at /media/) for its css.
To create these what you will want to do is create create some sym links within your public_html/whatever sub-directory, then instruct apache, in .htaccess, to follow those links.
Here's an example for my admin media setup.
media is the same name as the directory, above.
Repeat for other static files desired. Should work!
Django wants to host static files, for example the admin interface uses static files (hosted at /media/) for its css.
To create these what you will want to do is create create some sym links within your public_html/whatever sub-directory, then instruct apache, in .htaccess, to follow those links.
Here's an example for my admin media setup.
cd public_html/subdomain
ln -s media /home/wilkboar/checked_out_svn_all/edited_django_repository_files/django/contrib/admin/media
(media being where ADMIN_MEDIA_PREFIX is set to in settings.py -- defaults to media)
Then edit .htaccess, add
Options +FollowSymLinks
RewriteRule ^(media/.*)$ - [L]
media is the same name as the directory, above.
Repeat for other static files desired. Should work!
django strange error
so...ever get one of these?
It may be because you add to your urlpatterns, in settings.py, but forget to name it urlpatterns. Why this sometimes works, and sometimes doesn't, I have no idea :)
This is bad. it should be patterns('',...
GL!
Request Method: GET
Request URL: http://localhost:8000/generic_html/traffic_color_definitions.html
Exception Type: AttributeError
Exception Value: 'str' object has no attribute 'resolve'
Exception Location: C:\office_in_out\oliver\edited_django_repository_files\django\core\urlresolvers.py in resolve, line 163It may be because you add to your urlpatterns, in settings.py, but forget to name it urlpatterns. Why this sometimes works, and sometimes doesn't, I have no idea :)
urlpatterns += ('',
(r'^static_files/(?P.*)$', 'django.views.static.serve', {'document_root': 'C:/office_in_out/oliver/drb/static_files', 'show_indexes': True}),
)
This is bad. it should be patterns('',...
GL!
Monday, June 04, 2007
D&C thought
Well it appears there was some confusion about D&C 89 on teh internet, thought I'd put in my $.02...
Noticed an article of yours at http://www.johnankerberg.org/Articles/apologetics/AP0501W1.htm and I thank you for your respectful comments (I am LDS). As a contemplative addition (something to think about), the reference in v. 7 to "strong drinks" may also be 'pointing back' to v. 5 "wine or strong drinks" which is why it is typically construed to mean alcoholic beverages. Some people get confused and it's easy to do so. Keep up the good work!
--
-Roger Pack
"Men are that they might have joy." (2 ne 2:25)
Noticed an article of yours at http://www.johnankerberg.org
--
-Roger Pack
"Men are that they might have joy." (2 ne 2:25)
Friday, January 19, 2007
throttling with apache
So it appears that there is no "good" throttler for apache 2.x -- mod_cband only allows a max of 123 KB/s or something like that--at least on the LAN, so I think this probably means that it is just too slow for large loads, and I cannot see another good throttler for apache 2.x
So we go ahead and use apache 1.3.x
Unfortunately this means that when you install apacche 1.3.x you need to install ./configure --enable-module=so (installs mod_so) so that you can THEN compile/use mod_throttle (found at http://www.ivor.it/throttle/)
So we go ahead and use apache 1.3.x
Unfortunately this means that when you install apacche 1.3.x you need to install ./configure --enable-module=so (installs mod_so) so that you can THEN compile/use mod_throttle (found at http://www.ivor.it/throttle/)
Subscribe to:
Posts (Atom)