From mathieu at justbudget.com Tue Aug 1 01:33:55 2006 From: mathieu at justbudget.com (Mathieu Jobin) Date: Tue, 1 Aug 2006 14:33:55 +0900 Subject: warning and errors Message-ID: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> i got my app to run fine on one server, but I moved it to another and huge problem started.... I've been trying various things for 3 hours now, I can't get it to work.... I am getting this error. Exception `TypeError' at (eval):542 - superclass mismatch for class NotFound I am using the same camping.rb, apps starts in CGI but not in Apache/FastCGI. while it works fine on my other server the only difference I can think of, its the apache version. but I run rails fastcgi on this same apache, so the apache version should not be a problem. anyone got that error before ? also, when running ruby -d, I was wondering if those warnings could be eliminated? (eval):672: warning: `*' interpreted as argument prefix (eval):700: warning: `*' interpreted as argument prefix (eval):97: warning: already initialized constant C (eval):99: warning: already initialized constant P (eval):101: warning: already initialized constant H (eval):132: warning: method redefined; discarding old method_missing (eval):135: warning: discarding old u (eval):208: warning: method redefined; discarding old R (eval):233: warning: method redefined; discarding old errors_for (eval):241: warning: method redefined; discarding old / (eval):268: warning: method redefined; discarding old URL (eval):312: warning: already initialized constant Z (eval):339: warning: method redefined; discarding old method_missing (eval):359: warning: method redefined; discarding old redirect (eval):372: warning: method redefined; discarding old r (eval):374: warning: method redefined; discarding old initialize (eval):417: warning: method redefined; discarding old service (eval):425: warning: method redefined; discarding old to_s (eval):429: warning: method redefined; discarding old markaby (eval):456: warning: method redefined; discarding old r (eval):478: warning: method redefined; discarding old R (eval):497: warning: method redefined; discarding old D (eval):515: warning: method redefined; discarding old M Exception `TypeError' at (eval):542 - superclass mismatch for class NotFound Exception `TypeError' at /usr/rubyonrails/lib/ruby/gems/1.8/gems/camping- 1.4.2/lib/camping.rb:597 - (eval):542: superclass mismatch for class NotFound Exception `TypeError' at /usr/rubyonrails//lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:143 - (eval):542: superclass mismatch for class NotFound -- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it's impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060801/b11b657b/attachment.html From mathieu at justbudget.com Tue Aug 1 02:39:07 2006 From: mathieu at justbudget.com (Mathieu Jobin) Date: Tue, 1 Aug 2006 15:39:07 +0900 Subject: warning and errors In-Reply-To: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> References: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> Message-ID: <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> found this ... http://www.ruby-forum.com/topic/73894 the problem seems to be with the fact camping code is re-read over and over again. R() always returns a new Class why is the code red multiple times? On 8/1/06, Mathieu Jobin wrote: > > i got my app to run fine on one server, but I moved it to another and huge > problem started.... > I've been trying various things for 3 hours now, I can't get it to > work.... > I am getting this error. > Exception `TypeError' at (eval):542 - superclass mismatch for class > NotFound > > I am using the same camping.rb, apps starts in CGI but not in > Apache/FastCGI. > while it works fine on my other server > > the only difference I can think of, its the apache version. but I run > rails fastcgi on this same apache, so the apache version should not be a > problem. > > anyone got that error before ? > > also, when running ruby -d, I was wondering if those warnings could be > eliminated? > > (eval):672: warning: `*' interpreted as argument prefix > (eval):700: warning: `*' interpreted as argument prefix > (eval):97: warning: already initialized constant C > (eval):99: warning: already initialized constant P > (eval):101: warning: already initialized constant H > (eval):132: warning: method redefined; discarding old method_missing > (eval):135: warning: discarding old u > (eval):208: warning: method redefined; discarding old R > (eval):233: warning: method redefined; discarding old errors_for > (eval):241: warning: method redefined; discarding old / > (eval):268: warning: method redefined; discarding old URL > (eval):312: warning: already initialized constant Z > (eval):339: warning: method redefined; discarding old method_missing > (eval):359: warning: method redefined; discarding old redirect > (eval):372: warning: method redefined; discarding old r > (eval):374: warning: method redefined; discarding old initialize > (eval):417: warning: method redefined; discarding old service > (eval):425: warning: method redefined; discarding old to_s > (eval):429: warning: method redefined; discarding old markaby > (eval):456: warning: method redefined; discarding old r > (eval):478: warning: method redefined; discarding old R > (eval):497: warning: method redefined; discarding old D > (eval):515: warning: method redefined; discarding old M > Exception `TypeError' at (eval):542 - superclass mismatch for class > NotFound > Exception `TypeError' at /usr/rubyonrails/lib/ruby/gems/1.8/gems/camping- > 1.4.2 /lib/camping.rb:597 - (eval):542: superclass mismatch for class > NotFound > Exception `TypeError' at > /usr/rubyonrails//lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:143 > - (eval):542: superclass mismatch for class NotFound > > > -- > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static > -ldl -lcrypt -lm -o ruby > Everyone is trying their hardest to do their job but management has set it > up so that it's impossible. > Take the control over your money, track your expenses > http://justbudget.com > > Mathieu > -- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it's impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060801/718192d6/attachment.html From mathieu at justbudget.com Tue Aug 1 03:29:27 2006 From: mathieu at justbudget.com (Mathieu Jobin) Date: Tue, 1 Aug 2006 16:29:27 +0900 Subject: starting fresh Message-ID: <78181ce60608010029k3dc535aex87887d6e2dedaa11@mail.gmail.com> trying to get the example blog running under Apache/FastCGI with Camping 1.4.143 anyone using Apache/FastCGI in here? does not seems to be possible to use with Camping. anyone got better luck? this is my postamble if __FILE__ == $0 Blog::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'examples.db' Blog::Models::Base.logger = Logger.new('camping.log') Blog::Models::Base.threaded_connections=false Blog.create require_gem 'fcgi', '>=0.8' require 'camping/fastcgi' Dir.chdir(File.dirname(__FILE__)) Camping::FastCGI.serve(__FILE__) # tried File.dirname(__FILE__) and (`pwd`.chomp) end -- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it's impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060801/06a64c3b/attachment.html From zimba.tm at gmail.com Tue Aug 1 06:08:21 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Tue, 1 Aug 2006 12:08:21 +0200 Subject: warning and errors In-Reply-To: <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> References: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> Message-ID: <3ff63f9b0608010308g1ab3d806j8af46249e37ce0de@mail.gmail.com> Hi Mathieu, it looks like your app is loaded twice. Since NotFound inherits from R() and that R() passes a new class each time, this is normal that your get that error. On 01/08/06, Mathieu Jobin wrote: > found this ... http://www.ruby-forum.com/topic/73894 > the problem seems to be with the fact camping code is re-read over and over > again. > R() always returns a new Class > why is the code red multiple times? > > > On 8/1/06, Mathieu Jobin wrote: > > > > i got my app to run fine on one server, but I moved it to another and huge > problem started.... > > I've been trying various things for 3 hours now, I can't get it to > work.... > > I am getting this error. > > Exception `TypeError' at (eval):542 - superclass mismatch for class > NotFound > > > > I am using the same camping.rb, apps starts in CGI but not in > Apache/FastCGI. > > while it works fine on my other server > > > > the only difference I can think of, its the apache version. but I run > rails fastcgi on this same apache, so the apache version should not be a > problem. > > > > anyone got that error before ? > > > > also, when running ruby -d, I was wondering if those warnings could be > eliminated? > > > > (eval):672: warning: `*' interpreted as argument prefix > > (eval):700: warning: `*' interpreted as argument prefix > > (eval):97: warning: already initialized constant C > > (eval):99: warning: already initialized constant P > > (eval):101: warning: already initialized constant H > > (eval):132: warning: method redefined; discarding old method_missing > > (eval):135: warning: discarding old u > > (eval):208: warning: method redefined; discarding old R > > (eval):233: warning: method redefined; discarding old errors_for > > (eval):241: warning: method redefined; discarding old / > > (eval):268: warning: method redefined; discarding old URL > > (eval):312: warning: already initialized constant Z > > (eval):339: warning: method redefined; discarding old method_missing > > (eval):359: warning: method redefined; discarding old redirect > > (eval):372: warning: method redefined; discarding old r > > (eval):374: warning: method redefined; discarding old initialize > > (eval):417: warning: method redefined; discarding old service > > (eval):425: warning: method redefined; discarding old to_s > > (eval):429: warning: method redefined; discarding old markaby > > (eval):456: warning: method redefined; discarding old r > > (eval):478: warning: method redefined; discarding old R > > (eval):497: warning: method redefined; discarding old D > > (eval):515: warning: method redefined; discarding old M > > Exception `TypeError' at (eval):542 - superclass mismatch for class > NotFound > > Exception `TypeError' at > /usr/rubyonrails/lib/ruby/gems/1.8/gems/camping-1.4.2 > /lib/camping.rb:597 - (eval):542: superclass mismatch for class NotFound > > Exception `TypeError' at > /usr/rubyonrails//lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:143 > - (eval):542: superclass mismatch for class NotFound > > > > > > -- > > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > -lruby-static -ldl -lcrypt -lm -o ruby > > Everyone is trying their hardest to do their job but management has set it > up so that it's impossible. > > Take the control over your money, track your expenses > http://justbudget.com > > > > > > Mathieu > > > > -- > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > -lruby-static -ldl -lcrypt -lm -o ruby > Everyone is trying their hardest to do their job but management has set it > up so that it's impossible. > Take the control over your money, track your expenses http://justbudget.com > > Mathieu > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > -- Cheers, zimbatm http://zimbatm.oree.ch From zimba.tm at gmail.com Tue Aug 1 06:16:19 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Tue, 1 Aug 2006 12:16:19 +0200 Subject: warning and errors In-Reply-To: <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> References: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> Message-ID: <3ff63f9b0608010316m7026901fp3140b6d40b6cb47d@mail.gmail.com> Opps didn't read that post. On 01/08/06, Mathieu Jobin wrote: > found this ... http://www.ruby-forum.com/topic/73894 > the problem seems to be with the fact camping code is re-read over and over > again. > R() always returns a new Class > why is the code red multiple times? > > > On 8/1/06, Mathieu Jobin wrote: > > > > i got my app to run fine on one server, but I moved it to another and huge > problem started.... > > I've been trying various things for 3 hours now, I can't get it to > work.... > > I am getting this error. > > Exception `TypeError' at (eval):542 - superclass mismatch for class > NotFound > > > > I am using the same camping.rb, apps starts in CGI but not in > Apache/FastCGI. > > while it works fine on my other server > > > > the only difference I can think of, its the apache version. but I run > rails fastcgi on this same apache, so the apache version should not be a > problem. > > > > anyone got that error before ? > > > > also, when running ruby -d, I was wondering if those warnings could be > eliminated? > > > > (eval):672: warning: `*' interpreted as argument prefix > > (eval):700: warning: `*' interpreted as argument prefix > > (eval):97: warning: already initialized constant C > > (eval):99: warning: already initialized constant P > > (eval):101: warning: already initialized constant H > > (eval):132: warning: method redefined; discarding old method_missing > > (eval):135: warning: discarding old u > > (eval):208: warning: method redefined; discarding old R > > (eval):233: warning: method redefined; discarding old errors_for > > (eval):241: warning: method redefined; discarding old / > > (eval):268: warning: method redefined; discarding old URL > > (eval):312: warning: already initialized constant Z > > (eval):339: warning: method redefined; discarding old method_missing > > (eval):359: warning: method redefined; discarding old redirect > > (eval):372: warning: method redefined; discarding old r > > (eval):374: warning: method redefined; discarding old initialize > > (eval):417: warning: method redefined; discarding old service > > (eval):425: warning: method redefined; discarding old to_s > > (eval):429: warning: method redefined; discarding old markaby > > (eval):456: warning: method redefined; discarding old r > > (eval):478: warning: method redefined; discarding old R > > (eval):497: warning: method redefined; discarding old D > > (eval):515: warning: method redefined; discarding old M > > Exception `TypeError' at (eval):542 - superclass mismatch for class > NotFound > > Exception `TypeError' at > /usr/rubyonrails/lib/ruby/gems/1.8/gems/camping-1.4.2 > /lib/camping.rb:597 - (eval):542: superclass mismatch for class NotFound > > Exception `TypeError' at > /usr/rubyonrails//lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:143 > - (eval):542: superclass mismatch for class NotFound > > > > > > -- > > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > -lruby-static -ldl -lcrypt -lm -o ruby > > Everyone is trying their hardest to do their job but management has set it > up so that it's impossible. > > Take the control over your money, track your expenses > http://justbudget.com > > > > > > Mathieu > > > > -- > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > -lruby-static -ldl -lcrypt -lm -o ruby > Everyone is trying their hardest to do their job but management has set it > up so that it's impossible. > Take the control over your money, track your expenses http://justbudget.com > > Mathieu > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > -- Cheers, zimbatm http://zimbatm.oree.ch From zimba.tm at gmail.com Tue Aug 1 07:25:19 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Tue, 1 Aug 2006 13:25:19 +0200 Subject: warning and errors In-Reply-To: <3ff63f9b0608010316m7026901fp3140b6d40b6cb47d@mail.gmail.com> References: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> <3ff63f9b0608010316m7026901fp3140b6d40b6cb47d@mail.gmail.com> Message-ID: <3ff63f9b0608010425y556673d7va4cd6b29a6539e0e@mail.gmail.com> One possible solution is that your code is separated in more than one file where some file requires your main camping file. Since the camping/reloader uses Kernel#load to load your apps and that this method doesn't add the loaded file in the $LOADED_FEATURES array, if you Kernel#require that same file, it will get loaded a second time. Is it the case ? On 01/08/06, Jonas Pfenniger wrote: > Opps didn't read that post. > > On 01/08/06, Mathieu Jobin wrote: > > found this ... http://www.ruby-forum.com/topic/73894 > > the problem seems to be with the fact camping code is re-read over and over > > again. > > R() always returns a new Class > > why is the code red multiple times? > > > > > > On 8/1/06, Mathieu Jobin wrote: > > > > > > i got my app to run fine on one server, but I moved it to another and huge > > problem started.... > > > I've been trying various things for 3 hours now, I can't get it to > > work.... > > > I am getting this error. > > > Exception `TypeError' at (eval):542 - superclass mismatch for class > > NotFound > > > > > > I am using the same camping.rb, apps starts in CGI but not in > > Apache/FastCGI. > > > while it works fine on my other server > > > > > > the only difference I can think of, its the apache version. but I run > > rails fastcgi on this same apache, so the apache version should not be a > > problem. > > > > > > anyone got that error before ? > > > > > > also, when running ruby -d, I was wondering if those warnings could be > > eliminated? > > > > > > (eval):672: warning: `*' interpreted as argument prefix > > > (eval):700: warning: `*' interpreted as argument prefix > > > (eval):97: warning: already initialized constant C > > > (eval):99: warning: already initialized constant P > > > (eval):101: warning: already initialized constant H > > > (eval):132: warning: method redefined; discarding old method_missing > > > (eval):135: warning: discarding old u > > > (eval):208: warning: method redefined; discarding old R > > > (eval):233: warning: method redefined; discarding old errors_for > > > (eval):241: warning: method redefined; discarding old / > > > (eval):268: warning: method redefined; discarding old URL > > > (eval):312: warning: already initialized constant Z > > > (eval):339: warning: method redefined; discarding old method_missing > > > (eval):359: warning: method redefined; discarding old redirect > > > (eval):372: warning: method redefined; discarding old r > > > (eval):374: warning: method redefined; discarding old initialize > > > (eval):417: warning: method redefined; discarding old service > > > (eval):425: warning: method redefined; discarding old to_s > > > (eval):429: warning: method redefined; discarding old markaby > > > (eval):456: warning: method redefined; discarding old r > > > (eval):478: warning: method redefined; discarding old R > > > (eval):497: warning: method redefined; discarding old D > > > (eval):515: warning: method redefined; discarding old M > > > Exception `TypeError' at (eval):542 - superclass mismatch for class > > NotFound > > > Exception `TypeError' at > > /usr/rubyonrails/lib/ruby/gems/1.8/gems/camping-1.4.2 > > /lib/camping.rb:597 - (eval):542: superclass mismatch for class NotFound > > > Exception `TypeError' at > > /usr/rubyonrails//lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:143 > > - (eval):542: superclass mismatch for class NotFound > > > > > > > > > -- > > > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > > -lruby-static -ldl -lcrypt -lm -o ruby > > > Everyone is trying their hardest to do their job but management has set it > > up so that it's impossible. > > > Take the control over your money, track your expenses > > http://justbudget.com > > > > > > > > > Mathieu > > > > > > > > -- > > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > > -lruby-static -ldl -lcrypt -lm -o ruby > > Everyone is trying their hardest to do their job but management has set it > > up so that it's impossible. > > Take the control over your money, track your expenses http://justbudget.com > > > > Mathieu > > _______________________________________________ > > Camping-list mailing list > > Camping-list at rubyforge.org > > http://rubyforge.org/mailman/listinfo/camping-list > > > > > > > -- > Cheers, > zimbatm > > http://zimbatm.oree.ch > -- Cheers, zimbatm http://zimbatm.oree.ch From zimba.tm at gmail.com Tue Aug 1 07:26:55 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Tue, 1 Aug 2006 13:26:55 +0200 Subject: starting fresh In-Reply-To: <78181ce60608010029k3dc535aex87887d6e2dedaa11@mail.gmail.com> References: <78181ce60608010029k3dc535aex87887d6e2dedaa11@mail.gmail.com> Message-ID: <3ff63f9b0608010426h37cebfb4q96dc5d736eaef2df@mail.gmail.com> On 01/08/06, Mathieu Jobin wrote: > trying to get the example blog running under Apache/FastCGI with Camping > 1.4.143 Can you post your Apache configuration too ? I'll give it a try. -- Cheers, zimbatm http://zimbatm.oree.ch From zimba.tm at gmail.com Tue Aug 1 07:35:43 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Tue, 1 Aug 2006 13:35:43 +0200 Subject: starting fresh In-Reply-To: <3ff63f9b0608010426h37cebfb4q96dc5d736eaef2df@mail.gmail.com> References: <78181ce60608010029k3dc535aex87887d6e2dedaa11@mail.gmail.com> <3ff63f9b0608010426h37cebfb4q96dc5d736eaef2df@mail.gmail.com> Message-ID: <3ff63f9b0608010435s1bfff70eh2c64df11d9676989@mail.gmail.com> Also : server == 'Apache 1' or server == 'Apache 2' if server == 'Apache 2' fcgi == 'libapache2-mod-factcgi' or fcgi == 'libapache2-mod-fcgid' end On 01/08/06, Jonas Pfenniger wrote: > On 01/08/06, Mathieu Jobin wrote: > > trying to get the example blog running under Apache/FastCGI with Camping > > 1.4.143 > > Can you post your Apache configuration too ? I'll give it a try. > > -- > Cheers, > zimbatm > > http://zimbatm.oree.ch > -- Cheers, zimbatm http://zimbatm.oree.ch From mathieu at justbudget.com Tue Aug 1 19:54:47 2006 From: mathieu at justbudget.com (Mathieu Jobin) Date: Wed, 2 Aug 2006 08:54:47 +0900 Subject: starting fresh In-Reply-To: <3ff63f9b0608010435s1bfff70eh2c64df11d9676989@mail.gmail.com> References: <78181ce60608010029k3dc535aex87887d6e2dedaa11@mail.gmail.com> <3ff63f9b0608010426h37cebfb4q96dc5d736eaef2df@mail.gmail.com> <3ff63f9b0608010435s1bfff70eh2c64df11d9676989@mail.gmail.com> Message-ID: <78181ce60608011654t6f96e806hc36b4ef2417b598d@mail.gmail.com> Apache config is rather default. I'm running Apache 2.2 on one server and 1.3 on the other I'm using mod_fastcgi on both case, never heard of mod_fcgid before. but I see it as an available ports. I got everything to work fine on FreeBSD/Apache 2.2, but I had to modify camping code. I moved everything the other server RH/Apache 1.3, and everything crash the hell out. under CGI it worked not too bad. but its slow and we cannot use multipart/form-data on CGI. under FastCGI, I got all kind of error. but mostly crashing on this line. class NotFound < R() because R() always return a new Class instance and for some reason that code was executed more than once. about the config again, well. LoadModule fastcgi_module /usr/lib/apache/mod_fastcgi.so AddModule mod_fastcgi.c AddHandler cgi-script .cgi AddHandler fastcgi-script .fcgi AddHandler fastcgi-script .rb Options +FollowSymLinks +ExecCGI -Includes Order deny,allow Allow from all there is not much to configure, just enable fastcgi for the vhost. the idea of running a camping app under apache/fastcgi is that it does not require configuration. I just drop the file by FTP for example, et voila. thanks and good luck. On 8/1/06, Jonas Pfenniger wrote: > > Also : > > server == 'Apache 1' or server == 'Apache 2' > > if server == 'Apache 2' > fcgi == 'libapache2-mod-factcgi' or fcgi == 'libapache2-mod-fcgid' > end > > On 01/08/06, Jonas Pfenniger wrote: > > On 01/08/06, Mathieu Jobin wrote: > > > trying to get the example blog running under Apache/FastCGI with > Camping > > > 1.4.143 > > > > Can you post your Apache configuration too ? I'll give it a try. > > > > -- > > Cheers, > > zimbatm > > > > http://zimbatm.oree.ch > > > > > -- > Cheers, > zimbatm > > http://zimbatm.oree.ch > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it's impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060802/fcfd2b91/attachment.html From mathieu at justbudget.com Tue Aug 1 20:02:36 2006 From: mathieu at justbudget.com (Mathieu Jobin) Date: Wed, 2 Aug 2006 09:02:36 +0900 Subject: warning and errors In-Reply-To: <3ff63f9b0608010425y556673d7va4cd6b29a6539e0e@mail.gmail.com> References: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> <3ff63f9b0608010316m7026901fp3140b6d40b6cb47d@mail.gmail.com> <3ff63f9b0608010425y556673d7va4cd6b29a6539e0e@mail.gmail.com> Message-ID: <78181ce60608011702n9f67ba6ve9e5e3fb28c374ea@mail.gmail.com> the class NotFound < R() line is within Camping code itself, not my code. all the code is read twice,..... but why ? could not camping use Kernel#require instead of Kernel#load ? but anyway, camping code is also read twice, not only my code. so I really dont understand.... On 8/1/06, Jonas Pfenniger wrote: > > One possible solution is that your code is separated in more than one > file where some file requires your main camping file. > > Since the camping/reloader uses Kernel#load to load your apps and that > this method doesn't add the loaded file in the $LOADED_FEATURES array, > if you Kernel#require that same file, it will get loaded a second > time. Is it the case ? > > On 01/08/06, Jonas Pfenniger wrote: > > Opps didn't read that post. > > > > On 01/08/06, Mathieu Jobin wrote: > > > found this ... http://www.ruby-forum.com/topic/73894 > > > the problem seems to be with the fact camping code is re-read over and > over > > > again. > > > R() always returns a new Class > > > why is the code red multiple times? > > > > > > > > > On 8/1/06, Mathieu Jobin wrote: > > > > > > > > i got my app to run fine on one server, but I moved it to another > and huge > > > problem started.... > > > > I've been trying various things for 3 hours now, I can't get it to > > > work.... > > > > I am getting this error. > > > > Exception `TypeError' at (eval):542 - superclass mismatch for class > > > NotFound > > > > > > > > I am using the same camping.rb, apps starts in CGI but not in > > > Apache/FastCGI. > > > > while it works fine on my other server > > > > > > > > the only difference I can think of, its the apache version. but I > run > > > rails fastcgi on this same apache, so the apache version should not be > a > > > problem. > > > > > > > > anyone got that error before ? > > > > > > > > also, when running ruby -d, I was wondering if those warnings could > be > > > eliminated? > > > > > > > > (eval):672: warning: `*' interpreted as argument prefix > > > > (eval):700: warning: `*' interpreted as argument prefix > > > > (eval):97: warning: already initialized constant C > > > > (eval):99: warning: already initialized constant P > > > > (eval):101: warning: already initialized constant H > > > > (eval):132: warning: method redefined; discarding old method_missing > > > > (eval):135: warning: discarding old u > > > > (eval):208: warning: method redefined; discarding old R > > > > (eval):233: warning: method redefined; discarding old errors_for > > > > (eval):241: warning: method redefined; discarding old / > > > > (eval):268: warning: method redefined; discarding old URL > > > > (eval):312: warning: already initialized constant Z > > > > (eval):339: warning: method redefined; discarding old method_missing > > > > (eval):359: warning: method redefined; discarding old redirect > > > > (eval):372: warning: method redefined; discarding old r > > > > (eval):374: warning: method redefined; discarding old initialize > > > > (eval):417: warning: method redefined; discarding old service > > > > (eval):425: warning: method redefined; discarding old to_s > > > > (eval):429: warning: method redefined; discarding old markaby > > > > (eval):456: warning: method redefined; discarding old r > > > > (eval):478: warning: method redefined; discarding old R > > > > (eval):497: warning: method redefined; discarding old D > > > > (eval):515: warning: method redefined; discarding old M > > > > Exception `TypeError' at (eval):542 - superclass mismatch for class > > > NotFound > > > > Exception `TypeError' at > > > /usr/rubyonrails/lib/ruby/gems/1.8/gems/camping-1.4.2 > > > /lib/camping.rb:597 - (eval):542: superclass mismatch for class > NotFound > > > > Exception `TypeError' at > > > /usr/rubyonrails//lib/ruby/gems/1.8/gems/activesupport-1.3.1 > /lib/active_support/dependencies.rb:143 > > > - (eval):542: superclass mismatch for class NotFound > > > > > > > > > > > > -- > > > > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > > > -lruby-static -ldl -lcrypt -lm -o ruby > > > > Everyone is trying their hardest to do their job but management has > set it > > > up so that it's impossible. > > > > Take the control over your money, track your expenses > > > http://justbudget.com > > > > > > > > > > > > Mathieu > > > > > > > > > > > > -- > > > gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o > > > -lruby-static -ldl -lcrypt -lm -o ruby > > > Everyone is trying their hardest to do their job but management has > set it > > > up so that it's impossible. > > > Take the control over your money, track your expenses > http://justbudget.com > > > > > > Mathieu > > > _______________________________________________ > > > Camping-list mailing list > > > Camping-list at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/camping-list > > > > > > > > > > > > -- > > Cheers, > > zimbatm > > > > http://zimbatm.oree.ch > > > > > -- > Cheers, > zimbatm > > http://zimbatm.oree.ch > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it's impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060802/5a08d2c1/attachment-0001.html From mathieu at justbudget.com Wed Aug 2 04:30:26 2006 From: mathieu at justbudget.com (Mathieu Jobin) Date: Wed, 2 Aug 2006 17:30:26 +0900 Subject: mongrel experience.... Message-ID: <78181ce60608020130o3280a0f8t35aba72ad3f10eee@mail.gmail.com> well, I like it ;) until camping supports Apache/FastCGI properly I'm running the app with a mongrel postamble (default on the blog example) and I'm rerouting Apache using a ProxyPass, works like a charm. two comments though I first try to run it using 'camping app.rb' but it would always mount under / it would be awesome If I could do 'camping --mount /app app.rb' thanks for that. and the postamble, while it works well, it does not reread the code like the other methods and CTRL-C takes either a while to stop the server or just does not work. I have to kill the process every time I edit the code. not fun. thanks -- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it's impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060802/757590b5/attachment.html From zimba.tm at gmail.com Wed Aug 2 08:35:48 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Wed, 2 Aug 2006 14:35:48 +0200 Subject: warning and errors In-Reply-To: <78181ce60608011702n9f67ba6ve9e5e3fb28c374ea@mail.gmail.com> References: <78181ce60607312233p62ed4212x45481844ad3a56ac@mail.gmail.com> <78181ce60607312339y6e557646h7e15f952f9100bf4@mail.gmail.com> <3ff63f9b0608010316m7026901fp3140b6d40b6cb47d@mail.gmail.com> <3ff63f9b0608010425y556673d7va4cd6b29a6539e0e@mail.gmail.com> <78181ce60608011702n9f67ba6ve9e5e3fb28c374ea@mail.gmail.com> Message-ID: <3ff63f9b0608020535t3227d5b0g12681228e3d50a93@mail.gmail.com> On 02/08/06, Mathieu Jobin wrote: > the class NotFound < R() line is within Camping code itself, not my code. > all the code is read twice,..... but why ? When you call Camping.goes, Camping eval's it's own code by replacing "module Camping" with "module YourApp". So it doesn't mean that camping is reloaded. > could not camping use Kernel#require instead of Kernel#load ? Well. You can't require an application twice, thus reloading wouldn't work. (Unless you remove that app from the $LOADED_FEATURES array). Furthermore, since Ruby doesn't know the absolute path of the loaded files, you can't garantee that the file won't be loaded twice. > but anyway, camping code is also read twice, not only my code. > so I really dont understand.... See my answer before :-) -- Cheers, zimbatm http://zimbatm.oree.ch From why at whytheluckystiff.net Sun Aug 13 02:21:54 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Sun, 13 Aug 2006 01:21:54 -0500 Subject: + migrations in camping Message-ID: <20060813062154.GS94410@lstsv-3264.layeredtech.com> Camping apps are supposed to be little independent apps, often contained in a single file, which create the database tables and manage them without hassle. These days it's common to see in a Camping app: module Tepee::Models def self.schema(&block) @@schema = block if block_given? @@schema end end Tepee::Models.schema do create_table :tepee_pages, :force => true do |t| t.column :title, :string, :limit => 255 t.column :body, :text end Tepee::Models::Page.create_versioned_table end The `schema` block describes how to create the tables that Tepee needs. Yeah, this is in the Tepee sample wiki that comes with Camping. ActiveRecord is used to create the tables, it runs once and it's done. But what happens if the next version of Tepee adds a field? Well, you write some code to sniff out that field in the database, right? == V and Its Float == Here's how I could rewrite Tepee to use the V class: module Tepee::Models class CreatePages < V 1.0 def self.up create_table :tepee_pages, :force => true do |t| t.column :title, :string, :limit => 255 t.column :body, :text end Tepee::Models::Page.create_versioned_table end def self.down drop_table :tepee_pages Tepee::Models::Page.drop_versioned_table end end end This is only a very light bit of syntax on top of what ActiveRecord already does. If you're not familiar with the up/down methods and how migrations work, I'd look into the AR docs[1]. Basically, this class is identifying itself as version 1.0 of the schema. The app starts out at 0.0, so the first time you run your app, it'll `up`grade to 1.0. A `schema_info` table is created for each app, containing a single row with the latest version number in it. Oh, one other thing: def Tepee.create Tepee::Models.create_schema end Now the `create_schema` method will update the database when the app is loaded. So stick it in your app's `create` method[2]. As you're developing, you can add new migration classes, save the file, refresh the page in your browser, and when The Camping Server reloads your app, it'll update the database. _why [1] http://railsmanual.com/class/ActiveRecord%3A%3AMigration [2] http://code.whytheluckystiff.net/camping/wiki/GiveUsTheCreateMethod From chris at ozmm.org Sun Aug 13 16:53:57 2006 From: chris at ozmm.org (Chris Wanstrath) Date: Sun, 13 Aug 2006 13:53:57 -0700 Subject: + migrations in camping In-Reply-To: <20060813062154.GS94410@lstsv-3264.layeredtech.com> References: <20060813062154.GS94410@lstsv-3264.layeredtech.com> Message-ID: <634E01A7-7260-4803-8B2E-9A35364EA172@ozmm.org> On Aug 12, 2006, at 11:21 PM, why the lucky stiff wrote: > Here's how I could rewrite Tepee to use the V class: This would be great, please do. I've been playing with Dr. Nic's Magic Models in Camping and so far the only messy part is unless Blog::Models::Post.table_exists? ActiveRecord::Schema.define(&Blog::Models.schema) end The Magic Models code creates models on ze fly based on the schema. In the Camping blog example, the schema is created if a model's table doesn't exist. Catch-22. Migrations would solve this problem way more elegantly than I did. I'd also propose that adding migrations to Camping brings it one step closer to enterprise adoption. -- Chris Wanstrath http://errtheblog.com From mike.pence at gmail.com Sun Aug 13 18:08:39 2006 From: mike.pence at gmail.com (Mike Pence) Date: Sun, 13 Aug 2006 18:08:39 -0400 Subject: + migrations in camping In-Reply-To: <634E01A7-7260-4803-8B2E-9A35364EA172@ozmm.org> References: <20060813062154.GS94410@lstsv-3264.layeredtech.com> <634E01A7-7260-4803-8B2E-9A35364EA172@ozmm.org> Message-ID: On 8/13/06, Chris Wanstrath wrote: > I'd also propose that adding migrations to Camping brings it one step > closer to enterprise adoption. Perish. The. Thought. From why at whytheluckystiff.net Mon Aug 14 11:44:42 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Mon, 14 Aug 2006 10:44:42 -0500 Subject: + migrations in camping In-Reply-To: <634E01A7-7260-4803-8B2E-9A35364EA172@ozmm.org> References: <20060813062154.GS94410@lstsv-3264.layeredtech.com> <634E01A7-7260-4803-8B2E-9A35364EA172@ozmm.org> Message-ID: <20060814154441.GV94410@lstsv-3264.layeredtech.com> On Sun, Aug 13, 2006 at 01:53:57PM -0700, Chris Wanstrath wrote: > The Magic Models code creates models on ze fly based on the schema. > In the Camping blog example, the schema is created if a model's table > doesn't exist. Catch-22. Migrations would solve this problem way > more elegantly than I did. There, the migrations stuff is checked into SVN trunk. > I'd also propose that adding migrations to Camping brings it one step > closer to enterprise adoption. LOL!! _why From boss at topfunky.com Mon Aug 14 12:15:17 2006 From: boss at topfunky.com (Geoffrey Grosenbach) Date: Mon, 14 Aug 2006 09:15:17 -0700 Subject: OT: London Conference Message-ID: <4309B602-91B8-481A-8B4B-BF1FDEA0BA9E@topfunky.com> I just noticed that our fearless park ranger is listed as a presenter at RailsConf Europe in London: http://europe.railsconf.org/articles/2006/05/03/announcing-railsconf- europe Are there any Londoners on this mailing list? Maybe we can get together and have a mini camp-out at lunch or something. Geoff boss at topfunky.com From chris at ozmm.org Tue Aug 15 01:00:54 2006 From: chris at ozmm.org (Chris Wanstrath) Date: Mon, 14 Aug 2006 22:00:54 -0700 Subject: Camping with Dr. Nic Message-ID: <2ECDFE53-40EB-443B-B0B7-9B9A879090F8@ozmm.org> Campers. Dr. Nic. The new migrations in Camping's trunk are very nice. They also open the door (just an inch) to using Dr. Nic's Magic Models with Camping. Here's my stab at 'er: http://require.errtheblog.com/camping/blog.rb Run that against Camping trunk. Don't forget to `sudo gem install dr_nic_magic_models`. The hackery is in Blog.create. Have to dance around Camping's meta- ness and table prefix stuff. Anyone have a better / easier way of doing this? I tried a few different approaches but kept coming back to this one -- the brute force. Either way, it works. Maybe this is a candidate for Equipment, Jonas? Enjoy. -- Chris Wanstrath http://errtheblog.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060814/1eac798d/attachment.html From why at whytheluckystiff.net Tue Aug 15 03:08:20 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Tue, 15 Aug 2006 02:08:20 -0500 Subject: Camping with Dr. Nic In-Reply-To: <2ECDFE53-40EB-443B-B0B7-9B9A879090F8@ozmm.org> References: <2ECDFE53-40EB-443B-B0B7-9B9A879090F8@ozmm.org> Message-ID: <20060815070819.GX94410@lstsv-3264.layeredtech.com> On Mon, Aug 14, 2006 at 10:00:54PM -0700, Chris Wanstrath wrote: > The hackery is in Blog.create. Have to dance around Camping's meta- > ness and table prefix stuff. Anyone have a better / easier way of > doing this? I tried a few different approaches but kept coming back > to this one -- the brute force. Actually, this would be nice to have around in camping/db.rb. if Object.const_defined? DrNicMagicModels DrNicMagicModels::Schema.module_eval <<-LOAD def self.load_schema if conn = ActiveRecord::Base.connection @@models = DrNicMagicModels::ModelHash.new @@models.merge! conn.tables.inject({}) {|model_list,table_name| model_list[ActiveRecord::Base.class_name(table_name.split('_')[1..-1]*'_')] = table_name; model_list} end end LOAD end Play with it for another week and let's see if it holds up. If it's just 12 lines, then yeah. _why From why at whytheluckystiff.net Sat Aug 19 19:47:40 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Sat, 19 Aug 2006 18:47:40 -0500 Subject: ! camping 1.4.149 + markaby 0.4.74 gems Message-ID: <20060819234740.GP94410@lstsv-3264.layeredtech.com> The Camping 1.4.149 development gems is out. Really, the only update is the migrations stuff. (Camping::Models::V class.) The Markaby 0.4.74 is the merging of the xhtml-careful and trunk. If you've been using development gems for the past few months, this won't be much of a change for you. If you've been using trunk, it's a big change, I'll have a howto up soon. _why From why at whytheluckystiff.net Sat Aug 19 19:55:34 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Sat, 19 Aug 2006 18:55:34 -0500 Subject: Gems listed on the feeds Message-ID: <20060819235534.GQ94410@lstsv-3264.layeredtech.com> Oh, by the way, gem announcements are now listed on the feeds. So, if you want to follow camping development and get feed announcements as well, the feed for you is: Or if you want all checkins and gem releases for the entire repo: Every project in the repository has a feed, so it's pretty easy to figure what you're looking for. However, tickets and wiki changes are to be had through the Trac feeds. Okay, that's all. _why From tieg.zaharia at gmail.com Thu Aug 24 18:23:30 2006 From: tieg.zaharia at gmail.com (Tieg Zaharia) Date: Thu, 24 Aug 2006 16:23:30 -0600 Subject: Mousehole stuff Message-ID: <156c5bc40608241523i6f7992bexf63aa95722b4a5c0@mail.gmail.com> Hey everyone, I'm using mousehole for the first time today (love the artwork, btw) and I seem to be having problems with Camping and Markaby. When I go to the Apps page I get: Camping Problem! MouseHole::Controllers::RApps.GET TypeError /Users/tzaharia/Sites/mouseHole/lib/mouseHole/views.rb:78:in `+': can't convert String into Array:bla bla bla... The line in question refers to a span() call and when I take it out this view works correctly; the same thing happens on the Data view with the same span() method. I have the latest markaby and camping gems so I don't know why I'm getting this error, or if it's documented and has happened to others. I'm working off of trunk, revision 74. Also, this is a dumb quesiton, but where do you put scripts in mousehole? I noticed the three scripts in /samples weren't listed in apps. Also, if anyone knows of another way to setup a really simple proxy that can proxy https pages, I would be grateful to know how (as far as I know you can't do this with webrick http proxy), tieg -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060824/5e24b359/attachment.html From somekool at gmail.com Thu Aug 24 21:09:08 2006 From: somekool at gmail.com (Mathieu Jobin) Date: Fri, 25 Aug 2006 10:09:08 +0900 Subject: Mousehole stuff In-Reply-To: <156c5bc40608241523i6f7992bexf63aa95722b4a5c0@mail.gmail.com> References: <156c5bc40608241523i6f7992bexf63aa95722b4a5c0@mail.gmail.com> Message-ID: <78181ce60608241809j36ec9ba3u4634fa89512fc07b@mail.gmail.com> and what is mouseHole exactly ? I found that http://rubyforge.org/pipermail/mousehole-scripters/2006-May/000213.html but no webpages whatsoever. regards On 8/25/06, Tieg Zaharia wrote: > > Hey everyone, > > I'm using mousehole for the first time today (love the artwork, btw) and I > seem to be having problems with Camping and Markaby. When I go to the Apps > page I get: > > Camping Problem! MouseHole::Controllers::RApps.GET TypeError > /Users/tzaharia/Sites/mouseHole/lib/mouseHole/views.rb:78:in `+': can't > convert String into Array:bla bla bla... > > The line in question refers to a span() call and when I take it out this > view works correctly; the same thing happens on the Data view with the same > span() method. I have the latest markaby and camping gems so I don't know > why I'm getting this error, or if it's documented and has happened to > others. I'm working off of trunk, revision 74. > > Also, this is a dumb quesiton, but where do you put scripts in mousehole? > I noticed the three scripts in /samples weren't listed in apps. > > Also, if anyone knows of another way to setup a really simple proxy that > can proxy https pages, I would be grateful to know how (as far as I know you > can't do this with webrick http proxy), > > tieg > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > -- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it's impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060825/4db84d6d/attachment.html From why at whytheluckystiff.net Thu Aug 24 22:47:03 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Thu, 24 Aug 2006 21:47:03 -0500 Subject: Mousehole stuff In-Reply-To: <156c5bc40608241523i6f7992bexf63aa95722b4a5c0@mail.gmail.com> References: <156c5bc40608241523i6f7992bexf63aa95722b4a5c0@mail.gmail.com> Message-ID: <20060825024703.GA75627@lstsv-3264.layeredtech.com> On Thu, Aug 24, 2006 at 04:23:30PM -0600, Tieg Zaharia wrote: > I'm using mousehole for the first time today (love the artwork, btw) and I > seem to be having problems with Camping and Markaby. When I go to the Apps > page I get: Heya, welcome to you, Tieg Z. There's a whole separate mousehole list over here: For interested parties, MouseHole is Camping + Mongrel + Hpricot, all inside a web proxy. So you can do Greasemonkey-like thing with your Camping apps. > Camping Problem! MouseHole::Controllers::RApps.GET TypeError > /Users/tzaharia/Sites/mouseHole/lib/mouseHole/views.rb:78:in `+': can't > convert String into Array:bla bla bla... This indicates an old version of Markaby. Update both Camping and Markaby, if you will. gem install camping --source code.whytheluckystiff gem install markaby --source code.whytheluckystiff > Also, this is a dumb quesiton, but where do you put scripts in mousehole? I > noticed the three scripts in /samples weren't listed in apps. In ~/.mouseHole. MouseHole version 1 scripts won't work, so I'm attaching two examples of MouseHole 2 scripts. Also, Camping scripts will work as well. > Also, if anyone knows of another way to setup a really simple proxy that can > proxy https pages, I would be grateful to know how (as far as I know you > can't do this with webrick http proxy), You can do it with WEBrick or Mongrel. In fact, WEBrick has an http proxying class. I'm attaching the simple proxy I used as a basis of MouseHole on Mongrel. It's kind of hacky, but. _why -------------- next part -------------- require 'resolv-replace' require 'rubygems' require 'logger' require 'mongrel' require 'mongrel/camping' require 'mh2' # require 'net/http' # require 'net/httpio' module MouseHole class ProxyHandler < Mongrel::HttpHandler def initialize @logger = Logger.new STDOUT end def proxy_auth(req, res) if proc = @config[:ProxyAuthProc] proc.call(req, res) end req.header.delete("proxy-authorization") end # Some header fields shuold not be transfered. HopByHop = %w( connection keep-alive proxy-authenticate upgrade proxy-authorization te trailers transfer-encoding ) ShouldNotTransfer = %w( set-cookie proxy-connection ) def split_field(f) f ? f.split(/,\s+/).collect{|i| i.downcase } : [] end def choose_header(src, dst) connections = split_field(src['connection']) src.each{|key, value| key = key.downcase if HopByHop.member?(key) || # RFC2616: 13.5.1 connections.member?(key) || # RFC2616: 14.10 ShouldNotTransfer.member?(key) # pragmatics # @logger.debug("choose_header: `#{key}: #{value}'") next end dst[key.capitalize] = value } end # Net::HTTP is stupid about the multiple header fields. # Here is workaround: def set_cookie(src, dst) if str = src['set-cookie'] cookies = [] str.split(/,\s*/).each{|token| if /^[^=]+;/o =~ token cookies[-1] << ", " << token elsif /=/o =~ token cookies << token else cookies[-1] << ", " << token end } dst.cookies.replace(cookies) end end def set_via(h) # if @config[:ProxyVia] # if h['via'] # h['via'] << ", " << @via # else # h['via'] = @via # end # end end def proxy_uri(req, res) @config[:ProxyURI] end def process(request, response) proxy_host, proxy_port = *[] env = request.params.inject({}) do |hsh, (k, v)| hsh[k.downcase.gsub('_','-')] = v; hsh end path = env['path-info'].gsub("//#{env['server-name']}",'') header = {} choose_header(env, header) set_via(header) def response.send_status if not @status_sent @socket.write("HTTP/1.1 %d %s\r\n" % [status, Mongrel::HTTP_STATUS_CODES[@status]]) @status_sent = true end end begin @logger.debug("start HTTP: http:#{env['path-info']}") http = MH2::HTTP.new("http:#{env['path-info']}") http.headers = header http.request(env['request-method']) do |resin| choose_header(resin.headers, response.header) set_cookie(resin.headers, response.header) set_via(response.header) response.status = resin.status response.header['Proxy-connection'] = "close" response.header['Connection'] = "close" response.send_status response.send_header resin.read_body do |chunk| response.write(chunk) end end rescue => err @logger.debug("#{err.class}: #{err.message}; #{err.backtrace}") # raise Net::HTTPServiceUnavailable, err.message end @logger.debug("end HTTP: http:#{env['path-info']}") end end def self.serve # Use the Configurator as an example rather than Mongrel::Camping.start Mongrel::Const.const_set :REQUEST_PATH, "REQUEST_URI".freeze config = Mongrel::Configurator.new :host => "0.0.0.0" do listener :port => 3704 do uri "http:", :handler => ProxyHandler.new trap("INT") { stop } run end end config.join end end if __FILE__ == $0 MouseHole.serve end -------------- next part -------------- # Simple MouseHole 2.0 script, based on the Greasemonkey script # by Adam Vandenberg. His is GPL, so this is GPL. # class ComicAlt < MouseHole::App name "Comics Alt Text" namespace "http://adamv.com/greases/" description 'Shows the "hover text" for some comics on the page' + url("http://achewood.com/*") + url("http://*.achewood.com/*") + url("http://qwantz.com/*") + url("http://*.qwantz.com/*") + url("http://asofterworld.com/*") + url("http://*.asofterworld.com/*") + url("http://drmcninja.com/*") + url("http://www.wondermark.com/*") version "0.3" COMICS = { "achewood" => 'img[@src^="/comic.php?date="]', "qwantz" => 'img[@src^="http://www.qwantz.com/comics/"]', "asofterworld" => 'td/center/img', "drmcninja" => 'img[@src^="/issue"]', "wondermark" => 'img[@src^="/comics/"]' } # the pages flow through here def rewrite(page) whichSite, xpath = COMICS.detect do |key,| page.location.host.include? key end return unless whichSite comic = document/xpath return unless comic if comic.attributes['title'] div = Element.new 'div' div.attributes['className'] = 'msg' div.text = "(#{ comic.attributes['title'] })" comic.parent.insert_after comic, div end end end -------------- next part -------------- class LinkHints < MouseHole::App name 'Link Hints' namespace 'http://dysbiote.blogspot.com/mousehole' description "inserts the link's host name after each link" version '0.1' # very obnoxious on these sites - url(%r{^https?://www.google.com/}) # slightly less obnoxious everywhere else + url(%r{^https?://.+}) def absolute_href?(href) href && href.strip =~ %r{^(http:|https:|ftp:)//.+} end def rewrite(page) document.search('//a[@href]') do |link| href = URI(link.attributes['href']) rescue nil next unless href && href.host && href.host != page.location.host span = REXML::Element.new 'span' span.attributes['style'] = 'font-size:8px' span.text = "[#{href.host}]" link.parent.insert_after link, span end end end From tieg.zaharia at gmail.com Fri Aug 25 10:42:26 2006 From: tieg.zaharia at gmail.com (Tieg Zaharia) Date: Fri, 25 Aug 2006 08:42:26 -0600 Subject: Mousehole stuff In-Reply-To: <20060825024703.GA75627@lstsv-3264.layeredtech.com> References: <156c5bc40608241523i6f7992bexf63aa95722b4a5c0@mail.gmail.com> <20060825024703.GA75627@lstsv-3264.layeredtech.com> Message-ID: <156c5bc40608250742g15bd1fb4x4abf3cf0afb7f069@mail.gmail.com> Incredibleee. Thanks, why-- looks like I just wasn't getting the gems from your repository. I'll probably end up trying something with webrick/mongrel since this proxy has to be packaged up with a Rails app (we actually already have a proxy written that uses webrick, the trick is just to get it to handle SSL), but I'll play around with mouseHole more. Thankyee, tieg On 8/24/06, why the lucky stiff wrote: > > On Thu, Aug 24, 2006 at 04:23:30PM -0600, Tieg Zaharia wrote: > > I'm using mousehole for the first time today (love the artwork, btw) and > I > > seem to be having problems with Camping and Markaby. When I go to the > Apps > > page I get: > > Heya, welcome to you, Tieg Z. There's a whole separate mousehole list > over here: > > For interested parties, MouseHole is Camping + Mongrel + Hpricot, all > inside a > web proxy. So you can do Greasemonkey-like thing with your Camping apps. > > > > Camping Problem! MouseHole::Controllers::RApps.GET TypeError > > /Users/tzaharia/Sites/mouseHole/lib/mouseHole/views.rb:78:in `+': can't > > convert String into Array:bla bla bla... > > This indicates an old version of Markaby. Update both Camping and > Markaby, > if you will. > > gem install camping --source code.whytheluckystiff > gem install markaby --source code.whytheluckystiff > > > Also, this is a dumb quesiton, but where do you put scripts in > mousehole? I > > noticed the three scripts in /samples weren't listed in apps. > > In ~/.mouseHole. MouseHole version 1 scripts won't work, so I'm attaching > two > examples of MouseHole 2 scripts. Also, Camping scripts will work as well. > > > Also, if anyone knows of another way to setup a really simple proxy that > can > > proxy https pages, I would be grateful to know how (as far as I know you > > can't do this with webrick http proxy), > > You can do it with WEBrick or Mongrel. In fact, WEBrick has an http > proxying > class. I'm attaching the simple proxy I used as a basis of MouseHole on > Mongrel. It's kind of hacky, but. > > _why > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060825/1aa5ac95/attachment.html