Re: [Newbies] [semi-OT] (fwd) Re: What Killed Smalltalk?
On Wed, Nov 18, 2009 at 3:18 AM, Ralph Johnson john...@cs.uiuc.edu wrote: Smalltalk didn't die. It's growth was killed. The dream of taking over the world was killed. +1. I use Smalltalk willingly, therefore it is not dead. It will only be dead when the last contributer stops enjoying it. I believe the way to make Smalltalk popular is to make it do something that nobody else can that many people need. This is assuming that the basics are there: a good product, good documentation, support, etc. I've been programming in Smalltalk since 1985. I remember 1995 as if it were yesterday. In 1985, some of the people in this community didn't exist! Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to introspect method instance variables
On Tue, Aug 25, 2009 at 2:16 PM, rdmerrio rdmer...@gmail.com wrote: I have defined a method, i.e., someMethod anInstVariable := anotherInstVariable1 + anotherInstVariable2. I would like to intercept the acceptance of this method by the browser and programatically determine what instance variables this method is using so that I can grab these names for other processing tasks. Additionally, I would really like to be able to determine what instance variables are being assigned to, for instance, anInstVariable in this case and which ones are the independent instance variables, anotherInstVariable1 and anotherInstVariable2 in this case. How can I do this? Why? What are you trying to achieve? You're talking about some pretty intrusive techniques. Unless you're developing a code analyser of some sort, you probably should be looking at a better way of doing what you're doing. To capture the acceptance of a method (assuming you mean the action that happens when you press alt+s), you insert a bit of code into PluggableTextMorphaccept. To determine which instance variables are being assigned to, you'll need to somehow look at the bytecodes. They're not too hard to analyse, but it can be a bit of work. Alternatively, maybe the refactory browser can help, or maybe you can look at the intermediate code that the compiler generates. The bytecodes are described here: http://burks.bton.ac.uk/burks/language/smaltalk/goldberg/blueb003.htm. They're in the Blue book chapter 28 if you need to Google it. You'll want the store bytecodes. To see real bytecodes, either inspect Morph#basicInitialize to see a CompiledMethod, or use the byteCodes view in a Browser (hidden behind the source button). Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] \n equivalent?
On Mon, Aug 3, 2009 at 9:20 AM, Paul DeBruicker pdebr...@gmail.com wrote: Hi, This is all very interesting. So 'Character cr asciiValue' is 13 'Character lf asciiValue' is 10 This gets complicated. See http://en.wikipedia.org/wiki/Newline for a better summary than I could write. This should be required reading for anybody working with multi-platform text files. Perhaps we need Streamnewline or something? Squeak follows the Macintosh OS9 convention (refer Wikipedia article above under Representation). Arguably we should perhaps start using CR+LF like Internet protocols do. Or perhaps the Unicode suggestion of... er... yea, one of the options shown on that page. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] \n equivalent?
On Fri, Jul 31, 2009 at 8:48 AM, Paul DeBruicker pdebr...@gmail.com wrote: Hi - What Character or String is equal to \n in C or Python? Thanks I remember wondering about this when I was first learning Smalltalk too. You do stuff like: s := WriteStream on: (String new: 100). s nextPutAll: 'Hello World'. Write a string s nextPut: $!. Write a single character s cr. Write a newline character It's a bit wordy, but I think streams deserve a lot more credit than programmers give them. If you're doing String concatenation: myString := 'Hello, World!', String cr. Alternatively, this is also valid code: myString := 'This is a multi-line String! '. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] jpg woes
On Tue, Jul 21, 2009 at 4:58 PM, Brian Mason bma...@itassociates.comwrote: Greetings, I am trying to take an image off the new and save it to a file. This is what I have so far: (FileStream newFileNamed: 'test.jpg') nextPutAll: ('http://freetalklive.com/images/amondson.jpg' asUrl retrieveContents) getContentFromStream; close The image exists, is found, and the file is written. There is something wrong with the format of the local jpg. Your stream needs to be binary. Don't ask me more than about this; I only discovered it through trial, error and reading the code for HTTPSockethttpJpeg: image := 'http://freetalklive.com/images/amondson.jpg' asUrl retrieveContents. f := (FileStream newFileNamed: 'test.jpg'). f binary. f nextPutAll: image content. f close. or for your style of coding: (FileStream newFileNamed: 'test.jpg') binary; nextPutAll: ('http://freetalklive.com/images/amondson.jpg' asUrl retrieveContents) content; close. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Unsubscribe
On 5/6/09, Pedro Pereira virtuald...@hotmail.com wrote: Greetings How do I unsubscribe from this list? Thank you There's a link at the bottom of every email on this list. That gives you instructions on how to unsubscribe. Gulik -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Array vs OrderedCollection
On 4/27/09, Miguel Enrique Cobá Martínez miguel.c...@gmail.com wrote: Hi all, are there any reason to prefer: adding 2 objects array := Array with: anObject. array := array copyWith: aSecondObject removing object array := array copyWithout: aSecondObject. instead of: adding 2 objects oc := OrderedCollection new. oc add: anObject. oc add: aSecondObject. removing object oc remove: aSecondObject ifAbsent: [] This in reference to Class addSubclass: and Class removeSubclass: methods In this particular case, I think you've made a valid point. I can't see any obvious reason why an OrderedCollection can't be used. My first suspicion is that this code was written before OrderedCollections were added to the system (i.e. in 1980 sometime). It might also have been written this way to make sure that the image could potentially run without an OrderedCollection class (e.g. when bootstrapping an image or something). The first three variables of Class (i.e. superclass, methodDict, format) are special and accessed directly by the VM meaning that they need to be carefully worked with, but as far as I know all of the other instance variables can be toyed with. Just be careful though... changing something here the wrong way is likely to break the compiler or the image. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Squeak vs. Smalltalk
On 4/22/09, Mark Volkmann m...@ociweb.com wrote: On Apr 20, 2009, at 10:28 PM, David Mitchell wrote: Very trippy but sometimes frustrating to someone who just wants to build a CRUD GUI. This was a key factor in me setting Squeak aside for a bit. I love the syntax of Smalltalk and the tools, but I was amazed at how difficult it was to build and deploy a simple GUI application. For example, I just wanted to build a GUI with a text field for entering a name and an OK button. When the button is pressed I wanted to display a dialog box that contains the text Hello and the name. The most frustrating parts were the layout of widgets and the packages of the application which involves a large number of steps. +1. It's on my TODO list. A more recent concern for me is the lack of support for taking advantage of multi-core processors. I know someone is working on improving this. Unfortunately the situation here is rather dire. I blogged about it: http://securesqueak.blogspot.com/2009/03/concurrency.html. It's fully possible to make a Smalltalk VM that does fine-grained concurrency, but nobody concurrently has the time(/money), energy and raw creative intelligence to make one. Until then, Igor's Hydra VM is the best we have. I'd love to make one, but I haven't put it on my TODO list because I don't need a concurrent VM. My single cored 1Ghz Celeron CPU is plenty fast enough. I'm fascinated by concurrent computing, and I've dabbled in it a bit as a hobby, but most of what I do isn't CPU bound. There's a lot of very interesting stuff you can do before you're limited by your CPU speed. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Squeak vs. Smalltalk
On 4/22/09, Avidan Ackerson avidan.acker...@gmail.com wrote: Thank you for all your answers, as it has given me a good idea about the nature of Squeak. But what can you tell me as far as performance ability goes? I recall reading somewhere that Squeak can cause a drag in processing at times. The Squeak VM itself is fast, for a particular value of fast. The reason it feels slow is because the user interface has been becoming bloated. I haven't tried it myself, but people report that the Cuis image is much faster than the standard Squeak image (Google or read other emails on this email list for links). Older images such as Squeak 1.3 (from ye olde archives) are very reactive, but feel old. As far as interpreted VMs go, I believe that the Squeak VM is among the faster ones. Somebody should correct me if I'm wrong, but I /believe/ that the Squeak VM is faster than the standard Python VM, Perl and Ruby. Things might have changed since I last looked. However, Squeak is (I believe) slower than Forth interpreters and slower than compiled code from C++ and C. It will also be slower than just-in-time compilers/interpreters such as the Sun Java VM. Eliot Miranda has joined our ranks recently and is working on the Cog VM. This will make Squeak even faster. Bryce Kampjes is also working on Exupery, which is another approach to speeding up code. A stock Squeak VM can't use multiple CPU cores, although the Smalltalk language itself has support for this. A single-cored CPU will run Squeak at the same speed as a dual or quad-core machine. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] RE: Beginners Digest, Vol 35, Issue 22
On 4/1/09, Ray Feliciano ray.felici...@hotmail.com wrote: Hi there, New to Squeak and the mailing list. Just had a question was hoping someone could answer. I'm currently following the Laser Game Development Example by Stephen Wessels and have hit a road block. I'm using Squeak image 3.10.2-7179-basic. Tutorial Link: http://squeak.preeminent.org/tut2007/html/ Step I'm On: http://squeak.preeminent.org/tut2007/html/028.html I've gone back and checked to make sure I had all the code written the same way, in the same places (I didn't at first) but 4 sUnit tests wont pass for the MirrorCellTestCase. I get Error: only integers should be used as indices. Now, going through the debugger I notice the error happens when my MirrorCell cell hits the code: 'self exitSides at: #north put: #east.' I'm guessing this should be a number. Yet, since I'm new to Squeaking and trying to follow along, I don't want to mess anything up that may affect later portions of the tut. Any ideas, suggestions, comments? No, it shouldn't be a number. I've just had a quick look at the tutorial (never looked at it before). I suspect self exitSides is returning nil rather than a Dictionary like it should. When you call at:put: like you did on a nil, you get the error you got. Personally, I think this is a bug in Squeak; the error is very misleading. Umm... the fix is obvious for an experienced Smalltalker but a little non-trivial to walk through using email. Jump on IRC and ask me there: http://wiki.squeak.org/squeak/IRCPortal Gulik -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Can't load VMMaker classes
On 3/27/09, kmr1642 kmr1...@yahoo.com wrote: Hi all, I'd like to look at the code for Interpreter and ObjectMemory, in either Smalltalk or Slang, but can't find any classes/files for them. I noticed that the names appear in VMMaker comments in the Package Universe but when I tried to load any of the VMMakers, they all hung with a variety of reasons. (I used a fresh 3.10.2-7179 image in win32). Installing VMMaker using squeakMap also hung. Does anyone know where the source for these classes might be found for reading? Or a 1-click image that contains VMMaker? (doesn't have to be current) Believe me, it's much easier downloading a prepared image: http://www.squeakvm.org/ Go to Unix (even if you're using Windows or Mac) and there's an image available from that page that's set up ready to go. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Setting up a squeak on a Ubuntu system
On 3/25/09, Jerome Peace peace_the_drea...@yahoo.com wrote: I am old to squeak but new to unix systems. I have been able to install etoys successfully from the squeakland web site. And I have been able to download and unpack zip files for etoys-dev and squeak 3.10.2 from archives. The files are in a personal home directory. I am ignorant in how to tell my Ubuntu 8.04 system how to connect an image file with a squeak vm. (E.G. the vm that runs the installed etoys for example.) What do I need to know? Well, I always use the command line because I find the UI cumbersome, but there's a learning curve there. I also usually use a simple window manager such as IceWM rather than the whole Gnome environment because all I ever do is check email and run Squeak. Usually the shell used is called bash, which makes a good Googlable term. Install and run xterm or rxvt using the package manager (because the default gnome-terminal sucks). Type in: $ cd (directory where your image is) $ squeak someImageFile.image Usually, the directory where the image is would be ~/squeak where ~ is your home directory. If you saved the image on your desktop, then it would be in ~/Desktop/folderName. Oh, to install Squeak, I just usually manually chuck the executable, plugins, image and sources in the same folder. This is because I often have multiple versions of the Squeak VM around. If the squeak executable is in your current directory, you need to use: $ ./squeak someImageFile.image because otherwise bash won't look at the current directory for executables (a security feature). For fancy stuff you can do with Squeak, type: $ squeak --help which gives you VM options. Welcome to Linux, land of poverty-stricken programmers and crazy socialists ;-). Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] GUI (using MVC?) application writing advice
On Mon, Mar 23, 2009 at 12:45 AM, Kevin Polston khwp...@googlemail.comwrote: Hi I'm just beginning to learn Smalltalk. I've been using Cincom's VisualWorks and have been writing a small GUI application (Text boxes, radio buttons, action buttons - that kind of thing) using MVC. I've now come across Squeak and have been looking for a similar set of classes (or a package) to help me do a similar GUI application in Squeak but I can't seem to find anything. Can anybody help me here - some pointers to a tutorial would be fantastic. The GUI components in the base Squeak image are mostly implemented in Morphic. The classes are: Text boxes: PluggableTextMorph, TextFieldMorph. Radio buttons: UpdatingThreePhaseButtonMorph, ThreePhaseButtonMorph, ButtonMorph, ... Normal buttons: SimpleButtonMorph, UpdatingSimpleButtonMorph. Windows: SystemWindow I dislike Morphic and I don't hide the fact. It's a huge time-waster when you're trying to get things to work right. Instead, I use ToolBuilder (Google it), which gives a simplified API that has most of what I need. ToolBuilder is available in standard Squeak images, although I have updated packages lying around somewhere. There's no documentation (afaik) and you'll need to rely on example code. One day I plan to fix that. If you want your user interface to actually look respectable, then these are your options: * Go back to VisualWorks. * Try Pharo where a lot of UI work has been done. * Try Seaside for web-based applications. * Use WxSqueak or GtkSqueak which use native widgets. I've found WxSqueak to work okay and look quite nice, although you'll be working with old and experimental software. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] (no subject)
On Thu, Mar 19, 2009 at 11:00 AM, Steven Rodriguez optionshi...@gmail.comwrote: I disgree. Sometimes it is better to make a visible statement :-). Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] RE: Welcome to the Beginners mailing list
On Thu, Mar 12, 2009 at 8:24 AM, Pedro Pereira virtuald...@hotmail.comwrote: I again I am not a student :-) I wish I were :-) I own a store... if you wish you can see me in my webpage. :-) This is just my first try with it... just trying to figure it out for something else. I want to move a small picture called bolo (cake) to the mouth... than it would stop there for 1 minute, meanwhile it would show some text, something like food is shew and than continues is way than I would have that small picture, smaller and it would go through the throat it would stop mid way and it would have some other text and than it would stop for one more minute and so on. I just need help on those two steps than I would try to do the rest. If you could help I would apreciate a lot. Thank you for your fast reply. You're welcome. But what do you want again? Do you want a multimedia presentation in Squeak? Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Help me on Squeak
On Thu, Mar 12, 2009 at 7:55 AM, Pedro Pereira virtuald...@hotmail.comwrote: 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? I can send what I have made and maybe someone can please help on the rest? Thanks... all the way from Portugal Hi Pedro. Squeak is a very powerful programming environment. It originally took me 6 months to become proficient in the environment, and this is with a computer science degree. I understand from your previous email that you want to do a multimedia presentation of some sort. I would recommend looking at http://www.squeakland.org/, where you don't need to know much about programming to get good results. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] how to create multiple colorforms from a master colorform
On Mon, Mar 2, 2009 at 12:48 PM, mstramba mikestra...@gmail.com wrote: Greetings, I have a ColorForm create from : (Form fromFileNamed: cards). It's an 840x504x8 png file of a deck of playing cards, i.e. showing all the cards. I want to create individual ColorForms, each representing one playing card from the 'master' colorform. So I guess I need to (in a loop) extract a rectangular area of pixels from the original ColorForm and then create a new colorform from those extracted pixels. I'm looking at the ColorForm, ImageMorph, Form .. and other superlcasses methods, but haven't figured out which combination of methods I need to use. eachCard := masterForm copy: (0...@0 corner: 8...@504). You'll need to replace 0...@0 and 8...@504 with the coordinates you need. Also, this is fun: (Display copy: (0...@0 corner: 1...@768)) asMorph openInWindow It makes a partial screen-shot :-). Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] how to create multiple colorforms from a master colorform
On Mon, Mar 2, 2009 at 12:48 PM, mstramba mikestra...@gmail.com wrote: So I guess I need to (in a loop) extract a rectangular area of pixels from the original ColorForm and then create a new colorform from those extracted pixels. Oh, and generally you'd want to avoid pixel-by-pixel operations. They're very, very slow. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] how to create multiple colorforms from a master colorform
On Mon, Mar 2, 2009 at 2:38 PM, mstramba mikestra...@gmail.com wrote: Gulik, Thanks ! That works great ! I was hoping there was a nice simple little method / incantation like that :) Next problem ... ;) ImageMorph doesn't seem to be resizable. I tried sending the width:, height: messages:, but they have no effect. That's because an ImageMorph is based on a bit map, which is stuck pixel-for-pixel with whatever display you're using. You can do this: (myImageMorph addFlexShell scale: 5.2) openInWorld. However, this is voodoo to me, and I don't even want to know how or why it works. I don't particularly like the design of Morphic because there is too much voodoo in it. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Startup Image
On Thu, Feb 26, 2009 at 1:22 PM, GeertC geert.wl.cl...@gmail.com wrote: What is the first thing the VM does when starting an image? I want to learn more about how the image actually works. It runs main() or WinMain(). If you really want to know what the VM does, have a look at the VM source. See http://www.squeakvm.org/. Also, see here for a description of how the VM works; Squeak is similar but different to this: http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_imp_toc.html The rest of the blue book is available on Stef's book list (Google for it). Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Number formatting printf/sprintf for Squeak?
On Tue, Feb 17, 2009 at 10:44 AM, Sorensen sor...@surfy.net wrote: Is there a printf/sprintf-like package for formatting text for Squeak? If not, how do Squeakers go about formatting currency amounts or left justifying text within a field? My initial reaction was that's obvious; there are methods in the String class, but when I looked I realised that this isn't actually as trivial as that. For printf-like functionality, class String has a formatting category with undocumented methods. The excellent Squeak by Example book has some examples (http://scg.unibe.ch/SBE/SBE.pdf, page 208) but the functionality is very limited compared with printf. See also SequenceableCollectioncopyReplaceAll:with: For formatting currency, I notice there's a Locale class with LocaleprimCurrencySymbol, but I can't find any more advanced methods for actually formatting a currency, and I can't find any currency classes for any Smalltalk dialect on Google (!), apart from an LcMonetary class for GNU Smalltalk. For left-justifying text, I'm a bit surprised that you'd want to do this. Typically, you'd make the text left or right justified in whatever GUI element that value ends up in, rather than padding it with spaces. Anyway; some code examples for actually doing the above: Formatting a currency (specifically in my Locale) with two decimal places: I assume that you're using ScaledDecimals for the currency; you generally shouldn't use Floats for currency. c := ScaledDecimal newFromNumber: 123.45 scale: 2. It's good practise to use a stream for formatting strings manually stream := WriteStream on: (String new: 30). c = 0 ifTrue: [ stream nextPut: $- ]. stream nextPutAll: Locale current primCurrencySymbol. Generally, prim methods should be private... c printOn: stream. Bug: also prints out 's2'. result := stream contents. I would also add a new method to ScaledDecimal to print out its value without appending an 's2'. In fact, I'd probably make a subclass of Number or ScaledDecimal called Currency and release it as a reusable package. Left-justifying text with padding: padding := String new: 40. padding replaceAll: (Character value: 0) with: $ . s := 'format me'. result := padding copy replaceFrom: 1 to: s size with: s. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Number formatting printf/sprintf for Squeak?
On Tue, Feb 17, 2009 at 11:44 AM, Michael van der Gulik mike...@gmail.comwrote: c := ScaledDecimal newFromNumber: 123.45 scale: 2. A better version (which I just discovered): c := 123.45s2. Gulik. -- http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] String construction and replacement
On Mon, Feb 2, 2009 at 8:46 AM, Sebastian Nozzi sebno...@googlemail.comwrote: Hello List, I've been struggling a bit with some basics about Strings for which I couldn't find an answer (yet). 1) How to construct a String from Characters? For example, I want to construct a String from the Chatacter literals: $H $I Character cr $T $H $E $R $E If you're dealing with less than four characters, you could do: a := String with: $H with: $I with: Character cr with: $T. Otherwise, I'm not aware of any trivial way to do this. The first issue is that you need to have all those characters available as a collection somehow (without using a String). My best effort, without adding convenience methods to the String class, is: a := #( $H $I $- $T $H $E $R $E ). Makes an array of literals - I never liked this syntax though You have to manually put the Character cr in there; I'm not aware of any way to declare it as a literal like that: a at: 3 put: Character cr. And then you can do Smalltalk magic with it: b := a inject: '' into: [ :each :sum | each, sum asString]. Makes 8 copies of a String; inefficient If there were more than just a handful of characters (e.g. writing to a file), then you'd want to use streams instead: c := WriteStream on: (String new: a size). It's important to make a good estimate of size here c nextPutAll: a. b := c contents. c is a stream with a String as a target, so nextPutAll: will accept any collection of characters and nextPut: will accept any individual character. 2) How to replace a sequence of Characters in a String for others? For exaple, I want to replace every 'HI' (in this case only one) for 'HELLO' in the String above (not necesarily destructively, getting a new String is also ok). Is there a quick way to do that?;; This is something that I don't know off the top of my head, so I'm going to give you a small insight as to how I work this out. First, I bring up the browser and intuitively go to the String class. I have a quick look at the method categories, and see converting and copying which might be useful. I notice copyReplaceTokens:with: which invokes copyReplaceAll:with:asTokens. I highlight the invocation of copyReplaceAll:with:asTokens and press alt-m to see which classes implement this. But then a little lightbulb goes off in my head; perhaps copyReplaceAll:with: exists. It does - in class SequencableCollection. I also discover replaceAll:with on a hunch as well, but it doesn't work and doesn't give any errors. A bug maybe? So you can do this: d := b copyReplaceAll: 'HI' with: 'HELLO'. Now, I know that there are also more advanced things you can do, such as replacing using regular expressions, but I think that is in a downloadable package somewhere. You'll need to Google for it. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] closed and open interval
On Tue, Nov 25, 2008 at 5:46 AM, Randal L. Schwartz [EMAIL PROTECTED]wrote: Filip == Filip Malczak [EMAIL PROTECTED] writes: Filip You can always make subclass of Interval for example OpenedInterval , add Filip two variables: left and right.Make new methods: OpenedInterval from: aNumber to: aNumber left: aBoolean OpenedInterval from: aNumber to: aNumber right: aBoolean OpenedInterval from: aNumber to: aNumber left: aBoolean right: aBoolean You're exposing implementation there. I suggest: beOpenLeft beClosedLeft isOpenLeft isClosedLeft and the corresponding right methods, rather than an explicit boolean. More flexibility later. Or how about a := 1 to: ∞. If you add the Unicode symbol for infinity as a global variable, it seems to work okay. You just need to choose a font which has that symbol. Alternatively, you could be boring and use a name like Infinity. Now, the implementation would be most interesting :-). You could go a bit further and make infinity a valid number to use in code. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Hi there! (and my first problem)
On Tue, Nov 25, 2008 at 5:25 AM, Filip Malczak [EMAIL PROTECTED] wrote: 2008/11/23 Filip Malczak [EMAIL PROTECTED] Hi, Im Filip, and Im new at squeak. Ive read 'Squeak by example', and now I try to make my first program. Ive already written in Pascal and a bit (really small bit) of C. Im from Poland, so my english can by not realy good. Now time for my problem: I wanna write a program to write notes on stave (for music). Later Im gonna add translating notes into tabulatures for guitar, and later - for flute. But I begin with just notes. I started from creating object 'Pieciolinia' which is stave (in polish). Then I found out I need some tool to change metrum (Im not sure if its the same in english and polish, its speed of song, written on begining of stave, just after treble clef). So I made class 'TempoButton' which is expected to contain 3 smaller buttons: gora, dol strzalka. gora is top number of metrum, dol - bottom number and strzalka is button to show a list of usual metrums (you click it and you have a list). gora and dol should open FillInTheBlank and change itself captions to what is written by user, and strzalka should open a PopUpMenu with list of some metrums. Then I created class 'SkladowyButton' which is my version of Basic Button (I wasnt able to find out how to handle with it, so I tried to create new one. And I could make up my own outlook for button). Ive written some methods, but when I try to execute (do it with ctrl+d): but:=TempoButton new. but drawOn: World. I have debugger as on zrzut1.jpg (I send it). Hi Filip. You're calling bounds: on a Rectangle, which it doesn't understand. Open up a Browser and find the Rectangle class. This will show all the method selectors that Rectangle understands. If you bring up a halo for any morph on the screen (middle-click, right-click alt-click or whatever depending on platform), select Debug and then inspect morph, then type in self bounds in the text space at the bottom of the inspector window and press alt-i, you'll see that calling bounds on any Morph instance returns a Rectangle. So, in your code, you can simply do: rec := aMorph bounds. Or even more simply, remove the rec instance variable and do: aCanvas fillRectangle: (self bounds) color: (self color). I like using parenthesis to make the arguments stand out more. You don't need them if you don't want them. Note also that Rectangle is an immutable class. Its methods return copies of itself. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Webteam info
Because we're all at work, procrastinating on the Squeak mailing lists :-P. Gulik. On Wed, Nov 19, 2008 at 11:10 AM, Rob Rothwell [EMAIL PROTECTED]wrote: How is it possible that things happen faster around here than they do in most businesses? Take care! Rob On Tue, Nov 18, 2008 at 4:34 PM, Brad Fuller [EMAIL PROTECTED]wrote: On Tue, Nov 18, 2008 at 12:49 PM, Rob Rothwell [EMAIL PROTECTED] wrote: Is there anyone out there that can pass this on to the Webteam list? I just didn't feel like subscribing to one more list, but I thought that the link to Damien's dev images should be changed. It is currently: http://damien.cassou.free.fr/squeak-dev.html, but should be changed to: http://damiencassou.seasidehosting.st/Smalltalk/squeak-dev Take care, Rob ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners updated -- Brad Fuller ___ 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 -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Morphic Layout
On Thu, Oct 30, 2008 at 9:32 AM, Gauland, Michael [EMAIL PROTECTED] wrote: Can anyone help me learn the 'modern' way of laying out morphs? I'm trying to create a stack-based ('RPN') calculate in Squeak (more as a way of learning the language and environment than because the world needs another calculator). I've been digging through 'Squeak: Open Personal Computing and Multimedia, which is a bit dated. The section on Morphic recommends using 'AlignmentMorph', but the comments for this class (in Squeak 3.10) suggest it is no longer needed. So, what is the best way to layout a set of morphs? At least for now, all I need is a grid of buttons, that will look sensible when the parent calculator morph is resized. Just use AlignmentMorph. I don't understand any of the comments about it being deprecated. AlignmentMorph is still used throughout the image and works well enough. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] UI not threaded?
On Tue, Oct 28, 2008 at 4:05 PM, Greg Buchholz [EMAIL PROTECTED]wrote: I notice that the system isn't responsive when something else is running (for example, while starting up an application like SqueakMap). Can anyone point me in the direction of a document describing Squeak's theory of operation when it comes to threads and/or the user interface? Is Squeak a cooperative multi-tasking system, or is the UI single threaded, or...? I don't know about documentation, but I can tell you what I know. Smalltalk, the language rather than implementations, has good support for multitasking and is (in my opinion) one of the best languages for doing concurrent programming. The Squeak VM unfortunately only runs on a single OS process. It can't use multiple CPU cores. I believe this is the case for all other available Smalltalk VMs except for GemStone? The VM does simulate multiple green threads. In your code, you can do: [ some code ] fork. Which will create another process to run some code in parallel. There are semaphores available for synchronisation and higher-level abstractions can be built. However, the scheduler that Squeak uses doesn't perform very well and code can easily be starved of CPU time. Like Bert said, Morphic is, unfortunately, single-threaded. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] squeak.org unavailable?
On Wed, Oct 22, 2008 at 9:18 AM, rickm45 [EMAIL PROTECTED] wrote: I have been trying to access http://www.squeak.org over the past week and always get 10061 - Connection refused. Firefox or IE. I can access news.squeak.org though but not the others, ie, map.squeak.org, etc. I've tried from work and home with the same result. http://downforeveryoneorjustme.com/squeak.org tells me it doesn't recognize squeak.org. Am I the only one having a problem? I'm trying to get to the download page among other things. The community server was down from last Friday (supposibly bad RAM?). It should be working again now. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] anti-aliased fonts.
On Thu, Oct 23, 2008 at 9:16 AM, sergio [EMAIL PROTECTED] wrote: hi all.. i just decided this week to learn squeak.. actually, i am doing the following.. learn squeak.. learn smalltalk.. with the end game to learn seaside.. anyway.. i was wondering if there was any way to make the fonts look a little nicer in squeak.. i know it's kind of a gripe.. but it would be cool if i could get them to look pretty... Well, with the whole system being open source, there is definitely a way, but it probably isn't an easy way. You can load new fonts using the file list. You can change the fonts used using appearance - system fonts However, as to using nice sub-pixel antialiased fonts on LCD screens, I personally haven't managed to get this going (not that I've tried hard). I find the default fonts readable enough, so it's never been an issue for me. Anybody else? Is there a way to get sub-pixel antialiasing working? Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to create new exception
On Wed, Oct 15, 2008 at 5:22 PM, Alex Chi [EMAIL PROTECTED] wrote: Sorry for the that, I mean my problem is I put the exception in the wrong part of my program, so everytime I try to call it in the method it does not return the exception, so what i did was: 1. Create an new exception class, which is: FileNotFoundError Smalltalk.Core defineClass: #FileNotFound superclass: #{Core.Error} indexedType: #none private: false instanceVariableNames: '' classInstanceVariableNames: '' imports: '' category: '' 2. I use that new exception to raise signal on a FileNotFoundError. fileNotFound ^FileNotFound raiseSignal: 'The file is not exist' Which version of Smalltalk are you using? This doesn't look like Squeak to me. If you want an Exception object, you could just return a new instance: fileNotFound ^ FileDoesNotExistException new. Although this method is pretty pointless. I think you're misunderstanding how Exceptions work; you need to do more reading. I'm not sure if Smalltalk Exceptions are well documented anywhere, but I do know that they work in a similar way to exceptions in other programming languages such as Java or Python, so you could Google or get books from a library that describe these. Briefly, Exceptions are intended for handling situations where something goes wrong. See FileDoesNotExistException classexample for an example. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] learning Morphic
On Sat, Oct 11, 2008 at 1:59 AM, Mark Volkmann [EMAIL PROTECTED] wrote: My GUI programming background is mainly Java Swing. I'm trying to get a feel for programming with Morphic. Browsing through the list of classes, I'm not seeing lots of basic things I'd expect. Maybe Morphic is dramatically different. I'm trying to find basic things like text fields, checkboxes, radio buttons, push buttons, lists, tables, trees, etc. I've searched for Morphic tutorials. Most seem to focus on custom graphics rather than these basic GUI widgets. Where should I start? Yea, they're... er... not there. IMHO Squeak has only rudimentary support for GUIs, despite people raving about Morphic. I tried with Morphic and gave up. For simple stuff, it works okay. If you do more complex stuff, you end up wasting too much time making stuff work. And then when it does work, it looks like... Morphic. I now use ToolBuilder; it should be installed in your image. It was originally written as a cross-platform base for making all the Squeak tools work on Morphic, MVC, Tweak etc, and was originally designed only to have enough functionality to make the basic Squeak tools work. There's some example code but otherwise no documentation as far as I know. If you want me to, I could write some documentation for it. There's also wxSqueak and SqueakGTK, which use native widgets. I don't know much about them. You could also use Seaside to make web applications which look like anything else does in a web browser, but then you'll be in the unfortunate position of making a GUI using a markup language originally designed for sharing hyperlinked documents over a stateless network protocol. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] navigating the system browser without clicking
On Sat, Oct 11, 2008 at 7:00 AM, Joel Turnbull [EMAIL PROTECTED] wrote: How do I navigate b/t the various panes of the system browser without mouse clicking? Good question. I always use the mouse. Anybody? Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Fileupload
On Fri, Oct 10, 2008 at 1:29 AM, Riaan van Aarde - Specon Eng [EMAIL PROTECTED] wrote: Is there any way that I can limit fileupload size. I have a document upload function, but would like to limit the filesize to about 5mb. Can anyone please assist me. Well, we'd be able to assist you if you would tell us what software you want support on. Are you running a wiki or something? Or did you write the software yourself? Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Best data structure for a multidimensional database?
On Wed, Oct 8, 2008 at 4:38 AM, stan shepherd [EMAIL PROTECTED] wrote: Hi, I'm looking at building a small proof of concept of a multidimensional modelling tool in Squeak. Commercial products are things like Cognos, and the old Express that was assimilated by Oracle. A typical 'cube' will be 'dimensioned' by product, region, time. Each dimension has one or more roll-ups, e.g. All Ice Creams / \ Cornetto Tub / | \ C. Raspberry C. Vanilla C. Chocolate Then sales data would be entered for the lowest level, then rolled up over the product hierarchy, the region hierarchy, the time hierarchy. From there, you can ask qusetions like what's the year on year change in sales of Cornetto for Western Europe. Two data structures spring to mind: 1) Use nested dictionaries for the dimensions, so that from the sales cube we select the dictionary entry for Cornetto, then from there the entry for Western Europe, then the two entries for this year to date and last year to date, being actual numbers. 2) Give each dimension element a numerical index, eg Cornetto is product no 451 in the product dimension. Sales then becomes a single dictionary where we calculate the index as product number + (region number * number of products) + (period number * number of products * number of regions) no 2) sounds faster, but no 1) sounds Squeakier. Does anyone have any advice as to how best to do this? Options 3) etc also welcome. I daresay the correct answer is to do both and see which works best, but I suspect there are some obvious gotchas I'm not seeing. I'd probably start by looking at how existing multidimensional databases store their data structures, and then try to turn that into objects. Unfortunately, I don't have any experience with this. What I would do is have a huge unsorted god-collection which has DimensionalData objects in it. This would be a place just to get the data into the image in the first place. Each DimensionalData object would store a list of dimension coordinates and then the actual data... somehow. So you'd have an object that would contain: (Chocolate ice cream, Region 123, October 4 at 2pm, 4 ice creams sold). Each of these would contain a point in the dimensional space. Then I would start trying to find some way of creating indexs (in the SQL sense) over this raw unsorted data. You could then use these indexes to do queries. Each type of query would need a particular type of index, so you'd have a lot of fun trying to write reusable code for this. If hierarchies are used quite a lot, then I'd probably try to make a Tree class with a parent, children and iteration methods (cf: Collection et al). Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] first use of Monticello
You'll have to run through the usually network debugging routine: 1. Is your computer turned on? 2. Is your network cable plugged in? 3. Can you reach http://squeaksource.com/ with a web browser from the same host as the image? 4. Are people on IRC ranting about SqueakSource being down again? 5. Can you ping http://squeaksource.com/ from Squeak?: Socket pingPorts: #(80) on: 'squeaksource.com' timeOutSecs: 30. 6. Can you load packages using Monticello from http://squeaksource.com/? ...etc. Gulik. On Sun, Oct 5, 2008 at 1:49 PM, Mark Volkmann [EMAIL PROTECTED] wrote: I'm trying to save a package to squeaksource for the first time using a Monticello Browser. I get ConnectionTimedOut: send data timeout; data not sent. I created the project at squeaksource.com already. --- Mark Volkmann ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] enumerated types
On Mon, Oct 6, 2008 at 2:19 PM, Mark Volkmann [EMAIL PROTECTED] wrote: Have I summarized this correctly? Smalltalk doesn't support the concept of enumerated types like in Java 5 and above. Instead, the Smalltalk way is to: snip What are you using enums for? I've never found I've needed them, often because the need for them can be refactored away and you end up with cleaner code. Often I just use symbols (i.e. #red, #blue, #green). These are generic descriptive names for thingies. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] enumerated types
On Mon, Oct 6, 2008 at 2:48 PM, Mark Volkmann [EMAIL PROTECTED] wrote: On Oct 5, 2008, at 8:38 PM, Michael van der Gulik wrote: What are you using enums for? I've never found I've needed them, often because the need for them can be refactored away and you end up with cleaner code. Often I just use symbols (i.e. #red, #blue, #green). These are generic descriptive names for thingies. I haven't used them yet in Smalltalk, but I'm thinking I'll have a need to verify that a value passed to a method is a member of a confined set. Maybe I should just test a symbol passed as an argument to a method to see if it's in an array of allowed symbols. Well, there are simpler ways of doing that such as: isMemberOfConfinedSet: anArg (ValidValues includes: anArg) ifFalse: [self error: 'foo']. ... Where ValidValues is a class variable and a Collection of valid values. Alternatively, a more Smalltalkish way that I don't like: isMemberOfConfinedSet: anArg (anArg isSomething) ifFalse: [self error: 'foo']. Where isSomething is implemented to return true on all objects that could be a member. This method I find rather intrusive, especially if implemented on core classes like Object and String, but does run very fast because a simple method that just returns true has special optimisations in the VM. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: exception handling lingo
On Wed, Oct 1, 2008 at 7:34 AM, nicolas cellier [EMAIL PROTECTED]wrote: Mark Volkmann a écrit : I asked this earlier, but it wasn't the first question in my email, so it may have been overlooked. In Smalltalk lingo is it correct to say signal and handle in place of Java's throw and catch? --- Mark Volkmann He, nobody answering, seems you reached some kind of quota ;) Nah. Mark: don't stop asking questions; I've learned stuff myself from some of the answers. If you haven't already, jump on IRC (Freenode, #squeak) and ask stuff there too. I'm not sure there's a common lingo in the community for talking about exceptions. Personally, I haven't used them as much as I should and I think that applies to most Smalltalkers. signal can be a bit confusing because we also signal semaphores. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] changing fonts
On Mon, Sep 29, 2008 at 2:23 PM, Mark Volkmann [EMAIL PROTECTED] wrote: I'd like to try a different font, at least for the edit pane in the browser. When I select appearance...system fonts...default text font from the World menu, I see fonts from Accuat to ComicSansMS ... only 13 fonts. How do I get to fonts after ComicSansMS? Hi Mark. You need to install them first. Download a font from somewhere (e.g. a .ttf file), and select it in Squeak's file list tool. You can then install the font and start using it. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Windows
On Thu, Aug 14, 2008 at 1:28 PM, Roger Thedog [EMAIL PROTECTED] wrote: I have looked at a couple of tutorials for Morphic but they are pretty low level. Is there a guide or a framework I can look at for writing windows that you would typically expect to see in a corporate application environment? Morphic is a bit ugly (visually and architecturally) for creating a corporate application. You could, in theory, do it, but I've never had fun using Morphic directly. I use ToolBuilder instead. Like David Zmick said, wxSqueak and GTK for Squeak exist. I don't know much about them. The best option, using Squeak, is to look at Seaside for making web-based applications. http://www.seaside.st/. Web based applications seem to be all the craze these days. Otherwise, for a commercial application with a real GUI rather than a web-based one(*), it's probably better to use a commercial Smalltalk. http://www.smalltalk.org/ has a list of them. I've heard that VisualWorks is quite good, although other people may suggest others. Gulik. (*) The implication that web-based GUIs are fake is my opinion only. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Linked list structure?
On Mon, Jul 28, 2008 at 2:27 PM, Marcin Tustin [EMAIL PROTECTED] wrote: Is there - either as standard, or freely downloadable - a datastructure that is ordered, has constant-time appends of items, requires no particular protocol of the items stored, and can be iterated over (without allocating a new structure) starting with the first item added, proceeding to the next item added? I.e. has the characteristics of a linked list structure in most other datastructure libraries? I believe it's called an OrderedCollection, and it's in every Smalltalk image you'll find(*). I recommend reading through Chapter 9 of Squeak by Example (under Documentation on http://www.squeak.org/). It give a good explanation of Squeak collections and how to use them. Gulik. (*) Perhaps except for Craig Latta's 1337-byte image. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] What is a weak reference
On Mon, 14 Jul 2008 12:07:51 +0200 Michael Davies [EMAIL PROTECTED] wrote: On Sun, Jul 13, 2008 at 6:15 PM, Rob Rothwell [EMAIL PROTECTED] wrote: Can someone explain what a weak vs (I am guessing) strong reference is? [snip] I, too, am maintaining parent/child relationships in my application and have just been doing something like: ParentcreateChild |child| child := Child new parent: self. ^child I am assuming, given my troubles, that this is NOT a weak reference?! Hi Rob, Have a look at the class comment on WeakArray: WeakArray is an array which holds only weakly on its elements. This means whenever an object is only referenced by instances of WeakArray it will be garbage collected. My understanding of this is that garbage collection is done by reference counting, and so the situation you described may result in parent and child forming a circular reference to each other, and so never being collected - but it depends on what you do with that return value. Squeak's garbage collector is a generational mark/sweep garbage collector. It does not use reference counting. http://wiki.squeak.org/squeak/1469 (unfortunately the page has a dead URL in it). Gulik. -- Michael van der Gulik [EMAIL PROTECTED] ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Left-arrow for assignment
On Mon, 14 Jul 2008 19:54:38 -0400 Dominic Espinosa [EMAIL PROTECTED] wrote: On Tue, Jul 15, 2008 at 11:40:58AM +1200, Michael van der Gulik wrote: On Mon, 14 Jul 2008 01:20:25 -0400 Dominic Espinosa [EMAIL PROTECTED] wrote: Indeed, using '_' for assignment seems repugnant to a lot of people. Some of the debate in the previous swiki link focused on this aspect, and the issues in having '_' have such a non-standard meaning in Squeak, as well as the need to use '_' in circumstances other than assignment. Maybe left-arrow could be internally represented as ':=', filed-out as ':=', etc, but displayed as left-arrow according to preferences. Additionally, a key-binding could be used for inserting the left-arrow while typing. I'm not sure what kinds of issues this would raise in how source code is represented; I recall someone saying that the representation would have to change significantly for this to work. But perhaps there's an easy way to do it? Meh. := works fine for me. Gulik. -- Michael van der Gulik [EMAIL PROTECTED] ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Application data management
On Thu, 10 Jul 2008 09:59:06 +0200 Felix Dorner [EMAIL PROTECTED] wrote: Hi, I am thinking of how application data is best persisted in squeak apps. Probably I have problems in distinguishing the Squeak platform and my Application. If I see my application as a part of squeak, then I guess there's no need for custom resource management - as soon as a user does save.. all is saved automatically, including my app data (here its just a list of filenames). Is that the intended way? Or is Save... intended for developing only? Gee squeak is really different. Well... that's referred to as Image based persistence :-). And yes, it is one way of persisting user's data. Some people here store lots of information in their images - presentations, stuff they type up, small prototype apps, etc. It's certainly not just for developers. Otherwise, I could do it all manually, persist my data to somehomedir/.myappdata If you want to get serious, there are other options for persisting image data. Google for Magma and GOODS. How can I get the current user home? Er... that's a hard one. I actually don't know. I'd probably start by installing the OSProcess package which might have something like that. I've had a quick look in my image and can't find anything. Anybody else know? Gulik. -- Michael van der Gulik [EMAIL PROTECTED] ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] more of a general smalltalk question
On Wed, Jul 9, 2008 at 12:53 PM, Hanita Bte Abd Hamid [EMAIL PROTECTED] wrote: Can someone please remove me frrom this list ? Hi Hanita. Go to the website listed at the bottom of each email; you can remove yourself there: ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Totally dumbfounded!!
On Fri, 4 Jul 2008 14:04:52 +0800 Stephen Ng [EMAIL PROTECTED] wrote: Hi everyone, First off, I am really new to smalltalk. I have tons of experience with languages like C but have never made the move to OO type languages. Secondly, I've been reading up as much as I can on OO concepts and perhaps I can say that I feel comfortable with smalltalk syntax. My question is how does one start learning about the MVC or Morphic interfaces in order to use smalltalk in writing programs that make use of lots of windows with text fields etc like in traditional business systems? I cannot seem to find complete info on these topics. Many tutorials just spend lots of time painting pretty lines and patterns and fall short of showing someone like me how best to use the MVC, Graphics-* or Morphic-* class categories and their classes. I understand Morphic is the new wave as far as Squeak is concerned and I would be just as happy to use it. However, all the literature on the web is really disparate and does not approach the subject in a holistic way. I've even tried looking at the classes themselves in the Browser but the whole thing just gets very confusing. I'd appreciate it if anyone can provide some pointers, direction, literature (up to date with Squeak) etc. Hi Stephen. Welcome to the community! For traditional business programs in Squeak, I think that Morphic is the hard way to do it. I tried, made a bit of progress but then gave up in disgust. What I recommend is that you start from our documentation page - http://www.squeak.org/Documentation/. The book to read is Squeak By Example. For business information system development, I'd recommend getting in to web development using Seaside: http://www.seaside.st/. Your applications in this environment will look a lot more professional than they would in Morphic. And do ask questions here, or join us on the IRC channel on freenode.net, #squeak. Often there are people there :-). Gulik. -- Michael van der Gulik [EMAIL PROTECTED] ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Ubuntu and Squeak
On Fri, Jun 6, 2008 at 12:46 PM, Hanita Bte Abd Hamid [EMAIL PROTECTED] wrote: Im sorry,but this mail belongs to my work. I can't handle too much emails. How do I unsubscibe and change the subscribe mailing address. First, you look at the signature at the bottom of this email. It looks like this: ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners You go to that URL. At the bottom of that page are instructions for unsubscribing. Then you make a GMail account and subscribe yourself there :-). Gulik -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Ubuntu and Squeak
On Thu, Jun 5, 2008 at 10:07 AM, Rob Rothwell [EMAIL PROTECTED] wrote: Ok...so we sort of got Ubuntu running on a server...which VM should I go get? (Yes, I am so NOT Linux-enabled at this particular time...) Hi Rob. It depends on your architecture. If you're just running on 32-bit x86, you can just use the latest Linux VM from http://www.squeak.org/Download. Here's a direct link, because I'm such a nice guy and my browser is open on it anyway: http://ftp.squeak.org/3.10/unix-linux/Squeak-3.10-1.i686-pc-linux-gnu.tar.gz IIRC there may be a VM that is installable from Ubuntu's package manager. That would work as well. If you installed the AMD64 bit version of Ubuntu, then things are a bit trickier. Then you'll need to look at http://www.squeakvm.org/. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Sound
On Wed, May 28, 2008 at 1:19 AM, Jeffery Billing [EMAIL PROTECTED] wrote: Chris, I followed your instructions and at one point in the proceedings everything worked. I then found that whatever I did it would not work - so don't know what happened. I have spent 6 hours on this so will try again tomorrow with a fresh brain. At least I know it will work!!! so some progress. Wow... I wish I had a full 6 hours to work on Squeak! Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Namespaces
On Wed, Apr 30, 2008 at 11:53 PM, Pinku Surana [EMAIL PROTECTED] wrote: What is the current state of namespaces in Squeak? Is there a programming convention to prevent name clashes? Sorry for the slow reply. I haven't been on this list much lately. I'm actively developing a proper Namespaces solution that runs on Squeak; the tools currently work although they're pretty rough, and I'm currently writing tests and fixing bugs. See http://gulik.pbwiki.com/Namespaces and http://gulik.pbwiki.com/Packages for more info. Why do you ask? Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Magma and Tweak
On Thu, Apr 10, 2008 at 2:37 PM, Dr Keith A. Morneau [EMAIL PROTECTED] wrote: Hi, I am trying to creating an image with tweak and magma on it. I have tried multiple things and I can not get both on the same image. I can get magma on a the current build but not tweak. I can get tweak on a earlier image but not magma. Any help would be appreciated. Could you be more specific about the problems you are seeing? What is failing? Also, why do you want Tweak and Magma in the same image? Perhaps there is a better solution for your needs? Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] authenticating Squeak to a proxy
On Tue, Apr 1, 2008 at 12:28 PM, [EMAIL PROTECTED] wrote: Hello, I am new to Squeak (but not OO programming), and reading the Squeak by Example book, but I can't figure out how to get Squeak to use a proxy that requires authentication. When at home, this is not a problem, but at my school, I can only access the Internet through an HTTP proxy, and it requires that each student enter his or her username and password. I've found where in Squeak I need to tell it what port to use, and the server name, but there's nothing there for a username or passkey. Is there a way to tell Squeak to authenticate itself as a particular user? Hi Aidan. Try this: HTTPSocket clearProxyUserPassword. HTTPSocket useProxyServerNamed: 'my.proxy.server' port: 80. HTTPSocket proxyUser: 'myUserID' password: 'myPassword'. Also, you can manually download packages using a web browser and install them using Squeak's file browser. If it doesn't work, email me back and I'll have a proper look this evening (NZ time). Gulik (in Wellington). -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Project Ideas
On Sat, 22 Mar 2008 14:37:44 -0500 David Zmick [EMAIL PROTECTED] wrote: This has been sent to both the Squeak-dev list and the squeak beginners list For those of you that don't know me, I am a 14 year old programmer. I want to write something useful, but I don't have any ideas! I have always had this problem, with any language, and, all of the problems that have been going around on the mailing lists seem to hard for me to work on, as I am not very proficient as a developer and I am looking for some easy beginner projects! Thank you in advance! Write a game! Pick a genre that you like, or make one up (if you're really creative!). Games can be more fun to write than they are to play, and I think that Squeak should be able to handle 2-D graphics quite well if you use BitBlt and Forms directly. Gulik. -- Michael van der Gulik [EMAIL PROTECTED] ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Headless Squeak on Redhat - HELP!
On Tue, Mar 4, 2008 at 1:16 PM, albegadeep [EMAIL PROTECTED] wrote: I have a small (P3) server running Redhat, and I'm trying to get Squeak running on it. Since there's no monitor, and the graphics subsystem isn't started in the usual runlevel, I need to run Squeak headless. I put image and change file into a directory (read, write, owned by user A) that should copy a couple of files when run, using Smalltalk addToStartUpList: MyClass. I load it up in Windows, and it works fine. I load it in Linux: [EMAIL PROTECTED] A]# squeak -headless The cursor goes to the next line, and nothing happens. Any idea what's going wrong? How do I correct it? I will happily furnish any other info or troubleshooting that is needed. Unfortunately all our psychics are busy working out the Lottery results for me for this coming Saturday, so you're going to have to do some diagnosis yourself :-P. It sounds like your image is starting up fine; a cursor on the next line is all I'd expect. Have you checked to make sure the files aren't actually been copied and that everything is working fine? Have you checked the obvious things, such as running it in headless mode under your development environment (your Windows machine) to see if it behaves the way you expect? My initial suspicion is that something platform-related isn't working - permissions, directories that don't exist, the current working directory is wrong, a plugin is missing, or something like that. I can think of several paths forward. Either: - Use OSProcess to write debugging information to stdout, or a logging solution like writing directly to a log file or using Toothpick. - Install VNC on the image and access it from another host to diagnose the problem. - If the X11 libraries are installed on your server, grab the Cygwin X server and ssh client, ssh -X to your linux server and run Squeak with the GUI that way. - Use REPLServer (which I wrote, so I'm biased ;-) ) to access the remote image and work out what's happening. I'm assuming you're able to find each of these packages using Google and common sense. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Squeak for the Asus eee
Would you please report this on bugs.squeak.org under the VM category? Cheers, Gulik. On Tue, Mar 4, 2008 at 5:18 AM, Rezza [EMAIL PROTECTED] wrote: It's segfaulting because of missing /proc/self/exe - binfmt module. EEE has stripped kernel :( readlink(/proc/self/exe, unfinished ... +++ killed by SIGSEGV +++ Process 22651 detached R. Michael van der Gulik-2 wrote: On Dec 30, 2007 4:26 PM, [EMAIL PROTECTED] wrote: Does anyone know where there is a version of Squeak that will install on the Asus eee? I tried the debian and generic linux version and they dont install/work. The debian version wong apt-install. It complains about missing binfmt-support dependency. The linux version segfaults. The standard Linux version shouldn't segfault. AFAIK, the Asus EEE (which I'd like to have one of if anybody feels like donating them :-) ) is a standard i386 running modified Xandros Linux. Could you provide more information about how it crashes? Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners -- View this message in context: http://www.nabble.com/Squeak-for-the-Asus-eee-tp14544063p15807347.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 -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Method category tags
On 2/26/08, cdrick [EMAIL PROTECTED] wrote: Hi In a recent post, Matthew Fulmer explained how categories work... and I don't really see why they exist this way... Can someone explain me (historical reason, etc...)? The only reason I could think of would be for speed. In the olden days, Smalltalk systems ran very slow, so code was often written in an inelegant but fast manner to get good performance. I don't believe that the categories have been refactored much since they were originally designed back in the 80s. Otherwise - yea, they're yuck. They would be difficult to refactor it in the squeak.org image because a lot of projects (namely, various browsers and tools) depend on their implementation. Matthew also said we could adopt Namespace/Category like Gulik's work on namespaces, as Namespaces are much like reified Categories. My namespaces implementation replaces class categories, but doesn't (yet) do anything with method categories. I might leave method categories as they are for the meanwhile; it would be a low-priority refactoring to change them. I'm never going to advocate integrating my Namespaces implementation into the squeak.org image. It would be a bad idea -- squeak.org needs to remain compatible with the large base of code out there, and my Namespaces solution breaks backwards compatibility. Instead, I'm making a fork of Squeak called SecureSqueak which will use Namespaces extensively. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: Looking back... (was Re: [Newbies] How to empty a collection?)
On Feb 20, 2008 8:47 AM, [EMAIL PROTECTED] wrote: Hi Goran! I just want to point out that the long links in your mail were broken for me (although a little cut and paste fixed that). Perhaps a service like tinyURL would be useful when sending long links from the dark and distant past. I have noticed in this thread an undertone of #become is the Devil's playground Could someone succinctly explain to someone who is a coarse and styless programmer like myself why this is so, and when its use is justified? Hi John the Newbie. It would be appreciated if you replied under a quoted message rather than above it. I've just sent an email in the original thread about this. It's use would only be justified if there are no other options. I've used it myself in my remote object architecture[1] for converting a message-capturing object proxy into the original object when an object is migrated between computers. My intention was to keep the remoteness of the objects involved as hidden as possible, making the use of #become: necessary. In retrospect, it was a big and dangerous time-waster. Many images died to bring me this information. Originally, the Collections framework in Squeak used become: to grow some collections. The blue book design of the Smalltalk VM[2] has an object lookup table where the implementation of #become: was very fast - switch a single pointer. The Squeak VM uses direct pointers between objects now, so the entire object memory needs to be scanned. [1] http://www.gulik.co.nz/dpon_design.pdf, http://www.squeaksource.com/DPON . [2] http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_imp_toc.html Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to empty a collection?
On Feb 20, 2008 8:09 AM, Randal L. Schwartz [EMAIL PROTECTED] wrote: goran == goran [EMAIL PROTECTED] writes: I'd just do: removeAll self notEmpty ifTrue: [self become: self species new]. and let subclasses make it more efficient using implementation knowledge. goran I would never use become: in regular code like this. :) First, how regular is it if the method hasn't been missed by anyone in 27 years. :) Second, what are you objecting to? #become: is clearly a part of the image, and works fine. This code also cleans out a grown collection to be the smallest it possiby can become, where delete-one-at-a-time solutions don't. #become: and its friends are voodoo. Don't use them in your code unless you have absolutely no other option. It doesn't work fine. It breaks code that relies on hashes; specifically, a Dictionary elsewhere in your image can start acting screwy if you do a #become: variant that doesn't preserve an object's hash. See #becomeForwardcopyHash:. You would then also be relying on a Squeakish behaviour and your code would become less portable across Smalltalk dialects. They are also a fantastic way to introduce bugs of various sorts, and can even cause an image to crash (as in, stack trace and exit to the OS). Say, for example, that one of the arguments you pass is accidently nil, true or false? Your image would continue working... for a while. #become: and variants are also very slow and causes the equivalent of a full GC on every invocation. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Recap: How to empty a collection
On Feb 20, 2008 2:17 PM, nicolas cellier [EMAIL PROTECTED] wrote: Blake a écrit : On Tue, 19 Feb 2008 15:59:57 -0800, nicolas cellier [EMAIL PROTECTED] wrote: snip Could we please move this discussion to squeak-dev please? We're going to scare the beginners. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] 1-way #become: ?
See becomeForward: Gulik. On Feb 19, 2008 4:59 PM, itsme213 [EMAIL PROTECTED] wrote: #become: apparently (effectively) swaps object ids. Is there anything like x oneWayBecome: y that would pass this test: testOneWayBecome: x to: y | a b | a := x. b := y. x oneWayBecome: y. self assert: [x == y]. self assert: [a == y]. self assert: [b == y]. (Not related to my earlier collection empty question) Thanks - Sophie ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Morphic Questions
Hi Jeffrey. 24 hours and no answer, so I'll have a crack at your questions. Jeffrey Straszheim wrote: I have some basic intro questions on Morphic. I'm digging through the source code, and reading what I can find on the web, but it is quite a lot to take in. 1. Messages There seem to be at least 2 ways to handle messages with Morphic. The subclassing way, overriding methods such as *handlesMouseDown* and so on, and *on:send:to:* way. What are the differences between the two, and why would I prefer one over the other? Unless you come across problems, either way is good. A quick look at the code shows that if you override methods, you'll be overriding the implementation used by on:send:to to implement message sending. It seems your implementation would run faster if you override the methods. You might want to use on:send:to if you want your event handling logic to be in another object. 2. MorphicModel The MorphicModel class appears to be for morphs that implement the view side of MVC. However, I find the source rather confusing. What on earth is a *slotSelector*, for instance? And a method like *compileAccessForSlot* just leaves me baffled. What is this class for, and are there any simple examples of its use? Welcome to Squeak. You might find a lot of the source quite confusing; there are a lot of ancient relics, failed experiments and red herrings in the image. Just try to understand only as much as you need; trying to understand more will leave you either confused or disgusted. Note firstly that MorphicModel is a superclass of a whole host of other classes - open up the hierarchy browser and see! I believe it represents to some degree the model of the model-view-controller paradigm that Morphic was written to be so blissfully unaware of. As with a slot - never heard of them, and the source code is pretty non-obvious. It messes with reflection, so it's probably dodgy code. 3. PasteUpMorph I know that the screen background is a PasteUpMorph, but I see them mentioned elsewhere from time to time. What exactly is a PasteUpMorph? Would I ever want to use one? Is there a simple example? The PasteUpMorph class in Squeak 3.9 has a pretty good description. Try this: PasteUpMorph newWorldTesting Often you'll find test methods on the class side. These can be useful for just playing with the code to see what it does. The BitBlt class tends to be pretty fascinating in this regard :-). Also, again, look at the inheritance hierarchy (the hierarchy button in the browser) and you'll see its the superclass of a bunch of other interesting looking classes. Don't forget to visit us on IRC at #squeak. It's often quiet for long periods, but people do come and go and we like newbies there. Cheers, Gulik ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Screensaver detection
On Feb 13, 2008 10:53 AM, Uwe Loew [EMAIL PROTECTED] wrote: Hello squeak professionals, in our process monitoring software we use a background process to update the displayed values. breakFlag := false. delay := Delay forMilliseconds: 10. Processor fork: [ [ breakFlag ] whileFalse: [ backgroundProcess := true. Process is now active delay wait. .calling the GUI update methods displaying the measured values from the process delay wait. ]. backgroundProcess := false. Process is going to terminate ] at: Processor userPriority - 5 Processor is an instance of ProcessScheduler. Something in our GUI update software wastes memory and over some days crashes the system. So the user has to stop the background display process when leaving the system and to restart it when coming back. We now want to automate this switching on and off of the GUI updates by checking the screensaver status of windows. Our wish is to check in each update cycle, whether the windows-screensaver is on, and depending on this status, to update the GUI display or not. Can anybody of you give us a hint, how to check, whether windows has switched of the desktop-display and displaying the screensaver, or is still displaying the desktop containing the squeak window? Which OS? Windows, Mac, Linux, other? One option is to find and fix your memory leak. I haven't tried this before in Squeak (my applications crash much earlier than that :-P ), but I'd probably start by doing something like: Smalltalk collect: [ :each | (each isMemberOf: Class) ifTrue: [ each name, ': ', each allInstances size, ' instances' ]. (there might be a #numInstances method on Behavior; I don't have an image handy right now) Inspecting the result after running your program for some time might give some clues as to what is using up your memory. You could write a custom screensaver in C, or maybe even in Squeak if you're keen, and then that screensaver could somehow send a signal to your application - maybe using TCP/IP, or maybe sending a signal to Squeak (can Squeak capture POSIX signals?), or some other mechanism. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Debugging Squeak
On Jan 31, 2008 3:46 PM, K Chang [EMAIL PROTECTED] wrote: Hi, I was trying to make some modifications on Squeak. After some coding work,I found my Squeak now consumes almost 95% CPU time and more than 100M mem, and it seems like it won't slow down unless i close it. I've already saved the image and the CPU consuming problem comes out right after starting Squeak with out running any code I wrote, my question is, is there any debugging tools that i could find out which process or chunk of code is slowing down my squeak ? I've tried MessageTally,didn't work. Open up the process browser and enable the options Show CPU usage and Auto update. I can't remember exactly what all the names are, but you should be able to work it out. This shows you which process is using all the CPU, and you can suspend it, debug it or terminate it. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Reminder - Check your Squeak People Email or Sign up to vote
On Jan 17, 2008 8:26 AM, Ron Teitelbaum [EMAIL PROTECTED] wrote: Hi all, I thought I'd send out a reminder about the Squeak Foundation Board Elections. If you would like to vote in the upcoming Squeak Foundation Elections, you should check your email address on Squeak People. http://people.squeakfoundation.org/ . Please make sure you have access to your squeak people account, check that you included your name and that the supplied email is correct. If you need help accessing your account please let me know. This year, could we please have longer than a week between the announcement of the start of voting and the closing of the ballet boxes? Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Proxy objects
On Jan 11, 2008 12:19 PM, cnantais [EMAIL PROTECTED] wrote: Can someone recommend a good read on how to use proxy objects in Smalltalk? I'm trying to verify expectations about the messages that classes are receiving (as is done in rSpec, the Ruby BDD framework) and I think proxy objects may be the right pattern. Typically you'd make a subclass of ProtoObject and write a doesNotUnderstand: method that does what you want. However, this is fraught with many dangers and crashed images. Another way is to modify the virtual machine, which is the approach taken by Craig Latta's Spoon project. Try my MessageCapture package, from http://www.squeaksource.com/DPON. It contains a MessageCapture class. I can't remember exactly how it's used, but it's something like: m := MessageCapture captureFrom: anObject forwardTo: aReceiver. And then you implement a reciever object which implements some method like handleMessage: m. You'll have to read the source; it's been hours since I've touched this stuff so I can't remember what the actual methods were. This package contains a bunch of things which make it much easier to manage these message capturing objects, such as (mostly) being able to use the debugger and inspector on them. A message capture can't easily be stored in a dictionary, because the dictionary calls hash on it. As an effect of this, you can't use them in a workspace. Also, don't try using an Object Explorer on them. Sometimes alt-. may help, sometimes it won't. Also, save your code often and keep backups. Gulik. -- http://people.squeakfoundation.org/person/mikevdg http://gulik.pbwiki.com/ ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Low space
an organic wrote: Hello this looks as advice that i need. I download new session and run it, i see changes from my damaged image. Is possible load changes from damaged image to my new one - is it possible step by step? Yes. You select several of the changes you want made to your image (again) and click file in selections. I am not use monticello :(. I'd encourage you to learn about it! I keep all my code in Monticello; when I lose an image (which is often, because I abuse my images), I can load all my code into a new image. I'll be on IRC for the next 9 hours or so if you want more help. Gulik. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] squeak make back up of category
an organic wrote: Hello, i am writing small apllication in one category and i want make back up save current state of this category. I cant find how to do this, can anybody help me? Hi. What is your name? I don't really like the idea of addressing you by An organic... This is what Monticello is used for. Monticello is the version control system that nearly all Squeakers use. It takes a bit of learning, but is usually sufficient for the work you want to do. Monticello will put all classes in a category starting with you packages name, e.g. MyProject-Core, MyProject-Tests, and all methods in categories starting with an asterisk and the project name, e.g. *myproject-printing and *myproject-converting. There's some information about it here: http://wiki.squeak.org/squeak/1287 Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] simple server?
Yes; sorry about that. REPLServer has dependencies on other packages. If you use the UniversesBrowser from Squeak 3.10, it will load dependencies automatically for you. Michael. Don McLane wrote: Thanks Michael. My problem may have become immediately obvious when I tried to load REPLServer. I need TCPService. But where do I get that? It's not on SqueakMap. Google isn't helpful. Don p.s. I'm not IRC literate yet, but I'll look into that next. Michael van der Gulik wrote: Don McLane wrote: I'm trying to learn to write network objects in squeak. I read the chapter Networking Squeak by Parsia, Kerimbaev, and Spoon, from Mark Guzdials book. But I wanted to start at a more basic level. My first attempt is to write the simplest possible server. This server should wait for a connection, then print the first line sent to it, finally close. Unfortunately, it gets a primitive failed error. I got the same result on XP and Vista. Here's my code: | serverSocket connectionSocket | Socket initializeNetwork. serverSocket := Socket newTCP. serverSocket listenOn: 8080. connectionSocket := serverSocket accept. Transcript show: (connectionSocket upToAll: String crlf). connectionSocket close. serverSocket close. I found some old code for the PWS and looked around. It makes a ServerSocket object, but I can't find that class in my image (3.9-7067). If I do get a server socket to return a connection socket, is there a way to convert that socket into a SocketStream? Can anyone get me un-stuck? I've been trying to get past this for a couple evenings now. Hi Don. You'll be wanting to do: ss := SocketStream on: serverSocket. I would recommend looking at a simple network service. One I can think of is REPLServer, which is a telnet server, but there may be simpler ones out there for e.g. HTTP. Also, if you want faster help, I recommend joining the #squeak IRC channel. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] simple server?
Don McLane wrote: I'm trying to learn to write network objects in squeak. I read the chapter Networking Squeak by Parsia, Kerimbaev, and Spoon, from Mark Guzdials book. But I wanted to start at a more basic level. My first attempt is to write the simplest possible server. This server should wait for a connection, then print the first line sent to it, finally close. Unfortunately, it gets a primitive failed error. I got the same result on XP and Vista. Here's my code: | serverSocket connectionSocket | Socket initializeNetwork. serverSocket := Socket newTCP. serverSocket listenOn: 8080. connectionSocket := serverSocket accept. Transcript show: (connectionSocket upToAll: String crlf). connectionSocket close. serverSocket close. I found some old code for the PWS and looked around. It makes a ServerSocket object, but I can't find that class in my image (3.9-7067). If I do get a server socket to return a connection socket, is there a way to convert that socket into a SocketStream? Can anyone get me un-stuck? I've been trying to get past this for a couple evenings now. Hi Don. You'll be wanting to do: ss := SocketStream on: serverSocket. I would recommend looking at a simple network service. One I can think of is REPLServer, which is a telnet server, but there may be simpler ones out there for e.g. HTTP. Also, if you want faster help, I recommend joining the #squeak IRC channel. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Question / Thought about absence of any standard online help
itsme213 wrote: Is there some reason why the myriad tools in Squeak don't have even a placeholder button or menu item for online help? From my newbies point of view it is very frustrating to try to do something (refactor to extract a method with a parameter, most recently) and be confronted with a totally new editor (Selector editor, in this case) and not have any idea about what the panels and buttons mean (Up? Down? Ok?). I finally figured it out, but it took 15 minutes of blind trial and error. It is very disheartening and a huge hurdle for someone who wants to get started with Squeak. Shouldn't online help be a standard part of any IDE framework, making it easy for tool writers to add a few lines of online help in a standard way? Perhaps include some url links? Heck, if the tool even had a standard link (e.g. on SystemWindow) to a standard place on a Squeak wikis, anyone (even me) could contribute to the help. And yes, I know that getting those lines written is a separate matter. Hello... umm... Itsme. I've been using Squeak for a few years and I couldn't agree more. There are documentation and tutorials at: http://www.squeak.org/Documentation This page is the official page containing links to Squeak documentation. There are also books - the old Smalltalk books are still largely relevant, and the tools are still used in the same way. If you want to contribute, you can help with the documentation effort: http://wiki.squeak.org/squeak/2983 The community would also welcome code contributions, more documentation and discussions on the Squeak mailing list about this. As a group of volunteers, there's an endemic shortage of time to work on this sort of thing so any help is appreciated. Online help from within the Squeak environment would be very useful! Gulik. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] printing graphics in squeak
Hi Ching. Morphs draw themselves on Canvases - look at the Canvas class. Typically, these would be FormCanvas which draws to the screen. I think there is a Postscript-capable Canvas subclass. I'm not sure what it's called (PostscriptCanvas?). Google for Ghostscript for info on how to print postscript files if you don't have a postscript-capable printer (or if you aren't running Linux). Also try reverse-engineering the print command in the... menus? This will be a good exercise for you. Find the print command in a menu somewhere in squeak (probably in a halo menu for a Morph?), and open the halo on the menu itself, select explore or inspect and poke around to see if you can find where the code for the print command is. Sorry I can't give you specifics; I don't have squeak available right now. Michael. On 9/18/07, Ching de la Serna [EMAIL PROTECTED] wrote: Thanks David, I think I need to look at Morphs a little more closely for what I need to do which is to create some graphics (shapes, etc.) and send them to a printer. Ching On 9/18/07, David Mitchell [EMAIL PROTECTED] wrote: Do you mean charts and graphs? If so, check out PlotMorph. http://wiki.squeak.org/squeak/2626 On 9/17/07, Ching de la Serna [EMAIL PROTECTED] wrote: Hi, I would like to print graphics in Squeak. What classes do I need to do this? Many thanks in advance. Ching ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] printing graphics in squeak
Squeak isn't intimidating. It's cute and fluffy :-P. Michael. On 9/18/07, Ching de la Serna [EMAIL PROTECTED] wrote: Hi Michael, Thanks for the info. Squeak can be intimidating with its wealth of capabilities if you don't know where to look. I will sure be busy checking out your suggestions. Ching ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] The old inisqueak problem on Linux
Heiko Schroeder wrote: Dear list, perhaps some of you are aware of this old problem: Installing Squeak 3.9.8 under Linux by description is impossible. - the inisqueak command is missing - the author of the manpage ian pumarta presents a wrong address - a second one can be found in the INSTALL file which is wrong as well I reported this problem more than a year ago several times, but there has been no change up to now. It is a pity, since Squeak is that splendid. Hi Heiko. Which instructions are you following? Which package are you installing? Are you installing the package that comes with your Linux distribution or the one from http://squeak.org? I shall investigate this issue further and raise a bug report if there are problems. Regards, Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] The old inisqueak problem on Linux
Heiko Schroeder wrote: Dear list, perhaps some of you are aware of this old problem: Installing Squeak 3.9.8 under Linux by description is impossible. - the inisqueak command is missing - the author of the manpage ian pumarta presents a wrong address - a second one can be found in the INSTALL file which is wrong as well I reported this problem more than a year ago several times, but there has been no change up to now. It is a pity, since Squeak is that splendid. Regards Heiko This bug is currently open on our bug reporting system. If I find the time, I will fix it up. http://bugs.squeak.org/view.php?id=6368 Let me know if you find any more issues. Regards, Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Mod operator?
Matthew Fulmer wrote: On Sat, Aug 11, 2007 at 11:05:54AM -0400, John Almberg wrote: Sorry for this simple question, but I can't seem to find the mod operator. As in, what's the remainder after doing division? Thanks: John For such questions, it is best to use the method finder: - Open method finder (world menu - open - method finder) - enter a mod expression ( such as 7 . 3 . 1 ) and hit enter - method finder gives several answers. Two of them are what you are looking for WOW!! That's just magic! I can't believe that I'm still finding more incredible features in Squeak after spending a couple of years immersed in it. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Dead keys on Ubuntu
Fahr Jahrel wrote: Hello, all-- I've been trying unsuccessfully for some hours to make my Squeak image accept diacritical characters under Ubuntu 7.04. I've tried all possible combinations of the -textenc, -encoding, and LC_CTYPE options I could but none worked. The diacritical characters either don't display or display incorrectly. Ironically, if I run Squeak via Wine, the diacritical characters display correctly. Any help pointing me to the right direction would be appreciated. My system configuration today is: Distro: Ubuntu 7.04 Squeak: 3.9-8 #5 Tue Oct 10 11:56:09 PDT 2006 gcc 4.0.3 Squeak3.9alpha of 4 July 2005 [latest update: #7021] Linux ubuntu 2.6.15-27-386 #1 PREEMPT Sat Sep 16 01:51:59 UTC 2006 i686 GNU/Linux default plugin location: /usr/local/lib/squeak/3.9-8/*.so Image: Tried with the vanilla 7067 image, the lasted squeak-dev image, and even Ramon Leon's image. :-) Hi Fahr. I'm using Ubuntu 7.04, and I tried the international characters using 3.9-7067. I set my keyboard to be US English International (with dead keys) (änd ít séëms tø wórk). I learned something new today - I've never played with international characters in Linux before. It worked mostly okay. The dead keys didn't work, but I could use the right-alt key to type in some pretty cool characters. The characters displayed fine. Try using a different font (appearance - system fonts). I'm no expert on this, but from what I know, Squeak can either use itś built-in font renderers or use the freetype library, and not all fonts have all characters in them. Otherwise could you be more specific about what is happening? Are you having trouble typing in the characters, or are they being displayed incorrectly? Can you cut and paste international characters into Squeak okay? Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Morphic Tutorial for Basic Window Functions
Jack Williams wrote: I am looking for a tutorial that covers basic window management: how to put a window on the screen on the screen, draw a form, gather data from the fields and return the user reponses to the application. I can find morphic tutorials that show how to animate something and do cool stuff, but not how to do the basics. I am new to smalltalk and any help is appreciated. Hi Jack. It seems that nobody has replied yet, so I'll insert my snide remarks ;-). Firstly, I tried Morphic and gave up. It's hard work to get going and it's harder work to make something behave the way you want. While I eventually got an application going, I wasted a lot of time working around quirks. Instead, I'd recommend that you learn and use ToolBuilder. It's a multiplatform UI API. To get it, add this as a Monticello repository: MCHttpRepository location: 'http://squeaksource.com/ToolBuilder' user: 'user' password: '' (Keep fiddling with this until it works - I tried without a username and it opened up a blank window (?!) ). Then load up ToolBuilder-Kernel, ToolBuilder-Specs, ToolBuilder-Morphic and ToolBuilder-examples. Then look for buildWith: methods in the examples. That's where most of the UI code is. I'm not sure if there's any documentation out there, but feel free to ask about anything here. Regards, Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] release image
Victor Lopes wrote: Hi every one, I am having trouble in finding any tutorial about making a release image to be distributed. I'd like to know how to clean an image as much as possible. For example, I have a application with no gui, just some kind of batch application and I'de like to disable any other squeak process and remove any class I don't use to achieve the best performance I can. Can anyone help me with this? Hi Victor. There are a few resources available. Personally, I'd spend a bit of time porting your code to Pavel's KernelImage. Pavel has done an excellent job of making a minimal Squeak and in my opinion this will give you the best results for the least effort. KernelImage: http://www.comtalk.net/Squeak/98 Alternatively, surf the wiki for more information. For example: http://wiki.squeak.org/squeak/2182 There are a bunch of methods in the SystemDictionary, although they may not all work. See the housekeeping and shrinking method categories in the SystemDictionary class. Make sure you back up your image first. Seeing that you're not running a graphical application, the least effort path would be to keep your whole image, junk included. You'll find that keeping the development tools in the image is a very good idea if you ever need to get back in to your image to fix anything. For deployment of a network service, you'll want some way of administering it - I recommend either using VNC (Squeak has a built-in VNC server) or REPL (which is a telnet server). Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Fishing for a Masters Thesis Topic
Hi Robert. I recommend asking the main squeak-dev mailing list! I'm sure you'll get a very warm reception there. The Croquet mailing list is also a good place to ask. Croquet has many unexplored academic opportunities. If I was in your shoes, I'd be looking at finding some other area of science / technology / business where Croquet would be profoundly useful. Personally I'd be looking at re-creating a useful, virtual office environment with shared documents and system for managing information, but then I'm boring. Michael. On 6/13/07, Robert Stehwien [EMAIL PROTECTED] wrote: I've been primarily a Windows C++ developer for 12 years with a little Java, Perl, Python, and lately Ruby along the way. I've never looked at line of Smalltalk until recently. But that all changed when I decided to get a Masters in CS and since a PhD isn't out of the question write a thesis. When asked by a co-worker what my thesis topic would be, I said maybe something with peer-to-peer, gaming, collaborative environments, 3D, education, visual programming, interaction design, or languages (big list I know but somewhat ordered). I started digging around and noticed a pattern... Smalltalk, Squeak, Croquet, and Seaside kept coming up (although it took a little while to notice the mouse icon and 3d bunny. So I've ordered the book Object Land, downloaded all the free books and Squeak (ordered the DVD too), and joined the list. But I'm still having trouble narrowing down a thesis topic to present to my advisor (for adjustment I'm sure). Anyone have any suggestions for a thesis topic? Maybe there is some part of Squeak that the community would like documented/researched/implemented. P2P gaming/collaboration using Croquet sound interesting, but I'm pretty open for suggestions. Thanks, Robert PS: As a working C++ developer it will take a while for me to finish the thesis and my masters. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] squeak on ubuntu linux
Hi Liliana. Liliana wrote: Hi, We have an Intel dual core 64 bit server where we installed Ubuntu 7.04 We are all new in Squeak/Smalltalk; but we managed to develop a small Seaside app in Squeak (on Windows XP) using Squeak 3.9 and Seaside 2.7 (latest). We would now like to install this image on the linux server and run seaside there, under Apache. I read quite a few of posts and Ramon Leon’s blog on how to get a squeak/seaside headless vm working on Linux; but we are all but confused; and didn’t manage to get anywhere. Questions: 1. Do we need x-windows, or not (we will not do development on the linux server)? You should not need X-Windows. 2. Is there a squeak vm we can download or do we have to build from source for Intel dual-core? ( we tried both versions and neither works) The debian packages at: http://ftp.squeak.org/debian/ stable main don’t seem to work for linux running on intel dual core and we downloaded Squeak-3.9-8.i686-pc-linux-gnu.tar.tar from http://www.squeakvm.org/unix/ With this last one installed we get the error: “could not find module vm-display-X11” This means that the VM cannot find that module (to state the obvious... sorry!); try copying that module (vm-display-X11.la or vm-display-X11.so) into the same directory as the squeak executable. Alternatively, you may be having linking problems because you're using 32-bit binaries. While Squeak won't use this plug-in, for some reason it won't start unless it is present. I would recommend trying the 64-bit binaries: http://www.squeakvm.org/squeak64/. I have used this version of Squeak on an AMD-64 machine without any problems. Also note that Squeak currently can't use the dual cores; for now Squeak can only make use of one core. I don't know about running multiple images with a load balancer though to increase thoughput; I don't think that Seaside would support this because it keeps stateful sessions. When we run: squeak -headless groupinvestment.image (where groupinvestment.image is our Windows build image containing seaside and our web site) And when we run: squeak -nodisplay groupinvestment.image we get: Segmentation fault I will let somebody else on this list handle this. It may be related to trying to run a 32-bit binary on a 64-bit machine. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] squeak on ubuntu linux
Liliana wrote: Hi, We have an Intel dual core 64 bit server where we installed Ubuntu 7.04 We are all new in Squeak/Smalltalk; but we managed to develop a small Seaside app in Squeak (on Windows XP) using Squeak 3.9 and Seaside 2.7 (latest). We would now like to install this image on the linux server and run seaside there, under Apache. I read quite a few of posts and Ramon Leon’s blog on how to get a squeak/seaside headless vm working on Linux; but we are all but confused; and didn’t manage to get anywhere. Questions: 1. Do we need x-windows, or not (we will not do development on the linux server)? Also - you'll need a way to manage Squeak remotely. I recommend either using the Squeak VNC server (should be on SqueakMap?) which many people have had success with, or the REPLServer which is a telnet server that runs simple Smalltalk commands - an old version is on SqueakMap, or I've made a nicer version at http://www.squeaksource.com/SecureSqueak/REPL-mvdg.13.mcz. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] which code browser to use?
Nick Ager wrote: Hi, What are the pros and cons of the different code browsers I see in my image (it's based on Damien Cassou's squeak-web-95-2.zip). I see: * Browser (appears to be the default) * HierarchyBrowser * OBSystemBrowser * ShoutOmniBrowser * eComspletionOmniBrowser * Tric-RefactoringBrowser * WhiskerBrowser * OmniBrowser It really depends on your preference. Try them; I've been Squeak for quite a few years and I've only really ever needed to use the standard Browser. The Browser and HierarchyBrowser are standard tools in a standard image. I don't know much about the OmniBrowser, but I think it's an intelligent re-design of the standard browser in that it looks the same but works much more intelligently under the covers. I think people use it as a starting point for developing experimental browsers. Shout is a package that gives you syntax hilighting, so the ShoutOmniBrowser is Shout plus the OmniBrowser. eCompletion is a package that gives you keyword completion (ala other IDEs)... ditto for eCompletionOmniBrowser. The WhiskerBrowser has a completely different UI - some people swear by it. The ones I haven't mentioned are the ones I don't know anything about. I find myself switching between different browsers and not finding one which provides a superset of browsing functionality.I feel must be missing a trick. Is there a prefered browser amoungst more experienced users? Again, I just use the standard browser. Personally I'm dissatisfied with it because it's completely non-obvious as to how you're meant to use it - even after a few years, I still haven't worked out what the standard way of defining a new method is; usually I just cheat and modify an existing method with a new name. You'll also find that a lot of the functionality you need is done in other places in the image. The biggest Aha! moment for me was discovering alt-n (find senders of...) and alt-m (find implementers or...) - select text and press those keys. How do I register a prefered browser as the default for alt-b and tools tab-browser? I've just had a look in the image. This is what I did: 1. I vaguely recall being asked what Tool set I wanted to use at some stage, so I opened up my bog-standard browser :-) and tried to find any class with the word Tool in the name. I saw a class called ToolSet so I looked at that. 2. ToolSet has no instance methods, so I looked at the class methods. 3. This looks like it - there's a method called #browse:selector:, so I looked at that. That calls the method default which isn't there. 4. Looking for the implementation of default, I opened up a hierarchy browser on ToolSet and looked up the inheritance hiearchy. I found the implementation in AppRegistry. That calls self askForDefault. 5. I look at the implementation of askForDefault in the same class. At a brief glance, it has UI code in it, so I try calling it: ToolSet askForDefault. There you go. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Simply...
Michael van der Gulik kirjoitti 20.5.2007 kello 13.25: Antero Salminen wrote: Hi, dbl-click program icon and no action. in intelmac , only some VM? no ide? I have no printer, but ... Hello again Antero :-). What is your native language? Finnish? There's a lot of documentation on http://www.squeak.org/ Documentation. Many of the books there are still valid. When you start up Squeak, normally you get a few windows on your screen with information about the image you're using. All of Squeak can be accessed from that - including the IDE. Is this what you're seeing? Try clicking on the background. Michael. Antero Salminen wrote: Hi, thanks. Any examples from databases. Where to dig. ? I would use Google; use site:wiki.squeak.org or site:lists.squeakfoundation.org in your queries and look for the keywords: Magma, GOODS, MySQL, PostgreSQL, ODBC, SQL etc. However, I'd learn to walk before you start running! Spend some time learning how to program in Squeak before trying to do complicated things like accessing databases. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Simply
Antero Salminen wrote: Hi, dbl-click program icon and no action. in intelmac , only some VM? no ide? I have no printer, but ... Hello again Antero :-). What is your native language? Finnish? There's a lot of documentation on http://www.squeak.org/Documentation. Many of the books there are still valid. When you start up Squeak, normally you get a few windows on your screen with information about the image you're using. All of Squeak can be accessed from that - including the IDE. Is this what you're seeing? Try clicking on the background. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] File system access in Squeak
Navodit Kaushik wrote: Hi Can anyone suggest a good package for file system access? Someone suggested Rio but I am not sure how to install it as it does not show up in the Package loader... I want to be able to work with the files on a ftp server and am not sure what to use for this. If possible an example script to connect to a ftp server and work with the files therein would be really helpful. Thanks Hi Navodit. Sorry that nobody seems to have much advice for what you're trying to do! What are you trying to do (at a higher level)? Is this commercially important or one of your own projects? What are the files that you're trying to move around - perhaps there's a better way of doing it? Anyway... here's some example code for opening an ftp connection to a remote server. This only uses classes from the basic Squeak release (in this case, 3.10): s := ServerDirectory new. s fullPath: 'ftp://[EMAIL PROTECTED]/www'. s password: 'wachtwoord'. s openFTPClient. s directoryNames inspect. s quit. To work out how to do this (I've never done it before), I: 1. Opened up a Browser, right-clicked on the categories pane and chose find class..., searching for ftp. 2. Found the FTPClient class, read the class comment which says to look in ServerDirectory for examples. 3. Went to the ServerDirectory class, looked at the available methods. I opened up a workspace and tried a few things. 4. I got an UndefinedObjecterrorNotIndexable error when I tried the first time to open a connection. I looked at the code in the debugger and realised that the newDirName variable in FTPClient was not set, probably meaning I also need to set a directory before opening the connection. 5. I went back to the ServerDirectory Browser, clicked on the inst vars button and realised that there was a directory instance variable. Clicking on that, I saw that it was accessed by fullPath:. Reading the comment in that method, I completed my code snippit. Try running through the same process of discovery, and especially look at the methods available in the ServerDirectory class. One of the reasons that Squeak doesn't have much specific documentation is because once you're familiar with the tools, you find it really doesn't need much! Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Populate a new array.
Bert Freudenberg wrote: On Mar 15, 2007, at 10:54 , Michael van der Gulik wrote: Also, observing that at: is actually implemented in Object, which seems...odd! It is a bit odd. An Object in the virtual machine resembles an array of instance variables, and that method assigns to an instance variable by number. Wrong. Any Squeak object is made of zero or more instance variables (named variables) plus zero or more numbered variables (indexed variables). The difference is that the number of named variables is fixed for all objects of that class, but the number of indexed variables can be specified when creating an instance using #new:, so it can differ from instance to instance. Objectat: lets you access those indexed variables. How else would you access these? It's not often useful (and downright dangerous if you ask me) Huh? It provides the very basics of the system! If we Smalltalkers say everything is an Object we mean it. Literally. There is no special array object that is different from regular objects. Rather, you can implement an array as an object that happens to have indexed variables: Object variableSubclass: #BertsArray instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Bert-Arrays'. (BertsArray new: 7) at: 5 put: 42 Thanks, Bert. I can't believe I've been Smalltalking for so many years and not known that! I always just assumed that arrays were some special case handled by the VM, like SmallIntegers. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Morphic event-handling confusion
Max OrHai wrote: handlesMouseStillDown: evt ^ true mouseStillDown: evt self position: evt hand position. These apparently don't do anything. But, that's OK, because I can, as Bert suggested, just send evt hand #grabMorph: self. Except, oops, that's NOT OK, because now mouseUp: apparently never gets sent to my Morph. So, I still need help. Thank you both very much. They worked for me - I was dragging a Morph around, and had readouts for the start and end positions of the dragging. Try making a completely fresh subclass of Morph with only the methods I suggested. I used Squeak 3.9. If I was going to implement momentum, I'd take the current position on mouseUp: and the position received by the very latest mouseStillDown:, and work out which vector the puck should travel in from that. I suppose you'd also need the times of those two events as well to calculate the velocity vector. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Populate a new array.
Blake wrote: Here's another one: I've created a method that returns an array of its own class: anArray: aQuantity | a | a := Array new: aQuantity. a size do: [:i | a at: i put: self class new]. ^ a but, for a while, I was trying to make this a single line: ^ (Array new: aQuantity) do: [:item | item := stuff ] Here, you're constantly assigning the variable item to new values, so the array remains untouched. I guess in a perfect world, the compiler shouldn't allow assignment to block parameters... I'm surprised that the Squeak compiler allows this. Also, observing that at: is actually implemented in Object, which seems...odd! It is a bit odd. An Object in the virtual machine resembles an array of instance variables, and that method assigns to an instance variable by number. It's not often useful (and downright dangerous if you ask me), but I've used it before (for example) to serialize the state of any object in an image. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Morphic event-handling confusion
Max OrHai wrote: I'm trying to use Morphic, in Squeak 3.9, to make a very simple physics model I call a HockeyPuck. The idea is that it's a CircleMorph subclass that one should be able to pick up with the Hand and throw, and have it bounce off the World edge (and then, hopefully, other such Pucks). I've got the step animation thing figured out pretty well, and I have some idea how to compute the motion and bounces and such, but I'm stumped as to how to properly handle the mouse events. On Eddie Cottongim's suggestion, at http://wiki.squeak.org/squeak/2477 , I tried using self on: #startDrag send: #beginThrow to: self (in my initialize method) but that seems a little weird, and doesn't seem to allow the default dragging behavior to go through. I also tried the approach of overriding handlesMouseDown and mouseDown, and sending super mouseDown in the latter, but that doesn't seem to work any better, although it makes a little more sense to me. There's a two-step sequence of messages I'd like my Puck to receive while still doing the normal getting-moved-by-the-Hand stuff. The first is #beginThrow, to be sent either on a mouseDown or (preferably) on a startDrag event. The second is #endThrow, to be sent on the subsequent mouseUp. How can I make this happen? Hi Max. Firstly, I might just make the point that Morphic is a pain to work with. I've often been at my wits end trying to work out what on earth it is doing and how to get it to behave. You're not the only one. I've just had a bit of a play around, and I think you'll want the following six methods in your Puck morph: handlesMouseDown: evt ^ true. mouseDown: evt Transcript show: 'Mouse down'; cr. handlesMouseStillDown: evt ^ true mouseStillDown: evt self position: evt hand position. handlesMouseUp: evt ^ true mouseUp: evt Transcript show: 'Mouse up'; cr. You can also define all the above methods using the on:send:to: mechanism if you want. Cheers, Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Removing an object instance
You shouldn't need to worry about removing it. I'm not sure what the Squeak garbage collector uses to kick off, but in other VMs (*cough* Java *cough*), GC kicks in when a certain percentage of the heap is full. So if you just keep running your program as normal, GC will eventually deallocate your 400MB map when it needs free memory. If there are timing contraints and GC will incur a noticable pause at a later stage, then it's a good idea to force a GC manually. Otherwise just let it do it's stuff. Michael. Millet Stéphane wrote: Herbert, Thanks for the answer. In fact, the object I was working on is a map which takes 400Mb, so when I finish a test, I would prefer the object to be removed. I will try to force garbage collection as you proposed. Cheers Stéphane Herbert König a écrit : Hello Stéphane, s I would like to know when an object created in aworkspace is deleted (garbaged). the simplified answer is, when the object is not referenced any more and the system decides to do a garbage collection. If you need something collected: Smalltalk garbageCollect will do just that. s I then ask for MyWorldallInstances in another window and the value is 1. Actually the value is an array with one element. If you still find instances after an explicit GC you can inspect that array by MyWorld allInstances inspect. In the inspector you can right click (Win) on that element and select objects pointing to this value and find out who references your object. s I don’t understand this behaviour. The objectshoudn’t be s referenced or only by weak references, no ? GC is time consuming so it's split up between incremental and full garbage collects. Both are scheduled when necessary (this is a big can of worms but documented on the swiki). So you can still find an object which is not referenced as long as no collection has occurred. Cheers Herbertmailto:[EMAIL PROTECTED] ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Re: A do with ONLY index? (plus, . a style question)
Blake wrote: On Fri, 09 Feb 2007 02:54:14 -0800, Klaus D. Witzel [EMAIL PROTECTED] wrote: Why doesn't this: ^ self basicNew initialize cause a DNU? Object doesn't have an initialize method. Really ? :) It is inherited from ProtoObject ;-) Wow, don't know how I missed that. I guess maybe partly because the debugger doesn't go into the method (because it's blank, I suppose). Actually, the method isn't blank, it's actually ^ self, except that that part is added automatically and you don't see it. See here: http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_chapter27.html#CompiledMethods27 One of the optimisations in Smalltalk is that a method that's just ^ self actually doesn't have any bytecodes but just a special flag in the method header. Glossing over a few details, the Interpreter picks this up and skips over it. It's interesting to play with the right-most button on the Browser - click it and see the bytecodes or the decompilation of source. Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Error All SqueakMap master servers are down
jerryw wrote: Thanks Damien, Apologies, I did mean 7067. I've found the http proxy preferences on the Preferences but there's nothing showing - no checkboxes or text. Is the same for you? It sounds like I am nearly there ... can you show me how to set the proxy preferences? The UI seems to have changed between 3.8 and 3.9, so it depends on your version. There's an easier way: Open a Workspace (Desktop - Open - Workspace) Type in: HTTPSocket useProxyServerNamed: 'cache2.uk.logicacmg.com' port: 80. Select the text you just typed and press Alt-d (or Cmd-d or whatever... the command for do it). Also, for finding your proxy server, you're much better off looking at the settings for your installation of Firefox. Regards, Michael. ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners