Seaside : Confirmation email of an inscription

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Seaside : Confirmation email of an inscription

Sothy Chau
Hello,
Here my problem : I have developped a WebSite with Seaside and I can register users on it.
I can also log in this site. But an user can only log when he is confimed. To confirm, he must click on
a link in the sended Email.

My problem is : how to make this link ?

I have also a boolean which say that the user is confirmed or not.

Please. Help me.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

sebastianconcept@gmail.co
with the domain of the app and setting in a parameter some kind of id that you can receive later in the #initialRequest: of the app (and make it to react properly)



On Oct 28, 2010, at 10:32 AM, Sothy Chau wrote:

Hello,
Here my problem : I have developped a WebSite with Seaside and I can register users on it.
I can also log in this site. But an user can only log when he is confimed. To confirm, he must click on
a link in the sended Email.

My problem is : how to make this link ?

I have also a boolean which say that the user is confirmed or not.

Please. Help me.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

Sothy Chau
can you reexplain plz i don't understand what you wrote

2010/10/28 Sebastian Sastre <[hidden email]>
with the domain of the app and setting in a parameter some kind of id that you can receive later in the #initialRequest: of the app (and make it to react properly)



On Oct 28, 2010, at 10:32 AM, Sothy Chau wrote:

Hello,
Here my problem : I have developped a WebSite with Seaside and I can register users on it.
I can also log in this site. But an user can only log when he is confimed. To confirm, he must click on
a link in the sended Email.

My problem is : how to make this link ?

I have also a boolean which say that the user is confirmed or not.

Please. Help me.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

SeanTAllen
Sebastian is saying that you can use the initialRequest handler that gets run when you first hit and application
and an existing session doesn't exist to grab the information needed to confirm a user.

I would provide a separate interface using PM's Restful code to create a simple web service to confirm people thereby keeping
your one off code out of your main application as you might want to use initialRequest to something in the application proper
rather than just doing validation of their account. 

On Thu, Oct 28, 2010 at 9:33 AM, Sothy Chau <[hidden email]> wrote:
can you reexplain plz i don't understand what you wrote

2010/10/28 Sebastian Sastre <[hidden email]>

with the domain of the app and setting in a parameter some kind of id that you can receive later in the #initialRequest: of the app (and make it to react properly)



On Oct 28, 2010, at 10:32 AM, Sothy Chau wrote:

Hello,
Here my problem : I have developped a WebSite with Seaside and I can register users on it.
I can also log in this site. But an user can only log when he is confimed. To confirm, he must click on
a link in the sended Email.

My problem is : how to make this link ?

I have also a boolean which say that the user is confirmed or not.

Please. Help me.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

Sothy Chau
Once again I don't understand your solution.
I will reexplain my problem : I have an user who can register on my WebSite. Once the registration is done,
he will receive an Email to confirm his registration. In the user class I have a boolean value to indicate if the user
have confirmed his registration or not. I want in the sended Email a link (an URL to the site). When these link is clicked,
the boolean value will be set to true.

I want just to know how to make this link.

2010/10/28 Sean Allen <[hidden email]>
Sebastian is saying that you can use the initialRequest handler that gets run when you first hit and application
and an existing session doesn't exist to grab the information needed to confirm a user.

I would provide a separate interface using PM's Restful code to create a simple web service to confirm people thereby keeping
your one off code out of your main application as you might want to use initialRequest to something in the application proper
rather than just doing validation of their account. 

On Thu, Oct 28, 2010 at 9:33 AM, Sothy Chau <[hidden email]> wrote:
can you reexplain plz i don't understand what you wrote

2010/10/28 Sebastian Sastre <[hidden email]>

with the domain of the app and setting in a parameter some kind of id that you can receive later in the #initialRequest: of the app (and make it to react properly)



On Oct 28, 2010, at 10:32 AM, Sothy Chau wrote:

Hello,
Here my problem : I have developped a WebSite with Seaside and I can register users on it.
I can also log in this site. But an user can only log when he is confimed. To confirm, he must click on
a link in the sended Email.

My problem is : how to make this link ?

I have also a boolean which say that the user is confirmed or not.

Please. Help me.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

John McKeon


On Thu, Oct 28, 2010 at 11:14 AM, Sothy Chau <[hidden email]> wrote:
Once again I don't understand your solution.
I want just to know how to make this link.
 
Something like this was discussed on this list not long ago
 
 
Hope this helps
John
 

