Re: Passing Map to Remote App

new topic     » goto parent     » topic index » view thread      » older message » newer message

You can probably use save_map() and load_map():

map a = map:new_from_kvpairs({ 
    {"name","Jerry Smith"}, 
    {"age",`16`}, -- note, numbers must be quoted somehow; 
    {"bal",`49.95`}, 
    {"city","Buffalo NY"}, 
    {"phone","000-555-1212"}, 
    {"pix","thumbnails/Jerry.jpg"}}) 
 
save_map(a,canonical_path("~/demos/resources/Jerry.map"),SM_RAW) 

If you use SM_RAW mode, the output will be like this:

þþ;9:B9<:;:B9B=Bþ:=7:79)mnnuxyvnw})1>A?:C>@:@B:@:mknm5);9:>69;69;):=C:AC><2þþwjvnþjpnþyrþkjuþyqxwnþlr}‚þþSn{{‚)\vr}qþ:?þ}q~vkwjru|8Sn{{‚7sypþ=B7B>þ9996>>>6:;:;þ 
K~oojux)Wb 
There are lots of non-readable characters in there: ETX,ACK,EOT,VT, etc.

If you use SM_TEXT, then the results are human-readable:

\#22name\#22 = \#22Jerry Smith\#22 
\#22age\#22 = \#2216\#22 
\#22pix\#22 = \#22thumbnails/Jerry.jpg\#22 
\#22bal\#22 = \#2249.95\#22 
\#22phone\#22 = \#22000\-555\-1212\#22 
\#22city\#22 = \#22Buffalo NY\#22 

Either way:

object x = load_map("resources/Jerry.map") 
display(map:get(x,"name")) -- displays Jerry Smith 

Which mode may be easier/safer to transfer is left up to your experimentation. The raw mode map may need to be encoded in order to transfer it. What transport protocol do you intend to use?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu