[ANN] Wee 0.7.0 + Tutorial Videos

  • Thread starter Michael Neumann
  • Start date
M

Michael Neumann

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&release_id=1528

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.com/128432

== Download and Installation

http://rubyforge.org/projects/wee

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?view=auto

== 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
 
K

Kent Sibilev

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.
 
M

Michael Neumann

Kent said:
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
 
I

itsme213

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"?
 
L

Lloyd Zusman

Michael Neumann said:
[ ... ]

* 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.
 
M

Michael Neumann

Lloyd said:
Michael Neumann said:
[ ... ]

* 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
 
L

Lloyd Zusman

Michael Neumann said:
Lloyd said:
[ ... ]

/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).

???
 
I

itsme213

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
 
E

Ezra Zygmuntowicz

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
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?!?
 
R

Rob Lally

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.
 
M

Michael Neumann

Lloyd said:
Lloyd said:
[ ... ]

/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).

Hm, lets try this:

ruby -rubygems -e 'require "wee"; p Wee::Md5IdGenerator'

and then this:

ruby -e 'require "wee"; p Wee::Md5IdGenerator'

Regards,

Michael
 
M

Michael Neumann

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.

There are in DIVX4 format. I'll try to convert them into some other
format. Hope that works.

Now which codec should I use?
mpeg1, mpeg2, divx3 (MSMPEG4v3), or Windows Media Video (wmv1/2).

Thanks for reporting.

Regards,

Michael
 
G

gabriele renzi

Michael Neumann ha scritto:
There are in DIVX4 format. I'll try to convert them into some other
format. Hope that works.

Now which codec should I use?
mpeg1, mpeg2, divx3 (MSMPEG4v3), or Windows Media Video (wmv1/2).

Thanks for reporting.

Divx5/Xvid :)
 
G

gabriele renzi

gabriele renzi ha scritto:

oops, the cat ate a line:
"but provide a message saying the code are tou using"
 
M

Michael Neumann

Ezra said:
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.

Please try one of the videos and report me which one works for you:

http://ruwee.de/msmpeg4.avi
http://ruwee.de/wmv1.avi
http://ruwee.de/rv10.avi

There are only 60k - 100k in size. You should see the logo and then the
first slide ("Outline"), that's all.

Sorry for the inconvienice. Next time will use a format other than mpeg4.

Regards,

Michael
 
M

Michael Neumann

gabriele said:
Michael Neumann ha scritto:



Divx5/Xvid :)

yeah, now try that with "transcode"... only ffmpeg works for me, and
even with that, I have to transcode it twice, because the first time it
is mirrored and blue/red is mixed (and -l and -k options do not work).

Hm, isn't Divx5 == HL263?

Regards,

Michael
 
G

gabriele renzi

Michael Neumann ha scritto:

yeah, now try that with "transcode"... only ffmpeg works for me, and
even with that, I have to transcode it twice, because the first time it
is mirrored and blue/red is mixed (and -l and -k options do not work).

IIRC mplayer was able to generate xvid, but I don't think you should be
forced to use a different software just for us :)
Hm, isn't Divx5 == HL263?

sorry I don't have a clue
 
K

Kevin Howe

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've released the 0.1.2 gem with updates for Wee 0.7.0 compatibility.

In the works though is Nemo 0.3.0, which introduces much change, including a
much cleaner MetaObject definition syntax, and database ORM integration.

Regards,
Kevin
 
S

Sascha Ebach

Michael said:
There are in DIVX4 format. I'll try to convert them into some other
format. Hope that works.

Now which codec should I use?

Definately XVID 1.0x if you can.

I could see the movies just fine. But that is probably because I had the
" Gordian Knot Codec Pack 1.9" installed. You can find it on
www.doom9.org for Windows.

But I don't know how to encode on BSD (which I think you use).

Thanks for the videos. Wee is an interesting alternative to Rails.

Sascha Ebach
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top