[Newbies] remove allInstances?

2016-09-23 Thread Louis LaBrunda
Hi,

Tobias is right.  I'm use to the VA Smalltalk one way #become: and forgot about 
Squeaks two way
#become:, sorry about that.

Lou

On Fri, 23 Sep 2016 19:47:31 +0200, Tobias Pape  wrote:

>Hi,
>
>On 23.09.2016, at 15:03, Louis LaBrunda  wrote:
>
>> Hi Joseph,
>> 
>> Try:
>> 
>> Books allInstances do: [:b | b become: nil].
>
>I would advise against that. Become is a sledgehammer and you're about to 
>crush ants with it.
>
>What happens with 'a become: b' ? All occurrences of 'a' in the image are 
>replaced by 'b' and (this is important) vice versa.
>So, all 'b's are replaces by 'a'.
>
>With your example, all occurrences of nil are replaced with an instance of 
>Book, in the whole image. This is most probably _not_ what you want.
>
>These two versions work better:
>
>Books allInstances do: [:b | b becomeForward: nil].
>Books allInstances do: [:b | b become: Object new].
>
>The first avoids the 'vice versa' part of become: and is more safe, the second 
>one
>does the switcharoo with a new object every time, wich is also more safe.
>
>Anyhow, I presume that your intent is to track down instances of Book wich you 
>don't know where they are.
>
>Maybe they are actually unreferenced already, so
>   Smalltalk garbageCollect
>can get already rid of them. 
>
>If that does not help, you can try to track the references down by doing
>
>   Books allInstances do: [:b | b chasePointers]
>
>which will open a PointerFinder for each of the rouge object so you can 
>inspect where they get referenced.
>
>I hope this helps.
>
>Best regards
>   -Tobias
>
>
>> 
>> Lou
>> 
>> On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta  
>> wrote:
>> 
>>> Greetings,
>>> 
>>> The main program I am working on now is called Books.
>>> 
>>> If I evaluate
>>> 
>>> Books allInstances => anOrderedCollection( aBook aBook aBook )
>>> 
>>> How do I set them all equal to nil like
>>> 
>>> Books removeAllInstances.
>>> 
>>> Books allInstances => anOrderedCollection().
>>> 
>>> 
>>> Sincerely,
>>> 
>>> Joseph.
>> -- 
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>> 
>> ___
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

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


[Newbies] remove allInstances?

2016-09-23 Thread Louis LaBrunda
Hi Joseph,

Try:

Books allInstances do: [:b | b become: nil].

Lou

On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta  
wrote:

>Greetings,
>
>The main program I am working on now is called Books.
>
>If I evaluate
>
>Books allInstances => anOrderedCollection( aBook aBook aBook )
>
>How do I set them all equal to nil like
>
>Books removeAllInstances.
>
>Books allInstances => anOrderedCollection().
>
>
>Sincerely,
>
>Joseph.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

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


[Newbies] indexing into a collection

2016-07-27 Thread Louis LaBrunda
Hi Joe & Ben,

Ben's example is a good one.  If there will be only one instance of DrivingDays 
in the
collection for a given date then you should look at Dictionary and LookupTable. 
 You could then
add items to the collection with:

collection at: aDrivingDays date put: aDrivingDays.

and then use:

item := collection at: aDate.

to fetch the instance you want.

Lou


On Wed, 27 Jul 2016 15:51:44 +0800, Ben Coman  wrote:

>On Wed, Jul 27, 2016 at 8:13 AM, Joseph Alotta  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.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

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


[Newbies] next or break in a loop

2016-05-10 Thread Louis LaBrunda
Joe,

At each test for the type of data you can also test to see if you found type, 
something like
this:

stream := ReadStream on: myCollection.
[stream atEnd] whileFalse: [:item | | notFound |
item := stream next.
notFound := true.
(notFound and: [your column test1]) ifTrue: [notFound := false. 
stream upToEnd].
(notFound and: [your column test2]) ifTrue: [notFound := false. 
stream upToEnd].
(notFound and: [your column test3]) ifTrue: [notFound := false. 
stream upToEnd].
].

Not pretty but it should work.  You should also look into the #caseOf: method 
Bert suggested. I
have my own Case class in VA Smalltalk that I expect is similar but I'm not 
familiar with
#caseOf:, so you should look it up.  I expect it will make the code a little 
cleaner.

Lou

On Tue, 10 May 2016 08:57:03 -0700 (PDT), Joseph Alotta 
 wrote:

>Lou,
>
>I was trying to use the ReadStream, but the issue is to get execution to go 
>back to the top.  If I send the upToEnd message, it still executes from the 
>same line and goes through the rest of the tests.
>
>
>Sincerely,
>
>Joe.
>
>
>
>> On May 9, 2016, at 3:56 PM, Louis LaBrunda [via Smalltalk] 
>>  wrote:
>> 
>> Hi Joe, 
>> 
>> You can map your collection to a stream and then use the stream methods to 
>> traverse the 
>> collection. 
>> 
>> stream := ReadStream on: myCollection. 
>> [stream atEnd] whileFalse: [:item | 
>> item := stream next. 
>> "I'm not sure upToEnd is the right method here but it is close.  Look 
>> around, I'm sure you will 
>> find what you need." 
>> item doSomeWork. 
>> (when you think you are done with item) ifTrue: [stream 
>> upToEnd]. 
>> ]. 
>> 
>> Lou 
>> 
>> On Mon, 9 May 2016 16:00:58 -0500, Joseph Alotta <[hidden email]> wrote: 
>> 
>> >I don?t think any of the solutions work for my case. 
>> > 
>> >I want to evaluate several different variable for each step, make 
>> >calculations and if all of the conditions are met, then skip to the next 
>> >item, otherwise, do the next step of calculations. 
>> > 
>> >The project is reading comma deliminated bank or credit card files, taking 
>> >a column of data, counting various characters, and trying to determine what 
>> >kind of data it is.  For example, a column of data with two slash 
>> >characters and eight digits per line is likely to be a date field.  A 
>> >column of data with more than 3 letter characters and a percentage of 
>> >digits and a percentage of hash signs is likely to be a payee field.  A 
>> >column of data with no spaces, no digits, no special characters is likely 
>> >to be a type of transaction field.  A column of data with one period per 
>> >item, and only digits or a minus sign is  likely to be a amount field, and 
>> >a column of data with a high percentage of zero length items and the rest 
>> >having C or K and a pound sign and four or more digits is likely to be a 
>> >check number field. 
>> > 
>> >I am doing a lot of tests for each field and I don?t think the switch is a 
>> >good fit. 
>> > 
>> >Sincerely, 
>> > 
>> >Joe.
>> -- 
>> Louis LaBrunda 
>> Keystone Software Corp. 
>> SkypeMe callto://PhotonDemon 
>> 
>> ___ 
>> Beginners mailing list 
>> [hidden email] 
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>> 
>> 
>> If you reply to this email, your message will be added to the discussion 
>> below:
>> http://forum.world.st/next-or-break-in-a-loop-tp4894095p4894128.html
>> To start a new topic under Squeak - Beginners, email 
>> ml-node+s1294792n107673...@n4.nabble.com 
>> To unsubscribe from Squeak - Beginners, click here.
>> NAML
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

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


[Newbies] next or break in a loop

2016-05-09 Thread Louis LaBrunda
Hi Joe,

You can map your collection to a stream and then use the stream methods to 
traverse the
collection.

stream := ReadStream on: myCollection.
[stream atEnd] whileFalse: [:item |
item := stream next.
"I'm not sure upToEnd is the right method here but it is close.  Look around, 
I'm sure you will
find what you need."
item doSomeWork.
(when you think you are done with item) ifTrue: [stream 
upToEnd].
].

Lou

On Mon, 9 May 2016 16:00:58 -0500, Joseph Alotta  
wrote:

>I don’t think any of the solutions work for my case.
>
>I want to evaluate several different variable for each step, make calculations 
>and if all of the conditions are met, then skip to the next item, otherwise, 
>do the next step of calculations.
>
>The project is reading comma deliminated bank or credit card files, taking a 
>column of data, counting various characters, and trying to determine what kind 
>of data it is.  For example, a column of data with two slash characters and 
>eight digits per line is likely to be a date field.  A column of data with 
>more than 3 letter characters and a percentage of digits and a percentage of 
>hash signs is likely to be a payee field.  A column of data with no spaces, no 
>digits, no special characters is likely to be a type of transaction field.  A 
>column of data with one period per item, and only digits or a minus sign is  
>likely to be a amount field, and a column of data with a high percentage of 
>zero length items and the rest having C or K and a pound sign and four or more 
>digits is likely to be a check number field.
>
>I am doing a lot of tests for each field and I don’t think the switch is a 
>good fit. 
>
>Sincerely,
>
>Joe.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

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


[Newbies] conceptual design help

2016-04-28 Thread Louis LaBrunda
Hi Joe,

I agree with Kirt's suggestions in general.  See more below.

On Thu, 28 Apr 2016 17:15:05 -0500, Joseph Alotta  
wrote:

>Greetings,
>I am writing a program to consolidate all my personal finances for tax time 
>next year.  (This is not a school project.)
>There are transaction files from several banks and credit card companies.  
>Each has a similar format, CSV, but they vary in many ways, order of items, 
>extra notes, pipe delimited or tabs, etc.  I want to read them and load them 
>into a collection of transaction objects.

>1.  Should I have a FileReader object?
>2.  Should it have subclasses like FileReaderAmericanExpress, 
>FileReaderJPMorgan ?

No.  I would with the object you want to hold the information and work out from 
there.  An
object or your main program object should read the files and instantiate the 
objects (same
class) that gets the data.

>3.  Or should it have different methods like loadAmericanExpresFile, 
>loadJPMorganFile ?

Yes.  Use different methods to read and parse the files and instantiate the 
objects.  Depending
upon how close (similar) the files are you could have a method with a few 
parameters (three or
four at most) that handles more than one file.

>4.  Is a Collection of Transaction objects, the structure that you would load 
>the files into?

Yes.  An ordered or sorted collection would be good so you could sort by 
date/time if that is
helpful.

>The rest of the project would be to do data checking on the files, to make 
>sure there are no duplicates or missing dates.  Then write reports that I can 
>give to my accountant.

Sounds good.

>I would appreciate some design help?
>Sincerely,
>Joe.

Lou
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

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


[Newbies] go to the end of a loop

2016-04-25 Thread Louis LaBrunda
Hi Joe,

Better than checking for #nextLine answering nil, I think you can send the file 
stream #atEnd
to see if there is any more data.  You would then use a #whileFalse: and move 
the #nextLine
call into the second block of the whileFalse:.  Then test for empty lines with 
something like:
(line size < 2) ifFalse: [...putting all the code that does the work on a line 
with data in
here...].

Lou

PS.   If this is not a school project, we can be of more help, we just don't 
like doing
students projects for them as they learn more with just a few hints and not 
real code.

On Mon, 25 Apr 2016 10:16:33 -0500, Joseph Alotta  
wrote:

>Greetings,
>
>I have this code:
>
>**
>
>read
>   "read the category file into the dictionary
>   the first item is the category, the rest of the line are payees
>   
>   office expense|home depot|staples|costco
>   groceries|natures best|jewel|trader joes|fresh thyme
>   "
>
>| f line |
>f := FileStream oldFileNamed: myfile.
>
>[(line := f nextLine) notNil] whileTrue: [| array cat payees |
>   
>  array := line  findTokens: $| escapedBy:  Character 
> tab .
>
>   cat := array first.
>   payees := array reject: [ :i | i = cat 
> ].   "rest of the line"
>   
>   payees do:  [ :p |   mydict at: (p 
> withBlanksCondensed) put: (cat withBlanksCondensed)].
>  ].
>
>
>f close.
>
>*
>
>I am getting some blank lines in the data file.  Lines with just a Character 
>cr.  I was wondering how to handle that.  In other languages, there is a break 
>for the loop, to go to the end.  I can do:
>
>(line size < 2) ifTrue: [ f nextLine.].
>
>But that would interfere with the notNil idiom at the end of the file.  So 
>where do I put this.  Is there a common way to jump to the end?
>
>
>Sincerely,
>
>
>Joe.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

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


[Newbies] How to round a float?

2015-02-18 Thread Louis LaBrunda
Hi Bert,

>> That's why I thought there was a problem with #roundTo: but maybe #roundTo:
>> has some other intent that I'm not aware of?
>
>It's used for snapping values to a grid. E.g. in ScrollBar>>setValue:.
>- Bert -

Ahh, Thanks Bert.  So it isn't exactly the same as displaying the numbers
but close.  And in that case I guess a value like 162.890001 is
good enough and there wouldn't be any growing error as each snap brings the
value back where you want it.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] How to round a float?

2015-02-16 Thread Louis LaBrunda
Hi Nicolas,

>Lou, I'm very suspicious about what VA does.
>IMO you should not trust too much what you see (what it prints!)

I think I agree with everything you say.  I assumed (I know that might get
me in trouble) that Chuck was rounding to print or display the value.
Personally I don't see any reason to round floats (or almost anything else)
except to display them in a simpler form.  Given that, 162.89 looks better
than 162.890001 and is probably what Chuck was looking for.

That's why I thought there was a problem with #roundTo: but maybe #roundTo:
has some other intent that I'm not aware of?

Lou
-------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] How to doubble sort a collection - DynamicSortBlock.st (1/1)

2015-02-04 Thread Louis LaBrunda

begin 644 DynamicSortBlock.st
M#0I/8FIE8W0@6YA;6EC4V]R=$)L;V-K#0H@("`@8VQA
M
M*'-E;&8@;F5W*2!A8V-E2!I6UB;VQS*2!U6UB;VP@
M:6X@86-C97-S;W)S+"!T6UB;VP-"@DB268@86X@87-S;V-I871I;VXL(&%D9"!T
M:&4@86-C97-S;W(@86YD(&1I6UB;VP@:7-3>6UB;VP@:694
M6UB;VP@=F%L=64N#0H)72X-"B$-"@T*861D06-C97-S;W(Z(&%3
M>6UB;VP@86YD1&ER96-T:6]N.B!A0F]O;&5A;D]R4W1R:6YG#0H)(D%D9"!T
M:&4@86-C97-S;W(@86YD(&ET6UB;VP-"@DB061D('1H
M92!A8V-E6UB;VPN#0H)"!C;&%S9&ER96-T:6]N6UB;VP@:6X@86-C
M97-S;W)S+"!T71H:6YG#0H);W1H97(@
M=&AA;B!TF4@;V8@86-C97-S;W)S+B(-"@DB4V5E("-D:7)E8W1I
M;VYS(&%N9"`C=F%L=64Z=F%L=64Z(@T*"7P@<&%I2X-"@EA9&1#;G0@.CT@'10=71!;&PZ(&%C8V5S3H@86-C
M97-S;W(@=F%L=64Z(&1I2!T:&4@86-C97-S;W)S(&%R92!T9&ER96-T:6]N72X-"@D)"79A;'5E0B!I9&ER96-T:6]N(&YO=%TN#0H)"0DH=F%L=65!(#P@=F%L=65"*2!I
M9E1R=64Z(%M>9&ER96-T:6]N72X-"@D)"2AV86QU94$@/B!V86QU94(I(&EF
M5')U93H@6UYD:7)E8W1I;VX@;F]T72X-"@D)72X-"@E=+@T*"5YThttp://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection

2015-02-04 Thread Louis LaBrunda
Hi Raymond,

Try:

^notes sorted:[:a :b | (a date  > b date) | ((a date = b date) & (a date
temps > b date temps))].

Lou

On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin 
wrote:

>I have this kind of sorting on anOrderedCollection
>
>BlocNotes >>sortedNotes
>   ^notes sorted:[:a :b | a date  > b date]
>
>This sort my notes on date but I want them sort by date AND inside a date by 
>hours and I don't khow how to do this.
>
>Some insights?
>
>aNote = 'med com date temps' instancesVariables what I call hours = temps 
>witch is a number like 2123 for 21h23
>
>Some insights?
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] How to doubble sort a collection - DynamicSortBlock.st (0/1)

2015-02-04 Thread Louis LaBrunda
On Wed, 4 Feb 2015 09:00:13 -0800 (PST), Paul DeBruicker
 wrote:

>Does using the | or & notation have any advantages over and: or or:  or
>ifTrue:ifFalse ?

and: and or: are needed when you don't want to execute the code inside the
block unless it is needed.  They are also used to protect from executing
code that shouldn't be run for example:

x notNil and: [x foo > y foo]

>I always write expressions like the one you've written like:

>a date = b date 
>   ifTrue:[a temps > b temps] 
>   ifFalse:[a date > b date]

I like this but it may be a little tricky for a beginner.  But both or
replay help one to learn.

I have also attached a file out (from VA Smalltalk) of a class that acts
like a sort block but is much easier to use for complex sorts.

Lou

>Louis LaBrunda wrote
>> Hi Raymond,
>> 
>> Try:
>> 
>> ^notes sorted:[:a :b | (a date  > b date) | ((a date = b date) & (a date
>> temps > b date temps))].
>> 
>> Lou
>> 
>> On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin <
>
>> jgr.asselin@
>
>> >
>> wrote:
>> 
>>>I have this kind of sorting on anOrderedCollection
>>>
>>>BlocNotes >>sortedNotes
>>> ^notes sorted:[:a :b | a date  > b date]
>>>
>>>This sort my notes on date but I want them sort by date AND inside a date
>by hours and I don't khow how to do this.
>>>
>>>Some insights?
>>>
>>>aNote = 'med com date temps' instancesVariables what I call hours = temps
>witch is a number like 2123 for 21h23
>>>
>>>Some insights?
>> ---
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>> mailto:
>
>> Lou@
>
>>  http://www.Keystone-Software.com
>> 
>> ___
>> Beginners mailing list
>
>> Beginners@.squeakfoundation
>
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] How to round a float?

2015-02-04 Thread Louis LaBrunda
Hi Guys,

On Wed, 4 Feb 2015 08:22:02 -0500, Johann Hibschman 
wrote:

>That just looks like floating-point representation. It's as rounded as it
>can get!
>-Johann

At first I thought some more parans "(" were needed but that didn't change
anything.  No this sounds like a bug to me (ar at least something that can
be improved) as VA Smalltalk prints 162.89, so somehow they are able to
make the floats do the right thing.

Lou


>
>On Wed, Feb 4, 2015 at 6:22 AM, Chuck Hipschman 
>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 :-)
>>
>> MacBook Pro (Retina, 15-inch, Early 2013)  System Version: OS X 10.10.2
>> (14C109)
>>
>> Image
>> -
>>
>> /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image
>> Squeak4.5
>> latest update: #13680
>> Current Change Set: Unnamed1
>> Image format 6505 (32 bit)
>>
>> Virtual Machine
>> ---
>>
>> /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/MacOS/Squeak
>> Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331] 4.5
>> Mac OS X built on Aug 22 2013 10:08:05 Compiler: 4.2.1 (Apple Inc. build
>> 5666) (dot 3)
>> platform sources revision VM: r2776
>> http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545
>> http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
>> CoInterpreter VMMaker.oscog-eem.331 uuid:
>> 37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013
>> StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid:
>> 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013
>>
>> On Wed, Feb 4, 2015 at 2:59 AM, Ben Coman  wrote:
>>
>>> 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 
>>> 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
>>>
>>>
>>
>> ___
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Is Squeak/Pharo an appropriate language choice?

2013-11-01 Thread Louis LaBrunda
Hi Charles,

I don't know enough about Magma to answer your questions.  I'm really a VA
Smalltalk guy and only play a little with Squeak.  I knew just enough about
Magma to point you to it.  I'm sure there are a lot of Squeakers that know
about Magma and can probably answer your questions but they are probably
not reading this list.  Try re-posting on:
gmane.comp.lang.smalltalk.squeak.general.  There may also be a Magma
specific list but I'm not sure about that.

Before you decide you need a database for sure maybe you could experiment
with creating a lot of data in your image and see how long it takes to
load/save.  If it isn't too long then the OS paging out pieces and then
back when needed might not be too bad?

Also, if you are going to use a database maybe you could use a hash (big)
for the id's?

Lou

On Thu, 31 Oct 2013 14:53:03 -0700, Charles Hixson
 wrote:

>On 10/31/2013 01:28 PM, Louis LaBrunda wrote:
>> Hi Charles,
>>
>>> If I'm going to need to use a database, and handle my own rolling in and
>>> out anyway, then Smalltalk isn't a good choice.  And while multiple
>>> processing is only a speed-up thing, that's a pretty important thing in
>>> and of itself.
>> I think you may need an OODB, you should take a look at Magma
>> http://wiki.squeak.org/squeak/2665.  You may not need to do as much rolling
>> in and out on your own as you think.
>>
>> Lou
>> ---
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>> mailto:l...@keystone-software.com http://www.Keystone-Software.com
>Short answer:
>Probably not sufficient.
>
>Long answer (excuse the rambling, I was thinking it through as I wrote it):
>If I'm understanding http://wiki.squeak.org/squeak/2639 correctly, which 
>I may not be, I'd still need to recode the entire graph structure to be 
>designed in terms of id#s (keys) rather than direct references.
>I.e., I'd need to code it in terms of two collections one of which would 
>contain keys that, when interpreted, referenced itself.  This does 
>appear to move the plan into the area of the possible, but at the cost 
>of the advantage that I'd hoped Smalltalk would provide of a large 
>persistent image.  I thought at first when it was talking about 
>transparency that this wouldn't be necessary, but:
>
>> Magma *can* maintain and quickly "search" large, flat structures, but 
>> the normal Smalltalk collections such as Bag or OrderedCollection are 
>> not suitable for this. The contiguous ByteArray records Magma uses to 
>> store and transport Smalltalk objects would be impractical for a large 
>> Smalltalk Collection
>Seems to mean that the Graph couldn't be stored as something that Magma 
>would recognize as a graph.  So does "Objects are persisted by 
>reachability", though that has other possible interpretations.  But 
>since the graph would contain a very large number of cycles in multiple 
>"dimensions"...  OTOH http://wiki.squeak.org/squeak/2638 on Read 
>Strategies appears to mean that it wouldn't automatically (or rather 
>could be set to not automatically) pull in items that are references 
>within the object being read.
>
>Again, http://wiki.squeak.org/squeak/5722 , may mean that a class with 
>named variables holding 4 arrays of arrays of length 3 (reference float 
>float) and a few other variables containing things like bools and 
>strings and ints, would be handled without problem. But note that each 
>of those references is to an item of the same type, and it could include 
>cycles.  So I can't decide WHAT it means.  Do I need to recode the 
>references as id#s? Does that even suffice?  (If it does, then it's 
>still a good deal.  But if I must name each entry separately, it's not a 
>good deal at all, as the number of entries in each of the 4 outer level 
>arrays is highly variable, and though I intend to apply an upper limit, 
>only experiment can determine what a reasonable upper limit is.)
>
>And yet again (if I'm understanding correctly) I'm going to need to 
>violate just about every one of the hints on performance in 
>http://wiki.squeak.org/squeak/2985 .  I'm not sure how much MagmaArray 
>keeps in RAM of things that aren't currently in use.  At one point it 
>sounded like 6 bytes.  This is actually a lot of overhead in this kind 
>of a system.
>
>Additionally, it appears that Magma doesn't have anyway to detect that a 
>reference is "stale" (i.e., hasn't been referenced in a long time), an 
>use that to decide to roll it out.  It looks as if this needs to be 

[Newbies] Is Squeak/Pharo an appropriate language choice?

2013-10-31 Thread Louis LaBrunda
Hi Charles,

>If I'm going to need to use a database, and handle my own rolling in and 
>out anyway, then Smalltalk isn't a good choice.  And while multiple 
>processing is only a speed-up thing, that's a pretty important thing in 
>and of itself.

I think you may need an OODB, you should take a look at Magma
http://wiki.squeak.org/squeak/2665.  You may not need to do as much rolling
in and out on your own as you think.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Is Squeak/Pharo an appropriate language choice?

2013-10-31 Thread Louis LaBrunda
Hi Charles,

You may want to cross post this on the main Squeak news group:
gmane.comp.lang.smalltalk.squeak.general where there are people that are
interested in non-beginner questions.

I don't have enough experience with Squeak/Pharo to give you an answer but
I'm interested in hearing the answer and in what your project is.

Lou


On Thu, 31 Oct 2013 10:51:49 -0700, Charles Hixson
 wrote:

>I'm contemplating a project that would benefit greatly by a persistent 
>memory image, though I'll eventually (in a year or so) need the 64-bit 
>image, but:
>The image will be a lot larger than RAM.  It would include a directed 
>graph that had an index of a million or so entries, and most nodes 
>wouldn't be indexed.  So in order to even load it would need to use some 
>sort of lazy access.  And I'm not even sure that a Dictionary of over a 
>million items is reasonable.  (Naturally none of the examples address 
>this problem.)
>
>Additionally, all of my (written) documentation is so old that it 
>doesn't even discuss multi-processor systems, so I don't know whether 
>modern Smalltalks make any use of additional available processors.
>
>I'd really like some advice, and possibly some references.  I know that 
>Smalltalk has the reputation for being slow (yes, I've been reading 
>about the recent speed-ups), but much of what I'd need to write in any 
>other language seems like it may already be present in Smalltalk, so if 
>it would work, I'd like to choose it.  But I won't be able to test this 
>until the application has been running for quite awhile, so I would be 
>very desirable that I know ahead of time.
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Modify block (closure) parameters

2013-08-06 Thread Louis LaBrunda
Hi Guys,

FWIW, VA Smalltalk doesn't allow changing block arguments.

Lou

On Tue, 6 Aug 2013 13:42:33 -0700, Casey Ransberger
 wrote:

>I didn't read your post clearly enough. Yep, that would seem odd. You may
>have a bug there. I'm not sure why that happens. It looks like the outer
>context isn't taking the assignment, but hanging onto the initial value it
>receives from #value:.
>
>I'm not totally sure we should expect to be able to do what you're trying
>to do in modern Squeak. I haven't assigned to a block arg in a long time (I
>keep allow block assignments off unless I'm loading old code.) I don't know
>what the status is there. I run a relatively recent Cog VM on a 10.7.5 Mac
>and I'm seeing the same behavior in Squeak 4.4.
>
>When I switch to an old VM (3.8.18Beta3U) and run Squeak 3.0, your snippet
>works as expected. I'm not sure if this is in the image or the VM yet, or
>whether it's expected behavior or not with allowBlockArgumentAssignment
>(Again, I usually turn it off.)
>
>The main take away here is, don't do that:) as it's a back-compat feature
>and it really ought to have a big sign on it that says DEPRECATED. If
>you're trying to load some older code and running into this, it might be
>better to actually rewrite it not to assign to block arguments in my
>opinion (and maybe I'm nuts.)
>
>Can you tell me what VM you're using?
>
>Smalltalk vmVersion "this will tell us"
>
>And also which version of Squeak?
>
>SmalltalkImage current systemInformationString "ditto"
>
>Also, what's the OS of the host system?
>
>
>
>On Mon, Aug 5, 2013 at 1:44 AM, psea  wrote:
>
>> Hi Smalltalkers!
>>
>> Here is a question I can't find answer with google.
>> In short: Does block parameters and block local variables are the same
>> thing
>> (semantically) inside closure? It looks like it's not. Below the
>> explanation.
>>
>> ===
>> Here is the accumulator function (first attempt):
>>
>> makeAcc := [ :acc |
>> [:n | acc:=acc+n. acc]]
>>
>> It turns out it doesn't work as intended:
>>
>> a1 := makeAcc value: 10
>> a1 value: 1 => 11
>> a1 value: 1 => 11
>> a1 value: 2 => 12
>>
>> 
>> Here is the second attempt:
>>
>> makeAcc := [ :acc |
>> | total |
>> total:=acc.
>> [:n | total:=total+n. total]]
>>
>> And it does work as intended:
>>
>> a1 := makeAcc value: 10
>> a1 value: 1 => 11
>> a1 value: 1 => 12
>> a1 value: 2 => 14
>>
>> So if we use the local variable to store accumulator it works as it should
>> and remembers the value between function (block) calls. But if we use block
>> parameter to store the value of accumulator it does not remembers the value
>> between calls.
>> Why is it so?
>>
>> P.S. Sorry for my English. I do all my best.
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Modify-block-closure-parameters-tp4702118.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
>>
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Pool Variables

2013-07-02 Thread Louis LaBrunda
Hi Joseph,

>On Tuesday 02 July 2013 08:46 AM, Joseph J Alotta wrote:
>> Just curious, can someone give me an real life example of when you would 
>> need to use pool variables and no other variable would work?
>
>Generally information from external world are made available through 
>pool variables since they are broadly consumed by many classes. Examples 
>are
>  * Physical or Math constants like pi, e, ...
>  * Conventional names for weeks, months, colors, directions, playing 
>cards, chess pieces.
>  * Elements of binary file headers
>  * Character and Font tables
>  * Sensor events coming from hardware devices (like button codes)
>
>Explore
>
>SharedPool subclasses
>
>to see real-life usage in method source codes.
>HTH .. Subbu

I agree with Subbu.  If you take a look at my contribution:
http://ss3.gemstone.com/ss/minecraft.html/Overview?_s=pxWnk5AQYKMk4B4B&_k=EP_TzpOiAQnnFmJw

to Bert's Minecraft bindings you will see how I use them to make the calls
to Minecraft read better and make it so you don't have to remember what
number (value) goes with what Minecraft color or texture.

I have also recently used one in some of my VA Smalltalk GUI programs to
hold an object with some help information, like where the user was in
various layers of windows and panes within windows.  I could have passed
this object into each window but it is a lot of work just to avoid using
what amounts to a global variable.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] I need an idea. I know you have some. Give.

2013-03-08 Thread Louis LaBrunda
Hi Casey,

Here are a couple RasPi ideas, maybe we can make some money off of building
them/selling the hardware/selling pre configured memory cards.

Make a RasPi based file server with an external USB hard drive.

Make a RasPi jukebox.  Music can be saved on a large memory card or an
external USB hard drive.  I'm not sure how good the sound capabilities are
on the RasPi so that could be a problem.

Build a home security system based upon the RasPi.

Build a small all-in-one computer (maybe for the kitchen) by attaching the
RasPi to a small display.  Would have to come up with how to have/not have
a keyboard.

Lou

>Hello Squeakers!
>
>My job search is turning up dead ends, hurry up and wait, and unfathomably 
>boring prospects. 
>
>Screw all that! I want to do something cool. 
>
>I'm thinking about doing a KickStarter, but almost all of my ideas are either 
>a) stuff no one else wants which only I could possibly think would be cool, or 
>b) overly ambitious. The words Andreas used to describe my last idea: "a bit 
>grandiose." Gift for understatement at times. 
>
>So I'm looking for something which could be completed by one or two geeks in 
>six months to a year, which people actually want, to be implemented (at least 
>in part) using Squeak, and to be released at the end under the MIT license. 
>
>I've floored my expenses, so I can make my own labor (relatively, for a guy 
>living in Seattle) very cheap. By floored, I mean the room I sleep in isn't 
>even tall enough to stand up in -- I do not presently meet the definition of a 
>free-range chicken -- and I've disconnected my cellular service. I want to be 
>an efficient engine for getting things that matter to me and other people 
>done, rather than go on being some tool used to ship lucrative enterprise 
>crapware. 
>
>So here's the $x question: what do you want me to do? I have a Raspberry Pi on 
>order, so bonus points if you can work that in somehow.
>
>The person with the best (realistic) idea will be credited for it. 
>
>Inspire me! And thanks for reading all the way down to the bottom of this 
>message. 
>
>Casey
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: perform withArguments

2012-04-24 Thread Louis LaBrunda
Hi Dawson,

>Snip...
>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?)

Well everything is an object in Smalltalk.  If you really had to you could
probably get to the pointer that is in the instance variable.  We should
stop talking about it as a pointer.  The only thing that cares it is a
pointer is the Smalltalk/Squeak VM (virtual machine - usually a C program).
The VM uses the pointer in the variable to find the data that is the
object.  It is much better to just think of the instance variables as the
objects as long as we remember that more than one instance variable can
address/access/point to the same object.

Spoiler alert:

I have written a Sudoku program and used many arrays to map the same cells
to make it easier to check the values of the cells.  One set of arrays
would map the nine columns of cells.  Another set of arrays maps the nine
rows of cells.  And another set to map the cells in a 3x3 block.  Each cell
is in more than one of the arrays.  And the might themselves be in arrays.

Lou
-------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: perform withArguments

2012-04-24 Thread Louis LaBrunda
Hi Dawson,

>Hi Louis,
>Thanks, your advice looks very good here we hadn't even thought about
>ordered collections (we studied the "Squeak by example book" before we
>started our project, but sometimes it's hard to figure out when exactly
>you might need to use stuff you read about, even if you do the examples)

Your welcome.  Please don't feel bad about asking what seems like dumb
questions, there really aren't any.  Also, it is often hard to know which
programming construct best fits your needs, that takes experience.

>.. I had thought there might be a way of "building up" the "cellObject
>cellLock: aBoolean" ... judging from the replies, it seems that it is
>either a) crazy, b) it can't be done, c) no one knows how to do it.

I don't know if I would say it is crazy but some might.  Mostly I use VA
Smalltalk, it is designed more for business use that Squeak is (that's not
a knock on Squeak, it's just the way it is).  In VA Smalltalk the compiler
is not included with the packaged images.  In Squeak, you always live in
the image with the compiler.  I expect there is a way to build up a string
that might look like this: "cell1 cellLock: true" and then send it to the
compiler and then execute the compiled code returned by the compiler.  I
bet Bert and many other in the group know how to do this.  But once you
play with collections, you will see it is not needed.

>I think we'll give your suggestion a go when we get a few minutes.
>(ah .. the we is my son and I).
>Thanks,
>Dawson

Sounds like a great father/son project.  I have done some with my boys but
wish I could do more, so I envy you both.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: Re: perform withArguments

2012-04-24 Thread Louis LaBrunda
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.
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
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.

There would not be two copies of cell1, there would just be two pointers to
it.  Any messages sent to cell10 would effect cell1.  This can be
confusing, so I'm not recommending doing it exactly.  But putting the nine
cells in a collection is a good idea because it gives you another way to
get to the cells without using the original variables they were created in.

You ask about everything being an object is Smalltalk.  Yes everything is
an object.  You also ask if there is a way to construct the message with
the original variable names.  I don't know how to do it and don't think you
can with many Smalltalks.  Bert may know how to do it with Squeak.  Even if
Bert knows how, I wouldn't recommend it and I hope I'm not speaking out of
turn but I doubt Bert would recommend it either.  If it is doable, it's use
would be unusual and therefor confusing.  Even #perform: is seldom used by
most programmers and even less so by beginners.

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.

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.

Lou

>Hi,
>actually, that is not quite what we want to do (we meaning my son and I
>in our first squeak project).
>
>Since we were unable to assemble the message, we ended up doing a
>brute force method to get it to work:
>
>lockCell: aBoolean row: aRow column: aColumn
>
>   self addressToCellNumber: aRow and: aColumn
>   "this converts the big grid aRow, aCoulumn into a cellNumber"
>   
>   (aBoolean isKindof: Boolean)
> ifTrue: [
>  (cellNumber =1) ifTrue: [cell1 cellLock:aBoolean].
>  (cellNumber =2) ifTrue: [cell2 cellLock:aBoolean].
>  (cellNumber =3) ifTrue: [cell3 cellLock:aBoolean].
>  (cellNumber =4) ifTrue: [cell4 cellLock:aBoolean].
>  (cellNumber =5) ifTrue: [cell5 cellLock:aBoolean].
>  (cellNumber =6) ifTrue: [cell6 cellLock:aBoolean].
>  (cellNumber =7) ifTrue: [cell7 cellLock:aBoolean].
>  (cellNumber =8) ifTrue: [cell8 cellLock:aBoolean].
>  (cellNumber =9) ifTrue: [cell9 cellLock:aBoolean].
>   ].
>
>As you can see that is really repetitive. So, it seemed to us that one
>should be able to dynamically build the message in one line,
>
>that is why we tried to do something like:
>
> self perform: ('cell', cellNumber asString) asSymbol ... to build up
>the "cell1 ... cell9" object. But we couldn't figure out how to build up
>the rest of the message.
>
>(One solution which is possible was presented by Louis Labranda which
>involves using an ordered collection ... that should work fine ... but
>is there no way of building up the message similar to our attempt, but
>expanding on it?  We thought that everything's an object in Squeak ...
>what happened to that?)
>
>Thanks,
>
>Dawson (I'm the under 15 year old's father, and I don't mind my name
>being published)
>
>
>
>
>
>
>On 24/04/12 7:59 AM, Bert Freudenberg wrote:
>> So if I understand correctly you want to do something equivalent to this:
>> 
>>  cell1 cellLock: true.
>>  cell2 cellLock: true.
>>  cell3 cellLock: true.
>>  ... etc ...
>> 
>> Yes? If so, then perform is not what you are looking for. Perform lets you 
>> assemble the message selector, but not the receiver of the message. The 
>> Right Way to do this would be to have an Array of cells. Arrays are a 
>> collection of objects, and individual objects can be accessed by index. So 
>> if "cells" was an array of your cell objects, you could write
>> 
>>  (cells at: 1) cellLock: true.
>>  (cells at: 2) cellLock: true.
>>  (cells 

[Newbies] Re: Re: perform withArguments

2012-04-24 Thread Louis LaBrunda
Hi Bert,

>Ah that's curious - your reply did not have a Re: and was not threaded with 
>the original message. Would have saved me to write a message very similar to 
>yours ;)
>- Bert -

Sorry about that.  I don't like seeing all the Re: Re: filling up the
subject line often to the point where you can't see the real subject any
more, so I often remove it.

I use Forte Agent for email and news groups because it (by and large)
treats them the same and I can keep them all in one place.  I read the post
at and posted my reply to gmane.comp.lang.smalltalk.squeak.beginners.  With
Forte Agent, all the posts, including mine were in the same thread.  What
is also curious is that I also received a copy of your post (the one I am
replying to here) as an email but none of the other posts including your
other one.

I seem to get all the posts via the news group but only some of the emails.
I would rather I just get the news group posts but don't know how to turn
off the email copies.

Anyway, I will try to remember to leave one Re: in the future.  Although
I'm not sure why it is required to keep the thread together.  If anything,
having exactly the same subject line should keep post together better than
having to ignore a lot of Re:'s to fine the real subject.

Lou

>
>On 23.04.2012, at 10:44, Louis LaBrunda wrote:
>
>> Hi,
>> 
>> For your example:
>> 
>>  cellObject cellLock: aBoolean
>> 
>> where cellObject is to look like: cell1, cell2, cell3 ..., or cell9
>> 
>> I don't think you want or need to use #perform:.  You use #perform: when
>> you want to construct the message name and sent the constructed message
>> name to an object.
>> 
>> In your case you know the message you want to send, it is #cellLock:.  What
>> you don't know (or have easily available) is the object you want to send
>> the message to.
>> 
>> What I think you need to do is save your cell objects in an array or
>> collection (I will let you look up collections, but ask again if you need
>> help).  With something like:
>> 
>> cellObjects := OrderedCollection new.
>> cellObjects add: YourCellClass new.
>> 
>> Once you have a collection of your cells, you can access one or more of
>> them and sent the #cellLock: message to it like so:
>> 
>> (cellObjects at: cellNumber) cellLock: aBoolean
>> 
>> Good luck and keep posting if you need help.
>> 
>> Lou
>> 
>> On Mon, 23 Apr 2012 07:58:47 -0700 (PDT), OrgmiGeek
>>  wrote:
>> 
>>> Hi,
>>> I've read the sparse documentation on 'dynamic message' calls and I've
>>> experimented a lot and still cannot figure out how to do something that
>>> should be simple:
>>> 
>>> I want to build a message like this:
>>> 
>>>  cellObject cellLock: aBoolean
>>> 
>>> where cellObject is to look like: cell1, cell2, cell3 ..., or cell9
>>> 
>>> I can build up cellObject like this:
>>> 
>>>   self perform: ('cell', cellNumber asString) asSymbol
>>> 
>>> but I can't figure out how to build the full message with the key selector
>>> "cellLock:", and the value 'aBoolean'.
>>> I've tried everything I can think of based on the terse documentation, and
>>> anything I can find on the internet, which isn't much (including this
>>> forum).
>>> 
>>> Any help would be appreciated.
>>> 
>>> Thanks
>>> 
>>> -
>>> ---
>>> Under the age of 15 so don't want to post my name :D
>> ---
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>> mailto:l...@keystone-software.com http://www.Keystone-Software.com
>> 
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] perform withArguments

2012-04-23 Thread Louis LaBrunda
Hi,

For your example:

cellObject cellLock: aBoolean

where cellObject is to look like: cell1, cell2, cell3 ..., or cell9

I don't think you want or need to use #perform:.  You use #perform: when
you want to construct the message name and sent the constructed message
name to an object.

In your case you know the message you want to send, it is #cellLock:.  What
you don't know (or have easily available) is the object you want to send
the message to.

What I think you need to do is save your cell objects in an array or
collection (I will let you look up collections, but ask again if you need
help).  With something like:

cellObjects := OrderedCollection new.
cellObjects add: YourCellClass new.

Once you have a collection of your cells, you can access one or more of
them and sent the #cellLock: message to it like so:

(cellObjects at: cellNumber) cellLock: aBoolean

Good luck and keep posting if you need help.

Lou

On Mon, 23 Apr 2012 07:58:47 -0700 (PDT), OrgmiGeek
 wrote:

>Hi,
>I've read the sparse documentation on 'dynamic message' calls and I've
>experimented a lot and still cannot figure out how to do something that
>should be simple:
>
>I want to build a message like this:
>
>   cellObject cellLock: aBoolean
>
>where cellObject is to look like: cell1, cell2, cell3 ..., or cell9
>
>I can build up cellObject like this:
>
>self perform: ('cell', cellNumber asString) asSymbol
>
>but I can't figure out how to build the full message with the key selector
>"cellLock:", and the value 'aBoolean'.
>I've tried everything I can think of based on the terse documentation, and
>anything I can find on the internet, which isn't much (including this
>forum).
>
>Any help would be appreciated.
>
>Thanks
>
>-
>---
>Under the age of 15 so don't want to post my name :D
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] ifTrue ifFalse help

2011-04-28 Thread Louis LaBrunda
Hi Rick,

6 // 2 results in an integer value of 3.  3 asCharacter results in a
character with a value of 3 but that is not the printable character of $3
which has an integer value of 51.  Try sending #inspect (like: 3
asCharacter inspect) to objects, it should help you see what/how things are
stored.

Lou

On Thu, 28 Apr 2011 09:26:34 -0400, Richard Wallace
 wrote:

>Thanks for all the feedback and analogies to Java.  In addition to the
>original question...
>
>Given:
>| a b c |
>a := 6 // 2.
>b := a asCharacter.
>c := b isMemberOf: Character.
>Transcript show: 'Member of Char: ', c, '   b = ', b; cr.
>
>Result:
>Member of Char: true   b =
>
>I was wondering why b is not getting displayed.
>
>Thanks in advance!
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] ifTrue ifFalse help

2011-04-27 Thread Louis LaBrunda
On Wed, 27 Apr 2011 18:06:29 +0200, Mateusz Grotek

>is a character a string?
>in Smalltalk the answer is NO.

But of course in Smalltalk you can have a string with only one character in
it.  But:

$a is not equal to 'a'
$a is equal to 'a' first or 'a' at: 1.

Having a Character class in Smalltalk is valuable because there are
messages one might want to send to a character that wouldn't make sense
sending to a string, even one of length 1.

Lou
-------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] How to export/import painting from one Etoys project to another?

2010-09-20 Thread Louis LaBrunda
Hi All,

I have an image or painting in an Etoys project that I would like to use in
another project.  How do I export it from one project so I can import it to
another project?

Lou

P.S.  Sorry if this gets posted to more than new group.  I am having
trouble posting to the squeakland list.
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: Teaching Smalltalk

2010-05-03 Thread Louis LaBrunda
>Isn't that just some junk spam website?
>Thanks
>Samuel

It does look very different than what I remember but the links to Cincom
Smalltalk and VA Smalltalk are real and appear to be paid for, so it seems
real.

Lou
-------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: Teaching Smalltalk

2010-05-03 Thread Louis LaBrunda
Hi Samuel,

>That link doesn't seem to work (whysmalltalk). Is there some problem on my 
>end? I tried Google, but it also didn't show anything with that name..?

I think the link is actually http://whysmalltalk.com.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: Defining a binary message selector

2009-11-16 Thread Louis LaBrunda
Hi Andy,

I may be way off in my understanding of what you are trying to do, if so I
apologize ahead of time.

It looks to me like you want to create a method that will answer the
Fibonacci value for a given number.  Hence your first attempt
Integer>>fibonacci: aNumber.  Where I expect you returned the Fibonacci
value of aNumber.  I think you then moved on to wanting to just a message
and not having to pass aNumber.

This lead to the next attempt with '+'.  This is where I think you went a
little wrong, '+' actually has a parameter.  It normally looks like
someNumber + aNumber or 2 + 3.  Others have suggested using something like
#fib, but didn't explain much more.  This is the way to go, unless you
really want to use some single character, which you could.

If you extend Integer with the #fib method (without the # and no parameter)
you should have what you want.  All you need to do is use the code you had
for Integer>>fibonacci: aNumber and everywhere you had aNumber, replace it
with "self", you will be able to send the #fib message to any integer (like
5 fib) and get the Fibonacci value of the integer the #fib message was sent
to.

I will leave it to others to tell you how to use some special character to
replace #fib, if that is really what you want to do.

Have fun!

Lou

>As an experiment, I tried to create a Fibonacci method for Integer.
>Initially, I defined it as Integer>>fibonacci: aNumber. However, having
>thought about it a bit more I realised that it should probably be a binary
>message like '+'. I tried to create it as such, but Squeak wouldn't let me -
>even when I copied the code from the '+' method.
>
>After a bit of head scratching, I decided that '+' was probably a symbol,
>and that binary messages are probably limited to using symbols as selectors.
>However, I once arrived late to a baseball game (never having seen it played
>before), got confused about which team was which, and invented an entirely
>new scoring system that pretty much explained the results on the
>scoreboard.  So, I may be completely wrong about binary selectors!
>
>If I am right about them requiring to be symbols.  Would it be a good idea
>for meto make 'fibonacci' a symbol as well? Or would that lead to unintended
>problems down the road?
>
>Cheers
>Andy
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: Help me on Squeak

2009-03-11 Thread Louis LaBrunda
Hi Pedro Pereira

>Greetings,
>It must be me... I started in squeak today, and have been the last 5 hours
>(maybe a little more) trying to understand it. I am just tired and going
>nowere :-(
>Who can help me, please,  in a very small and simple project in squeak?

This sounds like it may be a request for help with a school project, if so,
we try not to do projects for students, if it isn't, my apologies.  At any
rate, if you can formulate a more specific question, I'm sure someone will
try to answer it.

Lou

>I can send what I have made and maybe someone can please help on the rest?
>Thanks... all the way from Portugal
> 
> 
>·´¨¨)) -:¦:-
>¸.·´ .·´¨¨)) 
>((¸¸.·´ ..·´ Pedro Amorim Pereira -:¦:-
>-:¦:- ((¸¸.·´-:¦:- virtuald...@hotmail.com
>
> 
>
>
>
>
>_
>Windows Live Messenger. O melhor em multitarefa.
>http://www.microsoft.com/windows/windowslive/products/messenger.aspx
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

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


[Newbies] Re: Windows

2008-08-18 Thread Louis LaBrunda
Also if you start here:

http://www.instantiations.com/VAST/index.html

I think you can find a download that is free to develop with and pay for when
you sell your program.  I am not sure about making programs for your personal
use or a company making programs for their internal use.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[EMAIL PROTECTED] http://www.Keystone-Software.com

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


[Newbies] Re: Bootable Squeak

2008-05-29 Thread Louis LaBrunda
>SqueakNOS is not completely dead, however, it only supports serial mice.
>And, to answer the question... I would use the slax squeak thing, or some
>minimilized linux to run squeak on.  Then you could also easily change your
>image you were running as well!

I also like the idea of using a minimal linux to run squeak on.  Linux has a lot
of developers supporting it on many platforms.  Why not build on their work and
not redo that work by writing Squeak drivers for keyboards, mice and other
devices.  Just hide Linux as best you can, use it for the low level stuff and
have Squeak do everything else.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[EMAIL PROTECTED] http://www.Keystone-Software.com

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


[Newbies] Re: is 0.1 a Float or a ScaledDecimal ?

2008-02-20 Thread Louis LaBrunda
Hi Cédrick,

I'm Glad to be of some help.

>[snip]
>Also, I didn't know 0.1234s4 notation before so having a unit test
>failing was finally a good thing. I was testing a method called
>remainingWeight (so basically 1 - SumOfAllSubsetWeight, hence the test
>of *egality*... between floats)).
>
>Cédrick

I don't know what you are working on but if you use fractions for what you are
doing it would be interesting to hear about how you use them and your results.
Because fractions are kept as an integer numerator and an integer denominator,
they probably take up more memory than floats but less than ScaledDecimals.  And
because both the numerator and denominator can be large integers, fractions can
be very precise.  But because they are implemented in both software and
hardware, then can be slow.  However, many numerical functions seem to have
fractions or divisions built into them.  If fractions are used and the divisions
not preformed until they absolutely have to be, then use of fractions could be
faster than expected and may be faster than ScaledDecimals or floats.  I have no
proof of this but if you do anything in this area, I would love to hear about
it.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[EMAIL PROTECTED] http://www.Keystone-Software.com

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


[Newbies] Re: is 0.1 a Float or a ScaledDecimal ?

2008-02-20 Thread Louis LaBrunda
>I have another interrogation. Please take it as a student/newbie
>whatever question.
>
>I think 0.1 should be considered as a ScaledDecimal so that we could
>write 0.1 asFraction and have 1/10...
>

What you desire is admirable but no longer practical as it would break a great
many existing programs.  In the begriming data types were closely tied to what
the hardware supported.  Most early computers supported integers (small
integers, not the long kind that we have in Smalltalk) and maybe some form of
floating point numbers and some form of decimals.  Things weren't very standard
between different manufactures computers.  After a while, computers supported
integers, floating point numbers and IBM mainframes had packed decimal numbers
(in the hardware) that are a lot like ScaledDecimal numbers, they were used a
lot in COBOL.

So, most languages took 0.1 to be a floating point number.  When Smalltalk came
along, it followed in that tradition.  Smalltalk added 0.1s1as a ScaledDecimal
number and 1/10 as a fraction.  They are both implemented as a mix of software
and hardware and not mapped directly to hardware.

Lastly, I would point out that in Smalltalk when you say 1/10 you get an
instance of a fraction and not an instruction to divide 1 by 10.  Therefore, you
don't need to say 0.1 asFraction or 0.1s1 asFraction to get 1/10 as an instance
of Fraction.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[EMAIL PROTECTED] http://www.Keystone-Software.com

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