I do but nowadays it's dependent on namespacing so only 64bit I'm afraid.
However the uploading worked when I tested and this code has not been
changed either in the current version. Maybe it's a permission issue on the
On Wed, May 8, 2013 at 4:32 PM, Jon Kleiser <jon.klei...@usit.uio.no> wrote:
> Hi Henrik,
> I just tried your simple-web-app, using 32-bit PicoLisp (188.8.131.52 C) on my
> Mac. It seems to work, except for uploading files. I've tried uploading a
> .jpg and a .txt file, but each time the server failed to return a response,
> probably hanging. I just got two empty files in the uploads folder. Do you
> have a newer version of your code?
> On 2/4/12 12:48 PM, Henrik Sarvell wrote:
>> Hi guys!
>> This time I've also attached the sample web app. You know where things
>> are to be and how to start the http server if you read the prior post.
>> So pl-web is getting more feature complete, we can now also:
>> 1.) Upload files, in the test application they end up in the
>> app/uploads folder in the sample web app ( http://localhost:8080/login
>> 2.) Redirect, go to
>> http://localhost:8080/to-**whoami<http://localhost:8080/to-whoami>to see it
>> in effect.
>> 3.) Download / load mime files, try
>> In addition to that sessions will now get wiped (if it works correctly
>> which I think but I'm not 100), in the main.l of the simple web app
>> you have the following at the top: (setq *SClI '(3600 . 5)) (Session
>> Clear Information) which means it should remove sessions that are
>> older than one hour and there's a 5% chance of the "swipe" being
>> initiated everytime someone accesses the site. Depending on how busy
>> the site is and how accurately you want to be able to remove old
>> sessions these values should be changed. I know, it's ugly but it's
>> what I can come up with.
>> We now have something like the PL equivalent of the environment /
>> capabilities you have when you start out with an empty PHP script.
>> If you inspect the code you will see that in addition to the http
>> function a few others have been redefined, I have removed basically
>> everything from _htSet and have no idea if now something essential is
>> missing or if it was just stuff pertaining to the GUI framework. It's
>> a monkey in a spaceship situation here, I suppose I'll find out soon
>> enough as my intention is to now go ahead and create some kind of
>> framework on top of pl-web.
>> I've also modified Alex JSON code and included it in pl-web. The
>> following now looks like it works (didn't try to eval with JS but
>> visually it looks good):
>> (class +Person)
>> (dm T (Name Age)
>> (=: nm Name)
>> (=: age Age))
>> (setq Anna (new '(+Person) "Anna" 25))
>> (setq Peter (new '(+Person) "Peter" 30))
>> (list "two-people" "" Anna Peter)
>> '("name" . "Smith")
>> '("age" . 25)
>> '("a-bool" . T)
>> '("some-bools" "" T NIL T T T NIL NIL)
>> ("street" . "21 2nd Street")
>> ("city" . "New York")
>> ("state" . "NY")
>> ("zip" . "10021") )
>> '("phone" "" "212 555-1234" "646 555-4567") ) )
>> I think comments on the above are superfluous. I never managed to
>> flip/reverse the pairs so that mapcar over the getl is the result of
>> that inability.
>> Anyway, it now basically works like I want.
>> On Sat, Jan 28, 2012 at 4:25 PM, Henrik Sarvell<hsarv...@gmail.com>
>>> OK so I've got a first draft of something simple.
>>> As opposed to what has been requested before this is NOT a web
>>> development framework in the sense of RoR or even Ring.
>>> Instead I've opted to create a simple environment from which
>>> frameworks utilizing conventions and such can be built, both a RoR
>>> type of thing or a simpler Ring style framework is possible to create
>>> from pl-web.
>>> What we have is a few basic things:
>>> 1.) An ability to inspect the current look of the URL (se line 87 and
>>> 120 in pl-web.l).
>>> 2.) File based sessions (ugly yes but will not make demands on how any
>>> database should look like). See line 109 in pl-web.l.
>>> 3.) Trying as hard as we can to utilize Linux system
>>> functions/commands in order to alleviate the need for libraries (see
>>> How to test:
>>> 1.) Unpack the attached file into /opt/picolisp and create
>>> 2.) Create a folder called simple-web-app in /opt/picolisp/projects
>>> and paste the following into a main.l file there:
>>> (de login (Msg)
>>> (<plw-form> NIL ""
>>> (<span> NIL "Username:")
>>> (<plw-field> "text" "username" (gReq "username"))
>>> (<span> NIL "Password:")
>>> (<plw-field> "password" "password" "")
>>> (<submit> "Submit")
>>> (<span> NIL Msg) ) )
>>> (de app ()
>>> (html 0 "PL Web" *Css NIL
>>> (<div> NIL (println "Post: " *Post " Cookies: " *Cookies))
>>> ((= (car *Urll) "login")
>>> (ifn (and (= (gReq "password") "test") (= (gReq
>>> "username") "test"))
>>> (login (if (gReq "username")
>>> "User not found."
>>> "Please login." ) )
>>> (sSess 'logged-in-user "test")
>>> (<div> NIL "Login successful.") ) )
>>> ((= (car *Urll) "whoami")
>>> (<div> NIL (prin "You are: " (gSess 'logged-in-user))) )
>>> (T ("Nothing to do.")) ) ) ) )
>>> (de start ()
>>> (off *JS))
>>> (de go ()
>>> (server 8080 "!start") )
>>> 3.) Start it: henrik@henrik-laptop:/opt/**picolisp$ ./pil
>>> projects/simple-web-app/main.l -go
>>> 4.) Browse to: http://localhost:8080/login and submit the form with
>>> test in both fields.
>>> 5.) Browse to: http://localhost:8080/whoami
>>> That's it, I think inspection of the code plus testing in #4 and #5
>>> above should be enough to understand how this works.
>>> A few TODO/Thoughts:
>>> 1.) Swiping stale sessions in the sessions folder. Some kind of
>>> timeout value might be needed, if combined with a random initializer
>>> we have recreated the ugliness of PHP session handling to perfection.
>>> 2.) Port of the current xhtml.l library (which we are currently
>>> relying heavily on), as can be seen I've started a little in the
>>> pl-html.l file, all that *JS stuff etc needs to go.
>>> 3.) Some brave soul needs to create a real, clever, framework from
>>> this that is beautiful enough that it might get some attention. What
>>> was that earlier suggestion, Bumblebee? Don't know about the name
>>> though as it brings to mind something that looks so heavy it should
>>> not be able to fly, yet does. Perhaps not something we want associated
>>> with PicoLisp.
>>> 4.) If it would be possible for PL to have several databases open at
>>> the same time (I have a vague memory of discussing this at some point
>>> in the past) stuff like session handling could done through a DB
>>> instead and without making demands on the main application E/R.
>>> /Henrik Sarvell
> UNSUBSCRIBE: mailto:picolisp@software-lab.**de <firstname.lastname@example.org>