Thoughts and tutorials on programming

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!"

Thursday, June 28, 2007

ruby-debug ctrl-c 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) 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

Tuesday, June 26, 2007

how to convert you putty key to linux 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

more install errs

get /home/rdp/i386/bin/gem:9:in `require': no such file to load -- rubygems (LoadError)
(maybe -- might be prev. post) install gemconfigure.rb /usr/lib/ruby/site_ruby/1.8/
no such file to load -- ubygems (LoadError)
then see the faq at at the bottom
must do things like
export RUBYLIB=$RUBYLIB:/home/rdp/i386/gemrepository:/home/rdp/i386/usr/lib/ruby/site_ruby/1.8/

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]

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 arg1,arg2,name1=value1 %} (see GL!

Thursday, June 07, 2007

how to host static files in a django app for development

add the following to (first line optional :)

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 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.

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 -- 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?

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\ in resolve, line 163

It may be because you add to your urlpatterns, in, 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('',...

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 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)

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

how to setup ssh to not prompt with planetlab

so with planetlab typically it has these 600 hosts and for each one, the first time you ssh into it, it prompts you if you want to accept that one's identification key.
To get rid of this:
to ~/.ssh/config

see the docs at "man ssh_config" which was were it was found.