Re: [Pharo-users] Morph reacting to Window being closed

2018-07-29 Thread Henrik-Nergaard
Hi Peter,

There are two methods which can be used for this purpose.
#outOfWorld: 
#announceDeleted

Both are called recursively down the morph tree from the window.

If you need to stop the window or provide a dialog then you should create a
subclass of Model and use that to keep references to things that need
cleanup and control the closing and other events.

Best regards,
Henrik




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Henrik-Nergaard
Hi Peter,

This functionallity is already available in STON where it preserves the
order when you use an OrderedDictionary. 
And was implemented for the usecase of dealing with fileout and versioning.
Perhaps the same could be added to NeoJson so that instead of some magic
flag you provide an OrderedDictionary sorted as you would like and it would
then preserve the order.

 If you aim to use it to preserve metada for filetree then there is a patch
for that which can be found at
https://github.com/DraagrenKirneh/PharoUtilities/tree/master/FileTreeFix

Best regards,
Henrik



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Object configuration idioms

2018-02-11 Thread Henrik-Nergaard
Hi Peter,

I would just fill in the configuration and have it give me the correct
client which uses the configuration instance. 

=
| client |

client  := TwitterConfiguration new 
  username: 'stuff';
  password: 'password1';
  port: '1234';
  useHttps;
  client.

TwitterConfiguration >> #client
self perhapsValidateConfigurationHere.

^ self clientClassDependingOnConfiguration on: self



Best regards,
Henrik 





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Fuel serialize of 70MB takes forever on Linux vs. Mac

2017-12-18 Thread Henrik-Nergaard
Hi Andreas,

It looks like you may have problems with hash collisions
FLLargeIdentityDictionary.
What are the tally sizes of the FLLargeIdentityDicitonary used when you
serialize? (If these have a tally larger than ~ 75% of the available size
(4096 items), then there may well be some performance loss).

You could check if file writing is the problem by measuring the time it
takes to only serialize in memory. 
You can try to use: "FLSerializer serializeToByteArray: " and see if it
gives petter performance?

Best regards,
Henrik



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] [Pillar] How do I include a picture which I get from aMorph imageFrom?

2017-08-31 Thread Henrik Nergaard

"There is no need to open the morph in the world and delete it. #imageForm uses 
its own form and renders the morph onto it."

| image |
image := AlignmentMorph newRow
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
color: Color gray;
addMorph: (EllipseMorph new color: Color red);
   addMorph: (EllipseMorph new color: Color yellow);
   addMorph: (EllipseMorph new color: Color green);
   imageForm.

image writePNGFileNamed: 'myImage.png'

"there are some export methods in morph which can be used instead of #imageForm 
and then #writePngFileNamed (#exportAsPNG), which will then prompt you for the 
file name and location".

Best regards,
Henrik











Fra: Pharo-users  på vegne av Stephane 
Ducasse 
Sendt: 31. august 2017 20:23:24
Til: Any question about pharo is welcome
Emne: Re: [Pharo-users] [Pillar] How do I include a picture which I get from 
aMorph imageFrom?

I will keep your idea for a student lectures we will have in second semester

+Caption>file://image.png|width=50|label=label+
=>
+Caption>inMemory: [| myMorph myForm myPillarSource myPillarDOM |

myMorph := AlignmentMorph newRow
   addMorph: (EllipseMorph new color: Color red);
   addMorph: (EllipseMorph new color: Color yellow);
   addMorph: (EllipseMorph new color: Color green);
   openInWorld.

myForm := myMorph imageForm.
myMorph delete.

PNGReadWriter
putForm: myForm
onFileNamed: 'myImage.png'.
]|width=50|label=label+

On Mon, Aug 28, 2017 at 6:22 PM, H. Hirzel  wrote:
> The answer (second option by writing the image to disk) is
>
> | myMorph myForm myPillarSource myPillarDOM |
>
> myMorph := AlignmentMorph newRow
>addMorph: (EllipseMorph new color: Color red);
>addMorph: (EllipseMorph new color: Color yellow);
>addMorph: (EllipseMorph new color: Color green);
>openInWorld.
>
> myForm := myMorph imageForm.
> myMorph delete.
>
> PNGReadWriter
> putForm: myForm
> onFileNamed: 'myImage.png'.
>
>
>
> myPillarSource := '
>
> !The title
> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
> eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
> minim veniam, quis nostrud exercitation ullamco laboris nisi ut
> aliquip ex ea commodo consequat. Duis aute irure dolor in
> reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
> pariatur.
>
> +The caption of my image>file://myImage.png|label=myLabel+
>
> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
> officia deserunt mollit anim id est laborum.
> '.
>
>
> myPillarDOM :=   PRPillarParser parse: myPillarSource.
>
>
> (PRHTMLWriter write: myPillarDOM) contents inspect
>
>
>
>
>
> HH.
>
>
> On 8/28/17, H. Hirzel  wrote:
>> Hello
>>
>> Is it possible to include a in-image picture in Pillar which I get by
>> evaluating
>>
>> myMorph imageForm?
>>
>> Or do I need to write the instance of Form I get by evaluating the
>> expression above first as a PNG file to disk and get it from there.
>>
>>
>> PNGReadWriter
>>   putForm: myMorph imageForm
>>   onFileNamed: aString
>>
>> If yes what is the default directory where does Pillar expects pictures --
>>
>>
>> The Pillar cheat sheet [1] and the Pillar chapter in the Pharo
>> enterprise book no 3 [2] have an example
>>
>> +Caption>file://image.png|width=50|label=label+
>>
>>
>> Regards
>>
>> Hannes
>>
>>
>>
>> [1]
>> http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet
>>
>> [2] Section 3.8 of
>> https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/PillarChap/Pillar.html
>>
>



Re: [Pharo-users] Playground doesn't respect LF endings

2017-08-19 Thread Henrik Nergaard
>> Right now I have to execute `Clipboard clipboardText withSqueakLineEndings 
>> asString` and then copy the result.

Why not fix the issue instead?

  *   Browse senders of #cr
  *   Filter "rub"
  *   Find  the method that navigates the cursor to line end
 *   change #indexOf::: to use #indexOfAnyOf::: with lf as well.
 *   move 1 more step if pos is cr and next is lf
  *   do something similar for home navigation

Best regards,
Henrik


Fra: Pharo-users  på vegne av Peter Uhnak 

Sendt: 8. august 2017 07:41:46
Til: pharo-users@lists.pharo.org
Emne: [Pharo-users] Playground doesn't respect LF endings

Hi,

when I paste a text into the playground with line endings containing just LF 
(unix-style), then navigation to beginning/end of a line instead jumps to the 
beginning/end of the text. (I guess it is hardcoded to CR only).

Right now I have to execute `Clipboard clipboardText withSqueakLineEndings 
asString` and then copy the result.

Peter



Re: [Pharo-users] Is it possible to change the Pharo application title bar?

2017-07-23 Thread Henrik Nergaard
DisplayScreen hostWindowTitle: 'NewTitle'


Best regards,

Henrik


Fra: Pharo-users  på vegne av Tim 
Mackinnon 
Sendt: 22. juli 2017 18:44:46
Til: Pharo Users Newsgroup
Emne: [Pharo-users] Is it possible to change the Pharo application title bar?

Hi - is it possible to easily change the Pharo.image title bar in the pharo 
application? (As in the OSX title bar, or Windows one).

I find that I often have multiple images running and its difficult to 
distinguish them - so having a title that had the immediate path of the image 
would be very useful. I’d prefer not to have to rename image files (althoughI 
guess could if its not easy to change the title).

Tim


Re: [Pharo-users] Playground and Dr. Geo

2017-07-16 Thread Henrik Nergaard
Hi,


a)Do you wrap the morph inside the morph tab view? ,

b) Do you use the same code for rendering as in  Morph>> #gtInspectorMorphIn: .


if a) it is most likely caused by the morph being wrapped within one or more 
transform morphs, and the offset of these are not taken into account when 
opening the menu.


if b) The real morph position is probably not the same as where clicked causing 
it to open at another place.


What method are you using for opening the menu: (#popUpEvent:in: , 
#popUpAt:forHand:in: , other)?

also see: 
https://pharo.fogbugz.com/f/cases/15927/Menu-is-broken-when-contained-in-a-scrollable-pane



Best regards,

Henrik



Fra: Pharo-users  på vegne av Hilaire 

Sendt: 16. juli 2017 21:12:16
Til: pharo-users@lists.pharo.org
Emne: [Pharo-users] Playground and Dr. Geo

Hi,

I am integrating the Dr. Geo Smalltalk Sketch to Playground.

So far, Dr. Geo morphic view is well integrated and interactive is
there. However when I select a menu in the view it opens deported. See
attached screenshot.

The Dr. Geo view is a StandardWindow with its label area hidden.

Any idea?

Thanks

Hilaire


--
Dr. Geo
http://drgeo.eu



[Pharo-users] XPath has unresolved dependencies

2017-06-05 Thread Henrik Nergaard
Hi,


Loading XPath from the catalog browser into the latest image raises a warning 
that there are unresolved references, and that the package depends on the 
following classes: XMLHighlighter, XMLHighlighterDefaults, 
GLMXMLHighlighterTextStylerDecorator.


The regular XPath works fine ignoring the warnings, but inspecting an XML 
document and clicking the XPath pane gives an error.


Best regards,

Henrik


Re: [Pharo-users] Windows equivalent of kill -s SIGUSR1?

2017-05-14 Thread Henrik Nergaard

Windows do not have Unix-style signals such as SIGUSR1.

To kill a process you can use Windows PowerShell:

$ Stop-Process -Name Pharo
Or by pid:
$ Get-Process -Name Pharo
$ Stop-Process -Id 42

Best regards,
Henrik

Sent from Mail for Windows 10

From: Alistair Grant
Sent: 14 May 2017 23:18
To: pharo-users@lists.pharo.org
Subject: [Pharo-users] Windows equivalent of kill -s SIGUSR1?

Hi All,

The subject pretty much says it all: Is there an equivalent on Windows
to the linux

kill -s SIGUSR1 

that gets the VM to dump its current status?

Thanks,
Alistair




Re: [Pharo-users] method names - grey or black

2017-02-03 Thread Henrik Nergaard
MethodWidget>>#methodWrapper: is the method that styles the text entries of the 
method list in Nautilus.

Best regards,
Henrik

Fra: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] På vegne av 
sheri...@sheridan-mahoney.com
Sendt: 03 February 2017 17:45
Til: pharo-users@lists.pharo.org
Emne: [Pharo-users] method names - grey or black


Hi there,

While looking at the String class methods, I noticed that some methods are in 
grey, and the protocol pane indicates that the method belongs to a different 
package (I think).  How is this implemented?  I'm curious how the System 
browser knows how to display the methods this way...

Many thanks,

Sheridan



Re: [Pharo-users] Tools for easy subtext extraction from text

2017-01-21 Thread Henrik Nergaard
>* I have to manually remove the 0x, even though it is a very common way of 
>expressing hex numbers

Adding a few lines to NumberParser>>#nextNumber enables it to parse 0x... 
---
((sourceStream peekFor: $r)) ifTrue: ["r"
...
]
ifFalse: [ 
(sourceStream peekFor: $x) ifTrue: [ "0x"
(integerPart isZero and: [ numberOfTrailingZeroInIntegerPart = 
1]) ifFalse: [ 
sourceStream skip: -1.
^ self expected: 'one leading 0 before x' 
]. 
^ self nextUnsignedIntegerBase: 16
]
].
--
0x10. "16"
0xFF + 16rFF = (2 * 0xff). "true"

Best regards,
Henrik

-Opprinnelig melding-
Fra: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] På vegne av Peter 
Uhnak
Sendt: 20 January 2017 16:16
Til: pharo-users@lists.pharo.org
Emne: [Pharo-users] Tools for easy subtext extraction from text

Hi,

what are the tools available from easier text extraction?

The input is unstructured text, but I want to extract portion from it.

I am not looking for an engineered approach (writing a parser or something), 
but something that can be done quickly by hand (i.e. interactively).

For example I have string
str = ' Temperature 0   37C (98F) [0x25] (TMPIN0)'
Now I want to extract '0x25' from it and convert it into integer

In Ruby it is dead simple:
str[/\[(.*)\]/,1].hex # "=> 37" , or .to_i(16)

In Pharo I have to break my fingers first:
rx := '.*\[0x(.*)\].*' asRegex.
rx matches: str.
Integer readFrom: (rx subexpression: 2) base: 16 "=>37".

* I have to know that to get subexpression I have to match first to manipulate 
the internal state
* I have to store the matcher to access the subexpression
* I need to explicitly use some global variable Integer as a conversion utility 
to convert hex to dec
* I have to manually remove the 0x, even though it is a very common way of 
expressing hex numbers


So the question is:
do we have a better way to do these things? And as I've mentioned - the use 
case is interactive coding where you often throw the code away when you are 
done; so dead easy to write and use.

Thanks,
Peter





Re: [Pharo-users] Tools for easy subtext extraction from text

2017-01-20 Thread Henrik Nergaard
You can use #match and #upTo: on a ReadStream for easy extraction

| text digits|
text := '   Temperature 0   37C (98F) [0x25] (TMPIN0)'
digits:= text readStream match: '[0x' ; upTo: $].
( '16r' , digits ) asNumber "37"


Best regards,
Henrik


-Opprinnelig melding-
Fra: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] På vegne av Peter 
Uhnak
Sendt: 20 January 2017 16:16
Til: pharo-users@lists.pharo.org
Emne: [Pharo-users] Tools for easy subtext extraction from text

Hi,

what are the tools available from easier text extraction?

The input is unstructured text, but I want to extract portion from it.

I am not looking for an engineered approach (writing a parser or something), 
but something that can be done quickly by hand (i.e. interactively).

For example I have string
str = ' Temperature 0   37C (98F) [0x25] (TMPIN0)'
Now I want to extract '0x25' from it and convert it into integer

In Ruby it is dead simple:
str[/\[(.*)\]/,1].hex # "=> 37" , or .to_i(16)

In Pharo I have to break my fingers first:
rx := '.*\[0x(.*)\].*' asRegex.
rx matches: str.
Integer readFrom: (rx subexpression: 2) base: 16 "=>37".

* I have to know that to get subexpression I have to match first to manipulate 
the internal state
* I have to store the matcher to access the subexpression
* I need to explicitly use some global variable Integer as a conversion utility 
to convert hex to dec
* I have to manually remove the 0x, even though it is a very common way of 
expressing hex numbers


So the question is:
do we have a better way to do these things? And as I've mentioned - the use 
case is interactive coding where you often throw the code away when you are 
done; so dead easy to write and use.

Thanks,
Peter





Re: [Pharo-users] Create png from pdf

2017-01-16 Thread Henrik Nergaard
See Form protocol (*Graphics-files), #writePNGFileNamed: , and PNGReadWriter.

| canvas |
canvas := FormCanvas extent: World extent.
World fullDrawOn: canvas.
canvas form writePNGFileNamed: 'imageOfWorld.png'


There are also some methods in morph (#exportAs:using: #exportAsPng), but these 
will ask for the filename via the file dialog.

World exportAsPng



Best regards,
Henrik

-Opprinnelig melding-
Fra: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] På vegne av 
Sabine Manaa
Sendt: 16 January 2017 10:26
Til: pharo-users@lists.pharo.org
Emne: [Pharo-users] Create png from pdf

Hi,

currently, I create pdfs with Artefact and it works fine.
For displaying previews of the pdf reports, I use  Apache PDFBox to generate 
pngs from the pdfs.
This works, too.

But I would prefer to generate the pngs directly from pharo and do not call 
external libraries.

Stephane told me that "there is a form in a morph and it can be converted in 
png".

Can anyone give me a small entry point or has done similar and provide some 
code snippet?

Regards
Sabine





--
View this message in context: 
http://forum.world.st/Create-png-from-pdf-tp4929722.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




Re: [Pharo-users] super super

2017-01-15 Thread Henrik Nergaard
#perform:withArugments:inSuperclass:

| menu |

menu := MenuMorph new.
menu isMorph. "true"
menu perform: #isMorph withArguments: #() inSuperclass: Morph. "true"
menu perform: #isMorph withArguments: #() inSuperclass: Object."false"
menu perform: #isMorph withArguments: #() inSuperclass: ProtoObject. "Error 
#isMorph not implemented"

Best regards,
Henrik

-Opprinnelig melding-
Fra: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] På vegne av 
Hilaire
Sendt: 15 January 2017 21:42
Til: pharo-users@lists.pharo.org
Emne: [Pharo-users] super super

Hi,

Is there a way from an instance to access a method situated 2 layers up in the 
class hierarchy?

A kind of super super.

Thanks

Hilaire
--
Dr. Geo
http://drgeo.eu




Re: [Pharo-users] making scroll smooth

2017-01-13 Thread Henrik Nergaard
Hi Siemen,

This is morph/widget specific so it would depend on what widget you want to 
change (see implementors of #mouseWheel: ).

Best regards,
Henrik

Fra: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] På vegne av 
Siemen Baader
Sendt: 13 January 2017 11:41
Til: Any question about pharo is welcome 
Emne: Re: [Pharo-users] making scroll smooth

There must be a place that defines that scroll should happen by a line height, 
rather than continuously... Does anyone know where to look?

-- Siemen



Re: [Pharo-users] Mouse events in FastTableModel subclass [Spec]

2017-01-06 Thread Henrik Nergaard
You can get the selection directly in FastTableModel by Setting 
#handlesDoubleClick: to true and the event handler block using 
#doubleClickAction:

-
FastTableModel new
icons: [ :e | example iconNamed: #forwardIcon ];
items: (1 to: 10) asArray;
handlesDoubleClick: true;
doubleClickAction: [ :ftStrong | ftStrong inspect ];
whenSelectedItemChanged: [ :new :old :something :announcment | 
{ new . old . something . announcment } inspectOnce ];
openWithSpec. 
---

Best regards,
Henrik

-Opprinnelig melding-
Fra: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] På vegne av Matteo
Sendt: 06 January 2017 16:35
Til: pharo-users@lists.pharo.org
Emne: Re: [Pharo-users] Mouse events in FastTableModel subclass [Spec]

Update: problem fixed by adding an "Announcer" to the "double click"
event, i.e.:

morWidget
onAnnouncement: FTStrongSelectionChanged
send: #doubleClick:
to: self.   

Where "morWidget" is the morphic object representing a list of pictures,  
"self" is the "MorphicPictureListAdapter", which creates the "morWidget" object.
The method "doubleClick:" contains the actions to be performed when the event 
is triggered.

Note that, in the "FTAnnouncement" hierachy, the "double click" event is 
represented by the class "FTStrongSelectionChanged", which I found a little 
tricky.

Bye,
Matteo



Re: [Pharo-users] DNU on materializing a fueled out exception

2016-12-28 Thread Henrik Nergaard
Hi Holger,

For slice based fixes:
1) Open case on Fogbugz and set the milestone to Pharo 5.0
2) Create a slice with the proposed fix
3) In Monticello browser: Select the slice package and select Pharo50/main 
repository and then click on changes to verify that the slice is correct.
3) Upload the slice to Pharo50Inbox/main
4) Copy the slice commit text to the case on Fogbugz so others will know which 
slice is the current. (click on edit)
5) Change the status of the case from  "Work needed" to "Resolved(Fix review 
needed)" (this will trigger the automatic test runner). (click on resolve).

https://vimeo.com/162493974

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Holger Freyther
Sent: Wednesday, December 28, 2016 11:23 AM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] DNU on materializing a fueled out exception


> On 19 Dec 2016, at 08:53, Holger Freyther  wrote:

Good Morning Everyone,


> So it looks like now it should create a debug session first and then pass it 
> to the debugger? I think loading new fuel in Pharo3.x is still possible so 
> maybe it is best to re-add that protocol?

I hope all of you had a nice break and look forward to 2017. I understand that 
in the future (Pharo6 or beyond) there are conceptually better ways to achieve 
what was working in Pharo3 (and maybe before) but right now something that 
worked stopped to work and from my point of view such a regression should be 
fixed.

I am not asking someone to fix what I think is important but I am still 
struggling to grasp the process of getting a bugfix into Pharo5. Maybe someone 
can help to line it out?

* I pick the approach Max suggested and put it into FLPlatform to open a 
debugger for a context
* Put it into the Pharo50Inbox?
* Create a ticket?
* Make a slice?

holger






Re: [Pharo-users] Scaled image

2016-12-22 Thread Henrik Nergaard
You can use WarpBlt to scale the form.

| input output |

input :=  Smalltalk ui icons iconNamed: #class.
output := Form extent: 128 asPoint depth: 32.

(WarpBlt toForm: output)
sourceForm: input;
cellSize: 1;
combinationRule: Form over;
copyQuad: input boundingBox innerCorners 
toRect: (0 asPoint extent: 127 asPoint).

output writePNGFileNamed: 'somefile.png'

Best regards,
Henrik



From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Trussardi Dario Romano
Sent: Thursday, December 22, 2016 6:45 PM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Scaled image

Ciao,



Morphs have an extent method that you can passes the size as a point in the x@y 
format, there are also width: and height: methods that take simple numbers

Can explain what i need do  with some code, example ?

After the scaled i need to save the new scaled image on the disk.

Thanks


On Thu, Dec 22, 2016 at 6:02 PM Trussardi Dario Romano 
> wrote:
Ciao,

after upload an image   ( with MAFileDescription support )

i need to create the relative logo image with specific size 128 x 128 
px.

How i can scale the image into Pharo?

And for deployment system based on Gemstone ?

Thanks,

Dario



Re: [Pharo-users] [Stupid Benchmarks] C++ vs Pharo

2016-12-17 Thread Henrik Nergaard
This is not a comparable benchmark as the sum in Smalltalk keeps on growing and 
ends up doing LargeInteger calculations and thus the speed loss, while the c 
the int just rolls over.

Sum in Smalltalk = 55
Sum in C   = -1243309312

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Sven Van Caekenberghe
Sent: Saturday, December 17, 2016 2:15 PM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] [Stupid Benchmarks] C++ vs Pharo

Like this:

[ | sum | sum:= 0. 1 to: 1e9 do: [ :i | sum := sum + i ]. sum ] timeToRun. 

"0:00:00:39.305"

cat bench.c

#include 
#include 

int main() {
  clock_t begin = clock();

  int sum = 0;
  for (int i = 0; i < 10; i++)
sum += i;

  clock_t end = clock();
  double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("time_spent=%f\n", time_spent); }

./a.out

time_spent=2.370234

That is C being 16 times faster ...

> On 17 Dec 2016, at 13:49, Sven Van Caekenberghe  wrote:
> 
> Hmm, this sounds wrong (C++ should be (a lot) faster on such micro 
> benchmarks).
> 
> You should exclude the executable startup time.
> 
> In Pharo you should do [ .. ] timeToRun and something similar in C/C++.
> 
>> On 17 Dec 2016, at 13:41, Dimitris Chloupis  wrote:
>> 
>> in multiplication pharo is around 2 times slower compared to C++
>> 
>> #include 
>> 
>> int main()
>> {
>>  double x=1;
>>  for(double i; i<10 ; ++i)
>>{
>>x = 0.1*i;
>>}
>> 
>>  return 1;
>>  }
>> 
>> time ./testMul
>>3.13 real 3.13 user 0.00 sys
>> 
>> time ./pharo Ephestos.image eval "|x| x := 1. 1 to: 10 do:[:each| x 
>> := 0.1 * each]"
>> 1
>>4.97 real 4.48 user 0.09 sys
>> 
>> On Sat, Dec 17, 2016 at 2:16 PM Dimitris Chloupis  
>> wrote:
>> So I was bored and decided to test how fast pharo is compared to C++. 
>> 
>> so I tested addition
>> 
>> C++ version:
>> 
>> #include 
>> 
>> int main()
>> {
>>  double x=0;
>>  while(x<10)
>>{
>>x = x+1;
>>}
>> 
>>  return 1;
>>  }
>> 
>> time ./test1
>>2.84 real 2.84 user 0.00 sys
>> 
>> Pharo version:
>> 
>> time ./pharo Ephestos.image eval "|x| x := 0. 1 to: 10 do:[:each| x 
>> := x +1]"
>> 1
>>2.09 real 1.94 user 0.08 sys
>> 
>> Pharo is +50% faster than C++ ... o_O ... that's suprising, I assume here 
>> Pharo VM probably does some kind of optimisation. 
>> 
> 





Re: [Pharo-users] [Stupid Benchmarks] C++ vs Pharo

2016-12-17 Thread Henrik Nergaard
You are comparing two different types here, double vs a 32 bit integer, and 
program starting time should be excluded.
Something like:

In playground:
Smalltalk garbageCollect.
[ 0 to: 16r0FFF do: [ :x | ] ] timeToRun.
“ try switch the 0 to 0.0 to have the iterations be on a float, leads to much 
slower time”

C++ (compile with -std=c++11)

#include 
#include 

int main(){

using namespace std::chrono;

auto start = high_resolution_clock::now();
for(uint32_t x{0}; x <= 0x0FFF; ++x){ }
auto end = high_resolution_clock::now();
auto ms = duration_cast(end - start).count();

std::cout
<< "time used: "
<< ms
<< "ms"
<< std::endl;
}

Best regards,
Henrik


From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Dimitris Chloupis
Sent: Saturday, December 17, 2016 1:16 PM
To: Any question about pharo is welcome 
Subject: [Pharo-users] [Stupid Benchmarks] C++ vs Pharo

So I was bored and decided to test how fast pharo is compared to C++.

so I tested addition

C++ version:

#include 

int main()
{
  double x=0;
  while(x<10)
{
x = x+1;
}

  return 1;
  }

 time ./test1
2.84 real 2.84 user 0.00 sys

Pharo version:

time ./pharo Ephestos.image eval "|x| x := 0. 1 to: 10 do:[:each| x := 
x +1]"
1
2.09 real 1.94 user 0.08 sys

Pharo is +50% faster than C++ ... o_O ... that's suprising, I assume here Pharo 
VM probably does some kind of optimisation.



Re: [Pharo-users] Flashing short duration images in a window

2016-11-28 Thread Henrik Nergaard
| image morph |

image := Form fromFileNamed: 'path/(.jpg|.png)'.
morph := image asMorph.
morph openCenteredInWorld.
morph addAlarm: #delete after: 2000 "ms".


Ps. Pharo UI runs at 50Hz

Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
William L. Cleveland
Sent: Monday, November 28, 2016 9:43 PM
To: pharo-users@lists.pharo.org
Subject: [Pharo-users] Flashing short duration images in a window

I want to write code to flash a color image of a person in a window for a short 
period of time. The duration of the flash is important, not the frequency of 
the flashes, which will be low and probably controlled by pressing a key.

Ideally, the duration should be an integral number of frames, starting from 1 
and increasing to a much larger number. With a 60 Hz monitor, one frame would 
be 0.0167 seconds. The images would be low to moderate resolution, e.g. 70K to 
1 Mb

Can this be done entirely in Pharo or would it be necessary to use the Unified 
FFI with operating system commands? If it can be done in Pharo, what are the 
classes needed to display an image filed in from the hard drive?

I am using a 27 inch iMAC (10.11.6) with 4GHz, 8 GB ram, and AMD Radeon R9 
M395X 4096 MB video card. Pharos is new to me but I wrote Smalltalk code with 
VisualWorks a few years back.

Thanks very much.

Lou Cleveland


Re: [Pharo-users] Chip-8

2016-11-21 Thread Henrik Nergaard
Keys are mapped to 1-4,q-r,a-f,z-v.

For Pong key 1 and q controls the left player while 4 and r is the right.

Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
stepharo
Sent: Monday, November 21, 2016 9:25 AM
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Subject: Re: [Pharo-users] Chip-8


I could not resist

The keys are not working for me too.

Stef
Le 21/11/16 à 08:38, olivier auverlot a écrit :
Very cool !!!

What are the used keys to move the player ?

Olivier ;-)

2016-11-21 0:16 GMT+01:00 Henrik Nergaard 
<henrik.nerga...@uia.no<mailto:henrik.nerga...@uia.no>>:
http://smalltalkhub.com/#!/~Latsabben/Chip8<http://smalltalkhub.com/#%21/%7ELatsabben/Chip8>

From: Pharo-users 
[mailto:pharo-users-boun...@lists.pharo.org<mailto:pharo-users-boun...@lists.pharo.org>]
 On Behalf Of olivier auverlot
Sent: Wednesday, November 16, 2016 11:22 AM
To: Any question about pharo is welcome 
<pharo-users@lists.pharo.org<mailto:pharo-users@lists.pharo.org>>
Subject: [Pharo-users] Chip-8

Hi,

I just read an fun article about Chip-8. Someone has worked on an emulator of 
this with Pharo?

http://www.multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/
http://miguelduarte.pt/2012/07/09/chip-8-emulator-in-javascript/

Best regards




Re: [Pharo-users] Chip-8

2016-11-20 Thread Henrik Nergaard
http://smalltalkhub.com/#!/~Latsabben/Chip8

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
olivier auverlot
Sent: Wednesday, November 16, 2016 11:22 AM
To: Any question about pharo is welcome 
Subject: [Pharo-users] Chip-8

Hi,

I just read an fun article about Chip-8. Someone has worked on an emulator of 
this with Pharo?

http://www.multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/
http://miguelduarte.pt/2012/07/09/chip-8-emulator-in-javascript/

Best regards


Re: [Pharo-users] Is it possible to file out a class hierarchy ?

2016-11-17 Thread Henrik Nergaard

| aStream aClass |

aStream := '' writeStream.
aClass := FTFilter.

FTFilter fileOutOn: aStream.
FTFilter allSubclassesDo: [ :cls |
cls fileOutOn: aStream
].

"(ChunkFileFormatParser for: aStream contents readStream) parseChunks"

---

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
PAUL DEBRUICKER
Sent: Thursday, November 17, 2016 6:16 PM
To: Any question about pharo is welcome 
Subject: [Pharo-users] Is it possible to file out a class hierarchy ?

>From a playground or nautilus is is possible to file out a class and all of 
>its subclasses into one file out?  The subclasses are in different packages, 
>which I think is a confounding factor.  



Thanks


Paul



Re: [Pharo-users] Little challenges for a friday evening

2016-11-11 Thread Henrik Nergaard
isIsogram

| i |

i := 0.

self asLowercase do: [ :char |
| val |
val := (char asInteger - 96).
(val between: 1 and: 26) ifFalse: [ ^ false ].
(i bitAt: val ) == 1 ifTrue: [ ^ false ].
i bitAt: val put: 1
].

^ true


An interesting observation here is that if #asLowercase is moved to  each 
character instead “val := (char asLowercase  asInteger - 96).” Then it leads to 
a 4-5x performance loss .




From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Damien Pollet
Sent: Friday, November 11, 2016 4:14 PM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Little challenges for a friday evening

On 11 November 2016 at 12:02, stepharo 
> wrote:
String>>#isIsogram
 | letters |
 letters := Dictionary new.
 self do: [ :x | letters at: x ifAbsent: [] ifPresent: [ ^false ].
Yes I did that one too and I was surprised because it was as slow as the bag 
implementation.

Anyone tried replacing the dictionary with an array of 26 booleans and indexing 
based on ascii, or even a SmallInteger and bit shifting?


Re: [Pharo-users] Class disappear from Nautilus, in Pharo 4

2016-11-11 Thread Henrik Nergaard
Looks like the class was created without a package?

Try something like: 
CGPhone category: 'PackageName'

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Hilaire
Sent: Friday, November 11, 2016 10:15 AM
To: pharo-users@lists.pharo.org
Subject: [Pharo-users] Class disappear from Nautilus, in Pharo 4

Hi,

I have a class which has disappear from Nautilus & al tools. The object is 
still there as I can create instance of it: CGPhone new But browsing lead to a 
Nautilus error, and the class does not appear as well from Nautilus browser.

Included change log.

Thanks

Hilaire

--
Dr. Geo
http://drgeo.eu


Re: [Pharo-users] Little challenges for a friday evening

2016-11-10 Thread Henrik Nergaard
String>>isIsogram

1 to: self size -1 do: [ :ix |
(self  
findString: (self at: ix) asString 
startingAt: ix +1 
caseSensitive: false
) ~~ 0 ifTrue: [ ^ false ]  
].

^ true

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Sven Van Caekenberghe
Sent: Thursday, November 10, 2016 11:10 PM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Little challenges for a friday evening

[ :string | string size = string asSet size ] value: 'Pharo'. 

>>> true

[ :string | string size = string asSet size ] value: 'Pharoo'.

>>> false

String>>#isIsogram
  ^ self size = self asSet size

?

> On 10 Nov 2016, at 22:19, stepharo  wrote:
> 
> Hi
> 
> I'm checking how I would implement an isogram checker
> 
> 'Pharo' isogram
> 
> >>> true
> 
> because it contains only single letter.
> 
> I got a stupid bag drivent implementation but I will do another better and 
> faster.
> 
> Stef
> 
> PS: after I will do anagram and pangram to have the family of gram checks 
> (this is for a book).
> 
> 





Re: [Pharo-users] About STONS efficiency at storing nested objects { was : (Re: Keeping data with an application)}

2016-11-02 Thread Henrik Nergaard
You could always store the closure as a string and then evaluate it on 
materialization, at least if it is clean (no thisContext and no return)

For blocks without no self usage:
--
| blk |

blk := [ :a :b | a <= b ].

#_ assert: blk isClean.

blk := Compiler evaluate: blk asString.

#_ assert: (blk value: 1 value: 2)


If self is used then it must also be stored to materialize it correctly again:


| blk ref |

blk := [ self crLog ].
ref := blk receiver.
blk := Smalltalk compiler evaluate: blk asString in: nil to: ref.
blk value


On the topic of STON, is there a way to specify that a variable should only be 
serialized if it is referenced elsewhere depper in the tree?
This could be useful, for example when storing morphs that are active in the 
world to only include #owner that are not the root serialized object and other 
structures were you might not want to serialize its parent but only deeper into 
the tree structure. 

Best regards,
Henrik


-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Sven Van Caekenberghe
Sent: Wednesday, November 2, 2016 11:11 PM
To: Any question about pharo is welcome  On 2 Nov 2016, at 20:03, Dimitris Chloupis  wrote:
> 
> I tried to use my ChronosManager object with it and STON does not seem 
> to like this
> 
> m := ChronosManager new.
> s:= STON toString: m
> s inspect.
> 
> STONWriter>>error:
> BlockClosure(Object)>>stonOn:
> STONWriter>>nextPut:
> STONWriter>>encodeKey:value:
> STONMapWriter>>at:put:
> [ :each |
> (anObject instVarNamed: each)
>   ifNotNil: [ :value | dictionary at: each asSymbol put: value ]
>   ifNil: [ anObject stonShouldWriteNilInstVars
>   ifTrue: [ dictionary at: each asSymbol put: nil ] ] ] 
> in [ 
> :dictionary | instanceVariableNames
>   do: [ :each | 
>   (anObject instVarNamed: each)
>   ifNotNil: [ :value | dictionary at: each asSymbol put: 
> value ]
>   ifNil: [ anObject stonShouldWriteNilInstVars
>   ifTrue: [ dictionary at: each asSymbol 
> put: nil ] ] ] ] in STONWriter>>writeObject: in Block: [ :each | ...
> Array(SequenceableCollection)>>do:
> [ :dictionary |
> instanceVariableNames
>   do: [ :each | 
>   (anObject instVarNamed: each)
>   ifNotNil: [ :value | dictionary at: each asSymbol put: 
> value ]
>   ifNil: [ anObject stonShouldWriteNilInstVars
>   ifTrue: [ dictionary at: each asSymbol 
> put: nil ] ] ] ] in STONWriter>>writeObject: in Block: [ :dictionary | ...
> [ self newlineIndent.
> block value: mapWriter ] in [ | mapWriter | mapWriter := STONMapWriter 
> on: self.
> writeStream nextPut: ${.
> self
>   indentedDo: [ self newlineIndent.
>   block value: mapWriter ].
> self newlineIndent.
> writeStream nextPut: $} ] in STONWriter>>writeObject:streamMap: in Block: [ 
> self newlineIndent
> STONWriter>>indentedDo:
> [ | mapWriter |
> mapWriter := STONMapWriter on: self.
> writeStream nextPut: ${.
> self
>   indentedDo: [ self newlineIndent.
>   block value: mapWriter ].
> self newlineIndent.
> writeStream nextPut: $} ] in STONWriter>>writeObject:streamMap: in Block: [ | 
> mapWriter |...
> [ writeStream nextPutAll: anObject class stonName.
> self prettyPrintSpace.
> block value ] in STONWriter>>writeObject:do: in Block: [ writeStream 
> nextPutAll: anObject class stonNameetc...
> STONWriter>>with:do:
> STONWriter>>writeObject:do:
> STONWriter>>writeObject:streamMap:
> STONWriter>>writeObject:
> KMKeymap(Object)>>stonOn:
> STONWriter>>nextPut:
> STONWriter>>encodeKey:value:
> [ :key :value |
> first
>   ifTrue: [ first := false ]
>   ifFalse: [ self mapElementSeparator ].
> self encodeKey: key value: value ] in [ self newlineIndent.
> pairs
>   keysAndValuesDo: [ :key :value | 
>   first
>   ifTrue: [ first := false ]
>   ifFalse: [ self mapElementSeparator ].
>   self encodeKey: key value: value ] ] in STONWriter>>encodeMap: 
> in Block: [ :key :value | ...
> [ :assoc | aBlock value: assoc key value: assoc value ] in 
> Dictionary>>keysAndValuesDo: in Block: [ :assoc | aBlock value: assoc key 
> value: assoc va...etc...
> [ :each | each ifNotNil: [ aBlock value: each ] ] in 
> Dictionary>>associationsDo: in Block: [ 

Re: [Pharo-users] trimRight: problem

2016-09-14 Thread Henrik Nergaard
 'This is a string.'  trimRight: [ :c | c = $. ]   works fine for me. 

The trimRight method will return a new string object without the punctuation. 
If you just do the expression without assigning it into a variable/method call, 
then it will have no effect because strings are immutable so the original 
string will remain unchanged. 

  | myString trimmedString |
  myString := 'This is a string.' .
  trimmedString := 'This is a string.'  trimRight: [ :c | c = $. ].
  1 assert: (trimmedString last = $.) not; 
   assert: myString ~~ trimmedString;
   assert: myString last = $.

---
 
Other trim options:

'This is a string.' allButLast.
'This is a string.' reject: [ :c | c =$. ].
'This is a string.' copyReplaceAll: '.' with: ''.
'' join: ($. split: 'This is a string.' ).
'This is a string.'  onlyLetters.
'This is a string.'  withoutPeriodSuffix.

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Brad Selfridge
Sent: Wednesday, September 14, 2016 10:34 PM
To: pharo-users@lists.pharo.org
Subject: [Pharo-users] trimRight: problem

I have a string that has an ending period (example - 'This is a string.'). I 
want to trim the trailing period off of the string. I've tried using: 

 'This is a string.' trimRight: [ :ea | ea = $. ] 

But, the period is not trimmed. Is there a way to do this without me having to 
extend the String class? 



-
Brad Selfridge
--
View this message in context: 
http://forum.world.st/trimRight-problem-tp4915603.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




Re: [Pharo-users] Comparing floats

2016-09-02 Thread Henrik Nergaard
You could implement a custom assert in ConverterTest  to do the comparison, 
something like

assert: aNumber withPrecision: precision equals: otherNumber

self 
assert: (aNumber round: precision) 
equals: otherNumber

assert: aNumber closeTo: otherNumber

assert: aNumber withPrecision: self defaultPrecision equals: otherNumber

defaultPrecision
^ 2


Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
stepharo
Sent: Friday, September 2, 2016 8:41 PM
To: Any question about pharo is welcome 
Subject: [Pharo-users] Comparing floats

Hi

I'm writing a simple converter between Celcius and Farhenheit as an example to 
start programming.


Converter >> convertFarhenheit: anInteger
 ^ ((anInteger - 32) / 1.8)

ConverterTest >> testFToC

 | converter |
 converter := TemperatureConverter new.
 self assert: ((converter convertFarhenheit: 86) = 30.0).
 self assert: ((converter convertFarhenheit: 50) = 10).
 self assert: ((converter convertFarhenheit: 52) = 11.11)


My problem is with ((converter convertFarhenheit: 52) = 11.11)

I do not want to have such ugly test.

I tried either to control the output

Converter >> convertFarhenheit: anInteger
 ^ ((anInteger - 32) / 1.8) roundDownTo: 0.1

Not a good idea

Or to compare with closeTo:

 self assert: ((converter convertFarhenheit: 52) closeTo: 11.11)

does not work because we cannot set the precision.

So at ESUG I briefly discuss that with Nicolas Cellier and I need help.

Should I introduce in pharo closeTo:interval:

Any suggestions that a newby can understand is welcome.


Stef





Re: [Pharo-users] SUnit and "data driven" tests

2016-08-12 Thread Henrik Nergaard
One possibility is to move the assertions to another method and have each test 
method invoke that method with a specific input.

For example
testPacketA

 self assertJitterIn: #( 1 2 3 4) equals: 42


Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Holger Freyther
Sent: Friday, August 12, 2016 10:21 AM
To: Any question about pharo is welcome 
Subject: [Pharo-users] SUnit and "data driven" tests

Hi,

I have a test/algorithm that I would like to test with different sets of input 
(and matching expected) output.

Let's imagine I write a protocol library for the RTP streaming protocol and 
would like to verify my implementation of sequence number wrapping and jitter 
delay, e.g. the difficulty is to deal with the sequence number counter wrapping.

My test-input is an array of sequence numbers and their arrival time and the 
expected result would be a calculation of "packet loss", jitter. I would like 
SUnit to call my testcase multiple times with different data being available.

Is something like this supported with SUnit?

thank you
holger



Re: [Pharo-users] System Browser "Implementors of..." drill down?

2016-07-21 Thread Henrik Nergaard
This can be achieved by selecting the message/class from the text area and 
either right clicking and using the menu->submenu "Code search..." or you can 
use the shortcuts: meta+m for implementors, meta+n for senders, and 
meta+shift+n for references of it.
There is also a shortcut (meta+space) for selecting the whole text between 
separators from where the cursor is.

"meta" is what  evaluates to (Ctrl on 
windows) .

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Norbert Fortelny
Sent: Thursday, July 21, 2016 7:55 PM
To: pharo-users@lists.pharo.org
Subject: [Pharo-users] System Browser "Implementors of..." drill down?

Something I have not figured out how to do easily in the Pharo system
browser:
I am looking at a method and want to see how a message that is used in this 
method is implemented. In other Smalltalks (e.g. Cincoms) I use the menu item 
"Implementors of..." and get a list of all the messages that are used in this 
method and can choose one to drill down.
In Pharo I get an immediate answer but only the implementors of my original 
method.
Why are there those "..." at  the end of this menu item indicating some further 
choice when there is none?
How to do this drilling down in Pharo?




--
View this message in context: 
http://forum.world.st/System-Browser-Implementors-of-drill-down-tp4907380.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




Re: [Pharo-users] change which browser opens when browsing senders/implementors

2016-07-19 Thread Henrik Nergaard
SystemNavigation>>#browseMessageList:name:autoSelect:refreshingBlock:

Adding: "methods size = 1 ifTrue: [ ^ methods anyOne browse ]." At line 10 
should do the trick I think.

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
PAUL DEBRUICKER
Sent: Wednesday, July 20, 2016 1:26 AM
To: Any question about pharo is welcome 
Subject: [Pharo-users] change which browser opens when browsing 
senders/implementors

Which method should I change if when browsing senders/implementors there is 
only one sender or implementor I'd like the Nautilus browser to open?


thanks


Paul



Re: [Pharo-users] Better color contrast for class extensions in dark theme

2016-06-24 Thread Henrik Nergaard
Pharo3DarkTheme >>#selectionColor

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Offray Vladimir Luna Cárdenas
Sent: Friday, June 24, 2016 7:20 PM
To: pharo-users@lists.pharo.org
Subject: Re: [Pharo-users] Better color contrast for class extensions in dark 
theme


Hi :),

Well, in the spirit of today's bug fixing hackathon, I should ask better some 
pointers about how to fix the color issue myself. So any advice is appreciated.

Cheers,

Offray

On 24/06/16 11:52, Offray Vladimir Luna Cárdenas wrote:

Hi :),

I'm enjoying the Pharo Dark Theme a lot (in fact my tweet on a 10 minutes hack 
about it[1] have more impact that the tweets with month and a half work  behind 
for Panama Papers[2]... that's life :-P), but I still have some suggestions on 
color contrast, particularly when you're doing class extensions and the light 
gray over blue makes the  reading really difficult (see screenshot at bottom).

[1] https://twitter.com/offrayLC/status/738828257680850944

[2] https://twitter.com/offrayLC/status/729069808684285953


[cid:image001.png@01D1CE52.7B5408C0]

Hope this helps to improve this theme.

Cheers,

Offray



Re: [Pharo-users] How can an image know it is running headless?

2016-06-22 Thread Henrik Nergaard
MessageBrowser browse: (
(Symbol selectorTable 
select: [ :s | s includesSubstring: #headless caseSensitive: 
false ]
) flatCollect: [ :s | s implementors ] as: OrderedCollection
).


Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Johan Fabry
Sent: Wednesday, June 22, 2016 11:57 PM
To: Pharo is welcome 
Subject: [Pharo-users] How can an image know it is running headless?

Hi all,

I would like to know how to know if the image is running in headless mode. Is 
there an expression I can run in my code to establish that?

TIA,

--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please 
see http://emailcharter.org .

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of 
Chile




Re: [Pharo-users] The #compile: selector

2016-06-15 Thread Henrik Nergaard
SomeClass compile: 'foo ^ ''foo''' classified: #accessor

Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Mark Bratcher
Sent: Wednesday, June 15, 2016 8:06 PM
To: Any question about pharo is welcome 
Subject: [Pharo-users] The #compile: selector

When using the #compile: selector to dynamically create a selector, is there a 
way (e.g., a pragma) to specify the category for the dynamic selector in a way 
that Pharo will see it? I tried, for example:

s := String new writeStream.
s nextPutAll: 'foo' ; cr ; nextPutAll: '  ' ; cr ; 
nextPutAll: '  ^fooVar' ; cr.
Foo compile: s contents.

Which created the following selector just fine:

foo

^ fooVar

But Pharo considers it uncategorized. I'm just wondering if it's possible.

Thanks
Mark



Re: [Pharo-users] Lockup when inspecting Text

2016-05-25 Thread Henrik Nergaard
Could you post the string/text object you have trouble inspecting?
Both: "Text new inspect" and " (String loremIpsum: 1234) asText inspect" works 
fine for me (Image 60035).

I can't interrupt the display (Ctrl-.).
Try (Alt-.)

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Alistair Grant
Sent: Wednesday, May 25, 2016 5:56 PM
To: pharo-users@lists.pharo.org
Subject: [Pharo-users] Lockup when inspecting Text

Hi All,

I've got a Text object which I can inspect the string or the runs, but when I 
attempt to inspect the text object itself Pharo goes into a CPU loop and 
becomes unresponsive.  I can't interrupt the display (Ctrl-.).

I've attempted to step through the code to find the problem, however Pharo is 
going into a CPU loop when returning from GLMMorphicPageRenderer>>render:.

I've included the stack trace leading to #render below.  At the moment I'm 
struggling for ideas on how to track this down.

Any suggestions?

Thanks!
Alistair


The stack trace just before returning from #render: is:

GLMMorphicPagerRenderer>>render:
GLMMorphicPagerRenderer class(GLMMorphicWidgetRenderer class)>>render:from:
GLMMorphicRenderer>>renderPager:
GLMPager>>renderGlamorouslyOn:
GLMMorphicRenderer(GLMRenderer)>>render:
GLMMorphicTabbedRenderer(GLMMorphicWidgetRenderer)>>renderObject:
GLMMorphicTabbedRenderer(GLMMorphicWidgetRenderer)>>renderWithTitleOrNil:
GLMMorphicTabbedRenderer>>render:
GLMMorphicTabbedRenderer class(GLMMorphicWidgetRenderer class)>>render:from:
GLMMorphicRenderer>>renderTabbedCompositePresentation:
GLMTabbedArrangement>>renderGlamorouslyOn:
GTInspector(GLMCompositePresentation)>>renderGlamorouslyOn:
GLMMorphicRenderer(GLMRenderer)>>render:
GLMMorphicWindowRenderer(GLMMorphicWidgetRenderer)>>renderObject:
GLMMorphicWindowRenderer>>render:
GLMMorphicWindowRenderer class(GLMMorphicWidgetRenderer
class)>>render:from:
GLMMorphicRenderer>>open:
GTInspector(GLMCompositePresentation)>>openWith:
GTInspector(GLMCompositePresentation)>>openOn:with:
GTInspector(GLMCompositePresentation)>>openOn:
GTInspector>>openOn:
GTInspector class>>openOn:
GTInspector class>>inspect:
Text(Object)>>inspect


This is where I'm attempting to inspect the object.


OrderedCollection>>DoIt
OpalCompiler>>evaluate
RubSmalltalkEditor>>evaluate:andDo:
RubSmalltalkEditor>>highlightEvaluateAndDo:
[ textMorph textArea editor highlightEvaluateAndDo: ann action.
textMorph shoutStyler style: textMorph text ] in [ textMorph textArea
handleEdit: [ textMorph textArea editor highlightEvaluateAndDo:
ann action.
textMorph shoutStyler style: textMorph text ] ] in
GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate:
RubEditingArea(RubAbstractTextArea)>>handleEdit:
[ textMorph textArea
handleEdit: [ textMorph textArea editor highlightEvaluateAndDo:
ann action.
textMorph shoutStyler style: textMorph text ] ] in
GLMMorphicPharoScriptRenderer(GLMMorphicPharoCodeRenderer)>>actOnHighlightAndEvaluate:
WorldState>>runStepMethodsIn:
WorldMorph>>runStepMethods
WorldState>>doOneCycleNowFor:
WorldState>>doOneCycleFor:
WorldMorph>>doOneCycle
[ [ World doOneCycle.
Processor yield.
false ] whileFalse: [  ] ] in MorphicUIManager>>spawnNewProcess [ self value.
Processor terminateActive ] in BlockClosure>>newProcess





Re: [Pharo-users] Disabling welcome window

2016-05-17 Thread Henrik Nergaard
World submorphs
   select: [ :sm |
  sm isSystemWindow and: [ sm label = 
PharoWelcomePage title ]
   ]
   thenDo: [ :window | window delete ].

Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Peter Uhnák
Sent: Wednesday, May 18, 2016 12:20 AM
To: Pharo-Users List 
Subject: [Pharo-users] Disabling welcome window

Is there a clean way how to close or not open the Pharo 5.0 welcome window?

Short of going through the stack and closing it (courtesy of Cyril)

 (SystemWindow allInstances select:  [ :w | w labelString includesSubstring: 
'Welcome' ]) do: #delete

Thanks,
Peter


Re: [Pharo-users] Playgound inspecting

2016-04-27 Thread Henrik Nergaard
By the way, would someone know how to force the styler to re-style a text?
RubShoutStylerDecorator>># refreshStyling

So from the textArea something like:
(self decoratorNamed: #shoutStyler) ifNotNil: [ :styler | styler refreshStyling 
]

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Thierry Goubier
Sent: Wednesday, April 27, 2016 10:17 PM
To: pharo-users@lists.pharo.org
Subject: Re: [Pharo-users] Playgound inspecting

Le 27/04/2016 21:26, Hilaire a écrit :
> Now I remember I already asked several months ago, and it does not work.
>
> Editing on the value does not work for me.
>
> http://forum.world.st/GL-inspector-editing-attribute-td4837704.html
>
> The same mis fortune is encountered with Pharo5
>
> I don't imagine how it can be like that and I fell unproductive now 
> with Playground and GTInspector, althought I acknowledge there are 
> nice ideas in these new tools but it can't be at the price of productivity.
>
> Hopefully you can switch to Workspace and EyeInspector.

With the help of Nicolai Hess, we worked a bit on improving syntax colouring 
for the EyeInspector and this has been integrated. Maybe someone can look into 
doing the same with GT (to correctly set #doItReceiver, #doItContext and a few 
other things related to syntax highlighting).

By the way, would someone know how to force the styler to re-style a text? When 
selecting another element in for example a EyeTreeInspector, this changes the 
reference class for syntax highlighting (and the styler correctly picks that) 
but the existing text isn't re-colored.

Thierry

>
> Hilaire
>
>
> Le 27/04/2016 15:51, Sean P. DeNigris a écrit :
>> HilaireFernandes wrote
 instance variables evaluate to nil in the bottom area of the 
 integrated inspector.
>> There is no direct inst var access from the playground. I was 
>> initially shocked by this as well and have had to resort to 
>> #instVarNamed: on several occasions. On the bright side, you can edit 
>> the values in place in the 'Value' column above.
>





Re: [Pharo-users] Pharo-users Question about the symbols

2016-04-08 Thread Henrik Nergaard
| s1 s2 |

s1 := 1234 asString.
s2 := 1234 asString.

s1 = s2. "true"
s1 == s2. "false"

s1 asSymbol = s2 asSymbol. "true"
s1 asSymbol == s2 asSymbol. "true"

(s1 class allInstances select: [:s | s = s1 ]) size. "2"
(s1 asSymbol class allInstances select: [:s | s = s1 asSymbol ]) size. "1"

[ #stringA = #stringB ] bench. "26,812,864 per second"
[ 'StringA' = 'StringB' ] bench. "3,492,987 per second"

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of Ben 
Coman
Sent: Friday, April 8, 2016 3:23 AM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Pharo-users Question about the symbols

A symbol is like a string, except that all symbols with the same value are in 
fact the same object; that is, every #hello symbol is the exact same object as 
every other #hello symbol.

See "identically equal" section here...
http://sdmeta.gforge.inria.fr/FreeBooks/ByExample/08%20-%20Chapter%206%20-%20Special%20Symbol.pdf

cheers, ben

On Fri, Apr 8, 2016 at 7:20 AM, Valentin Ryckewaert 
 wrote:
> Hello everyone,
>
> i'm learning Pharo and i'm having difficulties to understand the 
> symbols, what are they? How are they different of the ByteString ? Why 
> are they usefull ?
> Why should I put #string where I can put 'string' ?
>
> Thanks in advance for your answer.
> Valentin Ryckewaert



Re: [Pharo-users] STON UUID in the key

2016-04-02 Thread Henrik Nergaard
You need to set “allowComplexMapKeys” in StonReader to true for it to handle 
objects as keys.

| reader |

reader := STONReader new.
reader allowComplexMapKeys: true.
reader on: (STON toStringPretty: (Object new-> Morph new -> nil)) readStream.

reader next.


Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Peter Uhnák
Sent: Saturday, April 2, 2016 10:45 PM
To: Pharo Users List 
Subject: [Pharo-users] STON UUID in the key

Why does this fail?


STON fromString: (
STON toStringPretty: (Dictionary with: UUID new -> nil)
)


I would assume that if it can be serialized, then it should be also parsable.

Having scalars for keys is JSON (and JavaScript) limitation because it's stupid,
but if Smalltalk can have any hashable object for key (so any object), then it 
should be also possible to STON it in/out.

Would this be hard to change?

Peter


Re: [Pharo-users] Ideas of web services that I could script in a couple of lines?

2016-03-13 Thread Henrik Nergaard
Ahh!
I was looking at STON first but could not find any #parseJsonString: or similar.
Perhaps this should be mentioned in the class comment? :)

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Sven Van Caekenberghe
Sent: Sunday, March 13, 2016 10:53 PM
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Subject: Re: [Pharo-users] Ideas of web services that I could script in a 
couple of lines?


> On 13 Mar 2016, at 22:42, Henrik Nergaard <henrik.nerga...@uia.no> wrote:
> 
> Correct, I used that for the example since it is by default in the Image .

And that is a pity, IMHO, it sneaked in, while others have asked for NeoJSON to 
be included in the past ;-)

Anyway, STON, which is also part of the base image can parse JSON just as well.

  STON fromString: '[42, {"JSON":true}, -1.5]'.

You can also generate JSON.

  STON toJsonStringPretty: { 42. { 'JSON'->true } asDictionary. -1.5 }.

  STON toJsonString: { 42. { 'JSON'->true } asDictionary. -1.5 }.

> Best regards,
> Henrik
> 
> -Original Message-
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
> stepharo
> Sent: Sunday, March 13, 2016 10:34 PM
> To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
> Subject: Re: [Pharo-users] Ideas of web services that I could script in a 
> couple of lines?
> 
> Henrik
> 
> do you use MCFileTreeJsonParser
> just because this was just the JSON parser you got at hand?
> 
> Stef
> 
> Le 13/3/16 22:24, Henrik Nergaard a écrit :
>> Accessing the Nominatim service: 
>> http://wiki.openstreetmap.org/wiki/Nominatim .
>> 
>> http://ws.stfx.eu/ATBXE2DN83CW
>> 
>> Best regards,
>> Henrik
>> 
>> -Original Message-
>> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
>> stepharo
>> Sent: Sunday, March 13, 2016 9:52 PM
>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
>> Subject: [Pharo-users] Ideas of web services that I could script in a couple 
>> of lines?
>> 
>> Hi hernan and others
>> 
>> I'm looking for ideas of simple services capital, dictionaries
>> forecast that I could access using Zinc in a couple of lines.
>> 
>> This is for challenges that I'm writing for the mooc.
>> Stef
>> 
>> 
>> 
> 
> 




Re: [Pharo-users] Ideas of web services that I could script in a couple of lines?

2016-03-13 Thread Henrik Nergaard
Correct, I used that for the example since it is by default in the Image .

Best regards,
Henrik  

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
stepharo
Sent: Sunday, March 13, 2016 10:34 PM
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Subject: Re: [Pharo-users] Ideas of web services that I could script in a 
couple of lines?

Henrik

do you use MCFileTreeJsonParser
just because this was just the JSON parser you got at hand?

Stef

Le 13/3/16 22:24, Henrik Nergaard a écrit :
> Accessing the Nominatim service: http://wiki.openstreetmap.org/wiki/Nominatim 
> .
>
> http://ws.stfx.eu/ATBXE2DN83CW
>
> Best regards,
> Henrik
>
> -Original Message-
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
> stepharo
> Sent: Sunday, March 13, 2016 9:52 PM
> To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
> Subject: [Pharo-users] Ideas of web services that I could script in a couple 
> of lines?
>
> Hi hernan and others
>
> I'm looking for ideas of simple services capital, dictionaries
> forecast that I could access using Zinc in a couple of lines.
>
> This is for challenges that I'm writing for the mooc.
> Stef
>
>
>




Re: [Pharo-users] Ideas of web services that I could script in a couple of lines?

2016-03-13 Thread Henrik Nergaard
Accessing the Nominatim service: http://wiki.openstreetmap.org/wiki/Nominatim .

http://ws.stfx.eu/ATBXE2DN83CW

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
stepharo
Sent: Sunday, March 13, 2016 9:52 PM
To: Any question about pharo is welcome 
Subject: [Pharo-users] Ideas of web services that I could script in a couple of 
lines?

Hi hernan and others

I'm looking for ideas of simple services capital, dictionaries
forecast that I could access using Zinc in a couple of lines.

This is for challenges that I'm writing for the mooc.
Stef





Re: [Pharo-users] Get the code of a method - Artefact

2016-03-10 Thread Henrik Nergaard
( aClass >> #aSelector ) sourceCode.

Ex:

(Morph>>#drawOn:) sourceCode

For class side methods:

(Object class >> #taskbarIcon) sourceCode

Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Guillaume Ongenae
Sent: Thursday, March 10, 2016 11:14 AM
To: pharo-users@lists.pharo.org
Subject: [Pharo-users] Get the code of a method - Artefact

Hello,

I'm a student at Lille 1 university, so I'm still a beginner in Pharo

I'm working on Artefact to create a more understable and complete demonstration.
To do that I would like to print the code of a given method. However I can find 
how to decompiled the given method.
Any help is welcome.

--


Feil! Filnavn er ikke angitt.
[Bilde er fjernet av sender.]



Guillaume Ongenae
Feil! Filnavn er ikke angitt.about.me/guillaume.ongenae







Re: [Pharo-users] View a class with inherited variables/methods

2016-03-08 Thread Henrik Nergaard
>From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
>Esteban A. Maringolo
>Sent: Tuesday, March 8, 2016 9:03 PM
>To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
>Subject: Re: [Pharo-users] View a class with inherited variables/methods

>Hi Henrik,

>2016-03-08 16:57 GMT-03:00 Henrik Nergaard <henrik.nerga...@uia.no>:
>> #withAllSubclasses

>> TextMorphForFieldView withAllSuperclasses reversed collect: [ :cls |  cls -> 
>> {cls instVarNames  . cls methods }].

>I was doing something similar like:
>MyClass withAllSuperclasses reversed flatCollect: [ :cls |  cls instVarNames ].

>But I was asking if there was a tool that already provides that.

Ah, so Something like this then?
--
| classToView browser list nav |

classToView := TextMorphForFieldView.

nav := SystemNavigation new 
browsedEnvironment: RBBrowserEnvironment new;
yourself.

browser := MessageBrowser new
title: 'aTitle'; 
autoSelect: classToView name; 
messages: #();
yourself.

list := FTEasyListMorph new
hResizing: #spaceFill; 
vResizing: #spaceFill;
elements: (classToView  withAllSuperclasses reversed flatCollect: [ 
:cls | cls instVarNames ]);
beSingleSelection;
yourself.

list onAnnouncement: FTSelectionChanged do: [ :ann | | ivar |
ivar := [ list dataSource elementAt: ann newSelectedRowIndexes anyOne ] 
ifError: [ nil ].
ivar ifNotNil: [ browser messages: (nav allAccessesTo: ivar from: 
classToView )
]
].

(AlignmentMorph new
setAsRow;
addMorph: browser buildWithSpec;
addMorph: list;
layoutChanged;
fullBounds;
openInWindowLabeled: 'Stuff')
position: 20@20;
extent: 900@620.

---

 Best regards,
Henrik


>Thank you!


>Esteban A. Maringolo



Re: [Pharo-users] View a class with inherited variables/methods

2016-03-08 Thread Henrik Nergaard
#withAllSubclasses 

TextMorphForFieldView withAllSuperclasses reversed collect: [ :cls |  cls -> 
{cls instVarNames  . cls methods }].

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Esteban A. Maringolo
Sent: Tuesday, March 8, 2016 8:50 PM
To: Pharo users 
Subject: [Pharo-users] View a class with inherited variables/methods

Is there a way to view a class with all the inherited instance variables and/or 
methods?

I'm trying to understand some code, and because the inheritance tree is not 
shallow, I'd like to see all the variables it has (both own and inherited).

Regards!

Esteban A. Maringolo



Re: [Pharo-users] Getting whether specific key is currently pressed

2016-02-13 Thread Henrik Nergaard
Quick and dirty: "Sensor shiftPressed"

The modification keys (shift/ctrl/alt/cmd?) is available at the MorphicEvent 
side see the class UserInputEvent (variable buttons + protocol modifier state). 
Adding a variable to TRAbstractMouseEvent (removing those at 
TRAbstractMouseClick) which hold this information 
+ the same messages as in "modifier stae" 
+ in each rtMouse... method in RTMorph add a line setting the button state from 
the evt argument to the RTEvent type (for example "ee modifierState: evt 
buttons") should make this information available for any mouse event in Roassal.

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of Jan 
Bliznicenko
Sent: Saturday, February 13, 2016 8:27 PM
To: pharo-users@lists.pharo.org
Subject: Re: [Pharo-users] Getting whether specific key is currently pressed

That's true, but I'm not sure that modifying TRMorph, TRMouseDragStart and 
TRMouseDragEnd is the right way to go here, so I'm interested in finding 
simpler solution if there is any.

Jan


Peter Uhnák wrote
> Mouse and keyboard events are usually captured by TRMorph and then 
> converted into Roassal events, so check there.
> 
> Peter
> 
> On Sat, Feb 13, 2016 at 4:06 PM, Jan Blizničenko 

> bliznjan@.cvut

> 
> wrote:
> 
>> Hello
>>
>> I would like to ask whether is there any way to directly find out if 
>> specific key (shift in my case) is currently pressed. I am trying to 
>> implement own multi-selection of elements drawn on Roassal canvas, 
>> but I do not receive original MouseClick/Drag/whatever event with 
>> shiftKeyPressed, but I receive only Roassal selection event without 
>> this kind of information.
>> It would require lots of modifications on Roassal part to forward 
>> such info (although it would be possible I suppose), so I am looking 
>> for a way to bypass it.
>>
>> Any help is appreciated.
>>
>> Jan Blizničenko
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Getting-whether-specific-key-is-currently-press
>> ed-tp4877401.html Sent from the Pharo Smalltalk Users mailing list 
>> archive at Nabble.com.
>>
>>





--
View this message in context: 
http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401p4877420.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] 4th Chapter of Updated Pharo by Example ready for review.

2016-01-24 Thread Henrik Nergaard
Hi Stef,

In the section "Message structure" some of the code refers to the class Pen 
which is no longer in the default image (I think it is located in 
PharoExtras?), perhaps it would be better to change the examples to another 
class existing in the default image so one can easily try out the code?

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
stepharo
Sent: Sunday, January 24, 2016 10:17 PM
To: Pharo Development List ; Any question about 
pharo is welcome 
Subject: [Pharo-users] 4th Chapter of Updated Pharo by Example ready for review.

4th Chapter of Updated Pharo by Example ready for review.

https://ci.inria.fr/pharo-contribution/view/Books/job/UpdatedPharoByExample/lastSuccessfulBuild/artifact/book-result/UnderstandingMessage/UnderstandingMessage.pdf
 


This one was way simpler than the PharoTour and FirstAplication, so I imagine 
that the review will be easier too.

Stef
Not thinking too much, just doing.



Re: [Pharo-users] Updating a project and NIL class variables

2016-01-20 Thread Henrik Nergaard
“The warning is: this only happens when the *source* code of the #initialize 
methods changes. So sometimes, you will have to touch that method to force it.”

Perhaps there should be an overload able method that decides whether or not to 
initialize the class, such that classes relying on reinitializing  every time a 
change is merged, can do this by simply answering true?


From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Dimitris Chloupis
Sent: Wednesday, January 20, 2016 3:47 PM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Updating a project and NIL class variables

no apologies owed, I just asked because I want to make sure Pharo wont do 
anything weird behind my back :)

On Wed, Jan 20, 2016 at 4:39 PM Sven Van Caekenberghe 
> wrote:

> On 20 Jan 2016, at 15:34, Dimitris Chloupis 
> > wrote:
>
> Thank you for the info but I think I did not make myself clear because you 
> say "remain nil"
>
> Ok Imagine a class SomeClass and that class has a variable we will call 
> SomeVariable, class variable that is
> , there is no class initialize method, now that class has a method that is 
> eventually called ,
> someMethod
>
> SomeVariable ifNil: [ SomeVariable := 'hello world']
>
> so when I decide to update this class via metacello loading the latest 
> version from github ,  SomeVariable will have the value 'hello world'
>
> My question is , will SomeVariable after I do the update revert back to nil  
> or stay 'hello world' ?
>
> If your answer is no, and it stays 'hello world' then yes i need an 
> initialize method and call it at update time.

Argh, I should have said: keeps it value, will not revert to nil.

Sorry for the confusion !

> On Wed, Jan 20, 2016 at 2:54 PM Sven Van Caekenberghe 
> > wrote:
> They remain nil.
>
> That is why #initialize on the class side is needed.
>
> You can call that explicitly in a post load script, or rely on the class 
> loading mechanism that normally calls #initialize automatically when loading 
> a class. The warning is: this only happens when the *source* code of the 
> #initialize methods changes. So sometimes, you will have to touch that method 
> to force it.
>
> I hope that makes sense.
>
> See MCMethodDefinition>>#postloadOver:
>
> > On 20 Jan 2016, at 13:41, Dimitris Chloupis 
> > > wrote:
> >
> > So my question is this , I have a class with nil variables that are lazy 
> > initialised only when needed the first time and of course they keep their 
> > values from there on.
> >
> > Lets say I get the latest update from github via metacello over an older 
> > update that I already have inside the image , do those variables revert 
> > back to nil values ? or do they keep their values as they are ?
>
>



Re: [Pharo-users] Fogbuz issues

2016-01-17 Thread Henrik Nergaard
In the top right corner of Fogbugz there is a menu which has an entry called 
“subscriptions” here you can configure what you want to be automatically 
subscribed to. See attachment.

Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Nicolai Hess
Sent: Sunday, January 17, 2016 11:25 AM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Fogbuz issues



2016-01-17 11:00 GMT+01:00 Dimitris Chloupis 
>:
Since I am on a complaining spree lately let me complain once more.
I really dont like Fogbuz and in order not to bore with blah blah lets get to 2 
big issues
1) If you open a bug report it does not subscribe you to it, WTF !!! Who else 
could be more interested in my bug report than I ?
2) If I go to My Cases its shows none of the reports I opened , actually it 
shows nothing, none, zero , empty space  WTF^2

Yes this is confusing, "My Cases" only shows issues "assigned to you".

Instaed, you can filter all cases by

editedBy:theKilon
or
openedBy:theKilon


And people then wonder why on earth I keep pushing for github integration, 
thats why !



Re: [Pharo-users] About profiling code

2015-11-22 Thread Henrik Nergaard
To profile the creation and drawing, create a canvas and do a #fullDrawOn: onto 
it.

Example:
[ 
| morph canvas |

morph := FTTableMorph new
extent: 300@300;
dataSource: (FTExampleDataSource elements: (Smalltalk 
allClassesAndTraits 
sorted: [ :a :b | a name < b name]));
yourself.

canvas := FormCanvas 
extent: morph fullBounds extent 
depth: Display depth. 

morph fullDrawOn: canvas

] timeProfile.

Best regards,
Henrik

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Stephan Eggermont
Sent: Sunday, November 22, 2015 9:16 PM
To: pharo-users@lists.pharo.org
Subject: Re: [Pharo-users] About profiling code

On 22-11-15 20:42, Guillermo Polito wrote:
> Out of the top of my head, doing it like that only profiles widget 
> creation/install if I'm not mistaken. But not render time.
>
> Because the doit is executed inside the event processing of the 
> morphic render loop. But a cool ui profiling should also measure the drawOn:
> methods.
>
> I don't know if there is a tool to do that right know but it would be 
> possible...

Thierry explained:
Show halos on a Morph, inspect morph, DoIt [self fullDrawOn: Display getCanvas] 
timeProfile in the inspector.

I've noticed very large differences in where time is spend (and not just the 
first time when all default values still need to be calculated).

Stephan




Re: [Pharo-users] ifNotEmpty(Do):

2015-10-10 Thread Henrik Nergaard
Look like #ifNotEmpty: is the correct choice.

Collection methods select: [ :m |
   (m selector  includesSubstring: 'if' caseSensitive: 
false) and: [
  m selector includesSubstring: 'empty' 
caseSensitive: false
   ]
]
thenCollect: [ :m | m -> m senders size ]

"{
   Collection>>#ifEmpty:->188.
   Collection>>#ifNotEmpty:->113.
   Collection>>#ifNotEmptyDo:ifEmpty:->0.
   Collection>>#ifEmpty:ifNotEmpty:->80.
   Collection>>#ifEmpty:ifNotEmptyDo:->0.
   Collection>>#ifNotEmptyDo:->0.
   Collection>>#ifNotEmpty:ifEmpty:->14
}"

Best regards,
Henrik

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Peter Uhnák
Sent: Saturday, October 10, 2015 6:55 PM
To: Pharo Users List 
Subject: [Pharo-users] ifNotEmpty(Do):

Collection>>ifNotEmpty: comment says

"If the block has an argument, eval with the receiver as its argument,
but it might be better to use ifNotEmptyDo: to make the code easier to
understand"

yet when I do that, Code Critic complains:
ifNotEmptyDo: should not be used as ifNotEmpty: works for blocks with 
arguments, too.


1) who is right? what should I use?
2) shouldn't one be deprecated then? (or maybe one of them is to be compatible 
with other smalltalks?)

Thanks,
Peter