Re: Blob problems
Hi Henrik, (class +Article +Entity) (rel aid (+Key +Number)) (rel title (+String)) (rel type (+String)) (rel htmlUrl (+Key +String)) (rel body (+Blob)) (dm put (Key Val) (if (= Key 'body) (prog (put! This 'body T) (out (blob This 'body) (prinl Val))) (super Key Val))) I didn't try this code, and have no direct explanation why you get an error upon re-import, but I see a different problem: It is not good to nest 'put!' within 'put'. 'put!' builds its own transaction with 'dbSync' and 'commit'. This means, that you get a preliminary 'commit', which will unlock the database too early. So the 'put!' above should at least be a simple 'put'. Then we might simply use 'super' instead: (dm put (Key Val) (ifn (== Key 'body) (super Key Val) (super 'body T) (out (blob This 'body) (prinl Val) ) ) ) As usual, this 'put' must run in a transaction (surrounded by 'dbSync' and 'commit'), of course. I don't know if this solves the original problem though. The same situation ('put!' inside 'lose!') we have here: (dm lose! () (call 'rm (blob This 'body)) (put! This 'body NIL) (super)) In fact, I never directly remove blobs, and rely on the nightly garbage collection to have them cleaned up. So the above 'lose!' method might simply be omitted. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
onOff question
Hi Alex, is this supposed to happen? : (show NIL) NIL NIL - NIL : (onOff) - T : (show NIL) T T - T : (=T NIL) - T : (onOff sym ..) - flg Logical negates the VAL's of all argument symbols sym. Returns the new value of the last symbol. - Should not the symbol names be passed explicitly? - Why does it return value of the last symbol? Thanks, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Static content and http.l
Hi Henrik, I need to be able to serve static content as well as dynamic content generated through PicoLisp. I have tried several different configurations. You can serve everything with picolisp, either the way Alex suggested or you can have a look at http://logand.com/picoWiki/rewriteUrl how to completely control the format of your urls inside your picolisp app. Only a small 'patch'-ing is necessary. Even though I do not serve all content by picolisp in the end, I still use variations on the rewriteUrl in my apps running behind nginx. I saw that Tomas had managed to separate the concerns here: http://www.mail-archive.com/picolisp@software-lab.de/msg00311.html through the use of Nginx for static content and the pico server for the rest. How did you go about setting it up? That post is not exactly chock full of details :) I end up having nginx on port 80 with static content served directly by nginx and dynamic content proxied to picolisp. You can specify rewrite rules in nginx to match urls depending on static or dynamic content. You can configure proxies to your picolisp servers and then you don't really need httpGate if your trafic goes through nginx on port 80. The only thing to keep in mind is that nginx does not keep connections open (http1.1 only, used by Alex to speed up widget responses over SSL if I remember well). It wasn't an issue for me. Also, I did not like the default picolisp behaviour where the users get connection error when the picolisp session expires. First I made a small change to httpGate but Alex didn't like it and I didn't want to maintain my own version so I took advantage of an nginx features where your server generating dynamic content can return an internal redirect for nginx and also default fallback url when connection to your server fails. This way users always get some screen; if not from their session process, then at least from the main/parent app process. Cheers, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Static content and http.l
Hi Henrik, (`(chop swf) application/x-shockwave-flash 3600) (`(chop xml) text/xml 3600) I think you can add custom mime-types in your app like this: (mime swf application/x-shockwave-flash 3600) (mime xml text/xml 3600) Cheers, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: From Pico to JSON in the client
It worked out OK with the :key rule, however in the end I went for prefuse flare, not processing for my visualizations and was irritated by having to change (processingjs is too slow) so I skipped the Actionscript 3 implementation, I'm just outputting JSON in picolisp now straight away which works just fine too. /Henrik On Wed, Sep 16, 2009 at 9:46 AM, Tomas Hlavaty t...@logand.com wrote: Hi Henrik and TC, I just realized that there is an ambiguity here since I can't seem to accomplish a pair looking like this: (key . (1 2 3)), no matter how I try I get: (key (1 2 3)), if the Heh, I think the problem is quite obvious when looking to the list as wh= at it really is: a chain of cons. (key (1 2 3)) - (key . ((1 . (2 . (3 . NIL) that's equivalent to: (key . (1 2 3)) =A0=3D (key (1 2 3)) well, picolisp says that: : '(key . (1 2 3)) - (key 1 2 3) : In any case I can't think of a situation where I would have a string with quotes in it. That seems to me like a serious flaw:-( Regards, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Static content and http.l
Would it be possible for you to simply copy paste your config file here? /Henrik On Wed, Sep 16, 2009 at 9:47 AM, Tomas Hlavaty t...@logand.com wrote: Hi Henrik, I need to be able to serve static content as well as dynamic content generated through PicoLisp. I have tried several different configurations. You can serve everything with picolisp, either the way Alex suggested or you can have a look at http://logand.com/picoWiki/rewriteUrl how to completely control the format of your urls inside your picolisp app. Only a small 'patch'-ing is necessary. =A0Even though I do not serve all content by picolisp in the end, I still use variations on the rewriteUrl in my apps running behind nginx. I saw that Tomas had managed to separate the concerns here: http://www.mail-archive.com/picolisp@software-lab.de/msg00311.html through the use of Nginx for static content and the pico server for the rest. How did you go about setting it up? That post is not exactly chock full of details :) I end up having nginx on port 80 with static content served directly by nginx and dynamic content proxied to picolisp. =A0You can specify rewrite rules in nginx to match urls depending on static or dynamic content. You can configure proxies to your picolisp servers and then you don't really need httpGate if your trafic goes through nginx on port 80. =A0The only thing to keep in mind is that nginx does not keep connections open (http1.1 only, used by Alex to speed up widget responses over SSL if I remember well). =A0It wasn't an issue for me. =A0Also, I did not like the default picolisp behaviour where the users get connection error when the picolisp session expires. =A0First I made a small change to httpGate but Alex didn't like it and I didn't want to maintain my own version so I took advantage of an nginx features where your server generating dynamic content can return an internal redirect for nginx and also default fallback url when connection to your server fails. =A0This way users always get some screen; if not from their session process, then at least from the main/parent app process. Cheers, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Blob problems
nightly garbage I can't remember, didn't you go through that cron job script here in the mailing list or was it on IRC, if it was on IRC maybe it would be a good idea to do it here again? Will change the put! implementation, the error was on put so hopefully that might take care of it... /Henrik On Wed, Sep 16, 2009 at 7:55 AM, Alexander Burger a...@software-lab.de wro= te: Hi Henrik, (class +Article +Entity) (rel aid =A0 =A0 =A0 (+Key +Number)) (rel title =A0 =A0 (+String)) (rel type =A0 =A0 =A0(+String)) (rel htmlUrl =A0 (+Key +String)) (rel body =A0 =A0 =A0(+Blob)) (dm put (Key Val) =A0 =A0(if (=3D Key 'body) =A0 =A0 =A0 (prog =A0 =A0 =A0 =A0 =A0(put! This 'body T) =A0 =A0 =A0 =A0 =A0(out (blob This 'body) =A0 =A0 =A0 =A0 =A0 =A0 (prinl Val))) =A0 =A0 =A0 (super Key Val))) I didn't try this code, and have no direct explanation why you get an error upon re-import, but I see a different problem: It is not good to nest 'put!' within 'put'. 'put!' builds its own transaction with 'dbSync' and 'commit'. This means, that you get a preliminary 'commit', which will unlock the database too early. So the 'put!' above should at least be a simple 'put'. Then we might simply use 'super' instead: =A0 (dm put (Key Val) =A0 =A0 =A0(ifn (=3D=3D Key 'body) =A0 =A0 =A0 =A0 (super Key Val) =A0 =A0 =A0 =A0 (super 'body T) =A0 =A0 =A0 =A0 (out (blob This 'body) =A0 =A0 =A0 =A0 =A0 =A0(prinl Val) ) ) ) As usual, this 'put' must run in a transaction (surrounded by 'dbSync' and 'commit'), of course. I don't know if this solves the original problem though. The same situation ('put!' inside 'lose!') we have here: (dm lose! () =A0 =A0(call 'rm (blob This 'body)) =A0 =A0(put! This 'body NIL) =A0 =A0(super)) In fact, I never directly remove blobs, and rely on the nightly garbage collection to have them cleaned up. So the above 'lose!' method might simply be omitted. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: onOff question
Hi Tomas, is this supposed to happen? .. : (onOff) - T : (show NIL) T T Oops, no. But if I try here: : (onOff) !? (onOff) NIL -- Protected symbol ? I really don't remember, but it could well be that I repaired that in the course of rewriting some parts while codig the 64-bit version. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: onOff question
Hi Tomas, sorry, I missed the last two questions: (onOff sym ..) - flg Logical negates the VAL's of all argument symbols sym. Returns the new value of the last symbol. - Should not the symbol names be passed explicitly? Yes. But on the other hand, missing arguments usually default to NIL in picoLisp. Makes not much sense in the case of 'onOff'. - Why does it return value of the last symbol? What would you return instead? Most similar functions like 'on', 'off', 'zero' or 'setq' do the same. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: From Pico to JSON in the client
On Wed, 16 Sep 2009, Tomas Hlavaty wrote: Hi Henrik and TC, I just realized that there is an ambiguity here since I can't seem to accomplish a pair looking like this: (key . (1 2 3)), no matter how I try I get: (key (1 2 3)), if the Heh, I think the problem is quite obvious when looking to the list as what it really is: a chain of cons. (key (1 2 3)) - (key . ((1 . (2 . (3 . NIL) that's equivalent to: (key . (1 2 3)) = (key (1 2 3)) Brain farts happen... (key . ((1 2 3))) = (key (1 2 3)) -- This is what I tried to say. well, picolisp says that: : '(key . (1 2 3)) - (key 1 2 3) : I know, I knew this since I sent that email, but since it was only to show _why_ the (Sym . list) was not going to work, it wasn't worth it to send another email fixing this. In any case I can't think of a situation where I would have a string with quotes in it. That seems to me like a serious flaw:-( Regards, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe