Re: [Newbies] Re: indexing into a collection

2016-07-27 Thread Ben Coman
On Wed, Jul 27, 2016 at 8:13 AM, Joseph Alotta <joseph.alo...@gmail.com> wrote:
> Ben, Ron, I made a small example, and it works as you said it would:
>
> a := #( #(1 2)  #(3 4)).
> b := a asOrderedCollection.
> b  => an OrderedCollection(#(1 2) #(3 4))
> c := b select: [ :i | (i first) = 3 ].

Ahh. Code examples help. Maybe what you need is #detect:
which returns an element rather than a collection of elements.

> c => an OrderedCollection(#(3 4))
> d := c first
> d =>  #(3 4)
> d at: 2 put: 5
> d =>  #(3 5)
> b  => an OrderedCollection(#(1 2) #(3 5))
>
> Okay, I will check my other code.
>
> Sincerely,
>
> Joe.

Here's a domain specific example...

Object subclass: #DrivingDays
instanceVariables: 'date store mileage"?" '
...etc...

oc := OrderedCollection new.
oc add: (DrivingDays new date: '2016-01-02' ; store: 'quigley' ; mileage: 18).
oc add: (DrivingDays new date: '2016-01-03' ; store: 'marianos' ; mileage: 5).

oc printString.
>> > an OrderedCollection(2016-01-02| quigley | 18,
>> >  2016-01-03| marianos | 5)

drivingDayToUpdate := oc detect: [ :dd | dd store = 'marianos' ].
drivingDayToUpdate mileage: 7.

oc printString.
>> > an OrderedCollection(2016-01-02| quigley | 18,
>> >  2016-01-03| marianos | 7)

(disclaimer, I am not somewhere I can run this. Its just off the top
of my head.)
cheers -ben

>
>
>
>
>> On Jul 26, 2016, at 6:25 PM, Ben Coman [via Smalltalk] <[hidden email]>
>> wrote:
>>
>> Hi Joe,
>>
>> As Ron said, you should not be getting a copy.  If you still have a
>> problem, perhaps best if you post code for a complete example:
>> * class definition (with just two instance variables)
>> * instance variable accessor methods
>> * instance creation & adding to collection
>> * select statement
>> * updating object
>>
>> cheers -ben
>>
>> On Wed, Jul 27, 2016 at 5:53 AM, Ron Teitelbaum <[hidden email]> wrote:
>>
>> > Hi Joe,
>> >
>> > If the orderedCollection contains your object DrivingDays then select
>> > should give you the object and not a copy.
>> >
>> > You don't need to add it back to the collection just update the object.
>> >
>> > Check your code for anything that might be making a copy.
>> >
>> > All the best,
>> >
>> > Ron Teitelbaum
>> >
>> >
>> > -Original Message-
>> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Joseph Alotta
>> > Sent: Tuesday, July 26, 2016 3:04 PM
>> > To: [hidden email]
>> > Subject: [Newbies] indexing into a collection
>> >
>> > Greetings,
>> >
>> > I have a OrderedCollection of DrivingDays.
>> >
>> >
>> > an OrderedCollection(2016-01-02| quigley s| nil|18§
>> >  2016-01-03| marianos fresh| nil|5§
>> >  2016-01-04| fresh thyme| nil|5§
>> >  2016-01-05| panda express| nil|3§
>> >  2016-01-06| peets| nil|7§
>> >  2016-01-07| starbucks| nil|3§)
>> >
>> > I want to select aDrivingDay object from the list by date, update it by
>> > adding mileage and places visited and put it back into the list.
>> >
>> > If I #select the OrderedCollection, I get a copy of the item, not the
>> > same one in the OrderedCollection.
>> >
>> > How do I select an item in the list for update?
>> >
>> > Sincerely,
>> >
>> > Joe.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] indexing into a collection

2016-07-26 Thread Ben Coman
Hi Joe,

As Ron said, you should not be getting a copy.  If you still have a
problem, perhaps best if you post code for a complete example:
* class definition (with just two instance variables)
* instance variable accessor methods
* instance creation & adding to collection
* select statement
* updating object

cheers -ben

On Wed, Jul 27, 2016 at 5:53 AM, Ron Teitelbaum  wrote:
> Hi Joe,
>
> If the orderedCollection contains your object DrivingDays then select should 
> give you the object and not a copy.
>
> You don't need to add it back to the collection just update the object.
>
> Check your code for anything that might be making a copy.
>
> All the best,
>
> Ron Teitelbaum
>
>
> -Original Message-
> From: beginners-boun...@lists.squeakfoundation.org 
> [mailto:beginners-boun...@lists.squeakfoundation.org] On Behalf Of Joseph 
> Alotta
> Sent: Tuesday, July 26, 2016 3:04 PM
> To: beginners@lists.squeakfoundation.org
> Subject: [Newbies] indexing into a collection
>
> Greetings,
>
> I have a OrderedCollection of DrivingDays.
>
>
> an OrderedCollection(2016-01-02| quigley s| nil|18§
>  2016-01-03| marianos fresh| nil|5§
>  2016-01-04| fresh thyme| nil|5§
>  2016-01-05| panda express| nil|3§
>  2016-01-06| peets| nil|7§
>  2016-01-07| starbucks| nil|3§)
>
> I want to select aDrivingDay object from the list by date, update it by 
> adding mileage and places visited and put it back into the list.
>
> If I #select the OrderedCollection, I get a copy of the item, not the same 
> one in the OrderedCollection.
>
> How do I select an item in the list for update?
>
> Sincerely,
>
> Joe.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] sorting by key1 inside of key2

2016-07-06 Thread Ben Coman
On Thu, Jul 7, 2016 at 10:58 AM, Joseph Alotta  wrote:
> Greetings,
>
> I have a collection of Transaction objects.  They have instance variables of 
> category and payee.
>
> A category might be “Office Expense”  and a payee might be “Costco” or 
> “Amazon”.
>
> I want to sort by categories and then payees.
>
> Office Expense, Amazon…..
> …..
> ….
> ….
> Office Expense, Costco
> ….
> …
> …
>
> Here is some of my code:
>
>
>
> sorted := trans asSortedCollection:  [:a :b | (a category) < (b category)].

Just guessing...
[:a :b | (a category) = (b category)
ifFalse: [ (a category) < (b category) ]
ifTrue: [ (a payee) < (b payee)]].

cheers -ben

>
> sorted do:  [ :tr |  | cat pay |
>   cat := tr category.
>   pay := tr payee.
>
>   stream nextPutAll: (tr myPrintFormat2).
>
>
>
> How do I make the sort block sort on both keys?
>
> Sincerely,
>
> Joe.
>
>
>
>
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Interactive Fiction Framework in Smalltalk Released

2016-06-20 Thread Ben Coman
Hi Eric,

Given you've developed on top of Pharo, another good place to announce
is pharo-users
http://lists.pharo.org/mailman/listinfo/pharo-users_lists.pharo.org

Sounds like a cool project.  I'll try to find some time to try it out.

cheers -ben

(p.s. you might add [ANN] to the front of your subject line.)

On Tue, Jun 21, 2016 at 4:52 AM, ericvm  wrote:
> Hello,
>
> Hopefully this is the right place to write. If not, please tell me which
> mailing list I should write to.
>
> I am working at an Interactive Fiction framework in Smalltalk and it is
> already in a very usable state and has a working Cloak of Darkness demo. I
> only tested it on Pharo but I suppose it would take minimum effort to port
> it to Squeak as well.
>
> The stable branch is on github (https://github.com/ericvm/smallworlds) and
> potentially unstable development branch is currently hosted at Smalltalkhub
> (http://smalltalkhub.com/#!/%7Eericvm/Smallworlds)
>
> It would be very nice if there were people interested in trying/testing and
> contribute to the project.
>
> I was hoping that since Squeak is more education focused than Pharo there
> might be more people interested in the project
>
>
>
> --
> View this message in context: 
> http://forum.world.st/Interactive-Fiction-Framework-in-Smalltalk-Released-tp4901971.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: FileDirectory

2016-05-26 Thread Ben Coman
On Fri, May 27, 2016 at 3:02 AM, Joseph Alotta  wrote:
>
>> On May 26, 2016, at 8:29 AM, Ron Teitelbaum [via Smalltalk] <[hidden
>> email]> wrote:
>>
>> One more question for you.  I mentioned returning a newly created instance
>> or a specific class from a class side method.  Can you name another reason
>> why you would write a method on the class side?
>
> When there is only one
> instance of an object and other is not desirable or logical.
>
> For example, one compiler: two is not practical.  One instance of the number
> Pi.  One instance of Nil. Why would you need another?

One downside of this approach is that it can make developing/running
unit tests harder when your tests are changing global state - which is
what class variables kind-of are.

cheers -ben

>
>> Why would it be a good idea to put a method on the class side instead of
>> the instance side?  (a hint for you, I’m thinking of something where nothing
>> is returned. (of course in Smalltalk if nothing is returned you get back
>> self, what I mean is that nothing useful is returned)) Bonus points for 2 or
>> more answers with or without returning
>> something J.
>
> You would put a method on the class side when the method applies to all
> instances of the class.  For example, Window closeAllWindows.  Or Process
> stopAllProcesses.   Or Smalltalk saveImage.
>
> I don’t think this is what you had in mind, though.
>
> Sincerely,
>
> Joe.
>
>
>
> 
> View this message in context: Re: FileDirectory
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] help with morphic

2016-05-19 Thread Ben Coman
On Fri, May 20, 2016 at 7:38 AM, Ben Coman <b...@openinworld.com> wrote:
> On Fri, May 20, 2016 at 4:43 AM, Joseph Alotta <joseph.alo...@gmail.com> 
> wrote:
>> Greetings,
>>
>> I am having trouble getting started with Morphic.  I tried the tutorial on 
>> squeak.org and found it too hard to follow.  Now I have morphs on my screen 
>> and I don’t know how to close them.
>>
>> I looked for videos on Morphic and found only a technical comparison of 
>> changes.  Is there a video designed for beginners that someone not an 
>> egghead can follow?
>
> I think Steve Wessels LaserGame is a great general tutorial, which
> also covers Morphic.
> http://squeak.preeminent.org/tut2007/html/
(Sorry, darn keyboard shortcut sent that before I'd finished.  )

Best to regress to Squeak 3.9 while doing the tutorial, then if you
like, upgrade your game to current version.

cheers -ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] help with morphic

2016-05-19 Thread Ben Coman
On Fri, May 20, 2016 at 4:43 AM, Joseph Alotta  wrote:
> Greetings,
>
> I am having trouble getting started with Morphic.  I tried the tutorial on 
> squeak.org and found it too hard to follow.  Now I have morphs on my screen 
> and I don’t know how to close them.
>
> I looked for videos on Morphic and found only a technical comparison of 
> changes.  Is there a video designed for beginners that someone not an egghead 
> can follow?

I think Steve Wessels LaserGame is a great general tutorial, which
also covers Morphic.
http://squeak.preeminent.org/tut2007/html/
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Raspberry Pi v. Raspberry St

2015-07-16 Thread Ben Coman
And another option might be using the Programmable Realtime Unit of
the Beaglebone Black.
For example, tight loop toggling of an LED is 200ns on:
* 1Ghz Arm Cortex-A8 = 200ns
* 200Mhz PRU = 5ns

ELC 2015 - Enhancing Real-Time Capabilities with the PRU - Rob
Birkett, Texas Instruments
http://events.linuxfoundation.org/sites/events/files/slides/Enhancing%20RT%20Capabilities%20with%20the%20PRU%20final.pdf
https://www.youtube.com/watch?v=plCYsbmMbmY

cheers -ben


On Tue, Jul 14, 2015 at 7:42 PM, Ben Coman b...@openinworld.com wrote:
 Smalltalk FPGA may be of interest...

 http://www.slideshare.net/esug/luc-fabresse-iwst2014

 http://esug.org/data/ESUG2014/IWST/Papers/iwst2014_From%20Smalltalk%20to%20Silicon_Towards%20a%20methodology%20to%20turn%20Smalltalk%20code%20into%20FPGA.pdf

 cheers -ben

 On Tue, Jul 14, 2015 at 11:55 AM, Kirk Fraser overcomer@gmail.com wrote:
 Hi Casey,

 Thanks for the suggestion.  I will have multiple connected controller boards
 and with your suggestion maybe I'll try a Pi for each limb and each webcam
 or maybe your ARM9 suggestion.

 To prove it's good as a human in performance I want it to do minor
 acrobatics like cartwheels and balancing tricks, maybe a Chuck Norris kick
 or jumping over a fence with one hand on a post.  Or like those free-running
 videos. Stuff I could not do myself. But it all waits on money.  Maybe I'll
 make better progress next year when social security kicks in.

 As far as human performance goals, one professor wrote it takes 200 cycles
 per second to hop on one leg.  Somewhere I read human touch can sense 1 in
 32,000 of an inch.  I don't have the other figures yet.  I may not be able
 to drive an arm as fast as a human boxer - 200 mph but as long as it's fast
 enough to drive a vehicle on a slow road (not I5) that might be enough until
 faster computers are here.

 The vision system seems like a major speed bottle neck.  Maybe a mini-cloud
 can take one 64th of the image for each processor analyze it, then assemble
 larger object detection in time for the next frame.  The DARPA Atlas robot
 used 4 cores for each camera I think.  But a mini-cloud set off nearby to
 process vision and return either the objects with measurements or
 instructions would be a lot of work.   The more I write, the more I see why
 the head of DARPA's robots said they cost 1-2 million as you have to hire a
 team of programmers or make a really intricate learning program.

 Kirk


 On Mon, Jul 13, 2015 at 5:58 PM, Casey Ransberger casey.obrie...@gmail.com
 wrote:

 Hey Kirk,

 I like Ralph's suggestion of doing the time/timing specific stuff on a
 dedicated microcontroller.

 I'd recommend going one better: use more than one microcontroller. Robots
 need to do a lot in parallel; if the robot has to stop driving in order to
 think, that's a problem (although the converse would be decidedly human!)
 Anyway, it sounds like real-time is not negotiable in your view, so green
 threads won't cut it either.

 Mine has... six controllers in total. That's not counting the ARM9 which
 is more like a full computer (e.g., Linux.)

 I think six anyway. Could be more hiding in there. Two drive sensors,
 three drive motors, one is wired up close to the ARM board to coordinate the
 other controllers on behalf of what the Linux system wants them doing.

 I'm curious, have you figured out what the average, best, and worst case
 latencies are on human reflexes? In my view, matching or beating that
 benchmark is where the money probably is.

 --C

 On Jul 6, 2015, at 12:39 PM, Kirk Fraser overcomer@gmail.com wrote:

 Ralph Johnson,

 That's an excellent suggestion and an excellent story, thank you very
 much!  Letting the human interface in Smalltalk program the robot controller
 instead of being the robot controller sounds good.

 My robot uses a network of Parallax microcontroller chips to drive
 hydraulic valves, which can be programmed via USB for simple tasks like
 moving one joint from point A to B but since each controller has 8 cores
 more complex tasks like grasping or walking can be done on the MCU's or on a
 small Raspberry Pi or other hardware in a non-GC or controllable GC
 language.

 A harder part to wrap my head around is handling the webcam vision system
 and artificial intelligence while remaining time sensitive enough to do time
 critical tasks like cartwheels and other acrobatic choreography.

 I know in effect my human mind shuts down most of its intellectual
 pursuits when engaged in heavy physical activity - maybe the robot must do
 the same - think more creatively when idling and pay closer attention while
 working. That takes care of the Ai timing.

 The heavy load of vision processing appears to need a mini-cloud of cores
 to reduce time to identify and measure objects from contours and other
 information.  To guarantee performance they would also need to run a non-GC
 language that could be programmed from Squeak interactively as new objects
 are being learned

Re: [Newbies] Raspberry Pi v. Raspberry St

2015-07-15 Thread Ben Coman
On Wed, Jul 15, 2015 at 1:28 AM, Kirk Fraser overcomer@gmail.com wrote:
 Wow!  Ben's article and slides shows Ralph Johnson's suggestion several
 steps closer to real life and on computer vision for robots.

 I'm still thinking a laser range finder is not necessary since humans don't
 have them.  We get by with eyes that can measure distances with or without
 stereo enhancement and the stereo image facility helps us see things neither
 eye can make out alone.

OT: That sounds a bit purist. Just because we haven't evolved laser
vision (yet) doesn't mean its not useful.  If it needs less
computation than stereo vision then I'd say use the tools you've got
:)

cheers -ben   :)-|--
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Raspberry Pi v. Raspberry St

2015-07-14 Thread Ben Coman
Smalltalk FPGA may be of interest...

http://www.slideshare.net/esug/luc-fabresse-iwst2014

http://esug.org/data/ESUG2014/IWST/Papers/iwst2014_From%20Smalltalk%20to%20Silicon_Towards%20a%20methodology%20to%20turn%20Smalltalk%20code%20into%20FPGA.pdf

cheers -ben

On Tue, Jul 14, 2015 at 11:55 AM, Kirk Fraser overcomer@gmail.com wrote:
 Hi Casey,

 Thanks for the suggestion.  I will have multiple connected controller boards
 and with your suggestion maybe I'll try a Pi for each limb and each webcam
 or maybe your ARM9 suggestion.

 To prove it's good as a human in performance I want it to do minor
 acrobatics like cartwheels and balancing tricks, maybe a Chuck Norris kick
 or jumping over a fence with one hand on a post.  Or like those free-running
 videos. Stuff I could not do myself. But it all waits on money.  Maybe I'll
 make better progress next year when social security kicks in.

 As far as human performance goals, one professor wrote it takes 200 cycles
 per second to hop on one leg.  Somewhere I read human touch can sense 1 in
 32,000 of an inch.  I don't have the other figures yet.  I may not be able
 to drive an arm as fast as a human boxer - 200 mph but as long as it's fast
 enough to drive a vehicle on a slow road (not I5) that might be enough until
 faster computers are here.

 The vision system seems like a major speed bottle neck.  Maybe a mini-cloud
 can take one 64th of the image for each processor analyze it, then assemble
 larger object detection in time for the next frame.  The DARPA Atlas robot
 used 4 cores for each camera I think.  But a mini-cloud set off nearby to
 process vision and return either the objects with measurements or
 instructions would be a lot of work.   The more I write, the more I see why
 the head of DARPA's robots said they cost 1-2 million as you have to hire a
 team of programmers or make a really intricate learning program.

 Kirk


 On Mon, Jul 13, 2015 at 5:58 PM, Casey Ransberger casey.obrie...@gmail.com
 wrote:

 Hey Kirk,

 I like Ralph's suggestion of doing the time/timing specific stuff on a
 dedicated microcontroller.

 I'd recommend going one better: use more than one microcontroller. Robots
 need to do a lot in parallel; if the robot has to stop driving in order to
 think, that's a problem (although the converse would be decidedly human!)
 Anyway, it sounds like real-time is not negotiable in your view, so green
 threads won't cut it either.

 Mine has... six controllers in total. That's not counting the ARM9 which
 is more like a full computer (e.g., Linux.)

 I think six anyway. Could be more hiding in there. Two drive sensors,
 three drive motors, one is wired up close to the ARM board to coordinate the
 other controllers on behalf of what the Linux system wants them doing.

 I'm curious, have you figured out what the average, best, and worst case
 latencies are on human reflexes? In my view, matching or beating that
 benchmark is where the money probably is.

 --C

 On Jul 6, 2015, at 12:39 PM, Kirk Fraser overcomer@gmail.com wrote:

 Ralph Johnson,

 That's an excellent suggestion and an excellent story, thank you very
 much!  Letting the human interface in Smalltalk program the robot controller
 instead of being the robot controller sounds good.

 My robot uses a network of Parallax microcontroller chips to drive
 hydraulic valves, which can be programmed via USB for simple tasks like
 moving one joint from point A to B but since each controller has 8 cores
 more complex tasks like grasping or walking can be done on the MCU's or on a
 small Raspberry Pi or other hardware in a non-GC or controllable GC
 language.

 A harder part to wrap my head around is handling the webcam vision system
 and artificial intelligence while remaining time sensitive enough to do time
 critical tasks like cartwheels and other acrobatic choreography.

 I know in effect my human mind shuts down most of its intellectual
 pursuits when engaged in heavy physical activity - maybe the robot must do
 the same - think more creatively when idling and pay closer attention while
 working. That takes care of the Ai timing.

 The heavy load of vision processing appears to need a mini-cloud of cores
 to reduce time to identify and measure objects from contours and other
 information.  To guarantee performance they would also need to run a non-GC
 language that could be programmed from Squeak interactively as new objects
 are being learned.  I haven't worked with a laser range finder but I suspect
 they use it to narrow the focus onto moving objects to process video in more
 detail in those areas.

 The current buzzword co-robots meaning robots that work beside or
 cooperatively with people working in symbiotic relationships with human
 partners suggests everyone will need a robot friend, which will require an
 artificial intelligence capable of intelligent thought.  As most Americans
 are Christian it would make sense for a human compatible AI to be based on
 the Bible.  

Re: [Newbies] How to round a float?

2015-02-04 Thread Ben Coman
In the interest of teaching how to fish, look at the senders of #roundTo:
to find its usage.

I'll post a full answer tomorrow if you don't beat me to it.

cheers -ben

On Wed, Feb 4, 2015 at 4:34 PM, Chuck Hipschman ckhipsch...@gmail.com
wrote:

 7 / 8.0 roundTo: 2 I expect 0.88, I get 0

 What am I doing wrong, or this a bug?

 TIA

 Chuck

 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to round a float?

2015-02-04 Thread Ben Coman
On Wed, Feb 4, 2015 at 7:22 PM, Chuck Hipschman ckhipsch...@gmail.com
wrote:

 7 / 8.0 roundTo 0.01 = 0.88  Aha! Thanks!

 But:

 100 * (1.05 raisedTo: 10) roundTo: 0.01 162.890001

 162.88946267774418 unrounded
 100 * (1.05 raisedTo: 15) roundTo: 0.01 207.890001

  207.8928179411367  unrounded
  Bug, or me again :-)


