From mneumann at ntecs.de Wed Jan 26 15:38:38 2005 From: mneumann at ntecs.de (Michael Neumann) Date: Wed, 26 Jan 2005 21:38:38 +0100 Subject: [Nitro-general] Re: Og boolean datatype In-Reply-To: References: <41F78D54.3090706@ntecs.de> Message-ID: <41F7FFCE.5020700@ntecs.de> I CC'ed you, as I'm not sure you are already subscribed to the mailing-list... George Moschovitis wrote: >>How would one do the 'done bit default 0' column in Og? Is there a >>Boolean datatype in Og? > > > After all, there is a boolean: > > TrueClass => 'boolean' > > so just use: > > prop_accessor :done, TrueClass, sql => 'bit default 0' Okay, the SQL does not work... wrong default values for bit datatype says Postgres... But if I just do: prop_accessor :done, TrueClass then the table is created correctly, and I can insert values for that column correctly BUT I can't retrieve them! For some reason I always get 'false' back as a result, even if the column is 'true' in the database. Regards, Michael From george.moschovitis at gmail.com Thu Jan 27 03:30:03 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 27 Jan 2005 10:30:03 +0200 Subject: [Nitro] Test Message-ID: This is a test, ignore -- www.rubyforge.com/projects/nitro www.joy.gr From george.moschovitis at gmail.com Thu Jan 27 03:33:08 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 27 Jan 2005 10:33:08 +0200 Subject: [Nitro] Og Boolean datatype Message-ID: Hello Michael, > But if I just do: > prop_accessor :done, TrueClass > then the table is created correctly, and I can insert values for > that column correctly BUT I can't retrieve them! For some > reason I always get > 'false' back as a result, even if the column is 'true' in the > database. thanks for this bug report, I 'll investigate and fix later today, and send you the patched version! -.g -- www.rubyforge.com/projects/nitro www.joy.gr From ak at navel.gr Thu Jan 27 07:15:26 2005 From: ak at navel.gr (Anastasios Koutoumanos) Date: Thu, 27 Jan 2005 14:15:26 +0200 Subject: [Nitro] Nitro is great, at least for GIS ;-) Message-ID: <41F8DB5E.2020600@navel.gr> Hello everybody, I have been using Nitro for a small GIS-related project and it's proven of great help! We have managed to develop simple web services that interact with multiple databases and other web services in less than an hour! I'll try to invest some time in the next weeks to improve some bits in the source code and maybe help with the documentation. At last, after all these years of fustration, we have a nice web application platform to work with :-) Tasos, aka drak -- Navel, Greece : www.navel.gr Come and joy! : www.joy.gr From george.moschovitis at gmail.com Thu Jan 27 09:26:43 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 27 Jan 2005 16:26:43 +0200 Subject: [Nitro] Re: fixed boolean In-Reply-To: <41F8F8AF.5080206@ntecs.de> References: <41F8F8AF.5080206@ntecs.de> Message-ID: Thanks, Do you know that there is a scaffolder and a FormBuilder (like Nemo) in nitro that utilizes the Og metadata? (btw did I tell you that the new Nitro will ROCK? :) -g. On Thu, 27 Jan 2005 15:20:31 +0100, Michael Neumann wrote: > George Moschovitis wrote: > > here is the fixed gem > > Thanks so much! I'm now taking the time to make my Og scaffolder more > like Rails one (similar as in the onlamp article). > > By using Og, I believe, the whole onlamp article would be only 1/3 of > the size, which is good for the developer but bad for the author ;-) > > __props is a nice thing in Og ;-) > > Regards, > > Michael -- www.rubyforge.com/projects/nitro www.joy.gr From mneumann at ntecs.de Thu Jan 27 10:34:40 2005 From: mneumann at ntecs.de (Michael Neumann) Date: Thu, 27 Jan 2005 16:34:40 +0100 Subject: [Nitro] Re: fixed boolean In-Reply-To: References: <41F8F8AF.5080206@ntecs.de> <41F8FFF6.1080109@ntecs.de> Message-ID: <41F90A10.5050102@ntecs.de> George Moschovitis wrote: >>BTW, do you have a cryptographical secure session-id generator that I >>can copy? IOWA ships with an ISAAC implementation. > > > i changed the session id generation in the current version. I used the code from > cgi.rb session (matz) Could you give a little example on how you generate just a session-id? >>BTW2: What's the license of Nitro. Is it Ruby's or LGPL... not sure >>whether there would be license-compatibility problems if I copy code >>from you... uhm... otherwise I take your code as an example and recode >>it... ;-) > > > BSD licence, you can copy the code :) But it would be nice to mention > the original place :) That's just fine ;-) I've now taken a look at your FormBuilder. How exactly can I define those meta-attributes? I saw, you use meta[:ui] == :textarea... Ah sorry, I found it already myself: prop_accessor :attr, :ui => :textarea will do. Thanks. Regards, Michael From george.moschovitis at gmail.com Thu Jan 27 10:41:34 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 27 Jan 2005 17:41:34 +0200 Subject: [Nitro] Re: fixed boolean In-Reply-To: <41F90A10.5050102@ntecs.de> References: <41F8F8AF.5080206@ntecs.de> <41F8FFF6.1080109@ntecs.de> <41F90A10.5050102@ntecs.de> Message-ID: > Could you give a little example on how you generate just a session-id? Sure: # Calculates a unique id. # # The session id must be unique, a monotonically # increasing function like time is appropriate. Random # may produce equal ids? add a prefix (SALT) to stop # hackers from creating session_ids. def create_id now = Time.now md5 = Digest::MD5.new md5.update(now.to_s) md5.update(now.usec.to_s) md5.update(rand(0).to_s) md5.update(Session.session_id_salt) md5.hexdigest end > I've now taken a look at your FormBuilder. How exactly can I define > those meta-attributes? I saw, you use meta[:ui] == :textarea... > Ah sorry, I found it already myself: > > prop_accessor :attr, :ui => :textarea > > will do. As you can see the FormBuilder is under construction, If you have any good ideas, let me know :) I do have some cool ideas for this, you will see in Nitro 0.10.0 :) regards, George. -- www.rubyforge.com/projects/nitro www.joy.gr From george.moschovitis at gmail.com Thu Jan 27 10:57:27 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 27 Jan 2005 17:57:27 +0200 Subject: [Nitro] RubyGems Message-ID: Hello, I would like to make Og/Nitro more RubyGems friendly. I would like to use require_gem '...' everywhere instead of code like: $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') everywhere. How can I use require_gem in a Software Configuration environment (Subversion) ? -g. -- www.rubyforge.com/projects/nitro www.joy.gr From mneumann at ntecs.de Thu Jan 27 11:29:38 2005 From: mneumann at ntecs.de (Michael Neumann) Date: Thu, 27 Jan 2005 17:29:38 +0100 Subject: [Nitro] Re: fixed boolean In-Reply-To: References: <41F8F8AF.5080206@ntecs.de> <41F8FFF6.1080109@ntecs.de> <41F90A10.5050102@ntecs.de> Message-ID: <41F916F2.7070905@ntecs.de> George Moschovitis wrote: >>Could you give a little example on how you generate just a session-id? > > > Sure: > > # Calculates a unique id. > # > # The session id must be unique, a monotonically > # increasing function like time is appropriate. Random > # may produce equal ids? add a prefix (SALT) to stop > # hackers from creating session_ids. > > def create_id > now = Time.now > md5 = Digest::MD5.new > md5.update(now.to_s) > md5.update(now.usec.to_s) > md5.update(rand(0).to_s) > md5.update(Session.session_id_salt) > md5.hexdigest > end Thanks. Will use this as default session-id generator until I include ISAAC. >>I've now taken a look at your FormBuilder. How exactly can I define >>those meta-attributes? I saw, you use meta[:ui] == :textarea... >>Ah sorry, I found it already myself: >> >> prop_accessor :attr, :ui => :textarea >> >>will do. > > > As you can see the FormBuilder is under construction, If you have any > good ideas, let me know :) I do have some cool ideas for this, you > will see in Nitro 0.10.0 :) Mine is called OgScaffolder::Editor. I factored the rendering into following methods: * render (top level) -> calls render_property for each property -> then calls render_buttons * render_property -> calls render_label -> then calls depending on the property type one of render_numeric, render_string, render_bool etc. This makes it easier to customize layout. My editor also does not render a
tag, this can be done by adding a FormDecoration to the component. The advantage: You can put as many Editors on a page as you like, and when you hit a button, you don't loose what you entered in the other forms. If you click Save or Cancel, my editor returns (answers), so that you can use it like this: def show_editor call Editor.new(Customer.new), :on_answer end def on_answer(res) ... end Of course you can use it without using #call. But then you have to wrap it with a AnswerDecoration. Then I'll have a OgScaffolder::ListView which shows multiple domain-objects in a table. Regards, Michael From george.moschovitis at gmail.com Thu Jan 27 11:54:52 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Thu, 27 Jan 2005 18:54:52 +0200 Subject: [Nitro] Re: fixed boolean In-Reply-To: <41F916F2.7070905@ntecs.de> References: <41F8F8AF.5080206@ntecs.de> <41F8FFF6.1080109@ntecs.de> <41F90A10.5050102@ntecs.de> <41F916F2.7070905@ntecs.de> Message-ID: > Mine is called OgScaffolder::Editor. I factored the rendering into > ... > Then I'll have a OgScaffolder::ListView which shows multiple > domain-objects in a table. Seems to me, we are writing the same code twice :( For example I am planning to do a TableBuilder that does this. We should probably synchronize our efforts and build something together. But then again, perhaps it is better If you go alone and create your version, so we can compare the two aproaches afterwards. -g. PS: updating Nitro 'docs' right now, this is pain in the a**. -- www.rubyforge.com/projects/nitro www.joy.gr From mneumann at ntecs.de Thu Jan 27 12:37:20 2005 From: mneumann at ntecs.de (Michael Neumann) Date: Thu, 27 Jan 2005 18:37:20 +0100 Subject: [Nitro] Again boolean bug in Og Message-ID: <41F926D0.1000201@ntecs.de> Hi, The version you send me has still problems. If I reload the domain object, the boolean value is always "false". It's due to: UPDATE..... done=true And then in self.read_prop (Pg backend) you do: 't' == res.getvalue(...) This patch will help: --- psql.rb.old 2005-01-27 18:31:05.000000000 +0100 +++ psql.rb 2005-01-27 18:36:56.000000000 +0100 @@ -111,7 +111,7 @@ elsif p.klass.ancestors.include?(Date) return %|#\{@#{p.symbol} ? "'#\{Og::PsqlBackend.date(@#{p.symbol})\}'" : 'NULL'\}| elsif p.klass.ancestors.include?(TrueClass) - return "#\{@#{p.symbol} || 'NULL'\}" + return "#\{@#{p.symbol} ? \"'t'\" : 'NULL' \}" else return %|#\{@#{p.symbol} ? "'#\{Og::PsqlBackend.escape(@#{p.symbol}.to_yaml)\}'" : "''"\}| end Regards, Michael From mneumann at ntecs.de Thu Jan 27 12:52:11 2005 From: mneumann at ntecs.de (Michael Neumann) Date: Thu, 27 Jan 2005 18:52:11 +0100 Subject: [Nitro] RubyGems In-Reply-To: References: Message-ID: <41F92A4B.8070904@ntecs.de> George Moschovitis wrote: > Hello, > > I would like to make Og/Nitro more RubyGems friendly. I would like to > use require_gem '...' everywhere instead of code like: > > $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') > > everywhere. How can I use require_gem in a Software Configuration > environment (Subversion) ? Why not just provide a install.rb file as I did last night? ;-) Would be wonderful if RPA would still be alive... I am not sure whether it's alive, but in this respect it's a great project. Regards, Michael From george.moschovitis at gmail.com Fri Jan 28 03:36:06 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Fri, 28 Jan 2005 10:36:06 +0200 Subject: [Nitro] Again boolean bug in Og In-Reply-To: <41F926D0.1000201@ntecs.de> References: <41F926D0.1000201@ntecs.de> Message-ID: Ok, thank you very much for the patch, I 'll add it! -g. On Thu, 27 Jan 2005 18:37:20 +0100, Michael Neumann wrote: > Hi, > > The version you send >... eral at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- www.rubyforge.com/projects/nitro www.joy.gr From george.moschovitis at gmail.com Fri Jan 28 03:36:42 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Fri, 28 Jan 2005 10:36:42 +0200 Subject: [Nitro] RubyGems In-Reply-To: <41F92A4B.8070904@ntecs.de> References: <41F92A4B.8070904@ntecs.de> Message-ID: > Why not just provide a install.rb file as I did last night? ;-) Will do, but I prefer the gems solution. -- www.rubyforge.com/projects/nitro www.joy.gr From george.moschovitis at gmail.com Mon Jan 31 06:10:41 2005 From: george.moschovitis at gmail.com (George Moschovitis) Date: Mon, 31 Jan 2005 13:10:41 +0200 Subject: [Nitro] Rubyforge feature tracker Message-ID: Hello Michael, thanks for using the feature tracker in Rubyforge, this is very helpful. I implemented your requests. regards, George -- www.rubyforge.com/projects/nitro www.joy.gr