Re: [Pharo-users] Fuel - FLSerializer tests are not working (pharo 8)

2020-07-28 Thread Davide Varvello via Pharo-users
--- Begin Message ---
Hi,
I discovered why tests are failing. 
The reason is that Fuel is using root directory as working path instead of
the working directory. Unfortunately the root dir is not writeable (of
course) and so the failings.

I guess the mistake occurs because since Pharo (7?) the File* and Stream*
classes changed.
Cheers
Davide



Pharo Smalltalk Users mailing list wrote
> Hi Guys,
> 
> There is something wrong with Fuel.
> I got the version for Pharo 8
> 
> Metacello new
> repository: 'github://theseion/Fuel:3.0.2/repository';
> baseline: 'Fuel';
> load.
> 
> 
> But tests are red, all tests of FLBinaryFileStreamBasicSerializationTest
> and
> others
> 
> Cheers
> Davide
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





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

--- End Message ---


[Pharo-users] Want to create a text Field using SPEC2 to get Value from User

2020-07-28 Thread shawon58
Hello
Is there anyone who have idea how to create a textinputfield in spec2/GUI in
pharo and get the value from that text field. Cause i want to use LibC
fuction to send the text field data to a BAT file. So need help to create a
simple textfield that can get the value. I need guide line badly.

Thanks for your kind Help



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



Re: [Pharo-users] Want to create a text Field using SPEC2 to get Value from User

2020-07-28 Thread kmo
This code should give you a clue of how to do what you want. You can file it
in or type it in yourself. You can run it from the playground with the
command -

SimpleExample new openWithSpec.

How it works - You need to subclass SpPresenter. You need to set up an
instance method called initializePresenters to create a text input and a
button. You then create aninstance method called connectPresenters to put a
handler on to the button.

You need a class side method called defaultSpec to layout the button and the
text input

That's it.

Note that you have to hit enter to register any change in the text field.
You will need the transcript open to see the results in this example.

Hope this helps 

SpPresenter subclass: #SimpleExample
instanceVariableNames: 'myButton myTextField'
classVariableNames: ''
package: 'KMP-SimpleSpecExample'!

!SimpleExample methodsFor: 'as yet unclassified' stamp: 'KMP 7/28/2020
16:20'!
initialize 
super initialize ! !


!SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:31'!
initializePresenters 
myButton := self newButton .
myButton label:'Click Me'.
myTextField := self newTextInput.
! !

!SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:29'!
connectPresenters 
"Put what you want to do when the button is clicked hhere"
 myButton whenActivatedDo: [ Transcript show: myTextField text].! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

SimpleExample class
instanceVariableNames: ''!

!SimpleExample class methodsFor: 'specs' stamp: 'KMP 7/28/2020 16:30'!
defaultSpec 

^ SpBoxLayout newVertical 
borderWidth: 10;
spacing: 10;
add: #myTextField  expand: false;
add: #myButton expand: false;
yourself! !





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



[Pharo-users] Class side vs instance side (variables and methods)

2020-07-28 Thread G B via Pharo-users
--- Begin Message ---
Being new not only to Smalltalk, but OOP in general, I think I finally am 
understanding things. One area I am still unsure about is the class side versus 
the instance side. Does one usually use the class side when they want those 
inherited in every subclass, which frees one from having to declare them in 
every instance?
TIA for reading my silly questions.
--- End Message ---


Re: [Pharo-users] Class side vs instance side (variables and methods)

2020-07-28 Thread Richard Sargent
On Tue, Jul 28, 2020 at 4:35 PM G B via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Being new not only to Smalltalk, but OOP in general, I think I finally am
> understanding things. One area I am still unsure about is the class side
> versus the instance side. Does one usually use the class side when they
> want those inherited in every subclass, which frees one from having to
> declare them in every instance?
>

One of the important concepts in Smalltalk is that *everything* is an
object. When we say "class side" and "instance side", we are using a
shorthand for the two objects involved. In most Smalltalks, the "class
side" is really a meta-class and the "instance side" is really the class.
The browser is designed to present them together because it makes sense to
do that. Both sets of behaviours and variables are inherited by subclasses.
[I'm playing a little loose here, as there is a distinction between a Class
Variable and a Class Instance Variable in the meta-class.] The
meta-class/"class side" typically deals with instance creation and
management. The "instance side" provides the behaviours associated with the
instances of the class.


> TIA for reading my silly questions.
>

Not silly at all. This is a somewhat opaque topic since the browser makes
it appear less obvious.


Re: [Pharo-users] Class side vs instance side (variables and methods)

2020-07-28 Thread Esteban Maringolo
Hi,

The "class vs instance" side is one of the most confusing things for
newcomers, I remember struggling with it when I learnt Smalltalk (and
also was a novice in OOP).

It helps you thinking it this way: the instance side is everything
that will affect all instances of such class, and you can think the
"class side" as what affect the factory for these instances (the sole
instance of the class).

E.g. let's say you have a "Dog".
Dog instances will have a #bark method, and maybe a "color" property
(via an instance variable).

So when you do:
dog1 := Dog new.
dog1 color: Color white.
dog2 := Dog new.
dog2 color: Color black.

You have two instances of Dog, and each one with its own color. Both
understand the #bark message.

But the Dog (capitalized) there, references the Dog class itself (aka
"the class side" of Dog) and #new is a method of the "class side" of
Dog.

So if you implement a #newWhite method in the "class side" of Dog, it
would be something like this.
Dog class>>newWhite
  "Returns a new white instance of receiver."
  ^self new color: Color white