If you debug into #roundTo: you'll see its implementation is simple
arithmetic, subject to the vagaries of float resolution.

Float(Number)roundTo:
^(self / quantum) rounded * quantum

Now are you wanting something nicely formatted for display, or are you
rounding for some mathematic purpose?  Perhaps instead you are wanting...

   100 * (1.05 raisedTo: 10) printShowingDecimalPlaces: 2   -- 162.89 

   0.105 printShowingDecimalPlaces: 2 -- 0.10 

   0.115 printShowingDecimalPlaces: 2 -- 0.12 

btw, I only found these today, looking in the printing protocol of Number
and Float.

cheers -ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Read RasPi GPIO

2015-01-28 Thread Ben Coman
How about sending #reset to set the stream back to the start ?

Read the paragraph above lseek here...
http://falsinsoft.blogspot.com.au/2012/11/access-gpio-from-linux-user-space.html

cheers -ben


On Wed, Jan 28, 2015 at 8:45 PM, Herbert König herbertkoe...@gmx.net
wrote:

 Hi,

 I can successfully read a GPIO Pin on the RasPi if I do it like:
 |value|
 dataFile ensureOpen.
 value := dataFile upToEnd.
 dataFile close.
 ^value

 dataFile is the /sys/class/gpio/gpioxx/value file that exists after
 exporting gpioxx.

 Without the reopening and closing of the file I get '' on subsequent reads
 which means that
 StandartFileStreambasicNext answers nil.

 Is there a way to get the values without having to close and reopen the
 file each time?

 Thanks

 Herbert
 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Beginner wants to start graphic windows in, Smalltalk 80 - need help - 2

