[Nitro] [NP.ORG] Nitro/Og Fora daily diggest

george.moschovitis at gmail.com george.moschovitis at gmail.com
Sun Mar 25 20:05:01 EDT 2007


>From gmosx.myopenid.com 
Date: Sun Mar 25 21:39:42 UTC 2007
Subject: Optimized UUID primary key.
Message-ID: http://www.nitroproject.org/fora/posts/view/71

Dear devs, 

I am workin on an UUID mixin for Og. It works at the moment and I am storing the UUID as a CHAR(22) using the 22 byte encoding method from the usesguid AR plugin. I would like to optimize things a bit. I would like to make uuids of objects created at the same time close to each other. 

Here are two UUIDS generated by two inserts:

dioy0y2Vur25oXaby2aq4s
dip9BW2Vur25oXaby2aq4s

these are generated with:

@oid = UUID.timestamp_create().to_s22

notice that the two keys contain a common substring. I am wondering if it would be better to have the comon part to the left of the string. Any ideas or suggestions on this?

-g.

PS: This mixin is optional. AUTOINCREMENT/SEQUENCE keys are used by default.


>From gmosx.myopenid.com 
Date: Sun Mar 25 21:34:18 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/57
Message-ID: http://www.nitroproject.org/fora/posts/view/70

Ok, I will change it more or less like you suggest. Though I think there must be some other problem with that aproach. Will have to look at this.

-g.

>From gmosx.myopenid.com 
Date: Sun Mar 25 21:33:27 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/68
Message-ID: http://www.nitroproject.org/fora/posts/view/69

Please zip the whole directory and send it to me to investigate. Are you sure you do not have an older version of Nitro in the LOAD_PATH?

-g.

>From rmela.myopenid.com 
Date: Sun Mar 25 20:02:16 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/60
Message-ID: http://www.nitroproject.org/fora/posts/view/68

Sorry -- I'd incorrectly copied my app.rb.

So far it appears to be simply that either

- A file is absent from raw/lib/raw/dispatcher/format and format from dispatcher/format.rb
- or some member of HTMLFormat needs tweaking ( e.g., @exension is currently set to "html")

I don't understand why the HTMLFormat has an @extension of "html" rather than "htmlx" while simultaneiously having the Markupfilter in it's filter chain -- perhaps HTMLFilter's @extension should be "htmlx", not "html"?

Anyhow, I do call Nitro.start -- the full program is:

require ”#{File.dirname(FILE)}/../../script/glycerin”
require “nitro”
include Nitro

class Foo

  def index
    print “Hello World”
  end

  def foo
  end

end

Nitro.start foo

Again, the behavior is as described above.

My fix was to define an XHTMLTemplate class in a new file raw/lib/raw/dispatcher/format/xhtml.rb, and add it to the STANDARD_FORMATS list in raw/lib/raw/dispatcher/format.rb

Finally -- all that's changed for templates is the extension, correct?   That .xhtml has simply been *renamed* to .htmlx?

I did change the extension to htmlx, and it appears the only location from which the controller would retrieve the template was from the template directory directly beneath it -- not from app/template.  I suppose this is a configurable, and I should look to application.rb, dispatcher.rb, or 





>From gmosx.myopenid.com 
Date: Sun Mar 25 15:29:32 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/66
Message-ID: http://www.nitroproject.org/fora/posts/view/67

Also have a look at the code attached to this post. As you can see, Object.to_data does not handle collections as expected.

-g.


>From gmosx.myopenid.com 
Date: Sun Mar 25 10:17:23 UTC 2007
Subject: Better to_json method for Facets
Message-ID: http://www.nitroproject.org/fora/posts/view/66

I would like to suggest a better (?) Object.to_json method:

<code><
class Object
  def to_json
    JSON.unparse(self.class.name.demodulize.underscore => to_data)
  end
end
</code>

Tom, what do you think? A  similar to_xml function would be very useful as well.

regards,
George.

>From gmosx.myopenid.com 
Date: Sun Mar 25 09:18:31 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/64
Message-ID: http://www.nitroproject.org/fora/posts/view/65

<blockquote>
Is there an initialization step I’m missing?
</blockquote>

You have to call:

Nitro.start(Foo)

Or more verbose:

app = Application.new
app.dispatcher.root = Foo
app.start

try this and let me know if it works. For more details have a look at the examples dir.


>From rmela.myopenid.com 
Date: Sun Mar 25 01:17:51 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/60
Message-ID: http://www.nitroproject.org/fora/posts/view/64

Well, it's working, but the way I had to go about it leads me to believe something's askew.

My repo.nitroproject.org/examples/foo/app.rb is:

require "#{File.dirname(__FILE__)}/../../script/glycerin"
require "nitro"
include Nitro

class Foo

  def index
    print "Hello World"
  end

  def foo
  end

end


I tried foo.html, foo.xhtml, and foo.htmlx in each of

./public/
./template/
./app/template/

The only thing that rendered was public/foo.html

Here's the workaround ( fix? ):

I created raw/lib/raw/dispatcher/format/xhtml.rb with a class XHTMLFormat.   In format.rb I added

  require "raw/dispatcher/format/xhtml"

and changed

  STANDARD_FORMATS = FormatManager.new(
     HTMLFormat, ATOMFormat, RSSFormat, JSONFormat, XOXOFormat
   )

to 

   STANDARD_FORMATS = FormatManager.new(
      HTMLFormat, ATOMFormat, RSSFormat, JSONFormat, XOXOFormat, XHTMLFormat
   )


After that, the following were rendered:

public/foo.html ( foo.htmlx and foo.xhtml ignored if in public/ )
template/foo.xhtml (foo.html and foo.htmlx ingored if in template/ )

public/foo.html takes precedence over template/foo.xhtml

Nothing in app/template/ is rendered ( not foo.html, nor foo.xhtml, nor foo.htmlx  )

Is there an initialization step I'm missing?   Or 




--
This mail is automatically generated from the http://nitroproject.org/fora
digest robot. It presents the discussions in the fora during the last 24 hours.
Do not reply to this email.


More information about the Nitro-general mailing list