In this method the "self new" refers to the class itself, not to the
"instance" of the dog, but the returned object of "new" is an
instance, and there the #color: message is sent to the instance of
Dog.

I hope this explanation helps, the meta relations involved in this are
more complex than what I explained, but I hope this helps you get
started.

Regards!

Esteban A. Maringolo

On Tue, Jul 28, 2020 at 8:35 PM G B via Pharo-users
 wrote:
>
> Being new not only to Smalltalk, but OOP in general, I think I finally am 
> understanding things. One area I am still unsure about is the class side 
> versus the instance side. Does one usually use the class side when they want 
> those inherited in every subclass, which frees one from having to declare 
> them in every instance?
>
> TIA for reading my silly questions.



Re: [Pharo-users] Intermediate-Level Tutorials for Pharo

2020-07-28 Thread Russ Whaley
Back on the 'Intermediate Tutorials' question...

I would love to see intermediate tutorials on Spec2 and Seaside and
perhaps how to best adapt an (Sp)Application to serve both 'presenters'
with guidelines on what responsibility goes where on the
presenter/component, application, and model(s).

What I found most useful in tutorials is specific examples. To me, generic
examples can be too easily misunderstood - making them difficult to
(re)apply.  A specific example, even if silly, can really make a
difference... i.e. I'm never going to create a GUI based on the
Class/method hierarchy and I find it very difficult to apply those examples
(although they are slick) to my application needs.

I love looking at how other people approach problems, identify solutions (I
can't wait to dig into the logic-puzzle code).  This mailing list is great,
but more - and more advanced - tutorials would be very much appreciated!

Thanks!
Russ


On Mon, Jul 27, 2020 at 11:45 PM tbrunz  wrote:

> So I decided to write an application to solve the Zebra Puzzle, by solving
> this type of problem in general.  In Pharo, of course.
>
> I worked out a few basic algorithms for making deductions and inferences,
> and coded them, along with tests, in Pharo 8.  Now I've reached the point
> of
> having a working "proof of concept" or prototype.  It can't (yet) solve the
> Zebra Puzzle without some "human assistance", but it does keep track of the
> solution state as it progresses, it handles the bookkeeping, makes the
> basic
> deductions/inferences, and produces reports.
>
> And I've used it to quickly solve the Zebra Puzzle.  I coded the solution
> as
> a separate class/method, with extra rules inserted that I was able to infer
> by iterating to partial solutions, so that it solves the entire thing.  It
> will interesting to develop the remaining algorithms, and it would be nice
> to eventually create a nice, interactive user interface for it as well.
>
> Since I want to fashion this into an intermediate-level tutorial, I need
> feedback on what I have so far.  I don't want my inexperience to lead to me
> teaching the wrong techniques, etc. to other developers who are learning
> Pharo.  What I have can no doubt be improved, but I need to hear from the
> master craftsman in this community what parts are compromised and how (and
> why) it can be made a better example of "how to program in Pharo" properly.
>
> If anyone has the time and is willing to help, the code (complete with
> class
> & method comments, test classes/methods, and the Zebra Puzzle example) is
> here:
> https://github.com/tbrunz/logic-puzzle and I'm available to answer
> questions
> about it, of course.
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>

-- 
Russ Whaley
whaley.r...@gmail.com


Re: [Pharo-users] Want to create a text Field using SPEC2 to get Value from User

2020-07-28 Thread shawon58


Hello KMO
i follow your step one by one and make the form but i want to run :

connectPresenters
myButton whenActivatedDo: [LibC system: 'a.bat', myTextField asString].

That means when i put any value in text field than press click me than that
value need to send to my bat file as string. so i dont know is that ok or
not. but if i write:

myButton whenActivatedDo: [LibC system: 'a.bat 10'].

than its work perfectly but my concern is to get the value from text field
not the fixed value.
SO i think  i am doing in the wrong things. Please help me with this issue.

Thanks a lot 
kmo wrote
> This code should give you a clue of how to do what you want. You can file
> it
> in or type it in yourself. You can run it from the playground with the
> command -
> 
> SimpleExample new openWithSpec.
> 
> How it works - You need to subclass SpPresenter. You need to set up an
> instance method called initializePresenters to create a text input and a
> button. You then create aninstance method called connectPresenters to put
> a
> handler on to the button.
> 
> You need a class side method called defaultSpec to layout the button and
> the
> text input
> 
> That's it.
> 
> Note that you have to hit enter to register any change in the text field.
> You will need the transcript open to see the results in this example.
> 
> Hope this helps 
> 
> SpPresenter subclass: #SimpleExample
>   instanceVariableNames: 'myButton myTextField'
>   classVariableNames: ''
>   package: 'KMP-SimpleSpecExample'!
> 
> !SimpleExample methodsFor: 'as yet unclassified' stamp: 'KMP 7/28/2020
> 16:20'!
> initialize 
> super initialize ! !
> 
> 
> !SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:31'!
> initializePresenters 
> myButton := self newButton .
> myButton label:'Click Me'.
> myTextField := self newTextInput.
> ! !
> 
> !SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:29'!
> connectPresenters 
> "Put what you want to do when the button is clicked hhere"
>  myButton whenActivatedDo: [ Transcript show: myTextField text].! !
> 
> "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
> 
> SimpleExample class
>   instanceVariableNames: ''!
> 
> !SimpleExample class methodsFor: 'specs' stamp: 'KMP 7/28/2020 16:30'!
> defaultSpec 
> 
> ^ SpBoxLayout newVertical 
>   borderWidth: 10;
>   spacing: 10;
>   add: #myTextField  expand: false;
>   add: #myButton expand: false;
>   yourself! !
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





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