Jon Kleiser | 1 Feb 2012 10:50
Picon
Picon
Favicon
Gravatar

Social Share Privacy buttons in the PicoLisp Wiki

Hi Alex,

I may not see the benefit of having those buttons at the bottom of every 
page in the PicoLisp Wiki. If they will generate increased interest in 
PicoLisp, that is very fine, but will we/you be able to say whether they 
do so?

I'm more uneasy with all that JavaScript code that comes with those 
buttons, especially the 181.1 KB of jQuery (v1.4.2) that turns up in 
 <at> lib/socialshareprivacy/js.l. I have trouble understanding that an 
entire jQuery library is needed for those buttons to work. All that 
JavaScript code for just a few buttons doesn't feel right when used in 
company with "The Scalpel of Programming". Sorry for being so negative 
about this. ;-)

/Jon
Jakob Eriksson | 1 Feb 2012 11:06
Picon

Re: Social Share Privacy buttons in the PicoLisp Wiki


On February 1, 2012 at 10:50 AM Jon Kleiser <jon.kleiser@...> wrote:

> I'm more uneasy with all that JavaScript code that comes with those
> buttons, especially the 181.1 KB of jQuery (v1.4.2) that turns up in

Use this for source instead, a most people will already have it in their
cache. (Or whatever the official link is, I just googled this link up.)

https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

//Jakob
Alexander Burger | 1 Feb 2012 11:08
Picon

Re: Social Share Privacy buttons in the PicoLisp Wiki

Hi Jon,

> I'm more uneasy with all that JavaScript code that comes with those
> buttons, especially the 181.1 KB of jQuery (v1.4.2) that turns up in
>  <at> lib/socialshareprivacy/js.l. I have trouble understanding that an
> entire jQuery library is needed for those buttons to work. All that
> JavaScript code for just a few buttons doesn't feel right when used
> in company with "The Scalpel of Programming". Sorry for being so
> negative about this. ;-)

No, you are very right. I feel exactly the same about it.

Initially, I thought to recreate these buttons with PicoLisp on-board
mechanisms. However, I feel that it is more "right" to take these
"official" buttons, for example to spread this 2-click concept and its
idea.

And, of course, it would involve quite a lot of work to find out how
exactly they work, and how they communicate with the social networks
behind them.

And, third, I expect Heise Verlag to support these buttons in the
future, possibly supporting other networks and/or features. Keeping in
sync with that would involve even more work.

> I may not see the benefit of having those buttons at the bottom of
> every page in the PicoLisp Wiki. If they will generate increased

The overhead may not be sooo big as it looks like. The jQuery code is
loaded only once, and then cached in the browser.
(Continue reading)

Henrik Sarvell | 1 Feb 2012 11:10
Picon
Gravatar

Re: Social Share Privacy buttons in the PicoLisp Wiki

A minified version can be downloaded here (if it is not already used):
http://docs.jquery.com/Downloading_jQuery#Download_jQuery

On Wed, Feb 1, 2012 at 4:50 PM, Jon Kleiser <jon.kleiser@...> wrote:
> Hi Alex,
>
> I may not see the benefit of having those buttons at the bottom of every
> page in the PicoLisp Wiki. If they will generate increased interest in
> PicoLisp, that is very fine, but will we/you be able to say whether they do
> so?
>
> I'm more uneasy with all that JavaScript code that comes with those buttons,
> especially the 181.1 KB of jQuery (v1.4.2) that turns up in
>  <at> lib/socialshareprivacy/js.l. I have trouble understanding that an entire
> jQuery library is needed for those buttons to work. All that JavaScript code
> for just a few buttons doesn't feel right when used in company with "The
> Scalpel of Programming". Sorry for being so negative about this. ;-)
>
> /Jon
> --
> UNSUBSCRIBE: mailto:picolisp@...?subject=Unsubscribe
Imran Rafique | 1 Feb 2012 14:53
Gravatar

Re: (symbols) inside a function

Thanks for responding Alex.

As you know, I'm just trying out picolisp in my spare time (hence my slow
responses on this list, sorry about that). To put some context to these
questions, I thought that using seperate namespaces to simulate a key/value
dictionary/hash-table would be a nice idea to play with, to understand picolisp
better.

(alists are nice and easy, but if you update it frequently cons'ing changes to
the begining, it gets slower & slower to work with the less frequently changing
key/values at the end of the alist)

Anyway, as the symbol-table/namespace itself is just a big hash-table, then all
we would need are: + a way to create a new namespace + check if a variable
exists in that namespace + get or set a variable in that namespace

I'm going to pull my original comments, and your replies, out of order and put
them under the above 3 headings, just to get a bit of order in here :)

(BTW, I hope this doesn't come across as "dogshedding" - or "arguing for
aguments sake". I'm genuinely interested to see where I can use picolisp in my
current stack - its 1/10th the memory footprint of racket!)

# a way to create a new namespace
#################################
>> (mk Dc)
>
> creates a new namespace 'Dc', and immidiately sets the current namespace
> back to 'pico'. That's all right.

(Continue reading)

José Romero | 1 Feb 2012 16:52
Picon

Re: (symbols) inside a function

On Wed, 1 Feb 2012 05:53:11 -0800
Imran Rafique <imran@...> wrote:

> Thanks for responding Alex.
> 
> As you know, I'm just trying out picolisp in my spare time (hence my
> slow responses on this list, sorry about that). To put some context
> to these questions, I thought that using seperate namespaces to
> simulate a key/value dictionary/hash-table would be a nice idea to
> play with, to understand picolisp better.
> 
> (alists are nice and easy, but if you update it frequently cons'ing
> changes to the begining, it gets slower & slower to work with the
> less frequently changing key/values at the end of the alist)
> 
Why not use a 'idx tree then? http://software-lab.de/doc/refI.html#idx

##################################################
# I used 'name here to prevent accidental clobbering
(de iset (Tree Key Value)
   (set
      (or
         (car (idx Tree Key))
         (prog1 (name Key) (idx Tree  <at>  T)) )
      Value ) )

(de iget (Tree Key)
   (val (car (idx Tree Key))) )

###### Tests ######
(Continue reading)

Alexander Burger | 1 Feb 2012 20:59
Picon

Re: (symbols) inside a function

Hi Imran,

> As you know, I'm just trying out picolisp in my spare time (hence my slow
> responses on this list, sorry about that). To put some context to these

That's perfect. No hurry :)

I also want to spend more time concentrating on project work.

> questions, I thought that using seperate namespaces to simulate a key/value
> dictionary/hash-table would be a nice idea to play with, to understand picolisp
> better.

While this is theoretically possible, I would stronly disadvise it.

Namespaces are a huge overhead, if you just want to create some data
lookup structure. Calling 'symbols' creates a copy of the current
namespace, so this means that for a (relatively small) namespace of 1000
symbols, a tree of 1000 nodes (or roughly 1500 cells) is copied. That's
24000 bytes of memory. Searching for a few symbols in that big tree is
also unnecessarily slow.

> (alists are nice and easy, but if you update it frequently cons'ing changes to
> the begining, it gets slower & slower to work with the less frequently changing

A simple linear list search is for up to 100 or so items probably faster
than a lookup in the above large tree.

> key/values at the end of the alist)

(Continue reading)

Jakob Eriksson | 3 Feb 2012 14:31
Picon

Suggestion for message to passers by


Hello!

Suggestion:  put prominently on the picolisp.com site two things:

How to sign up to this mailing list,

 and

"if you ask a question on Stackoverflow and put the picolisp tag on the
question,
we have people monitoring there for new picolisp questions"

best regards,
Jakob
Henrik Sarvell | 4 Feb 2012 05:55
Picon
Gravatar

Re: Suggestion for message to passers by

Seems like a good idea!


On Fri, Feb 3, 2012 at 8:31 PM, Jakob Eriksson <jakob-n3I6myebJzmL/mWF2lcskw@public.gmane.org> wrote:


Hello!

Suggestion:  put prominently on the picolisp.com site two things:

How to sign up to this mailing list,

 and

"if you ask a question on Stackoverflow and put the picolisp tag on the
question,
we have people monitoring there for new picolisp questions"


best regards,
Jakob
--
UNSUBSCRIBE: mailto:picolisp <at> software-lab.de?subject=Unsubscribe

Henrik Sarvell | 4 Feb 2012 12:48
Picon
Gravatar

Re: pl-web, almost a web development framework

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 to see it in effect.
3.) Download / load mime files, try
http://localhost:8080/public/test.html and
http://localhost:8080/public/test.txt

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))

(printJson
   (list
      (list "two-people" "[]" Anna Peter)
      '("name" . "Smith")
      '("age" . 25)
      '("a-bool" . T)
      '("some-bools" "[]" T NIL T T T NIL NIL)
      '("address"
         ("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 <hsarvell@...> wrote:
>
> 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
> cmd.l).
>
> How to test:
>
> 1.) Unpack the attached file into /opt/picolisp and create
> /tmp/pl-web/sessions/.
>
> 2.) Create a folder called simple-web-app in /opt/picolisp/projects
> and paste the following into a main.l file there:
>
> (load
>   "pl-web/pl-web.l"
>   "pl-web/pl-html.l")
>
> (de login (Msg)
>   (<plw-form> NIL ""
>      (<span> NIL "Username:")
>      (<plw-field> "text" "username" (gReq "username"))
>      (<br>)
>      (<span> NIL "Password:")
>      (<plw-field> "password" "password" "")
>      (<br>)
>      (<submit> "Submit")
>      (<br>)
>      (<span> NIL Msg) ) )
>
> (de app ()
>   (fatApp
>      (html 0 "PL Web" *Css NIL
>         (<div> NIL (println "Post: " *Post " Cookies: " *Cookies))
>         (cond
>            ((= (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 <at> 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.
>
> Comments?
>
> /Henrik Sarvell
Attachment (pl-web.tar.bz2): application/x-bzip2, 3275 bytes
Attachment (simple-web-app.tar.bz2): application/x-bzip2, 1417 bytes

Gmane