From george.moschovitis at gmail.com Tue Mar 1 03:46:46 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Tue, 1 Mar 2005 10:46:46 +0200 Subject: [Nitro] [ANN] Nitro + Og 0.11.0 Message-ID: Hello everyone, new versions of Nitro and Og where released. For more information check out the release notes: http://rubyforge.org/forum/forum.php?forum_id=2483 regards, George Moschovitis -- www.rubyforge.com/projects/nitro www.joy.gr From george.moschovitis at gmail.com Wed Mar 9 03:55:07 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 9 Mar 2005 10:55:07 +0200 Subject: [Nitro] Nitro/Og Homepage Message-ID: Hello everyone, I 've just uploaded a homepage for the Nitro and Og projects: http://nitro.rubyforge.org At the moment the homepage is rather simple, however it contains links to some online documentation, the Og tutorial, the Forum, Mailing list and Bug tracker. As everything related with Nitro, this homepage will be improved frequently, so stay tuned :) regards, George. -- www.rubyforge.com/projects/nitro www.joy.gr From george.moschovitis at gmail.com Thu Mar 10 04:38:49 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 10 Mar 2005 11:38:49 +0200 Subject: [Nitro] What do you think? Message-ID: I am planning some changes for Nitro/Og and I would like your opinion. Check out: http://rubyforge.org/forum/forum.php?forum_id=1782 regards, -g. -- nitro.rubyforge.org www.joy.gr From ilias at lazaridis.com Thu Mar 10 04:53:34 2005 From: ilias at lazaridis.com (Ilias Lazaridis) Date: Thu, 10 Mar 2005 11:53:34 +0200 Subject: [Nitro] What do you think? In-Reply-To: References: Message-ID: George Moschovitis wrote: > I am planning some changes for Nitro/Og and I would like > your opinion. Check out: > > http://rubyforge.org/forum/forum.php?forum_id=1782 I think you should close this duplicate resource and post your suggestions and RFC's directly here. > regards, > -g. > -- http://lazaridis.com From jamesUNDERBARb at neurogami.com Thu Mar 10 09:46:23 2005 From: jamesUNDERBARb at neurogami.com (James Britt) Date: Thu, 10 Mar 2005 07:46:23 -0700 Subject: [Nitro] What do you think? In-Reply-To: References: Message-ID: <42305DBF.1030903@neurogami.com> George Moschovitis wrote: > I am planning some changes for Nitro/Og and I would like > your opinion. Check out: > > http://rubyforge.org/forum/forum.php?forum_id=1782 I tend to prefer being able to use more or less standard file extensions, as editors know how to do The Right Thing. (Which is also why I prefer that (x)html templates use PI syntax () ratchet than ASP/ERB syntax (<%%>for embedded commands) But perhaps this can be configurable? Separate gems might be nice, too. Hard to say given my very limited us of Og/Nitro. But as a general rule I prefer independent tools, each usable on their own, hooked together. One issue I have with Rails is that, despite the availability of separate gems, it is resented as a monolithic application library; for example, I have to download and install ActiveMailer ever though I've yet to have a use for it. James From gm at navel.gr Thu Mar 10 10:05:17 2005 From: gm at navel.gr (George Moschovitis) Date: Thu, 10 Mar 2005 17:05:17 +0200 Subject: [Nitro] What do you think? In-Reply-To: <42305DBF.1030903@neurogami.com> References: <42305DBF.1030903@neurogami.com> Message-ID: <1110467117.3320.19.camel@slude.navel.gr> > I tend to prefer being able to use more or less standard file > extensions, as editors know how to do The Right Thing. (Which is also > why I prefer that (x)html templates use PI syntax () ratchet than > ASP/ERB syntax (<%%>for embedded commands) You are right, thats why I used this extension in the first place. However, in preparing the codebase to support caching I think I 'll probably change the extension, other opinions? > But perhaps this can be configurable? Sure. > Separate gems might be nice, too. Hard to say given my very limited us > of Og/Nitro. But as a general rule I prefer independent tools, each > usable on their own, hooked together. One issue I have with Rails is > that, despite the availability of separate gems, it is resented as a > monolithic application library; for example, I have to download and > install ActiveMailer ever though I've yet to have a use for it. I created the 3 gems, looks much nicer. Btw you are right about Rails being monolithic. I tried to see how i could use just action mailer or just active support with Nitro, but it doesnt seem possible. There is lots of bloat. And I hate those LOOOOOOOOONG namespace modules (like ActiveSupport::CoreExt::Numeric) Anyway expect some sort of active support/ actionmailer functionality in the next version of Nitro. And much more cleaned up code. -g. > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general -- web: http://www.navel.gr tel: +30 210 6898050 fax: +30 210 6898437 From jamesUNDERBARb at neurogami.com Sat Mar 19 00:09:40 2005 From: jamesUNDERBARb at neurogami.com (James Britt) Date: Fri, 18 Mar 2005 22:09:40 -0700 Subject: [Nitro] Not expected behavior Message-ID: <423BB414.5000600@neurogami.com> I discovered (though perhaps this is documented someplace and it eluded my conscious brain) that you apparently have to call the Og database configuration AFTER you have defined the classes you plan on persisting. I noticed that my code differed from the tutorial example in that I put the db config part up top; this just seems more natural, putting config details first. When I moved them *after* my class code, though, it magically worked. Not sure I like this. It seems that it would restrict how and where one defines configuration details. In all likelihood, I would use a 'require' call to pull in config details, so the class ode would always come after the parsing of the class defs. I gather the enchant code only knows to enchant classes already in object space? Is this intentional, or a coincidence? James -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com From george.moschovitis at gmail.com Sat Mar 19 01:20:09 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Sat, 19 Mar 2005 08:20:09 +0200 Subject: Fwd: [Nitro] Not expected behavior In-Reply-To: References: <423BB414.5000600@neurogami.com> Message-ID: ---------- Forwarded message ---------- From: George Moschovitis Date: Sat, 19 Mar 2005 08:02:41 +0200 Subject: Re: [Nitro] Not expected behavior To: james_b at neurogami.com Hello James, you are correct, Og only automatically finds manageable classes that are already defined. Alternatively you can call: og = OgDatabase.new(...) og.manage(MyClass) to explicitly manage classes. I 'll ad a new method like og.find_manageable_classes (or something like this, any idea for a better name?) Even better, if you have any other idea, how I could recode this to work as expected, please let me know! for any other problems, dont hesitate to contact me. -g. ps: I am working on a relly cool feature. The nested intervals sql tree traversal pattern, available with just one macron :) On Fri, 18 Mar 2005 22:09:40 -0700, James Britt wrote: > I discovered (though perhaps this is documented someplace and it eluded > my conscious brain) that you apparently have to call the Og database > configuration AFTER you have defined the classes you plan on persisting. > > I noticed that my code differed from the tutorial example in that I put > the db config part up top; this just seems more natural, putting config > details first. > > When I moved them *after* my class code, though, it magically worked. > > Not sure I like this. It seems that it would restrict how and where one > defines configuration details. In all likelihood, I would use a > 'require' call to pull in config details, so the class ode would always > come after the parsing of the class defs. I gather the enchant code > only knows to enchant classes already in object space? > > Is this intentional, or a coincidence? > > James > > -- > > http://www.ruby-doc.org > http://www.rubyxml.com > http://catapult.rubyforge.com > http://orbjson.rubyforge.com > http://ooo4r.rubyforge.com > http://www.jamesbritt.com > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- http://nitro.rubyforge.org http://www.joy.gr -- http://nitro.rubyforge.org http://www.joy.gr From matt.bowen at farweststeel.com Mon Mar 21 19:29:57 2005 From: matt.bowen at farweststeel.com (Matt Bowen) Date: Mon, 21 Mar 2005 16:29:57 -0800 Subject: [Nitro] Unexpected Page Generation With Blog Examples Message-ID: George: I've been playing around with the Blog examples, both the XSLT and non-XSLT-flavors. I'm struggling a little bit with consistent/expected page generation. I'll boil down my problem to this simple case. Let me know if you need more details. 1. Startup server with "ruby -rubygems run.rb --debug" 2. Going to http://10.10.105.125:9999/ displays the blog home page. 3. Clicking the Login link on right doesn't display login page. However, peeking at console I see this written: DEBUG: Rendering '/login'. DEBUG: Compiling action 'src/views/login' DEBUG: Transforming 'src/views/login.xhtml' DEBUG: Parsing xsl 'src/xsl/style.xsl' 10.10.105.121 - - [21/Mar/2005:15:54:53 PST] "GET /login HTTP/1.1" 200 1849 http://10.10.105.125:9999/login -> /login 4. Clicking the refresh button or forcing a refresh (SHIFT+F5 on IE) doesn't display the login page. However, if I shutdown the server and restart and then try to go to the login page, I'll see it. Though, if I start clicking around, I'll get in same situation where URL doesn't display as expected though transformations and redirection appear to occur in the console. I'm wondering if caching is tripping me up. Is there an easy way to disable this to verify this hunch? Is there some further debugging/tracing flags that I can set to help me track down the problem? Thanks for any help. Nitro rocks! - Matt Bowen From dan at zeraweb.com Mon Mar 21 21:11:02 2005 From: dan at zeraweb.com (Dan Yoder) Date: Mon, 21 Mar 2005 20:11:02 -0600 Subject: [Nitro] Trouble With Examples Message-ID: <2e841dc7d426b1d07cb125d19b145651@zeraweb.com> The blog example is giving me the following error: INFO: Connecting to database 'blog' using the 'mysql' adapter. /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:33:in `for_name': (eval):1:in `for_name': uninitialized constant Og::Adapter::MysqlAdapter (NameError) from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:66:in `eval' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:33:in `for_name' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:66:in `initialize' from run.rb:20:in `new' from run.rb:20 The MysqlAdapter file and class definition are there and the require statement on the line before the error succeeds, so I am not sure what the problem is ... Please help! From dan at zeraweb.com Tue Mar 22 02:52:55 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 01:52:55 -0600 Subject: [Nitro] Nitro Database Creation Problem Message-ID: <3b4e4bfc224dbd3134d6abe988f4f762@zeraweb.com> Okay, I've now managed to figure out what was wrong with the "adapter not found" error (I had to install ruby-mysql). Now I am getting an infinte loop: INFO: Creating database 'blog'. INFO: Database 'blog' not found! INFO: Creating database 'blog'. INFO: Database 'blog' not found! ... and so on. I tried running this as root in case it was a permissions error. Suggestions? From dan at zeraweb.com Tue Mar 22 03:03:02 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 02:03:02 -0600 Subject: [Nitro] Is Nitro Supported / Released? Message-ID: <952e5693623e66a79599f524a49cba95@zeraweb.com> Is Nitro a supported project at this time? I don't mean to be impatient. I do understand that there is a tremendous amount of work involved in launching a project like this. I am extremely impressed by the design goals for Nitro. I have worked for a long time doing framework development and Nitro is pretty close to the Holy Grail. I think it has addressed some of the key problems with Rails and could ultimately be very successful. I am building a portal framework, which is currently implemented in PHP. I began migrating it to Rails but got very frustrated with its lack of modularity in the underlying design. And then I discovered Nitro, sort of by accident (I was curious about Og after having seen the article on RubyGarden). What I can offer: - I am building a portal framework, which will result in a number of open source-able components that could enhance the attractiveness of Nitro. Already I have built a component library that would offer yet another templating model for Nitro. I have tried to integrate into Rails but it hasn't been easy, with all those instance variables being passed around. =) - I am a knowledgeable early adopter, highly motivated to make Nitro work for me because I understand the importance of what you are trying to do, and why it is distinct from Rails. - This is a for profit project, which means I may be able to make some donations to the project financially. I don't want to overstate this because I don't know at this point how profitable this venture will be, but I am willing to support the folks that make my life easier. Please let me know what the intentions of the Nitro team are: am I too early? Is it too soon to have a relative new-comer to Ruby start using your framework. Regards, Dan From dan at zeraweb.com Tue Mar 22 03:08:53 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 02:08:53 -0600 Subject: [Nitro] More Trouble With Og Message-ID: <658fa570b7aa5f9b8a85fcb66cd747d6@zeraweb.com> I went ahead and created the blog database, hoping maybe once that was squared away I would at least have a running app. But I got another error when it tried to query the database: INFO: Connecting to database 'blog' using the 'mysql' adapter. DEBUG: Og auto manages the following classes: DEBUG: [BlogEntry, Category, Comment] ERROR: DB error Table 'blog.og_blogentry' doesn't exist, [SELECT * FROM og_blogentry LIMIT 1] ERROR: /usr/local/lib/ruby/1.8/mysql.rb:453:in `read' /usr/local/lib/ruby/1.8/mysql.rb:345:in `read_query_result' /usr/local/lib/ruby/1.8/mysql.rb:160:in `real_query' /usr/local/lib/ruby/1.8/mysql.rb:275:in `query' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapters/mysql.rb: 276:in `query' (eval):10:in `query' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapters/mysql.rb: 112:in `calc_field_index' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:454:in `eval_og_read' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:303:in `eval_lifecycle_methods' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:220:in `convert' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:159:in `manage' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:169:in `manage_classes' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:168:in `each' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:168:in `manage_classes' /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:93:in `initialize' run.rb:20:in `new' run.rb:20 /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapters/mysql.rb: 115:in `calc_field_index': undefined method `num_fields' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:454:in `eval_og_read' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:303:in `eval_lifecycle_methods' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:220:in `convert' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:159:in `manage' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:169:in `manage_classes' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:168:in `each' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:168:in `manage_classes' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:93:in `initialize' from run.rb:20:in `new' from run.rb:20 From dan at zeraweb.com Tue Mar 22 03:34:31 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 02:34:31 -0600 Subject: [Nitro] OG Problem Resolved - Now Can't Find XML/XSLT Message-ID: <213e2c122084aa7f4481b3b8e7db9912@zeraweb.com> I set the create_schema variable to true and that could care of the last error I reported. (I am still getting the infinite loop when the database itself isn't created first.) Now I'm getting: INFO: Connecting to database 'blog' using the 'mysql' adapter. DEBUG: Og auto manages the following classes: DEBUG: [BlogEntry, Category, Comment] INFO: Created table 'og_blogentry'. INFO: Created table 'og_category'. INFO: Created table 'og_comment'. /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__': No such file to load -- xml/xslt (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require' from /usr/local/lib/ruby/site_ruby/1.8/nitro/shaders.rb:186:in `initialize' from run.rb:29:in `new' from run.rb:29 From dan at zeraweb.com Tue Mar 22 04:52:54 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 03:52:54 -0600 Subject: [Nitro] what does compiling action mean? Message-ID: <0c785f1e99b3aac75b91608e58f8386d@zeraweb.com> now i have this very simple hello world controller, with only an index method returning hello world, and i am getting this apparently infinite loop: DEBUG: Rendering '/'. DEBUG: Compiling action 'public/index' 127.0.0.1 - - [22/Mar/2005:02:45:07 CST] "GET / HTTP/1.1" 303 32 - -> / DEBUG: Rendering '/'. DEBUG: Compiling action 'public/index' 127.0.0.1 - - [22/Mar/2005:02:45:07 CST] "GET / HTTP/1.1" 303 32 - -> / DEBUG: Rendering '/'. DEBUG: Compiling action 'public/index' 127.0.0.1 - - [22/Mar/2005:02:45:07 CST] "GET / HTTP/1.1" 303 0 - -> / From george.moschovitis at gmail.com Tue Mar 22 05:28:17 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Tue, 22 Mar 2005 12:28:17 +0200 Subject: [Nitro] Trouble With Examples In-Reply-To: <2e841dc7d426b1d07cb125d19b145651@zeraweb.com> References: <2e841dc7d426b1d07cb125d19b145651@zeraweb.com> Message-ID: Hello Dan, thanks for trying out Nitro. I made a mistake and released the blog example with Og.create_schema = false. Please change this to Og.create_schema = true This resides in the file run.rb -g. On Mon, 21 Mar 2005 20:11:02 -0600, Dan Yoder wrote: > The blog example is giving me the following error: > INFO: Connecting to database 'blog' using the 'mysql' adapter. > /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:33:in > `for_name': (eval):1:in `for_name': uninitialized constant > Og::Adapter::MysqlAdapter (NameError) > from > /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:66:in > `eval' > from > /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapter.rb:33:in > `for_name' > from > /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:66:in > `initialize' > from run.rb:20:in `new' > from run.rb:20 > The MysqlAdapter file and class definition are there and the require > statement on the line before the error succeeds, so I am not sure what > the problem is ... > > Please help! > > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Tue Mar 22 05:37:07 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Tue, 22 Mar 2005 12:37:07 +0200 Subject: [Nitro] Is Nitro Supported / Released? In-Reply-To: <952e5693623e66a79599f524a49cba95@zeraweb.com> References: <952e5693623e66a79599f524a49cba95@zeraweb.com> Message-ID: Hello Dan, On Tue, 22 Mar 2005 02:03:02 -0600, Dan Yoder wrote: > Is Nitro a supported project at this time? Nitro is a very active project at the moment. Have a look at www.rubyforge.org. New releases are coming almost every 10 days. And reported bugs are fixed ASAP. > I am extremely impressed by the design goals for Nitro. I have worked > for a long time doing framework development and Nitro is pretty close > to the Holy Grail. I think it has addressed some of the key problems > with Rails and could ultimately be very successful. I think so too, I would love to get additional suggestions, and ideas. Perhaps you can even help me. The nice thing about Nitro, in contrast to Rails, is that it is not used yet by many people so it is easier to make changes. So send me your suggestions. > > What I can offer: > - I am building a portal framework, which will result in a number of > open source-able components that could enhance the attractiveness of > Nitro. Already I have built a component library that would offer yet > another templating model for Nitro. I have tried to integrate into > Rails but it hasn't been easy, with all those instance variables being > passed around. =) I am working on a higher level framework, tentatively calles Gen (combined you get Nitrogen :) :)) However I am not sure if this will be released as open source. > - I am a knowledgeable early adopter, highly motivated to make Nitro > work for me because I understand the importance of what you are trying > to do, and why it is distinct from Rails. Thats great. I am looking for people tha would like to have a look at an alternative. Rails gets many things right but I think we can fix a lot of problems. And I always believed in the second mover advantage. I 'll appreciate any help, and your suggestions. > - This is a for profit project, which means I may be able to make some > donations to the project financially. I don't want to overstate this > because I don't know at this point how profitable this venture will be, > but I am willing to support the folks that make my life easier. This is also nice to hear. Donations are of course very welcome. However, please note that I 'll continue to improve Nitro and Og even if I get no donations or something. My goal is to create the best web framework and then use it to create a *BIG* youth portal / community site. > Please let me know what the intentions of the Nitro team are: am I too > early? Is it too soon to have a relative new-comer to Ruby start using > your framework. No, you came at the RIGHT point in time. The next version of Nitro will be released later this week featuring even more cool stuff: - caching (full page, action, fragment) - nested elements tree traversal - improved multipart support and much more. It will be better if you join the Nitro projects, it is easier to make a difference here, and influence the direction of the framework than in Rails. best regards, George. -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Tue Mar 22 05:44:00 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Tue, 22 Mar 2005 12:44:00 +0200 Subject: [Nitro] what does compiling action mean? In-Reply-To: <0c785f1e99b3aac75b91608e58f8386d@zeraweb.com> References: <0c785f1e99b3aac75b91608e58f8386d@zeraweb.com> Message-ID: Hello dan, your action method looks probably like this: def index return "Hello world" end This shouls be like this: def index @out << "Hello world" end or o << 'Hello world' or o.text 'Hellow world' if an action does not fill the output buffer (@out) Nitro automatically redirects to the referer. In version 0.14.0 there is a render_nothing method that is useful to better 'document' this behaviour in your code. If you have any more problems, let me know! regards, George. -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Tue Mar 22 05:46:20 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Tue, 22 Mar 2005 12:46:20 +0200 Subject: [Nitro] Unexpected Page Generation With Blog Examples In-Reply-To: References: Message-ID: On Mon, 21 Mar 2005 16:29:57 -0800, Matt Bowen wrote: > George: > I've been playing around with the Blog examples, both the XSLT and > non-XSLT-flavors. I'm struggling a little bit with consistent/expected page > generation. I'll boil down my problem to this simple case. Let me know if > ... > that I can set to help me track down the problem? Thanks for any help. Hello Matt, can you try the example with Firefox and tell me if this works for you? > Nitro rocks! I know :) regards, George. -- http://nitro.rubyforge.org http://www.joy.gr From dan at zeraweb.com Tue Mar 22 14:22:50 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 13:22:50 -0600 Subject: [Nitro] More Create Schema Trouble Message-ID: <52ddc0c11e4c18257ec9c23e725bce1b@zeraweb.com> Hi George, I have a simple app that just has one model and a simple controller that uses the scaffold. When I run the app, the first thing that happens is the usual problem with the creation of the database. So I do that by hand, and then I get a create table error: INFO: Connecting to database 'cruiser' using the 'mysql' adapter. DEBUG: Og auto manages the following classes: DEBUG: [Story] /usr/local/lib/ruby/1.8/mysql.rb:453:in `read': You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' oid integer AUTO_INCREMENT PRIMARY KEY)' at line 1 (Mysql::Error) from /usr/local/lib/ruby/1.8/mysql.rb:345:in `read_query_result' from /usr/local/lib/ruby/1.8/mysql.rb:160:in `real_query' from /usr/local/lib/ruby/1.8/mysql.rb:275:in `query' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/adapters/mysql.rb: 178:in `create_table' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:214:in `convert' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:159:in `manage' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:169:in `manage_classes' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:168:in `each' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:168:in `manage_classes' from /usr/local/lib/ruby/gems/1.8/gems/og-0.13.0/lib/og/database.rb:93:in `initialize' from run.rb:14:in `new' from run.rb:14 My source follows: ****************************** run.rb ****************************** require 'nitro' require 'og' require 'controllers/story_controller' include N Og.create_schema = true runner = Runner.new.setup db = Og::Database.new( :address => 'localhost', :adapter => 'mysql', :database => 'cruiser', :user => 'root', :password => '', :connection_count => 3 ) conf = Conf.new( :name => 'Cruiser Demo', :host => '127.0.0.1', :port => 3000, :dispatcher => Dispatcher.new(StoryController) ) runner.run(conf) ****************************** StoryController.rb ****************************** require 'nitro/controller' require 'models/story' class StoryController < N::Controller scaffold Story, :name => 'story', :index => true end ****************************** Story.rb ****************************** include N class Story prop_accessor :title, String prop_accessor :body, String prop_accessor :created, Date prop_accessor :publish, Date prop_accessor :expire, Data validate_value :title, :msg => 'Please provide a title' validate_value :body, :msg => 'Please provide an article body' end From dan at zeraweb.com Tue Mar 22 17:58:40 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 16:58:40 -0600 Subject: [Nitro] Date Versus Time Message-ID: <6e2c59939443c9f27ec28bd4f365089a@zeraweb.com> Okay, my last problem was because i declared my properties to be of type Date instead of Time. But what if all want is the Date? Dan From dan at zeraweb.com Tue Mar 22 18:02:13 2005 From: dan at zeraweb.com (Dan Yoder) Date: Tue, 22 Mar 2005 17:02:13 -0600 Subject: [Nitro] Scaffold And Inifite Redirect Loops Message-ID: <74b8fabedff726007d3c046e59296ec6@zeraweb.com> I am using scaffold in my controller and I am getting an infinite loop: INFO: Connecting to database 'cruiser' using the 'mysql' adapter. DEBUG: Og auto manages the following classes: DEBUG: [Story] INFO: Created table 'og_story'. ==> Listening at 127.0.0.1:3000. [2005-03-22 16:57:36] INFO WEBrick 1.3.1 [2005-03-22 16:57:36] INFO ruby 1.8.2 (2004-12-25) [powerpc-darwin7.8.0] [2005-03-22 16:57:36] WARN TCPServer Error: Address already in use - bind(2) [2005-03-22 16:57:36] INFO WEBrick::HTTPServer#start: pid=5359 port=3000 DEBUG: Rendering '/'. DEBUG: Compiling action 'public/index' DEBUG: SELECT * FROM og_story ORDER BY oid 127.0.0.1 - - [22/Mar/2005:16:59:11 CST] "GET / HTTP/1.1" 303 32 - -> / DEBUG: Rendering '/'. DEBUG: Compiling action 'public/index' DEBUG: SELECT * FROM og_story ORDER BY oid 127.0.0.1 - - [22/Mar/2005:16:59:11 CST] "GET / HTTP/1.1" 303 32 and so on. What is going here? What is missing? From george.moschovitis at gmail.com Tue Mar 22 18:53:42 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 23 Mar 2005 01:53:42 +0200 Subject: [Nitro] Scaffold And Inifite Redirect Loops In-Reply-To: <74b8fabedff726007d3c046e59296ec6@zeraweb.com> References: <74b8fabedff726007d3c046e59296ec6@zeraweb.com> Message-ID: Hello dan, On Tue, 22 Mar 2005 17:02:13 -0600, Dan Yoder wrote: > I am using scaffold in my controller and I am getting an infinite loop: Again you are not filling the output buffer. At the moment the scaffolder generates the following code: def index list end def list @entries = Object.all(...) end You have to provide either a template (index.xhtml) that renders the @entries collection as html or overload the index or list actions. Btw, I 'll rethink the autoredirect feature in the next version, and add an extra check to avoid infinite loops (I added a check for the infinite loop in the creat_db method). Thanks for pointing this out to me. regards, George. ps: I 'll probably make a pre-release of 0.14.0 available in the nitro homepage tommorow. -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Tue Mar 22 18:57:01 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 23 Mar 2005 01:57:01 +0200 Subject: [Nitro] Date Versus Time In-Reply-To: <6e2c59939443c9f27ec28bd4f365089a@zeraweb.com> References: <6e2c59939443c9f27ec28bd4f365089a@zeraweb.com> Message-ID: On Tue, 22 Mar 2005 16:58:40 -0600, Dan Yoder wrote: > Okay, my last problem was because i declared my properties to be of > type Date instead of Time. But what if all want is the Date? Hmm, to tell you the truth, I haven't tested a Date yet, I always use Time. I 'll add a unit test for this, and fix any problems. Thanks for the report, -g. ps: If it is possible please add a bug report to the www.rubyforge.org/projects/nitro page. So I can better track them down. -- http://nitro.rubyforge.org http://www.joy.gr From jamesUNDERBARb at neurogami.com Fri Mar 18 23:43:26 2005 From: jamesUNDERBARb at neurogami.com (James Britt) Date: Fri, 18 Mar 2005 21:43:26 -0700 Subject: [Nitro] Help! undefined method `save' Message-ID: <423BADEE.4020609@neurogami.com> I'm trying to build an Og app, following the RubyGarden tutorial, and when I try to save my object I get this error: undefined method `save' #----------------------------- #!/usr/bin/env ruby require 'og' db = Og::Database.new( :database => 'tag_devel', :adapter => 'mysql', :user => 'root', :password => 'password' ) class Tag prop_accessor :name, String prop_accessor :context, String prop_accessor :creator, String prop_reader :last_update, Time def initialize( ) yield self if block_given? @last_update = Time.now end end tag = Tag.new tag.name = "Database" tag.save # undefined method `save' for # (NoMethodError) #----------------- What might the problem be? nitro-0.13.0 og-0.13.0 (from gems) ruby 1.8.2, 1-click on Win2K Thanks, James Britt -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com From jamesUNDERBARb at neurogami.com Sat Mar 19 09:12:57 2005 From: jamesUNDERBARb at neurogami.com (James Britt) Date: Sat, 19 Mar 2005 07:12:57 -0700 Subject: Fwd: [Nitro] Not expected behavior In-Reply-To: References: <423BB414.5000600@neurogami.com> Message-ID: <423C3369.7030703@neurogami.com> George Moschovitis wrote: > ---------- Forwarded message ---------- > From: George Moschovitis > Date: Sat, 19 Mar 2005 08:02:41 +0200 > Subject: Re: [Nitro] Not expected behavior > To: james_b at neurogami.com > > > Hello James, > > you are correct, Og only automatically finds manageable classes that > are already defined. Alternatively you can call: > > og = OgDatabase.new(...) > og.manage(MyClass) > > to explicitly manage classes. > > I 'll ad a new method like > > og.find_manageable_classes (or something like this, any idea for a better name?) > > Even better, if you have any other idea, how I could recode this to > work as expected, please let me know! I had started wondering if I was supposed to inherit or extend a class, which is one way to explicitly indicate a class should be enchanted or managed. One the one hand, the idea that all classes magically acquire certain persistence methods is rather nice. On the other, maybe this isn't what one wants (for example, you have other objects with a 'save' method and they behave differently). Since one has to use 'property' or 'prop_*' methods to indicate what fields are to be saved, could the call to Og.manage( class) be hooked into those? Whenever Og sees that some class is calling a prop_* method, it marks the class for enchantment? Thanks, James From jamesUNDERBARb at neurogami.com Tue Mar 22 21:48:11 2005 From: jamesUNDERBARb at neurogami.com (James Britt) Date: Tue, 22 Mar 2005 19:48:11 -0700 Subject: [Nitro] Complex selections Message-ID: <4240D8EB.6080704@neurogami.com> I have an app (well, I'm learning Nitro/Og as I write it) that has a fairly simple object model. A Resource object models a bookmark, a la del.icio.us, which has among its properties a set of Tag objects. Tags are basically simple structs; the main property is the name. I want to be able to select a set of resources that have one or more tags with a given name. Some pseudo-code: # assume tag_set is an array of tag names rset = [] Resource.select { |r| tag_set.each { |t| rset << r if r.tags.include? t } } rset.uniq! Probably not the most efficient way to do this, and almost certainly not correct Og-speak. In my first go-round with Rails (where I first implemented this), I did not find any nice Ruby-based way to do this, and ended up falling back on assorted SQL (and running into various issues with subselect and MySQL). Is there some way to do this in Og without also having to hand-craft the SQL? Is this sort of select just better done using in SQL? Thanks, James -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com From george.moschovitis at gmail.com Wed Mar 23 03:26:30 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 23 Mar 2005 10:26:30 +0200 Subject: [Nitro] Help! undefined method `save' In-Reply-To: <423BADEE.4020609@neurogami.com> References: <423BADEE.4020609@neurogami.com> Message-ID: Create Og::Database after you define your class or use the ogdb.auto_manage_classes method that will be available in 0.14.0 -g. On Fri, 18 Mar 2005 21:43:26 -0700, James Britt wrote: > I'm trying to build an Og app, following the RubyGarden tutorial, and > when I try to save my object I get this error: > > undefined method `save' > > #----------------------------- > #!/usr/bin/env ruby > require 'og' > > db = Og::Database.new( > :database => 'tag_devel', > :adapter => 'mysql', > :user => 'root', > :password => 'password' > ) > > class Tag > prop_accessor :name, String > prop_accessor :context, String > prop_accessor :creator, String > prop_reader :last_update, Time > > def initialize( ) > yield self if block_given? > @last_update = Time.now > end > end > > tag = Tag.new > > tag.name = "Database" > tag.save > # undefined method `save' for # (NoMethodError) > > #----------------- > > What might the problem be? > > nitro-0.13.0 > og-0.13.0 > > (from gems) > > ruby 1.8.2, 1-click on Win2K > > Thanks, > > James Britt > > -- > > http://www.ruby-doc.org > http://www.rubyxml.com > http://catapult.rubyforge.com > http://orbjson.rubyforge.com > http://ooo4r.rubyforge.com > http://www.jamesbritt.com > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Wed Mar 23 03:28:31 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 23 Mar 2005 10:28:31 +0200 Subject: Fwd: [Nitro] Not expected behavior In-Reply-To: <423C3369.7030703@neurogami.com> References: <423BB414.5000600@neurogami.com> <423C3369.7030703@neurogami.com> Message-ID: > Since one has to use 'property' or 'prop_*' methods to indicate what > fields are to be saved, could the call to Og.manage( class) be hooked > into those? Whenever Og sees that some class is calling a prop_* > method, it marks the class for enchantment? This is allready what happens :) Og only manages classes that use property at least once. However you gave me an Idea how I can avoid the ogdb.auto_manage_classes to get objects defined after the Og::Database is created. George -- http://nitro.rubyforge.org http://www.joy.gr From dan at zeraweb.com Wed Mar 23 03:32:23 2005 From: dan at zeraweb.com (Dan Yoder) Date: Wed, 23 Mar 2005 02:32:23 -0600 Subject: [Nitro] problem with shader Message-ID: <0e0d96db8c1870f49f1d6160e22e460b@zeraweb.com> the blog example won't run because it is complaining that it can't find the xml/xslt stuff. is there something else i need to install? my own shader-free app is still looping infinitely because it can't find the index.xhtml template, even though it's there. not sure what to do on that. i tried setting the template directory in the controller's initialize method and that didn't help. From george.moschovitis at gmail.com Wed Mar 23 03:33:10 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 23 Mar 2005 10:33:10 +0200 Subject: [Nitro] Complex selections In-Reply-To: <4240D8EB.6080704@neurogami.com> References: <4240D8EB.6080704@neurogami.com> Message-ID: > I have an app (well, I'm learning Nitro/Og as I write it) that has a > fairly simple object model. > ... > I want to be able to select a set of resources that have one or more > tags with a given name. Hmm I am planning to use Nitro for something like this :) > Probably not the most efficient way to do this, and almost certainly not > correct Og-speak. > ... > In my first go-round with Rails (where I first implemented this), I did > not find any nice Ruby-based way to do this, and ended up falling back > on assorted SQL (and running into various issues with subselect and MySQL). Can you suggest an API for this? I dont have something available, but I would like to add this functionality. Can you post the SQL query you would actually use and then we can extract some kind of API. Btw this is similar to another feature I want to add: join queries. Let me demonstrate with an example. class User property :name, String has_many :comments, Comment end class Comment belongs_to :user, User end u = User['george'] u.comments(:join => User) > > Is there some way to do this in Og without also having to hand-craft the > SQL? Is this sort of select just better done using in SQL? > > Thanks, > > James > > -- > > http://www.ruby-doc.org > http://www.rubyxml.com > http://catapult.rubyforge.com > http://orbjson.rubyforge.com > http://ooo4r.rubyforge.com > http://www.jamesbritt.com > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Wed Mar 23 03:35:39 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 23 Mar 2005 10:35:39 +0200 Subject: [Nitro] Complex selections In-Reply-To: <4240D8EB.6080704@neurogami.com> References: <4240D8EB.6080704@neurogami.com> Message-ID: > I have an app (well, I'm learning Nitro/Og as I write it) that has a > fairly simple object model. > ... > I want to be able to select a set of resources that have one or more > tags with a given name. Hmm I am planning to use Nitro for something like this :) > Probably not the most efficient way to do this, and almost certainly not > correct Og-speak. > ... > In my first go-round with Rails (where I first implemented this), I did > not find any nice Ruby-based way to do this, and ended up falling back > on assorted SQL (and running into various issues with subselect and MySQL). Can you suggest an API for this? I dont have something available, but I would like to add this functionality. Can you post the SQL query you would actually use and then we can extract some kind of API. Btw this is similar to another feature I want to add: join queries. Let me demonstrate with an example. class User property :name, String has_many :comments, Comment end class Comment property :username, :join => User, :property => :name belongs_to :user, User end u = User['george'] for c in u.comments(:join => User) puts c.username end the property :username in Comment is a virtual field not actually stored in the database. I am not that happy with this API though. Does somenone have any suggestions for this? regards, George -- http://nitro.rubyforge.org http://www.joy.gr From dan at zeraweb.com Wed Mar 23 04:19:51 2005 From: dan at zeraweb.com (Dan Yoder) Date: Wed, 23 Mar 2005 03:19:51 -0600 Subject: [Nitro] debugging Message-ID: i saw a mention somewhere that there was a browser-based debugger. how do i access that? right now i am getting this mysterious "(error)" message. From gm at navel.gr Wed Mar 23 04:24:26 2005 From: gm at navel.gr (George Moschovitis) Date: Wed, 23 Mar 2005 11:24:26 +0200 Subject: [Nitro] debugging In-Reply-To: References: Message-ID: <1111569867.3263.7.camel@slude.navel.gr> On Wed, 2005-03-23 at 03:19 -0600, Dan Yoder wrote: > i saw a mention somewhere that there was a browser-based debugger. how > do i access that? right now i am getting this mysterious "(error)" > message. For the moment, copy the file: examples/blog/public/error.xhtml to yourapp/public/error.xhtml this will not be needed in the next version. regards, George. -- web: http://www.navel.gr tel: +30 210 6898050 fax: +30 210 6898437 From dan at zeraweb.com Wed Mar 23 04:24:42 2005 From: dan at zeraweb.com (Dan Yoder) Date: Wed, 23 Mar 2005 03:24:42 -0600 Subject: [Nitro] what's wrong with this picture? Message-ID: def list_story @stories = Story.all end when i comment out the @stories ... line, it works fine (at least, it loads my index.xhtml file). as is, i get "(error)" From dan at zeraweb.com Wed Mar 23 04:43:25 2005 From: dan at zeraweb.com (Dan Yoder) Date: Wed, 23 Mar 2005 03:43:25 -0600 Subject: [Nitro] what's wrong with this picture? In-Reply-To: References: Message-ID: yes, but i thought perhaps there was something else with the web-based debugging. i put the error.xhtml file in place and it worked fine, very nice. the error here is "argument out of range" coming from ruby's time.rb local method. it looks as though a null value in a time column will cause this error. dan On Mar 23, 2005, at 3:29 AM, George Moschovitis wrote: > Btw, debuging information is emmited if you use the --debug options > or if you define $DBG > > -g. > > > On Wed, 23 Mar 2005 03:24:42 -0600, Dan Yoder wrote: >> >> def list_story >> @stories = Story.all >> end >> >> when i comment out the @stories ... line, it works fine (at least, it >> loads my index.xhtml file). as is, i get "(error)" >> >> _______________________________________________ >> Nitro-general mailing list >> Nitro-general at rubyforge.org >> http://rubyforge.org/mailman/listinfo/nitro-general >> > > > -- > http://nitro.rubyforge.org > http://www.joy.gr From gm at navel.gr Wed Mar 23 04:57:17 2005 From: gm at navel.gr (George Moschovitis) Date: Wed, 23 Mar 2005 11:57:17 +0200 Subject: [Nitro] what's wrong with this picture? In-Reply-To: References: Message-ID: <1111571837.3263.14.camel@slude.navel.gr> > yes, but i thought perhaps there was something else with the web-based > debugging. You can also dump the rendering errors in page (see the blog example) Alternatively you can start a new instance like this: ruby run.rb --console and this brings up an irb console into your runing server. Moroever you can use florian gross's breakpointer library (install the gem). I 'll write some docs about this, be patient. reagrds, George. -- web: http://www.navel.gr tel: +30 210 6898050 fax: +30 210 6898437 From dan at zeraweb.com Wed Mar 23 05:51:02 2005 From: dan at zeraweb.com (Dan Yoder) Date: Wed, 23 Mar 2005 04:51:02 -0600 Subject: [Nitro] custom templates Message-ID: <258034bbe0d597ca5000489bfd8304e7@zeraweb.com> I have a widget library I'd like to use with Nitro. Any clues on how to "plug-in" a different templating system? Mine ERB and XML based, no XSLT. BTW, I think basing your templates on a library that isn't built-in and actually requires (unless I am missing something) installing a compiled binary for libxslt is going to create an obstacle to adoption. One option is to push the processing out to the browser. Have you looked into doing it that way? Another option would be to use my widgets! =) Dan From gm at navel.gr Wed Mar 23 06:15:32 2005 From: gm at navel.gr (George Moschovitis) Date: Wed, 23 Mar 2005 13:15:32 +0200 Subject: [Nitro] custom templates In-Reply-To: <258034bbe0d597ca5000489bfd8304e7@zeraweb.com> References: <258034bbe0d597ca5000489bfd8304e7@zeraweb.com> Message-ID: <1111576532.3263.18.camel@slude.navel.gr> On Wed, 2005-03-23 at 04:51 -0600, Dan Yoder wrote: > I have a widget library I'd like to use with Nitro. Any clues on how to > "plug-in" a different templating system? Mine ERB and XML based, no > XSLT. Hmm, you could email me this templating system and we 'll see how this can be integrated. However, please experiment a little bit with Nitro's templating system. I think it is really MUCH better than ERB and the XSLT templates are the more powerful (not to mention standards compliant) way to do templates. If you play a little bit with nitro's templating system I am sure you will like it. Nice features: - xhtml compliant can be validated with standard parsers (xmlint) - strips comments - correctly syntax highlighted in most editors regards, George. -- web: http://www.navel.gr tel: +30 210 6898050 fax: +30 210 6898437 From george.moschovitis at gmail.com Wed Mar 23 06:18:42 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Wed, 23 Mar 2005 13:18:42 +0200 Subject: [Nitro] custom templates In-Reply-To: <258034bbe0d597ca5000489bfd8304e7@zeraweb.com> References: <258034bbe0d597ca5000489bfd8304e7@zeraweb.com> Message-ID: > One > option is to push the processing out to the browser. Have you looked > into doing it that way? Another option would be to use my widgets! =) another option is to write a pure Ruby xslt transformator. Please note that the XSLT transform is preaplied before compiling the templates. So the transformation step comes for free. You can do extremely complex transforms (like localization transforms (to be demonstrated in a future example)) without affecting performance. -g. -- http://nitro.rubyforge.org http://www.joy.gr From james.britt at gmail.com Wed Mar 23 10:32:36 2005 From: james.britt at gmail.com (James Britt) Date: Wed, 23 Mar 2005 08:32:36 -0700 Subject: [Nitro] Complex selections In-Reply-To: References: <4240D8EB.6080704@neurogami.com> Message-ID: <42418C14.5010407@gmail.com> George Moschovitis wrote: ... > Can you suggest an API for this? I dont have something available, but > I would like to add this functionality. Can you post the SQL query you > would actually use and then we can extract some kind of API. The pseudo-code I posted turned out to be essentially the code I'm using right now. It works, but it's very slow, and really only does part of what I want. def find_by_tags tag_set = context.params[ 'tags' ].to_s.split( ' ' ) tag_set.map!{ |t| t.downcase } @resources = [] Resource.all.each { |r| r.tags.each { |t| @resources.push( r) if tag_set.include? t.name.downcase } } @resources.uniq! end Given a tag set of ['foo', 'bar', 'baz'], this finds all resources that have any or all of these as tags. There is no way this is even remotely as efficient as actual SQL. My production DB has several hundred resources, each with an average of three tags. I can't have code walk every item. The SQL I have used in the first version is pretty gnarly, and part of the issue is that MySQL does not quite support sub-selects, and the support differs from 3.x to 4.x. I ended up (due to a requirement to use a 3.x MySQL instance) using 2 calls. Getting this right across multiple databases so as to hide the SQL details from the user can be tricky. To make things more complex, what I'm really looking for is a combination of AND and OR in the selection. For example, given a URL such as http://foo.com/find_by_tags/foo,bar+baz I want to locate resources that have foo OR bar AND baz My partial-Rails version (I ditched a lot of the built-in stuff) constructs chunks of SQL based on assorted parameters, joins them up, and does a find_by_sql to locate things. In the end, given the nature of the query, that may be the only way to get reasonable performance over large data sets. > > Btw this is similar to another feature I want to add: join queries. > > Let me demonstrate with an example. > > class User > property :name, String > has_many :comments, Comment > end > > class Comment > > belongs_to :user, User > end > > u = User['george'] > > u.comments(:join => User) If there are common usage patterns then it may be reasonable to construct SQL templates for each database adapter and wrap the calls in high-level Ruby constructs. For example, the ~rails version has this helper method: def make_tag_union_post_id_set( tags ) raise( "make_tag_union_post_id_set has nil tag array" ) unless tags raise( "make_tag_union_post_id_set given something not an array: #{tags.class}" ) unless tags.class == Array raise( "make_tag_union_post_id_set given empty tag array" ) unless tags.size > 0 tag_set_str = tags.map { |t| "'#{t}'" }.join( ', ') sql = "select t.* from tags t where t.tag in ( #{tag_set_str} ) " tags = Tag.find_by_sql( sql ) tags.map{ |t| t.post_id } end There's a similar method for intersection that boils down to this: tag_set_str = tags.map { |t| "'#{t}'" }.join( ', ') sql = "select t.*, count(tag) as tag_count from tags t where t.tag in ( #{tag_set_str} ) group by t.post_id " tags = Tag.find_by_sql( sql ) id_set = [ -1 ] tags.each{ |t| id_set << t.post_id if t.tag_count.to_i == tcnt.to_i } (This is based on a SQL hack I found on a MySQL chat board, as MySQL has poor INTERSECTION support. Code for PostgreSQL would likely be more straightforward.) These are used to find a set of post/resource IDs, which is used for another SQL select to get the final results. Perhaps then there is a way to parameterize such calls to dynamically build SQL appropriate to the objects|properties of interest, given that parent_obj.child_obj_set[] is a common structure, as is selection of parent_obj based on some criteria applied to child_obj_set properties. James From george.moschovitis at gmail.com Thu Mar 24 04:47:11 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 24 Mar 2005 11:47:11 +0200 Subject: [Nitro] Attribute Message-ID: Dear all, I am having unexpected behaviour from the cattr_accessor/mattr_accessor macros defined in lib/glue/attribute.rb Do you have any idea, what might be wrong with this implementation? The accessor methods are defined in wrong classes some times. Any help appreciated. George. -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Thu Mar 24 08:04:46 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 24 Mar 2005 15:04:46 +0200 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) Message-ID: Hello all, I just released the development code as 3 gems. They are available at: nitro.rubyforge.org These gems contain IMPORTANT bug fixes so It you are experimenting with Og and/or Nitro I suggest that you download these latest versions. The final release of version 0.14.0 will follow in the next days. regards, George. -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Thu Mar 24 08:10:45 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 24 Mar 2005 15:10:45 +0200 Subject: [Nitro] Fwd: Nitro + JSONORB In-Reply-To: <424186A3.2040705@neurogami.com> References: <424186A3.2040705@neurogami.com> Message-ID: forwarded with permission, so more people can comment on this. ---------- Forwarded message ---------- From: James Britt Date: Wed, 23 Mar 2005 08:09:23 -0700 Subject: Re: Nitro + JSONORB To: George Moschovitis George Moschovitis wrote: > Btw, > > Is there some way we could integrate your JSON library with Nitro? > Have you tried this? Any ideas? It crossed my mind, especially after I read about the alleged AJAX support in Rails (I say alleged because I think it uses HTML not XML; it's sort of AJAX-lite). I haven't used it, but I get the impression it is good for certain cases (passing complete HTML down to the client) but less so for the more general (and arguably more powerful) case where you want the client to manage complex data structures. Earlier this week, someone on the Rails list asked about integrating Orbjson with Rails; I replied with an example that took about 30 minutes to assemble, including my explanation and sample code. I'll see what's involved with doing this for Nitro. The harder part really is thinking through the API, how to make this fairly transparent to the developer. Orbjson needs a configuration hash/YAML string, which can be defined in run.rb or someplace similar, and a class that derives from the the core Orbjson::Common code. And then you just need an end point that takes the raw POST data and hands it off to that Orbjson-derived class and spits back the results. If the a N::Orbjson class were already defined, I think one could simply d this require 'nitro/json' def jsonrpc @out = Njson.process end I'm thinking now that if you allow for a default end-point of /jsonrpc there may be no need to write anything other than the service registration YAML. The controller/action part for my Rails hack was this: class ServicesController < ApplicationController def jsonrpc # Not sure of the Official Rails API for # this. I hacked my own, available upon request. post = get_raw_post_data render_text( ORBJSON.process( post ) ) end end and the endpoint was /services/jsonrpc That's something can be built-in, I think. Just define the services and Nitro would know what to do after that. Zero lines of code. "There's no step 1!" Anyway, I'll take a look. James -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Thu Mar 24 08:11:11 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 24 Mar 2005 15:11:11 +0200 Subject: [Nitro] Fwd: Nitro + JSONORB In-Reply-To: References: <424186A3.2040705@neurogami.com> Message-ID: ---------- Forwarded message ---------- From: George Moschovitis Date: Wed, 23 Mar 2005 17:24:12 +0200 Subject: Re: Nitro + JSONORB To: james_b at neurogami.com Hmm, I dont like to have a separate controller just for JSON (or REST,XMLRPC etc). I would like to use a single controller (have a look at the blog example, how this handles the rdfs). But perhaps I am wrong. -g. -- http://nitro.rubyforge.org http://www.joy.gr -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Thu Mar 24 08:11:45 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 24 Mar 2005 15:11:45 +0200 Subject: [Nitro] Fwd: Nitro + JSONORB In-Reply-To: <42419720.5010002@neurogami.com> References: <424186A3.2040705@neurogami.com> <42419720.5010002@neurogami.com> Message-ID: forwarded to the list with permision ---------- Forwarded message ---------- From: James Britt Date: Wed, 23 Mar 2005 09:19:44 -0700 Subject: Re: Nitro + JSONORB To: George Moschovitis George Moschovitis wrote: > Hmm, > > I dont like to have a separate controller just for JSON (or REST,XMLRPC etc). > I would like to use a single controller (have a look at the blog > example, how this handles the rdfs). But perhaps I am wrong. The reasons for a predefined controller is that the end-point for *-RPC tends to be fixed. For example, if I expose map.city_list, map.country_list, and football.team_names as services, all requests from the client would go to the same end-point (typically something like http://www.foo.com/RPC) All the details for what object, method, and arguments are bundled up in the POST data instead of being exposed in a GET request. That's one difference between JSON-RPC and the typical AJAX implementation. AJAX tends (I think) to function more for side-effect free data fetches, using GETs to varying end-points. What may be handy, though, and what I think people will expect, is a way to create controllers that are automatically configured as RPC services. So that one could do class Map < N::JSON_RPC def city_list # ... end end and have it available via json-rpc, as map.city_list, at the default endpoint. If the developer wants a different endpoint (or possibly more than one) perhaps these can be set up as routes or something. and of course people can register arbitrary classes using the current Orbjson config method (though I tend to think the use of controllers to wrap the actual service classes seems nicer). James > > -g. > -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com -- http://nitro.rubyforge.org http://www.joy.gr From ak at navel.gr Thu Mar 24 08:17:55 2005 From: ak at navel.gr (Anastasios Koutoumanos) Date: Thu, 24 Mar 2005 15:17:55 +0200 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) In-Reply-To: References: Message-ID: <4242BE03.5060606@navel.gr> George Moschovitis wrote: > Hello all, > > I just released the development code as 3 gems. They are available at: > > nitro.rubyforge.org > > These gems contain IMPORTANT bug fixes so It you are experimenting with > Og and/or Nitro I suggest that you download these latest versions. > > The final release of version 0.14.0 will follow in the next days. > > regards, > George. > apparently the gems do not display yet in the rubyforge download page http://rubyforge.org/frs/?group_id=418 any clue about that? -- Navel Ltd http://www.navel.gr - info at navel.gr - +30 210 6898050 Have fun: www.joy.gr/ and create: www.navel.gr/nitro From gm at navel.gr Thu Mar 24 08:21:39 2005 From: gm at navel.gr (George Moschovitis) Date: Thu, 24 Mar 2005 15:21:39 +0200 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) In-Reply-To: <4242BE03.5060606@navel.gr> References: <4242BE03.5060606@navel.gr> Message-ID: <1111670499.3541.26.camel@slude.navel.gr> > apparently the gems do not display yet in the rubyforge download page > http://rubyforge.org/frs/?group_id=418 > > any clue about that? Nope these are 'development' versions (ie something like a nightly build). They are available at: http://nitro.rubyforge.org (the homepage) The final 0.14.0 will be available in a few days. regards, George. -- web: http://www.navel.gr tel: +30 210 6898050 fax: +30 210 6898437 From ak at navel.gr Thu Mar 24 08:41:46 2005 From: ak at navel.gr (Anastasios Koutoumanos) Date: Thu, 24 Mar 2005 15:41:46 +0200 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) In-Reply-To: <1111670499.3541.26.camel@slude.navel.gr> References: <4242BE03.5060606@navel.gr> <1111670499.3541.26.camel@slude.navel.gr> Message-ID: <4242C39A.6050501@navel.gr> George Moschovitis wrote: >>apparently the gems do not display yet in the rubyforge download page >>http://rubyforge.org/frs/?group_id=418 >> >>any clue about that? > > > Nope these are 'development' versions (ie something like a nightly > build). They are available at: > > http://nitro.rubyforge.org (the homepage) > > The final 0.14.0 will be available in a few days. > > regards, > George. > > >gem install og-0.13.1.gem Attempting local installation of 'og-0.13.1.gem' -> Local installation can't proceed due to LoadError: RubyGem version error: glue(0.13.1 not = 0.13.0) Attempting remote installation of 'og-0.13.1.gem' ERROR: While executing gem ... (Gem::GemNotFoundException) Could not find og-0.13.1.gem (> 0) in the repository -- Navel Ltd http://www.navel.gr - info at navel.gr - +30 210 6898050 Have fun: www.joy.gr/ and create: www.navel.gr/nitro From james_b at neurogami.com Thu Mar 24 08:57:20 2005 From: james_b at neurogami.com (James Britt) Date: Thu, 24 Mar 2005 06:57:20 -0700 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) In-Reply-To: <1111670499.3541.26.camel@slude.navel.gr> References: <4242BE03.5060606@navel.gr> <1111670499.3541.26.camel@slude.navel.gr> Message-ID: <4242C740.7050908@neurogami.com> George Moschovitis wrote: >>apparently the gems do not display yet in the rubyforge download page >>http://rubyforge.org/frs/?group_id=418 >> >>any clue about that? > > > Nope these are 'development' versions (ie something like a nightly > build). They are available at: > > http://nitro.rubyforge.org (the homepage) > > The final 0.14.0 will be available in a few days. One should be able to do this, for example: % gem update nitro --source http://nitro.rubyforge.org/dev to fetch gems from a specific gem repository other than rubyforge.org. But that URL does not return a gem list file, which is a fairly convoluted YAML file detailing what gems are available at the URL. You can see an example at http://gems.rubyonrails.com/yaml I have to believe there is a way to auto-generate this file, but I cannot find any docs on this. James -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com From gm at navel.gr Thu Mar 24 09:00:37 2005 From: gm at navel.gr (George Moschovitis) Date: Thu, 24 Mar 2005 16:00:37 +0200 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) In-Reply-To: <4242C39A.6050501@navel.gr> References: <4242BE03.5060606@navel.gr> <1111670499.3541.26.camel@slude.navel.gr> <4242C39A.6050501@navel.gr> Message-ID: <1111672837.3541.28.camel@slude.navel.gr> > >gem install og-0.13.1.gem > Attempting local installation of 'og-0.13.1.gem' > -> Local installation can't proceed due to LoadError: RubyGem version > error: glue(0.13.1 not = 0.13.0) > Attempting remote installation of 'og-0.13.1.gem' > ERROR: While executing gem ... (Gem::GemNotFoundException) > Could not find og-0.13.1.gem (> 0) in the repository Thanks for reporting, I just uploaded a fixed gem. keep hacking :) -g. -- web: http://www.navel.gr tel: +30 210 6898050 fax: +30 210 6898437 From gm at navel.gr Thu Mar 24 09:03:32 2005 From: gm at navel.gr (George Moschovitis) Date: Thu, 24 Mar 2005 16:03:32 +0200 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) In-Reply-To: <4242C740.7050908@neurogami.com> References: <4242BE03.5060606@navel.gr> <1111670499.3541.26.camel@slude.navel.gr> <4242C740.7050908@neurogami.com> Message-ID: <1111673012.3541.32.camel@slude.navel.gr> > One should be able to do this, for example: >... > I have to believe there is a way to auto-generate this file, but I > cannot find any docs on this. Nice idea, I 'll investigate how this is done. For the moment please download the gems from the homepage, they fix an emabarassing show- stopper bug with prop_accessor and friends. regards, George. ps: also have a look at lib/nitro/caching and lib/og/mixins, I would like some ideas/suggestions. -- web: http://www.navel.gr tel: +30 210 6898050 fax: +30 210 6898437 From ak at navel.gr Thu Mar 24 09:50:09 2005 From: ak at navel.gr (Anastasios Koutoumanos) Date: Thu, 24 Mar 2005 16:50:09 +0200 Subject: [Nitro] 0.13.1 Development version available (IMPORTANT BUG FIXES) In-Reply-To: <1111672837.3541.28.camel@slude.navel.gr> References: <4242BE03.5060606@navel.gr> <1111670499.3541.26.camel@slude.navel.gr> <4242C39A.6050501@navel.gr> <1111672837.3541.28.camel@slude.navel.gr> Message-ID: <4242D3A1.7010303@navel.gr> George Moschovitis wrote: >>>gem install og-0.13.1.gem >> >>Attempting local installation of 'og-0.13.1.gem' >> -> Local installation can't proceed due to LoadError: RubyGem version >>error: glue(0.13.1 not = 0.13.0) >>Attempting remote installation of 'og-0.13.1.gem' >>ERROR: While executing gem ... (Gem::GemNotFoundException) >> Could not find og-0.13.1.gem (> 0) in the repository > > > Thanks for reporting, > > I just uploaded a fixed gem. > > keep hacking :) > > -g. > ok, finally got it to work! Now, another issue. I thought that the ruby windows oneclick installer contains the mysql bindings, apparently it does not. In fact, I tried to run the no_xsl_blog, but kept getting errors related to the MysqlAdapter. After realising that I had no mysql support bundled with the default ruby installation, I spent some time trying to configure it my own. I gave up after of 5 minutes, thinking "what the heck, why bother, ruby should be fun, not fustrating, so let's try another route!" I changed line 16 in no_xsl_blog/run.rb # :adapter => 'mysql', :adapter => 'sqlite', then crossed my fingers, and ruby run.rb. Nope... got an error again. Not giving up: >gem install sqlite, chose the 2nd option. Error again. >gem install sqlite3, error again, referring to the sqlite3.dll. Googled, browsed to http://www.sqlite.org/download.html, grabbed the http://www.sqlite.org/sqlitedll-3_2_0.zip moved the dll to the system32 folder, crossed fingers again: Voilla! I have the blog example running, feeling good, ready to start my project with nitro ;-) /t. -- Navel Ltd http://www.navel.gr - info at navel.gr - +30 210 6898050 Have fun: www.joy.gr/ and create: www.navel.gr/nitro From james_b at neurogami.com Fri Mar 25 01:23:23 2005 From: james_b at neurogami.com (James Britt) Date: Thu, 24 Mar 2005 23:23:23 -0700 Subject: [Nitro] An implemention of Orbjson in Nitro Message-ID: <4243AE5B.8080104@neurogami.com> I assembled some proof-of-concept code that allows one to create create services in Nitro with a minimum of fuss. Note that this code only works with the copy of Orbjson on my laptop; I've added/changed some methods to make the library more flexible, but have not released a new version. But you should be able to read this and see how well this might work out in real-life. All the code is bundled up for convenience, though the actual packaging would hide most of this; the user would really only need to write the Example class, while the rest just happens via Nitro libs. Keep in mind that this design is predicated in the idea that all json-rpc calls would use the same endpoint, regardless of the service invoked. #----------------------------------------------------- require 'nitro/controller' require 'Orbjson' module N class HyperActiveOrbjson include Orbjson::Common # Must have a call to init. # But seems a kludgey Orbjson::System.init( {} ) end ORBJSON = HyperActiveOrbjson.new module JSONRPC_Service def self.extend_object( o ) self.register( o.name ) end def self.register( class_name ) Logger.debug( " register( ! #{class_name}") ORBJSON.add_by_class_name( class_name ) end end end # The public URL for this service would be configurable. # My copy of run.rb has this: # dispatcher.mount( { 'service' => ServiceController } ) # so the endpoint is /service/jsonrpc # class ServiceController < N::Controller def jsonrpc post = get_raw_post_data render_text( ORBJSON.process( post ) ) end private # Hack. def get_raw_post_data x = '' context.params.each { |k, v| x = k if v == nil } x end end # This is what the user writes to # expose a class as a json-rpc service class Example extend N::JSONRPC_Service def times2( x ) x * 2 end end #------------------------------------------------- Question: should the Example class inherit from N::Controller ? Such services do not respond directly back to the client; the results a marshaled through Orbjson, as all results have to go back to the client as json-rpc response messages. James Britt -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com From george.moschovitis at gmail.com Fri Mar 25 02:32:11 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Fri, 25 Mar 2005 09:32:11 +0200 Subject: [Nitro] An implemention of Orbjson in Nitro In-Reply-To: <4243AE5B.8080104@neurogami.com> References: <4243AE5B.8080104@neurogami.com> Message-ID: Hello James, thanks for this code snippet and for your efforts! This example looks cool, I especially like the auto registration thing. By the way I 'll add a correct get_raw_post method. Do you need something else? Some remarks: - what is the URL to call this service? Something like: www.mysite.com/service/jsonrpc/example/times/x ? how does the x parameter get passet to the times method? - why do you use Needle? Is this really useful? It *seems* to be useful but I still cannot understand why. - Can we find a sorter/better name than ORBJSON / JSONRPC ? thanks, George. ps: seems to me you played quite a bit with Nitro. If you have found methos/parameters that could be named better, or snippets of code that could be improved please let me know. Nailing the API down is very importance at this moment. -- http://nitro.rubyforge.org http://www.joy.gr From james_b at neurogami.com Fri Mar 25 09:29:35 2005 From: james_b at neurogami.com (James Britt) Date: Fri, 25 Mar 2005 07:29:35 -0700 Subject: [Nitro] An implemention of Orbjson in Nitro In-Reply-To: References: <4243AE5B.8080104@neurogami.com> Message-ID: <4244204F.8000202@neurogami.com> George Moschovitis wrote: > Hello James, > > thanks for this code snippet and for your efforts! This example looks > cool, I especially like the auto registration thing. By the way I 'll > add a correct get_raw_post method. Do you need something else? > > Some remarks: > > - what is the URL to call this service? > Something like: > > www.mysite.com/service/jsonrpc/example/times/x ? > > how does the x parameter get passet to the times method? The requests are done using HTTP posts. The remote method name and all parameters are bundled up in the json-rpc message sent in the post data, so all calls use the same URL: www.mysite.com/service/jsonrpc > > - why do you use Needle? Is this really useful? It *seems* to be > useful but I still cannot understand why. I had written my own simple object registry to store service objects (basically a Hash), but felt it was too simplistic, and saw that Needle had essentially do what I wanted (plus more, really). Rather than continue to hack features on to my object registry, I decided to just reuse Needle. Less code for me to maintain. It isn't essential, of course What's needed is a way to map json-rpc requests to objects. Needle just happens to make that easy. > > - Can we find a sorter/better name than ORBJSON / JSONRPC ? JSON-RPC is the name of the remote method invocation format. My library implements an object request broker that routes json-rpc requests to objects and marshals back the response. Orbjson was just a name I picked for my library. There's nothing too remarkable going on here (a feature I like), I pretty much jut teamed up Jami Buck's Needle with Florian Franks Ruby-JSON; it may be better to just write a version specially for Nitro. I prefer, though, to think in terms of how independent libraries may be wired together, such that people need only install and use the parts they need, and others can use the libraries for their own apps/frameworks without having to buy into all the other parts. It may seem trivial, but I find it odd that in order to write a really simple database-backed Web site using Rails I have to install a mailer library, a Web services library, an AJAX lib, etc. whether I use them or not. I would prefer to see a system where I am only prompted to install code once I run a generator script that creates a dependency. > > thanks, > George. > > > ps: seems to me you played quite a bit with Nitro. If you have found > methos/parameters that could be named better, or snippets of code that > could be improved please let me know. Nailing the API down is very > importance at this moment. One thing that had me confused was how to add new controllers. After doing a contract job with Rails I cames to expect that simply defining a class as FooController would automagically make that class available as http://mysite.com/foo But I found that I could only get it to work if I explicitly registered the class with the dispatcher. But maybe that's a good thing. Recently, Hal Fulton posted a message to ruby-talk about object databases. I started a response, but didn't send it, as I was concerned that it may sound a bit too snarky (more snarky than I often am, I'm afraid). The point I was after was that writing an application where your object model was strongly influenced by your database model was a development problem because of the paradigm mismatch. Maybe my understanding of Rails is not all that good, and I can imagine ways to add extra layers of abstractions to avoid getting stuck with a rigid object <-> DB mapping. But I was also reminded of a talk Avi Bryant gave at RubyConf 2002 (I think) on Borges. He started off showing a typical command-line application, with persistent state and such. He rhetorically asked the group how much more work would be needed to turn this into a Web application, then added one line of code. The crowd though this was trickery, and it was , of course, but he then demonstrated how that one line called into his Borges library, which used continuations to maintain state in a Web application. What struck me about this, and where I think this may apply to Nitro, is that one could go write an application blissfully unconcerned for certain operating aspects, such as whether or not the code would be standalone or on the Web. There was no need to think about any of the environment scaffolding (state, templates, markup, and all the usual Web stuff) until you were ready. And what attracted me to Nitro was the idea that I could write an application without concern for the persistence model, creating my objects based on business logic, not data. Then, later, I could decide how to persist the data. The objects drove the database, not the other way around. But this approach may mean that you don't get certain things for free, simply based on naming or other coding conventions, because the philosophy behind the library is that your code should not carry too much default behavior . You write your code as you wish, then go add certain items (top-level method calls, 'requires', or something) to magically add in persistence, or Web behavior, or concurrency, or whatever the case may be. So, when you ask about suggestions on API design, I think I'm a bit unclear as to what the driving philosophy behind Nitro is, so I can't really say if it is proper to expect, for example, that classes with a certain naming convention should automatically acquire certain behavior. Hope this made at least a little sense, and if I've grossly misunderstood something please straighten me out. But it seems that Nitro/Og, and Wee, and perhaps other projects (maybe Orbjson), are or could be geared to this "don't commit to an operating environment until the last moment" style of development. With Rails, it is assumed right from the start that you plan on writing a database-backed Web application, where the data is what drives the site. Nitro/Og seems to turn this around, though there is still the assumption (I think) that you plan on using a database of some sort and presenting on the Web. Suppose you had no idea, or you have existing command-line applications that had no data persistence. Is it, or should it be, a purpose of Og/Nitro to make it easy to layer on Web presentation and a database back end? Thanks, James -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com From george.moschovitis at gmail.com Fri Mar 25 12:50:20 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Fri, 25 Mar 2005 19:50:20 +0200 Subject: [Nitro] An implemention of Orbjson in Nitro In-Reply-To: <4244204F.8000202@neurogami.com> References: <4243AE5B.8080104@neurogami.com> <4244204F.8000202@neurogami.com> Message-ID: > I had written my own simple object registry to store service objects > .. > reuse Needle. Less code for me to maintain. I think a simple hash would do the job. > It may seem trivial, but I find it odd that in order to write a really > .. > not. I think you are asked if you want to install those libraries, when performing a gem install. > One thing that had me confused was how to add new controllers. After > .. > http://mysite.com/foo Is that so, I didn't know that. But what happens if you define a helper base controller: class BaseController end class BlogController < BaseController end class UsersController < BaseController end and you don't want to expose BaseController ? Moreover, I am not sure how Rails knows how to register the controller automatically, just be defining the class. > What struck me about this, and where I think this may apply to Nitro, is > .. > drove the database, not the other way around. I think we can pursuit that goal. > But this approach may mean that you don't get certain things for free, > simply based on naming or other coding conventions, because the > philosophy behind the library is that your code should not carry too > much default behavior . Yeah, this is one of the things I don't like about Rails. That too many coding conventions are forced to the developer. Nitro will propose naming conventions and development practices without forcing a solution to the programmer. > So, when you ask about suggestions on API design, I think I'm a bit > unclear as to what the driving philosophy behind Nitro is, so I can't > really say if it is proper to expect, for example, that classes with a > certain naming convention should automatically acquire certain behavior. As I said, I would like to have name-depended behaviour optional. The driving philosophy of Nitro is to put the programmer *off* rails. That means give the programmer more freedom: If the programmer wants to create a simple php style application, he can do that without worrying about MVC and stuff. Later he can extract the business logic in model objects, and the presentation logic in actions, or he can move the templates to a separate directory. Then he can enable output caching etc, etc. Nitro suggest a directory structure but does not force this structure to the user like Rails. Check out the blog and no_xsl_blog examples to see different source code layouts. Or you can write Wee style applications with no templates (check out wee_style and why_wiki). > Hope this made at least a little sense, and if I've grossly > misunderstood something please straighten me out. This makes sense. > But it seems that Nitro/Og, and Wee, and perhaps other projects (maybe Orbjson), are or > could be geared to this "don't commit to an operating environment until > the last moment" style of development. Ok I agree. I would like to hear some more concrete suggestions about how we can achieve this. > Nitro/Og seems to turn this around, though there is still the > assumption (I think) that you plan on using a database of some sort and > presenting on the Web. This is not true. Check out the why_wiki example. Moreover there is an experimental filesystem adapter for Og. > Suppose you had no idea, or you have existing > command-line applications that had no data persistence. Is it, or > should it be, a purpose of Og/Nitro to make it easy to layer on Web > presentation and a database back end? This is a nice goal. I am open to suggestions about achieving this. regards, George. -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Fri Mar 25 13:12:09 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Fri, 25 Mar 2005 20:12:09 +0200 Subject: [Nitro] An implemention of Orbjson in Nitro In-Reply-To: References: <4243AE5B.8080104@neurogami.com> <4244204F.8000202@neurogami.com> Message-ID: By the way, let me add something to the previous email. While the goal you stated seems bothe reasonable and interesting, and I like to pursuit it, the main goal of Nitro remains: "To make possible to develop scalable web applications using Ruby" Scalable means: - you can simply add more servers to the cluster and the load gets automatically distributed. - scalable algorithms (constant time wherever possible) - scalable for the developer, Nitro will provide the tools to manage complexity. At the same time the API should stay clean and elegant. regards, George. -- http://nitro.rubyforge.org http://www.joy.gr From james_b at neurogami.com Sat Mar 26 09:05:21 2005 From: james_b at neurogami.com (James Britt) Date: Sat, 26 Mar 2005 07:05:21 -0700 Subject: [Nitro] An implemention of Orbjson in Nitro In-Reply-To: References: <4243AE5B.8080104@neurogami.com> <4244204F.8000202@neurogami.com> Message-ID: <42456C21.4080201@neurogami.com> George Moschovitis wrote: >>I had written my own simple object registry to store service objects >>.. >>reuse Needle. Less code for me to maintain. > > > I think a simple hash would do the job. Perhaps; that's what I started with. I forget now what other issues came up that led me to Needle. > > >>It may seem trivial, but I find it odd that in order to write a really >>.. >>not. > > > I think you are asked if you want to install those libraries, when performing > a gem install. Yes; I once tried declining to install ActionMailer, and the whole Rails install failed. I don't know if rubygems allows you to mark an external gem as "nice to have but not essential", but I think that those Rails gems are all marked as required. (And each time I install or upgrade Rails I wish for a way to just say "yes to all", as one has little choice to keep tapping the 'y' key.) > > >>One thing that had me confused was how to add new controllers. After >>.. >>http://mysite.com/foo > > > Is that so, I didn't know that. But what happens if you define a > helper base controller: > > class BaseController > end > > class BlogController < BaseController > end > > class UsersController < BaseController > end > > and you don't want to expose BaseController ? Don't call it *Controller ? That's the issue with auto-registration/auto-exposure sort of stuff; you want to have the most common use cases handled automatically, but leave wiggle room for people to override them. So, you can have no autoregistration of controllers (i.e. assume that people usually do not want things named *Controller to be automatically exposed via the URL), requiring manual intervention, or assume that things named *Controller are so named because they are meant to map to URLs, yet offer a way for allow people to manually hide classes when desired. > > Moreover, I am not sure how Rails knows how to register the controller > automatically, just be defining the class. Some system introspection, I'm guessing. Run through ObjectSpace at startup and see what has been defined? Ruby has assorted magical metaprogramming hooks. > ... > > >>So, when you ask about suggestions on API design, I think I'm a bit >>unclear as to what the driving philosophy behind Nitro is, so I can't >>really say if it is proper to expect, for example, that classes with a >>certain naming convention should automatically acquire certain behavior. > > > As I said, I would like to have name-depended behaviour optional. The > driving philosophy of Nitro is to put the programmer *off* rails. That > means give the programmer more freedom: If the programmer wants to > create a simple php style application, he can do that without worrying > about MVC and stuff. Later he can extract the business logic in model > objects, and the presentation logic in actions, or he can move the > templates to a separate directory. Then he can enable output caching > etc, etc. Nitro suggest a directory structure but does not force this > structure to the user like Rails. Check out the blog and no_xsl_blog > examples to see different source code layouts. Or you can write Wee > style applications with no templates (check out wee_style and > why_wiki). I looked at those last two rather quickly; I'll take another look to see how they differ from each other and other Nitro apps. James -- http://www.ruby-doc.org http://www.rubyxml.com http://catapult.rubyforge.com http://orbjson.rubyforge.com http://ooo4r.rubyforge.com http://www.jamesbritt.com From paulha at aracnet.com Sat Mar 26 12:37:23 2005 From: paulha at aracnet.com (PAUL HANCHETT) Date: Sat, 26 Mar 2005 09:37:23 -0800 Subject: [Nitro] An implemention of Orbjson in Nitro In-Reply-To: <42456C21.4080201@neurogami.com> References: <4243AE5B.8080104@neurogami.com> <4244204F.8000202@neurogami.com> <42456C21.4080201@neurogami.com> Message-ID: <42459DD3.2010602@aracnet.com> James Britt wrote: > (And each time I install or upgrade Rails I wish for a way to just say > "yes to all", as one has little choice to keep tapping the 'y' key.) --include-dependencies. Works only with the newer versions of gem. :-) Paul > From dan at zeraweb.com Sat Mar 26 18:31:26 2005 From: dan at zeraweb.com (Dan Yoder) Date: Sat, 26 Mar 2005 17:31:26 -0600 Subject: [Nitro] validation Message-ID: <77ba73454ac2a1ea361ed4e3447d07de@zeraweb.com> Are there currently (plans for?) validators for length and regular expressions? ~Dan From george.moschovitis at gmail.com Sun Mar 27 13:14:11 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Sun, 27 Mar 2005 21:14:11 +0300 Subject: Fwd: [Nitro] validation In-Reply-To: References: <77ba73454ac2a1ea361ed4e3447d07de@zeraweb.com> Message-ID: ---------- Forwarded message ---------- From: George Moschovitis Date: Sun, 27 Mar 2005 21:14:01 +0300 Subject: Re: [Nitro] validation To: Dan Yoder but they are allready available: check out lib/glue/validation.rb additional validations: lib/og/validation.rb On Sat, 26 Mar 2005 17:31:26 -0600, Dan Yoder wrote: > Are there currently (plans for?) validators for length and regular > expressions? > ~Dan > > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- http://nitro.rubyforge.org http://www.joy.gr -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Sun Mar 27 13:15:13 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Sun, 27 Mar 2005 21:15:13 +0300 Subject: [Nitro] Re: install suggestions In-Reply-To: <4ed68fa2d72d56a100ff04ee961f5a61@zeraweb.com> References: <4ed68fa2d72d56a100ff04ee961f5a61@zeraweb.com> Message-ID: Ok, nice tips, will follow your advice. -g. On Sat, 26 Mar 2005 16:38:08 -0600, Dan Yoder wrote: > okay, i've finally gotten back to working install of nitro. > > a couple of suggestions: > - set up the examples to require 'rubygems' rather than relying on the > RUBYOPT variable > (one less thing that can go wrong) > - bundle the ruby-mysql adapter with the install, or at least create a > separate gem for it > - be explicit about the required ordering of the gem installs (glue, > og, nitro) > - mention the database driver requirement in the on-line docs > - state that old versions should be uninstalled prior to upgrades (is > that true? seems like it) > > Some of these things are probably obvious to Ruby veterans ... =) ... > but may be helpful to newbies. > > Regards, > Dan > > -- http://nitro.rubyforge.org http://www.joy.gr From george.moschovitis at gmail.com Mon Mar 28 06:32:58 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Mon, 28 Mar 2005 14:32:58 +0300 Subject: [Nitro] [ANN] Nitro + Og 0.14.0, Caching, Og Lists, Important fixes Message-ID: Hello everyone, new versions of Nitro and Og where released. You can find the announcement and the files here: http://nitro.rubyforge.org If you are experimenting with Nitro you HAVE to get this release, as it containes important bug fixes. regards, George. -- http://nitro.rubyforge.org http://www.joy.gr