2010/10/28 Sean Allen <[hidden email]>
Sebastian is saying that you can use the initialRequest handler that gets run when you first hit and application
and an existing session doesn't exist to grab the information needed to confirm a user.

I would provide a separate interface using PM's Restful code to create a simple web service to confirm people thereby keeping
your one off code out of your main application as you might want to use initialRequest to something in the application proper
rather than just doing validation of their account. 

On Thu, Oct 28, 2010 at 9:33 AM, Sothy Chau <[hidden email]> wrote:
can you reexplain plz i don't understand what you wrote

2010/10/28 Sebastian Sastre <[hidden email]>

with the domain of the app and setting in a parameter some kind of id that you can receive later in the #initialRequest: of the app (and make it to react properly)



On Oct 28, 2010, at 10:32 AM, Sothy Chau wrote:

Hello,
Here my problem : I have developped a WebSite with Seaside and I can register users on it.
I can also log in this site. But an user can only log when he is confimed. To confirm, he must click on
a link in the sended Email.

My problem is : how to make this link ?

I have also a boolean which say that the user is confirmed or not.

Please. Help me.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
http://john-mckeon.us

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

Yanni Chiu
On 28/10/10 11:44 AM, John McKeon wrote:

>
> On Thu, Oct 28, 2010 at 11:14 AM, Sothy Chau <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Once again I don't understand your solution.
>     I want just to know how to make this link.
>
> Something like this was discussed on this list not long ago
> http://forum.world.st/Sending-a-continuation-link-via-email-in-Seaside-3-0-tp2999639p2999639.html
> For sending the email look at
> http://forum.world.st/send-email-with-seaside-tp2998911p2998911.html
> Hope this helps
> John

In the final sample code for sending a continuation link, it has:

     '<a href="http://localhost:8080'">http://localhost:8080', url greaseString

Instead of adding '<a href="http://localhost:8080'">http://localhost:8080' to the URL, the right way to
do it is to set the protocol/hostname/port for the application. You
could use the /config application provided by Seaside, or use code, to
set these values. Once this is done, the "url greaseString" will already
have the '<a href="http://localhost:8080'">http://localhost:8080' portion of the URL.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

Sothy Chau
Yanni can you give me a more readable version of the code plz.

Thank you.

2010/10/28 Yanni Chiu <[hidden email]>
On 28/10/10 11:44 AM, John McKeon wrote:

On Thu, Oct 28, 2010 at 11:14 AM, Sothy Chau <[hidden email]
<mailto:[hidden email]>> wrote:

   Once again I don't understand your solution.
   I want just to know how to make this link.

Something like this was discussed on this list not long ago
http://forum.world.st/Sending-a-continuation-link-via-email-in-Seaside-3-0-tp2999639p2999639.html
For sending the email look at
http://forum.world.st/send-email-with-seaside-tp2998911p2998911.html
Hope this helps
John

In the final sample code for sending a continuation link, it has:

   'http://localhost:8080', url greaseString

Instead of adding 'http://localhost:8080' to the URL, the right way to do it is to set the protocol/hostname/port for the application. You could use the /config application provided by Seaside, or use code, to set these values. Once this is done, the "url greaseString" will already have the 'http://localhost:8080' portion of the URL.


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

Yanni Chiu
On 28/10/10 1:43 PM, Sothy Chau wrote:
> Yanni can you give me a more readable version of the code plz.

Try:
http://lists.squeakfoundation.org/pipermail/seaside/2010-October/024756.html

It's a fileout file. I don't know why the archive doesn't show it as a
down-loadable attachment.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside : Confirmation email of an inscription

Sothy Chau
Thank you your solution help me.
I have resolve my problem.

2010/10/28 Yanni Chiu <[hidden email]>
On 28/10/10 1:43 PM, Sothy Chau wrote:
Yanni can you give me a more readable version of the code plz.

Try: http://lists.squeakfoundation.org/pipermail/seaside/2010-October/024756.html

It's a fileout file. I don't know why the archive doesn't show it as a down-loadable attachment.


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
Sothy Chau
4th year Master in Civil Engineering
Technology of Information Specialisation
Multimedia Section
Applied Sciences Faculty.
ULB

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Dynamic typing in smalltalk

Alexandre BP

Hello,

I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
     var := Class new.
var := (SubClass1) message. 
var := (SubClass2) message.

Where message from SubClass1 is different then the one from SubClass2.
Is there any solution for my problem? 
I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?

Thank you in advance,
Regards
alex

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic typing in smalltalk

SeanTAllen
There are types in smalltalk. Each object has a type.

That aside, what are you trying to accomplish with your example below?


On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:

Hello,

I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
     var := Class new.
var := (SubClass1) message. 
var := (SubClass2) message.

Where message from SubClass1 is different then the one from SubClass2.
Is there any solution for my problem? 
I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?

Thank you in advance,
Regards
alex

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic typing in smalltalk

SebastianHC
I'm not quite sure about your aims but could this be a solution?

var := Class new.
    var := Subclass1 messageUsing: var.
    var := Subclass2 messageUsing: var.

SubClass1 class side:
messageUsing: aVar
   
    ^Message1 on: aVar

SubClass2 class side:
messageUsing: aVar
   
    ^Message2 on: aVar


?
Sebastian

    


Am 29.10.2010 18:24, schrieb Sean Allen:
There are types in smalltalk. Each object has a type.

That aside, what are you trying to accomplish with your example below?


On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:

Hello,

I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
     var := Class new.
var := (SubClass1) message. 
var := (SubClass2) message.

Where message from SubClass1 is different then the one from SubClass2.
Is there any solution for my problem? 
I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?

Thank you in advance,
Regards
alex

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Dynamic typing in smalltalk

Alexandre BP
In reply to this post by SeanTAllen
thank you for your reply
I have a class named "PaperBibli" which keeps a list of bibliographic entries.
Those entries are of different type: Article, Book, Conference,...
Every type has its own fields such as: author,title,...

 --> I created SubClasses of "PaperBibli" for each type so that when I instanciate an bibliographic entry I don't have lots of variables(fields) which are empty because not required in a particular type.
The problem is that when I instanciate my bibliographic entry I still don't know of which type it is because the user tell me so by choosing in a scroll list.

I hope that my explanation is clear





Date: Fri, 29 Oct 2010 12:24:22 -0400
Subject: Re: [Seaside] Dynamic typing in smalltalk
From: [hidden email]
To: [hidden email]

There are types in smalltalk. Each object has a type.

That aside, what are you trying to accomplish with your example below?


On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:

Hello,

I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
     var := Class new.
var := (SubClass1) message. 
var := (SubClass2) message.

Where message from SubClass1 is different then the one from SubClass2.
Is there any solution for my problem? 
I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?

Thank you in advance,
Regards
alex

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic typing in smalltalk

Andres Fortier-2
Hi Alexandre,
                        I guess you could try two approaches:

1. Just list the classes in a select, so that the first step is choosing
the entry. Once you have this you just create the appropriate class.

2. Decouple the type of the object from the object itself (check also
http://www.ksc.com/article3.htm). Thus PaperBibli would know an object
(lets say PaperType) whose subclasses would be Book, Article, etc. When
the user selects the type he wants you just set the object's type. The
type class is the one that holds the type-specific information.

HTH,
         Andrés

Alexandre BP escribió:

> thank you for your replyI have a class named "PaperBibli" which keeps a list of bibliographic entries.Those entries are of different type: Article, Book, Conference,...Every type has its own fields such as: author,title,...
>  --> I created SubClasses of "PaperBibli" for each type so that when I instanciate an bibliographic entry I don't have lots of variables(fields) which are empty because not required in a particular type.The problem is that when I instanciate my bibliographic entry I still don't know of which type it is because the user tell me so by choosing in a scroll list.
> I hope that my explanation is clear
>
>
>
> Date: Fri, 29 Oct 2010 12:24:22 -0400
> Subject: Re: [Seaside] Dynamic typing in smalltalk
> From: [hidden email]
> To: [hidden email]
>
> There are types in smalltalk. Each object has a type.
> That aside, what are you trying to accomplish with your example below?
>
> On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:
>
>
>
>
>
>
>
> Hello,
> I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
>       var := Class new. var := (SubClass1) message. var := (SubClass2) message.
>
> Where message from SubClass1 is different then the one from SubClass2.Is there any solution for my problem? I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?
>
> Thank you in advance,Regardsalex    
>
> _______________________________________________
>
> seaside mailing list
>
> [hidden email]
>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside     
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic typing in smalltalk

John McKeon
In reply to this post by Alexandre BP


On Fri, Oct 29, 2010 at 12:43 PM, Alexandre BP <[hidden email]> wrote:
thank you for your reply
I have a class named "PaperBibli" which keeps a list of bibliographic entries.
Those entries are of different type: Article, Book, Conference,...
Every type has its own fields such as: author,title,...

 --> I created SubClasses of "PaperBibli" for each type so that when I instanciate an bibliographic entry I don't have lots of variables(fields) which are empty because not required in a particular type.
The problem is that when I instanciate my bibliographic entry I still don't know of which type it is because the user tell me so by choosing in a scroll list.

I hope that my explanation is clear
 
Now its clear. Your scroll list, in Seaside, can hold the subClasses of Bibli as its list items (but can render labels: for each class). Then in the scroll list's callback: the value handed to it will be the selected subclass (NOT the label), so that you WILL know which class to create.
Cool huh?
 
html select
   list: PaperBibli allSubclasses;
   labels: [ :val | val class ];  <-- "implement a label message in each class to return a nice string then the block would be [ :val | val label ]"
   callback: [ :cls | someVar := cls new ];  <---cls is one of the subclasses!
  .....&etc
 
Hope that helps
John





Date: Fri, 29 Oct 2010 12:24:22 -0400
Subject: Re: [Seaside] Dynamic typing in smalltalk
From: [hidden email]
To: [hidden email]


There are types in smalltalk. Each object has a type.

That aside, what are you trying to accomplish with your example below?


On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:

Hello,

I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
     var := Class new.
var := (SubClass1) message. 
var := (SubClass2) message.

Where message from SubClass1 is different then the one from SubClass2.
Is there any solution for my problem? 
I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?

Thank you in advance,
Regards
alex

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
http://john-mckeon.us

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic typing in smalltalk

sebastianconcept@gmail.co
In reply to this post by Alexandre BP
<base href="x-msg://6/">It doesn't matter. You don't need to know the type. You need to know what to ask. 

For example its description (or label or whatever). So, you get a bunch of PaperBibli (and siblings) and you know they all answer correctly to, say, the #describe method. Then you use it (to render it or whatever).

That means you need to implement the #describe (or #description, or #name) method in every one of the subclasses (or factor it in its superclass)

 


On Oct 29, 2010, at 2:43 PM, Alexandre BP wrote:

thank you for your reply
I have a class named "PaperBibli" which keeps a list of bibliographic entries.
Those entries are of different type: Article, Book, Conference,...
Every type has its own fields such as: author,title,...

 --> I created SubClasses of "PaperBibli" for each type so that when I instanciate an bibliographic entry I don't have lots of variables(fields) which are empty because not required in a particular type.
The problem is that when I instanciate my bibliographic entry I still don't know of which type it is because the user tell me so by choosing in a scroll list.

I hope that my explanation is clear





Date: Fri, 29 Oct 2010 12:24:22 -0400
Subject: Re: [Seaside] Dynamic typing in smalltalk
From: [hidden email]
To: [hidden email]

There are types in smalltalk. Each object has a type.

That aside, what are you trying to accomplish with your example below?


On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:

Hello,

I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
     var := Class new.
var := (SubClass1) message. 
var := (SubClass2) message.

Where message from SubClass1 is different then the one from SubClass2.
Is there any solution for my problem? 
I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?

Thank you in advance,
Regards
alex

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________ seaside mailing list [hidden email]http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Dynamic typing in smalltalk

Alexandre BP
In reply to this post by Andres Fortier-2
thanks for your time,
Your second solution seems very nice I'll try it as soon as possible.

The second one however forces me to have a big list of loops that look like '(selectedType = 'Book') ifTrue: [var := PaperBibliArticle new]. ' 
which is neither clean nor evolutive.
I wanted to do something like:

 dynamicTyping := ('PaperBibli', selectedType, ' new') asSymbol.
bibEntry := PaperBibli perform: dynamicTyping.

OR

 dynamicTyping := ('PaperBibli', selectedType) asSymbol.
bibEntry := PaperBibli perform: dynamicTyping new.

--> it doesn't work unfortunately ...

OR:

As in JAVA:

PaperBibli bibEntry;

(when I need it)
bibEntry = new PaperBibliArticle;

Anyway I'll try the second solution which is more elegant.
thank you very much
alex


 

> Date: Fri, 29 Oct 2010 13:56:14 -0300
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Seaside] Dynamic typing in smalltalk
>
> Hi Alexandre,
> I guess you could try two approaches:
>
> 1. Just list the classes in a select, so that the first step is choosing
> the entry. Once you have this you just create the appropriate class.
>
> 2. Decouple the type of the object from the object itself (check also
> http://www.ksc.com/article3.htm). Thus PaperBibli would know an object
> (lets say PaperType) whose subclasses would be Book, Article, etc. When
> the user selects the type he wants you just set the object's type. The
> type class is the one that holds the type-specific information.
>
> HTH,
> Andrés
>
> Alexandre BP escribió:
> > thank you for your replyI have a class named "PaperBibli" which keeps a list of bibliographic entries.Those entries are of different type: Article, Book, Conference,...Every type has its own fields such as: author,title,...
> > --> I created SubClasses of "PaperBibli" for each type so that when I instanciate an bibliographic entry I don't have lots of variables(fields) which are empty because not required in a particular type.The problem is that when I instanciate my bibliographic entry I still don't know of which type it is because the user tell me so by choosing in a scroll list.
> > I hope that my explanation is clear
> >
> >
> >
> > Date: Fri, 29 Oct 2010 12:24:22 -0400
> > Subject: Re: [Seaside] Dynamic typing in smalltalk
> > From: [hidden email]
> > To: [hidden email]
> >
> > There are types in smalltalk. Each object has a type.
> > That aside, what are you trying to accomplish with your example below?
> >
> > On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > Hello,
> > I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
> > var := Class new. var := (SubClass1) message. var := (SubClass2) message.
> >
> > Where message from SubClass1 is different then the one from SubClass2.Is there any solution for my problem? I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?
> >
> > Thank you in advance,Regardsalex
> >
> > _______________________________________________
> >
> > seaside mailing list
> >
> > [hidden email]
> >
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> >
> >
> >
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic typing in smalltalk

Andres Fortier-2
As John suggested, your select list would hold the classes, not strings
or symbols. Is Smalltalk classes are objects themselves, thus you can do
something like:

html select
    list: PaperType allSubclasses; "#allSubclasses is a message that any
class can answer. It returns all the subclasses of that class"
    callback: [:cls | actualType:=cls new ];  "Here you send the message
#new to the class object and create an instance of it"

You can find more information about Smalltalk in general and its
reflective nature in some of the many free books collected by Stephane:
http://stephane.ducasse.free.fr/FreeBooks.html.

HTH,
         Andrés


Alexandre BP escribió:

> thanks for your time,Your second solution seems very nice I'll try it as soon as possible.
> The second one however forces me to have a big list of loops that look like '(selectedType = 'Book') ifTrue: [var := PaperBibliArticle new]. ' which is neither clean nor evolutive.I wanted to do something like:
>  dynamicTyping := ('PaperBibli', selectedType, ' new') asSymbol.bibEntry := PaperBibli perform: dynamicTyping.
> OR
>  dynamicTyping := ('PaperBibli', selectedType) asSymbol.bibEntry := PaperBibli perform: dynamicTyping new.
> --> it doesn't work unfortunately ...
> OR:
> As in JAVA:
> PaperBibli bibEntry;
> (when I need it)bibEntry = new PaperBibliArticle;
> Anyway I'll try the second solution which is more elegant.thank you very muchalex
>
>  
>> Date: Fri, 29 Oct 2010 13:56:14 -0300
>> From: [hidden email]
>> To: [hidden email]
>> Subject: Re: [Seaside] Dynamic typing in smalltalk
>>
>> Hi Alexandre,
>> I guess you could try two approaches:
>>
>> 1. Just list the classes in a select, so that the first step is choosing
>> the entry. Once you have this you just create the appropriate class.
>>
>> 2. Decouple the type of the object from the object itself (check also
>> http://www.ksc.com/article3.htm). Thus PaperBibli would know an object
>> (lets say PaperType) whose subclasses would be Book, Article, etc. When
>> the user selects the type he wants you just set the object's type. The
>> type class is the one that holds the type-specific information.
>>
>> HTH,
>>          Andrés
>>
>> Alexandre BP escribió:
>>> thank you for your replyI have a class named "PaperBibli" which keeps a list of bibliographic entries.Those entries are of different type: Article, Book, Conference,...Every type has its own fields such as: author,title,...
>>>  --> I created SubClasses of "PaperBibli" for each type so that when I instanciate an bibliographic entry I don't have lots of variables(fields) which are empty because not required in a particular type.The problem is that when I instanciate my bibliographic entry I still don't know of which type it is because the user tell me so by choosing in a scroll list.
>>> I hope that my explanation is clear
>>>
>>>
>>>
>>> Date: Fri, 29 Oct 2010 12:24:22 -0400
>>> Subject: Re: [Seaside] Dynamic typing in smalltalk
>>> From: [hidden email]
>>> To: [hidden email]
>>>
>>> There are types in smalltalk. Each object has a type.
>>> That aside, what are you trying to accomplish with your example below?
>>>
>>> On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP <[hidden email]> wrote:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hello,
>>> I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
>>>       var := Class new. var := (SubClass1) message. var := (SubClass2) message.
>>>
>>> Where message from SubClass1 is different then the one from SubClass2.Is there any solution for my problem? I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?
>>>
>>> Thank you in advance,Regardsalex    
>>>
>>> _______________________________________________
>>>
>>> seaside mailing list
>>>
>>> [hidden email]
>>>
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside     
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>      
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic typing in smalltalk

SebastianHC
In reply to this post by Alexandre BP
As far as I can see there's no need for your loop.
John's solution already provides you with a class in selectedType.

Eventhough it isn't quite the way to do it.
You forgot something here. Symbol new returns a Symbol:

 dynamicTyping := ('PaperBibli', selectedType) asSymbol asClass.
bibEntry := PaperBibli perform: dynamicTyping new.

asClass isn't nice because it take some while and there are more OO-solutions available.
Try to get away from casting. Delegation is the answer.

If you might need to keep your original Object, or, how to say this right now, whish or need to keep on using the memory space you could also use become: or becomeWith:
Now this is really not the nice way to do it, but it schould also work.

yourmessage: aPaperBibli
^PaperArticle new become: aPaperBibli

Just to be mentioned...

I would use John's approch, it's the most common.

Sebastian

Am 29.10.2010 20:23, schrieb Alexandre BP:
thanks for your time,
Your second solution seems very nice I'll try it as soon as possible.

The second one however forces me to have a big list of loops that look like '(selectedType = 'Book') ifTrue: [var := PaperBibliArticle new]. ' 
which is neither clean nor evolutive.
I wanted to do something like:

 dynamicTyping := ('PaperBibli', selectedType, ' new') asSymbol.
bibEntry := PaperBibli perform: dynamicTyping.

OR

 dynamicTyping := ('PaperBibli', selectedType) asSymbol.
bibEntry := PaperBibli perform: dynamicTyping new.

--> it doesn't work unfortunately ...

OR:

As in JAVA:

PaperBibli bibEntry;

(when I need it)
bibEntry = new PaperBibliArticle;

Anyway I'll try the second solution which is more elegant.
thank you very much
alex


 

> Date: Fri, 29 Oct 2010 13:56:14 -0300
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Seaside] Dynamic typing in smalltalk
>
> Hi Alexandre,
> I guess you could try two approaches:
>
> 1. Just list the classes in a select, so that the first step is choosing
> the entry. Once you have this you just create the appropriate class.
>
> 2. Decouple the type of the object from the object itself (check also
> http://www.ksc.com/article3.htm). Thus PaperBibli would know an object
> (lets say PaperType) whose subclasses would be Book, Article, etc. When
> the user selects the type he wants you just set the object's type. The
> type class is the one that holds the type-specific information.
>
> HTH,
> Andrés
>
> Alexandre BP escribió:
> > thank you for your replyI have a class named "PaperBibli" which keeps a list of bibliographic entries.Those entries are of different type: Article, Book, Conference,...Every type has its own fields such as: author,title,...
> > --> I created SubClasses of "PaperBibli" for each type so that when I instanciate an bibliographic entry I don't have lots of variables(fields) which are empty because not required in a particular type.The problem is that when I instanciate my bibliographic entry I still don't know of which type it is because the user tell me so by choosing in a scroll list.
> > I hope that my explanation is clear
> >
> >
> >
> > Date: Fri, 29 Oct 2010 12:24:22 -0400
> > Subject: Re: [Seaside] Dynamic typing in smalltalk
> > From: [hidden email]
> > To: [hidden email]
> >
> > There are types in smalltalk. Each object has a type.
> > That aside, what are you trying to accomplish with your example below?
> >
> > On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP [hidden email] wrote:
> >
> >
> >
> >
> >
> >
> >
> > Hello,
> > I would like to know if it is possible to apply dynamic typing in smalltalk. For example, If I want to use polymorphism, it would be:
> > var := Class new. var := (SubClass1) message. var := (SubClass2) message.
> >
> > Where message from SubClass1 is different then the one from SubClass2.Is there any solution for my problem? I know that there is no type in smalltalk but there is definitely a way to use polymorphism right?
> >
> > Thank you in advance,Regardsalex
> >
> > _______________________________________________
> >
> > seaside mailing list
> >
> > [hidden email]
> >
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> >
> >
> >
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
12