World: r3wp
[!Cheyenne] Discussions about the Cheyenne Web Server
older newer | first last |
Dockimbel 11-Jan-2010 [7418x2] | IE issue fixed with upload.html. It wasn't a settimeout( ) issue, it was a IE caching all the AJAX responses. |
SVN r61 FEAT: added request/store function to help manage uploaded files (see %changelog.txt). FIX: IE issue with upload.html (cache issue). Works ok in IE now. DOC: upload API documented in %www/upload.html. | |
Terry 11-Jan-2010 [7420x5] | JSON was my first thought.. but I think I'll build a custom "data format" using triples to keep inline with the back end.. still thinking about it. |
I guess the binary support would go hand in hand with your new upload script? | |
There's a blur with websockets.. traditional usage takes a form, serialize and send to the server as a associative array in the url.. With sockets, that's not necessary. Forms are becoming less relevant.. As individual fields can do their own thing.. <input type="text" onblur="ws.send(this.val());"> | |
Even non-form elements can be used.. <p id="myparagraph" onchange="ws.send(this.text);"> Lorem ipsum </p> | |
BTW, the typo wasn't in the config file, but in my ws app, If one app doesn't work, should the whole server come down? | |
Dockimbel 11-Jan-2010 [7425] | Binary support / upload: these are 2 different things. Uploading files (access to local filesystem) still requires FORM with multipart/form-data encoding. |
Terry 11-Jan-2010 [7426x2] | Hmm, maybe not with WS? |
Might even get away with partial file uploads, incrementals etc. | |
Dockimbel 11-Jan-2010 [7428] | WS doesn't give you access to local filesystem. |
Terry 11-Jan-2010 [7429x6] | P2P |
http://webkit.org/demos/sticky-notes/index.html | |
Another handy html 5 api.. Web pages can determine if the client is online. (returns boolean) var online = navigator.onLine; alert(online); | |
So, jump on a plane, update your Cheyenne data, store local, and sync via ws when back online :) | |
<script> var online = navigator.onLine if(online){var conn = new WebSocket("ws://localhost/ws.rsp")} </script> | |
else{golocalsql();} | |
Dockimbel 11-Jan-2010 [7435] | Terry, sure, HTML5 opens up a new world for web applications, the gap with native apps is closing. |
Terry 11-Jan-2010 [7436x2] | How about this.. passing a block via websocket as a data method? (not even sure if it would work), and loading it? ie: ws.send("[a 'one' b 'two]"); |
any security issues? | |
BrianH 11-Jan-2010 [7438] | Not is you screen the data after loading and throw away all functions. |
Terry 11-Jan-2010 [7439] | Hmm, that could be very handy. |
BrianH 11-Jan-2010 [7440] | It requires more security screening than JSON on the server side, and more work on the client side. |
Terry 11-Jan-2010 [7441] | But, it is rebol friendly |
BrianH 11-Jan-2010 [7442x3] | Not for web clients. You have to assume the client is hostile for web stuff, and screening REBOL data for malicious stuff is harder than parsing JSON data. The only way to be safe is to not transmit an executable dialect - full data dialect, reject anything bad. |
It's great if the client won't primarily be a browser, as long as you stick to full dialects and never DO the code. | |
Fortunately you can't create reference loops without DO, so if you stick to LOAD/all you should be fine. | |
Terry 11-Jan-2010 [7445x6] | Here's some JS that takes an array of elements, and builds a block for passing to Rebol via WS <script> function toblock(arr){ var block = '['; jQuery.each(arr, function(){ var val = $(this).val(); var id = $(this).attr('id'); block = block+id+" '"+val+"' "; }); block = block+"]"; //remove, alert(block); }; <script> <input id="one" type="text" /> <input id="two" type="text" /> <button onclick="toblock([one, two]);">TEST</button> |
oops.. missing / in closing script tag | |
That function only deals with elements that have value attributes.. for pulling the content of, say a <p>, use this.. jQuery.each(arr, function(){ var val = $(this).val(); if(val== ''){val = $(this).text();} ...... | |
if you want the html... if(val== ''){val = $(this).html();} | |
Why does this work >> n: "one 'on' two 'tw'" == "one 'on' two 'tw'" >> x: to-block n == [one 'on' two 'tw'] >> x/one == 'on' but not this (data is from ws) r: to-block data r/one | |
I can't turn data into a block no matter what i try? | |
PeterWood 11-Jan-2010 [7451] | Terry, are you mixing 1 and one ? |
PeterWood 12-Jan-2010 [7452x2] | >> x/one == 'on' >> x/1 == one x/one is really a shortcut for select x 'one: >> select x 'one == 'on' |
r/one will only work if the data returned from ws includes the value one | |
Terry 12-Jan-2010 [7454x8] | The block comes back as a string! [one 'on' two 'tw'] But somehow it's getting encased in curlys or sumthin... so the best i can do is get a block like so x: [[one 'on' two 'tw']] |
Now the problem is escaping the response? (I always send back JS for DOM scripting purposes) | |
ahh.. probe to the rescue (my rebol is so rusty.. if i add one more semi, or use ( instead of [ im going to barf. | |
Looks like Cheyenne is my new serrogate home HA! | |
Ok got it.. the problem was this.. I have two fields, and to test, i only filled out one... so the string looked like so.. "[one 'on' two '']" (where the value following two is a pair of single quotes) So when i converted to a block, I got an INVALID WORD --'' error. But, using sockets, the error isn't reported... In other words, debugging is a pain. | |
Last issue is this.. n: [ one 'on' two 'tw'] n/one is returning on' (note the apos) What's up with that?? | |
nevermind | |
I am a little concerned.. My entire cheyenne directory is rapidly approaching 2.5mb. | |
BrianH 12-Jan-2010 [7462x2] | That is horrifically large by REBOL standards, but not bad by web standards. How much is images and other web stuff? |
As opposed to RSP and Cheyenne files, I mean. | |
Terry 12-Jan-2010 [7464x3] | probably about 2/3rds :) |
That includes all the Atom db functions and data | |
Jison: An API for creating parsers in JavaScript http://tinyurl.com/yeravlz | |
Dockimbel 12-Jan-2010 [7467] | Terry, there's a Javascript group for such topics. |
older newer | first last |