newLISP Fan Club

Forum => So, what can you actually DO with newLISP? => Dragonfly => Topic started by: hilti on June 26, 2009, 02:51:13 AM

Title: Dragonfly - a web framework for newLISP
Post by: hilti on June 26, 2009, 02:51:13 AM
Hi newLISPER,



a week ago I started my project "Dragonfly". Now there's something to show, so it needs his own topic.



Currently Dragonfly (version 0.06) includes the following features



- generating HTML tables from lists

- generate several HTML tags (e.g. image, script, rss)

- a sliding panel with debugging information

- a very simple page-controller

- some basic functions for form generation



You can download on Google Code

http://code.google.com/p/dragonfly-newlisp/



I'd like to hear comments, feedback, ideas - just feel free to do.



Cheers

Marc aka Hilti
Title:
Post by: cormullion on June 26, 2009, 07:56:41 AM
It's cool!



Am I supposed to be picking up the css styles? I'm seeing the plain old Times on white background...
Title:
Post by: hilti on June 26, 2009, 12:55:06 PM
cormullion, feel free to do so.



I just added a twitter search function including the generation of some nice bubbles.

Here's a screenshot



(//%3C/s%3E%3CURL%20url=%22http://www.marchildmann.de/dragonfly_twitter.png%22%3Ehttp://www.marchildmann.de/dragonfly_twitter.png%3C/URL%3E%3Ce%3E)



Oh - rest in peace Michael Jackson!





Dragonfly 0.08 is updated on Google Code.
Title:
Post by: ale870 on July 05, 2009, 02:47:15 AM
It is very interesting!

Thank you! I will check it as soon as possible (I think it contains a big potential!)
Title:
Post by: ale870 on July 05, 2009, 02:51:15 AM
A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".

See here:



//http://www.opera.com/dragonfly/



You could have problems from Opera company... since because they are in a similar working area: web...
Title:
Post by: hilti on July 09, 2009, 08:04:48 AM
Quote from: "ale870"A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".

See here:



//http://www.opera.com/dragonfly/



You could have problems from Opera company... since because they are in a similar working area: web...


Hi,



I think the name "Dragonfly web framework" shouldn't get me into trouble. because there are a lot of projects or companies which include the name "Dragonfly" like "Dragonfly BSD", "Dragonfly Webdesign", "Dragonfly CMS" ...



Are there any lawyers in this forum who may help?



Best Regards and I hope You like my project. Version 0.10 is coming soon!!



hilti
Title:
Post by: hilti on July 09, 2009, 09:28:08 AM
I love the speed of newLISP!!!



Check out this picture in my blog post:

http://dragonfly-newlisp.blogspot.com/2009/07/i-love-speed-of-newlisp.html
Title:
Post by: ale870 on July 09, 2009, 09:58:26 AM
Yes I agrree with you, newList is very fast!

In fact I'm using it as scripting language for a new 2d game engine I'm creating!
Title:
Post by: cormullion on July 15, 2009, 09:54:54 AM
unbalanced-parentheses is now running Dragonfly, although just serving up random posts from the archive at the moment. It's working, but only just!



Just one thing I had to change - weird, this one.



In web.lsp:


(define headers '(("Content-type" "text/html")))

didn't work. But:


(define headers '(("Content-Type" "text/html")))

did. Must be some FreeBSD thing...



Jeff and Hilti: thanks for your efforts!
Title:
Post by: m35 on July 15, 2009, 11:41:35 AM
Quote from: "hilti"
Quote from: "ale870"A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".

See here:



//http://www.opera.com/dragonfly/



You could have problems from Opera company... since because they are in a similar working area: web...

I think the name "Dragonfly web framework" shouldn't get me into trouble. because there are a lot of projects or companies which include the name "Dragonfly" like "Dragonfly BSD", "Dragonfly Webdesign", "Dragonfly CMS" ...

Fans of a certain web site that would humorously respond to weekly emails might enjoy a slight name change to "Dagronfly" (I said consummate v's! Consummate! (//http))
Title:
Post by: hilti on July 15, 2009, 12:18:08 PM
WOW! So great to see it working on Your website.



hilti
Title:
Post by: ale870 on July 15, 2009, 01:43:20 PM
Quote from: "m35"
Quote from: "hilti"
Quote from: "ale870"A note: carefully check the name of your framework, since Opera Browser has a debugger called "Dragonfly".

See here:



//http://www.opera.com/dragonfly/



You could have problems from Opera company... since because they are in a similar working area: web...

I think the name "Dragonfly web framework" shouldn't get me into trouble. because there are a lot of projects or companies which include the name "Dragonfly" like "Dragonfly BSD", "Dragonfly Webdesign", "Dragonfly CMS" ...

Fans of a certain web site that would humorously respond to weekly emails might enjoy a slight name change to "Dagronfly" (I said consummate v's! Consummate! (//http))


Hello @m35, but are you referring to me when you say "Fans of a certain web site that would humorously respond to weekly emails" ?!
Title:
Post by: cormullion on July 15, 2009, 02:49:11 PM
(See sbemail (//http))



Hilti - I'm looking at dragonfly v12 now!



If you made Dragonfly:listener able to accept single queries such as "www.example.com/?teststring", then could I use .htaccess mod_rewrite to redirect URIs of the form "www.example.com/teststring" to "www.example.com/?teststring"? Not quite sure about your 'action' yet...



Cheers!
Title:
Post by: hilti on July 16, 2009, 08:03:02 AM
Quote from: "cormullion"
If you made Dragonfly:listener able to accept single queries such as "www.example.com/?teststring", then could I use .htaccess mod_rewrite to redirect URIs of the form "www.example.com/teststring" to "www.example.com/?teststring"? Not quite sure about your 'action' yet...


Hi!



Using htaccess mod_rewrite should be possible, but I didn't test it, because I just use newLISP as a webserver at the moment.



The "action" idea is about simulating something like a REST Interface, because newLISP always returns the 200 status code in CGI mode. Maybe I'm not finding the right switch ...



An "action" can be something like



/customer/show/1

/customer/findall

/customer/delete/1



You know what I mean?



cheers

hilti
Title:
Post by: Lutz on July 16, 2009, 09:42:01 AM
Quotebecause newLISP always returns the 200 status code in CGI mode. Maybe I'm not finding the right switch ...


You can force a different status code and text using the "Status: ..." directive from the CGI specification. This is described here:



http://www.newlisp.org/downloads/CodePatterns.html#toc-22



in the sub chapter: "CGI processing in HTTP mode"
Title:
Post by: m35 on July 16, 2009, 09:56:21 AM
Quote from: "ale870"Hello @m35, but are you referring to me when you say "Fans of a certain web site that would humorously respond to weekly emails" ?!

Ah no sorry ale870. I was making a (perhaps too obscure) reference to a bit of internet culture/humor. cormullion seems to have picked up on it and provided an informative link. :)


Quote from: "cormullion"(See sbemail (//http))
Title:
Post by: ale870 on July 16, 2009, 11:28:17 AM
Sorry m35 for my misunderstanding!
Title:
Post by: hilti on July 25, 2009, 02:36:42 AM
Just a short notice: Dragonfly version 0.17 is out!



Dragonfly 0.17 provides some cool functions for auto-loading modules and custom helpers. Just put them into the specified directories "helpers-active" or "modules-active" and Dragonfly loads them on startup.



This way the Dragonfly web framework keeps small and efficient. You just load what You need.



Download it now and have fun!

http://code.google.com/p/dragonfly-newlisp/downloads/list



(//%3C/s%3E%3CURL%20url=%22http://2.bp.blogspot.com/_CFrdlmy-B-I/SmrQGIPBE2I/AAAAAAAAAH0/Ece94VoTE74/s1600-h/Bild+3.png%22%3E%3CLINK_TEXT%20text=%22http://2.bp.blogspot.com/_CFrdlmy-B-I/S%20...%20Bild+3.png%22%3Ehttp://2.bp.blogspot.com/_CFrdlmy-B-I/SmrQGIPBE2I/AAAAAAAAAH0/Ece94VoTE74/s1600-h/Bild+3.png%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
Title:
Post by: ale870 on July 25, 2009, 02:45:26 AM
In these days I'm starting to work with Dojo framework, a language-independent AJAX client (one of the most famous). It is open source. See here:



http://www.dojotoolkit.org/



Since it is language independent, it means it can be used even from newLisp...



So I think you could start to introduce such framework (or another one) instead producing pure html.

Dojo works in xml and json (and newLisp can do that very well).

I think in this way to could give a BIG improvement to your framework (and a lot of work  is done, since Dojo is stable and really well done!).
Title:
Post by: newdep on July 25, 2009, 05:50:35 AM
On itself those kits are nice like //http://qooxdoo.org/..

but a big disadvantgage I encountered is the speed and browser

compatibility...But they sure do have nice widgets ;-)
Title:
Post by: ale870 on July 25, 2009, 06:51:17 AM
Try to use Dojo (check the demos). There is a delay on first usage (download javascript: about 130kb) but the system is really responsive.
Title:
Post by: hilti on July 26, 2009, 11:43:53 AM
Quote from: "ale870"Try to use Dojo (check the demos). There is a delay on first usage (download javascript: about 130kb) but the system is really responsive.


Hi Alessandro,



the Dojo Toolkit is really impressive. Although I like fancy AJAX-Stuff, drag & drop and those things I'm a bit aware of these bloated libraries. They're like MS Excel or Word where users just utilize 10% of the whole software.



Think about what users really need: isn't it a fast loading website, an interface/design which runs on mobiles like the iPhone too, content which is accessible by search engine bots.



If You try to load 130kb via Edge on a Mobile ... users will quit before they read Your first headline. And making things worse: most of the cool JS-Stuff won't really work in a touch environment like the iPhone.



cheers

Marc
Title: dragonfly web framework license
Post by: joejoe on September 07, 2009, 11:34:15 AM
hi hilti - looks like really cool code you've released.



im curious to know why you chose the mit license instead of the license that newlisp uses, the gpl? any chance you might consider the gpl for future releases?



thanks in any case! - :0)
Title:
Post by: TedWalther on September 07, 2009, 01:01:02 PM
How about the two-clause BSD license?
Title:
Post by: cormullion on September 07, 2009, 02:30:57 PM
just out of interest, what's the difference between the suggested licences?
Title:
Post by: xytroxon on September 07, 2009, 04:10:31 PM
Is BSD The New GPL? (//http)



Note: Zed Shaw is the former Ruby language programming guru, now Python language advocate... Zed does not mince words over his opinionated views on programming, and does not suffer fools (or Rubists ;) lightly... That said, he is usually right... And now prefering GPL over BSD for his new works... But most people nowdays, that don't want to suffer the pains of trying to figure out (let alone try to strictly follow), either license's rules, just throw up their hands and use the MIT license, as the least painful license for simple works they wish to share... Of course that p*sses the GPL's Richard Stallman off to no end ;p)



//http://en.wikipedia.org/wiki/BSD_licenses



//http://en.wikipedia.org/wiki/GNU_General_Public_License



//http://en.wikipedia.org/wiki/MIT_License
Title:
Post by: hilti on September 07, 2009, 10:18:10 PM
Quote from: "xytroxon" But most people nowdays, that don't want to suffer the pains of trying to figure out (let alone try to strictly follow), either license's rules, just throw up their hands and use the MIT license, as the least painful license for simple works they wish to share...


That's why I use the MIT License.



What are the benefits when I use the GPL License for Dragonfly - are there any?
Title:
Post by: TedWalther on September 07, 2009, 11:25:28 PM
Quote from: "cormullion"just out of interest, what's the difference between the suggested licences?


I think the modern two-clause BSD license is shortest and easiest to understand.
Title:
Post by: xytroxon on September 08, 2009, 01:25:10 AM
Here's an article, that for several possible advantages, such as for profit use, suggests the Apache License:

Does GPL still matter? (//http)
QuoteJagielski claims that Apache's licensing terms are written to be comprehensible to people with no legal training. "It's very, very easy to read and understand, so it's a less risky license for external companies to use," he says.


//http://en.wikipedia.org/wiki/Apache_License
Quote... as of July 2009, over 5000 non-ASF projects located at SourceForge.net are available under the terms of the Apache License.


QuoteThe Apache Software Foundation and the Free Software Foundation (FSF) agree that the Apache License 2.0 is a free software licence, compatible with version 3 of the GNU General Public License (GPL).



However, the Free Software Foundation considers all versions of the Apache License (as of 2007) to be incompatible with the previous GPL versions 1 and 2.


-- xytroxon
Title:
Post by: hilti on September 17, 2009, 12:26:13 PM
... counting 37 downloads at Google Code :-)



I'm just wondering if anybody else uses Dragonfly for his projects? One project beside my own website is here: //http://daycaster.org



Cheers

Hilti (working on version 0.20)
Title:
Post by: cormullion on September 17, 2009, 02:02:05 PM
i do!  //http://unbalanced-parentheses.nfshost.com/



I think it's great. I've found Dragonfly easy to use and reliable. The only problem is that when a new version is released it's quite hard to work out which files to install, which to modify, and which to ignore. Perhaps that's a difficult architecture to design...
Title:
Post by: Lutz on September 17, 2009, 02:31:58 PM
http://www.ohloh.net/p/dragonfly-newlisp
Title:
Post by: Kirill on September 18, 2009, 12:24:57 AM
Quote from: "hilti"... counting 37 downloads at Google Code :-)



I'm just wondering if anybody else uses Dragonfly for his projects? One project beside my own website is here: //http://daycaster.org



Cheers

Hilti (working on version 0.20)


Not yet, but I consider dragonfly (to try it out) for a PSI server.
Title:
Post by: hilti on September 18, 2009, 02:40:58 AM
Quote from: "Kirill"


Not yet, but I consider dragonfly (to try it out) for a PSI server.


Hi Kirill



what is a PSI server? Never heard of it.
Title:
Post by: hilti on September 18, 2009, 02:42:04 AM
Quote from: "Lutz"http://www.ohloh.net/p/dragonfly-newlisp


That's just me, Lutz ;-)
Title:
Post by: Kirill on September 18, 2009, 03:31:26 AM
Quote from: "hilti"
Hi Kirill



what is a PSI server? Never heard of it.


PSI stands for Public Subject Identifier (in the Topic Maps world that is). A PSI is an URI that servers two purposes: as a unique identifier for a subject and as a URL which can be entered into a browser to provide the end-user a description of what the subject refers to.



psi.ontopedia.net (//http) is a PSI server.



-- Kirill
Title: Re: dragonfly web framework license
Post by: joejoe on October 01, 2009, 11:48:13 AM
Quote from: "joejoe"hi hilti - looks like really cool code you've released.



im curious to know why you chose the mit license instead of the license that newlisp uses, the gpl? any chance you might consider the gpl for future releases?



thanks in any case! - :0)


i either misread or youve updated the license to gplv3 (like nL) !! :D



thanks for this, hilti! im downloading right now!
Title:
Post by: hilti on October 01, 2009, 12:06:30 PM
That's right. I've updated the license to GPL (v3), because I didn't see any difference (for my intention) between MIT License or GPL.



I just want the Dragonfly to be open source and free available.



Cheers!

Hilti
Title:
Post by: hilti on October 12, 2009, 01:21:16 PM
http://dragonfly.nfshost.com[/url]



The Dragonfly ajax functions in action:

//http://dragonfly.nfshost.com/dragonfly_ajax/index



Download it here

//http://code.google.com/p/dragonfly-newlisp/downloads/list



Have fun!

Hilti
Title:
Post by: cormullion on October 12, 2009, 02:11:05 PM
Cool! Will upgrade soon...
Title: thanks for the user guide
Post by: joejoe on October 12, 2009, 03:14:12 PM
the user guide really helped me get up and running in less than a minute. thanks!
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 06, 2009, 08:57:06 AM
Is your new version 0.50 available to non-Mercurial users yes?



(I gather Mercurial is another thing like git or subversion...?)
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 06, 2009, 06:11:05 PM
Quote from: "cormullion"Is your new version 0.50 available to non-Mercurial users yes?



(I gather Mercurial is another thing like git or subversion...?)


It will be ready sometime this month, but there's still some work to be done before we make a release.



Mercurial is a DVCS like git (SVN is not a DVCS), it's pretty simple to use, just takes a little reading (//http) and then you'll get the hang of it.



Short instructions:



To grab a copy from the repo:


$ hg clone https://dragonfly-newlisp.googlecode.com/hg/ dragonfly-newlisp

To update your copy (I would do this once a day):


$ cd dragonfly-newlisp
$ hg pull -uf


If you're not committing code, that's really all you'll need to do anyway. :-)



To run the example-site, read the README and the INSTALL documents.
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 07, 2009, 06:58:48 AM
thanks... I managed to obtain a copy (thanks!)



I'm now trying to copy my content over to the new framework. It's not going too badly, but there are a lot of changes from the version I'm using!



Edit:



OK, I haven't figured it out yet. These are the kind of URIs I want to handle:



http://unbalanced-parentheses.nfshost.com/syntaxmatters

http://unbalanced-parentheses.nfshost.com/newlispatwikibooksvolunteerswanted

http://unbalanced-parentheses.nfshost.com/jack-the-glypher/  -> directory containing index.cgi

http://unbalanced-parentheses.nfshost.com/downloads          -> directory



I used to test the selector:


(if (= "" Dragonfly:selector)

and provide a default page if I didn't find the string I wanted. What's the mechanism for doing this?
Title: Re: Dragonfly - a web framework for newLISP
Post by: hilti on November 07, 2009, 11:55:56 AM
Hi Cormullion!



Just a short help to Your "downloads" problem: You could use a static route to it described on this page in the User Guide: //http://www.rundragonfly.com/dragonfly_routes



Put this into your view
<% (link_to "Downloads" "downloads") %>

About the selector:

I've to test some things out, but maybe you can create your own route described here

//http://www.rundragonfly.com/dragonfly_create_routes



Hope this helps!

Hilti
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 07, 2009, 12:16:26 PM
Thanks for the help! I'm not sure I really know what a route is.



In the last version, I had code in the 'view' that took action depending on the selector:


<div id="right">    
    <% (Dragonfly:load-database "blog.nldb") %>
   
    <% (if (= "" Dragonfly:selector)
           (set 'query (nldb:select-rows 'nldb:stories true true 'nldb:story-date >))
           (set 'query (nldb:select-rows 'nldb:stories '(= nldb:story-id Dragonfly:selector)))) %>
   
    <% (unless query (set 'query (nldb:select-rows 'nldb:stories '(= nldb:story-id "aboutthissite")))) %>

    <% (set 'story (first query)) %>
    <% (println {<h1>} (story 2) {</h1>}) %>
    <% (println {<small>} (story 0) {</small>}) %>
    <% (println (last story)) %>

</div>


Do I put this code in a .lsp file in 'plugins-active' (the static route you're talking about)? I would have thought it belonged in the view.



Forgive the stupid questions - I'm trying to catch you up but you're going too fast for me.:)
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 07, 2009, 06:01:06 PM
cormullion, I've updated the dragonfly_routes page with some more detail, read through it carefully, it should explain what they are and how they work. Also, take a look at the page on creating templates (also in the guide).



As of this post it's not up on rundragonfly.com, so view the example-site in your web browser locally using newlisp as the server (again, see the INSTALL and README files if you don't know how to do this). Before doing that though you'll need to pull the latest changes as I showed above first.
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 07, 2009, 08:03:18 PM
Quote from: "cormullion"In the last version, I had code in the 'view' that took action depending on the selector:


<% (if (= "" Dragonfly:selector)


BTW, Dragonfly:selector has been removed. Views no longer have selectors or actions, if you want something like that either make a resource (see the guide on the RESTful route) or use GET/POST parameters with your views instead, or create your own route. If you need help, check the docs, they probably have the answer to your question, but if they don't let us know!
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 08, 2009, 06:15:03 AM
Thanks guys, Dragonfly is looking pretty impressive now. I've been reading the docs again. You've done a nice job.



Here's my problem. I already have the URLs I want (see above). I don't think I can use "RESTful routes" because the first value in these (the resource) has to be the name of the context whereas in my URLs I want it to be the name of the ID (the specific object in the collection). I don't want to create static routes because I don't want to create a page for each ID.



I suppose I'll have to use .htaccess to rewrite the incoming URL to  insert a 'resource' identifier before the ID, and then use the 'action' to store the ID and pass it on to the .lsp resource. And then I can just go 'print' to output HTML? But then what happened to the template...
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 08, 2009, 08:33:02 AM
Quote from: "cormullion"I don't want to create static routes because I don't want to create a page for each ID.


I looked at your URLs again (I hadn't really read your original post) and it seems like creating a page for each of those is the solution you're looking for, otherwise you're not really using Dragonfly to your advantage and end up rewriting a lot of the stuff that it handles efficiently and cleanly for you. You also end up with a massive single file that has a huge if/else block in it...



I'd consider splitting all of your pages into separate files the way the example-site does, but if you don't want to do that then just disable both of the default handlers in config.lsp and create your own route (as described in the guide). Your route would simply grab the first part of the request URL, set the DF:selector, and display your main file. Or you could even check the $GET parameters, i.e.: (if (nil? ($GET "downloads/foo")) ...)



Documentation on all of that ($GET, how to display files, etc.) is in the Core API (linking to my copy since rundragonfly.com currently isn't updated):



http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api
Title: Re: Dragonfly - a web framework for newLISP
Post by: Lutz on November 08, 2009, 11:34:19 AM
Congratulations! Is this the official link to the Dragonfly docs?



http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api



let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 08, 2009, 01:52:19 PM
Quote from: "Lutz"Congratulations! Is this the official link to the Dragonfly docs?



http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api


That's just my personal testing ground for Dragonfly with Apache, the official link will be on the rundragonfly site once 0.50 is released:



//http://www.rundragonfly.com/dragonfly_api



That site isn't up-to-date as of this posting though.


Quotelet me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.


Definitely! :-)



I think 0.50 should be around the corner very soon, the core I think is done and so is the User's Guide. Here's a link to the first page:



//http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_welcome
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 08, 2009, 03:29:13 PM
Quote from: "itistoday"it seems like creating a page for each of those is the solution you're looking for [...]



... I'd consider splitting all of your pages into separate files


Each of those URLs is (when stripped of the domain name) the ID of an entry in a database. It made sense to me to have a single 'design' or template which was then applied to the information when extracted from the database. I'll have another look at the documents and work out  how to do it the new way.
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 08, 2009, 06:18:01 PM
Quote from: "cormullion"Each of those URLs is (when stripped of the domain name) the ID of an entry in a database. It made sense to me to have a single 'design' or template which was then applied to the information when extracted from the database. I'll have another look at the documents and work out  how to do it the new way.


Ah! Gotcha, sorry, I didn't know that's what you were doing, and my sincere apologies if you mentioned it (I must have missed that part *whoops*).



In that case then a custom-route is the way to go, and yours should be extremely simple. For info on how to create a route (as well as an example) see this page:



//http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_create_routes



Or once it's updated, the official page:



//http://www.rundragonfly.com/dragonfly_create_routes



If you're not going to be using the other routes you can disable them, or place yours at the head of the 'dragonfly-routes' list so that it's evaluated first (for efficiency).
Title: Re: Dragonfly - a web framework for newLISP
Post by: hilti on November 10, 2009, 02:10:27 PM
Quote from: "Lutz"Congratulations! Is this the official link to the Dragonfly docs?



http://www.taoeffect.com/dragonfly-newlisp/example-site/dragonfly_api



let me know when I can link to this (or other address) from the http://www.newlisp.org/modules/ page.


The official Dragonfly docs are here now: //http://www.rundragonfly.com/dragonfly-api/index.html

Or in our site design: //http://www.rundragonfly.com/dragonfly_api



Cheers

Marc
Title: Re: Dragonfly - a web framework for newLISP
Post by: Lutz on November 10, 2009, 04:39:21 PM
... Dragonfly docs-index and site are now also accessible from here:



http://www.newlisp.org/modules/



and here:



http://www.newlisp.org/index.cgi?Code_Contributions



Not sure if the home page links for the authors Marc and Greg are correct on that last page.



Ps: The http://www.newlisp.org/code/modules/sqlite3.lsp.html module and help page has also been updated again.
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 11, 2009, 09:45:59 AM
I've nearly got my site working on Dragonfly 0.50. It's just me being slow - it's like waking up and finding that someone's moved all the furniture... :)



I can't quite work out one thing - how to make the forms work. For example, in the old version, I had this sort of thing for 'search':


<div class="form">
      <form id="search" action="/search/for" method="POST" />
      <p>
      <input type="text" class="input" name="inputstring" size="8" value="" />
      <input type="submit" name="search" value="Search">
      </p>
      </form>
    </div>


where the "/search/for" got translated somehow, and the template called 'search' was loaded; the search string was obtained by


<% (set 'search-text (lookup "inputstring" Web:POST)) %>

My mind's now gone blank and I can't work out how to set this up in a completely different way.



I have many questions - but first i want to say "awesome job" for all this cool stuff!
Title: Re: Dragonfly - a web framework for newLISP
Post by: hilti on November 11, 2009, 12:08:58 PM
Hi Cormullion!



Great to hear You're working with the new Dragon :)



The POST variables can be accessed like this for Your form.


<% (print ($POST "inputstring")) %>

Hope this helps!



Cheers

Hilti



Example with form:


<div class="form">
      <form id="search" action="" method="POST" />
      <p>
      <input type="text" class="input" name="inputstring" size="8" value="" />
      <input type="submit" name="search" value="Search">
      </p>
      </form>
</div>

<p>
<% (print ($POST "inputstring")) %>
</p>
Title: Re: Dragonfly - a web framework for newLISP
Post by: m35 on November 11, 2009, 12:10:19 PM
I'm quite impressed the site! It's very clean and simple to navigate and understand. The Getting Started walk-though made sense and should make it easy for people to get started.



I've never done any serious web development, but if ever I did, Dragonfly would be a serious contender for my api. It has that very accessible bar of entry, just like newLISP does.
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 12, 2009, 02:03:49 PM
Quote from: "hilti"Hope this helps!

Yes, thanks! That's nice and easy.



I'm now running Dragonfly 0.50 at //http://unbalanced-parentheses.nfshost.com/, and it's working quite well. There's a long list of things to do though.. :)



What's the best way to do Atom/Rss? I've got the code to provide the information, not sure about the routes...



How do you set the title of a page? Looks like the function call in header or something...


<title><% (title) %></title>

Also, I'm puzzled by how the question mark in the URL routes (eg "?welcome") disappears when I'm using  Apache, but appears when using newLISP server. Why is that? It's making the search fall over but it works locally using newLISP server...



Anyway, thanks again to Team Dragonfly!
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 12, 2009, 05:01:06 PM
Quote from: "cormullion"What's the best way to do Atom/Rss? I've got the code to provide the information, not sure about the routes...


If you're serving a static file for your feed then you can just add its extension to the STATIC_TRIGGER_EXTENSIONS in the config.lsp.



You're probably generating it on-the-fly though, so that's probably not what you want.



Instead just make a view (i.e. /feed) and place your newLISP code that outputs your Atom/RSS feed in it. Make sure to set the proper MIME-type though somewhere in there. I.e. place a call like this in your feed view somewhere:


(Response:content-type Response:xml-type)

Or provide your own string:


(Response:content-type "application/atom+xml")

In summary, this would be best done with a view + proper MIME type, there's no need to create a route for this (I don't think).


QuoteHow do you set the title of a page? Looks like the function call in header or something...


<title><% (title) %></title>


That function is from the example-site, it's defined in plugins-active/dragonfly_basic.lsp and uses the symbol DF:viewname (which is set by the STATIC_TRANSFORMATIONS in config.lsp).


QuoteAlso, I'm puzzled by how the question mark in the URL routes (eg "?welcome") disappears when I'm using  Apache, but appears when using newLISP server. Why is that? It's making the search fall over but it works locally using newLISP server...


newLISP doesn't support the .htaccess redirection that apache does (see the explanation in the Getting Started part of the User Guide), and Dragonfly uses the QUERY_STRING to determine which view/resource is being accessed.



However, I've just added functionality to the mercurial repository that removes the need for the ? even when using the built-in newLISP server.



For more information, see the comments in this thread: //http://newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=3168



BTW, when 0.51 is released (or if you're using the latest mercurial), use the newlispServer script to run the newlisp server (as it's no longer as simple as it was). Like this:


$ cd path/to/example-site
$ ./newlispServer
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 13, 2009, 08:50:58 AM
Wow, great tech support too! Thanks. I'll try to get this all working today...



By the way, when you update the framework, you won't overwrite all my changes in "plugins-active" will you? :)
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 13, 2009, 10:27:27 AM
Quote from: "cormullion"By the way, when you update the framework, you won't overwrite all my changes in "plugins-active" will you? :)


Nope. As long as you're not modifying the files that come with Dragonfly and are creating your own plugins your changes won't be overwritten and no conflicts should arise.
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 13, 2009, 03:35:25 PM
Got most things working OK. One exception: an Atom feed. I'm struggling to make any progress with this - ran out of time for now - but hope to address the problem soon.



As I see it, this is the process that ought to work:



1 user request is for 'atom' - http://blah.com/atom



2 dragonfly converts this to a request to display the view file 'atom.html' in views/ ('html'? - well, your RSS file is 'dragonfly_rssfeed.html' in 'views/'.)



3 the 'atom.html' file generates the XML output:
<% (Response:content-type "application/atom+xml") %>
<% (Dragonfly:display-partial "head") %>
code to generate XML using partial templates
<%  (Dragonfly:display-partial "story") %>
<% (Dragonfly:display-partial "foot") %>


where the partial files are called head.xml story.xml and foot.xml. (Or should they be 'html'?)



5 the header for the main web page refers to the XML feed using this function:


(rss "Dragonfly web framework RSS Feed" (web-root "?dragonfly_rssfeed/xml"))

or does there need to be an 'atom' version of this?



Anyway, apart from this one area I've yet to get to grips with, things are looking good!
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 14, 2009, 02:36:40 PM
I found a strange bug relating to the nldb database code... I'm using a revised version of nldb.lsp in plugins-active, but don't know whether you want to add it - or let me add it someday...
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 14, 2009, 03:29:50 PM
Quote from: "cormullion"2 dragonfly converts this to a request to display the view file 'atom.html' in views/ ('html'? - well, your RSS file is 'dragonfly_rssfeed.html' in 'views/'.)


.html if the VIEW_EXTENSION is .html.


Quote3 the 'atom.html' file generates the XML output:
<% (Response:content-type "application/atom+xml") %>
<% (Dragonfly:display-partial "head") %>
code to generate XML using partial templates
<%  (Dragonfly:display-partial "story") %>
<% (Dragonfly:display-partial "foot") %>


Not really, I'm not sure why you're outputting the head/story/footer as you're not displaying an HTML document but an RSS/Atom feed.


Quotewhere the partial files are called head.xml story.xml and foot.xml. (Or should they be 'html'?)


Check the docs (//http) for VIEW_EXTENSION. It's also documented via comments in config.lsp.



If VIEW_EXTENSION is .html, they should be .html if you're using the display-partial/display-view functions. Use display-file/include if you want to avoid the use of VIEW_EXTENSION. See the Dragonfly API for details.


Quote5 the header for the main web page refers to the XML feed using this function:


(rss "Dragonfly web framework RSS Feed" (web-root "?dragonfly_rssfeed/xml"))


Hmm... that's actually outdated (from pre-0.50), I'll fix that. 'web-root' should not have the ? specified in the string and there's no need for the "/xml" after "dragonfly_rssfeed".


Quoteor does there need to be an 'atom' version of this?


If you want to display an atom feed include the appropriate markup to display atom feeds. I personally don't recommend relying too heavily on Dragonfly's markup-shortcut functions like 'rss', it's just as easy to include the actual HTML markup (check what 'rss' does, it's defined in dragonfly_basic.lsp, it's just a shortcut for the the 'link' tag to include an rss file in the page). If you're confused, check with google (//http).
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 15, 2009, 12:34:46 AM
OK, gotcha. I've probably been assuming that I should switch to '.xml' extensions at some stage but sticking with 'html' all the way helps - at least, hitting //http://unbalanced-parentheses.nfshost.com/atom seems to want to produce Atom XML.



The head/story/footer stuff is just so that I can output the XML heading stuff (author update etc) and then loop through each of the last x items.



Thanks again for the help!
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 16, 2009, 10:01:58 AM
I have one more problem... I'm finding that some pages are being processed through Dragonfly but I didn't think they were going to be (they're not views). For example, if you go to //http://unbalanced-parentheses.nfshost.com/downloads/mycroft.nl.html - it's a page generated by newlispdoc - and click on source, the resulting HTML file is being passed through Dragonfly:eval-template. Unfortunately that file contains text (probably multiple [text][/text] pairs) that causes eval-template to fail. It's not  supposed to be a template.


ERR: missing parenthesis : "..."'(){}.0123456789[/text])
called from user defined function Dragonfly:eval-template
called from user defined function Route.Static:run
called from user defined function Dragonfly:listener
called from user defined function run


I thought that files came through 'as they were' if they didn't match anything else. I'm wondering whether I've done something that makes Dragonfly try to evaluate all files...
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 16, 2009, 12:50:50 PM
cormullion, please take a look at how Route.Static works:



//http://www.rundragonfly.com/dragonfly_routes



It will match all files that end in VIEW_EXTENSION, and your source page does as well. Therefore if there are any "code islands" (i.e. stuff that comes after OPEN_TAG: <%) then that will be interpreted as newLISP code and it will be evaluated.



If you don't want that file getting sent through eval-template then there are several things you can do:



- Update your .htaccess file with a RewriteCond to prevent files ending in .src.html from being sent to the index.cgi script. This requires knowledge of .htaccess files (search google for mod_rewrite).



- Do it instead through a custom route that checks if the QUERY_STRING represents one of your source files and then simply pass it through the 'display-file' function. Make sure this route is added to the front of 'DF:dragonfly-routes' so that it gets evaluated before Route.Static.



- Change your VIEW_EXTENSION to something else (and change all your template files as well to that other extension).



In a future version of Dragonfly we could probably add a hook to Route.Static that will allow you to define a function that determines whether the file should be passed through display-view or display-file (as the former sends it through eval-template and the latter doesn't), but for now your easiest solution is to add a custom route, which isn't difficult to do (again, the docs really help you here).



EDIT] Whoops, that's DF:include, not DF:display-file. DF:display-view calls DF:display-file which calls DF:eval-template. Apparently I don't know what my own code does. :-p
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 16, 2009, 03:03:13 PM
OK, thanks! I can solve it by passing it to DF:include... I didn't fully appreciate the fact that every matching file, not just a view file, is passed through eval-template. Makes sense now, though.



I have to admit that I've studied the documents, but still find it hard to solve problems - I'm not a web developer, so I don't have the basics down yet.
Title: Re: Dragonfly - a web framework for newLISP
Post by: itistoday on November 16, 2009, 06:18:56 PM
Quote from: "cormullion"OK, thanks! I can solve it by passing it to DF:include... I didn't fully appreciate the fact that every matching file, not just a view file, is passed through eval-template. Makes sense now, though.


Ack! Sorry for giving you bad information, I've edited my post to mention that DF:include is what you want, not DF:display-file. You figured it out though. :-)


QuoteI have to admit that I've studied the documents, but still find it hard to solve problems - I'm not a web developer, so I don't have the basics down yet.


Just takes practice, you'll get it. :-)



BTW, I *love* your magical rainbow code highlighter stuff.
Title: Re: Dragonfly - a web framework for newLISP
Post by: cormullion on November 18, 2009, 09:59:13 AM
Quote from: "itistoday"BTW, I *love* your magical rainbow code highlighter stuff.


:) I'm still trying to decide whether it's just cool or useful as well!



I realized I haven't uploaded the code for that; it's now uploaded as Module Nestor.
Title: Re:
Post by: joejoe on October 31, 2010, 04:24:02 PM
Quote from: "hilti"
* changed license from MIT to GNU (GPL v3)

Hi, just noticed the ohloh.net Dragonfly listing still has the old license.



http://www.ohloh.net/p/dragonfly-newlisp



Just wanted to let hilti know so he could update it there when he has a chance.



thanks!
Title: Re: Dragonfly - a web framework for newLISP
Post by: hilti on October 31, 2010, 11:28:29 PM
Changed! :-)



Thanks JoeJoe!

Hilti
Title: Re: Dragonfly - a web framework for newLISP
Post by: joejoe on November 01, 2010, 10:38:14 AM
super duper! :D