From alemmens at xs4all.nl Thu Aug 21 13:12:12 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Thu, 21 Aug 2008 15:12:12 +0200 (CEST) Subject: [rucksack-devel] Re: Rucksack for Clisp fix? Message-ID: <16090.145.64.134.224.1219324332.squirrel@webmail.xs4all.nl> Hi Erik, [Added the Rucksack list to CC.] > First of all, I've been using Rucksack for a few months now in some > personal projects in SBCL (on Linux) and I really like it and never > had any problems with it. That's good to hear ;-) > See the included tar.gz which contains the original Rucksack tree and > one I adapted for Clisp. Thanks. I'll have a look at this soon and get back to you. Arthur From e.winkels at sdu.nl Thu Aug 21 14:08:27 2008 From: e.winkels at sdu.nl (Erik Winkels) Date: Thu, 21 Aug 2008 16:08:27 +0200 Subject: [rucksack-devel] Re: Rucksack for Clisp fix? In-Reply-To: <16090.145.64.134.224.1219324332.squirrel@webmail.xs4all.nl> (Arthur Lemmens's message of "Thu, 21 Aug 2008 15:12:12 +0200 (CEST)") References: <16090.145.64.134.224.1219324332.squirrel@webmail.xs4all.nl> Message-ID: >> See the included tar.gz which contains the original Rucksack tree >> and one I adapted for Clisp. > > Thanks. I'll have a look at this soon and get back to you. Just to be in the clear, since I don't want to steal anyone's credits I just did what the guy here wrote: http://www.lispforum.com/viewtopic.php?f=2&p=749, added a wrapper for file-position and replaced all the calls in rucksack to that wrapper (instead of redefining file-position again which gave all kinds of warnings in CLISP). Then I ran rucksack-test::run-tests and they all passed for my rucksack tree. This probably isn't the way official CLISP support should be added but I needed a quick fix to get Rucksack running on CLISP. Erik From helmut at cybernetic-systems.de Mon Aug 25 08:12:10 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Mon, 25 Aug 2008 10:12:10 +0200 Subject: [rucksack-devel] (not) Understanding proxy Message-ID: <48B2695A.2090003@cybernetic-systems.de> In my rucksack are persons (p1..p3), each has a slot with a list of friend. I set the the friends of p1 to (list p1 p2 p3). Now I want to put p1 onto the friends list of p2: (see ;<-------------- below) and got the error message: There is no applicable method for the generic function # when called with arguments ((#) #). The problem is propably in my (not) understanding what a Proxy is. Are there some more docs than in the doc directory? :-) Thanks, Helmut -------EXAMPLE---------------------------------------------- (with-rucksack (rs *rs-tute-directory* :if-exists :supersede) (with-transaction () (defclass person () ((unique-id :initarg :unique-id :accessor unique-id-of :index :number-index :unique t) (name :initarg :name :accessor name :index :case-insensitive-string-index) (friends :initarg :friends :accessor friends :documentation "List of Friends.")) (:index t) (:metaclass persistent-class)))) (defun find-person-by-name (name) (with-rucksack (rs *rs-tute-directory*) (with-transaction () (rucksack-map-slot rs 'person 'name (lambda (contact) (return-from find-person-by-name contact)) :equal name))) nil) (defun link-friends () (declare (optimize (debug 3))) (with-rucksack (rs *rs-tute-directory*) (with-transaction () (let* ((uid 0) (p1 (make-instance 'person :unique-id (incf uid) :name "p1" :friends nil)) (p2 (make-instance 'person :unique-id (incf uid) :name "p2" :friends nil)) (p3 (make-instance 'person :unique-id (incf uid) :name "p3" :friends nil)) (fs (list p1 p2 p3)) (setf (friends p1) fs)))) (with-rucksack (rs *rs-tute-directory*) (with-transaction () (let ((person (find-person-by-name "p1"))) ;; Set p1 on the friends list of p2. (setf (friends (second (friends person))) (list person)))))) ;<------------------- ---------------------------------------------sbcl------------------------------------------- CL-USER> (rs-tute::link-friends) There is no applicable method for the generic function # when called with arguments ((#) #). [Condition of type SIMPLE-ERROR] From helmut at cybernetic-systems.de Mon Aug 25 11:40:08 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Mon, 25 Aug 2008 13:40:08 +0200 Subject: [rucksack-devel] Re: (not) Understanding proxy In-Reply-To: <48B2695A.2090003@cybernetic-systems.de> References: <48B2695A.2090003@cybernetic-systems.de> Message-ID: <48B29A18.5000809@cybernetic-systems.de> Solved, sorry for the noice. I used list instead of p-list (second instead of p-cadr) etc. Helmut > In my rucksack are persons (p1..p3), each has a slot with a list of friend. > I set the the friends of p1 to (list p1 p2 p3). > Now I want to put p1 onto the friends list of p2: > (see ;<-------------- below) > and got the error message: > > There is no applicable method for the generic function > # > when called with arguments > ((#) > #). > > The problem is propably in my (not) understanding what a Proxy is. > Are there some more docs than in the doc directory? :-) > > Thanks, > Helmut > From helmut at cybernetic-systems.de Tue Aug 26 08:51:54 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Tue, 26 Aug 2008 10:51:54 +0200 Subject: [rucksack-devel] Project "Rucksack" Message-ID: <48B3C42A.3050803@cybernetic-systems.de> It pays off, to give 'rucksack' a try. I'm deeply impressed, and would like to add a rucksack - line to the clbuild (wnpp-) projects: rucksack get_cvs_clnet #Persistence library for Common Lisp. Helmut From alemmens at xs4all.nl Tue Aug 26 11:37:22 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Tue, 26 Aug 2008 13:37:22 +0200 Subject: [rucksack-devel] Re: (not) Understanding proxy In-Reply-To: <48B29A18.5000809@cybernetic-systems.de> References: <48B2695A.2090003@cybernetic-systems.de> <48B29A18.5000809@cybernetic-systems.de> Message-ID: Helmut Enders wrote: > I used list instead of p-list (second instead of p-cadr) etc. Right. Generally you shouldn't use non-persistent datastructures to contain persistent objects, because Rucksack won't be able to keep track of the changes then. Arthur From helmut at cybernetic-systems.de Tue Aug 26 13:19:48 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Tue, 26 Aug 2008 15:19:48 +0200 Subject: [rucksack-devel] defclass Message-ID: <48B402F4.5070609@cybernetic-systems.de> I need a defclass definition *before* I can open a rucksack. What is the right way to do this. Now I do the defclass twice, at toplevel (defclass ... (metaclass persistant-class)) and at runtime in a function (defun repeat-defclass-for-rucksack () (with-transaction (defclass ..) which is not very nice, because I have the defclass code two times. Helmut From alemmens at xs4all.nl Tue Aug 26 16:14:43 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Tue, 26 Aug 2008 18:14:43 +0200 Subject: [rucksack-devel] defclass In-Reply-To: <48B402F4.5070609@cybernetic-systems.de> References: <48B402F4.5070609@cybernetic-systems.de> Message-ID: Helmut Enders wrote: > I need a defclass definition *before* I can open a rucksack. > What is the right way to do this. > > Now I do the defclass twice, at toplevel > > (defclass ... (metaclass persistant-class)) > > and at runtime in a function > > (defun repeat-defclass-for-rucksack () > (with-transaction > (defclass ..) > > > which is not very nice, because I have the defclass code two times. I'm not sure why you need the definition twice. At the moment, my usual approach is to wrap (WITH-RUCKSACK (..) (WITH-TRANSACTION (...) ..)) around the toplevel DEFCLASS form. Then I don't think you need to repeat the DEFCLASS form later on. But I agree that needing to wrap WITH-RUCKSACK etcetera around the DEFCLASS form isn't very pretty, and it makes it almost impossible to reuse the same class definitions with different rucksacks. So I recently wrote some code to work around this restriction. This code isn't in the CVS repository yet, but I tested it already and I'll commit it Real Soon Now. Arthur From helmut at cybernetic-systems.de Wed Aug 27 08:18:10 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Wed, 27 Aug 2008 10:18:10 +0200 Subject: [rucksack-devel] with-transaction Message-ID: <48B50DC2.8020807@cybernetic-systems.de> Do I always need a (with-transaction .. wrapper, even if I'm only reading? (defun find-user-by-login (name) (rucksack-map-slot *rs* 'user 'login (lambda (user) (return-from find-user-by-login user)) :equal name) nil) There is no applicable method for the generic function # when called with arguments (NIL). [Condition of type SIMPLE-ERROR] Helmut From helmut at cybernetic-systems.de Wed Aug 27 13:01:43 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Wed, 27 Aug 2008 15:01:43 +0200 Subject: [rucksack-devel] my rucksack Message-ID: <48B55037.6080804@cybernetic-systems.de> After some questions, .. I finally have finished my first rucksack based application. (It's a small Web application for managing job tickets). I first tried it with postgresql (pg.lisp). But there was alot of code converting from lisp to sql and back, always looking, that there is no wrong character in the sql string :-). As this is a small application, it is not worth to install, initialize and administrate a sql database when moving to a new server. So I tried the persistence with a log-file, (:user :id 3 :name "helmut"). Portable but the code becomes very clumsy. Trying "rucksack' was a blessing in disguise. - I had a steep learning curve. After the tutorial I felt at home. (*) - the code becomes small and clean, the logic flow is no longer interfered with lines doing the persistence. in 'lines of code' you get the persistence nearly for nothing. - my errors could be solved without digging in the sources. (not that I think, it was always the rigth thing, but it was a working one. :-). - it looks very stable. I'm impressed!!! Helmut (*) One thing, I'm still fighting with is (with-transaction .... nearly all my errors came from using it - to often, (with-transaction () ... (function-which-calls-with-transaction)) - or having to many rucksack-calls in one (with-transaction ... - or forgetting it to use around a make-instance etc. From alemmens at xs4all.nl Thu Aug 28 16:23:29 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Thu, 28 Aug 2008 18:23:29 +0200 Subject: [rucksack-devel] my rucksack In-Reply-To: <48B55037.6080804@cybernetic-systems.de> References: <48B55037.6080804@cybernetic-systems.de> Message-ID: Helmut Enders wrote: > I finally have finished my first rucksack based application. Thanks a lot for the report. > (*) One thing, I'm still fighting with is > (with-transaction .... > > nearly all my errors came from using it > - to often, > (with-transaction () ... > (function-which-calls-with-transaction)) Yes, interesting point. I guess Rucksack could allow nested transactions by just ignoring all inner WITH-TRANSACTION forms. (Of course this could also muffle potential errors, so maybe ignoring inner transactions should be optional.) > - or having to many rucksack-calls in one (with-transaction ... I'm not sure what you're saying here. > - or forgetting it to use around a make-instance etc. Hmm, yes. IIRC I played with the idea of automatically creating a 'one-shot' transaction for cases like this, but I never implemented this. The advantage would be that the persistence layer would be even more invisible than it is now. But that could also be a disadvantage. Maybe it would be a good idea to add some kind of STRICT-TRANSACTIONS-P flag. If true, Rucksack would throw an error for nested transactions or missing transactions. If false, it would just DWIM and automatically create missing transactions or ignore superfluous ones. Does that sound reasonable? Arthur From vagif at cox.net Thu Aug 28 16:34:42 2008 From: vagif at cox.net (Vagif Verdi) Date: Thu, 28 Aug 2008 09:34:42 -0700 Subject: [rucksack-devel] my rucksack In-Reply-To: Message-ID: <20080828163446.BFDH6684.fed1rmmtao102.cox.net@fed1rmimpo02.cox.net> EXPLICIT-TRANSACTIONS-P And by default it would be true. -----Original Message----- From: rucksack-devel-bounces at common-lisp.net [mailto:rucksack-devel-bounces at common-lisp.net] On Behalf Of Arthur Lemmens Sent: Thursday, August 28, 2008 9:23 AM To: Dr. Helmut G. Enders; rucksack-devel at common-lisp.net Subject: Re: [rucksack-devel] my rucksack Helmut Enders wrote: > I finally have finished my first rucksack based application. Thanks a lot for the report. > (*) One thing, I'm still fighting with is > (with-transaction .... > > nearly all my errors came from using it > - to often, > (with-transaction () ... > (function-which-calls-with-transaction)) Yes, interesting point. I guess Rucksack could allow nested transactions by just ignoring all inner WITH-TRANSACTION forms. (Of course this could also muffle potential errors, so maybe ignoring inner transactions should be optional.) > - or having to many rucksack-calls in one (with-transaction ... I'm not sure what you're saying here. > - or forgetting it to use around a make-instance etc. Hmm, yes. IIRC I played with the idea of automatically creating a 'one-shot' transaction for cases like this, but I never implemented this. The advantage would be that the persistence layer would be even more invisible than it is now. But that could also be a disadvantage. Maybe it would be a good idea to add some kind of STRICT-TRANSACTIONS-P flag. If true, Rucksack would throw an error for nested transactions or missing transactions. If false, it would just DWIM and automatically create missing transactions or ignore superfluous ones. Does that sound reasonable? Arthur _______________________________________________ rucksack-devel mailing list rucksack-devel at common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/rucksack-devel From alemmens at xs4all.nl Thu Aug 28 16:47:05 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Thu, 28 Aug 2008 18:47:05 +0200 Subject: [rucksack-devel] with-transaction In-Reply-To: <48B50DC2.8020807@cybernetic-systems.de> References: <48B50DC2.8020807@cybernetic-systems.de> Message-ID: Helmut Enders wrote: > Do I always need a > (with-transaction .. wrapper, > even if I'm only reading? In principle this wouldn't be necessary for single threaded applications. But it is necessary for multithreaded applications that can have reading and writing transactions 'at the same time'. In such cases a reading transaction could be reading an older version of an object while a writing transaction is creating a newer version. That's why Rucksack always expects an active transaction, even if you're only reading. But I must admit that I never tested these parallel transactions in practice, and it's the part of Rucksack that I feel the least confident about. I also don't expect that I'm going to need parallel transactions for real work soon, so it's unlikely to see much improvement unless other people start working on it. But I /am/ using Rucksack nowadays to work with relatively large datasets (in computational linguistics), and Rucksack's performance is beginning to annoy me. So I'm experimenting with simpler and faster heaps and trying to optimize some of the btree code. Arthur From edi at agharta.de Thu Aug 28 16:50:53 2008 From: edi at agharta.de (Edi Weitz) Date: Thu, 28 Aug 2008 12:50:53 -0400 Subject: [rucksack-devel] my rucksack In-Reply-To: (Arthur Lemmens's message of "Thu, 28 Aug 2008 18:23:29 +0200") References: <48B55037.6080804@cybernetic-systems.de> Message-ID: On Thu, 28 Aug 2008 18:23:29 +0200, "Arthur Lemmens" wrote: > Maybe it would be a good idea to add some kind of > STRICT-TRANSACTIONS-P flag. If true, Rucksack would throw an error > for nested transactions or missing transactions. If false, it would > just DWIM and automatically create missing transactions or ignore > superfluous ones. Does that sound reasonable? Sounds good. I'm sure I'd almost always set the flag to NIL... :) From alemmens at xs4all.nl Thu Aug 28 16:56:11 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Thu, 28 Aug 2008 18:56:11 +0200 Subject: [rucksack-devel] my rucksack In-Reply-To: <20080828163446.BFDH6684.fed1rmmtao102.cox.net@fed1rmimpo02.cox.net> References: <20080828163446.BFDH6684.fed1rmmtao102.cox.net@fed1rmimpo02.cox.net> Message-ID: Vagif Verdi wrote: > EXPLICIT-TRANSACTIONS-P Yes, I like that name. Thanks. > And by default it would be true. I'm not sure about this. Forgetting (or nesting) transactions is more likely to be a beginner's problem, and beginners are less likely to know about subtle options like EXPLICIT-TRANSACTIONS-P anyway. Arthur From vagif at cox.net Thu Aug 28 17:06:17 2008 From: vagif at cox.net (Vagif Verdi) Date: Thu, 28 Aug 2008 10:06:17 -0700 Subject: [rucksack-devel] my rucksack In-Reply-To: Message-ID: <20080828170619.CKYZ6684.fed1rmmtao102.cox.net@fed1rmimpo03.cox.net> Yes, It is a decision between compatibility with old versions (default true), and ease of use for most users (default false) Since I do not have any projects using rucksack (so far), I'd be happy with user friendly default. But existing users might disagree with that. -----Original Message----- From: Arthur Lemmens [mailto:alemmens at xs4all.nl] Sent: Thursday, August 28, 2008 9:56 AM To: Vagif Verdi; rucksack-devel at common-lisp.net Subject: Re: [rucksack-devel] my rucksack Vagif Verdi wrote: > EXPLICIT-TRANSACTIONS-P Yes, I like that name. Thanks. > And by default it would be true. I'm not sure about this. Forgetting (or nesting) transactions is more likely to be a beginner's problem, and beginners are less likely to know about subtle options like EXPLICIT-TRANSACTIONS-P anyway. Arthur From ln at bk.ru Fri Aug 29 05:38:45 2008 From: ln at bk.ru (=?koi8-r?Q?=EC=C5=CF=CE=C9=C4_=EE=CF=D7=C9=CB=CF=D7?=) Date: Fri, 29 Aug 2008 09:38:45 +0400 Subject: =?koi8-r?Q?Re=3A_Re=3A_[rucksack-devel]_with-transaction?= In-Reply-To: References: Message-ID: > But I must admit that I never tested these parallel transactions in > practice, and it's the part of Rucksack that I feel the least confident > about. I also don't expect that I'm going to need parallel transactions > for real work soon, so it's unlikely to see much improvement unless > other people start working on it. > I tried to work with several parallel transactions. About its attempt I wrote in http://common-lisp.net/pipermail/rucksack-devel/2008-July/000399.html From alemmens at xs4all.nl Fri Aug 29 06:52:13 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Fri, 29 Aug 2008 08:52:13 +0200 Subject: [rucksack-devel] with-transaction In-Reply-To: References: Message-ID: Leonid Novikov wrote: > I tried to work with several parallel transactions. > About its attempt I wrote in > http://common-lisp.net/pipermail/rucksack-devel/2008-July/000399.html Ah sorry, I must have missed that mail during my summer vacation. I'll take a look at the code you attached, thanks. Arthur From helmut at cybernetic-systems.de Fri Aug 29 07:29:54 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Fri, 29 Aug 2008 09:29:54 +0200 Subject: [rucksack-devel] my rucksack In-Reply-To: References: <48B55037.6080804@cybernetic-systems.de> Message-ID: <48B7A572.7090705@cybernetic-systems.de> Arthur Lemmens wrote: > Helmut Enders wrote: >> - or having to many rucksack-calls in one (with-transaction ... > > I'm not sure what you're saying here. Me neither, :-) in my web application I had only one (with-transaction () in the handler-function and got errors, so I put many (with-tr... in the lower functions, because I mistakenly thought that was the reason. Now I have put the code back to the *one-with-transaction-version" and it works faultlessly. Helmut From helmut at cybernetic-systems.de Fri Aug 29 08:41:10 2008 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Fri, 29 Aug 2008 10:41:10 +0200 Subject: [rucksack-devel] classes Message-ID: <48B7B626.7050505@cybernetic-systems.de> Using rucksack with many applications, and many users pro application (one rucksack for one user), I'm looking for a function to request the "meta" data of a rucksack (what psql is for postgresql). - what classes (slots) are there etc. I think, it is not to difficult, to do that on user-level, like a doc-list of "(defclass xyz ()..." strings, with a defined name in root. After an eval on these strings, the rest can be done with the map-... functions. Is such a functionality in rucksack, or is a plan already in place? Helmut From alemmens at xs4all.nl Sat Aug 30 20:34:42 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Sat, 30 Aug 2008 22:34:42 +0200 Subject: [rucksack-devel] my rucksack In-Reply-To: <48B7A572.7090705@cybernetic-systems.de> References: <48B55037.6080804@cybernetic-systems.de> <48B7A572.7090705@cybernetic-systems.de> Message-ID: Helmut Enders wrote: > in my web application I had only one (with-transaction () > in the handler-function Yes, that's how I would do it for most web apps. > and got errors, so I put many (with-tr... in the lower functions That shouldn't be necessary. > because I mistakenly thought that was the reason. Now I have put > the code back to the *one-with-transaction-version" and it works > faultlessly. Good ;-) Arthur