Roger's woze

January 21, 2008

ruby extend versus include

Filed under: Uncategorized — rogerdpack @ 6:31 pm

So…you want to add a module to your ruby class, huh?

Touche! It appears that if you want to add ‘just functions’ here’s how

module FunctionsAndConstants
  CONSTANT='3'
  def a end
end
class B
 include JustFunctionsend
end
b_instance = B.new()
b_instance.a()
B::CONSTANT # '3'

however if you want to add class functions use extend but define them as normal functions

module JustClassStuff
 def class_method  end
end
class C
 extend JustClassStuff
end
C.class_method

however.

http://www.rubycentral.com/pickaxe/classes.html

January 20, 2008

oscommerce

Filed under: Uncategorized — rogerdpack @ 1:28 am

so it turns out that to enable authorize.net with it, you go to admin/modules and install SIM or AIM.  SIM is the ‘standard’ and AIM is actually developed by vger and is ‘on-site you take their credit card here’

January 19, 2008

substruct

Filed under: Uncategorized — rogerdpack @ 11:15 pm


Not Found

The requested URL /store/checkout was not found on this server.Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.means ‘you need to setSubstruct.override_ssl_production_mode = true in your environment.rb (at the bottom where it already is set). 

January 18, 2008

escaping erb

Filed under: Uncategorized — rogerdpack @ 4:51 pm

So…you want to put erb into erb itself? erb escaping for itself:use %%<%%= this_stuff_comes_out_as_another_erb_command %>

January 16, 2008

mac uninstall utility

Filed under: Uncategorized — rogerdpack @ 10:14 pm

appdelete is free and uninstall apps on os x.

php replacement for fcgi

Filed under: Uncategorized — rogerdpack @ 9:26 pm

So…fcgi doesn’t work? Stuck with cgi, as in hostgator? Well you could try this experimental simple_proxy which attempts to (and poorly does) replace fcgi. It also has the added benefit of attempting to rewrite your url’s should you have any that are ‘hard coded’ so that you can use a rails app within a directory.

It is sweet.

To come should I ever be free with my time: auto-starting mongrel, doing some house keeping on it, etc.


http://ruby-roger-useful-functions.googlecode.com/svn/trunk/forward.php

To use it in .htaccess

RewriteEngine On
RewriteRule ^(.*)$ forward.php [QSA,L]
(not perfect, I know)

January 15, 2008

streamlined tips

Filed under: Uncategorized — rogerdpack @ 10:49 pm

How to make pagination ‘deeper’? — go to crud_helpers.rb, change :per_page

some error reports

Filed under: Uncategorized — rogerdpack @ 7:26 pm

So…mongrel hangs every so often?  Are your logs too huge maybe?so you start mysql and it fails?  if innodb_log_file_size is smaller than the current log file sizes it will silently quit. 

January 13, 2008

php not working on hostgator

Filed under: Uncategorized — rogerdpack @ 1:22 am

if it doesn’t (at all–500 error) check your error logs, scan all carefully (they’re ordered poorly), see if there is a permissions problem.

January 12, 2008

substruct tips

Filed under: Uncategorized — rogerdpack @ 11:24 pm

If it errs on db half-way through–did you follow the instructions to the letter, so that you have the right environment.rb which defines some constants at the bottom?It just doesn’t start:are you sure it is starting in the right ‘mode’? (development versus production)are you sure the #! all say ruby, in your public directory?It doesn’t show the first page–just a default.Did you copy over the files, exactly as specified?Note it doesn’t work with rails 2.0 yet. rake doesn’t work: use v. 0.7.3  as a last resort, Check your error logs (?) 

Older Posts »

Powered by WordPress