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

World: r3wp

[Core] Discuss core issues

JaimeVargas
28-Jan-2006
[3294]
Personally I think the wireless market and the networking market 
are very difficult to takle correctly. It is a commodotized market 
which means people don't care for the features and they don't pay 
too much extra for those, they just bargain best price. Which keeps 
going down. At least that is our experience with our routers.
Terry
29-Jan-2006
[3295]
How can I add a value to a read/custom post query?? ie.. 

xyz: "bob"


read/custom http:/theurl/x.cgi [POST "fname=bob&lname=jones&value= 
XYZ"]

where XYZ is the word??
Graham
29-Jan-2006
[3296x4]
use 'reduce
or compose
or ...
I think Linksys have moved away from Linux now as it was GPL.
Terry
29-Jan-2006
[3300]
I get errors with [POST.. ] no matter what I try
Graham
29-Jan-2006
[3301]
reduce [ 'POST  join "fname=bob&lname=jones&value=" word! ]
Terry
29-Jan-2006
[3302x3]
ahh, ok.. didn't use the ' with post
this works.. 

result: read/custom http://squigglz.com/update.php[post "user=&pass=&squiggle=sandbox-ip&val=23.43.234.000"]

but this doesn't??
user: ""
pass: ""


result: read/custom http://squigglz.com/update.phpreduce ['post 
"user=" user "&pass=" pass "&squiggle=sandbox-ip&val=2
3.43.234.001"]
Ok.. figured it out.. needed to 'rejoin' the query first, then 'reduce' 
it with POST later.. see the ~Framewerks~ group for the Squigglz/Rebol 
Dynamic Naming System..
Graham
29-Jan-2006
[3305x3]
My example did show that join or similar was required.
Jaime, why not treat the marketing differently.  Instead of marketing 
as a wireless router, market as a wireless chat server, or mp3 server 
with router facilities ?
I lot of people don't have the technical savy to do these things 
.. so you create a wireless appliance for specific purposes.
Henrik
29-Jan-2006
[3308]
hmm... I can't seem to figure this out:

>> w: copy reduce [make object! [test: 27]]
>> set [y] w
== [make object! [
        test: 27
    ]]
>> probe y
make object! [
    test: 27
]


This part is ok. Now I want to add new keys to the object. How do 
I do that while keeping the reference to the W block?

I can set existing keys:

>> set in y 'test 35
>> w
== [make object! [
        test: 35
    ]]

>> set in y 'test2 127

** Script Error: set expected word argument of type: any-word block 
object
** Near: set in y 'test2 127

Can't do that.

>> set y make y [test2: 127]

Then I lose the reference to the W block.


Y is a point I use in a large object which I traverse. It contains 
smaller objects and these smaller objects must sometimes be updated. 
The position is remembered with Y. I want to MAKE objects there without 
losing the reference to W.
Anton
29-Jan-2006
[3309x6]
Well, to start with, your original REDUCE is already doing a copy 
for you - so no need to copy again.
Maybe you meant:    w: reduce copy [make object! [test: 27]]
(either way, actually makes no difference here...) 
You can't currently extend an existing object.
We were talking about adding that to rebol recently, though.
The way to extend an existing object is not to use an object. :) 
 Use a block, instead. (Or a block inside an object.)
What are you using this for anyway ?
Volker
29-Jan-2006
[3315]
You cant extend objects in place. sadly. Carl says its only a little 
change in the code, but is unsure if it is a good idea. switch to 
blocks or keep the objects in a hashtable and reference them by name. 
Or use a mix, some fixed fields and a block for the extensible part.
Henrik
29-Jan-2006
[3316]
crap... oh well


anton, W is really a big object block with many nested objects. I'm 
building a list of relations, so I can relate words and numbers to 
eachother in a database
Graham
29-Jan-2006
[3317x2]
can't you use the object as a template to create a new object with 
the new field and then copy it back again?
Well, that's what I do when I need to extend an object .. though 
it's not in place.
Henrik
29-Jan-2006
[3319]
the point is, I need the position to copy it into. The position is 
automatically and elegantly referenced by Y and can be a lengthy 
calculation, if I need to find it again, but I may need to do that 
or make some other position marker which contains the block that 
holds the object I need to change.
Volker
29-Jan-2006
[3320]
You could do it indirectly. 
obj: reduce[make my-object]
and always access with obj/1 .
then extending with 
  obj/1: make obj/1
not really nice too. We write a RAMBO-request?
Henrik
29-Jan-2006
[3321]
volker, that doesn't work here? I lose the reference immediately 
when doing obj/1: make obj/1
Volker
29-Jan-2006
[3322x2]
its not my typo? must be with block,
obj/1: make obj/1[]
i test it.
Henrik
29-Jan-2006
[3324]
I anticipated that
Volker
29-Jan-2006
[3325x3]
thought so. was to easy :)
!>>obj: reduce[context[a: 1]]
== [make object! [
        a: 1
    ]]
!>>obj/1: make obj/1[b: 2]
!>>probe obj/1
make object! [
    a: 1
    b: 2
]
But the obj/1 must be on every access, and bindings are still lost.
Henrik
29-Jan-2006
[3328]
yes....
Anton
30-Jan-2006
[3329x3]
>> w: reduce [[test 1][test 2]]
== [[test 1] [test 2]]
>> set [y] w
== [[test 1] [test 2]]
>> y
== [test 1]
>> y/test
== 1
>> y/test: 100
== 100
>> w
== [[test 100] [test 2]]
>> c: context [test: none]
>> b: reduce [in c 'test]
== [test]
>> reduce b
== [none]
>> c: context [test: 1]
>> b: reduce [in c 'test]
== [test]
>> reduce b
== [1]
>> c: context [test: 2]
>> b2: reduce [in c 'test]
== [test]
>> reduce b2
== [2]
>> b
== [test]
>> reduce b
== [1]
>> reduce b2
== [2]
The first of the two examples above shows how to use path notation 
to select and change values in a block.

The second of the two examples above shows how to use a "throwaway" 
context to store new words in, then to reference these words from 
inside a block.
Both examples are showing how to use blocks instead of objects.

One of the advantages of objects is the convenient path syntax to 
get to a value. Hopefully, the above examples show how this can be 
done with blocks.
Henrik
30-Jan-2006
[3332]
anton, that's very interesting. a shame that I'm almost done now, 
still a few bugs left. :-) I solved the problem by going one step 
backwards. it happens to be that all objects are stored in a block 
so I can change it on the spot that way. the trick was to figure 
out how to move backwards and get the rules right.
Anton
31-Jan-2006
[3333]
What does your system look like now ?
Henrik
31-Jan-2006
[3334]
entangled in lots of debug code :-)
Anton
31-Jan-2006
[3335]
I mean .. the essence of it .. :)
Henrik
31-Jan-2006
[3336x2]
well, I use a structure like this:

<word>: [
  <id> make object! [
    <word2>: [
      <id2> make object! [
        <word3>: [<id4> <id5>]
      ]
      <id3> make object! [
        <word4>: [
          <id6> make object! [
            <word5>: [<id7>]
          ]
        ]
      ]
      <id4> make object! [
        <word6>: [<id8> <id9>]
      ]
    ]
  ]
]
a word relates to one or more values which relate to more words which 
can relate to more values
Anton
31-Jan-2006
[3338]
So it works ok ?
Henrik
31-Jan-2006
[3339x2]
then I have a function that asks for a specific relation by diving 
down a path with a block like: [customers 1234 invoices 45 articles 
15] to find customer 1234 who has invoice 45 which holds article 
15

then there is a function to add and remove relations
there are a few bugs left, but they are easy to fix
Anton
31-Jan-2006
[3341x2]
That's good. So you managed to stick with objects somehow, anyway.
Oh I see of course.
Henrik
3-Feb-2006
[3343]
most bugs seem to be fixed now. I made a little release on http://www.hmkdesign.dk/rebol/

the question is whether this is useful to anyone :-)