answerstu

Pharo image does not recognize middle mouse click on Debian

Related to this question, which was never really answered...I'm running Debian Testing on a Lenovo Thinkpad T530.I downloaded Pharo using the zeroconf script. About saysPharo3.0Latest update: #30860I noticed that middle click didn't bring up the morphic halo as I expected, based on the description in Pharo by Example, nor did it do anything as far as I could tell.I ran the Pharo VM with a Squeak image (as suggested by this answer), and middle mouse did exactly what I would have expected.I couldn't find any more information about this, so I'm as...Read more

pharo - How do I override the printing of arrays?

printOn: aStream | normalized | normalized := self normalized. aStream nextPut: ${. self isEmpty ifFalse: [ normalized printElem: 1 on: aStream. 2 to: self size do: [ :i | aStream nextPutAll: ' . '. normalized printElem: i on: aStream ]. ]. aStream nextPut: $}This printOn: method works, but the Inspector is using some other route to print the array. How do I to tell the Inspector to use the above method for my class that inherits from Array?...Read more

pharo - What is the reasoning behind having to declare temporary variables rather than having bindings?

Out of all the features Pharo has, the |a b c| style of declaring temporary variables definitely feels like something that should have stayed in the 80s. Is there any benefit from declaring uninitialized variables and then doing assignment on them rather than having let bindings?It is true that the IDE will be helpful in making such declarations, but I found it to be annoying when removing assignments as the empty declarations would still remain in....Read more

pharo - How should existing library classes be extended?

normalize: sum | strategy normalizingSum | strategy := sum collect: [ :each | each max: 0.0 ]. normalizingSum := strategy sum. ^strategy collect: [ :each | normalizingSum strictlyPositive ifTrue: [ each / normalizingSum ] ifFalse: [ 1.0 / Action subclasses size ] ]I want to make the above an instance method rather than having to pass sum into it explicitly. The issue is not so much that I can't make the method or I can't put it into the Array class. It is just that coming from functional languages, I find...Read more

pharo - Is there a limit to the number of nested #call:'s in Seaside?

I'm developing a Seaside Application and I suspect I've reached a point in which I can no longer #call: another component.It's not an issue of my WAComponents, since I tried other messages that end up in #call:, like #confirm:.I have 4 nested #call:'s in my app (I know, I know... but I'm not looking for design advice, just an answer on this :) ). The 5th just reloads the page, and the called component never appears.I searched the docs but there's nothing about this, and debugging is really difficult to me, since I'm not familiar with Seaside's...Read more

Pharo Smalltalk Quick Reference Card

I am trying to introduce some PHP developers Smalltalk. I seem to remember that the old Pharo website had a link to a Pharo Smalltalk Quick Reference card. If you printed it out it would print on a 8.5 x 11 page - front and back. I can't seem to find this link anymore. Does anyone know where to find this?...Read more

pharo - Downloading sources file to image directory

I am using PharoCloud to host a Pharo image for me. By default it downloads a ZIP of the image only to my appliance; this ZIP doesn't include the .sources file.I am trying to manually download the sources file with ZnClient. The directory my image is located in is /mnt/upload/upload.140605183221.This is the code I have| aFileStream | aFileStream := '/mnt/universe/upload/upload.140605183221/PharoV30.sources' asFileName writeStream. aFileStream write: (ZnClient new get: 'http://files.pharo.org/sources/PharoV30.sources.zip'). aFileStrea...Read more

How to do "File in" in Pharo 6.1?

Wanting to migrate my small project from Pharo 5 to Pharo 6.1, and I happily found the File Out option when I right-clicked on my package and its classes. I saw it generates text files for those artifacts in my image directory (I'm running on Windows). So far, so good.However, I looked everywhere for a menu to import these files back into Pharo 6.1 (right-clicked on the package list, etc.) to no avail. How does one do a File In (the opposite of File Out)?...Read more

How to create a custom slot class in Pharo

I don't understand how to create my own subclass of Slot and use it in Pharo. The problem is that it looks like the slot-handling code requires me to implement #size and #index but I have no idea what to put in there.The use case is the definition of a class that represents a configuration. A user can specify part of the configuration and relies on default values to specify the rest. To do that, I want to define a slot class that has (1) a default value (2) a dictionary. The idea is that when reading the slot, the dictionary is searched for a k...Read more

How to save a Pharo Smalltalk package to disk in Tonel format?

I would like to write Pharo Smalltalk scripts that load and save Smalltalk packages to disk in tonel format but I don't understand the API for saving packages.Loading from Tonel on disk into the image works like this:(TonelReader on: aRepositoryDirectory fileName: packageName) version load.but what is the inverse operation that saves a package onto disk? (assuming that the package name and target directory are supplied.)(I explicitly want to avoid using advanced tools like Metacello and Iceberg here. I want to either use the Tonel library di...Read more

pharo - How do I dynamically add elements to the Roassal RTGrapher instance?

Object subclass: #MultiData instanceVariableNames: 'b' classVariableNames: '' package: 'CFR-Extensions'initialize b := RTGrapher new. b add: (self makeD: #('hello' 1 2 1)). b add: (self makeD: #('test' 1 2 11)). bmakeD: first | d | d := RTVerticalMultipleData new. d barShape color: Color blue. points := OrderedCollection new. points add: first. d points: points. d addMetric: #second. d addMetric: #third. d addMetric: #fourth. "Rotated text" d barChartWithBarTitle: #first rotation: -30. ^d...Read more

issue with transcript instruction in Pharo

I have downloaded Pharo 6.0 and trying to follow up his famous or "infamous" book Pharo by Example (I call it like that because the books they give at their documentation page is never in syntony with the programming language)In the book it says to open a playground and put the following instruction:Transcript show: 'hello world'; cr.I have selected the instruction and selected Do It, but nothing happens, only appears to press Ctrl+D as a shortcut and nothing more. I suppose that it should appear the Workspace with the message on it, but it is ...Read more