r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Power Mezz] Discussions of the Power Mezz

Pekr
27-Jan-2010
[9x2]
I use another nice stuff from Gabriele in there :-) I do remember, 
that some nice libs were created even for the Detective. But maybe 
Gabriele wants to keep Qtask related stuff separated?
IIRC, there was nice auto-update library for e.g., async call, or 
something like that ...
Gabriele
27-Jan-2010
[11]
if i had the time, i would add everything to the power mezz. the 
detective stuff needs some work though before being added here. (convert 
to a module, change the format, add tests if possible, and so on)
Ashley
27-Jan-2010
[12]
Thankyou for that, I can particularly relate to "reduce the need 
of reinventing the wheel for each developer"! Documentation is first 
rate as well (both presentation and content). Congrats to all involved.
Will
27-Jan-2010
[13x3]
Grazie Gabriele, Thank you Reichart ! 8-)
links for "6.1 Macros for handling trees" are 404
I would suggest adding a charset in the header of source code pages, 
this one for example http://www.rebol.it/power-mezz/mezz/html-to-text.r
I get this line:

break-at: complement charset [#"0" - #"9" #"A" - #"Z" #"a" - #"z" 
{"'#$%&([^{@} #"" - #""]   <- last 2 chars are ?
Gabriele
27-Jan-2010
[16x7]
Will: I tend to have strings as UTF-8, but char! values need to be 
latin1 for R2. The .r files are the result of MOLD so although I 
have #"^(XX)" in the RLP source, you get the actual latin1 char in 
the .r.
Wetan does not properly handle this case either so the HTML sometimes 
does not display char! values correctly. I need to set aside some 
time to work on Wetan...
If you look here: http://rebol-power-mez.hg.sourceforge.net/hgweb/rebol-power-mez/rebol-power-mez/file/68b9806fc1a1/mezz/html-to-text.rlp
you'll find: break-at: complement charset [#"0" - #"9" #"A" - #"Z" 
#"a" - #"z" {"'#$%&([^{@} #"^(80)" - #"^(FF)"]
(HTML to Text needs to be rewritten as it's still using the old normalize-html 
function. load-html is much faster and much better...)
fixed the missing macros dir
uploaded (to sourceforge) a zip with just the modules (.r files). 
no tests, docs, etc. for the lazy :-)
BrianH
27-Jan-2010
[23]
I'll be sure to test against future R2 versions for compatibility. 
The only gotcha so far is COLLECT, but that's not bad.
Gabriele
28-Jan-2010
[24]
it should not clash with any built in ones available in the future, 
because it's a module.
BrianH
28-Jan-2010
[25]
For that matter it works (sort-of) the same, so it's a swap-in replacement. 
Hence the "not bad" :)
BrianH
30-Jan-2010
[26]
Here's the group about Gabriele's Power Mezz package.
Graham
30-Jan-2010
[27]
>> do %mezz/filter-html.r
Script: "HTML Filter" (none)
** Script Error: macro has no value

** Near: !set-assoc: macro [assoc word value] [(:either) _pos: (:find) 
assoc word [(:poke) _pos 2 value/only] [
        insert/on..
BrianH
30-Jan-2010
[28x4]
Did you use LOAD-MODULE to import the module? IIRC that is the function 
name that Gabriele used.
Most of the Power Mezz files are modules written for the Power Mezz 
module system.
Strangely enough, the R2/Forward source is already in Power Mezz 
module form :)
(Just one though, for now)
Gabriele
31-Jan-2010
[32x5]
Graham, I'll answer here.
1) Download the built zip, or download the scripts individually from 
http://www.rebol.it/power-mezz/. (Of course it would be nice to 
get the whole repo and setup your system to be able to make changes 
as well. It currently requires GNU Make, however, those crazy people 
still using Windows could rewrite remake.r to do all the work.)
2) In your script, use something like:

do %/path/to/module.r
load-module/from %/path/to/power-mezz/

module [
    Imports: [%mezz/filter-html.r]
] [
    ; ....
]
Since filter-html is defined globally, you can also use: load-module 
%mezz/filter-html.r
however, I recommend the former as I don't like making things global 
and I will remove that eventually
Graham
31-Jan-2010
[37]
Thanks ... I'll give it a go.  But it seems that it would require 
a bit of work to use this within an encapped script?
Gabriele
1-Feb-2010
[38]
yes, though it would be easy to add support to prebol.
Janko
22-Sep-2010
[39x2]
First of all.. thanks for making this and making it awailable. I 
am working with emails now for usrjoy and if I would have to manaually 
detect and decode (or write all this) various encodings in subject 
or content I would just shoot myself (like quoted printable / base64 
).
I can use decode-email-field to decode various encodings of subject. 
But I wasn't able to figure out how can I decode the content of an 
email which is in my case encoded with quoted-printable / utf8 . 


I found to-netmsg library on codeconscius.com code that loads the 
email text and parses it into structure. It doesn't decode the subject 
=?UTF-8?B...?= but it does the content. I could use that and power 
mezz to get the effect I want. If there is a way to encode content 
in power-mezz I would rather use it alone.
Gabriele
23-Sep-2010
[41]
http://www.rebol.it/power-mezz/mezz/text-encoding.html

See the list of supported encodings.
florin
25-Sep-2010
[42]
Is there any documentation on how to use these modules? I've had 
a couple of hours this beautiful weekend and all I did was try to 
find a way to load load-html.r with no results. Dependent modules 
change the current directory in the console and as a result one module 
cannot find another another. Yes, I am a poor soul on windows. Heck, 
I got to take the kids to the Fall Festival and am late already.
BrianH
25-Sep-2010
[43]
http://www.rebol.it/power-mezz/mezz/module.html
florin
25-Sep-2010
[44]
So this: %./ wasted 2 hours of my precious Saturday! I hate dots 
and slashes.
Graham
25-Sep-2010
[45x2]
only 2 hours?  lol
I think Gab built them into one package .. check http://sourceforge.net/projects/rebol-power-mez/
florin
25-Sep-2010
[47x3]
Well, well. I thought I could just type and things heppen. I actually 
need to read code. Bummer. This guy, BrianH, is a heartless man.
The package you mention has files with a different extension, .rlp. 
Apparently the package needs to be  cooked on a strange OS different 
than Windows. (Gabriele: It currently requires GNU Make, however, 
those crazy people  still using Windows could rewrite remake.r to 
do all the work).
Keeping things obscure is part of the nefarious goals of the Genius 
Network United (GNU).
Andreas
26-Sep-2010
[50]
http://gnuwin32.sourceforge.net/downlinks/make-bin-zip.php

has a single binary in the bin/ subfolder, "make.exe", that's all 
you need.
BrianH
26-Sep-2010
[51]
Gabriele likes what is called "literate programing". RLP is his own 
processor that implements it. The .rpl files are the source of both 
the .r code files and the .html doc files, one .rlp generates both. 
If you want to understand his code, either read the .html or the 
.rlp file; the .r file is not formatted for human consumption.
florin
26-Sep-2010
[52]
Thanks BrianH. You guys are awesome.
BrianH
26-Sep-2010
[53x2]
I am not an RLP advocate, for good reasons, but it has its fans and 
I respect that. It's a matter of taste.
Note, I mean that I am not a LP advocate. However, if you are a LP 
fan, I *definitely* recommend RLP, it's a great implementation of 
the LP concept and a great piece of code.
Gabriele
27-Sep-2010
[55x2]
Florin, if you go here: http://sourceforge.net/projects/rebol-power-mez/files/


you'll find power-mezz-built-1.0.0.zip which contains pre-built .r 
scripts. Inside tools/ , there is a module-console.r which defines 
a IMPORT function so that you can just write "import %mezz/load-html.r" 
and have its exported words available in the console.

Otherwise, from your own code:

    do %<path to power-mezz>/mezz/module.r
    load-module/from %<path to power-mezz>

    module [
        Imports: [%mezz/load-html.r]
    ] [
        ; your code that uses load-html
    ]
of note, if you have the normal package, from windows you can go 
to tools/ and double click on wetan-test.r (assuming you have View 
associated with .r files), and it will just ask you for a file to 
process. select any of the .rlp file to process it and produce .html 
and .r files.


make is only required if you want everything to happen automatically. 
i'm not sure if it is obscure, as it is the tool used by basically 
every C programmer on this planet since 1980 or so...
florin
27-Sep-2010
[57x2]
Gabriele, thank you so much. I realize that you don't like to litter 
the global namespace, yet I doubt that (poking) ~Humor should have 
it's own group on Altme. I barely get an hour every now and then 
for Rebol so I appreciate all the shortcuts that I can get. I need 
to change my name to Nonchalant. You guys are an awesome bunch.
And I did get it work to this point:
** Script Error: make-node has no value
** Where: context
** Near: root: current-node: make-node 'root