[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Wee 0.7.0 + Tutorial Videos

Michael Neumann

2/1/2005 8:45:00 PM

Hi,

Wee 0.7.0 is out! In addition, I've recorded three tutorial sessions (screen
captures). You can download the MPEGs via BitTorrent here:

http://rubyforge.org/frs/?group_id=427&relea...

I'm open for suggestions and thankful for comments. If possible, please let
you BitTorrent client open.

The first tutorial is about installing Wee, creating an initial skeleton
application, simple forms and explains briefly decorations. The second is
about subcomponents and backtracking. The third is on using Wee together with
Og and a Postgres database.

== Philosophy/Features of Wee

http://rubytalk....

== Download and Installation

http://rubyforge.org/pr...

gem install wee

Have a look at the 'wee' command!

== ChangeLog

Major changes (compared to 0.5.0) are:

* Added ERB-templating. Example:

# file: ~/components/main.rb
class Test < Wee::Component

# use template '~/components/main.tpl'
template :render

# use template '~/components/main.tpl-buttons'
template :render_buttons
end

This allows you to use ERB-templates instead of the render_XXX
methods. You can also call render_XXX methods from ERB, back and
forth. The template file is relative to the file from which the
'template :symbol' call is executed. The template method optionally
takes the two hash-parameters :file and :property.

* Added "Pageless" mode. In pageless mode, the URL displayed in your
browser always looks like "/app". The session id is stored as cookie
and there is no page_id, hence "pageless" mode. No backtracking is
performed! Example:

require 'wee/pageless'

app = Wee::Utils.app_for(YourMainComponent,
:session => Wee::PagelessSession,
:application => Wee::PagelessApplication)

Wee::WEBrickAdaptor.
request_class(Wee::PagelessRequest).
register('/app' => app).
start

* Added named callbacks. Example:

r.anchor.named_callback('test') { ... }

will use 'test' as callback_id instead of a generic one.

* added 'wee' binary which generates a sample application and
recommended directory structure for you (similar to the 'rails' command).

* Wee::Request: Refactored a lot. Use =/ instead of @ as delimeter for
the request_handler_id/page_id part ('@' looks ugly in Konqueror, as
it is displayed as '%40')

* Implemented a new OgScaffolder, which now is more like the Rails one.

Changes that break compatibility:

* Wee::LiteralMethodCallback and Component#call: Additional arguments
are now prepended instead of appended. Example:

call MessageBox.new('msg'), :confirm, 1

def confirm(one, msgbox_result)
end

* Methods ImageTag#src_for and GenericTagBrush#css_class_for no more
prepend 'img.' or 'css.' in front of the property name.

* Method Wee::Utils.app_for: Removed the id_seed option. Use id_gen
instead, which expects a IdGenerator object (default is now the much more
secure Md5IdGenerator).

* SelectListTag (r.select_list): NON-backwards-compatible change!!!
If it's NOT a multiple select list, then the callback is called
with the choosen value (instead of an array of one element). Method
#selected requires a single value in the same way. No changes if it's
a multiple-select list!

For the full list of changes see:

http://www.ntecs.de/viewcvs/viewcvs/Wee/trunk/ChangeLog...

== Hello World

require 'wee'

class HelloWorld < Wee::Component
def click
@clicks = (@clicks || 0) + 1
end

def render
r.h1.onclick_callback(:click).with("Hello World!")
r.text "#{ @clicks || 'No' } clicks"
end
end

# And start the WEBrick web-server
require 'wee/utils'
require 'wee/adaptors/webrick'

app = Wee::Utils.app_for {
HelloWorld.new.add_decoration(Wee::PageDecoration.new("Hello World"))
}
Wee::WEBrickAdaptor.register('/app' => app).start

Make sure you run this application with the -rubygems option. Then point your
browser to http://localhost:2000/app and click on the h1-header. Every time
you click on it, you should see that the number of clicks increases. Have fun!

== Future?

I'd like improve the integration of models with Wee.

Regards,

Michael


26 Answers

Kent Sibilev

2/2/2005 4:53:00 AM

0

I'm playing with the wee and so far it looks very interesting. I hope
I'll get more understanding after following tutorial videos (tahnks for
those btw). The only minor thing I have noticed is that calendar.rb
example seems to be a little bit outdated. The following change fixed
it for me:

@@ -343,9 +343,7 @@
# Call the calendar component
#
def calendar()
- if date = call( CustomCalendar.new(@date) )
- @date = date
- end
+ call( CustomCalendar.new(@date), lambda { |date| @date = date if
date })
end
end

Cheers,
Kent.

On Feb 1, 2005, at 3:44 PM, Michael Neumann wrote:

> Hi,
>
> Wee 0.7.0 is out! In addition, I've recorded three tutorial sessions
> (screen
> captures). You can download the MPEGs via BitTorrent here:
>
> http://rubyforge.org/frs/?group_id=427&relea...
>
> I'm open for suggestions and thankful for comments. If possible,
> please let
> you BitTorrent client open.
>
> The first tutorial is about installing Wee, creating an initial
> skeleton
> application, simple forms and explains briefly decorations. The second
> is
> about subcomponents and backtracking. The third is on using Wee
> together with
> Og and a Postgres database.
>
> == Philosophy/Features of Wee
>
> http://rubytalk....
>
> == Download and Installation
>
> http://rubyforge.org/pr...
>
> gem install wee
>
> Have a look at the 'wee' command!
>
> == ChangeLog
>
> Major changes (compared to 0.5.0) are:
>
> * Added ERB-templating. Example:
>
> # file: ~/components/main.rb
> class Test < Wee::Component
>
> # use template '~/components/main.tpl'
> template :render
>
> # use template '~/components/main.tpl-buttons'
> template :render_buttons
> end
>
> This allows you to use ERB-templates instead of the render_XXX
> methods. You can also call render_XXX methods from ERB, back and
> forth. The template file is relative to the file from which the
> 'template :symbol' call is executed. The template method optionally
> takes the two hash-parameters :file and :property.
>
> * Added "Pageless" mode. In pageless mode, the URL displayed in your
> browser always looks like "/app". The session id is stored as cookie
> and there is no page_id, hence "pageless" mode. No backtracking is
> performed! Example:
>
> require 'wee/pageless'
>
> app = Wee::Utils.app_for(YourMainComponent,
> :session => Wee::PagelessSession,
> :application => Wee::PagelessApplication)
>
> Wee::WEBrickAdaptor.
> request_class(Wee::PagelessRequest).
> register('/app' => app).
> start
>
> * Added named callbacks. Example:
>
> r.anchor.named_callback('test') { ... }
>
> will use 'test' as callback_id instead of a generic one.
>
> * added 'wee' binary which generates a sample application and
> recommended directory structure for you (similar to the 'rails'
> command).
>
> * Wee::Request: Refactored a lot. Use =/ instead of @ as delimeter for
> the request_handler_id/page_id part ('@' looks ugly in Konqueror, as
> it is displayed as '%40')
>
> * Implemented a new OgScaffolder, which now is more like the Rails
> one.
>
> Changes that break compatibility:
>
> * Wee::LiteralMethodCallback and Component#call: Additional arguments
> are now prepended instead of appended. Example:
>
> call MessageBox.new('msg'), :confirm, 1
>
> def confirm(one, msgbox_result)
> end
>
> * Methods ImageTag#src_for and GenericTagBrush#css_class_for no more
> prepend 'img.' or 'css.' in front of the property name.
>
> * Method Wee::Utils.app_for: Removed the id_seed option. Use id_gen
> instead, which expects a IdGenerator object (default is now the
> much more
> secure Md5IdGenerator).
>
> * SelectListTag (r.select_list): NON-backwards-compatible change!!!
> If it's NOT a multiple select list, then the callback is called
> with the choosen value (instead of an array of one element). Method
> #selected requires a single value in the same way. No changes if
> it's
> a multiple-select list!
>
> For the full list of changes see:
>
> http://www.ntecs.de/viewcvs/viewcvs/Wee/trunk/ChangeLog...
>
> == Hello World
>
> require 'wee'
>
> class HelloWorld < Wee::Component
> def click
> @clicks = (@clicks || 0) + 1
> end
>
> def render
> r.h1.onclick_callback(:click).with("Hello World!")
> r.text "#{ @clicks || 'No' } clicks"
> end
> end
>
> # And start the WEBrick web-server
> require 'wee/utils'
> require 'wee/adaptors/webrick'
>
> app = Wee::Utils.app_for {
> HelloWorld.new.add_decoration(Wee::PageDecoration.new("Hello
> World"))
> }
> Wee::WEBrickAdaptor.register('/app' => app).start
>
> Make sure you run this application with the -rubygems option. Then
> point your
> browser to http://localhost:2000/app and click on the h1-header.
> Every time
> you click on it, you should see that the number of clicks increases.
> Have fun!
>
> == Future?
>
> I'd like improve the integration of models with Wee.
>
> Regards,
>
> Michael
>



Michael Neumann

2/2/2005 9:52:00 AM

0

Kent Sibilev wrote:
> I'm playing with the wee and so far it looks very interesting. I hope
> I'll get more understanding after following tutorial videos (tahnks for
> those btw). The only minor thing I have noticed is that calendar.rb
> example seems to be a little bit outdated. The following change fixed it
> for me:
>
> @@ -343,9 +343,7 @@
> # Call the calendar component
> #
> def calendar()
> - if date = call( CustomCalendar.new(@date) )
> - @date = date
> - end
> + call( CustomCalendar.new(@date), lambda { |date| @date = date if
> date })
> end
> end

Thanks. Either your patch solves this, or put a require
'wee/continuation' at the top. There are probably some other examples
broken.

Regards,

Michael


Its Me

2/2/2005 11:34:00 PM

0

> Wee 0.7.0 is out!

I'm having trouble getting Nemo to run with Wee 0.7.0. Any ideas?

> I'd like improve the integration of models with Wee.
What kinds of "models"?

Michael Neumann

2/3/2005 12:33:00 AM

0

itsme213@hotmail.com wrote:
>>Wee 0.7.0 is out!
>
>
> I'm having trouble getting Nemo to run with Wee 0.7.0. Any ideas?

Yes. You should wait for Nemo 0.3.0.

>>I'd like improve the integration of models with Wee.
>
> What kinds of "models"?

database models.

Regards,

Michael


Lloyd Zusman

2/3/2005 12:44:00 AM

0

Michael Neumann <mneumann@ntecs.de> writes:
>
> [ ... ]
>
> * Added "Pageless" mode. In pageless mode, the URL displayed in your
> browser always looks like "/app". The session id is stored as cookie
> and there is no page_id, hence "pageless" mode. No backtracking is
> performed! Example:
>
> require 'wee/pageless'
>
> app = Wee::Utils.app_for(YourMainComponent,
> :session => Wee::PagelessSession,
> :application => Wee::PagelessApplication)
>
> Wee::WEBrickAdaptor.
> request_class(Wee::PagelessRequest).
> register('/app' => app).
> start

Thank you for all your great work on wee.

I got the following error when trying to invoke an example in
"Pageless" mode (wrapped to fit it better in this email message):

/usr/local/lib/ruby/gems/1.9/gems/wee-0.7.0/lib/wee/utils/helper.rb:29:
in `app_for': uninitialized constant Wee::Md5IdGenerator (NameError)
from ./hello-wee.rb:22

Here's my code:

#!/usr/bin/ruby

require 'rubygems'
require 'wee'
require 'wee/pageless'
require 'wee/utils'
require 'wee/adaptors/webrick'

class HelloWorld < Wee::Component
def click
@clicks = (@clicks || 0) + 1
end

def render
r.h1.onclick_callback(:click).with("Hello World!")
r.text "#{ @clicks || 'No' } clicks"
end
end

app = Wee::Utils.app_for(
HelloWorld.new.add_decoration(
Wee::PageDecoration.new("Hello World")),
:session => Wee::PagelessSession,
:application => Wee::PagelessApplication
)

Wee::WEBrickAdaptor.
request_class(Wee::PagelessRequest).
register('/app' => app).start

Any ideas as to what the problem might be?

Thanks in advance.


--
Lloyd Zusman
ljz@asfast.com
God bless you.



Michael Neumann

2/3/2005 1:40:00 AM

0

Lloyd Zusman wrote:
> Michael Neumann <mneumann@ntecs.de> writes:
>
>>[ ... ]
>>
>> * Added "Pageless" mode. In pageless mode, the URL displayed in your
>> browser always looks like "/app". The session id is stored as cookie
>> and there is no page_id, hence "pageless" mode. No backtracking is
>> performed! Example:
>>
>> require 'wee/pageless'
>>
>> app = Wee::Utils.app_for(YourMainComponent,
>> :session => Wee::PagelessSession,
>> :application => Wee::PagelessApplication)
>>
>> Wee::WEBrickAdaptor.
>> request_class(Wee::PagelessRequest).
>> register('/app' => app).
>> start
>
>
> Thank you for all your great work on wee.
>
> I got the following error when trying to invoke an example in
> "Pageless" mode (wrapped to fit it better in this email message):
>
> /usr/local/lib/ruby/gems/1.9/gems/wee-0.7.0/lib/wee/utils/helper.rb:29:
> in `app_for': uninitialized constant Wee::Md5IdGenerator (NameError)
> from ./hello-wee.rb:22
>
> Here's my code:
>
> #!/usr/bin/ruby
>
> require 'rubygems'
> require 'wee'
> require 'wee/pageless'
> require 'wee/utils'
> require 'wee/adaptors/webrick'
>
> class HelloWorld < Wee::Component
> def click
> @clicks = (@clicks || 0) + 1
> end
>
> def render
> r.h1.onclick_callback(:click).with("Hello World!")
> r.text "#{ @clicks || 'No' } clicks"
> end
> end
>
> app = Wee::Utils.app_for(
> HelloWorld.new.add_decoration(
> Wee::PageDecoration.new("Hello World")),
> :session => Wee::PagelessSession,
> :application => Wee::PagelessApplication
> )

First argument of app_for is the root-component class, not an object
thereof. An object does not work, as each session needs it's own root
component object. So you should use a block:

app = Wee::Utils.app_for(
nil,
:session => Wee::PagelessSession,
:application => Wee::PagelessApplication
) {
HelloWorld.new.add_decoration(
Wee::PageDecoration.new("Hello World"))
}

That should work, despite that it look a little bit ugly ;-)

Regards,

Michael


Lloyd Zusman

2/3/2005 1:58:00 AM

0

Michael Neumann <mneumann@ntecs.de> writes:

> Lloyd Zusman wrote:
>>
>> [ ... ]
>>
>> /usr/local/lib/ruby/gems/1.9/gems/wee-0.7.0/lib/wee/utils/helper.rb:29:
>> in `app_for': uninitialized constant Wee::Md5IdGenerator (NameError)
>> from ./hello-wee.rb:22
>> Here's my code:
>> #!/usr/bin/ruby
>> require 'rubygems'
>> require 'wee'
>> require 'wee/pageless'
>> require 'wee/utils'
>> require 'wee/adaptors/webrick'
>> class HelloWorld < Wee::Component
>> def click
>> @clicks = (@clicks || 0) + 1
>> end
>> def render
>> r.h1.onclick_callback(:click).with("Hello World!")
>> r.text "#{ @clicks || 'No' } clicks"
>> end
>> end
>> app = Wee::Utils.app_for(
>> HelloWorld.new.add_decoration(
>> Wee::PageDecoration.new("Hello World")),
>> :session => Wee::PagelessSession,
>> :application => Wee::PagelessApplication
>> )
>
> First argument of app_for is the root-component class, not an object
> thereof. An object does not work, as each session needs it's own root
> component object. So you should use a block:
>
> app = Wee::Utils.app_for(
> nil,
> :session => Wee::PagelessSession,
> :application => Wee::PagelessApplication
> ) {
> HelloWorld.new.add_decoration(
> Wee::PageDecoration.new("Hello World"))
> }
>
> That should work, despite that it look a little bit ugly ;-)

Thank you very much ... but sadly, I did this and got the same error
message (see above).

???

--
Lloyd Zusman
ljz@asfast.com
God bless you.



Its Me

2/3/2005 6:44:00 AM

0

Michael, I may be doing something wrong, but none of the MPEGs worked
for me (with both WinDVD and MS Windows Media Player). Just thought I'd
let you know.

Thanks

Ezra Zygmuntowicz

2/3/2005 8:03:00 AM

0

I could not get the videos to work either. On OS, Linux or Win. All it
showed was the starting screen that said WEE and that was all. I would
really like to chekc them out though if you could repost some different
vids.
-Thanks
On Feb 2, 2005, at 10:45 PM, itsme213@hotmail.com wrote:

> Michael, I may be doing something wrong, but none of the MPEGs worked
> for me (with both WinDVD and MS Windows Media Player). Just thought I'd
> let you know.
>
> Thanks
>
>
>
Mail from ezmobius1 won't change you life or will it?!?



Rob Lally

2/3/2005 9:32:00 AM

0

They worked fine for me on a windows XP box using windows media player 9.

Well fine except for a few garbled bits in the middle, but they looked like the screen capture software had lost it a
bit rather than a problem with the recording itself.

BTW - The videos were most enlightening.

R.

Ezra Zygmuntowicz wrote:

> I could not get the videos to work either. On OS, Linux or Win. All it
> showed was the starting screen that said WEE and that was all. I would
> really like to chekc them out though if you could repost some different
> vids.
> -Thanks
> On Feb 2, 2005, at 10:45 PM, itsme213@hotmail.com wrote:
>
>> Michael, I may be doing something wrong, but none of the MPEGs worked
>> for me (with both WinDVD and MS Windows Media Player). Just thought I'd
>> let you know.
>>
>> Thanks
>>
>>
>>
> Mail from ezmobius1 won't change you life or will it?!?
>
>
>