2014-11-26 Thread Ben Coman

Hans Schueren wrote:

Hello , here is Hans , The Byte Surfer ,


the smalltalk code is from books of  year 1992 and 1993 1988 and 1987.

I have a lot of books around the world .   ALL of the Topic SMALLTALK 
80.  Only 80 !!!



Because i am a absolute beginner and want to learn smalltalk 80.


Smalltalk  80 encompasses core language and libraries. Squeak and Pharo 
are direct decendents from Smalltalk 80, however Smalltalk was always 
meant to be an evolving system, and Smalltalk 80 is just a snapshot 
from 1980 and all flavours of Smalltalk how moved over this time.  The 
core language is the same but the libraries have moved a bit.




I realized that thing have changed.   for example  GUI programming

Mosttimes there is a optional library needed for creation. There is a 
optional IDE i know , for those things.


No Matter !


If you wish to use Pharo by Example, then its best to use the older 
image that the book was written for...

http://www.pharobyexample.org/image/PBE-OneClick-1.1.app.zip

I believe its the same situation for Squeak...
http://gforge.inria.fr/frs/download.php/4624/SqueakByExample-1.3.zip

Now Pharo By Example is about a third of the way through being updated 
to recent Pharo versions, but it takes time.





I dont know anything about the  NEWTOOLSand Replacements in 
actual Smalltalk Engineering like PHARO.




Please tell me what i have to learn.


What is GUI IDE in Pharo. Do i have to learn   Morpic. What else 
for Window and Buttons design ?



The Pharo  ( and actual squeak )   have very much weight for a beginner.


Its heaviness is the paradigm shift in thinking about programming. Like 
all things, it gets easier after that hump. Now some say, the only 
languages worth learning are those that change how you think about 
programming  I hope you stick with it.   Ask many questions here.


After the By Example books, try...
http://webcache.googleusercontent.com/search?q=cache:http://squeak.preeminent.org/tut2007/html/
(I don't know why the main site is down atm)

cheers -ben




Is it right , that allNEW STUFF  is decribed in the two manuals :  
Pharo by Example + Deep into Pharo.


Or is there any other actual description about Up to date programming 
Pharo 




Sincerely  Your Friend


Hans
The Byte Surfer


PS. Wish to have Smalltalk 80 from XEROX 1987 here.  ha ha ha


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] status of the 'mvc' environment?

2014-09-06 Thread Ben Coman




Casey Ransberger wrote:

  Woot! I can't answer your question, but I do have a
strong interest in being able to unload the Morphic environment. In
something like a web server, Morphic just wastes a lot of CPU cycles,
and MVC is much less expensive (as we've seen on lower end machines
like the Raspberry Pi,) so it would be fantastic to elevate it to its
former glory as a complete solution to the user interface of
applications which do not require the flexibility of the Morphic
environment, like the system browser.
  
  
  Unfortunately, while I have plenty of experience with the MVC
"pattern," I have only really just sat in awe of how fast Squeak runs
inside an MVC project. Having someone around who's returning after 14
years of wandering might be just what I need to make myself useful in
this regard. I know that David Lewis is also interested in seeing the
MVC system a viable option for development again (IIRC he fixed some
serious problems with the debugger,) and I imagine that at least some
of the Seaside folks would love to drop the overhead of Morphic from
their servers.
  
  
  I'm moving this conversation to squeak-dev, as it's more about
remodelling and redecorating a part of the core of Squeak and less
about using it in general. If you aren't subscribed there, you should
be, or you'll end up in the moderator's queue, which can take a
(relatively) longish time to turn around.
  
  
  If the community doesn't take the bait, feel free to contact me
offline. Maybe there's a common point of interest and we can team up.
  


Maybe this progress is of interest...  
http://pharoweekly.wordpress.com/tag/bootstrap-image-reloading-morphic/
Its not MVC on its own, but it might provide a good basis for MVC
without Morphic.
cheers -ben


  
  
  
  --Casey Ransberger
  
  
  
  On Fri, Sep 5, 2014 at 8:39 PM, Mayuresh
Kathe mayur...@kathe.in
wrote:
  hello,

i am returning to squeak after a gap of 14 years.
back then, i used to work only within the 'mvc' environment as morphic
hadn't taken off the way it has now.

i still prefer the simplicity and lightness of the 'mvc' environment.

at last use, the 'mvc' environment felt quite sluggish and crashed my
squeak session multiple times.
hope all is well!

~mayuresh

ps: if boris gaertner is still around, could he please mail me off-list!

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  
  
  
  
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  







___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Unknown error

2014-06-06 Thread Ben Coman

ParadoxMachine wrote:

Hello.

I'm having problems with this code:



That code results in the following text being written in Transcript:



I don't know how to fix this.

Thank you for reading.



--
View this message in context: http://forum.world.st/Unknown-error-tp4761926.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  


I don't see any code or Transcript output.  Were there meant to be images?
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Unknown error

2014-06-06 Thread Ben Coman

ParadoxMachine wrote:

No, they were supposed to appear as raw text (using raw tags). At least they
do for me.

Anyway, here's the code:

a := 0. 
b := 1. 
10 timesRepeat: [

a timesRepeat: [b = b*2].
Transcript show: '2^a = '.
Transcript show: b ;cr.
a = a+1.
b = 1].

And this is the result:

2^a = 1

UndefinedObjectDoIt (a is Undeclared) 
UndefinedObjectDoIt (b is Undeclared) 
UndefinedObjectDoIt (a is Undeclared) 
UndefinedObjectDoIt (b is Undeclared) 
UndefinedObjectDoIt (b is Undeclared) 
UndefinedObjectDoIt (b is Undeclared) 
UndefinedObjectDoIt (a is Undeclared) 
UndefinedObjectDoIt (a is Undeclared) 
UndefinedObjectDoIt (b is Undeclared) 




--
View this message in context: 
http://forum.world.st/apparently-Undeclared-variables-tp4761926p4761938.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  

your last two assignments are = and not := ?
cheers -ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Unknown error

2014-06-06 Thread Ben Coman

ParadoxMachine wrote:

No, that doesn't work, either. The result is exactly the same as the one I
mentioned.
Thanks for replying, though.

-ParadoxMachine



--
View this message in context: 
http://forum.world.st/apparently-Undeclared-variables-tp4761926p4761943.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  
That change to your code works for me, but I should have said last three 
assignments.

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Unknown error

2014-06-06 Thread Ben Coman

ParadoxMachine wrote:

That worked, thanks.

By the way, how do I put strings (or a string and a number) together? The
way I did it requires me to write more than a single Transcript show:
line.

-ParadoxMachine
  

Two alternatives...
* Transcript crShow: 1 asString, String tab, 2 asString.
* Transcript crShow: 1 ; tab ; show: 2.

As well, you may find the links useful...
http://wiki.squeak.org/squeak/5699
http://www.eli.sdsu.edu/courses/spring01/cs635/readingSmalltalk.pdf

btw, just some general feedback on your code. Since b is set to 1 before 
the loop and at the end of the loop, it is equivalent to just do that at 
the start of the loop instead (unless you are relying on b=1 after the 
loop. And here is an alternative...

0 to: 9 do: [ :a |
   b := 1.
   a timesRepeat: [b := b*2].
   Transcript show: '2^a = '.
   Transcript show: b ;cr.
].

cheers, Ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] List still active?

2014-04-05 Thread Ben Coman




Mark Dymek wrote:

  I tried to subscribe to this list but it appears I
already am. Is the list no longer active? I have not been getting
messages from it. 
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  

Hi Mark,

The last post I received prior to yours was 22 March 2014. There is
not always a lot of activity, but there are a lot of people observing
and responses are pretty quick.

cheers -ben


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] List still active?

2014-04-05 Thread Ben Coman




Well there have been several responses to your post on the list. So
there is something wrong.

Mark Dymek wrote:

  I ask because I've received no messages from this list. 
  On Apr 5, 2014 12:52 PM, "Ben Coman" b...@openinworld.com
wrote:
  

Mark Dymek wrote:

  I tried to subscribe to this list but it appears I
already am. Is the list no longer active? I have not been getting
messages from it. 
  
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  

Hi Mark,

The last post I received prior to yours was 22 March 2014. There is
not always a lot of activity, but there are a lot of people observing
and responses are pretty quick.

cheers -ben

  
  




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Website change, Squeek by Example Game?

2014-03-21 Thread Ben Coman




Sorry I'm not familiar with the tutorial you are referring to. However
a good alternative is Stephan
B Wessels Laser Game tutorial [1].
Unfortunately it has been updated since 3.9, but I think its still
worth doing as one of the best. 

[1] http://squeak.preeminent.org/tut2007/html/

cheers -ben

Abuzar wrote:

  Hi all,

I'm still looking for that specific tutorial, and a recommendation on
whether it's obsolete or other advice.  A response would be
appreciated.

Thanks,
Abuzar


On Wed, Mar 12, 2014 at 7:04 PM, Abuzar abu...@abuzar.com wrote:
  
  
Hi all,

I was going through a squeek-by-example tutorial.  Not the .pdf book.
It was a simple game tutorial on the Documentation page.  After the
website changeover, it has seemingly disappeared.  Is it now obsolete?
or no longer recommended?

I'm also noticing that Squeak 4.5 is rolling out.  Is this a big
change?  Should I hold off going through tutorials until they're
updated?

Abuzar

  
  ___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Website change, Squeek by Example Game?

2014-03-21 Thread Ben Coman




Abuzar wrote:

  Hi Ben,

That's it!  That's the tutorial I was going through when it
disappeared from the website.  I'm not sure, but the look and feel is
a bit different?  Maybe a copy of it was on the website?  Or maybe
just the main index looks a bit different?  Anyhow that's the tutorial
and I'll continue with Section 2 now.

So far I think it's a decent tutorial.  



  If there's time and energy, it
might be good to update it (yes, I'm running across some
inconsistencies between version 3.9 and 4.4, but have managed to
guess/figure stuff out), and put it back on the website?  

That is something I would be interested in putting some energy into -
for both Squeak and Pharo. I have previously emailed the author asking
permission to do that but there was no response. 
cheers -ben


  At first
glance, I prefer it as a starting point over the SBE book, which I
intend to go through after this tutorial.

Thanks!
Abuzar


On Fri, Mar 21, 2014 at 10:42 AM, Ben Coman b...@openinworld.com wrote:
  
  
Sorry I'm not familiar with the tutorial you are referring to.  However a
good alternative is Stephan B Wessels Laser Game tutorial [1].
Unfortunately it has been updated since 3.9, but I think its still worth
doing as one of the best.

[1] http://squeak.preeminent.org/tut2007/html/

cheers -ben

Abuzar wrote:

Hi all,

I'm still looking for that specific tutorial, and a recommendation on
whether it's obsolete or other advice.  A response would be
appreciated.

Thanks,
Abuzar


On Wed, Mar 12, 2014 at 7:04 PM, Abuzar abu...@abuzar.com wrote:


Hi all,

I was going through a squeek-by-example tutorial.  Not the .pdf book.
It was a simple game tutorial on the Documentation page.  After the
website changeover, it has seemingly disappeared.  Is it now obsolete?
or no longer recommended?

I'm also noticing that Squeak 4.5 is rolling out.  Is this a big
change?  Should I hold off going through tutorials until they're
updated?

Abuzar


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners





___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


  
  ___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Package difference

2013-12-10 Thread Ben Coman

Mateusz Grotek wrote:

How to see the difference between two packages by using Monticello?
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  

Do you mean two versions of the same package, or two different packages?

cheers -ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] sandboxing a world

2013-10-13 Thread Ben Coman




David Holiday wrote:

  Hi all, 

I'm just now getting into squeak and finding it a delightful programming environment. I am, however, curious as to why some features don't seem readily available. First and foremost, why isn't there a stripped down version of the VM that runs Squeak programs and nothing else? That is, why isn't it possible to distribute Squeak program to users in the way Java developers distribute Java programs? 

To put this another way, let's say I'm a Squeak developer and I want to distribute my program to a community of people that does X. Under the current paradigm, all the people that do X also have to be Squeak savvy people if they are going to make use of my program. They have to be savvy enough to know what it is, install it, run it, install my program, and run my program. Moreover, they have to know enough about the Squeak interface to know what to do if they accidentally close my program window. Conversely, with Java, the user doesn't have to know anything about Java beyond downloading JVM. In this way, I can distribute my program to everyone that does X without having to worry about whether or not they also know anything about Squeak. 

So why isn't something like this available? 
  

Refer to http://squeak.preeminent.org/tut2007/html/205.html
noting that it is for an older version of Squeak.

cheers -ben

  

David Holiday 
-
San Diego State University
neubu...@rohan.sdsu.edu







  
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Modbus (was Re: [Newbies] Re: Beginners Digest, Vol 89, Issue 3)

2013-09-15 Thread Ben Coman




Marcos Cevallos wrote:

  Hi

Is there any example of MODBUS implementation in pharo seaside ?

Regards

Marcos
  


Hi Marcos,

I don't know of any Modbus implementations.  I proposed developing a
native Smalltalk implementation for this year's GSoC [1] but it didn't
get selected as a priority.  I am still interested in developing one so
I am curious as to your application.  The other option would be
interfacing to an existing C library using NativeBoost (but I haven't
had any experience with that yet.)

[1] http://gsoc2013.esug.org/projects/modbus

regards -ben

P.S.  A criticism :) 
Do you have some problem setting a proper 'Subject' and also leaving
out all the material below that is not relevant to your one line
question?





  
2013/9/13, beginners-requ...@lists.squeakfoundation.org
beginners-requ...@lists.squeakfoundation.org:
  
  
Send Beginners mailing list submissions to
	beginners@lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
	beginners-requ...@lists.squeakfoundation.org

You can reach the person managing the list at
	beginners-ow...@lists.squeakfoundation.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re: Beginners Digest, Vol 89, Issue 2 (Marcos Cevallos)
   2. properly setting the subject line - was: [Newbies] Re:
  Beginners	Digest, Vol 89, Issue 2 (Ben Coman)


--

Message: 1
Date: Fri, 13 Sep 2013 08:00:41 -0500
From: Marcos Cevallos mcevallo...@gmail.com
Subject: [Newbies] Re: Beginners Digest, Vol 89, Issue 2
To: beginners@lists.squeakfoundation.org
Message-ID:
	cacho2ejvcsj27xofpaf1d6cchm+pyd+eq-az7-pjwknjr90...@mail.gmail.com
Content-Type: text/plain; charset=UTF-8

Hi, thanks so much for your promptly support.
It worked!!!.

I was doing

FileDirectory deleteFileNamed: 'c:\temp\prueba.txt'.  and get an error.

But then I tryied

FileDirectory default deleteFileNamed: 'c:\temp\prueba.txt'.  and it
worked.

Sorry I missed include default

Again, thank so much.

This is the first time I wrote.

I am trying to use Seaside to work with Web Services that provide a
Xerox Multifunction Device. I will tell you how everything is going
on, If there is anay doubt I will tell you.

Best Regards

Marcos.

2013/9/13, beginners-requ...@lists.squeakfoundation.org
beginners-requ...@lists.squeakfoundation.org:


  Send Beginners mailing list submissions to
	beginners@lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
	beginners-requ...@lists.squeakfoundation.org

You can reach the person managing the list at
	beginners-ow...@lists.squeakfoundation.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re: Beginners Digest, Vol 89, Issue 1 (Marcos Cevallos)
   2. deleting a file from Windows system directory (Ben Coman)


--

Message: 1
Date: Thu, 12 Sep 2013 19:35:17 -0500
From: Marcos Cevallos mcevallo...@gmail.com
Subject: [Newbies] Re: Beginners Digest, Vol 89, Issue 1
To: beginners@lists.squeakfoundation.org
Message-ID:
	cacho2egm7ge-t20kkke-hbxurczdi3ehfehfgo4tvejpvdg...@mail.gmail.com
Content-Type: text/plain; charset=UTF-8

Hi

I´m newbie in squeak

I want to know how to delete a file in a windows system directory in
pharo 1.3 seaside 3.0.7

I really appreciate it

2013/9/10, beginners-requ...@lists.squeakfoundation.org
beginners-requ...@lists.squeakfoundation.org:
  
  
Send Beginners mailing list submissions to
	beginners@lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
	beginners-requ...@lists.squeakfoundation.org

You can reach the person managing the list at
	beginners-ow...@lists.squeakfoundation.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Serial port write freezes the VM (mactro)
   2. Re: Serial port write freezes the VM (Levente Uzonyi)
   3. Re: Serial port write freezes the VM (Maciej Troszy?ski)


--

Message: 1
Date: Mon, 9 Sep 2013 05:35:18 -0700 (PDT)
From: mactro mac...@gmail.com
Subject: [Newbies] Serial port write freezes the VM
To: beginners@lists.squeakfoundation.org
Message-ID: 1378730118166-4707333.p...@n4.nabble.com
Content-Type: text/plain; charset=us-as

properly setting the subject line - was: [Newbies] Re: Beginners Digest, Vol 89, Issue 2

2013-09-13 Thread Ben Coman




Hi Marcos,

Glad you got it going, and thanks for reporting back.  However could
you pay attention to properly setting the subject line when you reply
to any digest.  Thanks.

regards -ben

Marcos Cevallos wrote:

  Hi, thanks so much for your promptly support.
It worked!!!.

I was doing

FileDirectory deleteFileNamed: 'c:\temp\prueba.txt'.  and get an error.

But then I tryied

FileDirectory default deleteFileNamed: 'c:\temp\prueba.txt'.  and it worked.

Sorry I missed include default

Again, thank so much.

This is the first time I wrote.

I am trying to use Seaside to work with Web Services that provide a
Xerox Multifunction Device. I will tell you how everything is going
on, If there is anay doubt I will tell you.

Best Regards

Marcos.

2013/9/13, beginners-requ...@lists.squeakfoundation.org
beginners-requ...@lists.squeakfoundation.org:
  
  
Send Beginners mailing list submissions to
	beginners@lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
	beginners-requ...@lists.squeakfoundation.org

You can reach the person managing the list at
	beginners-ow...@lists.squeakfoundation.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re: Beginners Digest, Vol 89, Issue 1 (Marcos Cevallos)
   2. deleting a file from Windows system directory (Ben Coman)


--

Message: 1
Date: Thu, 12 Sep 2013 19:35:17 -0500
From: Marcos Cevallos mcevallo...@gmail.com
Subject: [Newbies] Re: Beginners Digest, Vol 89, Issue 1
To: beginners@lists.squeakfoundation.org
Message-ID:
	cacho2egm7ge-t20kkke-hbxurczdi3ehfehfgo4tvejpvdg...@mail.gmail.com
Content-Type: text/plain; charset=UTF-8

Hi

I´m newbie in squeak

I want to know how to delete a file in a windows system directory in
pharo 1.3 seaside 3.0.7

I really appreciate it

2013/9/10, beginners-requ...@lists.squeakfoundation.org
beginners-requ...@lists.squeakfoundation.org:


  Send Beginners mailing list submissions to
	beginners@lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
	beginners-requ...@lists.squeakfoundation.org

You can reach the person managing the list at
	beginners-ow...@lists.squeakfoundation.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Serial port write freezes the VM (mactro)
   2. Re: Serial port write freezes the VM (Levente Uzonyi)
   3. Re: Serial port write freezes the VM (Maciej Troszy?ski)


--

Message: 1
Date: Mon, 9 Sep 2013 05:35:18 -0700 (PDT)
From: mactro mac...@gmail.com
Subject: [Newbies] Serial port write freezes the VM
To: beginners@lists.squeakfoundation.org
Message-ID: 1378730118166-4707333.p...@n4.nabble.com
Content-Type: text/plain; charset=us-ascii

Hi,

I'm developing a mod for Scratch that will allow controlling an
educational
robot via Bluetooth. I'm using SerialPort2 class that is included in
Scratch
plugin and allows opening ports by name. Everything works fine BUT, when
I
send commands in a loop, and the connection is lost (i.e. the robot was
powered off), the VM freezes. I tried forking the port nextPutAll like
that:

timer := Delay forMilliseconds: 1000.
port := SerialPort2  new.
port openPortNamed:'COM14' baud:57600.
process := [port nextPutAll:'test'. Transcript show:'port'.] forkAt: 1.
[timer wait. Transcript show:'delay'. process terminate.] forkAt: 7.

but with no result. Is there any way to write to a serial port with
timeout?

mactro



--
View this message in context:
http://forum.world.st/Serial-port-write-freezes-the-VM-tp4707333.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.


--

Message: 2
Date: Tue, 10 Sep 2013 04:45:35 +0200 (CEST)
From: Levente Uzonyi le...@elte.hu
Subject: Re: [Newbies] Serial port write freezes the VM
To: "A friendly place to get answers to even the most basic questions
	about	Squeak." beginners@lists.squeakfoundation.org
Message-ID:
	alpine.deb.2.00.1309100442210.21...@login01.caesar.elte.hu
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Mon, 9 Sep 2013, mactro wrote:

  
  
Hi,

I'm developing a mod for Scratch that will allow controlling an
educational
robot via Bluetooth. I'm using SerialPort2 class that is included in
Scratch
plugin and allows opening ports by name. Everything works fine BUT, when
I
send commands in a loop, and the connection is lost (i.e. the robot was
powered off), the VM freezes. I tried forking the por

Re: [Newbies] RE: I need an idea. I know you have some. Give. (Casey Ransberger)

2013-03-09 Thread Ben Coman




Casey Ransberger wrote:

  And a TableMorph could complete the package. It's something I've thought
about for a while too. I wish there was more information about Analyst
around, I get the sense that a Smalltalk spreadsheet could be crazy
powerful.
  

Check out Spreadsheet at
http://www.smalltalkhub.com/#!/~StephaneDucasse/PetitsBazars.
Start with SpreadsheetGridMorphTesttestExternalControl.

some background...
http://forum.world.st/Spreadsheet-widget-td4663257.html

cheers -ben


  
http://computinged.wordpress.com/2010/07/01/alan-kay-on-beyond-spreadsheets/

Lately I've been following the VPRI papers around functional reactive
programming (FRP) which might also be worth a look if you're thinking about
this stuff.

http://www.vpri.org/pdf/rn2012001_kscript.pdf

http://www.vpri.org/pdf/m2013001_serializing.pdf

I like the idea, and I like the tightly limited scope. I'll think about
this.

On Fri, Mar 8, 2013 at 7:45 AM, Joseph J Alotta joseph.alo...@gmail.comwrote:

  
  
It always bothered me, and still does that there isn't a Table object.

Most of my data has more than one key and more than one data items, just
like a table in a spreadsheet, or a table in SQL.

I think all of us are spending our time packing things into Arrays of
Arrays or Dictionaries of Dictionaries when the most
simple structure of a Table is what we need.

Sincerely,

Joe.



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


  
  


  
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] RE: I need an idea. I know you have some. Give. (Casey Ransberger)

2013-03-09 Thread Ben Coman




Ben Coman wrote:

  Casey Ransberger wrote:
 And a TableMorph could complete the package. It's something I've thought
 about for a while too. I wish there was more information about Analyst
 around, I get the sense that a Smalltalk spreadsheet could be crazy
 powerful.
   
Check out Spreadsheet at 
http://www.smalltalkhub.com/#!/~StephaneDucasse/PetitsBazars.
Start with SpreadsheetGridMorphTesttestExternalControl.

some background... http://forum.world.st/Spreadsheet-widget-td4663257.html

cheers -ben
  


I forgot to add, I thought it would be interesting to marry that with
Sven Van Caekenberghe's NeoCSV [1] for data import,
and Fuel or STON based native save/load. 

[1] http://forum.world.st/ANN-NeoCSV-td4636208.html


  
 http://computinged.wordpress.com/2010/07/01/alan-kay-on-beyond-spreadsheets/

 Lately I've been following the VPRI papers around functional reactive
 programming (FRP) which might also be worth a look if you're thinking about
 this stuff.

 http://www.vpri.org/pdf/rn2012001_kscript.pdf

 http://www.vpri.org/pdf/m2013001_serializing.pdf

 I like the idea, and I like the tightly limited scope. I'll think about
 this.

 On Fri, Mar 8, 2013 at 7:45 AM, Joseph J Alotta joseph.alo...@gmail.comwrote:

   
 It always bothered me, and still does that there isn't a Table object.

 Most of my data has more than one key and more than one data items, just
 like a table in a spreadsheet, or a table in SQL.

 I think all of us are spending our time packing things into Arrays of
 Arrays or Dictionaries of Dictionaries when the most
 simple structure of a Table is what we need.

 Sincerely,

 Joe.



 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners

 



   
 

 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners
   

  
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Reset Morphic Drawing After Error

2013-02-12 Thread Ben Coman




Look in MorphfullDrawOn: 
and how it calls drawErrorOn:

Doing [ self setProperty: #errorOnDraw toValue: false ] 
should resume your regularly scheduled program.

Jeff Gonis wrote:

  Hi Everyone,

So when I am using Morphs in Squeak I like to instantiate a morph and then
iteratively change it on the fly, having it respond to step calls, change
how drawing works etc. All in all, this works pretty well and is one of my
favorite ways to develop.  However, one thing that does occur from time to
time is that I will introduce an error that is triggered during the drawOn:
call to the Morph.  When this happens the morph stays instantiated in the
world, but its canvas is drawn all red with a yellow "X" through it,
indicating that my drawing code has failed.

My question is how do I cause the drawing of the morph to be reset after I
have corrected this error in the drawing code? As it stands now I just take
the lazy way out and re-create the morph as a new object and continue on
with my experimentation. However, if I could reset whatever drawing state
needs to be reset, and have the morph continue on with the fixed code, this
would be pretty great, and get me one step closer to my ideal method of
development.

Thanks for your help,
Jeff

  
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Creating a ClassnewX method directly from a pre-existing instance X

2012-06-09 Thread Ben Coman




Casey Ransberger wrote:

  Maybe worth noting that #storeString might not work so well with a Morph that's visible in the World... IIRC that ends up trying to store the whole World, because Morphs hang onto a reference to their current World.

It will work as long as there aren't cycles and it's not in the current world.

In the menu of a workspace, there's an option to create references from dropped Morphs. I think the way I hustled around the problem was by dropping my handmade Morph into the workspace to get a reference, then detaching the Morph from the world with the halo (the workspace has a reference so the Morph doesn't meet the great garbage collector in the sky.)

#storeString and #storeOn: are fun:)

On Jun 9, 2012, at 2:37 PM, Chris Cunnington smalltalktelevis...@gmail.com wrote:

  
  
Well, I don't think you'd programmatically create a new class, because your instance has to have been an instance of a class that already exists. Or else you would not have an instance to begin with. 

Perhaps, you want a way to programatically reproduce an instance you've been working with by hand in a Workspace. You have the instance. It's just right. You want it to be programmatically reproducible at will. I'd use ObjectstoreString. 

x := (HelloWorld new) color: 'Black'.

I've created a instance with an instvar. I send it storeString:
	
x storeString 

and I get: 

'(HelloWorld basicNew instVarAt: 1 put: ''Black''; yourself)'

It's a bit crufty to me. I remove the first and last quote and parentheses. The double single quotes aren't great, so I remove them too. 

HelloWorld basicNew instVarAt: 1 put: 'Black'; yourself

Print it, and get: 

a HelloWorld 

I'm not sure why it comes in some extra syntax. 
That's my best guess at an answer to your question. YMMV. 


Chris 




On 2012-06-09, at 5:04 PM, Erich Groat wrote:



  Hi all,

I was wondering if there are any built-in facilities for taking a particular instance a class X, call it anX, and creating from it a class method that returns an identical instance of anX for future use.

For example, say I'm futzing around in a workspace with an instance of a class called InteractiveWindowShape, tweaking things so that I have a nice window with all the colors and proportions and buttons I want, perhaps using Morphs to create the thing dynamically (so it's some kind of Morph object). In the course of this I get an instance of anInteractiveWindowShape that I am satisfied with, all the instance variables set just right. Let's call this object | idealShape |. It's just sitting there, rather vulnerably, in a workspace, the result of my using various screen tools over the last half hour. Now, I don't just want to save this object: I want to be able to create an identical one whenever I like. So what I want is a Class method, InteractiveWindowShapes classnewIdealShape, that creates an instance exactly like idealShape.

Is there a message I can send to this instance idealShape that would return a block of code that would act as a class method, which I could then call newIdealShape, and which would return an identical instance?

I suspect such a general method might not exist, due to the potential hazards surrounding the deep copy problem; I also suspect I may not be imagining the best sort of solution to my problem. Is there a strategy for this?

Thanks all!

Erich
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  
  
  
  

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
  

You might look at Class Variables. Use the halos to bring up an
Inspector on the top level morph, and within that execute MyClass
storeProtoype such that you store the morph you have. Then later work
out how you want to copy generate clones of that object. For example

MyClass class  storePrototype: aMorph
 MyClassVariable := aMorph.


MyClass class  clonePrototype
 ^ MyClassVariable copy.

Also, you might look back at Squeak 3.9 and go...
1. World  Flaps  Supplies
2. The drag your morph into the Supplies flap which should now show a
icon looking like you morph.
3. Now drag several of those icons out into the world.

cheer -ben


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Where is the setter for self?

2012-06-02 Thread Ben Coman

Chris Cunnington wrote:

http://www.osrcon.ca/image2.png
http://www.osrcon.ca/image1.png

Yea, I'm not asking this very well. And all things Renggli make my 
head spin.


In image2, if I inspect the string 'bob' I see self contains a string 
called 'bob'. It does not say a ByteString, which to me means the 
usual behaviour has been overtaken by something else. We don't get an 
instance; we get only its return value. The instance a ByteString 
was no longer as important as its return value.


In image1, Lukas has overwritten ObjectprintString: in 
SUObjectprintString:. And he's using a pattern (composite with 
decorations or something) to represent the domain of the JavaScript 
language in Smalltalk.


If I print SUSlider new I don't get a SUSlider. I get a string of 
JavaScript. What is printed out is what is found in self. If I inspect 
SUSlider new I can see in self the string that will be produced. I 
can also see in the decoration instance variable a SUCreate. With 
each decoration in the chain he makes the string in self gets longer. 
If I execute that entire piece of code from SUSlider new down to 
onChange: I will get a string of pure JavaScript.


If how I'm asking this is still really confusing, I'll have to sit on 
it for a few days. I seem to do my best comprehending when I'm asleep.


Thanks,
Chris



You may already understand the cascade of message sends, or it may be 
confounding your understanding.  That is, if you are incrementally 
inspecting from X := SUSlider new up to each next semi-colon and 
seeing each Inspector pointing at a different object, since new is 
executed each time.  Just to round out your understanding of self try 
Do It separately on each the following lines...

x := SUSLider new new Control.Slider(null,null) inspect
x handleId: 'handle'
x trackId: track
x value: position
x range: (0 to: 100)
x onChange: ( SUUpdater new id: 'position' )



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Re: perform withArguments

2012-04-24 Thread Ben Coman




Dawson wrote:

  Hi Louis,

thanks for your very helpful posts, particularly the most recent one ...

On 24/04/12 6:49 PM, Louis LaBrunda wrote:
  
  
Hi Dawson and Dawson's 15 year old son,

From your code below, I assume that somewhere in your program you have
created (instantiated) nine cells in instance variables named cell1-cell9.

  
  
Yes, you are right .. these are instantiations of a class (more info in
my other reply to Randal)
  
  
This is fine but you should realize that they (cell1-cell9) are variables
that hold pointers to the objects and not really the objects themselves. It
is okay to think of them as the objects because for the most part it is

  
  
Yes, I was using inexact language here (back to everything is an object
... are pointers in Squeak considered objects then? or is this a case of
something that isn't an object in Squeak?)
  
  
easier than thinking of them as pointers to objects.  The real point is to
realize that more than one variable can point to the same instance of an
object.  For example, if I were to write:

cell10 := cell1.


  
  Point taken.

SNIP

  
  
Back to your program.  I assume that you have a good reason for putting the
cells in variables named (cell1-cell9) and again that is fine but there is
no reason why you can't have the same objects addressable or accessible
from a collection.


  
  Yeah .. I suppose with very little context it looks like we haven't got
a clue what we are doing. (Maybe we don't, but what we've written so far
works even if there is a bit of brute force kind of stuff in there). To
be honest, it is why we started asking questions, as a trained engineer,
and as an artist, I like elegant solutions, perhaps that is what drew me
to Squeak after my son began enquiring if we could learn it together.
But our program right now is certainly not very elegant yet. As we learn
more we can tweak it though.
  
  
Smalltalk's collection classes are one of its many unknown treasures.  They
are a big part of why Smalltalk code is shorter and more understandable
than code of other languages.  Check them out.  And please keep asking
questions.

  
  
Excellent. We have read the "Squeak by Example" book, but we don't
always know how to use the stuff we've read about even after following
the examples. We figured after we wrote this program, that we'd re-read
the book, and get more out of it the next time through.

Thanks again for taking the time to write your advice and suggestions,
we appreciate it.

Dawson
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

  

I found Stephan Wessels' Laser Game [1] very useful as an end-to-end
development example.
Seeing how the development of a whole application progresses using
Squeak is quite insightful.
It is written against an older Squeak 3.9, but I just downloaded that
version to match the tutorial.

[1] http://squeak.preeminent.org/tut2007/html/008.html
http://squeak.preeminent.org/tut2007/html/


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] comparing to an exact class storing class association relationships

2012-04-23 Thread Ben Coman




Randal L. Schwartz wrote:

  

  

  
"Ben" == Ben Coman b...@openinworld.com writes:

  

  

  
  
Ben doh! smacks-head   funny how it works itself out when you step away for a
Ben while - this works fine...

Ben B class  relations
Ben   (self == B)
Ben   ifTrue:  [ ^ { E- #addE.  } ]
Ben   ifFalse: [ ^ {}  ]

Ben but I still wonder if it is the right approach

Without further analysis, or description of the problem you're trying to
solve, this already looks far too fragile for me.

For one, it fails the "null subclass" test.  You should always be able
to subclass a class, putting no methods in the subclass, and the
subclass and superclass objects would be completely interchangeable.

  

I've been taking my time to wrap my head around your comment. It makes
complete sense when thinking about the use of the object model.
However (if you can refer to the attached diagram showing one
association and one inheritance relationship) what I am trying to work
out is whether that applies as strongly one level up at the meta /
class description. 

If ConductingEquipment is a null-subclass then at the instance/model
level it could be completely interchanged with Equipment because the
association is inherited. However at the meta / class-description
level (ie storing the data to be able to redraw that diagram)
ConductingEquipment and Equipment seem not interchangable since no
direct line exists between ConductingEquipment to EquipmentContainer.

I'll continue to muse on that. Thanks for you reply.
cheers -ben


inline: aRelation.png___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: [squeak-dev] Another video tutorial

2012-01-31 Thread Ben Coman

Lawson English wrote:


Latest squeak tutorial. Connectors how-to:

http://www.youtube.com/watch?v=H1LveflchAU

as an aside, it seems to me that Connectors should be ported back to 
Pharo, because it can be very useful I am finding.


Lawson



There is http://www.squeaksource.com/MinimalConnectors.html
used by http://www.squeaksource.com/smallUML.html

I just happened to have found this yesterday.  The following worked for 
me in Pharo-1.3-13315...


Gofer it
   squeaksource: 'smallUML';
   package: 'ConfigurationOfSmallUML';
   load.
(Smalltalk at: #ConfigurationOfSmallUML) project latestVersion load.

DiagramDrawingDocumentation openDiagramBrowser




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Testing = and == in workspace

2012-01-07 Thread Ben Coman




Bert Freudenberg wrote:

  Am 07.01.2012 um 07:04 schrieb Ben Coman b...@openinworld.com:
  
  
I had thought that the two assignments of 'xxx' to (x) and (y) would result in different objects, but they turn out to be identical.  It is like the compiler has noticed that they are equal and chosen to make them identical.  

  
  
That is indeed what's happening. 

You can verify this by executing each line separately. 
  

Thanks Bert. Doing that is insightful. Interestingly the result is
different with numbers. Where strings assigned in separate executions
are not identical, numbers assigned in separate executions are
identical - at lower values. For example, number 12345678 has (x) and
(y) identical but with 123456789 they are not. I then expected those
number literals to be a different class, but both numbers inspect as
SmallIntegers. btw this is with Pharo-1.3-13315-cog2522. 

Anyway, my curiosity is satisfied for now.
cheers, Ben


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Testing = and == in workspace

2012-01-07 Thread Ben Coman




nicolas cellier wrote:

  Ben Coman btc at openInWorld.com writes:
  
  
  

Thanks Bert. Doing that is insightful.  Interestingly the result is
different with numbers.  Where strings assigned in separate executions
are not identical, numbers assigned in separate executions are
identical - at lower values.  For example, number 12345678 has (x) and
(y) identical but with 123456789 they are not.  I then expected those
number literals to be a different class, but both numbers inspect as
SmallIntegers.  btw this is with Pharo-1.3-13315-cog2522.  
Anyway, my curiosity is satisfied for now.
cheers, Ben


  
  
I was about to invite you to dig a bit deeper in the system in order to satisfy
your curiosity, but it's a bit harder than I imagined...

You could start your search with a method finder looking matches of *literal*
One should deserve your attention, EncoderencodeLiteral:
You will see it uses an inst. var. named litSet.
If you browse references to it, you'll see it is initialized with StdLiterals
class var. in Encoder#initScopeAndLiteralTables
You can inspect this class var and see it is a PluggableDictionary (not a set as
the litSet name did tell).
If you browse references to StdLiterals, it is indeed initialized in
VariableNode classinitialize with
StdLiterals := PluggableDictionary new equalBlock: [ :x :y | x literalEqual: y ].

So finally, we get it, the method of interest is #literalEqual:
If two literals are literally equal, then only one is created.
I encourage you to understand why 2, 2.0s1, 2.00s2 and 2.0 are not literally
equal, though they arithmetically are

Of course, why is Encoder a subclass of ParseNode (an Encoder is not a ParseNode
!), why a class variable used exclusively in Encoder is initialized in
VariableNode, would be very good questions. The implementers did choose
inheritance just to share a few class variables, and this is not a very clean
design.
Even the indirection #name:key:class:type:set: is rather arguable, it factors
code of two senders at the price of a complex interface (5 parameters is way too
much), and thus at the price of readability. 
But hey, why do you think some people started to write a NewCompiler ;)
Also, anti-patterns are also a very good way to learn how to (not) code, so in
its way these are good lessons for noobs.

Nicolas
  

Wow thank you for that detailed reply.  
I can see the ScaledDecimalliteralEqual add the requirement
"[self scale = other scale]"


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Testing = and == in workspace

2012-01-07 Thread Ben Coman

Levente Uzonyi wrote:

On Sat, 7 Jan 2012, Ben Coman wrote:


Bert Freudenberg wrote:

 Am 07.01.2012 um 07:04 schrieb Ben Coman b...@openinworld.com:


 I had thought that the two assignments of 'xxx' to (x) and (y) would 
result in different objects, but they turn out to be identical.  It 
is like the compiler has noticed that they are equal and chosen to 
make them identical.



 That is indeed what's happening.
You can verify this by executing each line separately.


Thanks Bert. Doing that is insightful.  Interestingly the result is 
different with numbers.  Where strings assigned in separate 
executions are not
identical, numbers assigned in separate executions are identical - at 
lower values.  For example, number 12345678 has (x) and (y) identical 
but with
123456789 they are not.  I then expected those number literals to be 
a different class, but both numbers inspect as SmallIntegers.  btw 
this is with


That's impossible, SmallIntegers with the same value are identical.


Levente


Pharo-1.3-13315-cog2522.
Anyway, my curiosity is satisfied for now.
cheers, Ben

I could have sworn I observed that behaviour last night, with the 
difference between the 8th and 9th digit, being SmallIntegers in both 
cases, but this morning I can't replicate it.  Now the difference is 
between the 9th and 10th digits, which makes more sense they become 
LargePositiveIntegers with the 10th digit.   I put it down to fatigue 
from being up too late. (though I would have sworn...)


As a final thing. For some naive reason I thought that the SmallIntegers 
would stop at 64k.  Is it platform dependent on whether the CPU is 
16/32/64 bit ?


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] class method #initializeClass vs. #initialize

2012-01-07 Thread Ben Coman
I have come across a class method initializeClass with a comment Do not 
rename to #initialize.

Is that a generic concern ?

This particular case is from BaseUnit  initializeClass from 
http://www.squeaksource.com/Units.html


cheers, Ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Testing = and == in workspace

2012-01-06 Thread Ben Coman
I was trying to confirm the operation of = and == in the workspace by 
executing the following code..


x :=  'xxx'.
y :=  'xxx'.
z := x.
(OrderedCollection new) add: (x = y) ; add: (x == y) ; add: (x=z); add: 
(x==z); yourself.


I was confused that I was getting anOrderedCollection(true true true true)

It was not until I changed to the following code...

x := String newFrom: 'xxx'.
y := String newFrom: 'xxx'.
z := x.
(OrderedCollection new) add: (x = y) ; add: (x == y) ; add: (x=z); add: 
(x==z); yourself.


that I got the expected anOrderedCollection(true false true true)

I was curious what was going on in the first case.

cheers, Ben
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Float variableWordSubclass

2012-01-05 Thread Ben Coman

Levente Uzonyi wrote:

On Wed, 4 Jan 2012, Ben Coman wrote:


When I define...
  Float subclass: MyPrefixFloat


I guess you meat Float subclass: #MyPrefixFloat .



why does it get changed to...
  Float variableWordSubclass: #MyPrefixFloat


Float is already a variableWordSubclass, so its subclasses must also 
be variableWordSubclasses, otherwise the indexable slots would be lost.




and is that just what the Epsilon symbol next to the class is?


What Epsilon symbol?


Epsilon - the letter of the Greek alphabet used in maths.
But doh!  I should have said summation symbol
http://en.wikipedia.org/wiki/Summation
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Enumeration type implementation

2012-01-04 Thread Ben Coman

(Resending since it didn't show up on the list overnight)

What is the best way to implement enumerations in Smalltalk. For 
instance, for a UML definition of...

enumeration Currency
 enum USD   'US dollar'
 enum EUR   'Eueropean euro'
 enum AUD'Australian dollar'

here is my guess, consisting of 2 instance side methods and 3 class side 
methods...

-
Object subclass: #EpcimCurrency
  instanceVariableNames: 'value'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'IEC61970-Domain-Enumerations'

EpcimCurrency  value: aCurrency
  ( (self class) validate: aCurrency) ifTrue:
  [ value := aCurrency
  ].

EpcimCurrency  value
  ^value
---

EpcimCurrency class
  instanceVariableNames: 'enums'

EpcimCurrency class  validate: aString
  enums ifNil: [ self initialize ].
  ^ enums includesKey: aString.

EpcimCurrency class   enums   for displaying in pulldown menus
  enums ifNil: [ self initialize ].
  ^enums copy

EpcimCurrency class  initalize
  (enums := Dictionary new)
  add: 'USD'- 'US dollar' ;
  add: 'EUR'- 'European euro' ;
  add: 'AUD'- 'Australian dollar' ;
  add: 'CAD'- 'Canadian dollar' ;
  add: 'CHF'- 'Swiss francs' ;
  add: 'CNY'- 'Chinese yuan renminbi' ;
  add: 'DKK'- 'Danish crown' ;
  add: 'GBP'- 'British pound' ;
  add: 'JPY'- 'Japanese yen' ;
  add: 'NOK'- 'Norwegian crown' ;
  add: 'RUR'- 'Russian ruble' ;
  add: 'SEK'- 'Swedish crown' ;
  add: 'INR'- 'India rupees' ;
  add: 'other'- 'Another type of currency' .
--
Examples
   (EpcimCurrency new value: 'AUD' ) value inspect 'AUD'
   (EpcimCurrency new value: 'XXX') value  inspect nil
   EpcimCurrency initialize  
   EpcimCurrency enums inspect--- aDictionary
--
The other way I thought might be like `Color blue`, but I'm not sure what is 
gained.

Your feedback would be appreciated.


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Enumeration type implementation

2012-01-04 Thread Ben Coman
What is the best way to implement enumerations in Smalltalk. For 
instance, for a UML definition of...

enumeration Currency
  enum USD   'US dollar'
  enum EUR   'Eueropean euro'
  enum AUD'Australian dollar'

here is my guess, consisting of 2 instance side methods and 3 class side 
methods...

-
Object subclass: #EpcimCurrency
   instanceVariableNames: 'value'
   classVariableNames: ''
   poolDictionaries: ''
   category: 'IEC61970-Domain-Enumerations'

EpcimCurrency  value: aCurrency
   ( (self class) validate: aCurrency) ifTrue:
   [ value := aCurrency
   ].

EpcimCurrency  value
   ^value
---

EpcimCurrency class
   instanceVariableNames: 'enums'

EpcimCurrency class  validate: aString
   enums ifNil: [ self initialize ].
   ^ enums includesKey: aString.

EpcimCurrency class   enums   for displaying in pulldown menus
   enums ifNil: [ self initialize ].
   ^enums copy

EpcimCurrency class  initalize
   (enums := Dictionary new)
   add: 'USD'- 'US dollar' ;
   add: 'EUR'- 'European euro' ;
   add: 'AUD'- 'Australian dollar' ;
   add: 'CAD'- 'Canadian dollar' ;
   add: 'CHF'- 'Swiss francs' ;
   add: 'CNY'- 'Chinese yuan renminbi' ;
   add: 'DKK'- 'Danish crown' ;
   add: 'GBP'- 'British pound' ;
   add: 'JPY'- 'Japanese yen' ;
   add: 'NOK'- 'Norwegian crown' ;
   add: 'RUR'- 'Russian ruble' ;
   add: 'SEK'- 'Swedish crown' ;
   add: 'INR'- 'India rupees' ;
   add: 'other'- 'Another type of currency' .
--
(EpcimCurrency new value: 'AUD' ) value inspect 'AUD'
(EpcimCurrency new value: 'XXX') value  inspect nil
EpcimCurrency initialize  
EpcimCurrency enums inspect--- aDictionary

Any suggestions
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners