Re: camping moved to github
2008/4/7 _why <[EMAIL PROTECTED]>: > In the better interest of helping all of you feel more welcome to > contribute. > > http://github.com/why/camping > I will probably close Trac and move to ditz for bug management, if > zimbatm doesn't mind at all. You can look at Shoes' bugs/ directory > for a sneak peek at how that all turns out. why not.. I don't really understand what makes github so special but git the RCS is quite nice. Concerning ditz, it makes sense to have bugs related to a particular version of a code. I'm not sure if I should expect camping users to understand git and ditz to report bugs, but why not ? -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Are we ready for a release ?
2008/3/12, Jonas Pfenniger <[EMAIL PROTECTED]>: > 2008/3/12, Paul van Tilburg <[EMAIL PROTECTED]>: > > By the way, do you/we have any release notes, or NEWS listing the new > > features? > The changes are only noted in the SVN actually. I'll scan trough it > when updating the doc. Actually, erm, it seems that I have updated the CHANGELOG in [237]. Some things might be missing although. -- Cheers, Jonas ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Are we ready for a release ?
2008/3/12, Paul van Tilburg <[EMAIL PROTECTED]>: > Hello all, > > On Wed, Mar 12, 2008 at 05:58:00PM +0100, Jonas Pfenniger wrote: > > what do you think of releasing the current trunk as camping-1.6 ? > > Nothing much has moved since a while and apart from FastCGI, I believe > > most bugs where ironed out. > > Yeah, I see in the roadmap that there are two bugs open (you mention > one here). Are these real blockers? It would be greate to have a relase. You're right. Actually the ESPIPE error (#130) is hard to solve. jsheets proposed to read the full upload in a StringIO. That idea clearly doesn't scale to big files. The ideal solution would be to rewrite that big chunk in #initialize to not use IO#revert but I never had the guts to do it. So while I could wait for somebody to do the work, I prefer to state that file uploads doesn't work in CGI instead of penalizing the other adapters. I clearly have to be documented somewhere at least. > > After the gem release, I propose putting some effort on documentation > > and how to use Rack's FastCGI. When that's done, we'll have a > > Rubyforge announcement and such. > > Don't forget the tarball release. ;) Noted > By the way, do you/we have any release notes, or NEWS listing the new > features? The changes are only noted in the SVN actually. I'll scan trough it when updating the doc. -- Cheers, Jonas ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Are we ready for a release ?
Hi campers, what do you think of releasing the current trunk as camping-1.6 ? Nothing much has moved since a while and apart from FastCGI, I believe most bugs where ironed out. After the gem release, I propose putting some effort on documentation and how to use Rack's FastCGI. When that's done, we'll have a Rubyforge announcement and such. /me is waiting for community input -- Cheers, Jonas ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: how to "encrypt" the password/login for the blog.rb example?
2008/2/25, Albert Ng <[EMAIL PROTECTED]>: > I'll keep that in mind. > > As an aside, using this gem, how would I go about changing the user without > closing the browser or raising «Unauthorized»? That last pops up a log-in > window that can't authorize (have to press escape). There is no perfect solution. Here is what I use in jQuery : // idea from : http://nanodocumet.homedns.org/rest/ $('#header A.disconnect').click(function() { try { if ($.browser.msie) { // IE clear HTTP Authentication document.execCommand("ClearAuthenticationCache"); } else { var xhr = new XMLHttpRequest(); xhr.open("GET", "/logout", true, "logout", "logout"); xhr.send(null); xhr.abort(); } } catch(e) { error(e) } }) - * the /logout url should respond "Unauthorized" for the logout:logout credential * the xhr.open is called with async to true, otherwise the browser shows the login window -- Cheers, Jonas ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping is a winner at SXSW-i
Brilliant ! -- Cheers, Jonas ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Keeping Camping going
2008/1/10, Jeremy McAnally <[EMAIL PROTECTED]>: > I'm not sure who Camping's steward is at this point(zimbatm? _why?), > but I haven't seen much activity in quite some time. I really like > Camping, and I understand open source projects can fall by the > wayside. Some times ago, I proposed to take the project a little further. Times passes so fast ! I managed to do some cleanup but then got stuck for some reasons. At last, you are welcome to kick in :) Why not start by fixing some open ticket ? I was thinking of dropping the fastcgi support but if you wish to make it work it would be a great start. Another part that could be fixed, is the Session support. Dig in the list archive for some discussions around it. Have fun, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: How many CRLFs between header and body?
Hey Brendan, thanks a lot for your insightful investigation. I've committed the fix [239], I hope it solves the problem now :) A propos FastCGI, I think that Camping should drop it's support. I don't know what other people think, but if you look at the bug tracker, most bugs are related to it. Since Rack has a camping handler, for those people who really need fastcgi, they could get it trough it. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: css image url's and :img problem
I know what I will say won't help you : FastCGI is a total waste of time. Apart if you're stucked with that setup, a reverse proxy of any kind does just fine and is much less hassle to maintain/operate. Contrary to FastCGI, HTTP is a well understood and supported protocol, with lots of different tools. I always use Nginx or Apache + Mongrels and it works fine. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: where do i get the return value of a javascipt method?
2007/11/21, Ronald Evangelista <[EMAIL PROTECTED]>: > how do i get the value of a javascipt confirm() function? > > a(:href=>R(DeleteUser, @user.id), :onclick => "javascript:confirm('You > sure about this?')"){label} Try adding the return statement, like "return confirm("sure ?")". But it is better to use a post method for destructive actions. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: css image url's and :img problem
Try this version : http://pastebin.com/m10c8fab0 -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: css image url's and :img problem
2007/11/20, pedro mg <[EMAIL PROTECTED]>: > But it doesnt render in the browser, reporting: > The image "http://localhost:3301/project/static/img01.png"; cannot be > displayed because it contains errors. > > Any hint ? Are you still running the same code ? I've spotted another error : more line 5 between 6 and 7. Otherwise, your 403 error won't have the right content-type. This is not the cause of your problem but it could help. Also, on what server are you running the code ? Mongrel ? And which version of camping are you using ? -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: css image url's and :img problem
2007/11/18, pedro mg <[EMAIL PROTECTED]>: > The class is here: http://pastebin.com/f7c92f95a Remove the quotes around the regexp on line 5. Right now the expression returns nil, which is not an entry in your MIME_TYPES hash. Apparently the browser can work around a nil mime-type for the .css but not for the pics. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: help on helper module inclusion/extension
The root of the problem is that a module doesn't propagate newly included methods on classes or modules where it's been alreay included. take : module A; def a; end; end module B; def b; end; end class C; end where A is included in B and B in C. Depending on the inclusion order, you won't get the same result. class C; include B; end module B; include A; end C.instance_methods #=> [... "b" ... ] now... module B; include A; end class C; include B; end C.instance_methods #=> [... "a", "b", ... ] end of explanation In Camping 1.5.180, you'll have to include your module in Helpers, Views and Mab. Due to some changes in Camping-trunk, you'll only have to include your module in Helpers and Views. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Will there be a new release soon?
Hi Daniel, 2007/10/24, Berger, Daniel <[EMAIL PROTECTED]>: > Is there going to be a 1.5.1 release anytime soon? Seems like there have > been enough changes in SVN to warrant one and I prefer to use only > "released" code in production. It gives me warmer, fuzzier feelings than > using svn/trunk. :) the svn trunk is near the release but still needs some work on the following areas : * better session handling * fastcgi fixes Look in the track for ticket, patches are welcome :) -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: textarea fails on rows attribute
Hi Daniel, Markaby throws an exception on malformed html entities to ensure valid HTML. The tag doesn't accept that "rows" attribute because it is not set in the standard (or am I wrong?). I don't remember where but I think that it is possible to disable those checks if you want but I thinkt that you're looking for the tag. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Weird application/x-www-form-urlencoded bug
2007/10/23, Simon Rozet <[EMAIL PROTECTED]>: > Hello, > > I experienced a weird bug today, while implementing an AtomPub server. > I pasted all the story and bug details here : http://p.caboo.se/110125 > > It maybe be related to http://code.whytheluckystiff.net/camping/ticket/142 ... > > I am using > - mongrel 1.0.1 > - camping 1.5 Hi Simon, can you try to reproduce your problem with the svn code ? -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Something is wrong with Camping::H in the svn version
Hi Nagy, you should drop your session table once. Camping::H now inherits from Hash but your sessions data still use HashWithIndifferentAccess. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Camping and sessions proposal.
Hi Campers, from the discussions gathered around, the current Camping sessions don't seem to be satisfying. ActiveRecord doesn't seem to handle hashid as an identifier, plus it doesn't seem to be fully consistent across the various RDBMS. On the other hand, the scope of the project does not permit to implement all kind of client persistence. Secure sessions with cross-process persistence is not that easy. You probably would like to link the sessions ids with the clients's IP or other kind of magic to make sure that XSS attacks are not possible. So here is what I propose : Camping will only provide an in-process session store with no real security built-in. See it as a hack-ready example that will allow you to make your internal apps work quickly (ak. no DB dependency). And for the more demanding, I hope that a parallel project can be started that provides more serious sessions (and other extensions?) handling. Ah, and I have attached a working example of how it would look like for peer-review. -- Cheers, zimbatm session.rb Description: Binary data ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session handling busted on Oracle
2007/10/8, Berger, Daniel <[EMAIL PROTECTED]>: > Was there something else I should have used? Well technically, the id field is not necessary anymore. I don't know how AR will react if it is set. Also, are you sure that you are using camping from trunk ? Btw, here is the schema I have on sqlite : CREATE TABLE sessions ("hashid" varchar(32) NOT NULL, "created_at" datetime DEFAULT NULL, "ivars" text DEFAULT NULL); -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session handling busted on Oracle
Weird, the ivars field should have been defined in the "generate" function. Did you drop the session schema on beforehand ? -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Cookie session handling?
2007/10/5, why the lucky stiff <[EMAIL PROTECTED]>: > On Fri, Oct 05, 2007 at 06:08:12PM +0200, Jonas Pfenniger wrote: > > I like the idea pretty much. What do you think of simply using a > > Camping::H that is process-persistent ? > > Sure, and maybe it doesn't really need to be process-persistent. How can it be less than process-persistent ? Instance persistent ? Or is it irony and it means not persistent at all ? :p -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Cookie session handling?
Hi Daniel, I like the idea pretty much. What do you think of simply using a Camping::H that is process-persistent ? -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session handling busted on Oracle
Hi Daniel, I think that I have corrected that last week changeset [226]. The problem was that Session uses it's own kind of id (hashid) and that by default, ActiveRecord uses an incremental version. See : http://code.whytheluckystiff.net/camping/changeset/226 Please tell me if I introduced any regression. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: PUT (and friends) bug?
Okay, I'll remove the test then. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: putting away HashWithIndifferentAccess
2007/9/27, why the lucky stiff <[EMAIL PROTECTED]>: > Well, case-sensitiveness would be a prob with 1.5 as well. Since > @env.HTTP_HOST will work and @env.http_host will not. True. So what do you think of the attached patch ? It removes roughly 50 octets to camping.rb and seems to work pretty well, except for apps that used :symbols to access H members. -- Cheers, zimbatm Index: lib/camping.rb === --- lib/camping.rb (revision 232) +++ lib/camping.rb (working copy) @@ -1,7 +1,7 @@ -%w[active_support markaby tempfile uri].map{|l|require l};module Camping;C=self -S=IO.read(__FILE__)rescue nil;P="Cam\ping Problem!";H=HashWithIndifferentAccess -class H;def method_missing m,*a;m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m]:super -end;alias u regular_update;end;module Helpers def R c,*g;p,h=/\(.+?\)/,g. +%w[markaby tempfile uri].map{|l|require l};module Camping;C=self +S=IO.read(__FILE__)rescue nil;P="Cam\ping Problem!";class Hhttp://rubyforge.org/projects/mongrel Mongrel comes with examples # in its examples/camping directory. # -%w[active_support markaby tempfile uri].map { |l| require l } +%w[markaby tempfile uri].map { |l| require l } # == Camping # @@ -85,8 +85,7 @@ C = self S = IO.read(__FILE__) rescue nil P = "Cam\ping Problem!" - H = HashWithIndifferentAccess - # An object-like Hash, based on ActiveSupport's HashWithIndifferentAccess. + # An object-like Hash. # All Camping query string and cookie variables are loaded as this. # # To access the query string, for instance, use the @input variable. @@ -109,7 +108,7 @@ # # Use the @cookies variable in the same fashion to access cookie variables. # Also, the @env variable is an H containing the HTTP headers and server info. - class H + class H < Hash # Gets or sets keys in the hash. # # @cookies.my_favorite = :macadamian @@ -117,9 +116,9 @@ # => :macadamian # def method_missing(m,*a) -m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m]:super +m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super end -alias u regular_update +alias u merge! end # Helpers contains methods available in your controllers and views. You may add @@ -368,12 +367,12 @@ when /^Content-D.+?: form-data;/ fh.u H[*$'.scan(/(?:\s(\w+)="([^"]+)")/).flatten] when /^Content-Type: (.+?)(\r$|\Z)/m - fh[:type] = $1 + fh.type = $1 end end - fn=fh[:name] - o=if fh[:filename] -o=fh[:tempfile]=Tempfile.new(:C) + fn=fh.name + o=if fh.filename +o=fh.tempfile=Tempfile.new(:C) o.binmode else fh="" @@ -391,7 +390,7 @@ [EMAIL PROTECTED](s) end C.qsp(fn,'&;',fh,q) if fn - fh[:tempfile].rewind if fh.is_a?H + fh.tempfile.rewind if fh.is_a?H end elsif @method == "post" and e.CONTENT_TYPE == "application/x-www-form-urlencoded" q.u(C.qsp(@in.read)) @@ -673,7 +672,7 @@ # Blog.post(:Login, :input => {'username' => 'admin', 'password' => 'camping'}) # #=> # # -# Blog.get(:Info, :env => {:HTTP_HOST => 'wagon'}) +# Blog.get(:Info, :env => {'HTTP_HOST' => 'wagon'}) # #=> #'wagon'} ...> # def method_missing(m, c, *a) ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: PUT (and friends) bug?
2007/9/28, Nathaniel Talbott <[EMAIL PROTECTED]>: > As far as I can tell, sending an actual HTTP PUT request to a Camping > app will never parse the params out of the request body - or am I > going nuts? No you aren't at all. Actually, Camping is only a toy to quickly hack small apps together. I am highly skeptical that we'll never be able to implement the 397K of the HTTP1.1 rfc into it's 4K limitation but I would be happy if somebody does it :) In the mean time, it doesn't mean that it can't provide some facilities for extension. Actually, the initialize method is the biggest method in Camping and I remember _why talking about splitting it up. Concerning the PUT method, the rfc starts it's description with the following terms : "The PUT method requests that the enclosed entity be stored under the supplied Request-URI." (sec9.6). As I understand it, it is intended to store files under a specific URL, but who knows what an "entity" exactly is ? If I am right, a form is not really a file since it's entries order are not strictly defined. At least, it rapidly becomes complex because the RFC doesn't specifies a strict list of accepted verbs. From the standard ones, OPTION, GET, HEAD and TRACE should be "safe" and thus not accepting "post" data I guess and DELETE makes no sense with an entity attached but I didn't find any MUST or SHOULD attached to that assertion. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping and ruby2ruby
2007/9/28, MenTaLguY <[EMAIL PROTECTED]>: > Perhaps "condensing" ? Yes, with a little touch of artistic sense added :) Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: FastCGI in Shared Hosting - What To Do?
2007/9/28, Matthew Snyder <[EMAIL PROTECTED]>: > Running 'ruby beta.rb' produces no output and goes straight back to a > prompt. Running 'ruby dispatch.fcgi' produces no output, and when I > hit enter, I'm returned to a prompt. > This is the only thing I get in my error logs: > [Thu Sep 27 21:35:48 2007] [warn] FastCGI: (dynamic) server "/home/ > ardekant/public_html/beta/dispatch.fcgi" has failed to remain running > for 30 seconds given 3 attempts, its restart interval has been backed > off to 600 seconds Hmm.. try something like this to get more output : #!/usr/bin/ruby begin require 'rubygems' require 'camping/fastcgi' Camping::FastCGI.start('~/www/beta/beta.rb') rescue Object => ex File.open('err.log','w'){|f| f.write(ex.inspect); f.write(ex.backtrace.join("\n")} end > By not using the rewrite engine, do you mean just remove my .htaccess > while I test? What would I put in as a web address if that were the > case? Right now http://beta.ardekantur.com points to that beta/ > directory where the Camping app, .htaccess, and dispatch are. Yes, if I am right you can access it trough http://beta.ardekantur.com/dispatch.fcgi -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping and ruby2ruby
2007/9/28, Gregor Schmidt <[EMAIL PROTECTED]>: > For a none native speaker. Could you give a synonym for "platterize". Sorry, from a non native speaker too. The term was probably badly chosen. I was referring to the action that consist of taking camping-unabridged.rb and create a "platter?" out of it. It is a reference to the visual output that camping.rb gives. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping and ruby2ruby
2007/9/28, Gregor Schmidt <[EMAIL PROTECTED]>: > I was "insulting" ruby2ruby and not camping. So everthing is okay on this > side. No problem. You can insult Camping if you want, if at least I get understood. Joking aside, it's true that ruby2ruby still lacks some maturity but it is an interesting project nonetheless. I have big hopes that one day is will be usable to "platterize" camping.rb -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: FastCGI in Shared Hosting - What To Do?
Hi Matthew, your setup looks fine but FastCGI is vicious, so don't abandon yet ! I loathe fastcgi but I hope that this e-mail will help you a little bit. Your ruby script looks fine but if you have an SSH access, you could try to run it by hand. The expected result, is no output at all. If it does, report back here. Terminate the app with Ctrl-C. The second thing is that we must make sure that apache is configured properly. You can find some inspiration here : http://wiki.rubyonrails.org/rails/pages/HowtoSetupApacheWithFastCGIAndRubyBindings >From the same page, it is said that it is better to use mod_fcgid instead of mod_fastcgi because it is outdated. It would also probably help if you could provide some apache error logs. Finally, the rewrite engine is vicious too, in it's own way. So it's probably better to deactivate it until the rest is working. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping and ruby2ruby
2007/9/27, Gregor Schmidt <[EMAIL PROTECTED]>: > Defining NilClass#method_missing for nothing is not too clever, for a > large scale libary IMO. I'm not sure you understood, it is ruby2ruby who defined nil.method_missing. We can't start to support each and every hack a library will add to the Ruby core. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping and ruby2ruby
Hi Gregor, I wasn't able to track the error on Camping side, but it comes from r2r that defines nil.error_missing. 2007/9/27, Gregor Schmidt <[EMAIL PROTECTED]>: > require "rubygems" > require "ruby2ruby" # It works in this case but probably breaks r2r on a larger scale. class NilClass undef method_missing end > Camping.goes :Test > > module Test > module Controllers > class Index < R '/' > def get > div.literate_programming! do > example { 1 + 1 == 2 } > end > end > end > end > > module Helpers > def example(&block) > pre( block.to_ruby.gsub(/^proc \{\n(.*)\n\}$/m, '\1')) > end > end > end > I don't know where the :href attribute comes from and I don't know, > why it only appears within camping and not in markaby itself. Camping overrides [:href,:action,:src] to translate relative links to absolute ones. See Mab at the end of camping-unabridged. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: WEBrick Re: Next camping release
2007/9/27, Ernest Prabhakar <[EMAIL PROTECTED]>: > I was looking at the test cases on the changeset: > > http://code.whytheluckystiff.net/camping/browser/trunk/test?rev=227 > > However, I didn't see anything about testing with different web > browsers; which is a concern since there was a nasty WEBrick bug in > the last version. Is there test coverage for that? Hi Ernie, I didn't get into testing the various web servers yet. Ref 277 is the base to do that, since those apps can be tested against the various web servers. I know there are some issues with FastCGI too so I'll have to get into it anyways. > P.S. I mean to file the bug, but got into a fight with the trac > system. ;-( You need a http://rubyforge.org/ account, which you can then reuse here : http://code.whytheluckystiff.net/access/ Once you are registered, you can log into the various Trac applications. File upload doesn't work tough. Anyways, you can still describe your bug on the list and I'll see what to do. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: putting away HashWithIndifferentAccess
Minimal HWIA removal patch attached. So far, the examples, file upload, sessions, all work under mongrel with the patch applied. _why, is it something like that that you want ? I'm not even sure if HWIA extension is useful. The method_missing shortcut is even shorter than the one with :symbols. -- Cheers, zimbatm Index: lib/camping-unabridged.rb === --- lib/camping-unabridged.rb (revision 226) +++ lib/camping-unabridged.rb (working copy) @@ -28,8 +28,14 @@ # http://rubyforge.org/projects/mongrel Mongrel comes with examples # in its examples/camping directory. # -%w[active_support markaby tempfile uri].map { |l| require l } +%w[markaby tempfile uri].map { |l| require l } +class Object + def meta_def(m,&b) +(class<@input variable. @@ -109,7 +114,7 @@ # # Use the @cookies variable in the same fashion to access cookie variables. # Also, the @env variable is an H containing the HTTP headers and server info. - class H + class H < Hash # Gets or sets keys in the hash. # # @cookies.my_favorite = :macadamian @@ -117,9 +122,9 @@ # => :macadamian # def method_missing(m,*a) -m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m]:super +m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super end -alias u regular_update +alias u merge! end # Helpers contains methods available in your controllers and views. You may add @@ -369,12 +374,12 @@ when /^Content-D.+?: form-data;/ fh.u H[*$'.scan(/(?:\s(\w+)="([^"]+)")/).flatten] when /^Content-Type: (.+?)(\r$|\Z)/m - fh[:type] = $1 + fh.type = $1 end end - fn=fh[:name] - o=if fh[:filename] -o=fh[:tempfile]=Tempfile.new(:C) + fn=fh.name + o=if fh.filename +o=fh.tempfile=Tempfile.new(:C) o.binmode else fh="" @@ -392,7 +397,7 @@ [EMAIL PROTECTED](s) end C.qsp(fn,'&;',fh,q) if fn - fh[:tempfile].rewind if fh.is_a?H + fh.tempfile.rewind if fh.is_a?H end elsif @method == "post" and e.CONTENT_TYPE == "application/x-www-form-urlencoded" q.u(C.qsp(@in.read)) @@ -673,7 +678,7 @@ # Blog.post(:Login, :input => {'username' => 'admin', 'password' => 'camping'}) # #=> # # -# Blog.get(:Info, :env => {:HTTP_HOST => 'wagon'}) +# Blog.get(:Info, :env => {'HTTP_HOST' => 'wagon'}) # #=> #'wagon'} ...> # def method_missing(m, c, *a) ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session cookies not passed on first redirect
2007/9/26, Julian 'Julik' Tarkhanov <[EMAIL PROTECTED]>: > pretty fast depending on the conditions. > True, didnt think about that in this sense. Well let's carry on then :-)-1 > for my netaness and I set out on the test corpus this weekend > this kind of stuff is something we _really_ should have known before Well, I don't use sessions so I don't care :-p -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session cookies not passed on first redirect
2007/9/26, Julian 'Julik' Tarkhanov <[EMAIL PROTECTED]>: > Coolio! You can optionally try my patch for session.rb because it makes them > neater and does not do bypasses. I am not really confident with the eternally growing id. I guess it depends on the database, but a 65535 items limit can be obtained pretty fast depending on the conditions. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: putting away HashWithIndifferentAccess
2007/9/26, why the lucky stiff <[EMAIL PROTECTED]>: > Hey, campineros. And many good handshakes to zimbatm for getting > some patches applied. You're welcome ! > Markaby's going to take much more work. Part of the issue is: how > does an app tell Camping that it needs to use Markaby without > screwing up the other apps? My hunch is we'll use some eval'd code > to override render per-App like you see in camping/db.rb. Adding method_missing to the views would be enough to proxy the calls to Markaby. You'd still need to propagate the controller's instance variables to the view tough. One solution is to add the View into the controller. The disadvantages is that it greaten the chances of method clashes and that the distinction between Helper and Base module would be null. The advantage is that method_missing could be reused, like it is for the NotFound and ServerError classes. > And, well, as for ActiveSupport, Camping only uses the supra- > flexi-careless-hash, so we need a replacement. I suggest that H is a child of Hash. Extensions can extend it to provide method_missing goodness or anything else. The only concern I have is about case-sensitiveness. I am not sure if the http headers are normalized on input or not. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session cookies not passed on first redirect
Thanks Julian, the little app helped a lot. Check changeset [225]. http://code.whytheluckystiff.net/camping/changeset/225 -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session cookies not passed on first redirect
2007/9/25, Julian 'Julik' Tarkhanov <[EMAIL PROTECTED]>: > Cannot find the SVN URL on the site - only the trac is showing. `svn co http://code.whytheluckystiff.net/svn/camping/trunk` -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Session cookies not passed on first redirect
Hi Julian, can you try the attached patch applied to camping-trunk ? -- Cheers, zimbatm Index: lib/camping/session.rb === --- lib/camping/session.rb (revision 218) +++ lib/camping/session.rb (working copy) @@ -108,7 +108,8 @@ app = self.class.name.gsub(/^(\w+)::.+$/, '\1') @state = (session[app] ||= Camping::H[]) hash_before = Marshal.dump(@state).hash -s = super(*a) +return super(*a) +ensure if session hash_after = Marshal.dump(@state).hash unless hash_before == hash_after @@ -116,7 +117,6 @@ session.save end end -s end end end ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Next camping release
2007/9/25, Michael Maltese <[EMAIL PROTECTED]>: > That makes sense. > An extension, do you mean like camping/session? Yes, and the gem dependency would only be added to camping-omnibus. But first, let's release Camping 1.6 -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Next camping release
2007/9/25, Michael Maltese <[EMAIL PROTECTED]>: > Remove Markaby? How will that work? Only as a direct dependency. It will probably kept as an extension. Basically, you can return a string containing html from your controller methods even if it's a bit rough. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Next camping release
2007/9/24, andré gustavo cardozo <[EMAIL PROTECTED]>: > it would be really cool do remove the apache scriptAlias directive so > camping would run everywhere Sure, could you file a bug for this ? -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Next camping release
2007/9/23, Manfred Stienstra <[EMAIL PROTECTED]>: > > This will result in a short-term release with not too much changes, > > used for code stabilization. > > > > When this is done, I will embark on 2.0 for bigger changes like > > Markaby and AR removal. > > Cool, I'm currently trying to get my apps working with svn camping. I > think I've found a problem surrounding URL(). Jonas, can you try to > float around #camping to discuss any problems? I am not really an IRC user but I will try to. I'd really appreciate if every concerned person could follow the changesets and raise objection on the list. It is easy to follow if you use rss feeds : http://code.whytheluckystiff.net/camping/timeline?milestone=on&ticket=on&changeset=on&wiki=on&max=50&daysback=90&format=rss -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Next camping release
Dear camping users, having been contacted by Julian Tarkhanov, I am willing to prepare the next camping release. _why has given me his friendly approval, with the reserve that camping.rb should be lower than 4k. He also told me that he wanted to remove the ActiveSupport and Markaby dependencies. I am writing here to get the users input so that I don't do any mistake. So far, my plans are to : - solve all remaining bugs in the tracker - remove the unused #errors_for method. Please give some input if you do ! - add some unit-tests. This will result in a short-term release with not too much changes, used for code stabilization. When this is done, I will embark on 2.0 for bigger changes like Markaby and AR removal. Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping and Threads!
2007/5/10, Ryan Allen <[EMAIL PROTECTED]>: > Hey Everybody! > > I was wondering if/how Camping can process more than one request at > once (i.e. not what Rails does). I'm fairly new to threads, and I > bought a book, and read some of it, and dived into the Camping source... > > I found some thread stuff but I'm not... entirely sure. So I thought > I would ask! Hi, Camping is green-thread-safe on the requests. At every requests, YourApp.run is called and an instance of your routed controller is created. You just need a web server that allows concurrency, like mongrel. Just don't use ActiveRecord for your data backend because I don't believe it's green-thread-safe. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Running something periodically.
2007/4/25, Jonathan Stott <[EMAIL PROTECTED]>: > Suppose, for a moment, that I have a Camping app. It looks at > something, like an RSS feed of upcoming events, and displays them if > they meet a specified criterion. I look at the index page, it fetches > the feed items and then displays them. Yay. Maybe it also writes them > to a database. > > Which is great, so long as I keep looking at the page every so often. > But what do I do while I'm sleeping? or on holiday? Who will look at > the page to fetch the feeds then? > > So, is there some way I can make Camping perform the fetch operation > regularly, all internal to Camping? I know I could set up a cron job > to grab the page via curl every hour or whatever, but can I do it just > in Camping? You can make use of the create method to initialize your thread. Just make sure that you store the thread's presence outside of the app's module to avoid problems when reloading.. module YourApp def self.create ::YOURAPP_FETCH_THREAD ||= Thread.new { ... } end end PS : I wouldn't use an external scheduler if the database is sqlite.. I had lots of problems with locking. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Gem broekn?
Try removing ~/.gem/source_cache first 2007/4/18, carmen <[EMAIL PROTECTED]>: > gem install --source http://code.whytheluckystiff.net camping > Need to update 3 gems from http://code.whytheluckystiff.net > ... > complete > ERROR: While executing gem ... (TypeError) > > > gem install camping-omnibus --source http://code.whytheluckystiff.net > Install required dependency camping? [Yn] y > ERROR: While executing gem ... (TypeError) > can't convert Hash into String > > ruby -v > ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux] > > /me scurries off to manually check out > ___ > Camping-list mailing list > Camping-list@rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: customizing global request handler
2007/4/18, Thomas Lockney <[EMAIL PROTECTED]>: > On 4/18/07, Jonas Pfenniger <[EMAIL PROTECTED]> wrote: > > Hi Carmen, > > > > to avoid patching Camping, I suggest you look into overriding the > > "service" method for the target controllers. You can do this in your > > main application module or by including a custom module in your > > controllers, as you prefer. Let me know if you need more hints. > > I was going to suggest the same thing, but when I looked at it, it wasn't > clear if this would allow for grabbing data like the request headers > (allowing you to determine what form the submitted data takes). Based on the > code Carmen posted, it looks like the idea is to be able to use the same > controllers whether the data comes in from regular requests or as JSON data. > Granted, that could still be done in the controllers, but it does end up > being a bit less elegant. Yes, Camping could probably benefit from some method splitting here. I feel like this method is too big and not really correct. I don't think that it should put the posted data in a Tempfile, especially if your controller will never make a use of it. I'm not sure it follows the RFC too. Btw I've spotted some debug line here that could be removed : http://code.whytheluckystiff.net/camping/browser/trunk/lib/camping-unabridged.rb#L402 -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: customizing global request handler
2007/4/18, carmen <[EMAIL PROTECTED]>: > what is the cleanest way to do something for every request of a particular > type (Verb, and Content-Type header)? i'm trying to figure out if shipping a > custom camping.rb is avoidable, and if, how i should structure a patch > > > my app http://whats-your.name/yard/ uses exclusively JSON based messaging > between server and client. this means POST bodies are JSON, and not > querystring.. camping assumes: > > elsif @method == "post" > qs.merge!(C.qsp(@in.read)) > > if i patch to: > > elsif @method == "post" > case e.CONTENT_TYPE > when "application/x-www-form-urlencoded" > qs.merge!(C.qsp(@in.read)) > when "application/json" > @input = JSON.parse(@in.read)) > end > > theres two probs, 1) you now have to always make sure you send the > x-www-form-urlencoded header (weird browsers, or XHR requests might not), 2) > @input is overwritten by qs.dup, input isnt a query string! > > i tried using a custom verb, which works fine in firefox, but not > WebKit-QT4-Linux.. RFC 2616 does not specify a format for the data in a POST > body, and the overall function of the request is consistent with POST. > > what do i do? :) Hi Carmen, to avoid patching Camping, I suggest you look into overriding the "service" method for the target controllers. You can do this in your main application module or by including a custom module in your controllers, as you prefer. Let me know if you need more hints. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: threading and concurrency
2007/3/15, Michael Gorsuch <[EMAIL PROTECTED]>: > carmen - I'm not sure _how_ much this will really help you, but I > recently explored a similar issue with an internal Camping app. > > In summary, I needed to make sure that all calls to a specific > controller were always executed serially. i.e. - if two calls came in > at approximately the same time, the second call could not run until > the first one finished. > > This was not a problem: I just included the 'thread' library and > wrapped the code in a synchronize block. The only requirement: I only > run a single mongrel instance. > > Simple code example follows: > > ** > > require 'thread' > > > class Create < R '/create' > def synchronize > mutex.synchronize {yield self} > end > > def mutex > @mutex ||= Mutex.new > end > > def get > synchronize do > # my code goes here... > end > end > end > > ** > > I hope this helps out some, > > Michael Gorsuch > http://www.styledbits.com > > > > On 3/12/07, carmen <[EMAIL PROTECTED]> wrote: > > hello all. ive come to the point where im thinking about deploying my > > 'rails on rails' app-development solution built in camping. > > > > mainly, im wondering what the barriers to thread-safety are. > > > > for db, i use redland, and afaik it spawns a single db connection for each > > find, and keeps a pool around to reuse. iow, no ActiveRecord. > > > > are class-vars a problem? theres one that i'd like to keep, a 'close' cache > > of triples in a normal ruby Array.. read/writes to this are fast (much > > faster than HTML generation in markaby, from what i can tell), but i guess > > they would need to lock the other threads briefly. > > > > for simplicity. i'd prefer a single interpreter process. otherwise i'm > > going to have to come up with some distributed cache invalidation scheme > > (typically the user load is 1-15, small workgroups, which loadwise is fine > > except they may experience a few seconds lag in their requests if eg a > > heavy SPARQL query is going on in another request) > > > > oh, and id like to hear 'sure, but you have to hack up the mongrel > > configurator slightly, and not do this' rather than 'just use a pack of > > mongrels' > > > > > > cheers :) > > ___ > > Camping-list mailing list > > Camping-list@rubyforge.org > > http://rubyforge.org/mailman/listinfo/camping-list > > > ___ > Camping-list mailing list > Camping-list@rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > Are you sure it's the right way to do ? It seems to me that an instance of the controller is created on each request. So with your approach, a mutex is created on each request and your don't have the benefit of mutex locking. Adding an `at` before @mutex should do the trick. -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: [ANN] Parasite and camping_generator 0.2.0
Sweet ! I like the concept but your parasite looks to kind :D -- Cheers, zimbatm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Looking for a dev
Hello, I'm working for a small Swiss company called STVS[1]. Our product is about to be released and we're looking for more developers to join our Team ! What we're looking for is a good ruby developer that is able to think out of the box and that is not afraid of "technologies" like Camping. Yeah, we're using Camping ! We mainly code in Ruby but for some times we do a little bit of C and bash scripting. Some knowledge in Linux and esp. Gentoo is very good since we distribute our product in a derived Gentoo distro. You'll also need to know HTML and Javascript. But what matters the most is that you are independent and flexible. So if you're interested, the best way to apply is to choose a ruby quiz[2], write a unique solution and send us the result with your CV and a small explanation of why you chose that quiz. With hope to see you at my work, Jonas Pfenniger [1] : http://stvs.ch [2] : http://www.rubyquiz.com/ ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Re: RESTful mixin, mixin repo?
This is what I though. Equipment seems pretty complicated but it is not really. What's complicated is the extension mechanism that was created to support many use cases. If you overlook that, the rest is pretty simple. Basically, to create a Camping equipment, you do the following : module YourExtension extend Equipment # installs the hooks depends_on OtherExtension # make sure the other extension is included first # Here you mimic your app's structure. class methods are defined with a module # called like your constant + ClassMethods. Like ControllersClassMethods. module Controllers # controllers will get copied over to your app class Woot # R is not available end end module Helpers # new helper def hello end end module CClassMethods # class methods for your app def create # the create method is chained super # do something end end end in your app : require 'equipment' Camping.goes :YourApp module YourApp equip YourExtension end Maybe I should put that more in form an make a tutorial. -- Cheers, zimbatm http://zimbatm.oree.ch ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Re: [UHH] any blogs sprung from camping?
Yes, look in Equipment so see what I did. There is a security module that separate the authentication of the authorization. You can define authentication or authorization rules on a class or application wide level. Note that mixins have some limitations, this is why the Equipment extension method is pretty complex. If you mix module A in module B and THEN add some methods to module A, module B won't get them. In Equipment, all includes are done when the #create method is called to avoid that problem. -- Cheers, zimbatm [1] http://zimbatm.oree.ch/files/camping.png ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Catching a list of variables with a Controller
Hi Boris, welcome to Ruby and Camping :) Camping doesn't support nested regexp groups like ((\w+)\/) so you'll have to do it differently. Your second approach is right. You can also use the multiple arguments input if you don't want to split the string with the commas. Like ?tag=one&tag=two&tag=three. That will give you a ['one', 'two', 'three'] array in input.tag. -- Cheers, zimbatm http://zimbatm.oree.ch ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Re: RESTful mixin, mixin repo?
On 14/11/06, Mark Fredrickson <[EMAIL PROTECTED]> wrote: > I'd be happy to include this on the wiki. Can some explain how to add > a helper function into the including module's namespace? > > eg. How do I get > > module Camping > module REST > module Helpers > def form ... > end > end > end > end > > properly mixed in (so as to provide a form helper to override markaby) > using 'include Camping::REST' You'll have to use the included callback. like : module REST def self.included(app) app::Helpers.send :include, Helpers end end -- Cheers, zimbatm http://zimbatm.oree.ch ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: [UHH] any blogs sprung from camping?
The problem with authentication is that you manage it at an application level. So if you're running each of them side by side, you'll have multiple User tables, etc... What I actually do is manage the authentication on the reverse proxy but it introduces other limitations, like the inhability to map datas with users in a straight forward manner. I think the best would be to provide some camping server-wide authentication mechanism so that it can be shared by the various applications. A server-wide template would also be interesting so that you can add links between the apps. But Camping doesn't support plugins (yet) :) -- Cheers, zimbatm http://zimbatm.oree.ch ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: RESTful mixin, mixin repo?
Hi, Great ! I wanted to implement that for long time and never had it (the time). I've packages a set of Camping extensions in a package called "Equipment". Apparently I don't have many followers but maybe you're interested to contribute ? I think that my lib is a bit too complex and gets intimidating compared to the LOC of Camping. Let me know if you want to be introduced a little bit :) -- Cheers, zimbatm http://zimbatm.oree.ch ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: A New App, and A Question
Hi Geoff, really nice idea, it will help me too. To answer your question : Look in the @root instance variable. It is the path to your application's root. We already had some problems with FastCgi -- Cheers, zimbatm http://zimbatm.oree.ch ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Date Helpers?
Here is an example : module DateHelper def select_day(date, options={}) default_opts = { :name => 'day' } options = default_opts.merge(options) select opts do for each day in month of date "date" do |d| # replace that with valid code if d == date.mday option d, :selected=>'selected' else option d end end end end You can then use that module in your application like that : Camping.goes :YourApp module YourApp::Helpers include DateHelpers end And now you have some new methods in your view and controllers. On 23/10/06, Michael Gorsuch <[EMAIL PROTECTED]> wrote: > Does anyone have any ideas off the top of there head how to easily construct > a date helper as one would see in Rails? > > Thanks, > > Michael Gorsuch > http://www.styledbits.com > > -- Cheers, zimbatm http://zimbatm.oree.ch ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list