Rob Rothwell | 5 Sep 23:52

Pre 1900 Date problems

How do I reference dates prior to 1900 in Squeak?

When I print, for instance d := Date fromString: '01/01/1800', I get 1 January 3700.

1700 = 3600,

etc...

Should I be using a different Date/TimeStamp package for this sort of thing?

Thanks,

Rob
_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Andy Burnett | 5 Sep 13:58

Integrating Seaside and Flash

I would like to include a Flash component in a seaside page. The component needs to write data back to the seaside app.  I can think of two ways to communicate with the server:
1. define a static URL, that the component can call, and somehow process the returned data
2. have a form embedded on the page (that contains the flash component) and get the component to write its data into the form, and then submit it

I was going towards the first option, but Ramon put a comment on my blog that made me realise that I probably don't understand the seaside approach yet. So, could anyone give me a simple example of what they feel is the best approach?

cheers
Andy
_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Charles Gray | 4 Sep 17:13

Arrays within arrays

Why doesn't this work?

strength := Array new: 10.
strength := #( #(0 0 0 0) #(0 0 0 0) #(0 0 0 0) #(0 0 0 0) #(0 0 0 0) #(0 0 0 0)
#(2 1 0 0) #( 8 4 0 1) #(14 6 0 2) #(30 12 1 4)).

I read that the contents of an array are objects and the arrays inside of
strength are objects but Smalltalk simply refuses to accept this assignment. I
didn't want to say a := #(0 0 0 0). b := #(2 1 0 0). c := #(8 4 0 1) ... etc.
and then strength := #( a a a a a a b c ... etc  but it appears this may be
necessary. I suppose a, b, c, etc are temporary variables and will disappear
after use but it seems like a terrible waste. 
Anders Janmyr | 4 Sep 09:40

Continuous Integration

Hi,

I was wondering if there is a good way to do Continuous Integration.

What I am looking for is something like:
1. Start a new basic image.
2. Load in required software packages from Squeak Map, Universe,
Monticello, etc.
3. Load latest packages from my Monticello repository.
4. Run all the tests.
5. Produce a test report as a web page or as a mail.

Thankful for any help.
Anders

--

-- 
http://anders.janmyr.com/
Freeman Mayberry | 4 Sep 00:47

how do I get rid of things that pointer finder points to?

 
I figured out how to find bad reference to obsolete objects using pointer finder, but I still don't really understand how to hunt it down and get rid of it.

--
Freeman Mayberry
_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Waldemar Schwan | 3 Sep 02:23

Exceptions in Squeak


> What I wanted was an exception (try/except) in case any of the reads
> failed. Corrupt files are an expected case that should be handled by
> the program. So I can't crash while reading (or writing). Does Squeak
> have exceptions? Or is there a Smalltalk pattern for this "try to
> execute this, do something else if it fails"? That answer should
> probably go into another thread.
>
> David

You may take a look at BlockContext, exception protocoll. BlockContext  
is the class of [ ] .

If you are searching for a try catch, try
	[ self doingThingsThatMayThrowErrors ] on: Error do: [ something ].

example:
	[ Error new signal] on: Error do: [Transcript show: 'error'].

Regards
	Waldemar
David Finlayson | 3 Sep 00:36

Binary file I/O performance problems

I've been working on my first Smalltalk program which needs to read
and write large c structs from a binary file. I wrote two classes
BinaryStreamReader and BinaryStreamWriter that take a stream and can
read (or write) all of the integer and floating point types I need
(also handles byte-swapping if necessary). I wrote a test program that
focuses on just reading a small (for us) 123 Mb data file on disk. The
program takes about 166 seconds to run compared to 1.2 seconds for an
equivalent C version (140x faster than Squeak version).

As an example of the style of code I've written, here is the method
that reads an unsigned 32-bit integer:

uint32
	" returns the next unsigned, 32-bit integer from the binary stream "
	" see PositionableStream for original implimentation."
	| n a b c d |
	isBigEndian
		ifTrue:
			[ a := stream next.
			b := stream next.
			c := stream next.
			d := stream next ]
		ifFalse:
			[ d := stream next.
			c := stream next.
			b := stream next.
			a := stream next ].
	((((a notNil and: [ b notNil ]) and: [ c notNil ])) and: [ d notNil])
		ifTrue:
			[ n := a.
			n := (n bitShift: 8) + b.
			n := (n bitShift: 8) + c.
			n := (n bitShift: 8) + d ]
		ifFalse: [ n := nil ].
	^ n

There are at 4 calls to stream next for each integer and sure enough,
a profile of the code (attached below) shows that most of the time is
being lost in the StandardFileStream basicNext and next methods. There
must be a better way to do this. Scaled up to operational code, I will
need to process about 40 Gb of data per day. My C code currently takes
about 16 cpu hours to do this work (including number crunching). In
Squeak, just reading the data would take 3 cpu months!

Hopefully, someone can help me out here. The working code is available
on squeaksource.org if anyone is interested:

http://www.squeaksource.com/ <at> CWlm_vX4hAPUzk5w/7SVjQQhp

Thanks,

David

Below is a message tally of my program:

 - 166088 tallies, 166100 msec.

**Tree**
100.0% {166100ms} SEAFileReader>>printAllBlocks
  99.9% {165934ms} ProcessedPingBlock>>readFrom:
    99.9% {165934ms} XYZAPingData>>readFrom:
      99.7% {165602ms} XYZATransducerData>>readFrom:
        95.9% {159290ms} XYZAPointData>>readFrom:
          46.4% {77070ms} BinaryStreamReader>>double
            |41.9% {69596ms} BinaryStreamReader>>uint32
            |  |28.1% {46674ms} StandardFileStream>>next
            |  |  |14.1% {23420ms} primitives
            |  |  |14.0% {23254ms} StandardFileStream>>basicNext
            |  |9.8% {16278ms} LargePositiveInteger>>+
            |  |  |6.1% {10132ms} LargePositiveInteger(Integer)>>+
            |  |  |  |3.1% {5149ms} primitives
            |  |  |  |3.0% {4983ms} SmallInteger(Number)>>negative
            |  |  |3.7% {6146ms} primitives
            |  |4.1% {6810ms} primitives
            |2.5% {4153ms} Float class(Behavior)>>new:
            |2.0% {3322ms} primitives
          13.9% {23088ms} BinaryStreamReader>>float
            |10.4% {17274ms} BinaryStreamReader>>uint32
            |  |7.0% {11627ms} StandardFileStream>>next
            |  |  |3.5% {5814ms} primitives
            |  |  |3.5% {5814ms} StandardFileStream>>basicNext
            |  |2.4% {3986ms} LargePositiveInteger>>+
            |2.2% {3654ms} Float class>>fromIEEE32Bit:
          13.7% {22756ms} BinaryStreamReader>>int32
            |7.7% {12790ms} BinaryStreamReader>>uint32
            |  |6.8% {11295ms} StandardFileStream>>next
            |  |  3.5% {5814ms} StandardFileStream>>basicNext
            |  |  3.4% {5647ms} primitives
            |5.2% {8637ms} SmallInteger>>>=
            |  4.3% {7142ms} SmallInteger(Magnitude)>>>=
            |    3.5% {5814ms} SmallInteger>><
            |      2.6% {4319ms} SmallInteger(Integer)>><
          10.7% {17773ms} BinaryStreamReader>>uint16
            |6.9% {11461ms} StandardFileStream>>next
            |  |3.5% {5814ms} StandardFileStream>>basicNext
            |  |3.3% {5481ms} primitives
            |3.8% {6312ms} primitives
          6.8% {11295ms} BinaryStreamReader>>skip:
            |5.0% {8305ms} StandardFileStream>>skip:
          3.4% {5647ms} BinaryStreamReader>>int8
            2.6% {4319ms} BinaryStreamReader>>uint8

**Leaves**
25.4% {42189ms} StandardFileStream>>basicNext
25.2% {41857ms} StandardFileStream>>next
6.0% {9966ms} BinaryStreamReader>>uint32
5.6% {9302ms} SmallInteger(Number)>>negative
4.6% {7641ms} LargePositiveInteger>>+
3.8% {6312ms} LargePositiveInteger(Integer)>>+
3.8% {6312ms} BinaryStreamReader>>uint16
3.4% {5647ms} Float class(Behavior)>>new:
2.0% {3322ms} BinaryStreamReader>>double

**Memory**
	old			+3,705,004 bytes
	young		-28,800 bytes
	used		+3,676,204 bytes
	free		+362,744 bytes

**GCs**
	full			50 totalling 2,524ms (2.0% uptime), avg 50.0ms
	incr		19959 totalling 2,794ms (2.0% uptime), avg 0.0ms
	tenures		6,041 (avg 3 GCs/tenure)
	root table	0 overflows

--

-- 
David Finlayson, Ph.D.
Operational Geologist

U.S. Geological Survey
Pacific Science Center
400 Natural Bridges Drive
Santa Cruz, CA 95060, USA

Tel: 831-427-4757, Fax: 831-427-4748, E-mail: dfinlayson <at> usgs.gov
Marcin Tustin | 29 Aug 18:22

Re: Good practice for modeling model tools

Have you looked at Magritte?

On Fri, Aug 29, 2008 at 8:04 AM, Anders Janmyr <anders <at> janmyr.com> wrote:
Hi,

I would like some thought on what is a good way to model "model tools"
in Smalltalk.

Clarification
The user should be able to create classes.
The classes contain named variables.
The variables can be described (typed) with data such as type (String,
Date, Company) and multiplicity (1, 2..5, 4..)
I also want to attach behavior to the classes.
I would also want to be able to refactor the classes, preferably with
the existing tools

Example:
Person
 name:String:1
 mother:Person:1
 father:Person:1
 children:Person:0..

Process
 name: ImportPeople
 executeMethod: "code for importing people into my model"

Should I model the users models as Smalltalk objects or should I make
my own parallel hierarchy.
Should the Person above be dynamically created as a smalltalk class:

Person
 name:
 mother:
 ...

or should I use
 MyClass
   name: Person
   instVars: #(name mother ...)



Any help will be appreciated.

Anders

--
http://anders.janmyr.com/
_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Anders Janmyr | 29 Aug 09:02

Good practice for modeling model tools

Hi,

I would like some thought on what is a good way to model "model tools"
in Smalltalk.

Clarification
The user should be able to create classes.
The classes contain named variables.
The variables can be described (typed) with data such as type (String,
Date, Company) and multiplicity (1, 2..5, 4..)
I also want to attach behavior to the classes.
I would also want to be able to refactor the classes, preferably with
the existing tools

Example:
Person
  name:String:1
  mother:Person:1
  father:Person:1
  children:Person:0..

Process
  name: ImportPeople
  executeMethod: "code for importing people into my model"

Should I model the users models as Smalltalk objects or should I make
my own parallel hierarchy.
Should the Person above be dynamically created as a smalltalk class:

Person
  name:
  mother:
  ...

or should I use
  MyClass
    name: Person
    instVars: #(name mother ...)

Any help will be appreciated.

Anders

--

-- 
http://anders.janmyr.com/
Matthias Korn | 27 Aug 12:35

Common/Best Practices on (Collaborative) Version Control

Hi all,

we are a small group of people working together on a project in Squeak.

Now, I was wondering what the most common workflow for supporting
collaborative work in the Squeak environment is.
Like normally you would have a central SVN repository where everyone
could check their stuff in and than update and merge new stuff with
their own local repository...

As far as I understand, Monticello does all the versioning and packaging
stuff. But I currently do not see the collaborative part in that
(without sending mcz-files via eMail). Also, we do not want to publish
our project (like on SqueakSource) at this point in time. We are looking
for an internal solution.

What is generally the most common workflow to do that in Squeak?

Thanks,
Matthias
Marcin Tustin | 25 Aug 13:21

Re: The Bridge Playing example

For anyone who's interested, here's an implementation with the cards represented as integers (or wrapping integers). Perhaps this could be the basis of a super-compact representation. In any case, sorting hands becomes simpler, but either dealing (creating a card object) or checking that a play is legal becomes more involved (because at some point you would have to reconstruct the symbolic information regarding suit and rank).

Alternatively, if you want to make the deck bridge-specific you could change the undealt variable into an Array or OrderedCollection, and after shuffling treat each of the quarters as belonging to a specific hand. Again, more compact, less simplicity. Taking something out of the hand could be represented by replacing that card's integer with 0 in the deck/hand array.

Another alternative would be to use an "ordinary" representation for shuffling etc. then write that into a bit-packed representation with each two bits representing a player, as the original questioner wanted. Some utility classes could go over that to make handling such a thing look like an array of players, and use a formatting method similar to the one used in the attached code.


Attachment (PlayingCards.st): application/octet-stream, 2323 bytes
_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Gmane