[Factor-talk] User update magic in edit-profile

2010-02-21 Thread Alex Drummond
Hi,

I've written an implementation of the furnace authentication provider
protocol for couchdb. I decided to do a direct implementation, rather
than write a tuple db interface for couchdb, since when using couchdb
you need to jump through various hoops in order to ensure the
uniqueness of usernames and email addresses.

It's all working fine, except that the edit-profile controller is
not saving the modified user tuple back to the DB. I see that it sets
the changed? flag of the tuple once its submit action finishes, but
I'm having trouble working out how I should hook into whatever method
is supposed to get called in order to commit the update to the DB.

It works fine if I use the following nasty code to manually ensure
that a user-saver is created, and its destructor called:

edit-profile-action
[
responder [
 [
call( -- response )
logged-in-user get user-saver dispose
 ] curry
] change-submit drop
]
[ auth-boilerplate edit-profile add-responder ]
bi

But this is pretty ugly, and I'd like to know what the Right Way is,
if there is one. Any help appreciated.

Alex

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] User update magic in edit-profile

2010-02-21 Thread Slava Pestov
Hi Alex,

Does the call-responder* method of your authentication realm execute
call-next-method? Because M: realm call-responder* calls
save-user-after, which sets up a destructor that will call update-user
when the request is done. If you implement the update-user generic
word then editing the profile should work.

Slava

On Sun, Feb 21, 2010 at 9:59 PM, Alex Drummond
a.d.drumm...@googlemail.com wrote:
 Hi,

 I've written an implementation of the furnace authentication provider
 protocol for couchdb. I decided to do a direct implementation, rather
 than write a tuple db interface for couchdb, since when using couchdb
 you need to jump through various hoops in order to ensure the
 uniqueness of usernames and email addresses.

 It's all working fine, except that the edit-profile controller is
 not saving the modified user tuple back to the DB. I see that it sets
 the changed? flag of the tuple once its submit action finishes, but
 I'm having trouble working out how I should hook into whatever method
 is supposed to get called in order to commit the update to the DB.

 It works fine if I use the following nasty code to manually ensure
 that a user-saver is created, and its destructor called:

    edit-profile-action
    [
            responder [
                 [
                        call( -- response )
                        logged-in-user get user-saver dispose
                 ] curry
            ] change-submit drop
    ]
    [ auth-boilerplate edit-profile add-responder ]
    bi

 But this is pretty ugly, and I'd like to know what the Right Way is,
 if there is one. Any help appreciated.

 Alex

 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] User update magic in edit-profile

2010-02-21 Thread Alex Drummond
Oops, when I switched back to using allow-edit-profile instead of the
hack in the previous email, it worked fine.

I guess there must previously have been a bug in my update-user method
which somehow led me to think that it wasn't being called at all. (I
am just using login-realm, so there wouldn't have been an issue with
call-next-method.)

sorry for the false alarm...
Alex

On 21 February 2010 04:08, Slava Pestov sl...@factorcode.org wrote:
 Hi Alex,

 Does the call-responder* method of your authentication realm execute
 call-next-method? Because M: realm call-responder* calls
 save-user-after, which sets up a destructor that will call update-user
 when the request is done. If you implement the update-user generic
 word then editing the profile should work.

 Slava

 On Sun, Feb 21, 2010 at 9:59 PM, Alex Drummond
 a.d.drumm...@googlemail.com wrote:
 Hi,

 I've written an implementation of the furnace authentication provider
 protocol for couchdb. I decided to do a direct implementation, rather
 than write a tuple db interface for couchdb, since when using couchdb
 you need to jump through various hoops in order to ensure the
 uniqueness of usernames and email addresses.

 It's all working fine, except that the edit-profile controller is
 not saving the modified user tuple back to the DB. I see that it sets
 the changed? flag of the tuple once its submit action finishes, but
 I'm having trouble working out how I should hook into whatever method
 is supposed to get called in order to commit the update to the DB.

 It works fine if I use the following nasty code to manually ensure
 that a user-saver is created, and its destructor called:

    edit-profile-action
    [
            responder [
                 [
                        call( -- response )
                        logged-in-user get user-saver dispose
                 ] curry
            ] change-submit drop
    ]
    [ auth-boilerplate edit-profile add-responder ]
    bi

 But this is pretty ugly, and I'd like to know what the Right Way is,
 if there is one. Any help appreciated.

 Alex

 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] User update magic in edit-profile

2010-02-21 Thread Slava Pestov
Excellent. Looking forward you seeing your code contributed.

