Network save and load
Hello, In DrGeo I want a new feature: users could save and load sketches in a remote server. It could be done with FTP or HTTP, or any other means. I don't have any experience in networked operation nor what it is possible to do with the Pharo classes library. What are your suggestion? Thanks Hilaire -- Dr. Geo -- http://www.drgeo.eu
Hilaire, On 03 Dec 2011, at 10:38, Hilaire Fernandes wrote:
Hello,
In DrGeo I want a new feature: users could save and load sketches in a remote server. It could be done with FTP or HTTP, or any other means. I don't have any experience in networked operation nor what it is possible to do with the Pharo classes library.
What are your suggestion?
Thanks
Hilaire
I would use HTTP with basic authentication to start with, like Monticello does today. Account management is a seperate problem, as is some security strategy. You probably intent to have sharing, so you have to think about that too. The client side could be very simple (for simplicity let's assume you store strings, you could pick a better representation with automatic encoding/decoding, later on): "Get drawing1" ZnClient new username: 'john' password: 'secret'; get: 'http://www.drgeo.eu/drawings/johnsbook/drawing1'. "Store a new drawing or overwrite an existing one" ZnClient new username: 'john' password: 'secret'; contents: 'a string representation of a drawing'; put: 'http://www.drgeo.eu/drawings/johnsbook/drawing1'. "Delete a drawing" ZnClient new username: 'john' password: 'secret'; delete: 'http://www.drgeo.eu/drawings/johnsbook/drawing1'. "List my drawings" ZnClient new username: 'john' password: 'secret'; get: 'http://www.drgeo.eu/drawings/johnsbook/'. The server side would not be that much work either: have a look at how the ZnMonticelloServerDelegate class (to be combined with a ZnServer). This implements a comparable protocol. HTH, Sven
Thanks very much for your tips and examples, it is very valuable. Thanks a lot. On the server side I want to be server neutral, and use what ever resource is there: Apache, FTP. And may be I don't want to build a specific Smalltalk server, at least for now. Is it possible to use FTP client in Pharo? Hilaire Le 03/12/2011 11:45, Sven Van Caekenberghe a écrit :
Hilaire,
On 03 Dec 2011, at 10:38, Hilaire Fernandes wrote:
Hello,
In DrGeo I want a new feature: users could save and load sketches in a remote server. It could be done with FTP or HTTP, or any other means. I don't have any experience in networked operation nor what it is possible to do with the Pharo classes library.
What are your suggestion?
Thanks
Hilaire
I would use HTTP with basic authentication to start with, like Monticello does today. Account management is a seperate problem, as is some security strategy. You probably intent to have sharing, so you have to think about that too.
The client side could be very simple (for simplicity let's assume you store strings, you could pick a better representation with automatic encoding/decoding, later on):
"Get drawing1"
ZnClient new username: 'john' password: 'secret'; get: 'http://www.drgeo.eu/drawings/johnsbook/drawing1'.
"Store a new drawing or overwrite an existing one"
ZnClient new username: 'john' password: 'secret'; contents: 'a string representation of a drawing'; put: 'http://www.drgeo.eu/drawings/johnsbook/drawing1'.
"Delete a drawing"
ZnClient new username: 'john' password: 'secret'; delete: 'http://www.drgeo.eu/drawings/johnsbook/drawing1'.
"List my drawings"
ZnClient new username: 'john' password: 'secret'; get: 'http://www.drgeo.eu/drawings/johnsbook/'.
The server side would not be that much work either: have a look at how the ZnMonticelloServerDelegate class (to be combined with a ZnServer). This implements a comparable protocol.
HTH,
Sven
-- Dr. Geo -- http://www.drgeo.eu
Hilaire if you have a simple solution for the server side I would be interested because it would be a cool example for the chapter on Zinc. Stef On Dec 3, 2011, at 11:45 AM, Sven Van Caekenberghe wrote:
"List my drawings"
ZnClient new username: 'john' password: 'secret'; get: 'http://www.drgeo.eu/drawings/johnsbook/'.
The server side would not be that much work either: have a look at how the ZnMonticelloServerDelegate class (to be combined with a ZnServer). This implements a comparable protocol.
For the server side I should not do anything. It should rely on existing server in school or whatever: FTP or even WebDav service as it exists in Apache or even CMS applicaton like Zope, may be Moodle ? Hilaire Le 03/12/2011 22:30, Stéphane Ducasse a écrit :
Hilaire
if you have a simple solution for the server side I would be interested because it would be a cool example for the chapter on Zinc.
Stef On Dec 3, 2011, at 11:45 AM, Sven Van Caekenberghe wrote:
"List my drawings"
ZnClient new username: 'john' password: 'secret'; get: 'http://www.drgeo.eu/drawings/johnsbook/'.
The server side would not be that much work either: have a look at how the ZnMonticelloServerDelegate class (to be combined with a ZnServer). This implements a comparable protocol.
-- Dr. Geo -- http://www.drgeo.eu
Le 03/12/2011 11:45, Sven Van Caekenberghe a écrit :
"List my drawings"
ZnClient new username: 'john' password: 'secret'; get: 'http://www.drgeo.eu/drawings/johnsbook/'.
I try ZnClient get: 'http://icp.ge.ch/co/plonecoudriers/maths/drgeo/' username: 'hilaire' password: 'xxx' but I only get the content of the rendered page. How can I fetch the file list.
From Gnome, I added in the file manager a distant server dav://hilaire@icp.ge.ch/co/plonecoudriers/maths/drgeo and it give me back the listed file.
-- Dr. Geo -- http://www.drgeo.eu
Hi Hilaire, On 11 Dec 2011, at 11:03, Hilaire Fernandes wrote:
I try
ZnClient get: 'http://icp.ge.ch/co/plonecoudriers/maths/drgeo/' username: 'hilaire' password: 'xxx'
but I only get the content of the rendered page. How can I fetch the file list.
From Gnome, I added in the file manager a distant server dav://hilaire@icp.ge.ch/co/plonecoudriers/maths/drgeo and it give me back the listed file.
I haven't said it would work out of the box, just that Zn should contain the necessary things to build upon ;-) WebDAV is a quite complicated standard, multiple RFCs, using lots of XML, so it will be difficult to implement all of it. Since I like the DrGeo project and its goals, I will try to help. Give me some time, and I will see what I can come up with. Regards, Sven
Hilaire, On 11 Dec 2011, at 13:57, Sven Van Caekenberghe wrote:
WebDAV is a quite complicated standard, multiple RFCs, using lots of XML, so it will be difficult to implement all of it.
Since I like the DrGeo project and its goals, I will try to help.
Give me some time, and I will see what I can come up with.
OK, here is an early, simplified, totally incomplete, proof of concept: http://www.squeaksource.com/ZincHTTPComponents/Zinc-WebDAV You'll need to load XML Support and the very latest Zn version. I tested on Mac OS X against a free application called 'MediaMaster Server' ( http://itunes.apple.com/us/app/mediamaster-server/id427559105?mt=12 ), which gives you a very simple GUI to quickly set up a Web DAV server. I don't know if you are on Mac. ZnWebDAVClient new host: 'localhost'; port: 8000; username: 'johndoe' password: 'secret'; list; at: 'foo.txt' put: (ZnEntity text: 'Pharo Smalltalk'); at: 'foo.txt'. Right now, you can list the (top-level) files, load a file and save a file. This server returns all files as bytes, I don't know if that is normal. There are so many limitations that I can't list them all ;-) Have a look at the code, this is just the beginning. Most probably this won't work for your server: if possible, give me a login so that I can see what goes wrong. Regards, Sven
participants (3)
-
Hilaire Fernandes -
Stéphane Ducasse -
Sven Van Caekenberghe