Re: [Hecl script error]

4 views
Skip to first unread message
Message has been deleted

tkouts

unread,
Sep 8, 2008, 7:15:45 AM9/8/08
to porcupine-users
Vassili,

If this script is served from a QuiX method using the Python's
String.template module do not forget to use double $ when accesing a
variable value. Thus your script should be something like this:

set contacts [getcontacts]
set howMany llen $$contacts

set resp []

for {set i 0} {< $$i $$howMany} {incr $$i}
{
lappend resp [rpc "" "synch" lindex[$$contacts $$i]
}

commitcontacts $$resp

On Sep 8, 2:08 pm, VLegakis <vlega...@gmail.com> wrote:
> Hi all,
>
> I wanted to pass my handset's contacts one by one to the server
> instead of passing them all at once. So here is the hecl script I use:
>
> set contacts [getcontacts]
> set howMany llen contacts
>
> set resp []
>
> for {set i 0} {< $i howMany} {incr $i}
> {
>         lappend resp [rpc "" "synch" lindex[$$contacts $$i]
>
> }
>
> commitcontacts $$resp
>
> The getcontacts and commitcontacts are commands I've implemented. The
> problem is this script is not recognisable. I'm not very good at Hecl
> so any help?

VLegakis

unread,
Sep 8, 2008, 7:16:45 AM9/8/08
to porcupine-users
Hi all,

I wanted to pass my handset's contacts one by one to the server
instead of passing them all at once. So here is the hecl script I use:

set contacts [getcontacts]
set howMany llen contacts

set resp []

for {set i 0} {< $i howMany} {incr $i}
{
lappend resp [rpc "" "synch" lindex[$$contacts $i]]

VLegakis

unread,
Sep 8, 2008, 1:06:22 PM9/8/08
to porcupine-users
Hi all,
I've made it work and this is the way:


set contacts [getcontacts]
set howMany [llen $$contacts]
set resp [list]

for {set i 0} {< $$i $$howMany} {incr $$i} {
set requestRow [lrange $$contacts $$i $$i]
set responseRow [rpc "" "synch" $$requestRow]
lappend $$resp $$responseRow
}

commitcontacts $$resp


Watch out the way your data is packaged too!
Hecl commands like "lindex" accept the data in a packaged format
of Thing>HashThing>Hashtable etc.. and returns a HashThing(translated
into a java native hashtable from the rpc)

...while to get a ListThing (translated into a java native vector from
the rpc) you should use hecl command "lrange" ! (like I did in the
above code snippet)

;-)

VLegakis

unread,
Sep 8, 2008, 1:07:53 PM9/8/08
to porcupine-users
Hi all,
I've made it work and this is the way:


set contacts [getcontacts]
set howMany [llen $$contacts]
set resp [list]

for {set i 0} {< $$i $$howMany} {incr $$i} {
set requestRow [lrange $$contacts $$i $$i]
set responseRow [rpc "" "synch" $$requestRow]
lappend $$resp $$responseRow
}

commitcontacts $$resp


Watch out the way your data is packaged too!
Hecl commands like "lindex" accept the data in a packaged format
of Thing>HashThing>Hashtable etc.. and returns a HashThing(translated
into a java native hashtable from the rpc)

...while to get a ListThing (translated into a java native vector from
the rpc) you should use hecl command "lrange" ! (like I did in the
above code snippet)

;-)

On Sep 8, 2:15 pm, tkouts <t.koutsovassi...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages