[Newbies] a simple Morph
Hi there! I have some difficulties to create a morph, which shows me simply all elements of an array inside that morph. my morph has an instance var called myArray. now the morph should simply show the contents of myArray. and here my confusion start. I don't want to reprogram PluggableListMorph. But I don't get this thing to use myArray. I guess PluggableListMorph want's to have a model. Or? So I should the MVC stuff, or? I did some morphic tutorials, but none of these showed me, how to build a more complex morph. There are rectangles, drag and drop and so on. But there is nothing like: here is a collection, now show me all elements of that collection inside a morph (as a list). In my understanding, I would build a classic MVC-triple. But as i understood Morphic, there is no need for classic MVC anymore. So I am badly confused. My realisation so far: BorderedMorph subclass: #MenschMorph instanceVariableNames: 'liste' classVariableNames: '' poolDictionaries: '' category: 'UserObjects' initialize | c m| super initialize. self extent: [EMAIL PROTECTED] self position: [EMAIL PROTECTED] self color: Color white. self liste: #('name' 'alter' 'huhu'). c := 1. liste do: [:each | m := TextMorph new openInWorld. m position: self position + ([EMAIL PROTECTED]). c:= c+1. self addMorph: m. ]. Now i would write some manipulation stuff for 'liste'. I would delete all the TextMorphs and simply redraw them, but with my manipulated list as new 'input'. And that feels damn wrong to me. How to proceed? My goal should be a Morph, which shows me simply the contens of a list. The Morph should update itself, when i manipulate the list. Classic MVC for me. Am I right? So long, Stephan ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
RE: [Newbies] Best place to ask Smalltalk questions?
Hi Sean, ok i have another. lets take something that in a sql driven environment would be a lookup table. countries and states. what the the smalltalk way with this? There are a number of patterns for this. Not all of them are strictly object oriented. The easiest way to do this is to use a database to hold and coordinate the data. Then you would query for the data and instantiate objects as needed (and maybe cache some frequently used ones). Your suggestion of using a class variable or a class method that is responsible for creating all of your instances also makes sense. You can either build all the instances and save them in your image or build the instances during startup or lazily when needed. You need to have some root to hold those new instances to keep them from being garbage collected. This can also be done with a class variable. Just set a class variable to a collection of your instances, then use that variable to lookup your instances. Having an external file is also a good way to go. The same issues arise from the file as for putting the data in a method, but benefit of using the file is that your data is not saved in code and can be updated without changing your running image, although your image needs to know when the file changes so that it can refresh your instances. Hope that helps, Ron Teitelbaum ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] a simple Morph
On Thu, Aug 07, 2008 at 03:13:40PM +0200, Stephan Janosch wrote: But there is nothing like: here is a collection, now show me all elements of that collection inside a morph (as a list). This works for me: myArray explore myArray inspect My goal should be a Morph, which shows me simply the contens of a list. The Morph should update itself, when i manipulate the list. Classic MVC for me. Am I right? well, if you want auto-updating, you will need one of two things: - somebody that polls the collection, or - a collection that sends out events when it changes The first is what the Inspector tool does The second is what Etoys and Tweak do. Etoys does not have a generic event-sending collection, but Tweak does: CCollection A few things in squeak actually do send out notifications on change, like the Class heiarchy, but not in a very generic way. See SystemChangeNotifier and references to it -- Matthew Fulmer -- http://mtfulmer.wordpress.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] a simple Morph
Hello Stephan, Thursday, August 7, 2008, 3:13:40 PM, you wrote: SJ and here my confusion start. I don't want to reprogram SJ PluggableListMorph. But I don't get this thing to use myArray. I guess SJ PluggableListMorph want's to have a model. Or? yes SJ My goal should be a Morph, which shows me simply the contens of a list. SJ The Morph should update itself, when i manipulate the list. Classic MVC SJ for me. Am I right? http://wiki.squeak.org/squeak/2962 has pluggableListMorphDemo.pr which shows you how to use your array as model for the list. -- Cheers, Herbert ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] a simple Morph
Thanks Herbert ( and Matthew ) http://wiki.squeak.org/squeak/2962 has pluggableListMorphDemo.pr which shows you how to use your array as model for the list. I'll have a look at that. And I'll post code, which helps to realize my project. so long, Stephan ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
[Newbies] How do I run Chess?
Hello, I would like to explore Squeak but am unable to do even the simplest thing: running a program. I have spent literally hours trying to figure this out, browsing on the web and just playing with the application but I don't know how to make Chess.st run graphically so I can play the game. I've looked at the code and all but still don't understand how to make it run. Could you help me please? Daniel Lewis ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How do I run Chess?
El 8/7/08 5:10 PM, Daniel Lewis [EMAIL PROTECTED] escribió: Hello, I would like to explore Squeak but am unable to do even the simplest thing: running a program. I have spent literally hours trying to figure this out, browsing on the web and just playing with the application but I don't know how to make Chess.st run graphically so I can play the game. I've looked at the code and all but still don't understand how to make it run. Could you help me please? Daniel Lewis Chess and many others games is part of FunSqueak 7, where you have a glimpse of different things from past and present in a ready to run image. On Objects Flaps you found a morph . Drag to World and start to play :=) Edgar ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How do I run Chess?
I am a noob, so handle with care. You got a file named Chess.st? So maybe look for 'how do I load a .st file in smalltalk?' Looking in the Squeak FAQ gave me this: http://wiki.squeak.org/squeak/1105 Now that does tell me something about what a .st file is. However it doesn't tell me how to load such a piece of code. Searching further got me to this page: http://coweb.cc.gatech.edu/cs2340/3667 He tells me to just 'do': FileStream fileIn: 'C:\foo.st' ( If you don't know how to 'do' something, you should probably postpone your chess adventure and read the Squeak by Example Book. Probably everyone highly recomends it. ) Now you need to find a Class that you could call the 'main entry point' for the Chess program you are trying to run. Open the Class browser and search for Chess. You could also try something as: Chess new openInWorld (which is kind of a Pattern I've seen through all Squeak UI apps.) Hope that helps a little. Don't give up. Felix ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Tim's Fix for LargeIntgerAtRandom
HI Randal, I drafted two replies to this and didn't feel comfortable enough with either of them to post. I suspect you are right in what you say. I am doing some experiments to find out. So what do you suggest to solve the problem? More to my interest, what do you suggest as a test to prove the problem is solved to your satisfaction. What is a good or at least reasonable way to test the randomness of larger positive integers? I want to emphasize that my coding is just for m (Learning from my own mistakes is the only sure way to get past my stubborn part.) Basicly, I believe you might be right an the PRNG stuff. --- On Tue, 8/5/08, Randal L. Schwartz [EMAIL PROTECTED] wrote: From: Randal L. Schwartz [EMAIL PROTECTED] Subject: Re: [Newbies] Re: Tim's Fix for LargeIntgerAtRandom To: Jerome Peace [EMAIL PROTECTED] Cc: beginners@lists.squeakfoundation.org Date: Tuesday, August 5, 2008, 6:18 PM Jerome == Jerome Peace [EMAIL PROTECTED] writes: Jerome The objection Randal raised is that now it is using too many. Jerome That's IMO a red herring. No, it's not. Multiple calls to a PRNG generate correlated numbers, which can be used for an attack. You need to use a PRNG that in a single call gives enough bits. And if you don't know that about PRNGs, you're not the one to be fixing this. I have not set out to. Tim should be able to succeed. My purpose is to encourage him to contribute. I am interested in writing tests that can show whether a particular solution is working sufficiently or not. I talked about it in terms of entropy because that's the easiest way to see that you're not gaining anything except the illusion of gain, which will bite back some day. You can't get 112 bits of entropy by calling a 56-bit PRNG twice. It's not progress if it breaks it. It was for the Gossamer Condor. More to the issue. Help design a test to prove if its broken or not. With respect, Yours in curiosity and service, --Jerome Peace ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Tim's Fix for LargeIntgerAtRandom
Jerome == Jerome Peace [EMAIL PROTECTED] writes: Jerome So what do you suggest to solve the problem? Use the code from the Crypto team. If you want that included in the core, make sure it has an MIT license, and submit it as a bug/change-request. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How do I run Chess?
On Friday 08 Aug 2008 1:40:55 am Daniel Lewis wrote: Hello, I would like to explore Squeak but am unable to do even the simplest thing: running a program. In Squeak, you don't run 'programs' but create and delete 'objects'. If you want to play chess, open Object Catalog (ALT+O) and look for Chess object (either under C in alphabetic or under Games) and then drag a copy of game template to the world area. The closest idea to 'running a program' is sending a message to a class to create a new instance. In this example, if someone has created a collection of classes for a chess game, find the main class (say Chess) and look for methods in the 'instance creation' category (if no method is found, then use 'new') and then do the sentence: Chess new openInHand BTW, when you post questions please include the version of your Squeak. HTH .. Subbu ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners