[Pharo-users] Re: [Pharo @ FOSDEM 2021] Stand

2021-01-11 Thread Ben Coman
As a backup, you could edit videos from ESUG 2019
https://www.youtube.com/playlist?list=PLJ5nSnWzQXi8DPNpy1jCkjE4yE0WUtDP2
e.g..
- "Show us your project"
https://www.youtube.com/watch?v=RNQKwcYb6Jc=PLJ5nSnWzQXi8DPNpy1jCkjE4yE0WUtDP2=50
- "Object Centric Debugging"
https://www.youtube.com/watch?v=uDYJIm54yE4=PLJ5nSnWzQXi8DPNpy1jCkjE4yE0WUtDP2=18


On Wed, 6 Jan 2021 at 23:04, Santiago Bragagnolo <
santiagobragagn...@gmail.com> wrote:

> Hello everybody.
> We have been accepted to have a virtual stand in FOSDEM 2021.
>
> The idea is to start gathering information to show in the stand about
> Pharo.
> Besides the pharo graphical image related content, we would like to offer
> also success stories, and also videos related to your tools / fwks /
> business etc, from the point of view of how pharo was a good choice, how it
> was helpful. Like this we can gather stories that promote your things and
> pharo at the same time.
>
> Also I would like to ask to all those persons doing research on pharo to
> have some kind of video equivalent to a poster presentation, remarking the
> interest of using pharo.
>
> And to the people that works on pharo core, if you have videos presenting
> features or assets such as how to build tests, how pharo is integrated with
> sisop, how it is rendered, how it is interpreted, jited, etc. We could have
> a track on youtube or similar presenting many features :).
>
>
> Of course if you want to participate actively on the organization of the
> stand you are more than welcome. Please send me a private message and we
> may build some communication group to share ideas and organize.
>
> Thanks a lot for your attention :)
>
> Santiago
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> El mié, 6 ene 2021 a las 15:53, Santiago Bragagnolo (<
> santiagobragagn...@gmail.com>) escribió:
>
>> We applied to participate in FOSDEM 2021, and we were accepted :)!
>>
>> ===
>> Hello team behind Pharo,
>>
>> Your submission for a stand at FOSDEM 2021 has been accepted.
>>
>> We welcome you to FOSDEM 2021, our first fully digital edition.
>>
>> As a reminder, this is what you can expect this year.
>>  - A spot on our exhibition website (stands.fosdem.org).
>>  - A Matrix chatroom.
>>  - A place to store video's.
>>
>> The exhibition website is a static site generated by hugo (gohugo.io).
>> We have set the theme and the structure, and you can add as many pages as
>> you want. The code for the website currently lives at
>> https://github.com/FOSDEM/stands-website . Documentation will be added
>> shortly (and will be communicated via the list).
>>
>> To get started with adding content to the website, follow these steps:
>>
>>  1. Create two git repositories (public), one for your content and one
>> for your static files. Provide us with both links and make sure we can pull
>> anonymously.
>>  2. Add pages in any format Hugo accepts. Note that you cannot add more
>> levels (if you want a deeper structure, ask us).
>>  3. Once every hour a script will rebuild the website.
>>  4. You can add links to your own website(s) as well, but we ask that you
>> keep stand-related things on our stands website.
>>
>> We'll provide more information on where to upload the video's later this
>> month. It is up to you if you wish to create them, but we think it will add
>> value to your stand.
>>
>> More details on the chatroom will also be made available in the coming
>> week.
>>
>> This week, we'll publish the list of accepted stands on our website, and
>> add the primary and secondary contact to standhold...@lists.fosdem.org
>> for further communication. By the beginning of next week, the exhibition
>> website will be put online (behind authentication as it is not public yet).
>> As soon as the infrastructure is in place, the video site and the Matrix
>> chatroom will be configured.
>>
>> We'll send further updates to the standholders mailing list. Please bear
>> with us, this is new for us as well ;-)
>>
>> We hope to see you at FOSDEM!
>>
>> Kind regards,
>>
>> The FOSDEM Stands Team
>>
>


Re: [Pharo-users] Want to create a text Field using SPEC2 to get Value from User

2020-07-30 Thread Ben Coman
On Wed, 29 Jul 2020 at 23:57, kmo  wrote:
>
> Let's see: 'a.bat 10' works but 'a.bat', myTextField asString does NOT work.
> There's clearly something wrong with 'a.bat', myTextField asString - but
> what? As Tim says, you have to investigate.
>
> Tim has suggested a couple of ways you could investigate. Here's another -
>
> You have my code that writes the stuff typed in to myTextField to the
> Transcript when you click the button. Did you get it working? Did you try it
> out? Are you happy you understood it? The Transcript is not perhaps the best
> way to debug but in this case you have it readily available.
>
> Amend that code so that it writes out 'a.bat', myTextField asString to the
> Transcript. Do you get what you expect? If not, why is that?
>
> When you see what you are getting it should give you a good clue as to what
> is wrong. Keep experimenting with the code until you get precisely what you
> want appearing in the Transcript. Then you can go back and change the code
> to use LibC

This is good advice, and to clarify further...

If this works...
myButton whenActivatedDo: [LibC system: 'a.bat 10'].
and this doesn't...
   myButton whenActivatedDo: [LibC system: 'a.bat', myTextField asString].
and you can't see why, then you likely have an assumption about what
you think is happening, that is blinding you what is actually
happening, which you need to expose :)
i.e. you need to know *exactly* what string is being passed in the
#system: call.
One way to do that is to replace "LibC system:" with
"Transcript:show:" in your code.

cheers -ben.
myButton whenActivatedDo: [ Transcript show: myTextField text]



Re: [Pharo-users] UFFI asynchronous callbacks

2020-07-25 Thread Ben Coman
Could you provide the actual code you are running?

On Sat, 25 Jul 2020 at 16:17, ASAM  wrote:
>
> Hi Pablo,
> today I have a little bit of time to try out the "threaded FFI".
> But immediately with the load I get the following error message
> "PrimitiveFailed: primitive #primitiveInitializeQueueWith: in
> TFCallbackQueue failed".
>
> see pic:  
>
> When I load it again it looks good. But then I get the error message with
> every Pharo start.
>
> To rule out possible errors, I tested with a fresh Pharo8 64bit image, of
> course.
>
> Could you tell me what i'm doing wrong?
>
> Thanks
> ASAM
>
>
>
>
>
>
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>



Re: [Pharo-users] How to get text field value and send to bat file

2020-07-25 Thread Ben Coman
Searching the table of contents of Pharo By Example
I see "Using streams for file access"
that would be a good place to start, and then browse other the methods
of the classes used there,
and also the "senders" of any of those that look interesting.

cheers -ben

On Sat, 25 Jul 2020 at 15:04, shawon58  wrote:
>
> Hello
> i am new in GUI in pharo . I am following Spec2 form where i can able to
> make form that send value and show in result tab. But my concern is i want
> to send the text field value to a Bat file which will execute a C++ file. So
> i want to use LibC system: 'a.bat textfieldinput' like this but how to do i
> dont know. If anyone have idea pleas share with me. In the screenshot u can
> see that i can send a number that shows in result tab. But now i want to
> send same number when i press submit than it will send to  LibC system:
> 'a.bat textfieldinput' means in bat it will receive the number from the
> form.
>
> Thanks
>
> 
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>



Re: [Pharo-users] how to make a simple form in GUI

2020-07-22 Thread Ben Coman
On Wed, 22 Jul 2020 at 11:57, shawon58  wrote:
>
> Hello
> i am new in GUI , so i want to know how to make a simple from that can have
> some data and display those data.

https://books.pharo.org/spec-tutorial/
http://agilevisualization.com/

cheers -ben



Re: [Pharo-users] Bit Manipulation Challenge

2020-07-20 Thread Ben Coman
On Mon, 20 Jul 2020 at 23:19, Sean P. DeNigris  wrote:
>
> I want to take an IP address routing prefix in CIDR [1] notation (i.e. the 24
> in "192.168.100.14/24") and convert it into subnet form (i.e.
> 255.255.255.0). I came up with 4 ways to do that (see below), but none stand
> out as best (although #3 and #4 seem a bit more straightforward as they
> avoid the `max` temp).
>
> How would you go about it?
>
> Here are the ways I came up with:
> cidr := 24.
> shift := 32 - cidr.
> max := #[ 255 255 255 255 ] asInteger.
> "1." ((max bitShift: shift negated) bitShift: shift) asByteArray.
> "2." (max bitClear: (2 raisedTo: shift) - 1) asByteArray.
> "3." ((2 raisedTo: shift) - 1) bitInvert32 asByteArray.
> "4." (((2 raisedTo: cidr) - 1) bitShift: shift) asByteArray

To me the most complicated ones have the "subtract 1" - it makes it
harder to reason about.  I'd also guess "3" and "4" are slowest.

"1." can be simplified by hardcoding max
5. (4294967295 bitShift: shift negated) bitShift: shift) asByteArray

Additional alternative...
6. ((4294967295 bitShift: shift) rem: 4294967296) asByteArray

And why not low-brow...
7. CIDRLookup at: cidr.

cheers -ben



Re: [Pharo-users] UFFI asynchronous callbacks

2020-07-19 Thread Ben Coman
Hi Asam,

On Sun, 19 Jul 2020 at 21:38, ASAM  wrote:
>
> Hello Ben,
>
> I quickly made a dummy DLL to limit the problem to the essentials.

Great idea.  A more generic example is attractive for people to
examine and help out.
I browsed the code but I'm sorry it needs a deeper expertise than I have.
Hopefully someone working on the threaded FFI will tune in.

In the meantime, it won't solve your query but you may find this
interesting to watch...
Strategies for Non-Blocking FFI
https://www.youtube.com/watch?v=L_QFwsNOMAc

cheers -ben

>
> I think my problem comes more from how I use the semaphore.
>
> I wanted to do that:
>
> only "semaphore signal",
> But that somehow doesn't work.
> Now i'm doing that "[ Processor yield. semaphore signal ] fork" (it work's)
> but i don't know if that's a good idea.
>
>
> ffiCallback
> ^ FFICallback signature: #( void #( uint32 foo ) ) block: [ :foo |
>   Transcript
>   show: 'API Funktion value: ' , foo asString, ' 
> activePriority:',
>   Processor activePriority asString; cr.
>
> "that's working"
>   [ Processor yield. semaphore signal ] fork.
>
>   "that usually works 80%."
>   "[ semaphore signal ] fork"
>
>   "that crashes pharo almost always."
>   "semaphore signal"
> ]
>
> I also have a little problem, too. Why can I use my own C-Type UNUM32 at
> ...self ffiCall: #( T_ERROR StartMyThreadFunction(UNUM32 millisecondsToFire)
> ).
> But with FFICallback signature: # (void # (uint32 foo)) I get an error
> "Unable to resolve external type: UNUM32. Why is that?
>
> Thanks for your help.
>
> testDllForAsyncCallback.dll
> 
> testDllForAsyncCallback.cpp
> 
> testDllForAsyncCallback.h
> 
> testDllForAsyncCallback.h
> 
> UFFICallback.st 
> CTypes.st 
> 
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>



Re: [Pharo-users] UFFI asynchronous callbacks

2020-07-18 Thread Ben Coman
Callbacks are supported...
http://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-4-ast-walking-with-visitors-callbacks/
but I'm not sure about the "asynchronous" part of your query.

cheers -ben

On Sat, 18 Jul 2020 at 19:56, ASAM  wrote:

> I use Pharo 8(64bit) UFFI to call a dll(64bit).
> Over the dll I have access to 1 or more hardware devices.
> The dll has a function where I can register a call-back function.
> The callback is invoked whenever a hardware is connected or disconnected
> from PC.
>
> At the moment, Pharo always crashes when the callback is executed by the
> dll.
>
> Before I waste my time trying to find the bug.
> I wanted to ask first…  Is Pharo supporting asynchronous callbacks?
>
> I also found this old thread but the last entry is from 2017.
>
> http://forum.world.st/UFFI-with-asynchronous-callbacks-td4993968.html#a5014328
> Now I wanted to check the current status.
>
> Thanks for your help.
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] need suggestion badly

2020-07-14 Thread Ben Coman
Rather than spoon feed you for your masters project (and also your question
is a bit generic and hard to answer),
can you report the tutorial examples you've found for LibC, OSProcess and
OSSubProcess.
Then perhaps you can ask more focussed questions about any difficulties you
have doing those tutorials.

Please read http://www.catb.org/~esr/faqs/smart-questions.html

Apart from basic google search, a good place to search is...
http://forum.world.st/Pharo-f1294836.html
or focus your google search like this...  OSProcess  site:forum.world.st
Also, I'm not sure which book, but you may find something here...
https://books.pharo.org/

cheers -ben

On Sun, 12 Jul 2020 at 12:33, shawon58  wrote:

> Hello
> I am doing masters project where i need to use pharo and freeCAD. In my
> work
> i need to send some parameter to freeCAD which can create a cube or other
> type shape. After getting some idea i write a C++ code that can send
> command
> to freeCAD to create a cube.step file so that means i have the file for
> cube
> now. Just i need to compile and send some parameter to through command
> line.
> below i have attached my screenshot to show the gui. a simple gui to send
> command line command using LibC function. where i can compile and execute
> than run my box or other file using pharo gui.
> But my supervisor want me to send parameter from pharo to that file which i
> dont know how to do. if i can send the parameter to that file or exe than
> my
> work complete. as my limition is c++ file cause c++ file can hand freeCAD
> command. Also i know if my file is c file than maybe i can use ffi .
>
> Now i need suggestion is there any way to do ? need your kind advice .
> Thanks
>
> 
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] I think I've discovered an error in the later v9 builds

2020-07-07 Thread Ben Coman
On Thu, 2 Jul 2020 at 06:20, Russ Whaley  wrote:

> I'd be happy to, but um... I don't know how/where (color me
> embarrassed...).  Can you point me in the right direction?  I've not
> submitted a bug report before.
>

I would guess Stef means... https://github.com/pharo-spec/Spec/issues



> I've created a sample Class, App, & Presenter that demonstrates the error
> consistently.  I was kindof hoping when I created this example I would find
> it was something in my code...  I'll attach the fileout here but will also
> include it in the bug report.  Also attached are the screenshots before and
> after I clicked on the first row.
>
> Is there a way to tell the build number of an image I'm using?  I'd like
> to go back to a fresh image of the image I'm using... it has inflated to
> over 350MB and I'd like to start fresh with an image that doesn't have this
> defect.  If I can get hold of the build of the image I'm using, that would
> be great.
>

You are able to get build info using... World > System > System Reporter



>
> Thanks,
> Russ
>
>
> On Wed, Jul 1, 2020 at 1:42 PM Stéphane Ducasse 
> wrote:
>
>> Thanks can you enter a bug entry in the spec project?
>>
>> S.
>>
>> On 1 Jul 2020, at 16:58, Russ Whaley  wrote:
>>
>> (Overall, this error does not occur in v8 - even the latest
>> snapshot.1140.  It did not exist in the v9 image from February - I don't
>> know how to tell what build it is.  But the latest Official Distribution
>> for v9 and the latest snapshot.840 - the following error occurs:).
>>
>> This error appears to be around the transmitTo: within
>> SpPresenterWithModel>>connectPresenters.  I haven't been able to (yet)
>> trace why, but the debug message is in the 2nd 'transform:' below --
>> erroring saying that 'each' is nil - and doesn't understand the #method2
>> message.
>>
>> Here is the scenario:
>>
>> (aSpTablePresenter(1) transmitTo: aSpTablePresenter(2))
>>
>> transform: [ :each | ((each #method asOrderedCollection ) sorted: #title
>> ascending ) ].
>>
>>
>> "transmit aSpTablePresenter(2) to aSpTablePresenter(3)"
>> (aSpTablePresenter(2) transmitTo: aSpTablePresenter(3))
>>
>> transform: [ :each | ((*each #method2* asOrderedCollection) sorted:
>> #number ascending )].
>>
>>
>> The UI populates just fine - when I click a row in the first
>> aSpTablePresenter(1) - it fills the 2nd aSpTablePresenter(2), but it looks
>> like the code above attempts to do the 2nd transmitTo: to populate
>> aSpTablePresenter(3) and is trying to do so without data from
>> aSpTablePresenter(2) - there could be a number of reasons for this.
>>
>> Behavior-wise, I would prefer that SpTablePresenters default to a first
>> row selected and populate (transmitTo:) to each of their SpTablePresenters
>> in kind (defaulting to first row, then transmitTo: the next
>> tablePresenter).
>>
>> Through the Inspector, all three SpTablePresenters have their lists
>> populated - and the UI shows these lists - even after punching through
>> error.
>>
>> Another observable - when I click on column headers to sort, the
>> transmitTo:'s get called again and also error out - even the first
>> transmitTo:... could be one simple change will correct all these anomalies.
>>
>> I will try and mock-up a simpler version to share.  Please let me know if
>> you have any questions or items I should specifically include.
>>
>> Thanks!
>> Russ
>>
>> --
>> Russ Whaley
>> whaley.r...@gmail.com
>>
>>
>> 
>> Stéphane Ducasse
>> http://stephane.ducasse.free.fr / http://www.pharo.org
>> 03 59 35 87 52
>> Assistant: Aurore Dalle
>> FAX 03 59 57 78 50
>> TEL 03 59 35 86 16
>> S. Ducasse - Inria
>> 40, avenue Halley,
>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
>> Villeneuve d'Ascq 59650
>> France
>>
>>
>
> --
> Russ Whaley
> whaley.r...@gmail.com
>


Re: [Pharo-users] How to set path as a variable

2020-07-07 Thread Ben Coman
That is useful to know the PATH variable can be updated for current process.
Nice blog writeup. Thanks Chris.

cheers -ben

On Sun, 28 Jun 2020 at 23:49, Christopher Fuhrman <
christopher.fuhr...@etsmtl.ca> wrote:

> Then you can add your directory to it (note that I put a semicolon for
>> path separator in Windows):
>>
>> modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' + path.
>
>
> My apologies (I have been coding too much JavaScript lately) - this should
> have been:
>
> modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' , path.
>
>
> Cheers,
>
>
> On Sun, 28 Jun 2020 at 11:16, Christopher Fuhrman <
> christopher.fuhr...@etsmtl.ca> wrote:
>
>> Hello,
>>
>> Why not use the PATH environment variable in Windows to do what you want?
>> I deal with setting variables used with LibC in my blog entry at
>> https://fuhrmanator.github.io/2019/03/16/LibC-Pharo-experiments.html
>>
>> You can get PATH by using:
>>
>> path := OSEnvironment current getEnv: 'PATH'.
>>
>> Then you can add your directory to it (note that I put a semicolon for
>> path separator in Windows):
>>
>> modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' + path.
>>
>> Then you have to set the variable in the system:
>>
>> result := OSEnvironment current setEnv: 'PATH' value: modifiedPath.
>>
>> You should probably get (again) the variable PATH (as above) to make sure
>> the path was set correctly.
>>
>> Then just do:
>>
>> result := LibC runCommand: 'makebox.step'.
>>
>> Let us know if it works for you.
>>
>> Cheers!
>>
>> On Sun, 28 Jun 2020 at 09:03, shawon58  wrote:
>>
>>> In pharo class side , i am creating class side method like as
>>> /*makebox
>>> LibC system: 'D:\DEV_FreeCAD\build\bin\makebox.step'*/
>>> SO i want to set /D:\DEV_FreeCAD\build\bin\ / as a variable like path
>>> than i
>>> can write like as
>>> *LibC system: 'path\makebox.step'*
>>>
>>> how to do that, if anyone have idea please share the idea with me.
>>>
>>> Thanks for your help
>>>
>>>
>>>
>>>
>>> --
>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>>
>>>
>>
>> --
>> Christopher Fuhrman, P.Eng., PhD
>>
>> *Professeur au Département de génie logiciel et des technologies de
>> l'informationÉTS (École de technologie supérieure)*
>>
>> http://profs.etsmtl.ca/cfuhrman
>> +1 514 396 8638
>> *L'ÉTS est une constituante de l'Université du Québec*
>>
>
>
> --
> Christopher Fuhrman, P.Eng., PhD
>
> *Professeur au Département de génie logiciel et des technologies de
> l'informationÉTS (École de technologie supérieure)*
>
> http://profs.etsmtl.ca/cfuhrman
> +1 514 396 8638
> *L'ÉTS est une constituante de l'Université du Québec*
>


Re: [Pharo-users] Output the method name as a string at runtime

2020-07-07 Thread Ben Coman
Sorry for the slow response. Perhaps you've already worked it out, but
anyway a few options...

You "could" pass thisContext as a block parameter

initialize
errorBlock := [ :tPduError :aContext | Error signal:'Method: ' ,
aContext selector
asString , '  with result: ', tPduError item asString ].

 pduDestruct
  result = T_PDU_ERROR PDU_STATUS_NOERROR ifFalse: [ errorBlock
value: result value: thisContext


But rather I suggest a better option is to separate this logic into its own
error class...

Error subclass: #PduError
... instanceVariables: 'result selector'

PduError class >> result: aResult context: aContext
^ self new initializeResult: aResult selector: aContext  selector
asString

PduError >> initializeResult: aResult selector: selectorString
result := aResult.
selector :=  selectorString

PduEror>>messageText
as you like - refer to other implementors for example

  PduError>>printOn:
   as you like - refer to other implementors for example


  pduDestruct
| result |
result := call ffiPDUDestruct.
result = T_PDU_ERROR PDU_STATUS_NOERROR ifFalse: [
   (PduError result: aResult context: thisContext) signal ]


cheers -ben

On Sat, 27 Jun 2020 at 22:56, ASAM  wrote:

> Hello,
> I would like to output the method name as a string in case of an error.
>
> what I've already done is this: (with thisContext selector asString)
>
> pduDestruct
> | result |
> result := call ffiPDUDestruct.
> result = T_PDU_ERROR PDU_STATUS_NOERROR
> ifFalse: [ Error signal:'Method: ' , thisContext selector asString , '
> with
> result: ', result item asString ]
>
>
> but now I use it more often. And wanted to rebuild it like that.
>
> initialize
> errorBlock := [ :tPduError | Error signal:'Method: ' , thisContext
> selector
> asString , '  with result: ', tPduError item asString ].
>
>
> pduDestruct
> | result |
> result := call ffiPDUDestruct.
> result = T_PDU_ERROR PDU_STATUS_NOERROR ifFalse: [ errorBlock
> value: result
> ]
>
>
> but that doesn't work because "this Context selector toString" now returns
> 'initialize'.
>
> Can someone give me a hint how to solve this?
> Is "thisContext selector asString" the only way to get the name of the
> method at runtime?
>
> Thanks in advance.
>


Re: [Pharo-users] Pharo 8.0 bug

2020-06-14 Thread Ben Coman
hi Sebastian,

Thanks for taking the time to report your issue.
Note that Fogbugz is no longer used for issue tracking.
Issues are now tracked at... https://github.com/pharo-project/pharo/issues
Could you try creating your issue there?

cheers -ben

On Sun, 14 Jun 2020 at 13:35, Sebastian Heidbrink via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Hello,
>
> I am unfortunately not able to register at https://pharo.fogbugz.com/
> because "/issues-register-service not found".
>
> This is why I post the following bug here:
>
> I attached a test case and how that somebody can recreate it.
>
> I just downloaded a Pharo 8.0 64Bit image with the pharolauncher to a
> Windows 10 machine.
>
> Depending on my actions within the dev environment the test case passes
> or fails in the last two asserts.
>
> What one has to do is just run the test and see if it fails the first time.
>
> If it does not fail then:
>
> 1. Remove the comment in the test method.
>
> 2. Within the System Browser navigate to the ValueHolderTestClass and
> back to ValueHolderTestCase again.
>
> 3. Rerun the test
>
> With a little back and forth you will eventually see the last asserts
> fails with
>
> "TestFailure: Got '13' instead for 'Test3' "
>
>
> It would be highly appreciated if somebody with access to
> pharo.fogbugz.com would find the time to try this and upload the
> information provided.
>
>
> Here the full info about the image:
> Pharo 8.0.0
> Build information:
> Pharo-8.0.0+build.1124.sha.0932da82f08175e906b0e2a8052120c823374e9f (64
> Bit)
>
>
> Thank you!
>
> Cheers!
>
> Sebastian
>
>
>


Re: [Pharo-users] GIS support for Pharo

2020-06-04 Thread Ben Coman
On Thu, 4 Jun 2020 at 16:12, Norbert Hartl  wrote:

> I think GIS needs more but what we have is more than just a start. The
> projection system with the current code is WGS84 for sure. If there are
> other needs we need to think about this early.
>

I don't know a lot about it, but in trying to learn I bumped into some
interesting articles from an Australian perspective...

https://www.spatialsource.com.au/company-industry/new-world-earth-fixed-datums


https://www.ga.gov.au/scientific-topics/positioning-navigation/wgs84

https://www.spatial.nsw.gov.au/__data/assets/pdf_file/0008/224396/WGS84_and_Australias_misaligned_web-maps_Information_Sheet.pdf

https://www.icsm.gov.au/sites/default/files/DatumMattersFactSheet1_0.pdf

cheers -ben


Re: [Pharo-users] ESRI ASCII raster format

2020-06-04 Thread Ben Coman
A couple of other interesting things I bumped into...

https://jblindsay.github.io/ghrg/WhiteboxTools/index.html ( MIT Licensed )

https://www.diva-portal.org/smash/get/diva2:1086367/FULLTEXT01.pdf

On Fri, 5 Jun 2020 at 01:33, Ben Coman  wrote:

> On Thu, 4 Jun 2020 at 21:00, Richard O'Keefe  wrote:
>
>> Does anyone know of a collection of test files for this format?
>>
>
> You might be looking for smaller tests, but anyway..
>
> https://github.com/richbl/esri-ascii-parser/tree/master/sample_data
>
> https://www.planlaufterrain.com/LiDAR-Data-and-FAQ/
>
> https://library.carleton.ca/help/dem-formats
>
>
> https://data.gov.au/dataset/ds-dga-b2e1dfc6-2c7e-404a-a949-7e3e95fc4418/details?q=
>
>
> cheers -ben
>
>


Re: [Pharo-users] ESRI ASCII raster format

2020-06-04 Thread Ben Coman
Minimal...


On Thu, 4 Jun 2020 at 21:00, Richard O'Keefe  wrote:

> Does anyone know of a collection of test files for this format?
>

You might be looking for smaller tests, but anyway..

https://github.com/richbl/esri-ascii-parser/tree/master/sample_data

https://www.planlaufterrain.com/LiDAR-Data-and-FAQ/

https://library.carleton.ca/help/dem-formats

https://data.gov.au/dataset/ds-dga-b2e1dfc6-2c7e-404a-a949-7e3e95fc4418/details?q=


cheers -ben


Re: [Pharo-users] Few newbie questoins about Pharo/Smalltalk capabilities

2020-06-04 Thread Ben Coman
On Tue, 2 Jun 2020 at 19:01, gustav_m  wrote:

> Hello! I don't know if this is a good place to ask this kind of questions,
> but I haven't found other places where Smalltalk/Pharo experts hang out.
>

This is the place, and also Discord that others have linked to.


> I'm a designer and unfortunately I know nothing about programming and
> computation. I'm trying to change this right now. I'm looking for suitable
> technology to learn and so far Pharo/Smalltalk looks very promising. To be
> honest, it looks way too good to be true. And that's why I'm here, asking
> you guys to disillusion me.
>

Your biggest disillusionment going to be less about Pharo versus any other
language,
and more about big ambitions exceed your (currently) small programming
skills.
I would encourage you to a step back from wanting to rush into using Pharo
(or any language)
for your work tools, and learn to program for its own sake.  This will have
a big impact on your level of frustration.

First...
 - Do the MOOC... http://mooc.pharo.org/
 - Read the Pharo By Example 5 and Learning Object Oriented Programming
books... https://books.pharo.org/
These will give you a baseline programming skill transferable to any other
programming language yo find interestin.
And along the way, ask lots of questions on Discord.

Then try Roassal.

Pharo is a really great environment to learn to program in.  At a minimum,
learning "just a bit of Pharo"
will give you an edge communicating with the programmers. We sometimes see
refugees from other languages
start using Pharo and exclaim "wow! programming is fun again!"

After watching this video [https://youtu.be/AnrlSqtpOkw?t=550] my
> imagination just went crazy. It looks like the Smalltalk system would be
> also a perfect tool to give presentations to my superiors.
> So to me Smalltalk looks like a holy grail. But again, my perception of it
> is probably wrong and



That video was a specific demo years ago that can't be done directly done
in Pharo (or I expect any modern Smalltalk),
but Pharo is still as close as you'll compared to language alternatives.
While it can't be done exactly graphically, similar connections between
objects are made in code one level lower.


> I might be better of learning, for instance Dart+Flutter.
>

I don't know Dart, but hazard to say that Pharo is a better environment to
"learn to program",
and a lot of those skills will be transferable to Dart later anyhow,
especially the software architectural skills you learn - which might be the
hardest part of making a working system.


> 1. As a designer I'm an aesthete. Is it possible to change the look of the
> windows and the environment to ones liking? Or redesign the whole system to
> not use windows at all? How moldable the environment is?
>

Mold-ability is where Pharo really excels compare to other languages.
Most languages you have an Integrated Development Environment,
that is separate from the application code you write,
that is separate from the software you compile and distribute.

With Pharo, the development environment, your application code,
and your running application are all siblings occurring within the same
environment.



> 2. How well is Smalltalk/Pharo suited to handle different graphic animation
> effects? As a designer I like to use animations to cue users. What about
> sound effects?
>
> Also, as a hobby I'd like to try some (3.) generative art


Look at Roassal.


> Some people cry about Smalltalk being slow. So maybe I'd be wiser to learn
> Processing (for
> 3) and NetLogo (for 4) instead. This would be unfortunate as these are two
> another technologies to learn.
>

"Slow" is very relative and application specific.  The run-speed of an
application needs to be balanced
against the speed-to-create the application.  If one language you could
create a tool in a month,
and another language you could create a tool twice as fast but it takes six
months - which language is better?

Original Smalltalk was "interpreted" only.  Pharo has a "Just In Time
Compiler".
For most applications it will be fast enough.  Any application that is not
true,
probably only a small part of you program is the bottle neck, and you redo
that small part in a faster language and call it from Pharo.



> I find the language itself, and especialy its minimalism/simplicity, so
> elegant, that I'm thinking of printing the famous "postcard example" and
> hanging it on a wall. The whole system, however, is humongous! It looks
> like
> learning (to be able to do anything interesting and non-trivial) will take
> ages.
>

Any language's library ecosystem can feel huge.  Pharo just happens to
build in a lot of things into the Image.
For example the "code" for every GUI element you are looking at is included
int he Image (so you can modify it)
which is missing from most other languages.

It will take time, but so will getting proficiency in any other language.


> So, what do you think? Should I invest my time here? Or is there a
> 

Re: [Pharo-users] Pushing to GitHub repository from my iceberg repository is hung (beachball). How do I interrupt the process?

2020-05-22 Thread Ben Coman
On Sat, 23 May 2020 at 06:17, Michael Burns via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> I had been following the Developing a simple counter chapter.
> All was well.
> I created an iceberg repository and added my Project to it.
> I committed the sources to git.
> Still working OK.
> Then I did a push of all that to my GitHub/MichaelKentBurns/MyCounter
> repository.
> I got a progress bar for the push which never made any progress.
> Instead I got the beachball spinner.  After quite some time I wanted to
> interrupt it to see if I could recover, but I could find a way.
> Eventually I had to force-quit.
>
> When I restarted my Pharo image, all of that work was lost because I had
> not done a save.
>
> My Question: Is there some way to interrupt such a process?
>

You should be able to push  where meta is Ctrl / Alt / Command
depending on your OS.
i.e. push period and meta keys together.

btw, in Pharo 7 I have been experiencing a few seconds lag before the
debugger appears,
such that it seems it didn't work so I end up hammering the  key
and half a dozen debuggers show up.
Apart from needing to modify my behaviour, what have other experienced.
I understood there was some work lately to improve responsiveness, so maybe
I move to Pharo 9 soon.

cheers -ben


Re: [Pharo-users] Loading a local repository

2020-05-22 Thread Ben Coman
On Sat, 23 May 2020 at 03:53, G B  wrote:

> https://github.com/zeroflag/Teapot
>
> On Friday, May 22, 2020, 2:31:22 PM CDT, Ben Coman 
> wrote:
>
>
>
>
> On Sat, 23 May 2020 at 00:06, G B via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
>
> I am new to Pharo and sent my first message a couple of days ago. Thanks
> for the help.  I did a clone of Teapot and had to move the source to my
> server (because the company doesn't allow it to have Internet access.)  So
> now I have a /tmp/Teapot and want to load it into Pharo.
>
> I've tried using Metacello and using "filetree:" ; "directory" ;
> "directory with subdirectories" and I can't seem to load it.
>
>
This is Tonel format, not Filetree.  (btw, Tonel is a class-per-file
whereas Filetree is a method-per-file)
https://github.com/zeroflag/Teapot/blob/master/source/Teapot-Core/BlockClosure.extension.st


Try what Stef said.

cheers -ben


> When I try to use Iceberg and "import from existing clone" and select
> either "/tmp/Teapot" or "/tmp/Teapot/source" it gives me an
> "AssertionFailure: Project location does not seem to be a valid git
> repository."  Even though /tmp/.git exists.
>
>
> Which Teapot repo did you clone?
>
> cheers -ben
>


Re: [Pharo-users] Loading a local repository

2020-05-22 Thread Ben Coman
On Sat, 23 May 2020 at 00:06, G B via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> I am new to Pharo and sent my first message a couple of days ago. Thanks
> for the help.  I did a clone of Teapot and had to move the source to my
> server (because the company doesn't allow it to have Internet access.)  So
> now I have a /tmp/Teapot and want to load it into Pharo.
>
> I've tried using Metacello and using "filetree:" ; "directory" ;
> "directory with subdirectories" and I can't seem to load it.  When I try to
> use Iceberg and "import from existing clone" and select either
> "/tmp/Teapot" or "/tmp/Teapot/source" it gives me an "AssertionFailure:
> Project location does not seem to be a valid git repository."  Even though
> /tmp/.git exists.
>

Which Teapot repo did you clone?

cheers -ben


Re: [Pharo-users] Refactor without formatting

2020-05-19 Thread Ben Coman
That seems to violate the Principal Of Least Surprise.
Whether or not it ends up getting changed, I think its worthwhile entering
that directly in the issue tracker.
It would assist if you could bisect to isolate which commit introduced the
behaviour.

cheers -ben

On Wed, 20 May 2020 at 01:34, Vitor Medina Cruz 
wrote:

> Hello,
>
> When I run a refactoring, Rename Method, for example, the refactoring is
> reformatting the code affected. Is it possible to configure Pharo to
> refactor without reformatting code? Depending on the refactoring, the
> reformat is so intrusive that make it more worth to make the refactoring by
> hand.
>
> Regards,
> Vitor
>


Re: [Pharo-users] FFI and absolute path to dll

2020-05-19 Thread Ben Coman
On Tue, 19 May 2020 at 23:09, ASAM  wrote:

> Of course there is a documentation for the API.
> It is even an ISO standard. And if I can do that, I would also like to make
> it available on GitHub. That's why it should be good.
>
> It is the ISO 22900-2 D-PDU-API.
> I can also attach the header file. However, the PDF is provided with a
> watermark. So please google.
>
> The API is provided by different manufacturers.
>
> The process is roughly the following, for Windows systems read a resitre
> key
> that says where the root.xml is. On Linux the pdu_api_root.xml is under
> /etc.
>
> In the root.xml you can find where the individual suppliers have installed
> their dll. With the absolute path you can now load the dll.
>
> Under Linux it would be a so-file which I have never seen live. I would say
> 95% use it only under windos.
>
> Thanks for help.
>
> ISO22900_2.h 
>

Cool.  I have an example using FFIOpaqueObject here...
https://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-2-simple-callout-string-return/


cheers -ben


Re: [Pharo-users] Siren 9.0 Released

2020-05-19 Thread Ben Coman
On Fri, 15 May 2020 at 04:16, Stéphane Ducasse 
wrote:

> Thanks Steven this is cool to see that Siren is living and kicking.
> Last year I was browsing the old site and I was sad because I thought it
> was dead.
> Your OSC looks better than the one in Pharo even if we used it
> successfully to connect interactive tables with a HCI research group.
>
> If you need help to migrate from VW let us know because it would be great
> to have Siren working in Pharo.
> I did not see any Unit tests and the tests saved us when we migrated
> Moose. Sometimes we even only kept them because they were
> better than the implementation. It took us around six months and we got
> free :)
> And we have some contacts that would be interested in London. We could put
> you in contact.
>
> Now just some questions and you may know the answer so I ask
>
> I was thinking but I may be totally wrong that it was forbidden to give VW
> images and that the current license
> was for personal use only. Long time ago the shrink process was removing
> the compiler. Now I saw that your image is 42mb.
>
> Personally I do not want to download any VisualWorks distribution and sign
> their licenses because I want to stay cristal clear
> on ANY license and possible issues. I did not look at Visualworks since
> 2008 and I feel clean and I will stay like that.
>
> So I imagine that I’m not allowed to use your software. I’m not good in
> music sadly so there is no frustration from my side.
>
> You mention that people can use a non-commercial version of VW but this
> license does not exist anymore.
> Is there a 64 bits version of VW because VW7.5 starts to show its age and
> on recent mac you only have 64 bits.
>
>
> Some people may think that we are just over the top on open-source but
> this is not by accident that we took the responsibility to create Pharo.
> We could not distribute Moose our open-source platform so after 10 years
> of hard work we had to do something. And we created Pharo.
> And the problem we got were with the previous version (the non commercial)
> of the Cincom license and the new one is even more restrictive.
> Some friends of mine told me that some lawyers were starting to get picky
> and send letters around.
> So watch out.
>
> BTW I did not see the license of Siren on the git repo. If I may suggest
> one,
> BSD/MIT are nice, avoid GPL because it means that nobody serious on
> Smalltalk will ever look at your system and contribute.
>

I recently saw an MIT/GPL comparison that I liked which was based on "What
Are You Afraid Of?"
* The MIT license is if you’re afraid no one will use your code; you’re
making the licensing as short and non-intimidating as possible.   MIT is
good for projects with a small audience where you want to maximize
community growth.
* The GPL license is if you are afraid of someone else profiting from your
work, i.e. how you would feel about that versus how likely it is to
happen.  GPL can be good for large infrastructure projects (Linux) to
reduce money driven feature fracturization of the community.

cheers -ben


Re: [Pharo-users] FFI and absolute path to dll

2020-05-19 Thread Ben Coman
Can you specify the API?

cheers -ben

On Tue, 19 May 2020 at 05:02, ASAM  wrote:

> Oh. Thank you for your answers. Now that you say it, I remember it. I dealt
> with Pharo 2 years ago. And now I  come back to load and execute a DLL with
> Pharo.
>
> Does anyone have a more detailed example of FFIOpaqueObjectis object than
> in
> the book (http://books.pharo.org/booklet-uffi/pdf/2020-02-12-uFFI-V1.0.1)
> ?
> I don't really understand it yet.
>
> I want to call a DLL whose API has 33 functions, 41 structures and 15
> enums.
> I would like to do it right and I have to understand everything first so
> that I can then decide how to implement it.
>
> Thank you for your help
>
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] FFI and absolute path to dll

2020-05-18 Thread Ben Coman
On Sun, 17 May 2020 at 20:54, ASAM  wrote:

> Thanks for the tips. It really helped me a lot.
> The dll is now loaded (I chose the 64-bit version of the dll).
>
> I am currently working on value mashalling and I want to create an ENUM
> class subclass from FFIEnumeration.
>
> Inside http://books.pharo.org/booklet-uffi/pdf/2020-02-12-uFFI-V1.0.1  i
> read chapter 4.4  Enumerations.
> I tried the example.
> For me, however, only new class variables are created after
> "ExampleEnumeration initialize".
>
> Is that okay? or a bug?
>

The class-side #initialization method only gets called when the class is
created e.g. when first loaded into a fresh image.
It doesn't get re-run just because you edit the method, because the class
is already initialized.
By analogy, evaluating ``x := MyObject new`` invokes the instance-side
initialize when the object is created.
Subsequently editing MyObject >> #initialize wont change any values in the
existing object in `x`.
Remember "classes are objects too".

cheers -ben


Re: [Pharo-users] ifCurtailed prompts debug window

2020-05-15 Thread Ben Coman
With the first, you are not defining for the Error to be handled,
only what to do when the stack unwinds abnormally.

In the second you are defining for the Error to be handled, so it does that.

cheers -ben

On Sat, 16 May 2020 at 01:00, Vitor Medina Cruz 
wrote:

> Hello,
>
> On Windows 10 and Pharo 8, If I do:
>
> [ Error signal ] ifCurtailed: [ Transcript show: 'error' ].
>
> the debug window pops up, when I close, 'error' is print in the
> Transcript. If I do
>
> [ Error signal ] on: Error do: [ Transcript show: 'error' ].
>
> 'error' is print in Transcript without debug windows pops up. I was
> expecting the same behavior here, as if ifCurtailed was a syntax sugar for
> on:do:, that is not the case or it is some kind of error? The way it is, I
> cannot use ifCurtailed because I don't want the debug window to pup up.
>
> Regards,
> Vitor
>


Re: [Pharo-users] mentor question 4

2020-05-15 Thread Ben Coman
On Fri, 15 May 2020 at 20:43, Richard O'Keefe  wrote:

> Why does it make no sense?
> To a first approximation,
>  aCollection asWHATEVER
> =
>  WHATEVER withAll: aCollection
>
> Consider
>  'CAB' asSet
>  'CAB' asArray
>  'CAB' asSortedCollection
>  'CAB' asBag
> and so on.  They all mean "an instance of the class named
> in the selector with the elements of the receiver."
> Why should #asString be any different?
>

Good point.

There may be counter arguments (I've only considered this briefly)
but where possible it seems reasonable that the as selectors should be
able to round-trip.
i.e... 'abc' asByteArray asString ==> 'abc'
in which case... 'abc' asArray asString ==> '#($a $b $c)  seems wrong.
That result seems more suitable to #printString or #displayString,
particularly considering Richards next insight...


> Why on earth does #($a $b $c) asString make no sense
> when #($a $b $c) as: String
> -- which we expect to do the same thing -- DOES apparently
> make sense?
>

cheers -ben


Re: [Pharo-users] Pharo-Sound

2020-05-14 Thread Ben Coman
On Thu, 14 May 2020 at 02:50, Russ Whaley  wrote:

> I'm using Pharo 8 stable (64bit) version.
>
> I pulled PharoSound from the Catalog and installed.  Installed fine, no
> errors.
>
> I went to the comments on the abstract class.  Copied the examples to the
> Playground, ran them - worked fine (although I don't know how to stop the
> dang PluckedString example!!)... I digress  :)
>
> I created my own subclass to play specific sounds at certain events in my
> application.  Worked well.  A day later - I have no sound in my image at
> all now.  Nothing works.  I reinstalled from the Catalog. Ran the code
> listed in the AbstractSound comments - nothing.
>
> I installed a new Pharo 8 stable 64-bit image - pulled PharoSound in,
> copied the sampe code from AbstractSound comments... and it worked just
> fine.
>
> Any ideas how I can get sound to work again on my original image?  For me,
> it is a real pain to try and migrate all my code over to a new image.  It
> is apparently a character flaw on my part, but it takes me hours to get
> Git/Iceberg working properly on a new image. (yes, I'm ashamed).  I see a
> new book on the topic, but I had been following that book while it was wip,
> and Git/Iceberg just whips my butt.  But if going to a new image is the
> solution, I'll try, try again.
>
> What do you think?
>

Sorry I don't the answer Russ, but just to piggy-back your query...
@all, is sound something that we should now be starting to do via FFI
rather than existing plugins? [but pls prioritize Russ's question]
cheers -ben


Re: [Pharo-users] MetaLinks for Dynamic Contracts

2020-05-04 Thread Ben Coman
On Mon, 4 May 2020 at 05:19, Evan Donahue  wrote:

> Hello,
>
> I am returning to some work in Pharo after about ~2.5 years and reminding
> myself of what I was working on before I got sidetracked. It appears
>
> I had mostly finished for release a dynamic contracts library for run time
> type checking based on Racket's contract library.[1] However, it relied on
> some hackery to interact well with the TestCoverage class, since both the
> contract and the TestCoverage wanted to replace the method during the run
> of a test. However, since it seems in Pharo 8 the TestCoverage class is no
> longer present, this seems like a good time to re-evaluate the project
> before I go in to see what needs to be patched up. I therefore have three
> questions:
>
> 1) Are there now any existing libraries for dynamic contracts that I
> should use instead of patching my old library?
>
> 2) Is MetaLinks the preferred way to intercept messages,
>



> and if so can someone point me to the repo (I can't seem to find it on
> Github)?
>

There is no repo for MetaLinks.  It comes batteries installed. (i.e. its in
the image)

cheers -ben


Re: [Pharo-users] mentor question 4

2020-05-03 Thread Ben Coman
On Sun., 3 May 2020, 3:48 pm Roelof Wobben,  wrote:

> Op 3-5-2020 om 04:24 schreef Ben Coman:
>
>
>
> On Sun, 3 May 2020 at 03:09, Roelof Wobben  wrote:
>
>> Op 2-5-2020 om 19:33 schreef Ben Coman:
>>
>>
>>
>> On Sat, 2 May 2020 at 15:52, Roelof Wobben via Pharo-users <
>> pharo-users@lists.pharo.org> wrote:
>>
>>> Op 1-5-2020 om 08:35 schreef Roelof Wobben:
>>> >> On Fri, 1 May 2020 at 02:16, Roelof Wobben  wrote:
>>> >>> Op 30-4-2020 om 16:06 schreef Richard O'Keefe:
>>> >>>> This sounds very much like the Luhn test task at RosettaCode.
>>> >>>> https://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers
>>> >>>> except that there it is described as working on the digits of an
>>> >>>> integer.
>>> >>>>
>>> >>>> (1) There are two approaches to traversing a sequence in reverse.
>>> >>>>   (A) Reverse the sequence, then traverse the copy forward.
>>> >>>>   aString reverse do: [:each | ...]
>>> >>>>   (B) Just traverse the sequence in reverse
>>> >>>>   aString reverseDo: [:each | ...]
>>> >>>>   My taste is for the second.
>>> >>>>
>>> >>>> (2) There are two approaches to deleting spaces.
>>> >>>>   (A) Make a copy of the string without spaces.
>>> >>>>   x := aString reject: [:each | each = Character space].
>>> >>>>   x do: ...
>>> >>>>   (B) Ignore spaces as you go:
>>> >>>>   (i) aString do: [:each | each = Character space ifFalse:
>>> >>>> [...]]
>>> >>>>   (ii) aString select: [:each | each ~= Character space]
>>> >>>> thenDo:
>>> >>>> [:each | ...]
>>> >>>>
>>> >>>> Combining (1A) and (2A) you get very obvious code:
>>> >>>>   (aString reject: [:each | each = Character space]) reverse do:
>>> >>>> [:digit } ...]
>>> >>>> Combining (1B) and (2Bi) you get more efficient code:
>>> >>>>   aString reverseDo: [:digit |
>>> >>>>   digit = Character space ifFalse: [ ...]]
>>> >>>>
>>> >>>> By the way, let's start by checking that the character in the
>>> >>>> string *are*
>>> >>>> digits or spaces:
>>> >>>>   (aString allSatisfy: [:each | each isDigit or: [each =
>>> >>>> Character s[ace]])
>>> >>>>   ifFalse: [^false],
>>> >>>>
>>> >>>> (3) There are two approaches to doubling the even digits.
>>> >>>>   (A) Make a new string that starts as a copy and change every
>>> >>>> second
>>> >>>>digit from the right.
>>> >>>>   (B) Simply *act* as if this has been done; keep track of
>>> >>>> whether the
>>> >>>>   current digit position is even or odd and multiply by 1
>>> >>>> or 2 as
>>> >>>>   appropriate.
>>> >>>>   nextIsOdd := true.
>>> >>>>   aString reverseDo: [:digit |
>>> >>>>   digit = Character space ifFalse: [
>>> >>>>   nextIsOdd
>>> >>>>   ifTrue:  [oddSum := ...]
>>> >>>>   ifFalse: [evenSum := ...].
>>> >>>>   nextIsOdd := nextIsOdd not]].
>>> >>>>
>>> >>>> I *like* code that traverses a data structure exactly once and
>>> >>>> allocates no intermediate garbage, so I'd be making (B) choices.
>>> >>>>
>>> >>>>
>>> >>> For me  , I use this to practice solving problems  and doing the
>>> >>> "right"
>>> >>> steps.
>>> >>> So I love it , that so many people share there way of solving it.
>>> >>> I can learn a lot from it
>>> >>> Expecially when they explain there thinking process so detailed.
>>> >>>
>>> >>> I like this code also a lot.
>>> >>> Am  I correct for testing if it is a valid string by doing this ^
>>> >>&

Re: [Pharo-users] mentor question 4

2020-05-02 Thread Ben Coman
On Sun, 3 May 2020 at 03:09, Roelof Wobben  wrote:

> Op 2-5-2020 om 19:33 schreef Ben Coman:
>
>
>
> On Sat, 2 May 2020 at 15:52, Roelof Wobben via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
>
>> Op 1-5-2020 om 08:35 schreef Roelof Wobben:
>> >> On Fri, 1 May 2020 at 02:16, Roelof Wobben  wrote:
>> >>> Op 30-4-2020 om 16:06 schreef Richard O'Keefe:
>> >>>> This sounds very much like the Luhn test task at RosettaCode.
>> >>>> https://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers
>> >>>> except that there it is described as working on the digits of an
>> >>>> integer.
>> >>>>
>> >>>> (1) There are two approaches to traversing a sequence in reverse.
>> >>>>   (A) Reverse the sequence, then traverse the copy forward.
>> >>>>   aString reverse do: [:each | ...]
>> >>>>   (B) Just traverse the sequence in reverse
>> >>>>   aString reverseDo: [:each | ...]
>> >>>>   My taste is for the second.
>> >>>>
>> >>>> (2) There are two approaches to deleting spaces.
>> >>>>   (A) Make a copy of the string without spaces.
>> >>>>   x := aString reject: [:each | each = Character space].
>> >>>>   x do: ...
>> >>>>   (B) Ignore spaces as you go:
>> >>>>   (i) aString do: [:each | each = Character space ifFalse:
>> >>>> [...]]
>> >>>>   (ii) aString select: [:each | each ~= Character space]
>> >>>> thenDo:
>> >>>> [:each | ...]
>> >>>>
>> >>>> Combining (1A) and (2A) you get very obvious code:
>> >>>>   (aString reject: [:each | each = Character space]) reverse do:
>> >>>> [:digit } ...]
>> >>>> Combining (1B) and (2Bi) you get more efficient code:
>> >>>>   aString reverseDo: [:digit |
>> >>>>   digit = Character space ifFalse: [ ...]]
>> >>>>
>> >>>> By the way, let's start by checking that the character in the
>> >>>> string *are*
>> >>>> digits or spaces:
>> >>>>   (aString allSatisfy: [:each | each isDigit or: [each =
>> >>>> Character s[ace]])
>> >>>>   ifFalse: [^false],
>> >>>>
>> >>>> (3) There are two approaches to doubling the even digits.
>> >>>>   (A) Make a new string that starts as a copy and change every
>> >>>> second
>> >>>>digit from the right.
>> >>>>   (B) Simply *act* as if this has been done; keep track of
>> >>>> whether the
>> >>>>   current digit position is even or odd and multiply by 1
>> >>>> or 2 as
>> >>>>   appropriate.
>> >>>>   nextIsOdd := true.
>> >>>>   aString reverseDo: [:digit |
>> >>>>   digit = Character space ifFalse: [
>> >>>>   nextIsOdd
>> >>>>   ifTrue:  [oddSum := ...]
>> >>>>   ifFalse: [evenSum := ...].
>> >>>>   nextIsOdd := nextIsOdd not]].
>> >>>>
>> >>>> I *like* code that traverses a data structure exactly once and
>> >>>> allocates no intermediate garbage, so I'd be making (B) choices.
>> >>>>
>> >>>>
>> >>> For me  , I use this to practice solving problems  and doing the
>> >>> "right"
>> >>> steps.
>> >>> So I love it , that so many people share there way of solving it.
>> >>> I can learn a lot from it
>> >>> Expecially when they explain there thinking process so detailed.
>> >>>
>> >>> I like this code also a lot.
>> >>> Am  I correct for testing if it is a valid string by doing this ^
>> >>> (oddSum + evenSum) dividedBy: 10
>> >>>
>> >>> Roelof
>> >>>
>> >
>> >
>> > oke,
>> >
>> > so this is better
>> >
>> > cardNumber := '8273 1232 7352 0569'.
>> > oddSum := 0.
>> > evenSum := 0.
>> > nextIsOdd := false.
>> >  cardNumber reverseDo: [:character |
>> >   digit :=

Re: [Pharo-users] mentor question 4

2020-05-02 Thread Ben Coman
On Sat, 2 May 2020 at 15:52, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Op 1-5-2020 om 08:35 schreef Roelof Wobben:
> >> On Fri, 1 May 2020 at 02:16, Roelof Wobben  wrote:
> >>> Op 30-4-2020 om 16:06 schreef Richard O'Keefe:
>  This sounds very much like the Luhn test task at RosettaCode.
>  https://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers
>  except that there it is described as working on the digits of an
>  integer.
> 
>  (1) There are two approaches to traversing a sequence in reverse.
>    (A) Reverse the sequence, then traverse the copy forward.
>    aString reverse do: [:each | ...]
>    (B) Just traverse the sequence in reverse
>    aString reverseDo: [:each | ...]
>    My taste is for the second.
> 
>  (2) There are two approaches to deleting spaces.
>    (A) Make a copy of the string without spaces.
>    x := aString reject: [:each | each = Character space].
>    x do: ...
>    (B) Ignore spaces as you go:
>    (i) aString do: [:each | each = Character space ifFalse:
>  [...]]
>    (ii) aString select: [:each | each ~= Character space]
>  thenDo:
>  [:each | ...]
> 
>  Combining (1A) and (2A) you get very obvious code:
>    (aString reject: [:each | each = Character space]) reverse do:
>  [:digit } ...]
>  Combining (1B) and (2Bi) you get more efficient code:
>    aString reverseDo: [:digit |
>    digit = Character space ifFalse: [ ...]]
> 
>  By the way, let's start by checking that the character in the
>  string *are*
>  digits or spaces:
>    (aString allSatisfy: [:each | each isDigit or: [each =
>  Character s[ace]])
>    ifFalse: [^false],
> 
>  (3) There are two approaches to doubling the even digits.
>    (A) Make a new string that starts as a copy and change every
>  second
> digit from the right.
>    (B) Simply *act* as if this has been done; keep track of
>  whether the
>    current digit position is even or odd and multiply by 1
>  or 2 as
>    appropriate.
>    nextIsOdd := true.
>    aString reverseDo: [:digit |
>    digit = Character space ifFalse: [
>    nextIsOdd
>    ifTrue:  [oddSum := ...]
>    ifFalse: [evenSum := ...].
>    nextIsOdd := nextIsOdd not]].
> 
>  I *like* code that traverses a data structure exactly once and
>  allocates no intermediate garbage, so I'd be making (B) choices.
> 
> 
> >>> For me  , I use this to practice solving problems  and doing the
> >>> "right"
> >>> steps.
> >>> So I love it , that so many people share there way of solving it.
> >>> I can learn a lot from it
> >>> Expecially when they explain there thinking process so detailed.
> >>>
> >>> I like this code also a lot.
> >>> Am  I correct for testing if it is a valid string by doing this ^
> >>> (oddSum + evenSum) dividedBy: 10
> >>>
> >>> Roelof
> >>>
> >
> >
> > oke,
> >
> > so this is better
> >
> > cardNumber := '8273 1232 7352 0569'.
> > oddSum := 0.
> > evenSum := 0.
> > nextIsOdd := false.
> >  cardNumber reverseDo: [:character |
> >   digit := character digitValue.
> >  character = Character space ifFalse: [
> >  nextIsOdd
> >  ifFalse:  [oddSum := oddSum + digit ]
> >  ifTrue: [(digit >= 5 )
> > ifTrue: [evenSum := evenSum + (digit * 2) - 9 ]
> > ifFalse: [ evenSum := evenSum + (digit * 2) ]].
> > nextIsOdd := nextIsOdd not]].
> > ^ evenSum + oddSum // 10 == 0.
> >
> >
> > where I could even make a seperate method of the ifTrue branch when
> > the digit is greater then 5.
> >
> >
> nobody who can say if this is a good solution ?
>

You didn't actually ask a question :)

btw, Its good you are stretching yourself to do it the most complicated
way,
but pay attention that when Richard says HE "likes code that traverses a
data structure exactly once"
its because he is starting with the philosophy to OPTIMISE for EFFICIENCY.
Often in programming that is the LAST thing you should do because to do so
your code often becomes more complex,
and Kernagan's law applies...
https://talixa.com/blog/why-i-write-simple-code/

In general, you want to avoid premature optimization.
https://effectiviology.com/premature-optimization/

The catch-phrase I see around this forum priorities things in this order:
1. Make it work.
2. Make it right.
3. Make it fast.
and often you can stop at 2 because it is already "fast enough".

Considering your code above, if I take TIME to go through it, I can
evaluate that it seems right
but I remain feeling that I could have missed something.

Something like Richard's (A) examples without loops  I would consider to be
"more good".
since each line can 

Re: [Pharo-users] Automating release announcements

2020-05-01 Thread Ben Coman
On Fri, 1 May 2020 at 00:26, Gabriel Cotelli  wrote:

> I finally figure out how to make it work. For this mailing list you have
> to send the e-mail in CC and not BCC, because if not it gets retained
> awaiting for moderator approval.
> In case anyone is interested here is the GitHub action making the magic:
> https://github.com/ba-st-actions/email-release-notification
>

 Cool !!   Thanks for sharing Gabriel.

cheers -ben


Re: [Pharo-users] mentor question 4

2020-04-30 Thread Ben Coman
On Thu, 30 Apr 2020 at 16:46, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Op 30-4-2020 om 10:31 schreef Ben Coman:
> > collection := '8569 2478 0383 3437'.
> > (collection reverse selectWithIndex: [:item :index | (index % 2 == 0)
> > ifTrue: [item *2]] )  inspect
>
>
> I see a error and the non-even numbers are nill now.
>
> but after some figgeling this seems to work :
>

Great that you worked it out for yourself !!!
"figgeling" is a very important part of programming.



>
> collection := '8569247803833437' asArray.
> checkNumber := (collection reverse withIndexCollect: [:item :index |
> (index % 2 == 0) ifTrue: [item asInteger *2] ifFalse: [item asInteger]]
> ) sum inspect
> ^ checkNumber isDivisibleBy: 10
>

That looks like it would work, but the inspect is redundant now you know
how it works.
An important take away from this is that when you are confused by what is
happening,
you need to LOOK at each spot you data is transformed, where "inspect" is
your friend, particular running it from the debugger.


Now there is another path you might try, but first I want to stress
that I didn't know this answer a minute ago - I only just discovered it !!
So this answer is not based on something magic I knew directly, but on my
approach to guess, search and test within the system.

I was considering how you were dealing with "every second digit" and
considered a general description of this was "pairs".
I _wondered_ whether Pharo had any methods dealing with "pairs" ?

Spotter is a good place to ask this question, so I...
 Pressed 
 Typed... pair #i
to see if there were any implementors containing the word "pair" and
discovered SequenceableCollection>>#pairsCollect:

3. First time I've seen that method, I wonder how it works?
The method comment gives a clue that the block takes two arguments.
So lets try-the-simplest-possible-thing...
( '123456' pairsCollect: [  :a :b | a ] ) inspect
==> #($1 $3 $5)

So that looks useful.
Try experimenting with it yourself.

cheers -ben


Re: [Pharo-users] mentor question 4

2020-04-30 Thread Ben Coman
On Thu, 30 Apr 2020 at 14:33, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Hello,
>
> I hope I can discuss my approch to this problem :
>
> Given a number determine whether or not it is valid per the Luhn formula.
>
> The Luhn algorithm  is a
> simple checksum formula used to validate a variety of identification
> numbers, such as credit card numbers and Canadian Social Insurance Numbers.
>
> The task is to check if a given string is valid.
> Validating a Number
>
> Strings of length 1 or less are not valid. Spaces are allowed in the
> input, but they should be stripped before checking. All other non-digit
> characters are disallowed.
> Example 1: valid credit card number
>
> 4539 1488 0343 6467
>
> The first step of the Luhn algorithm is to double every second digit,
> starting from the right. We will be doubling
>
> 4_3_ 1_8_ 0_4_ 6_6_
>
> If doubling the number results in a number greater than 9 then subtract 9
> from the product. The results of our doubling:
>
> 8569 2478 0383 3437
>
> Then sum all of the digits:
>
> 8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80
>
> If the sum is evenly divisible by 10, then the number is valid. This
> number is valid!
>
>
> my idea was to do these steps
>
> 1)  reverse the input.
>
2)   use this to double every second  digit and calculate the sum of all
> the numbers :
>
> checkNumber :=  (collection reverse selectwith index: [:item :index |
> (index % 2 == 0) . IfTrue: [item *2]] )  sumNumbers
>
I just want to check that before you are ask such questions, did you
actually run this code?
Because it would be fairly easy to see how close you are by evaluating it
without #sumNumbers.
i.e Please report what you see when evaluating this
```
collection := '8569 2478 0383 3437'.
(collection reverse selectWithIndex: [:item :index | (index % 2 == 0)
ifTrue: [item *2]] )  inspect
```

3) check if its a valid  number by doing this :
>
>
> ^ (checkNumber % 10 == 0)
>
That would work, but there is a more intention revealing method...
#isDivisibleBy:

cheers -ben


Re: [Pharo-users] mentor question 3 is there a formula for this

2020-04-29 Thread Ben Coman
Building on Richard's advice, one way to break this down into a series of
simpler tasks is
- first generate a square without any dots, i.e. ALL A's on the first line,
ALL B's on second line, ALL C's on third line.
- second, work out when to output a dot rather than a letter.

cheers -ben

On Wed, 29 Apr 2020 at 00:32, Richard Sargent <
richard.sarg...@gemtalksystems.com> wrote:

> Formula? Well, it's pretty straight forward.
>
> Let's start with the size of the diamond (it field, actually). In the
> example, there are two lines above and two lines below the "C" line.
> C-A = 2. This number looks useful.
> The dimension is 2+1+2 square.
>
> How many spaces before a letter? C-letter i.e. C-A = 2 C-B = 1 and C-C = 0
> The same number of spaces after the second/last occurrence of the letter
> on the line.
> The number of spaces between the letters on a line is the size minus the
> number of spaces before and after plus the two copies of the current line's
> letter. For the "B" line, there is one space before and after, 2x"B",
> leaving 5 - 1 -1 - 2 = 1 space between. For the "A" line, the simple
> arithmetic would give you -1, which also confirms that just one "A" is
> appropriate with no space between first and last letter on the line. (For
> "A", it is first and last, once only.)
>
> After that, you just need to iterate ($A to: $C), ($(C-1) to: $A by: -1)
> and do the arithmetic.
>
>
> On Tue, Apr 28, 2020 at 1:23 AM Roelof Wobben via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
>
>> Hello,
>>
>> I try now to solve this one :
>>
>> ntroduction
>>
>> The diamond kata takes as its input a letter, and outputs it in a diamond
>> shape. Given a letter, it prints a diamond starting with 'A', with the
>> supplied letter at the widest point.
>> Requirements
>>
>>- The first row contains one 'A'.
>>- The last row contains one 'A'.
>>- All rows, except the first and last, have exactly two identical
>>letters.
>>- All rows have as many trailing spaces as leading spaces. (This
>>might be 0).
>>- The diamond is horizontally symmetric.
>>- The diamond is vertically symmetric.
>>- The diamond has a square shape (width equals height).
>>- The letters form a diamond shape.
>>- The top half has the letters in ascending order.
>>- The bottom half has the letters in descending order.
>>- The four corners (containing the spaces) are triangles.
>>
>> Examples
>>
>> In the following examples, spaces are indicated by · characters.
>>
>> Diamond for letter 'A':
>>
>> A
>>
>> Diamond for letter 'C':
>>
>> ··A··
>> ·B·B·
>> C···C
>> ·B·B·
>> ··A··
>>
>>
>> I noticed that if you take a quarter of it. you see this pattern
>>
>> 001
>> 010
>> 100
>>
>> where a 0 is a space and a 1 is the character.
>>
>> Is there a easy way to make some sort of formula so I can make a output of 
>> this ?
>>
>>
>> Roelof
>>
>>
>>


Re: [Pharo-users] can I divide a string into part of exactly n length

2020-04-29 Thread Ben Coman
On Tue, 28 Apr 2020 at 01:08, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Op 27-4-2020 om 19:05 schreef Richard Sargent:
>
> On Mon, Apr 27, 2020 at 9:27 AM Roelof Wobben via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
>
>> Hello,
>>
>> I wonder if it is possible in Pharo to divide a string in lets say part
>> of 3.
>> so this :  'abcdefgh'
>>
>> would be  'abc def gh`
>>
>
> Do you really want a single string with spaces inserted or do you want a
> collection of substrings, each three characters (or less, for the last one)?
>
>
> I need a single string with spaces inserted.
> So maybe I have formulate my question wrong. Very difficult if English is
> not your mother language and you were bad at school in languages a very
> very long ago.
>

I didn't previously know of a method to do this, but I "guessed" what you
needed might be related to "grouping", so I did...
'abcd' inspect.
then in the Meta tab, starting at Collection, filtered on
 group*
and worked up the hierarchy discovering #groupsOf:atATimeDo: in
SequenceableCollection,
which guesswork found could work like this...
```
input := 'abcdefghijk'.
stream := String streamContents: [:s | input groupsOf: 3 atATimeDo: [
:group | s nextPutAll: group; nextPutAll: ' ']].
stream contents inspect.
```

One of the skills a new programmer needs to develop is to make those
educated "guesses"
and know where/how to test them.

So I learnt a new method today. thx.
cheers -ben


Re: [Pharo-users] mentor question 1

2020-04-29 Thread Ben Coman
>  but I do not have a clue what the aBlock is

You say the method definition is...
> linksTowards: anAddressdo: aBlock

and then later indicate its called like this...
>  linksTowards: aPacket destinationAddressdo: [ :link | self
send: aPacket via: link ]

so in this case aBlock would be "[ :link | self send: aPacket via: link ]"
Or was that not your question?
Remember that "blocks are objects too".
In the same way that curly brackets create an instance of Array...
{ 1 . 2 . 3 } inspect
the square brackets create an instance of BlockClosure, or "block" for
short.

In Playground, compare evaluating the above inspect with evaluating the
following... (i.e. type "inspect" and evaluate the whole thing)
[ :x | x + 1 ] inspect
then in bottom pane of that inspector, DoItAndGo evaluate the following...
   self value: 5
and you will see the result is 6 because #value: was sent to the block
object that you inspected.

HTH
cheers -ben



On Sun, 26 Apr 2020 at 00:48, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Hello,
>
> Im doing the OOP book written by Ducassse and im now stuck at the
> network-simulator.
> Code so far can be found here :
> https://github.com/RoelofWobben/Network-simulator
>
> Im stuck at 2 places
>
> 1) What for datatype is loopback ?  Is it a string or something else.
> The book is not telling that.
>
> 2)  I have to make this method/function
>
> linksTowards: anAddress do: aBlock
> "Simple flood algorithm: route via all outgoing links.
>However, just loopback if the receiver node is the routing destination."
>(address destination == loopback)
>ifTrue: [self send:  via: loopback ];
>ifFalse: [self send: via: anAddress]
>
> but I do not have a clue what the aBlock is  and if im on the right path.
> I know the solutions can be found online but then I do not learn anything.
>
> This is what is stated in the book :
>
> This method has to rely on some routing algorithm to identify which links
> will transmit the packet
> closer to its destination. Since some routing algorithms select more than
> one link, we will implement routing as an iteration method, which
> evaluates the given block for each selected link.
> KANetworkNode >> send: aPacket
> "Send aPacket, leaving the responsibility of routing to the node."
> self
> linksTowards: aPacket destinationAddress
> do: [ :link | self send: aPacket via: link ]
> One of the simplest routing algorithm is flooding: just send the packet
> via every outgoing link. Obviously, this is a waste of bandwidth, but it
> works without any knowledge of the network topology
> beyond the list of outgoing links.
> However, there is one case where we know how to route the packet: if the
> destination address
> matches the one of the current node, we can select the loopback link. The
> logic of linksTowards:do:
> is then: compare the packet’s destination address with the one of the
> node, if it is the same, we
> execute the block using the loopback link, else we simply iterate on the
> outgoing links of the receiver.
> KANetworkNode >> linksTowards: anAddress do: aBlock
> "Simple flood algorithm: route via all outgoing links.
> However, just loopback if the receiver node is the routing destination."
> ... Your code ...
>
>
> I hope someone can help me on the way or let me see which steps I had to
> take to solve this on my own.
>
> Roelof
>
>
>


Re: [Pharo-users] running Pharo8 in Digitalocean

2020-04-26 Thread Ben Coman
Have you considered installing Ubuntu App from Microsoft App Store?

cheers -ben

On Sun, 19 Apr 2020 at 01:15, Sanjay Minni  wrote:

> Hi,
>
> I am using a Windows 10 local machine and digitalocean ubuntu server
> droplet
> - how can I run pharo 8 remotedly in the windows 10 inbuilt powershell ssh
> terminal - or any other method
>
> (I have  successfully executed
> # ./pharo Pharo.image eval --no-quit 'ZnServer startDefaultOn: 8080'
> and connected from my local machine)
>


Re: [Pharo-users] Automation of MS Office from Pharo

2020-04-09 Thread Ben Coman
I'd be very interested to hear how this ends up.
Parsing Outlook mails from Pharo may prove useful in my day job.

cheers -ben

On Wed, 8 Apr 2020 at 18:02, PBKResearch  wrote:

> Hello Pablo
>
> Success! I have rerun one of the troublesome cases, with no problem. I
> then re-ran the test on the latest 16 messages, collecting all the HTML
> outputs in an array, which took just over 5 secs total; quicker than I
> expected. The longest texts, from the most verbose newsletters, run from
> 267K to over 300K, so that is where they ran into the limit we found
> yesterday.
>
> I now know that I can pass the HTML to the XMLHTMLParser in memory,
> without saving to file first; this will be more convenient. Thanks for the
> prompt help.
>
> @Guillermo - All this is a proof of possibility, it will need to be
> combined with other bits I am working on to make the automated system I
> want. I shall let you know when it is worked out - but it won't be in the
> next few days!
>
> Thanks to all
>
> Peter Kenny
>
> -Original Message-
> From: Pharo-users  On Behalf Of
> Guillermo Polito
> Sent: 08 April 2020 09:20
> To: Tomaž Turk ; Any question about pharo is
> welcome 
> Subject: Re: [Pharo-users] Automation of MS Office from Pharo
>
> Cool, thanks to the three :)
>
> @Peter, I’d like if you tell us at the end if you had success at
> automating you mail workflow ^^
>
> > El 8 abr 2020, a las 10:15, Tomaž Turk 
> escribió:
> >
> > Thanks Pablo for your quick response! I tested 32 and 64 bit images with
> >1.000.000 strings and it works just fine.
> >
> > Best wishes,
> > Tomaz
> >
> >
> > -- Original Message --
> > From: "teso...@gmail.com" 
> > To: "Any question about pharo is welcome" 
> > Cc: "Tomaž Turk" 
> > Sent: 8.4.2020 9:54:35
> > Subject: Re: [Pharo-users] Automation of MS Office from Pharo
> >
> >> Hi!!!
> >>  This was a great report. I have submitted a fix in the master of
> Pharo-COM.
> >>
> >> Basically the problem was to free twice the BSTR in the Variant.
> >> It was being free in the access to the value and in the free of the
> struct.
> >> Why it works with other BSTR when they are smaller, I cannot know.
> >>
> >> I have added another smoke test using Word
> >>
> >> Can you try the fix?
> >>
> >> Thanks, both for helping me with the reports, they were great.
> >>
> >> On Wed, Apr 8, 2020 at 9:37 AM PBKResearch 
> wrote:
> >>>
> >>> Tomaz, that was my understanding from the VBA piece you cited
> yesterday. So presumably it must be something in Pharo-Com which imposes
> the limits we have seen. I am OK at the moment, because all this work is
> just an exploration of possibilities; I can wait until you and Pablo have
> sorted it out. But from the results of your tests, a maximum of 16K in
> 64-bit systems must be a serious limitation, so something in Pharo-Com
> needs fixing.
> >>>
> >>>
> >>>
> >>> For my immediate work, I shall continue exporting the full text using
> MailItem.SaveAs; my further processing uses files I have exported manually
> in this way, so it’s not a problem.
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>>
> >>>
> >>> Peter Kenny
> >>>
> >>>
> >>>
> >>> From: Pharo-users  On Behalf Of
> Tomaž Turk
> >>> Sent: 08 April 2020 07:58
> >>> To: Any question about pharo is welcome 
> >>> Subject: Re: [Pharo-users] Automation of MS Office from Pharo
> >>>
> >>>
> >>>
> >>> Thanks, Stephane, for the acknowledgement. Peter, as I understand, the
> limits in COM BSTR data type are defined by the header's length prefix
> (which is 4 bytes) and software implementatios - for instance, string data
> type in Visual Basic for Applications is described as "a variable-length
> string can contain up to approximately 2 billion (2^31) characters", which
> is in line with the BSTR header. I'm not sure if the OS architecture (32
> and 64 bit) influences these values.
> >>>
> >>>
> >>>
> >>> Best wishes,
> >>>
> >>> Tomaz
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Pablo Tesone.
> >> teso...@gmail.com
> >
> >
>
>
>
>


Re: [Pharo-users] Need help badly

2020-04-02 Thread Ben Coman
Hi,
You don't mention that the standard de-register process failed. Can you try
this first? See the last button on this page...
https://lists.pharo.org/mailman/listinfo/pharo-users_lists.pharo.org

cheers -ben

On Thu, 2 Apr 2020 at 12:47, Md Shahidul Hoque  wrote:

> Dear admin team
> Can u please remove my email (shawo...@gmail.com) from user list. I got a
> lot of email from other discussion. I don't want to get those. please help
> me.
> Thanks
>


Re: [Pharo-users] [ANN] JRMPC Poll

2020-03-24 Thread Ben Coman
Pharo has some good documentation, but its more lesson-based than a library
reference.
Those of us familiar with Pharo know the tricks to use the system itself as
that reference, but I'd imagine this is an unfamiliar workflow for
newcomers.

I have seen before a class library reference generated from the image, but
I couldn't put my hands on it right now.
@all, is it still being generated?. This might provide newcomers
something more familiar to work with.

cheers -ben

On Tue, 24 Mar 2020 at 03:00, Richard Kenneth Eng 
wrote:

> https://jrmpc.ca/2020/03/20/what-makes-learning-smalltalk-challenging/
>
> FWIW, 95% of respondents pointed to the lack of reference documentation
> for the class library as the major obstacle to learning Smalltalk/Pharo.
>
> Richard
>


Re: [Pharo-users] Slots vs collections

2020-03-20 Thread Ben Coman
On Sat, 21 Mar 2020 at 01:54, Noury Bouraqadi  wrote:

> Hi Richard,
>
> My example was about having a collection of bits. So, #do: and #select: do
> continue to have the very same semantics.
> The whole point is to save memory behind the scenes, while keeping the
> same API.
> Consider a very large matrix of booleans. It would save memory to store
> booleans as bits.
> There is of course the "normal" way of doing it, by changing the
> implementation.
> But, with slots, it should be possible to use an instance 2DArray
>

What is the 2D-ness of a collection of bits.  Have you considered Bitmap?

The original paper discusses bit-fields.  I'm not sure how that maps to
current Pharo implementation.
http://scg.unibe.ch/archive/papers/Verw11bFlexibleObjectLayouts.pdf

cheers -ben


Re: [Pharo-users] Corona virus

2020-03-15 Thread Ben Coman
Of all the articles I've read on the coronavirus, this is the first I felt
worth sharing.
https://medium.com/@tomaspueyo/coronavirus-act-today-or-people-will-die-f4d3d9cd99ca


I've been a bit complacent about the advantage of living in Australia in a
small town outside Perth (one of the most remote capital cities in the
world)
but Section 3 on improving mortality rates by reducing the peak on the
health system is compelling for everyone to know.

cheers -ben

On Sun, 15 Mar 2020 at 01:15, Davide Grandi  wrote:

> That's true,
>
> and it will be a worldwide pandemia.
> Try to work @ home,
> limit contacts with other people,
> don't go in crowded places,
> and PROTECT YOUR PARENTS - GRANDPARENTS.
>
> The local newsmagazine of Dario's town, few km from mine,
> has normally ONE page of obituary.
> Yesterday ... TEN pages.
>
> bye,
>
>  Davide
>
> On 14/03/2020 14:52, dario.trussardi65 wrote:
> > Ciao,
> > be very careful ... it's very dangerous ...
> > here in Bergamo it's a disaster.
> > We are losing our grandparents like leaves falling from the tree 
> > Take all precautions  Don't underestimate the situation.
> > See you soon
> > Dario
>
> --
> Ing. Davide Grandi
> email  : davide.gra...@email.it
>
>
>


Re: [Pharo-users] Pharo 8 stability and large images

2020-03-08 Thread Ben Coman
I haven't been very involved in Pharo 8, but its great to hear of your
positive experience.
To grow Pharo its important to be able to reference positive stories from
the trenches.
Thanks for sharing.

cheers -ben

On Sat, 7 Mar 2020 at 03:08, Jimmie Houchin  wrote:

> I am in the midst of a very long term, in my spare time, project written
> in Pharo 7.
>
> I have at times been very frustrated with various problems. Images
> becoming unstable. Images crashing. Images crashing and unopenable after
> crashing. With seeming loss of code not yet committed. Images very
> unstable with memory greater than 500mb. The larger the worse. I
> regularly have images that exceed 1gb. It is without effort to grow
> images to such size. These images would increasingly become unstable,
> slow and unresponsive. They frequently would crash. I would have to
> reopen, save or commit my code and then open a new image and import my
> code. So I read threads speaking about large images with great interest.
>
> However, I persisted as I have a significant amount of code dedicated to
> this project. Currently approximately 120 classes. Some of which are
> private or proprietary. Over 70 public when I have cleaned up my mess
> and get ready to release. And many still to be written.
>
> As I persist, I also look around at my options. There are few things I
> would even consider for a rewrite.
>
> I this week decided to persist in my attempt to move to Pharo 8. I
> generally prefer to use the latest stable. However, the first use cause
> an error in saving an image which I did not understand and did not
> persist through.
>
> Currently I name my images for this project as such
> SmallTrader-0.00.image as a base image setup like I want. I open up such
> image and "Save As" and it automatically increments to the biggest
> number in the folder such as SmallTrader-0.59.image. Then I update with
> the latest code. However Pharo 8 generated an error (#+ was sent to nil)
> when doing "Save As"  from an image named SmallTrader-8.000.image. So I
> decided to keep on with Pharo 7. However, this week I decided not to let
> that stop me and I simply renamed my image to something Pharo 8 did not
> complain about, SmallTrader-8-00.image and it now "Save As" renames to
> SmallTrader-8-00.1.image.
>
> Now, I am not writing this email to complain. But rather to praise. Once
> I got going on Pharo 8 this week with the latest stable VM and Image, it
> has seemed to be very stable and solid. I just ran a backtest and had
> naively did not pay attention to my backtest settings. The image ran the
> backtest perfectly, without problem. It was stable and consistently
> performant. After it completed I decided to look at the OS System
> Monitor to check how much memory it was consuming because it had opened
> up 252 inspect windows with a dictionary of several thousand objects
> each. It was effortlessly sitting at 5.7gb and was nicely responsive in
> the UI. I later nil'd the object in the Playground and did a Smalltalk
> garbageCollect, and it shrank down to 400mb. Nice!
>
> Wow. Great job guys. I am impressed. I am exceptionally pleased.
>
> Thank you. Thank you. Thank you.
>
> This makes me less afraid to use other time series data which run up my
> memory greatly. I would be reading in over 2gb of csv files to create my
> objects to operate upon. Previously it made the image incredibly
> unstable and unusable. I look forward to giving it a try.
>
> I just wanted to give you guys and gals (should there be any) a
> tremendous thank you and praise report. I am greatly encouraged to
> persist in my use of Pharo. And at the same time greatly encouraged to
> not look elsewhere because no need. Pharo is meeting my needs with
> reasonable performance and stability.
>
> I look forward to being productively active using Pharo 8 and look
> forward to the bright future Pharo 9 and beyond hold.
>
> Thanks again for this amazing language and environment. I hope someday
> to be able to repay the blessing I have received from all who have
> contributed to what I enjoy today.
>
> Jimmie Houchin
>
>
>
>
>
>
>
>


Re: [Pharo-users] [ANN] Round 3 Results Are In

2020-02-23 Thread Ben Coman
Hi Richard,

On Sun, 23 Feb 2020 at 18:45, Richard O'Keefe  wrote:

> This is meant to be constructive, but won't seem that way at first.
>

Thanks for your feedback.  I can tell you're being constructive by the
detail you went into.
It must have taken a good ten minutes to compose and in an environment
where
attention is a scarce resource, that is gold.  I'll definitely file it for
my own future reference.



> (1) The sound track very nearly drove me away in the first few seconds.
> I'm deadly serious about that.  I'm not on the spectrum, but my elder
> daughter is, and sensory sensitivities are very common amongst ASD
> people.  I'm rather sensitive to noise myself.  Now if the sound track
> were *relevant* to the message, I'd put up with it, but I can't for the
> life of me see any connection between the sound track banging away
> and what's happening on the screen.
>

Its easy to forget such considerations when they are outside our immediate
experience.
Thx for the heads up.



> (2) Above all, it was a *missed opportunity*.  Here was the chance to
> add a narration telling us what we are seeing and what it all *means*.
> Something not unlike Code Bullet, maybe?
> https://www.youtube.com/watch?v=WSW-5m8lRMs


The specifics are quite different.  We don't have access to the teams in
the same way,
but I get your point. Something similar with a different slant should be
possible - if the creative juices flow the right way.


(3) I don't give a tinker's curse for the score.  It's just a number without
> any context.  The scores for *all* the teams might be more interesting.
> The numbers that really matter are TIME, EFFORT, and SIZE.  How
> long did it take each team?  How much code did they end up with?  How
> much were they able to re-use?  How many false starts had to be thrown
> away?
>

Good points, but being the first time running such a competition, its not
set up to gather that information.
If a chance arose to do it, are there any further questions of interest to
others?



> (4) The other missed opportunity was the chance to show some of the
> Pharo IDE in action.  Click on a cell, bring up the halo, explore the
> data structure, show some code, jump around in it.
>

Will try to find time to do this later on.



As it is, this clip shows me
>  - unknown code
>  - solving an unfamiliar problem
>  - written by people I know nothing about
>  - using unknown tools
>  - with no evidence that Smalltalk helped in any way.
>
> If I were a Blub programmer, I'd probably ignore this
> completely.  At best, I'd look for the problem specification,
> then say "who cares, I can do that easily in Blub".
>
> If you want to show that Smalltalk is the best thing since
> sliced cheese, you have to show that *Smalltalk* is relevant
> in some way.
>

Thanks for your constructive critque.
cheers -ben


>
>
> On Sun, 23 Feb 2020 at 03:53, Richard Kenneth Eng
>  wrote:
> >
> > https://www.youtube.com/watch?v=iNyu-3Y2arg
> >
> > This time, the teams must deal with Jump cells, Warp cells, and Death
> cells. If you land on a Death cell, you die and the simulation terminates.
> >
> > Next week is the most exciting round yet. Multiple teams will be
> competing on the same board! This will look so damn cool on YouTube.
> >
> > Richard
>
>


Re: [Pharo-users] What is the difference between a form and a morph?

2020-02-23 Thread Ben Coman
On Mon, 24 Feb 2020 at 04:31, Steve Quezadas  wrote:

> I usually like to go through the source code to answer my own question,
> but I can't tell by reading it.
>
> [Morph], from what I understand, deals with manipulating graphics on
> smalltalk. But when I use ZnEasy to get a jpeg file, I notice that it
> returns a [Form] and not a [Morph] to display a jpeg. Spec2 also wants
> [Form] for displaying images rather than [Morph].
>
> So what is the difference between a [Form] and a [Morph] since they both
> seem to deal with graphics?
>

I don't know the exact answer, but if you review method ImageMorph>>form
you will see that the ImageMorph is a wrapper around a Form.

So some simple differences that may be inferred.
- Many morphs are not bitmaps.
- Morphs are GUI elements, i.e. interact with mouse and keyboard
- Forms are not GUI elements
- Forms can be manipulated without displaying them.

In some other graphics system, an analogy could be putting an image on a
button and asking "what is the difference between an 'image' and a 'button'
?"

wrt Spec2, Morph is one backend that Spec2 might use to display a Form,
or Spec2 might display the Form using a GTK widget.

cheers -ben


Re: [Pharo-users] can I somehow test the contents of a package

2020-02-14 Thread Ben Coman
That link didn't work for me, so I used...
https://safebrowsing.google.com/safebrowsing/report_badware/?hl=en

not sure if thats the best.

cheers -ben

On Sat, 15 Feb 2020 at 06:43, Christopher Fuhrman <
christopher.fuhr...@etsmtl.ca> wrote:

> Mean time, you can report the Google Drive ZIP files for abuse to Google.
> I think you have to be logged in to Google and then you put the ID from the
> ZIP file's URL at the end of the following URL:
>
> https://drive.google.com/u/0/abuse?id=
>
> On Fri, 14 Feb 2020 at 17:29, p...@highoctane.be 
> wrote:
>
>> This is spam from some hacker.
>>
>> Replaced all passwords on my side and enable 2FA where not done yet.
>>
>>
>> Sorry for the noise.
>>
>> Phil, the real one
>>
>>
>


Re: [Pharo-users] The results are in!

2020-02-10 Thread Ben Coman
On Mon, 10 Feb 2020 at 08:01, horrido  wrote:

>
> > Although the "smalltalk" title of the video is not ideal, that was the
> > name of the competition when it was originally going to use VisualWorks,
> > and so it carried over.
>
> Not only that, but if you look at jrmpc.ca, it uses the word "Smalltalk"
> all
> over the place. The sponsors include LabWare (who doesn't use Pharo),
> Simberon (who doesn't use Pharo), and TSUG (Toronto *Smalltalk* User
> Group).
> It's "Smalltalk" everywhere!


That is what it is. Can't change it.  The sponsors are being very generous.


And that's fine because Pharo is a Smalltalk.
>

But pushing that line here may generate further controversy around the
competition that will not help anyones cause.
There are other forums you can do that.  Here lets focus on the "Pharo"
aspects of the competition. :)

cheers -ben


Re: [Pharo-users] The results are in!

2020-02-09 Thread Ben Coman
Hi Guille,

Full disclosure, I've spent the past 6 months using my discretionary hobby
time
programming the infrastructure for this competition using Pharo, so my
viewpoint may be biased.

On Sun, 9 Feb 2020 at 03:25, Guillermo Polito 
wrote:
>
> Hi Richard,
>
> I’d like to invite you to refrain yourself from posting such off-topic
messages in the future.
>
> This list is for people to *ask* questions about Pharo. Not to diffuse
any kind of propaganda (pharo related or not).

This list is not just for asking questions.  There are plenty of [ANN]
posts advertising new libraries
and blogs articles.  Following completion of the competition, the MIT
licensed code repository will be announced here.
Hopefully it may provide an engaging exercise for Pharo teachers to their
with their students.


> I have the feeling this list has been lately flooded with such off-topic
messages.

Unfortunately the original post was quite bare and failed to show how it
was Pharo-topical.
So I can understand how it triggered you.  I hope the additional background
info provided here alleviates some of your concern about it.


> I know you don’t agree, but I invite you to read here the **purpose** of
this list, just for respect to people subscribed to it:
>https://lists.pharo.org/mailman/listinfo/pharo-users_lists.pharo.org

The purpose I see there seems fairly generic... "This is the general
mailing list for users of Pharo."

The competition is programmed in Pharo and Pharo is promoted later in the
video with screens like...

[image: image.png]
[image: image.png]

But that promotion is not the main thing.  The main thing is simply that
this is-A competition programmed using Pharo,
and as such this list seems reasonable a reasonable place discuss it.
Although the "smalltalk" title of the video is not ideal,
that was the name of the competition when it was originally going to use
VisualWorks, and so it carried over.

A final thing to consider is how welcomed the dozens of competing students
may feel if they are watching this list
and see their Pharo based competition spurned by the community.

So with this additional perspective, may one post a week be allowed to
share the progress of the competition?

cheers -ben


> El 8 feb 2020, a las 19:12, Richard Kenneth Eng 
escribió:
>
> Round 1 — #1 Leading Team: https://youtu.be/QWHeN5WXfBQ
>
> I'm actually quite amazed by their effort. They surpassed my expectations.
>
> At the risk of sounding immodest, I think this is a terrific way to
promote Smalltalk (Pharo). I think the video is an absolute blast.
>
> Richard
>
>


Re: [Pharo-users] About "it's not pharo but smalltalk"

2020-02-08 Thread Ben Coman
I am of the side of this argument that Pharo is a kind of Smalltalk,
but the group that forked Squeak to create Pharo did so with the
express intention of being separate-from-Smalltalk
and we should respect that intention.  Indeed here we can see three
reasons why they feel the need to advertise that separation...

On Fri, 7 Feb 2020 at 21:45, TedVanGaalen  wrote:
>
> make improvement/changes only in such
> a way that anything written before will
> run without any modification

You are constraining what Pharo can be.


> Downward compatibility prevents people
> from have tediously edit and test their packages
> again and again each time some have
> the "brilliant" idea to deprecate stuff.

You are constraining what Pharo can be.


> If you want to implement newer core like things
> co-existence with previous is preferable.
> Do at the very least not alter the core/system classes.

You are constraining what Pharo can be.


The aim of the advertised statement that Pharo-is-not-Smalltalk is to
avoid you "later" being surprised if it differs from ST-80.
A marketing strategy analogous to a "fail early" programming paradigm,
and avoid such arguments that try to shackle Pharo.

In practice, its probably many years before Pharo is any more
incompatible with Smalltalk than the incompatibilities between
existing Smalltalks.
But Smalltalk-backward-compatibility should not be one of your
tick-boxes to choose Pharo.

cheers -ben



Re: [Pharo-users] Fwd: Morph menu entries

2020-01-26 Thread Ben Coman
I guess its a carry over from Squeak and maybe Scratch which have more
focus on interactive media direct interaction than Pharo.
Personally I never use it and consider it too prominent, and think sinking
it one level to a World Menu Item would be nice.
What would be the arguments against doing that?

An alternative could be having it as a Task Bar menu item.

cheers -ben

On Sun, 26 Jan 2020 at 20:18, Richard Kenneth Eng 
wrote:

> Could someone please explain what the "World contents" menu obtained by
> right-clicking on the background is all about? (I normally left-click to
> obtain the "World" menu.) Why are there all those morphs listed? And is
> this potentially a problem?
>
> Thanks.
>
> -- Forwarded message -
> From: Bob Nemec
> Date: Sat, 25 Jan 2020 at 10:16
> Subject: Morph menu entries
>
> Hey Richard,
>
> I’m still learning Pharo, so I don’t know what this means, but when I
> right-click on the desktop I see a long list of StringMorph entries.
>
> Later I’ll try starting with a new image. Is there a more recent JRMPC
> file-out you’d like me to use?
>
>
>
>
>
>
>
> *Bob Nemec*
>
>
>
>
>
> *HTS Toronto *| ontario.htseng.com
>
> 115 Norfinch Drive | Toronto, ON M3N 1W8
>
> C: 905.442.4539 | T: 416.661.4060 Ext 2255 | F: 416.661.0100
>
>
>
> *Delivering Real Success®*
>
>
>
>
>
>
>


Re: [Pharo-users] Pharo Quality Rules for Beginners

2020-01-16 Thread Ben Coman
On Wed, 15 Jan 2020 at 17:41, ESTEBAN VILLALOBOS DIAZ via Pharo-users
 wrote:
>
> Hello everyone!
>
> My name is Esteban and I will be working on the Pharo Quality Rules for the 
> next few months. The goal is to create different profiles for the rules 
> according to the programming experience of the user. For example, for the 
> beginner profile we would like to check for common mistakes made by people 
> who are just starting with Pharo like:
>
> Sending self as a message (probably because they forgot a . )
> Using False instead of false
> etc..
>
> I would appreciate it if you could share with me other common mistakes that 
> you have seen beginners do, or maybe tell me a bit of your own experience 
> when you started using Pharo :)

- Getting confused between instance-side and class-side, mixing up
which side methods are on.
When getting a DNU maybe check if that message is known on the class-side.

- leaving out the end of statement trailing dot.
An error message like "Blah doesn't understand self" is a bit complex
for a beginner to decipher.

cheers -ben



Re: [Pharo-users] [Pharo-dev] [ANN] Embedding Image Example (Win)

2020-01-13 Thread Ben Coman
Thanks Pablo.  This will be cool to try sometime, and likely useful if I
want to distribute an app.

Now what woudl be great is an example something like embedding the VM
within a simple REPL written in C.
or something like a simple Pong game where the main loop is in C and does
the rendering,
but the game logic run in Pharo.

cheers -ben

On Mon, 13 Jan 2020 at 21:34, teso...@gmail.com  wrote:

> Hi,
>I have produced an example of using the headless VM to have an
> embedded image in Windows. The example is hosted in Github
> (https://github.com/tesonep/pharo-vm-embedded-example)
>
> The example is a CMake project to generate a new small executable that
> uses the VM as a library. Also, it shows how to perform the branding
> of applications (I have used the same Pharo icon, but we can use
> anything else).
>
> In the example, I am opening one of the SDL2 examples, it opens a
> window where we can draw in an Athens Canvas.
>
> It requires a Cygwin environment, but if you are able to build the
> headless VM you already have it!.
>
> I will do other examples of the use case we are thinking for the headless
> VM!
>
> Cheers,
> Pablo
>
> --
> Pablo Tesone.
> teso...@gmail.com
>
>


Re: [Pharo-users] Floating point arithmetic

2020-01-13 Thread Ben Coman
On Mon, 13 Jan 2020 at 19:42, Richard O'Keefe  wrote:

> You say that the first two results are wrong.
> No.  The first two results are *exactly* what they are supposed to be.
> Floating point arithmetic is NOT mathematical real arithmetic.
> The floating point *numbers* are exact rational numbers of the form
> n * 2^k where n is a (bounded) integer and k is a (bounded) integer.
> If you enter a number that is not of this form (and within bounds)
> you will get a *different* number that *is* of that form and is close.
> The floating point *operations* in IEEE arithmetic are exact
> when and only when the result is a number of that form (and within
> bounds), otherwise the result is *approximate*.
>
> If you want exact arithmetic on numbers of the form n * 10^k,
> ANSI Smalltalk provides the ScaledDecimal class, which, sigh,
>

How could this be improved?



> Squeak and Pharo interpret as "rational number *printed* in
> decimal form but not *computed* using decimal arithmetic"
>

I'm interested to understand what is the benefit of doing it this way.
Anyone know history of it?

cheers -ben

, so
> that can give extremely confusing results too.
>
> So what you are going to have to do is use rational numbers,
> which are in Smalltalk the union of Integer and Fraction.
>
>
> On Mon, 13 Jan 2020 at 09:13, Donald Howard 
> wrote:
>
>> Hello everyone,
>>
>> This is an issue I've had awareness of going way back but it's the first
>> time I've had to personally deal with it.  I've done some research and
>> found it addressed in a number of ways but given current time pressures and
>> a huge list of to-dos, I thought I'd turn to the community for rapid advice
>> to get me over the hump.  The circumstances are summarized below in code
>> and comments suitable for a playground.
>>
>> "This is the actual arithmetic I want to do...
>>  0.09560268 - 0.005 = 0.09060268"
>>
>> "Evaluate this in a playground and you'll see this is what
>>  floating point arithmetic produces --the first two are wrong, every one
>> after is correct"
>> 0.09560268 - 0.005 "=> 0.090602679".
>> 0.0956026 - 0.005  "=> 0.090602599".
>> 0.095602 - 0.005   "=> 0.090602".
>> 0.09560 - 0.005"=> 0.0906".
>> 0.0956 - 0.005 "=> 0.0906".
>> 0.095 - 0.005  "=> 0.09".
>>
>> "This workaround works"
>> 0.09560268 - 0.005 roundTo: 0.0001 "=> 0.09060268".
>> "but one has to compute number of digits of precision
>> and according to study above, it's not necessary at
>> precisions >= 0.01"
>>
>> "What are other suggestions, workarounds or approaches community has?"
>> "THANKS!"
>>
>>
>> Don Howard
>>
>> 
>> *Founding Member*
>> dhow...@objectguild.com
>> +31653139744
>> (US) 651-253-7024
>>
>


Re: [Pharo-users] [ANN] XMLParserHTML moved to GitHub

2020-01-08 Thread Ben Coman
On Wed, 8 Jan 2020 at 06:32, LawsonEnglish  wrote:

> “Simple inspect” works fine.
>
> THe trace is:
>
> UndefinedObject(Object)>>doesNotUnderstand: #new
> Message>>sentTo:
> UndefinedObject(Object)>>doesNotUnderstand: #new
> XMLDocumentHighlightDefaults class(XMLHighlightDefaults
> class)>>textColorForShoutProperty:
> XMLDocumentHighlightDefaults class(XMLHighlightDefaults
> class)>>defaultDefaultColor
> XMLDocumentHighlightDefaults(XMLHighlightDefaults)>>defaultColor
> XMLDocumentHighlighter(XMLHighlighter)>>initializeColorsWithDefaults:
> XMLDocumentHighlighter>>initializeColorsWithDefaults:
> XMLDocumentHighlighter(XMLHighlighter)>>initialize
> XMLDocumentHighlighter class(Behavior)>>new
> XMLHighlightingWriter>>on:
> XMLHighlightingWriter class(XMLWriter class)>>on:
> XMLHighlightingWriter class(XMLWriter class)>>new
> XMLDocument(XMLNode)>>asHighlightedTextWrittenWith:
> XMLDocument(XMLNode)>>treeViewLabelText
> [ :each | each treeViewLabelText ] in
> XMLDocument(XMLNode)>>gtInspectorTreeIn:inContext: in Block: [ :each | each
> treeViewLabelText ]
> BlockClosure>>glamourValueWithArgs:
> BlockClosure(ProtoObject)>>glamourValue:
> GLMTreePresentation(GLMFormatedPresentation)>>formatedDisplayValueOf:
> GLMTreeMorphNodeModel>>displayText
> GLMTreeMorphNodeModel>>elementColumn
> [ :node :cont | node perform: self rowMorphGetSelector ] in
> MorphTreeColumn>>rowMorphGetterBlock in Block: [ :node :cont | node
> perform: self rowMorphGetSele...etc...
> MorphTreeColumn>>rowMorphFor:
> [ :col |
> | v |
> v := col rowMorphFor: complexContents.
> controls add: v.
> col -> v ] in MorphTreeNodeMorph>>buildRowMorph in Block: [ :col | ...
> OrderedCollection>>collect:
> MorphTreeNodeMorph>>buildRowMorph
> MorphTreeNodeMorph>>initRow
> MorphTreeNodeMorph>>initWithContents:prior:forList:indentLevel:
> [ :item :idx |
> priorMorph := self indentingItemClass new
> initWithContents: item
> prior: priorMorph
> forList: self
> indentLevel: newIndent.
> firstAddition ifNil: [ firstAddition := priorMorph ].
> morphList add: priorMorph.
> "Was this row expanded ? if true -> expand it
> again "
> ((item hasEquivalentIn: expandedItems) or: [ priorMorph isExpanded ])
> ifTrue: [ priorMorph isExpanded: true.
> priorMorph
> addChildrenForList: self
> addingTo: morphList
> withExpandedItems: expandedItems ] ] in
> GLMPaginatedMorphTreeMorph(MorphTreeMorph)>>addMorphsTo:from:withExpandedItems:atLevel:
> in Block: [ :item :idx | ...
> OrderedCollection(SequenceableCollection)>>withIndexDo:
>
>
>
> .
>
> If it isn’t obvious what is going wrong from the above, I gues the thing
> to do is reinstall Pharo, and go through the steps of installing the
> various packages while recording them. If I get the same error, I’ll post
> the video of what I did  on youtube. If I don’t an error, then it was
> operator error from the start, obviously.
>

When it works for others but not yourself, then it seems something is
different in the environment.
One part of that environment is saved "Settings" so try the following
experiment

Presuming you are using Pharo Launcher...
1. Right click Pharo 7.0 64bit (stable), then > Create Image

2. Right-click that new image, then > LAUNCH WITHOUT SETTING

3. In Playground, evaluate the following all together...
Metacello new
 baseline: 'XMLParserHTML';
 repository: 'github://pharo-contributions/XML-XMLParserHTML/src';
 load.
(#XMLHTMLParser asClass parseURL:  '
https://ndb.nal.usda.gov/ndb/search/list?sort=ndb=Standard+Reference')
inspect.

4. Report whether the error still occurs.

=

That said, reviewing the method near top of your stack...
XMLHighlightDefaults >> textColorForShoutProperty: aShoutProperty
self haltOnce.
^ TextColor color:
(((SHTextStylerST80 new attributesFor: aShoutProperty)
detect: [:each | each respondsTo: #color]
ifNone: [^ nil]) color)

the syntax highlighter indicates that  "SHTextStylerST80"  is an unknown
class,
in which scenario your DNU error message is expected when #new is sent to
it.

I notice there is a  "SHTextStyler" class.  I'm not sure how this relates
to "SHTextStylerST80"
but have a go at changing #textColorForShoutProperty: to use it,
then again evaluate...
   (#XMLHTMLParser asClass parseURL: '
https://ndb.nal.usda.gov/ndb/search/list?sort=ndb=Standard+Reference')
inspect.

cheers -ben


Re: [Pharo-users] can I make this so the vm would not be not responsibe when running the tests

2020-01-05 Thread Ben Coman
Hi Richard,

Just fyi, the aim of Exercism is not to teach programming.  Its aim is for
experienced programmers to fast-start in new languages.
It just happens to that new programmers also use Exercism and there is some
catering in the exercise text for this.

The grains exercise provides a nice vehicle for programmers to familiarize
themselves with recursion in Pharo,
and the hint for the exercise says "These kinds of problems (where an
answer is dependent on a previous) one are often called recursion"
which is why Roelof is approaching the problem this way.

That said, any solution will do.  Your advice on alternative considerations
is insightful and always good to read.

cheers -ben

On Mon, 6 Jan 2020 at 00:25, Richard O'Keefe  wrote:

> I did not ask why you were validating input.
> I asked about why you *repeatedly* validated input.
>
> Think of it this way:
>publicMethod: arg1 also: arg2
>   ... check arg1 ...
>   ... check arg2 ...
>  ^self privateMethod: arg1 also: arg2
>
> privateMethod: arg1 also: arg2
>   ... trust that arg1 and arg2 are valide ...
>   ... recursive calls use #privateMethod:andAlso: ...
>   ... not #publicMethod:andAlso: and must ensure ...
>   ... that arguments are valid by construction ...
>
> In my solution to the "Grains" exercism, I have
>   atSquare: n   -- checks its argument
>   total ^(1 bitShift: 64) - 1
> You are required to implement these two methods, true.
> You are NOT required to implement #total by calling #atSquare:.
> Not even once.  Nor is #atSquare: required to be recursive.
>
> On Mon, 6 Jan 2020 at 02:05, Roelof Wobben  wrote:
> >
> > Hello Ricard.
> >
> > You mean when I calcualate the total of a board.
> > That is because on when I had to calculate the number of a particular
> > field there were tests where the number was lower then zero or higher
> > then 64 which makes no sense.
> >
> > But im open for a solution where on a particular field I could check for
> > that and for the total I do not need that part.
> >
> > Roelof
> >
> >
> >
> > Op 5-1-2020 om 13:58 schreef Richard O'Keefe:
> > > Time microsecondsToRun: [
> > >  |n|
> > >  n := (2 raisedToInteger: 8 * 8) - 1.
> > >  Transcript
> > >  nextPutAll: 'The number of grains on an 8x8 chessboard is ';
> > > print: n; cr; endEntry].
> > > 
> > > On my laptop, this reports 194 microseconds.
> > >
> > > Why would you use recursion, anyway?
> > >
> > > Time microsecondsToRun: [
> > >  |n|
> > >  n := (1 to: 8 * 8) inject: 0 into: [:acc :each | acc+acc+1].
> > >  Transcript
> > >  nextPutAll: 'The number of grains on an 8x8 chessboard is ';
> > > print: n; cr; endEntry].
> > > 
> > > On the same laptop, this reports 118 microseconds.
> > >
> > > One of the lessons of 'functional' languages, promptly adopted by
> Smalltalk, is
> > > to encapsulate control structures into reusable methods, such as
> #inject:into:,
> > > more commonly known as `foldl` in functional languages.  It's then
> none of
> > > my business whether such a method works by recursion, iteration, or
> gangs
> > > of otherwise seasonally unemployed Christmas elves.
> > >
> > > In my own Smalltalk library,
> > >(GeometricSeries new: 64 from: 1 byFactor: 2) sum
> > > only takes 15 microseconds.
> > >
> > > I do note that you are calling validateInput repeatedly.  Why?
> > >
> > >
> > > On Sun, 5 Jan 2020 at 07:41, Roelof Wobben via Pharo-users
> > >  wrote:
> > >> Oke,
> > >>
> > >> So I can better not use recursion for this problem if I understand
> you well,  Richard.
> > >>
> > >> Roelof
> > >>
> > >>
> > >>
> > >> Op 4-1-2020 om 19:02 schreef Richard Sargent:
> > >>
> > >> On Sat, Jan 4, 2020 at 9:47 AM Roelof Wobben via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
> > >>> Hello,
> > >>>
> > >>> For a exercism challenge I need to calculate the total grains on a
> > >>> chessboard.
> > >>> So I did :
> > >>>
> > >>> atSquare: anInteger
> > >>>   self validateInput: anInteger.
> > >>>   ^ anInteger = 1
> > >>>   ifTrue: [ 1 ]
> > >>>   ifFalse: [ 2 * (self atSquare: anInteger - 1) ]
> > >>>
> > >>>
> > >>> but when I run the tests , the vm seems to be not responsive for
> some 4
> > >>> - 5 seconds.
> > >>>
> > >>> Is there a way I can use this code and take care that the vm stays
> > >>> responsive.
> > >>
> > >> What do you want the VM to do in addition to calculating that sum
> while it is calculating that sum?
> > >>
> > >>
> > >> The best way to keep the VM responsive is to take a page from Gauss'
> notebook and pay attention to the numbers[1]. Let's consider the first four
> squares and extrapolate from there.
> > >>
> > >> In binary, the squares hold the following grains: 2r1, 2r10, r2100,
> and 2r1000. When we add them up, we get 2r. If we use Gauss' tricks, we
> can notice that 2r is equal to 2r1 - 1. So, the sum of the grains
> on the first 4 squares is 2^5 - 1. You can easily generalize that pattern,
> 

Re: [Pharo-users] why is masses not found?

2020-01-02 Thread Ben Coman
On Fri, 3 Jan 2020 at 00:41, Roelof Wobben  wrote:

> Hello Ben.
>
> That was a error . There schould be a caret for it.  Im talking about the
> solution method.
>
> No, I cannot clean the in part because it is used in the process*  methods
>

But its not.  Your statement would be true if your processXXX methods did...
a := self at: self in next.
but they don't, instead you have...
a := self at: in next.

You never send the #in message, which is fine since "information hiding"
can be useful
to avoid exposing your internal representation that the outside doesn't
need to know about.
(the proof is in the pudding, see if it works after deleting #in and #in:)

The  processData:  can also be deleted . I think Its  a part of a earlier
> try to solve it.
>
> and yes. the ram is the same at both places.
>


> Is there then a better way to pass the stream around.
>

I think its fine how you've done it.

Final thing is to clean up the "class-instance variable" (i.e. class-side
instance variable)
which Sean mentioned.  You can see it here...
https://github.com/rwobben/intComputer/blob/master/AOC%202019/IntComputer.class.st#L8-L10


To remove it from the image, in the System Browser while viewing the class
definition, click the "Class" button and you should see it.

cheers -ben


>
> Op 2-1-2020 om 14:27 schreef Ben Coman:
>
> Hi Roelof,
>
> I presume its working since you only asked for code smells.
> It looks pretty good to me with methods generally being small and doing
> one thing.
>
> The way your class-side-method "IntComputer class >> solution" just
> creates an instance and sends #process is good.
> I'm a little curious that it doesn't return a value.  #process returns a
> value but nothing is done with it.  I guess the test-frame doesn't require
> it.
>
> The way zero-index ram access is encapsulated by  #at:  and   #at:put:  is
> good.
>
> Possible cleanup,  #in and #in: don't seem required since variable "in"
> is used directly in the rest of the code, which is fine.
>
> The hardcoded  #masses  return value is fine, except it makes the "masses"
> class variable redundant.
>
> Your various #processXXX methods are succinct and consume the stream
> neatly.
>
> However its curious your  #processData and #processData:  methods have
> identical code, since the latter has an argument that is then not used.
> So your code is working a bit by accident. At line 59 (
> https://github.com/rwobben/intComputer/blob/master/AOC%202019/IntComputer.class.st#L59
> )
> its just lucky that the "self ram" you pass there to #processData:  is the
> same as the "ram" variable referenced
> on line 82 (
> https://github.com/rwobben/intComputer/blob/master/AOC%202019/IntComputer.class.st#L82
> )
>
> Well done.
> cheers -ben
>
>
>
>
>
> On Thu, 2 Jan 2020 at 23:37, Roelof Wobben via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
>
>> Op 1-1-2020 om 17:27 schreef Roelof Wobben via Pharo-users:
>> Hello,
>>
>> I made some changes. Is this better or are there still some code smells.
>> Code :
>> https://github.com/rwobben/intComputer/blob/master/AOC%202019/IntComputer.class.st
>>
>> if so, can someone help me to solve the code smells.
>>
>> Here is the challenge I try to solve :
>>
>> On the way to your gravity assist
>> <https://en.wikipedia.org/wiki/Gravity_assist> around the Moon, your
>> ship computer beeps angrily about a "1202 program alarm
>> <https://www.hq.nasa.gov/alsj/a11/a11.landing.html#1023832>". On the
>> radio, an Elf is already explaining how to handle the situation: "Don't
>> worry, that's perfectly norma--" The ship computer bursts into flames
>> <https://en.wikipedia.org/wiki/Halt_and_Catch_Fire>.
>>
>> You notify the Elves that the computer's magic smoke
>> <https://en.wikipedia.org/wiki/Magic_smoke> seems to have escaped. "That
>> computer ran *Intcode* programs like the gravity assist program it was
>> working on; surely there are enough spare parts up there to build a new
>> Intcode computer!"
>>
>> An Intcode program is a list of integers
>> <https://en.wikipedia.org/wiki/Integer> separated by commas (like
>> 1,0,0,3,99). To run one, start by looking at the first integer (called
>> position 0). Here, you will find an *opcode* - either 1, 2, or 99. The
>> opcode indicates what to do; for example, 99 means that the program is
>> finished and should immediately halt. Encountering an unknown opcode means
>> something went wrong.
>>
>> Opcode 1 *adds* together numbers read 

Re: [Pharo-users] why is masses not found?

2020-01-02 Thread Ben Coman
Hi Roelof,

I presume its working since you only asked for code smells.
It looks pretty good to me with methods generally being small and doing one
thing.

The way your class-side-method "IntComputer class >> solution" just creates
an instance and sends #process is good.
I'm a little curious that it doesn't return a value.  #process returns a
value but nothing is done with it.  I guess the test-frame doesn't require
it.

The way zero-index ram access is encapsulated by  #at:  and   #at:put:  is
good.

Possible cleanup,  #in and #in: don't seem required since variable "in" is
used directly in the rest of the code, which is fine.

The hardcoded  #masses  return value is fine, except it makes the "masses"
class variable redundant.

Your various #processXXX methods are succinct and consume the stream neatly.

However its curious your  #processData and #processData:  methods have
identical code, since the latter has an argument that is then not used.
So your code is working a bit by accident. At line 59 (
https://github.com/rwobben/intComputer/blob/master/AOC%202019/IntComputer.class.st#L59
)
its just lucky that the "self ram" you pass there to #processData:  is the
same as the "ram" variable referenced
on line 82 (
https://github.com/rwobben/intComputer/blob/master/AOC%202019/IntComputer.class.st#L82
)

Well done.
cheers -ben





On Thu, 2 Jan 2020 at 23:37, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Op 1-1-2020 om 17:27 schreef Roelof Wobben via Pharo-users:
>
> Hello,
>
> I made some changes. Is this better or are there still some code smells.
> Code :
> https://github.com/rwobben/intComputer/blob/master/AOC%202019/IntComputer.class.st
>
> if so, can someone help me to solve the code smells.
>
> Here is the challenge I try to solve :
>
> On the way to your gravity assist
>  around the Moon, your ship
> computer beeps angrily about a "1202 program alarm
> ". On the
> radio, an Elf is already explaining how to handle the situation: "Don't
> worry, that's perfectly norma--" The ship computer bursts into flames
> .
>
> You notify the Elves that the computer's magic smoke
>  seems to have escaped. "That
> computer ran *Intcode* programs like the gravity assist program it was
> working on; surely there are enough spare parts up there to build a new
> Intcode computer!"
>
> An Intcode program is a list of integers
>  separated by commas (like
> 1,0,0,3,99). To run one, start by looking at the first integer (called
> position 0). Here, you will find an *opcode* - either 1, 2, or 99. The
> opcode indicates what to do; for example, 99 means that the program is
> finished and should immediately halt. Encountering an unknown opcode means
> something went wrong.
>
> Opcode 1 *adds* together numbers read from two positions and stores the
> result in a third position. The three integers *immediately after* the
> opcode tell you these three positions - the first two indicate the
> *positions* from which you should read the input values, and the third
> indicates the *position* at which the output should be stored.
>
> For example, if your Intcode computer encounters 1,10,20,30, it should
> read the values at positions 10 and 20, add those values, and then
> overwrite the value at position 30 with their sum.
>
> Opcode 2 works exactly like opcode 1, except it *multiplies* the two
> inputs instead of adding them. Again, the three integers after the opcode
> indicate *where* the inputs and outputs are, not their values.
>
> Once you're done processing an opcode, *move to the next one* by stepping
> forward 4 positions.
>
> For example, suppose you have the following program:
>
> 1,9,10,3,2,3,11,0,99,30,40,50
>
> For the purposes of illustration, here is the same program split into
> multiple lines:
>
> 1,9,10,3,
> 2,3,11,0,
> 99,
> 30,40,50
>
> The first four integers, 1,9,10,3, are at positions 0, 1, 2, and 3.
> Together, they represent the first opcode (1, addition), the positions of
> the two inputs (9 and 10), and the position of the output (3). To handle
> this opcode, you first need to get the values at the input positions:
> position 9 contains 30, and position 10 contains 40. *Add* these numbers
> together to get 70. Then, store this value at the output position; here,
> the output position (3) is *at* position 3, so it overwrites itself.
> Afterward, the program looks like this:
>
> 1,9,10,*70*,
> 2,3,11,0,
> 99,
> 30,40,50
>
> Step forward 4 positions to reach the next opcode, 2. This opcode works
> just like the previous, but it multiplies instead of adding. The inputs are
> at positions 3 and 11; these positions contain 70 and 50 respectively.
> Multiplying these produces 3500; this is stored at position 0:
>
> *3500*,9,10,70,
> 2,3,11,0,
> 99,
> 

Re: [Pharo-users] why is masses not found?

2019-12-31 Thread Ben Coman
Hi Roelof,

I could file-in or look at your attached code to try to help,
but its not clear what your question is or how to reproduce your scenario.

You say... "when I call on the class side the method which should read the
masses"which is a non-specific **description**.
So I feel its extra work to try and decipher your question and perhaps I
won't work it out and it would be wasted effort,
which discourages me from trying to answer.
Being more specific, something like... "when I call MyClass
class>>myMethodXyz"
would make feel like I have a chance at answering.

Same for... "at the process method" - I see no method named #process so I
can't guess what you question is.

I've taken the time to provide this feedback to encourage you to improve
your question to facilitate a better response.
I recommend reading... http://www.catb.org/~esr/faqs/smart-questions.html
(although the tone is a bit dark, there are some useful tidbits)

cheers -ben

P.S. Before your next (improved :^)  restatement of your question, could
you try an exercise...
Slowly debug into the class-side call you are making, each step recording
on paper on a new line the message sent, and on the same line the value of
significant variables, to see if anything unexpected catches your
attention.

When the stepping is at a return statement ($^), select that statement and
Inspect it, so you are sure of the value being returned.

HTH.
And btw, keep at it.  The "process" of finding out why things don't work as
expected is where you learn the most.

On Tue, 31 Dec 2019 at 22:02, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Hello,
>
> Im still trying to make part1 of day2 working at a way I can also test
> things.
> the tests are working but when I call on the class side the method which
> should reed the masses which are on the instanc side , the masses
> cannnot be found.
>
> So question 1 is why is masses not found.
>
> and question 2  is how can I use the changed array at the process method
> so I can calculate the outcome.
>
> Regards,
>
> Roelof
>
>


Re: [Pharo-users] Hi Community

2019-12-27 Thread Ben Coman
Looks cool. Thanks for sharing.

cheers -ben

On Sat, 28 Dec 2019 at 09:55, Pablo Navarro  wrote:

> Hi everyone, my name's Pablo and I'm from Argentina. I'm taking my first
> steps in Pharo and created this tool (
> https://github.com/pablo1n7/Smallbook) to share with my colleagues and
> show them the power of Pharo.
>
>
> It's a simple library to create slide presentations and show them in a web
> browser.
>
>
> I used Zinc HTTP for the server, JS for the presentation controls and CSS
> for the styles.
>
>
> It's not 100% complete, I'm still working on it. I hope you find it useful
> and any suggestion is welcomed
>
>
>
> Best Regards, Pablo.
>


Re: [Pharo-users] External Module not found - LGitLibrary

2019-12-20 Thread Ben Coman
On Fri, 20 Dec 2019 at 22:36, BrunoBB  wrote:

> Hi,
>
> My problem is in Pharo 7 and also it happend randomly.
>
> But this time is not going away ...
>
> My Pharo 7 VM is installed in "C:\Users\Usuario\Documents\Pharo\vms\70-x64"
>
> If i remember correctly i have read there are some issues when is not
> installed in the default path.
>

Although not a brilliant solution... what happens if you reboot your
machine.

cheers -ben


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Ben Coman
On Wed, 18 Dec 2019 at 16:12, Steve Davies 
wrote:

> Hi,
>
> I'm having yet another go to get to grips with Pharo.
>
> My project is for home automation.  It seems in principle a great match
> since object inside Smalltalk are obviously a great match for physical
> objects being controlled.
>
> I started at the Pharo Wiki on Github "Setting up a new project".
>
> I'm a career programmer but I'm nearly 60 and sadly I can't absorb
> information like I used to be able to, and I'm just finding Pharo so
> overwhelming - I feel like a maintenance programmer trying to find a way
> into a million lines of code when you don't understand the principles of
> organisation and the conventions of the developers.
>

Consider the analogy would be someone wanting to write Hello World as a
newcomer in C
and having the source code for the Eclipse IDE in front of them and feeling
like they have to understand all of that source code before writing Hello
World.
Just because because the code for the whole Pharo IDE system is front of
you doesn't mean you should feel need to understand it all at once, or even
ever.
But I remember a similar initial jarring of my workflow before developing a
constructive-ignorance mindset.


Is there no way to have some sort of "progressive revelation" of the
> insides of Pharo?  Just documentation on most classes, examples of how to
> use the class, without the implementation being exposed initially?
>

The books and MOOC are probably the best for this
https://pharo.org/documentation

For something a bit more goal oriented, try Exercism...
https://exercism.io/tracks/pharo-smalltalk


The stuff I need to look into for my project is mixed in with 1000s of
> classes that I (hopefully) can ignore for now - but there seems to be no
> way to hide away all the irrelevant stuff.
>
> Traditionally if I was trying to get to grips with a large unfamiliar code
> base I would use grep to search, skim through source files getting a sense
> of it.  With the browser in Pharo I feel like I'm looking through a
> keyhole.  No doubt this is just unfamiliarity and I just need to learn the
> tools better.
>

A few things I find useful are:
* In the class definition, select a variable the right-click-it > Code
Search > References to it
* In the Browser, select a class, right-click-it > Class Refs to find some
unit tests using it, then debug-into those tests.
* Make heavy use of Senders and Implementors to find examples of how things
are used.
* Add "self haltOnce" into methods so you can observe the call stack of how
they are used.  Note: "self halt" can be dangerous in system methods you're
not familiar with, in case that method is used by the UI loop.  haltOnce
effectively stops the current UI loop and spawn a new UI loop to keep
working.

Personally I find it easier to understand the Pharo libraries by watching
them run in a debugger than perusing static code.

I'm looking forward to trying out the new object-centric-debugging...
https://www.youtube.com/watch?v=uDYJIm54yE4


Please read this as a request for help as to how to get a finger hold and
> how to shake this feeling of drinking from the firehose?  It's not intended
> as a complaint.
>

Cool.  It does read that way.  Happy to help you settle in.

cheers -ben

>


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Ben Coman
On Wed, 18 Dec 2019 at 23:05, ponyatov  wrote:

> I'm speaking about 20K SRAM computers and Java-only services. FFI and VMs
> do
> not matter here.
>

Ahh, got it.  Pharo's never going squeeze down to a 20K device,
but I think its feasible for our StackInterpreter VM to be ported to the
ESP32 microprocessor (https://www.sparkfun.com/products/13907)
Oh if I had the time...
And these devices get more powerful and cheaper every year. Maybe we will
get there.

cheers -ben


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Ben Coman
On Wed, 18 Dec 2019 at 20:06, ponyatov  wrote:

> Hello, colleague.
>
> I'm also working in the same domain, primarily on the target of adapting
> the
> Actor model (async distributed messaging) for IoT systems in a wide: from
> deeply embedded nodes to top-level north-side cloud cervices.
>
> I like Pharo as a workstation system and IDE, but I'm not looking Pharo as
> a
> self-hosted platform for my needs. The problem is all IoT infrastructure it
> tightly bound with low-level C for nodes and Java for top-side. There are
> dozens and hundreds of existing projects, firmware source codes, platforms,
> etc which I must integrate with as is.
>
> As you know, Smalltalk is well known as bad in interaction with other
> existing projects,


Historically that was true, but Pharoers saw interaction with the outside
as a gap they had to close
and third party libraries are not hard to use via FFI..  Here is one small
example of my own making calls into the LibSodium crypto library.
https://github.com/Traadh/bittrex/search?q=ffi_q=ffi


If anybody doubts, try to use it the same way as
> Lua engine: embed into existing C#/Java project,


Embedding Pharo is getting better now that we have a headless VM

http://forum.world.st/ANN-Pharo-Headless-Beta-Actually-what-is-between-Alpha-and-Beta-td5102089.htm

able to use an external library like GTK3 for its graphics backend.



> or bind it with any
> randomly selected C++ library in a click, like Qt, LLVM, wxWidgets or
> something fat like this.
>

Can you link to some info/tutorial on such one-click binding.  What
workflow should Pharo be trying to emulate?

cheers -ben


Re: [Pharo-users] TaskIt

2019-12-17 Thread Ben Coman
On Mon, 16 Dec 2019 at 18:41, Santiago Bragagnolo <
santiagobragagn...@gmail.com> wrote:

> Hi everybody!
>We are starting to discuss with norbert about letting taskit to leave
> my incubator (my github account to go elsewhere). I have being thinking
> about it since long time, since i would like it to allow taskit to evolve
> into more than just my needs and wishes.
>
>The sidequestion i am bringing today it may seem (or even be) almost
> scholastic at this point, but i think it should have some space.
>The question is if to move it to pharo-contributions, or if to create a
> new pharo-processing.
>

I know a bit of what TaskIt is, but not what "processing" is in-general.
Can you clue me in?

cheers -ben


Re: [Pharo-users] how can I this refractor this so its more smalltalk

2019-12-17 Thread Ben Coman
Apart from using streams, part of making code less ugly is splitting it up
its separate aaspects.
One way it to to do as little as possible within your loop.  See how Todd
only does one thing within his loop.
Apart from looking nicer, doing so improves how you "think" about the
problem.

cheers -ben

On Tue, 17 Dec 2019 at 23:00, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Hello,
>
> My solution to day2 part1 is right this :
>
> processData: instructions
>  | opcode index firstNumber secondNumber placeToPut firstNumberIndex
> secondNumberIndex |
>  index := 1.
>  opcode := instructions at: index.
>  [ opcode ~= 99 ]
>  whileTrue: [ firstNumberIndex := instructions at: index + 1.
>  secondNumberIndex := instructions at: index + 2.
>  firstNumber := instructions at: firstNumberIndex + 1.
>  secondNumber := instructions at: secondNumberIndex + 1.
>  placeToPut := (instructions at: index + 3) + 1.
>  opcode == 1
>  ifTrue: [ instructions at: placeToPut put: firstNumber
> + secondNumber ].
>  opcode == 2
>  ifTrue: [ instructions at: placeToPut put: firstNumber
> * secondNumber ].
>  index := index + 4.
>  opcode := instructions at: index ].
>  ^ instructions at: 1
>
> so its ugly code
>
> is there a way  I can this more the smalltalk way by using streams or
> something else.
> if so, is there someone who can tell me or can let me see how to make
> this cleaner code
>
> Roelof
>
>
>


Re: [Pharo-users] uFFI: Debugging "External module not found" Error

2019-12-03 Thread Ben Coman
>
> > On Dec 3, 2019, at 11:34 AM, Sean P. DeNigris 
> wrote:
> >
> > Alistair Grant wrote
> >> The same message is returned whether the module itself isn't found, or
> >> if one of its dependencies can't be found.
>

Secondary dependencies are awkward to track via command line.



> >
> > Good to know. I wonder if we can't provide more detailed error messages
> > here...
>

The following turned up in a search (I've no experience with it), but could
be useful...
https://linux.die.net/man/7/rtld-audit

Or perhaps the system can examine the DYNAMIC section of an ELF to pre-load
each dependency.
>From the image, something in part equivalent to...
https://github.com/finixbit/elf-parser/blob/master/elf_parser.cpp
GT inspector on an ELF file could an interesting demo ;)

btw, I wasn't aware of how "Runtime Search Path: Security" affected the
search path...
https://amir.rachum.com/blog/2016/09/17/shared-libraries/


> Alistair Grant wrote
> >> On linux you can check dependencies with `ldd file.so`, I don't know
> >> what the Mac equivalent is.
> >
> > Apparently, it's `otool -L whatever.dylib`, which returns:
> >   @rpath/libvlc.dylib (compatibility version 12.0.0, current version
> 12.0.0)
> >   @rpath/libvlccore.dylib (compatibility version 10.0.0, current
> version
> > 10.0.0)
> >   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version
> > 1252.50.4)
> >   /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current
> version
> > 7.0.0)
>

On Wed, 4 Dec 2019 at 03:58, Todd Blanchard via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> This is the most annoying thing about UFFI - the library search seems to
> opaque and I don't understand how it works.
>
> So far I am finding best practice is to find the library yourself and then
> provide the exact file path you want.
>
> That way, you can actually prompt the user to find it if you don't and
> they get a decent experience.
>


cheers -ben

P.S. an interesting side article...
https://medium.com/forensicitguy/whitelisting-ld-preload-for-fun-and-no-profit-98dfea740b9


Re: [Pharo-users] uFFI: Debugging "External module not found" Error

2019-12-03 Thread Ben Coman
On Wed, 4 Dec 2019 at 00:26, Sean P. DeNigris  wrote:

> I was trying to get Pharo-LibVLC working on Mac. The following is copied
> from
> a GH issue[1]:
>
> > I have VLC installed via Homebrew cask, the formula for which simply
> > installs the dmg. I
> > first tried supplying a full path to the dylib that the VLC app uses
> > (/Applications/VLC.app/Contents/MacOS/lib/libvlc.5.dylib), which resulted
> > in "Error:
> > External module not found". I then remembered some trouble people have
> had
> > in the past
> > with FFI lookup locations and tried copying into the VM's plugin folder
>

One catch that has confused me in the past, is when the system caches that
it couldn't find the external module,
so even when I copyied it to the VM folder or got the path correct, it
continued to fail until I restarted the Image.

cheers -ben


> > both a link and the
> > actual dylib, with the same error. I read the uFFI booklet, but didn't
> > learn anything more.
> >
> > I also checked that the VLC lib was 64-bit via:
> >
> > lipo -info .../Pharo.app/Contents/MacOS/Plugins/libvlc.5.dylib
> > which returned:
> > Non-fat file: .../Plugins/libvlc.5.dylib is architecture: x86_64
>
> [1] https://github.com/badetitou/Pharo-LibVLC/issues/1
>
>
>
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] Was there some force push to Roassal?

2019-11-11 Thread Ben Coman
On Sun, 10 Nov 2019 at 09:32, Alexandre Bergel via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Hi Cyril,
>
> I tried something to remove some large blob from the history. The code
> source of Roassal2 is about 7Mb large, but the .git folder is about 150 Mb!
> But at the end, it was the push was rejected because some pullrequests
> exist. So, I did not suspect that I had an impact. Sorry about that.
>

It seems strange it was rejected because some pull request existed.   Were
you doing it from the command line?
Was it something like one of these error messages? Particularly Step 11?
https://github.community/t5/How-to-use-Git-and-GitHub/How-to-deal-with-quot-refusing-to-merge-unrelated-histories-quot/td-p/12619




> Help is welcome to shrink Roassal2’s .git folder.
>

I just cloned Rossal2 and `du -sh .` gave 88M, so its looks like you had
some success reducing it.
Google found me a way to list large objects...
```
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname)
%(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i
--suffix=B --padding=7 --round=nearest \
> ../list.txt
```
The largest file entry was...  e0c5f0885bac  432KiB src/Roassal2/
RTRoassalExample.class.st

That file is no longer in the repo, but...
$ grep RTRoassalExample.class.st ../list.txt  | wc -l
==> 158
and
158 * 432K ==> 68M

Found the commit with that blob to examine...
$ git log --all --pretty=format:%H -- src/Roassal2/RTRoassalExample.class.st
| xargs -n1 -I% sh -c "git ls-tree % -- src/Roassal2/
RTRoassalExample.class.st | grep -q e0c5f0885bac && echo %"
==> a7753aef2a9f14cf5c84da83b8ebff7e4e35f0e9

$ git checkout a7753aef2a9f14cf5c84da83b8ebff7e4e35f0e9
$ vi src/Roassal2/RTRoassalExample.class.st

and I see the culprit is icons being encoded directly in the class...
   { #category : #icons }
   RTRoassalExample >> exampleAligningGroupsIcon [
^
'iVBORw0KGgoNSUhEUgAAAGQAAABkCAYAAABw4pVUAAAICElEQVR4XuWaWWhUVxjHI27Q
   1oJttfjUusQHQdE+uIFUJYIVBC1VrDv6oKDUd5fGKK3RRgkRFfelaKvR1rpS7YbGFrUWcaHF
   msYsNMaJSWa9SWbmf3v+9/YmM5M7zj5J/P4wzGQyc+855/edbzuTo+vy1ZWUI38J5AORL/lA
   5AORL/lA5AORL/lA5AORL/lA5AORL/lA5Es+EPlA5Es+EPlA5Es+EPlA5Es+EPlA5Es+EPmS
   D0Q+EPmSD0Q+EPmSD0Q+EPmSD0Q+EPmSD0S+5AORD0S+5AORD0S+5AORD6QratMmoLkZCH3v
   ...etc

One way to reduce those historical file sizes would be running git-filter
with an automated way to extract those icons to separate files and add code
to load them.
Seems hard.

Following another path of investigation led me first to to "Git Compression
of Blobs and Packfiles"
https://gist.github.com/matthewmccullough/2695758

So trying...
$ git gc --aggressive
$ du -sh .
==> 18M

https://stackoverflow.com/questions/28720151/git-gc-aggressive-vs-git-repack

led me to the same job being done by...
$ git repack -a -d -f --depth=10 --window=250
$ du -sh .
==> 18M

My understanding is that this is safe and doesn't affect the commit
history.
However its just a local result.  A few things I read gives the feeling
that pushing from that repacked repo won't change anything on the server
since it only sends a diff to the server, which then repacks in its own
time.

Perhaps the only way is ask GIthub Support if they can repack it.
https://help.github.com/en/github/working-with-github-support/submitting-a-ticket


cheers -ben


Re: [Pharo-users] [Pharo-dev] Pumping FFI documentation [WAS] FFI beginner question

2019-09-25 Thread Ben Coman
On Wed, 25 Sep 2019 at 13:51, Stéphane Ducasse 
wrote:

> Hi
>
> Normally each time a PR is integrated in a book, the CI is generating the
> PDF.
> https://github.com/SquareBracketAssociates/Booklet-uFFI/releases
>
> So what you can do is to not bother and copy-edit and we fix the
> corresponding pillar
> if you break it.
>

Hey Stef :)
I'm guessing you mean to encourage Ted to "not worry" rather than "not
bother"
https://www.phrasemix.com/phrases/not-bother-doing-something

cheers -ben


Re: [Pharo-users] Pumping FFI documentation [WAS] FFI beginner question

2019-09-25 Thread Ben Coman
On Wed, 25 Sep 2019 at 08:35, Brainstorms  wrote:

> I automate instrumentation for data acquisition & process control;
> we started using Lua as a scripting language to allow our end-users to
> script the operation of compiled apps we produce.  There's a potential to
> also use Pharo to do this.  I think Lua's well-designed FFI will make
> "swapping out" Lua for Pharo achievable.
>

Cool!  I'd be interested to track what you do in this space.
(I'm an electrical engineer and always thought Pharo would make a great
SCADA system.
https://www.linkedin.com/in/bencoman/ )

Btw, I haven't managed to bubble playing-with-this to the top of my queue,
but it may interest you...
https://github.com/jmari/StModbus

cheers -ben


Re: [Pharo-users] pharo for ios and android

2019-09-21 Thread Ben Coman
On Sat, 21 Sep 2019 at 09:34, Steve Quezadas  wrote:

> I am going to the portland meetup this october and I noticed that one of
> the items listed is "Smalltalk on iOS and Android" which intrigues me. Is
> some Guilfoyle-type here writing a VM for these platforms? I was joking
> with a friend that we should write a vm for ios using the "smalltalk blue
> book" and it would be fun to learn how vm's work by trying to write
> sometihng for ios. Is someone already working on this?
>

It is not mainstream, but has been done by some individuals...
http://forum.world.st/Ann-Stack-Android-VM-td4919869.html
http://forum.world.st/Xcode-projects-for-VM-on-iOS-or-Mac-td5087786.html


One thing to be aware of is that the VM for these platform doesn't come
with JIT.

The other is that these platforms are strongly weighted towards
event-driven coding style
and the VM currently is not event driven.  This has an impact on battery
life, and may bump up against rules that terminate a long running process
(my understanding of this is limited).

Pharo 8's headless-VM opens up some possibilities towards creating an
event-driven VM, but I'm not aware of any immediate plans to do that.

cheers -ben


Re: [Pharo-users] Code of Conduct

2019-09-20 Thread Ben Coman
On Sat, 21 Sep 2019 at 01:35, Ramon Leon  wrote:

> On 2019-09-20 7:44 a.m., Steve Quezadas wrote:
> > Or maybe you're too easily offended and the problem lies with you.
>

Its all too easy for threads to drag out tit for tat.
I'd be impressed to see who can take the high road to wrap this up.

btw, you know why my wife always gets the last word in an argument?
Because the next thing I say is the start of a new argument.



> It's fairly obvious now, the Pharo leadership is occupied by left wing
> progressives who are intent on bringing identity politics into the
> community.


Thats not the impression I get, otherwise the full Contributor Covenant
would still be being rammed down your throat.

The impression I get is that its easy to think the full CC is a good thing
without being aware of its negative perceptions and consequences.
The original PR seems to have been accepted on that basis (and maybe even
submitted on that basis)
The board seems to have now taken account of opposing viewpoints and
determined a middle path.
That seems far from being a left wing progressive.



> While the new CoC is vastly better in its current state, it still insists
> one the left wing political ideology of respecting people's chosen
> identities as if that has any bearing at all on anything.
>

In a broad community like ours there will always be diverse opinions.
Often the only way forward is compromise.
If you are not compromising, then you are dictating, and there is no place
for that on non-technical topics.

A good compromise is sometimes said to be when opposing parties are
**equally** dissatisfied.
So if you are remain dissatisfied with the current simplified Code of
Conduct,
please balance how dissatisfied your nemesis would be with the result.


Any calls to respect someone's identity are thinly veiled attempts to
> impose objectionable left wing political language onto the community.


That feels to me like an extreme interpretation.



> I don't care how anyone identifies, but I'm under no obligation to play
> along and




> it is not disrespectful to disagree with these political beliefs.


Agreed, except contending the Pharo leadership are left wing progressives
and "progressives a ruining everything" is getting close...

I'm saying this here because the pull request to remove the word identity
> was rejected without explanation, discussion, or comment.


...when I'd guess it was more likely:
* they feel what they now have is a sufficiently good compromise
* the term "identity" didn't carry the same weight with them so the PR
seemed frivolous
* want to back to real work quick as possible
* felt under no obligation to play along with every extreme viewpoint (your
viewpoint is valid for you, but is at the other extreme from progressives)

That said, some comment would have helped

Overall I believe the board did a good job determining a middle path and
want to thank them for their decisive action.


I will finish by saying, going forward I hope we don't have a hair trigger
sensitivity against the odd slip.
That has its own consequence in not being welcoming of diverse people.
We're not robots and its hard to be completely mindful all the time.  Its
more about pattern of behaviour.
Also, if you do slip and are called out on something, take a moment to
consider that others may have personal experience that makes them
sensitivite.
So when someone's toes are stepped on, its okay for them to say "Ow" and
then both parties leave it at that.


Lets get back to work.
cheers -ben


Re: [Pharo-users] Code of Conduct

2019-09-19 Thread Ben Coman
makes me wonder whether he's such a machiavellian sociopath, or a useful
idiot.

On Thu, 19 Sep 2019 at 23:07, Eugen Leitl via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Let's see, I've posted one email to this list describing the dangers
> of abusing CoCs


I guess you refer to this one...
> On Tue, 17 Sep 2019 at 19:39, Eugen Leitl via Pharo-users <
pharo-users@lists.pharo.org> wrote:
> I agree. Technical people are too easy to exploit by malignant
manipulators of people.
> All too often they don't even realize it after the fact.

Thats fairly benign and doubt it had anything to do with being blocked on
github.



> and one post to GitHub describing the motivations of
> people who introduce CoCs, and immediately get banned on GitHub from
>

Note, the board member who blocked your GIthub account and deleted your
post there
also voiced their opinion as being...
For me a "welcome and be nice" should be enough to just continue as
before.
I find the introduction of CoC was a noise we didn't need,
our community was doing well and self-regulated without problem until
now.

So in spite of your implication, I doubt there is anything sinister from
the CoC in play here.
Comments such as  "makes me wonder whether he's such a machiavellian
sociopath, or a useful idiot."
have been consistently condemned years before thought of a CoC.



> I'm getting called a troll and a nobody in public by members of the
> project,


Its not that you are a "nobody", but actually you were "unknown to us" two
days ago.
Maybe you don't know Serge, but we've know him for years and his good work
including governance of our GSoC participation
so please consider why such comments from a newcomer may be dealt with as a
troll.
Community standards do not maintain themselves: They're maintained by
people actively applying them, visibly, in public.

Now personally I'm not going to condemn you on one slip.
I've been told to pull my head in before and they were right - I was
venting after a bad day at work.  But no one held it against me long.
These nontechnical and emotion-charge debates are infrequent and I hope get
a chance to see how things normally run once we are past it.

cheers -ben


Re: [Pharo-users] Code of Conduct

2019-09-19 Thread Ben Coman
>> On 19 Sep 2019, at 15:32, PBKResearch  wrote
>> You may be right, though I don’t think so. But ‘You have been warned’
was aimed at me; I’m sure of that.
>
> On Thu, 19 Sep 2019 at 21:50, Esteban Lorenzano 
wrote:
>
> Offray is right.
> And no, I was not referring to you but in general :)
>

Misinterpretation is a risk of a low-bandwidth communication channel like
email and demonstrates
the risk of a CoC being weighted towards first strike punitive action.

I do think having a CoC is useful to provide a baseline (and also in
today's world not having one can be a troublesome vacuum).
I like GoLang's adaption (https://golang.org/conduct) with the priority of
goals spelled out in the "About" introduction,
and the way it replaces the "Enforcement" section by "Conflict Resolution"

The Linux CoC sidebar has some good points (
https://www.kernel.org/doc/html/latest/process/code-of-conduct-interpretation.html#code-of-conduct-interpretation
)

Maybe our CoC could be as simple as... (https://dart.dev/code-of-conduct)

cheers -ben


Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-12 Thread Ben Coman
On Thu, 12 Sep 2019 at 18:08, Torsten Bergmann  wrote:

> From your snippets it looks like you want to do COM Automation on Windows.
>
> Maybe you should have a look at: https://github.com/tesonep/pharo-com
>

Does that by chance include an implementation of "MS-CFB" Microsoft
Compound File Binary
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/50708a61-81d9-49c8-ab9c-43c98a795242


I was wanting to write a utility to parse headers of MSG files saved from
Outlook,
to process a for a project email archive by bulk renaming each MSG file
with its transmit-date & subject.

cheers -ben


Re: [Pharo-users] Concurrency Best Practices + Tests

2019-09-04 Thread Ben Coman
On Wed, 4 Sep 2019 at 21:32, Noury Bouraqadi  wrote:

> Hi everyone,
>
> Can I get your input on the following questions :
>
> - What are your best practices and recommendations for developing and
> testing concurrent software?
>

I haven't any formalized advice, but just a scattering of thoughts:
- When the debugger opens, it really disturbs the timing context between
threads, so the problem you are looking for disappears.
- Tracking down timing-related problems often required interleaved-threads
logging to a threadsafe queue so a historical sequence could be reviewed.
   Sometimes this included exporting it to Excel then manually chopping
repeating sectioning into side-by-side columns to see how the order of
execution differs between cycles.
- Correctly distinguish between your "shared resource" problems and your
"work signalling" producer/consumer problems, respectively using mutexes
and semaphores.
   I think the latter is easier to reason about.

btw, watch out for Announcements.  You will appear to register them for the
receiving-thread, but actually they are executed in the context of the
sending-thread.


- How to discover need for synchronization/critical sections/ when doing
> TDD?
>

First consider whether synchronisation can be avoided using queues with
"positive hand-off"
 http://www.flounder.com/no_synchronization.htm

This video I bumped into today touches on the same thing...
https://www.youtube.com/watch?v=2yXtZ8x7TXw

Not available right now, but along the line "apartment-threading" I have
been musing about VM support for "Process-specific-immutability"
So an object has an "owner-process" which is the only thread able to mutate
it.
The existing immutability flag would be turned on, and when triggered the
VM would check if the thread-id matched before allowing/blocking an update.

For example, in a producer/consumer arrangement there could be a specific
system thread dedicated to processing class/code-modifications
which could keep that safe without scattering mutexes through that code,
but anyone can read it.



One thing that wasn't obvious to me until I read it, was that
lazy-initialization which is common in TDD is problematic with concurrency.
I'm still mulling over the implications, but it seems reasonable that you
can get at least double-initialization.
So its better to initialize at creation time before it is handed around to
other threads.


- How to write code to avoid dead-locks?
>

Here are some bookmarked articles I found enlightening on the differences
between between mutexes and semaphores.
The last two identify typical problems.
1. https://barrgroup.com/Embedded-Systems/How-To/RTOS-Mutex-Semaphore
2.
http://blog.feabhas.com/2009/09/mutex-vs-semaphores-%e2%80%93-part-1-semaphores/
3.
http://blog.feabhas.com/2009/09/mutex-vs-semaphores-%e2%80%93-part-2-the-mutex/
4.
http://blog.feabhas.com/2009/10/mutex-vs-semaphores-%e2%80%93-part-3-final-part-mutual-exclusion-problems/

5. http://www.smxrtos.com/articles/techppr/mutex.htm



You may find some useful patterns in these books...
- http://greenteapress.com/semaphores/LittleBookOfSemaphores.pdf
-
https://pdfs.semanticscholar.org/a51b/40c904add79f590ed887ccd3a78dbe630938.pdf


cheers -ben


Re: [Pharo-users] [Pharo-dev] [ANN] Pharo Headless - Beta (Actually what is between Alpha and Beta)

2019-09-04 Thread Ben Coman
On Mon, 12 Aug 2019 at 17:59, teso...@gmail.com  wrote:

> Hi,
>the repos is https://github.com/pharo-project/opensmalltalk-vm in
> the headless branch
>

btw, to go directly to that branch...
https://github.com/pharo-project/opensmalltalk-vm/tree/headless

I'm really glad to see smalltalksrc on github for its accessibility.
The concern then is synchronization with the original Monticello repo.
Could a branch "headless-tracking-vmmaker" be created as a pure-mirror
updated by a daily CI job
so Github Compare View  can be used to easily see differences (
https://github.blog/2010-03-01-introducing-github-compare-view/)
This would make it easier for anyone to experiment locally merging in
vmmaker updates without needing access to the particular conversion-tool
being used.
That is, it would fan out better to potential contributors.

It might be useful to similarly have an independent
"headless-tracking-extracted".
How is the extraction currently being done?
Is it a script being run adhoc by particular people or is it run by a CI
job?
Again it would fan out better to potential contributors to not need access
to the extraction script.

cheers -ben


Re: [Pharo-users] VW vs Pharo Performance

2019-08-31 Thread Ben Coman
On Sat, 31 Aug 2019 at 20:37, Sven Van Caekenberghe  wrote:

>
>
> > On 31 Aug 2019, at 13:27, Richard Kenneth Eng 
> wrote:
> >
> >
> https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/vw-pharo.html
> >
> > Is VisualWorks really faster than Pharo? Why???
>
> The Pharo code is single threaded, single core, while the VW code uses
> something called MatriX.VirtualMachines to create workers that run on
> multiple cores.
>
> Presumably that makes a huge difference.
>
> Also, such parallelism is easy for benchmarks that can be split in
> independent tasks, real world code is a completely different story.
>
> Basically, this is not the same code that is being compared.
>

Thanks Sven for this insight.  It wold not have occurred to me.
Looking at the results with new eyes, I notice its apparent in the sum
activity of the four processors - averaging around 103% (including
non-Pharo tasks) for Pharo testing
and much more for VisualWorks.  Normalizing CPU usage I get these
comparative results (smaller is faster VW).
0.86 fasta
0.93 binary-trees
1.02 fannkuch-redux
1.02 reverse-complement
1.08 pidigits
1.09 spectral-norm
1.44 n-body
1.49 k-nucleotide

So VW is 20% faster on some, 40% slower on others and most are pretty close.
Although such a Matrix feature would be advantageous for some domains -
just need someone to invent similar for Pharo.

cheers -ben


Re: [Pharo-users] SequenceableCollection>>#allButFirst: inconsistence across subclasses

2019-08-30 Thread Ben Coman
On Fri, 30 Aug 2019 at 15:34, Julien  wrote:

> Hello,
>
> I opened that issue: https://github.com/pharo-project/pharo/issues/4442
>
> And I think to fix it we need to actually discuss about what we want.
>
> #allButFirst: behaves differently depending on the actual type of
> sequenceable collection when argument is greater than collection size.
>
> For instance:
>
> #(1 2) allButFirst: 3.  "PrimitiveFailed signaled"
> (LinkedList with: 1 with: 2) allButFirst: 3. "PrimitiveFailed signaled"
> (OrderedCollection with: 1 with: 2) allButFirst: 3.  "an
> OrderedCollection() »
>
> The question is then, who is right?
>

Its worthwhile to at least survey other Smalltalks.
For Visualworks...
  #(1 2) allButFirst: 3.  "==> #()"
  (OrderedCollection with: 1 with: 2) allButFirst: 3.   "==>
OrderedCollection ()"
  (LinkedList with: Link new with: Link new ) allButFirst: 3.  "raises
an error Subscription out of bounds error"
and also...
  (LinkedList with: Link new with: Link new ) allButFirst: 2.  "raises
an error Subscription out of bounds error"

I feel that proceeding-without-iterating is nicer than
showing-an-application-error.
It provides the opportunity to not-check the number elements or wrapping
error handling around it - i.e. less code if its not important.
If its important not to exceed the number of elements, then that check can
be explicitly coded.

cheers -ben


Re: [Pharo-users] Connection Timed Out

2019-08-27 Thread Ben Coman
On Wed, 28 Aug 2019 at 03:12, Richard Kenneth Eng 
wrote:

> I have a Teapot application running under Linux and nginx. From time to
> time, I get the following error: *ConnectionTimedOut: Data receive timed
> out.*
>
> Otherwise, the Teapot application works fine, even with this error message.
>
> Can anyone tell me what or where it's timing out, and how can I change the
> timeout value?
>

I'm not familiar with Teapot, but a screen snapshot might help.
Hopefully someone else has some ideas.

cheers -ben


Re: [Pharo-users] Why do I not see the transactions when opening a customer

2019-08-19 Thread Ben Coman
On Mon, 19 Aug 2019 at 22:19, Roelof Wobben  wrote:

> Thanks all for the answers.
>
> As I see it , it impossible to store the password in the bankaccount
> object and make safe code to use it,
> So some one give me a stupid assignment.
>

That would seem to depend on the purpose of the assignment.
  a. To produce production ready code that managed someone's real life
money,
  b. Provide a vehicle to reason about typical implementation issues, in
which case did you learn anything from the exercise?

cheers -ben


Re: [Pharo-users] Why do I not see the transactions when opening a customer

2019-08-16 Thread Ben Coman
>
> and I inspect the customer I do not see the transaction added to the 
> bankaccounts collection.
>
>  Rather than focus on what you don't see.  What do you see?  And does
anything look odd about it?

cheers -ben


Re: [Pharo-users] finds replacements for deprecated objects

2019-08-15 Thread Ben Coman
On Thu, 15 Aug 2019 at 09:37, Steve Quezadas  wrote:

> Forgive the naive question here. But if an object gets deprecated, how do
> you find the closest replacement object in Pharo? Is there a way to do it
> within the VM or do you just have to check the documentation?
>

Hi Steve,

First I just like to check the language you're using.  The usual discussion
I see about deprecation relates to "classes" that define the objects rather
than the "objects" themselves.
Do you mean "if a class gets deprecated?"

Also the "VM" is compiled with a C-compiler (gcc or clang) and not code
that most Pharo users will ever look at.
Different to other languages (e.g. Java), the Pharo VM contains only
low-level routines for memory-manipulation, bytecode-execution and a few
primitives for interfacing different operating systems libraries.
90% of Pharo library code is stored "within the Image" that runs on top of
the VM.

So if you want to find the replacement for SomeDeprecatedClass that your
application is using,
a bit of investigation in the old Image should be able to discover places
its being used in the default Pharo libraries,
the look at those same places in the latest Image and see which class they
are now using.
Two useful tools for that in SystemBrowser are:
  1. Right-click a class and choose "Analyse > Class refs"
  2. Right-click a method and choose "Senders"

Pharo also has some facilities for creation of deprecation-rules to
automatically identify deprecation-use by your code and suggest the
replacement.
Whether those have been written for the particular thing you are interested
in is another question.
Do you have a particular class or method in mind? And which versions of
Pharo are you considering?

cheers -ben


Re: [Pharo-users] SHA512 HMAC support in Pharo

2019-08-14 Thread Ben Coman
On Wed, 14 Aug 2019 at 20:25, Jonathan van Alteren <
jvalte...@objectguild.com> wrote:

> Hi all,
>
> For a client project we need support for SHA512 and SHA384 hashing and
> digital signatures with HMAC). Can anyone tell me if there is work (being)
> done on SHA512? We're on Pharo 7.0.3.
>
> At first, it didn't look too hard to refactor the SHA256 class in the
> System-Hashing package. That is... until I saw the use of
> ThirtyTwoBitRegister and the SHA256NonPrimitive and SHA256WithPrimitive
> classes in the Cryptography-SHA256 package.
>
> It seems to me that SHA512 will need a SixtyFourBitRegister class.
>
> Also, when I try to generate the constants on the fly with 64 bit values,
> the last 3 hexadecimal digits are zero (0). To me, this suggests that
> Pharo/Smalltalk might have issues working with 64 bit (float?) values.
>
> "(Integer primesUpTo: 312) collect: [:x | (((x raisedTo: 1/3)
> fractionPart) * (2.0 raisedTo: 64)) truncated hex]"
>
>
You can use LibSodium via FFI to do SHA512-HMAC...
https://github.com/Traadh/bittrex/blob/master/src/Bittrex.package/BittrexLibsodium.class/class/crypto_auth_hmacsha512__out.in.inlen.k..st


Example...
https://github.com/Traadh/bittrex/blob/master/src/Bittrex.package/BittrexLibsodiumTest.class/instance/test_RFC4231_case1.st

https://github.com/Traadh/bittrex

And you may find some other options here...
http://forum.world.st/HMAC-SHA512-td5060307.html

cheers -ben


Re: [Pharo-users] A Canticle for Smalltalk

2019-08-06 Thread Ben Coman
I didn't get the sense that "used" means its no longer being used.
Yesterday I used a keyboard to write an email, and I'm doing the same thing
today.
cheers -ben

On Tue, 6 Aug 2019 at 16:06, Tim Mackinnon  wrote:

> It’s very entertaining but it seems a bit sad - it’s a shame it refers to
> JP-Morgan as “used Smalltalk “ as actually they are “still using Smalltalk”
> (so it’s not in the past)
>
> Tim
>
> Sent from my iPhone
>
> On 5 Aug 2019, at 16:19, Richard Kenneth Eng 
> wrote:
>
> A big fan of my work created this rogue video:
> https://drive.google.com/file/d/1opveHaukFK8WbQ8wg8b14wuKJsjoOZfO/view
>
> I appreciate the homage, but I can't take credit for it.
>
> It's really quite beautiful, though. I'm using it as part of my evangelism.
>
>


Re: [Pharo-users] "whenSelectedItemChanged:" in Spec

2019-07-16 Thread Ben Coman
I'm not familiar with Spec but I'll have a go...

On Wed, 17 Jul 2019 at 07:03, Steve Quezadas  wrote:

> On Tue, Jul 16, 2019 at 7:43 AM Ben Coman  wrote:
>>
>> On Tue, 16 Jul 2019 at 12:49, Steve Quezadas  wrote:
>> >
>> > I am running through the "Spec UI Framework" tutorial, and in it has a 
>> > widget class inherited from "ComposablePresenter" (ComposablePresenter 
>> > subclass: #WidgetClassList). But for some reason the 
>> > "whenSelectedItemChanged:" method call does not execute when I select any 
>> > item on the GUI list. Is there anything I'm missing?
>> >
>> > I posted this earlier on the list, and someone suggested I try  
>> > "whenActivatedDo:" or "whenSelectionChangedDo:", but it doesn't do 
>> > anything as well. The code looks like this:
>> >
>> > whenSelectedItemChanged: aBlock
>> > Transcript show: 'should get here; cr.
>> >
>> > I am using Pharo 7.
>>
>> Can you FileOut the entire sample class and attached it?
>>
>> cheers -ben
>>
>
> Ok, I filed out and it exported the file 'WidgetClassList.st' . This is the 
> contents of the file:
>
> 'From Pharo7.0.3 of 12 April 2019 [Build information: 
> Pharo-7.0.3+build.158.sha.0903ade8a6c96633f07e0a7f1baa9a5d48cfdf55 (64 Bit)] 
> on 16 July 2019 at 3:58:28.785036 pm'!
> ComposablePresenter subclass: #WidgetClassList
> instanceVariableNames: 'list'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'QuotesProg'!
>
> !WidgetClassList methodsFor: 'initialization' stamp: 'SteveQuezadas 7/10/2019 
> 14:07'!
> initializeWidgets
> list := self newList.
> list items: (AbstractWidgetPresenter allSubclasses
> sorted: [:a :b | a name < b name ]).
> self focusOrder add: list.! !
>
>
> !WidgetClassList methodsFor: 'events-shortcuts' stamp: 'SteveQuezadas 
> 7/15/2019 21:40'!
> whenSelectedItemChanged: aBlock
> Transcript show: 'got here'; cr.
> ! !

Looking at ListPresenter>>whenSelectedItemChanged: aBlock
it is registering aBlock on selectionHolder using #whenChangedDo:
Reviewing selectionHolder "Code search...>References to it" I see that
selectionHolder is initialized as an instance of SelectionHolderClass.

So it seems you are expecting whenSelectedItemChanged: to be called
every time the-selection-is-changed
when actually it is only called once (by your application) to register
the block-to-be-called when the-selection-is-changed.
You don't seem to have done any such registration.

cheers -ben



Re: [Pharo-users] "whenSelectedItemChanged:" in Spec

2019-07-16 Thread Ben Coman
On Tue, 16 Jul 2019 at 12:49, Steve Quezadas  wrote:
>
> I am running through the "Spec UI Framework" tutorial, and in it has a widget 
> class inherited from "ComposablePresenter" (ComposablePresenter subclass: 
> #WidgetClassList). But for some reason the "whenSelectedItemChanged:" method 
> call does not execute when I select any item on the GUI list. Is there 
> anything I'm missing?
>
> I posted this earlier on the list, and someone suggested I try  
> "whenActivatedDo:" or "whenSelectionChangedDo:", but it doesn't do anything 
> as well. The code looks like this:
>
> whenSelectedItemChanged: aBlock
> Transcript show: 'should get here; cr.
>
> I am using Pharo 7.

Can you FileOut the entire sample class and attached it?

cheers -ben



Re: [Pharo-users] [ANN] MessageFlowBrowser for Pharo 7 and 8

2019-07-11 Thread Ben Coman
On Fri, 12 Jul 2019 at 00:15, Torsten Bergmann  wrote:
>
> Hi,
>
> I updated my MessageFlowBrowser today to work on Pharo 7 and 8, see attached 
> screenshot
> or youtube video on https://www.youtube.com/watch?v=DRd_bzGocQg
>
> It now also works in Calypso and you just need to right click on a method in 
> the method
> pane or code pane and select "Message Flow" close to Senders, Implementors 
> and other.
>
> You can load the tool using
>
>Metacello new
> repository: 'github://astares/Pharo-MessageFlowBrowser/src';
> baseline: 'MessageFlowBrowser';
> load
>
> I also now moved repo from
>
>   http://www.smalltalkhub.com/#!/~TorstenBergmann/MessageFlowBrowser
>
> to the new location
>
>   https://github.com/astares/Pharo-MessageFlowBrowser
>
> on GitHub for future development.

Thanks Torsten.  It looks really nice.

cheers -ben



Re: [Pharo-users] [GSoC blog post] Binary Search Trees

2019-07-10 Thread Ben Coman
On Thu, 11 Jul 2019 at 00:53, Alexandre Bergel via Pharo-users
 wrote:
>
> Hello Smiljana,
>
> Thanks for having written down this document. I am not expert in algorithm, 
> so I would consider myself a simple user. I have developed complex software 
> for some times and I have never seen the need of having a binary search tree. 
> I guess this is probably partly because of my lack of expertise in binary 
> search tree and partly because experts in binary search trees assume that 
> people know what it is about and in what it is useful.
>
> My question is, when should a programmer ever need to use binary search tree? 
> Can you add some examples on what these trees are good for, and how an 
> average programmer should look into it. I think this will be a valuable and 
> easy way to expand your blog.

My "computer science" is a bit rusty but Binary Search Trees and their
generalisation to B-Trees is Databases 101.
Almost guaranteed you are "using" them with any database you use,
you're just not directly exposed to them.

If you skim "Redesigning String Data Structures to Exploit Cache"
(https://people.eng.unimelb.edu.au/jzobel/fulltext/acmjea10.pdf)
looking at the performance graphs, for "unordered searching" the best
bet for many applications is probably our hash-based Dictionary if
that covers all your needs.
BSTs are more memory efficient than Dictionarys, but less cache-friendly.

A few applications where BSTs can be useful:
* doing range searches efficiently [1]
* traversing elements in order, which is more difficult with hash tables [1] [2]
* good for "order" statistics [2] like:
- inexact search - finding closest lower and greater elements.
   - determining maximum & minimum elements
   - determining successor & predecessor elements
   - range queries - easy to do with BSTs and not a natural operation
with Hash Tables.
* Self-Balancing BSTs guarantee operations work in O(Logn) time.
Hashing has Θ(1) is average time but some particular operations are
costly, especially when table resizing happen [2]
   but also they are slower so if the data is sufficiently random
simple BSTs may do.

[1] 
https://stackoverflow.com/questions/371136/binary-trees-vs-linked-lists-vs-hash-tables
[2] https://www.geeksforgeeks.org/advantages-of-bst-over-hash-table/

This side-related article...
   "Number crunching: Why you should never, ever, EVER use linked-list
in your code again"
   
(https://kjellkod.wordpress.com/2012/02/25/why-you-should-never-ever-ever-use-linked-list-in-your-code-again)
indicates that for many In-Memory operations you are better using
sorted-Arrays (e.g. SequenceableCollection>>#findBinary:)
than cache-invalidating pointer-base structures like Lists & Trees -
thus the strong association of BSTs & BTrees with slower access
disk-based databases.
Also notice that additional BST features closely match common database
operations.

cheers -ben



Re: [Pharo-users] [GSoC blog post] Binary Search Trees

2019-07-10 Thread Ben Coman
I agree #bfs: is not explicit, but  #breadthFirstSearch:  is a well
know term, why not just that? Or even #breathFirstSearchFor:

In comparison  #findBreadthFirst:  and  #findDeepFirst:  feel a bit
awkward to me.
(I think its the repetition rhythm of "f" words)

cheers -ben

On Mon, 8 Jul 2019 at 12:55, ducasse  wrote:
>
> bfs: aValue
>
> =>
>
> findBreadthFirst: aValue
>
>
> dfs: info node: aNode
>
> =>
>
> findDeepFirst: aValue startingFrom: aNode



[Pharo-users] Python bridges

2019-06-27 Thread Ben Coman
Subject was> Re: [Pharo-users] Anything on Pharo that would be like
Opentalk on VW?)
On Wed, 26 Jun 2019 at 02:45, Alexandre Bergel via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> We have worked on bridging Pharo with Python. It works remarkably well.
> Here is the website: https://objectprofile.github.io/PythonBridge/
>

Hi Alexandre,

How does usage of your Python bridge compare to Kilon's... ?
https://github.com/kilon/Atlas

cheers -ben


Re: [Pharo-users] Distribution of test method name length

2019-06-23 Thread Ben Coman
On Mon, 24 Jun 2019 at 07:10, Jerry Kott  wrote:

> Interesting…
>
> I am curious about the purpose of this analysis (other than the
> ‘interesting-ness’ of it). Sure, some names read like sentences, but that
> beats the ’strcpy()’, doesn’t it? I love that in Smalltalk / Pharo, I don’t
> have to remember cryptic function names and can make the code optimally
> verbose (if there is such a thing) to express intent. If that means a
> method is rather long, so be it.
>

Its an offshoot of working on the Pharo Track of the Exercism project (
https://exercism.io/tracks/pharo-smalltalk)
Here we generate test-method names from their canonical data "description" (
https://github.com/exercism/problem-specifications/blob/master/exercises/word-count/canonical-data.json
)
The original intent of that field was to generate identifiers, but
sometimes the language ends up a bit flowery and we ended up with
method-name 150 character long. I am in the process of slimming these down.
Someone queried me "what was a recommended identifier length" and I had no
clue -- so I thought the Pharo code base would be a good source of data.
Having produced the graph, I thought others might find it mildly
interesting. Thats all.

It may be worthwhile reviewing some of the outliers, but that was not its
intent.
It was shared just-for-interest.  The purpose is certainly not to squeeze
Pharo messages down to 6 characters ;)
cheers -ben

P.S. I found the graph more useful showing percentages rather than absolute
count.
95% less than 50 characters
99% less than 60 characters
[image: image.png]


Re: [Pharo-users] Distribution of test method name length

2019-06-21 Thread Ben Coman
On Fri, 21 Jun 2019 at 12:43, K K Subbu  wrote:

> Nice graph, Ben! The larger test names (selector size > 100) look more
> like sentences than names ;-).
>
> On 21/06/19 6:50 AM, Ben Coman wrote:
> > classes := Object allSubclasses select: [ :cc | cc isKindOf:
> > TestCase class ].
> > methods := c flatCollect: [ :c | c allMethods  ].
>

Ahh, yes. Blame evolution of the Playground code between when I used it and
when I copied it here.


> Did you mean "classes" flatCollect: here?
>
> > tests := methods select: [ :m | m selector beginsWith: 'test' ].
> > lengths := tests collect: [ :m | m selector size ].
>
> select:thenCollect: can also be used here.
>

yes. but I was checking each stage as it grew incrementally.


>
> > lengths asBag keysAndValuesDo: [ :len :count | Transcript crShow:
> > len; show: ','; show: count  ]
>
> I find the in: selector very handy for quick commands without having to
> use undefined temps. e.g.
> 
> (Object allSubclasses select: [ :cc | cc isKindOf: TestCase class ]) in:
> [ :classes |
> (classes flatCollect: [ :c | c allMethods  ]) in: [
> :methods |
> (methods select: [ :m | m selector beginsWith:
> 'test' ] thenCollect:
> [ :m | m selector size ]) in: [:lengths |
> lengths asBag keysAndValuesDo: [ :len
> :count | Transcript crShow:
> len; show: ','; show: count  
> 
>

cool

cheers -ben


[Pharo-users] Distribution of test method name length

2019-06-20 Thread Ben Coman
Working on the Exercism project to shorten generated test method names,
for comparison I reviewed the length of test method names in Pharo 7.
So just for curiousity value, here is that graph (done in Excel)...

[image: image.png]

Data generated by...
   classes := Object allSubclasses select: [ :cc | cc isKindOf: TestCase
class ].
   methods := c flatCollect: [ :c | c allMethods  ].
   tests := methods select: [ :m | m selector beginsWith: 'test' ].
   lengths := tests collect: [ :m | m selector size ].
   lengths asBag keysAndValuesDo: [ :len :count | Transcript crShow: len;
show: ','; show: count  ]

cheers -ben


Re: [Pharo-users] Can I code a web browser in a Pharo GUI window (Morphic or other)?

2019-06-14 Thread Ben Coman
On Fri, 14 Jun 2019 at 15:46, Arie van Wingerden  wrote:

> Hi,
>
> for a project I need this kind of program:
>
>1. client side only
>2. must be able to programmatically show a web browser in a window
>(Morphic??); only local content will be shown
>3. must also be able to show other windows, containing simple games
>
> Now, I guess that 1 and 3 are possible straight away, but I am unsure
> about option 2.
>
> I found out that there are a few ways to do it:
>
>- using C#, which has:
>   - standard web browser control out-of-the-box
>   - third-party open source chromium web browser component
>- using Java, which (afaict) is a coding effort, but possible anyway
>
>
> That said, since I'd very much like to start using Pharo for more tasks
> (just starting) I wonder if Pharo has something to offer in this case.
>

The easier path is probably to connect to Chrome externally...

http://forum.world.st/Chrome-DevTools-Protocol-and-Pharo-td4947589.html

http://forum.world.st/Pharo-Chrome-was-Soup-bug-fix-td5020666.html

http://forum.world.st/Web-scrapping-with-Pharo-Chrome-td5066882.html


A heavier path is integrating Chromium via FFI.  This is probably the most
feasible path to a fully functioning browser.
Many web browsers are a wrappers around Chromium, letting it do all the
heavy lifting.
https://en.wikipedia.org/wiki/Chromium_(web_browser)#Browsers_based_on_Chromium

Pharo could do the same thing.  Even Microsoft is doing this...
https://www.theverge.com/2018/12/6/18128648/microsoft-edge-chrome-chromium-browser-changes


I've previously linked a small sub-part of Chromium with Pharo.
https://blog.openinworld.com/2017/11/pharo-pdf-part-1/


> In C# I can do this literally in a few hours, given the fact that ready
made components exist.

Depends on how you can balance your particular goals and time constraints,
wrt the effort of getting a connection versus the effort of processing the
data you get out of it.
https://imgs.xkcd.com/comics/is_it_worth_the_time.png

cheers -ben


Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread Ben Coman
On Mon, 10 Jun 2019 at 20:21, sergio ruiz  wrote:

> I am currently putting together a Seaside website for my radio show. I am
> trying to figure out how to model the "has and belongs to many"
> relationships.
>
> Each episode can have many tracks, each of these tracks can belong to
> several episodes.
> I want to be able to present a listing of which episodes each track
> appears in, and a listing of tracks for each episode.
>
> The approach I have seen on this is to create an intermediary object and
> store a set of ids on this, but this seems a little clunky, and it seems
> like there would be a clean way to do this.
>

This is how you'd model many-to-many relationships in relational databases.
https://dzone.com/articles/how-to-handle-a-many-to-many-relationship-in-datab

If that is where your data is stored, you may be forced to this.

If you are keeping your design purely in the object-oriented domain,
you might try Mutual Friends...
https://pdfs.semanticscholar.org/348f/e4ecff3c23f3709bb88e7e60379905a3b930.pdf
although I've not enough experience with it to know if its the best way.

Or you might try relation slots.   Check out SlotExampleMovieAndPersonTest.
Some background reading...
https://rmod.inria.fr/archives/papers/Verw11a-OOSPLA11-FlexibleObjectLayouts.pdf

which I'd guess is still useful even if I read somewhere it was a bit out
of date.

cheers -ben


Re: [Pharo-users] More Morphic snags

2019-06-01 Thread Ben Coman
On Sun, 2 Jun 2019 at 00:18, Markus Stumptner  wrote:
>
> I have been trying to replicate the behaviour of an existing (non-Pharo,
> non-Smalltalk) application with Morphic. This provides grouping images
> in a workspace, and then switching between laying them out separately or
> "stacked" by double clicking on the group (or an image in it). When the
> group is stacked, it can be moved around as a single drag and drop
> operation. When the group is separated, dragging an image out of it
> removes it from the group.
>
> On the surface this looked like a perfect fit to the submorph tree.
> Unfortunately, as both the Morphic chapter in Pharo by Example and the
> intro document by Maloney make clear, if you enable double clicking (by
> answering true to #handlesMouseDown:), you are interfering with what
> Maloney calls the "default behaviour" of being able to drag a Morph around.
>
> How do I reinstate that behaviour if a group is clicked on and the
> double click does not happen? Neither document helps in explaining where
> that "default" can be found in the code.

Have you put a `self haltOnce` in #handlesMouseDown: ?

I am far from an expert here, but the following may help:

Three alternate ways of handling mouse events
https://wiki.squeak.org/squeak/2477
http://squeak.preeminent.org/tut2007/html/078.html

Check the Dragging section here...
https://wiki.squeak.org/squeak/6194

Search for doubleclick here...
https://course.ccs.neu.edu/com3230/squeak/SqueakMorphClassGuide.pdf

a few more #handlesXXX methods...
https://course.ccs.neu.edu/com3230/squeak/SqueakMouseControls.html

cheers -ben



Re: [Pharo-users] Find after in strings?

2019-06-01 Thread Ben Coman
On Sat, 1 Jun 2019 at 18:01, Tim Mackinnon  wrote:
>
> Maybe this is a dumb question - and often I’m surprised when asking these, 
> but why is there no way to “find after” a string.
>
> I find it rather boring to try and parse a string, after a known marker - 
> thus:
> (loc := aString findString: ‘marker’) > 0 ifTrue: [ loc := loc + ‘marker’ 
> size ].
>
> Is there a better way? This whole pattern seems very old and clunky and not 
> smalltalk like?
>
> Couldn’t we have: findAfter: aString ifAbsent: aBlock ?
>
> Or is there a whole better pattern for string searching that I’m missing ?

Can your input be split into tokens using Stirng>>findTokens:
and `ReadStream on: that`.  Then you marker will be consumed by a single #next.

cheers -ben



  1   2   3   4   5   6   7   8   9   10   >