can't debug TinyBlog in the Pharo MOOC

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

can't debug TinyBlog in the Pharo MOOC

Pharo Smalltalk Users mailing list
hi guys
I'm following the Pharo MOOC and I'm at Week 4. the other day, I was trying
to implement TinyBlog: Data Persistency using Voyage and Mongo, when I tried
to compile the code, I've got an Error. the title of Error says:
"MessageNotUnderstood: receiver of "save:" is nil", and it refers to
TBMBlog>>writeBlogPost.

TBMBlog>>writeBlogPost: aTBMPost
    posts add: aTBMPost.
    aTBMPost save.
    self save .

thanks for your answers!



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: can't debug TinyBlog in the Pharo MOOC

EstebanLM
Hi, 

You are missing to initialise the Voyage repository. 
I don’t know how is explained in the Mooc, but you will probably need to do something like: 

VOMemoryRepository new enableSingleton.

Cheers,
Esteban

On 22 Nov 2018, at 17:51, iu136 via Pharo-users <[hidden email]> wrote:


From: iu136 <[hidden email]>
Subject: can't debug TinyBlog in the Pharo MOOC
Date: 22 November 2018 at 17:51:12 CET


hi guys
I'm following the Pharo MOOC and I'm at Week 4. the other day, I was trying
to implement TinyBlog: Data Persistency using Voyage and Mongo, when I tried
to compile the code, I've got an Error. the title of Error says:
"MessageNotUnderstood: receiver of "save:" is nil", and it refers to
TBMBlog>>writeBlogPost.

TBMBlog>>writeBlogPost: aTBMPost
   posts add: aTBMPost.
   aTBMPost save.
   self save .

thanks for your answers!



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html




Reply | Threaded
Open this post in threaded view
|

Re: can't debug TinyBlog in the Pharo MOOC

Pharo Smalltalk Users mailing list
EstebanLM wrote

> Hi,
>
> You are missing to initialise the Voyage repository.
> I don’t know how is explained in the Mooc, but you will probably need to
> do something like:
>
> VOMemoryRepository new enableSingleton.
>
> Cheers,
> Esteban

Hi Esteban.

actually I'm using an External Mongo database and in the MOOC the
initialization of Voyage Mongo repository, is done like:

TBBlog class >> initializeLocalhostMongoDB
    | repository |
    repository := VOMongoRepository database: 'tinyblog'.
    repository enableSingleton.

TBBlog class >> reset
    self initializeLocalhostMongoDB

and in my code I'm doing exactly like above. but interestingly when I wanted
to reset the cache of Voyage by:
     VORepository current reset

again I've got another Error saying: "MessageNotUnderstood: receiver of
"reset" is nill".

thanks anyway!



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: can't debug TinyBlog in the Pharo MOOC

EstebanLM


On 22 Nov 2018, at 21:48, iu136 via Pharo-users <[hidden email]> wrote:


From: iu136 <[hidden email]>
Subject: Re: can't debug TinyBlog in the Pharo MOOC
Date: 22 November 2018 at 21:48:52 CET


EstebanLM wrote
Hi,

You are missing to initialise the Voyage repository.
I don’t know how is explained in the Mooc, but you will probably need to
do something like:

VOMemoryRepository new enableSingleton.

Cheers,
Esteban

Hi Esteban.

actually I'm using an External Mongo database and in the MOOC the
initialization of Voyage Mongo repository, is done like:

TBBlog class >> initializeLocalhostMongoDB
   | repository |
   repository := VOMongoRepository database: 'tinyblog'.
   repository enableSingleton.

TBBlog class >> reset
   self initializeLocalhostMongoDB

and in my code I'm doing exactly like above. but interestingly when I wanted
to reset the cache of Voyage by:
    VORepository current reset

again I've got another Error saying: "MessageNotUnderstood: receiver of
"reset" is nill”.

Which again, should means you never executed initializeLocalhostMongoDB method.
Can you try doing: 

TBBlock initializeLocalhostMongoDB. 

Esteban


Reply | Threaded
Open this post in threaded view
|

Re: can't debug TinyBlog in the Pharo MOOC

Pharo Smalltalk Users mailing list

> Which again, should means you never executed initializeLocalhostMongoDB
> method.
> Can you try doing:
>
> TBBlock initializeLocalhostMongoDB.
>
> Esteban

You were right Esteban, finally I fixed it by manually executing the code
below at Playground:

| repository |
repository := VOMongoRepository database: 'tinyblog'.
repository enableSingleton .

Even thought I was putting the above code at initialize method of TBMBlog,
but I don't know why its never get executed!
Thank you very much for your help!




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: can't debug TinyBlog in the Pharo MOOC

CyrilFerlicot
On Fri, Nov 23, 2018 at 1:25 PM iu136 via Pharo-users
<[hidden email]> wrote:

>
> You were right Esteban, finally I fixed it by manually executing the code
> below at Playground:
>
> | repository |
> repository := VOMongoRepository database: 'tinyblog'.
> repository enableSingleton .
>
> Even thought I was putting the above code at initialize method of TBMBlog,
> but I don't know why its never get executed!

Hi,

Class initialisation methods are executed at loading. If you write the
method the first time it will not execute it by default.

> Thank you very much for your help!
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>


--
Cyril Ferlicot
https://ferlicot.fr