Are you interested in refactoring furnace.sessions to allow alternate
session storage as well? Right now its hard-coded to use the database,
but it could also use in-memory sessions (faster performance, no
failover) or couchdb (for people who don't want an RDBMS at all).

Slava

On Sun, Feb 21, 2010 at 10:27 PM, Alex Drummond
a.d.drumm...@googlemail.com wrote:
 Oops, when I switched back to using allow-edit-profile instead of the
 hack in the previous email, it worked fine.

 I guess there must previously have been a bug in my update-user method
 which somehow led me to think that it wasn't being called at all. (I
 am just using login-realm, so there wouldn't have been an issue with
 call-next-method.)

 sorry for the false alarm...
 Alex

 On 21 February 2010 04:08, Slava Pestov sl...@factorcode.org wrote:
 Hi Alex,

 Does the call-responder* method of your authentication realm execute
 call-next-method? Because M: realm call-responder* calls
 save-user-after, which sets up a destructor that will call update-user
 when the request is done. If you implement the update-user generic
 word then editing the profile should work.

 Slava

 On Sun, Feb 21, 2010 at 9:59 PM, Alex Drummond
 a.d.drumm...@googlemail.com wrote:
 Hi,

 I've written an implementation of the furnace authentication provider
 protocol for couchdb. I decided to do a direct implementation, rather
 than write a tuple db interface for couchdb, since when using couchdb
 you need to jump through various hoops in order to ensure the
 uniqueness of usernames and email addresses.

 It's all working fine, except that the edit-profile controller is
 not saving the modified user tuple back to the DB. I see that it sets
 the changed? flag of the tuple once its submit action finishes, but
 I'm having trouble working out how I should hook into whatever method
 is supposed to get called in order to commit the update to the DB.

 It works fine if I use the following nasty code to manually ensure
 that a user-saver is created, and its destructor called:

    edit-profile-action
    [
            responder [
                 [
                        call( -- response )
                        logged-in-user get user-saver dispose
                 ] curry
            ] change-submit drop
    ]
    [ auth-boilerplate edit-profile add-responder ]
    bi

 But this is pretty ugly, and I'd like to know what the Right Way is,
 if there is one. Any help appreciated.

 Alex

 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Vocab for comparing complex data types

2010-02-21 Thread Kobi Lurie
  On 21/2/2010 16:28, Jim mack wrote:
 I have some complicated datastructure, mixing containers  tuples, 
 like an ast.  I would like to get a report on what's different between 
 two of them, say for a test.  Is there an existing vocab for that?  It 
 won't need to be fast.  My first thought was to get the prettyprint 
 representations, then diff through an external tool.

Hi Jim, do you know of mirrors?
 I'm not sure if that's what you mean, but maybe something like this:

 : obj-diff ( big small -- diff )
[ mirror alist ] bi@ swap diff ;

 TUPLE: xyz x y z ;
 xyz new 4 z 2 x
 xyz new 3 x

 --- Data stack:
 T{ xyz f 2 f 4 }
 T{ xyz f 3 f f }
 ( scratchpad - auto ) obj-diff .
 { { x 3 } { z f } }

Best Regards, Kobi

-- 
China: stop persecuting Falun Gong!
http://faluninfo.net

URGENT: Innocent people are being persecuted for their belief inside Communist 
China.



--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Vocab for comparing complex data types

2010-02-21 Thread Jim mack
Thanks!  Never thought to look at that.  I did get something going with the
lcs library, but this may be better.

On Sun, Feb 21, 2010 at 10:44 AM, Kobi Lurie k_lu...@gbrener.org.il wrote:

  On 21/2/2010 16:28, Jim mack wrote:
  I have some complicated datastructure, mixing containers  tuples,
  like an ast.  I would like to get a report on what's different between
  two of them, say for a test.  Is there an existing vocab for that?  It
  won't need to be fast.  My first thought was to get the prettyprint
  representations, then diff through an external tool.

 Hi Jim, do you know of mirrors?
 I'm not sure if that's what you mean, but maybe something like this:

 : obj-diff ( big small -- diff )
[ mirror alist ] bi@ swap diff ;

 TUPLE: xyz x y z ;
 xyz new 4 z 2 x
 xyz new 3 x

 --- Data stack:
 T{ xyz f 2 f 4 }
 T{ xyz f 3 f f }
 ( scratchpad - auto ) obj-diff .
 { { x 3 } { z f } }

 Best Regards, Kobi

 --
 China: stop persecuting Falun Gong!
 http://faluninfo.net

 URGENT: Innocent people are being persecuted for their belief inside
 Communist China.




 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk




-- 
Jim
I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy.
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk