Re: sqlite3 connection problem
Are the permissions on the file set right? What happens if you try to access the file with rhe sqlite3 command line tool and run the query yourself? -- Eric On Tue, Jun 9, 2009 at 6:35 AM, Dave Everittdever...@innotts.co.uk wrote: Any feedback appreciated on the following. My most recent attempt to identify the issue is a minimal Ruby/SQLite/ActiveRecord script, Pastied here: http://pastie.textmate.org/492514 which brings up the following when run from the command line (an empty database file already exists): $ ./simple_db.rbx [SNIP]/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure': Could not find table 'users' (ActiveRecord::StatementInvalid) from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/object/misc.rb:39:in `returning' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:213:in `columns' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1276:in `columns' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3008:in `attributes_from_column_definition_without_lock' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/locking/optimistic.rb:66:in `attributes_from_column_definition' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2435:in `initialize' from ./simple_db.rbx:10:in `new' from ./simple_db.rbx:10 The adapted blog example code I want to run for my students as an example is Pastied at: http://pastie.org/492517 so I'd appreciate the identification of any glaring errors (currently Camping 1.5 under plain CGI): The errors in the server log read: [SNIP]/activerecord-2.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log': SQLite3::SQLException: unable to open database file: CREATE TABLE blogtiny_schema_infos (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, version float) (ActiveRecord::StatementInvalid) from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:157:in `execute' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:402:in `catch_schema_changes' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:157:in `execute' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `create_table' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:352:in `send' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:352:in `method_missing' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:328:in `say_with_time' from /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:328:in `say_with_time' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:348:in `method_missing' from (eval):71:in `create_schema' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/schema.rb:43:in `instance_eval' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/schema.rb:43:in `define' from (eval):70:in `create_schema' from /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx:71:in `create' from /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx:77 [Thu May 28 12:18:13 2009] [error] [client 127.0.0.1] malformed header from script. Bad header=-- create_table(blogtiny_sche: /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx Note the odd truncation of 'blogtiny_sche' in the final line. And one dumb question: I don't have to 'require sqlite3-ruby', right? Dave ___ 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
Re: Camping tutorials for education?
2. Stable version The current version is 1.5 and is available from RubyForge. This is however a *really* old release, and there have been plenty of bug fixes in the repo. There's a 1.5.180 from _why's gem server which fixes some of them. The 1.9-version I have at gems.judofyr.net is just a rake gem ran from the latest why/camping (once in a while). This should be stable enough. In fact, as soon as I finish this little cleanup of the documentation (and get some more feedback from you guys) I will most probably release it as 2.0. (1.9 is the preview release of 2.0) 3. Rack Camping started depending on Rack when the work on 2.0 started. Right now, Camping uses Rack::Utils so it's currently not possible to run Camping without Rack. This should hopefully not cause any problems. 4. Servers At the moment I think the easiest solution is Phusion Passenger, which is an Apache or Nginx modules which can serve any Rack app. 5. Documentation Yes, we really need some documentation! This is actually what's blocking the 2.0 release. I have some suggestions (will try to post these as soon as possible, aka few hours). I'm not very god writing documentation, so if you want to help out we can agree on how to organize it. 6. Picnic While I haven't been to take a proper look at it, I think it's a very cool idea. Keep up the good work :-) //Magnus Holm On Tue, Jun 9, 2009 at 12:35, Dave Everitt dever...@innotts.co.uk wrote: I'm planning to use Camping to teach the basics of frameworks, and encourage new arrivals from web design to take up Ruby instead of (say) defaulting to PHP. To do this, I need a foolproof set of instructions for both the technicians (who have to install on all the studio machines) and the students. To go further, I'd like to get an opinion on the following: 1. SQLIte/ActiveRecord I've had some trouble getting Camping to write to an SQLite database as it should (post 'sqlite3 connection problem' has the details). To prepare instructions, I need to understand exactly why this is happening (in case it happens on a student's machine), so I'll persist and get it solved, somehow. 2. Obtaining the definitive current stable version What's the consensus on the definitive stable version? And where is it? The bleeding edge download from http://gems.judofyr.net/ is at 1.9.316, yet Picnic includes Camping 2.0 (which I thought didn't exist yet), but if I 'gem update' my 1.5 version, Camping remains at 1.5? I hope you can understand the confusion (on behalf of my future students) here. 3. Rack At which version (see [2]) did Camping start depending on Rack (as stated at: http://github.com/why/camping/tree/master)? Just out of interest, is it still possible to run a Camping app without it? 4. Comparing servers Is there any consensus on running Camping with: Apache, Mongrel, fast_cgi, plain old CGI, etc.? Which is the most efficient, future-proof, quickest/easiest to set up, and is there any information that charts the methods and differences? In a production environment, the URLs are obviously an issue here, so some mod_rewrite (or -like) examples would also be good. With all this I also want to lower the entry bar to Camping for new users by attempting some nice, simple documentation just to get people going, which is the thing I've been struggling to do myself. Dave ___ 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
The D-word
Oh, yes. Let's (once again) try to clean the documentation up a bit :-) I have no facts behind me, but I assume there would be two kinds of people who would like to browse camping.rubyforge.org: 1. Beginners who want to know what it's all about, how to get started and how to get help. 2. Campers who don't quite remember which method to use, or where the mailing-list was located, or how you did X etc. So here's a little proposal: What if we split the documentation into three parts? - README.txt should be the first you see and should contain basic info and links. - API-reference. A one-page reference to the whole Camping API which gives you short descriptions/explanations and might also give a link to the book (see below) for more detailed thoughts. - A book or tutorial which guides the user from A-Z, starting with installation and how to use The Camping Server, through basic MVC and HTTP/REST to how to use service-overrides or middlewares. It would be really nice if this could be a clean, short and concise guide to both Ruby and web development. What'd you think? What do you miss most from the current (almost non-existing) documentation? //Magnus Holm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: The D-word
Oh, that would be very nice! Right now there is an example at camping.rubyforge.org showing a blog skeleton (with controllers, models and views). It might be better to rather have a tiny, fully functional one (to get the feel of Camping), and a link to blog.rb (which should be simplified even more, and actually work). The book could then take it from there and slightly expand into the blog.rb (or maybe even totally different; we should at least end up with something) You know, I remember stumbling on Camping after trying out Rails, and it was a horrible feeling ending up at page 3 of the tutorial (on the old wiki) where a giant TODO screamed at me. I think many newcomers would have a look at alternatives to Rails, and it would be great if we could guide them not only through Camping, but also on the way you have to think when you're developing on the web. Without boring them too much. At the same time, there will probably be some Rubyists/webdevs who just want to learn about Camping too. What if we start easy with lots of code and introduce them to Camping, then (if we bother to) more in-depth about the web, HTTP, GET/POST/PUT/DELETE, limitations? You could follow the book right through and will end up with basic understanding of the web, or just skip after the quickstart (and three months later, after you've experimented a bit, you take the trouble to trouble to read the rest). Maybe book is the wrong word for this too. A book is so formal and strict. This should be light, simple and something you just can dive right into whenever you want. Let's keep it simple and precise, yet informal! The API as a cheat is a great idea too, let's not forget that :-) When it comes to the dependency on Rack, I'm not that worried. You almost can't do any webdev in Ruby today without meeting on Rack. And you only need to have the Rack-library somewhere where Camping can find it (just download and unzip it to vendor/rack for instance), even though using the gem is preferred. Anyone else want to chime in? (Yes, you do!) I currently have some RDoc templates which renders the book/readme/api. It definitely needs to be cleaned up a lot, but I guess I can push it out at a branch when I get back to my computer. //Magnus Holm On Tue, Jun 9, 2009 at 19:30, Dave Everitt dever...@innotts.co.uk wrote: I'm quite good at clear an understandable English (and editing the work of others) so would be glad to help make the documentation as usable as possible. I reckon we need two starting examples somewhere (a download link in the README?): 1. 'It worked - you are now Camping!' (without a DB); 2. a foolproof version of the minimal blog. I think you're dead right about the two kinds of users and three parts of documentation. As for the book (WebDev with Ruby, using Camping as an example?), it would be good to follow the spirit of Camping and keep it under... well, not 4k, but you get the point. The Camping philosophy needs to pervade the docs too - there's cultural capital in it, which could become a real attraction. I also suggest putting up the '1-page API' on 'cheat'. I have one slight concern for those on shared hosting: that it's 'not possible to run Camping without Rack'. It might take some thinking about how best to do this without root (or how to ask your provider to add the necessary). Many prospective Campers won't change servers just to try something out. Not necessarily an obstacle, but it needs some thought (a cleaned up pre-rack version? Camping 'classic'?). DaveE Oh, yes. Let's (once again) try to clean the documentation up a bit :-) I have no facts behind me, but I assume there would be two kinds of people who would like to browse camping.rubyforge.org: 1. Beginners who want to know what it's all about, how to get started and how to get help. 2. Campers who don't quite remember which method to use, or where the mailing-list was located, or how you did X etc. So here's a little proposal: What if we split the documentation into three parts? - README.txt should be the first you see and should contain basic info and links. - API-reference. A one-page reference to the whole Camping API which gives you short descriptions/explanations and might also give a link to the book (see below) for more detailed thoughts. - A book or tutorial which guides the user from A-Z, starting with installation and how to use The Camping Server, through basic MVC and HTTP/REST to how to use service-overrides or middlewares. It would be really nice if this could be a clean, short and concise guide to both Ruby and web development. What'd you think? What do you miss most from the current (almost non-existing) documentation? ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org