Re: [Pharo-users] OSProcess and CommandShell available on GitHub for Pharo users

2019-10-14 Thread David T. Lewis
Hi Sean,

On Mon, Oct 14, 2019 at 08:16:17AM -0500, Sean P. DeNigris wrote:
> David T. Lewis wrote
> > Alistair Grant and I, with the support of Feenk, have made GitHub
> > repositories
> > for OSProcess and CommandShell
> 
> Thank you to all involved!
> 
> 
> David T. Lewis wrote
> > my own development work remains on squeaksource so I prefer
> > contributions there anyway
> 
> It might be good to add that disclaimer and the location of the canonical
> repo to the GH README. Also, does anyone know whether, after loading from
> GH, one can make enhancements and then simply save to an MCZ repo?
> 

To be honest, I'm not really sure how this should work. My sense is that
it is better for Pharo users to use the Pharo tools, and save changes in
git. In the case of OSProcess and CommandShell, I can harvest any changes
manually, and for me it is probably easiest to just do it that way.

Dave




Re: [Pharo-users] OSProcess and CommandShell available on GitHub for Pharo users

2019-10-14 Thread David T. Lewis
On Mon, Oct 14, 2019 at 11:01:13AM -0500, Sean P. DeNigris wrote:
> David T. Lewis wrote
> > they can now be loading in Pharo...
> 
> In Pharo 7.0.4, the following chugged for about an hour cycling back and
> forth between OSP and Command Shell without completing:
>   baseline: 'OSProcess' with: [
>   spec
>   repository: 
> 'github://dtlewis290/OSProcess-Tonel';
>   loads: #(#'Core with Output') ]
> 

Hi Sean,

Alistair put together the two load scripts, and they worked when I
last checked them. These are on the README.md descriptions as:

  Metacello new
repository: 'github://dtlewis290/OSProcess-Tonel/src';
baseline: 'OSProcess';
load.

  Metacello new
repository: 'github://dtlewis290/CommandShell-Tonel/src';
baseline: 'CommandShell';
load.

I am not familiar with the baseline approach, so maybe someone else
can give a pointer?

> 
> I wonder if it's related to the old circular dependency problem we had which
> IIRC was resolved with "Pipeability"...
> 

Possibly so. I think this may have been something to do with an earlier
OSProcess load specification that included part of the CommandShell package.

Dave




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

2019-10-14 Thread Vince Refiti
Hi

Q. What are your best practices and recommendations for developing and testing 
concurrent software?
A. I avoid writing concurrent code if I can. If not, I would launch multiple 
Smalltalk instances instead.

Even then I would use SQLite3 (or even Postgres, Redis etc) to hold the shared 
mutable state. SQlite3 locks the db for writes, which is exactly the behaviour 
I need to controlled access.

SQlite3 and Redis can be in memory and can be very fast. I use UDBCSQLite3, but 
looking at Sven’s SimpleRedisClient 
(https://github.com/svenvc/SimpleRedisClient) out of sheer curiosity. Then, I 
can just write sequential code without worrying too much about race/starvation 
conditions. If not then it class-side mutexes and semaphores, but only as a 
last resort.

Q. How to discover need for synchronization/critical sections/ when doing TDD?
A. I do the opposite. I make everything critical, and instead look for places 
where I can do Process yield. Brutal, but effective.

Q. How to write code to avoid dead-locks?
A. Use SQLite3 to hold shared mutable resources. It locks the entire db for 
writes, solving the deadlock for me. I will give SimpleRedisClient a run 
sometime.

Vince


From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Christopher Fuhrman
Sent: Tuesday, 15 October 2019 11:39 AM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Concurrency Best Practices + Tests


EXTERNAL: Do not click links or open attachments if you do not recognize the 
sender.

Hello,

My answer is late, but hopefully still useful. I'm not a concurrent programmer 
in Pharo, but have done it in lots of other environments.

Use the immutable object pattern to avoid having to deal with race conditions 
(although it won't solve all the problems).

POSA2 was focused on OO concurrency, and had been applied in C++ and Java: 
http://www.dre.vanderbilt.edu/~schmidt/POSA/POSA2/

You can find Coursera MOOCs with modern application of the POSA2 patterns, but 
it's mostly focused on Android.

Advice is often to use an environment's thread-safe data structures and thread 
pool librairies, if they exist. It's a bigger challenge otherwise to create 
these yourself.

I saw a cool exercise of understanding race conditions for the Singleton 
pattern in the book Head First Design Patterns. It basically looks at breaking 
up source code of a concurrent method into chunks, and figuring out if you can 
get a race condition with two threads executing them separately. The metaphor 
is magnets on a refrigerator door. See the attached image. The Spin model 
checker (using a DSL, called PROMELA, for code modeling) works in a similar 
way, by creating all possible executions and checking for violations of 
invariants. But that's a formal method that is hard to apply to arbitrary 
(complex) code.

Cheers,

Cris

On Wed, Sep 4, 2019, 09:32 Noury Bouraqadi 
mailto:bouraq...@gmail.com>> 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?

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

- How to write code to avoid dead-locks?

Noury


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

2019-10-14 Thread Tim Mackinnon
Noury - I happened to notice in a recent article about the Rust scheduler (it 
caught my eye) it had a section on concurrent testing and a tool they write 
called Loom to test all possible permutations and catch errors.

This might be an avenue of investigation for your work ?

An idea any way.
https://tokio.rs/blog/2019-10-scheduler/

Sent from my iPhone

> On 4 Sep 2019, at 14:31, 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? 
> 
> - How to discover need for synchronization/critical sections/ when doing TDD?
> 
> - How to write code to avoid dead-locks?
> 
> Noury


Re: [Pharo-users] Aconcagua Canonical Repo(s)

2019-10-14 Thread Sean P. DeNigris
gcotelli wrote
> I don't know if call it canonical. But certainly it is the version the
> community is maintaining.

That works for me. I guess I'll re-fork from there. Hopefully, some of the
other repo owners will speak up as to whether they have useful changes to
pick up.



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



Re: [Pharo-users] Aconcagua Canonical Repo(s)

2019-10-14 Thread Gabriel Cotelli
I don't know if call it canonical. But certainly it is the version the
community is maintaining. It's a fork of the mtaborda repo and converted to
tonel format. I don't know how it was migrated from Sthub, but it was
before any tool for migrating the history existed.

I think it must contain all the functionality available in Sthub.

Regarding Units package we never made a thorough comparison so I cannot
tell the differences. But this package is intended to be usable for things
beyond standard units. We're using it for financial measurements besides
the physical ones.

Hope it helps in clarifying a bit the situation.

On Mon, Oct 14, 2019, 14:13 Sean P. DeNigris  wrote:

> It seems that this is now canonical: https://github.com/ba-st/aconcagua
>
> I assume its predecessor [1] was a port from this StHub repo [2]. There are
> two other repos on StHub [3] - the first of which has changes after the
> last
> in [1] and the other has changes which may have been/need to be merged. Can
> anyone shed further light?
>
> 1. https://github.com/mtaborda/aconcagua
> 2. http://smalltalkhub.com/#!/~maxi/Aconcagua
> 3. http://smalltalkhub.com/#!/~HernanWilkinson/Aconcagua
> http://smalltalkhub.com/#!/~BenoitAstruc/Aconcagua
>
> p.s. IMHO when porting from MCZ to GH, a good practice is to state in the
> GH
> README that it's a port, including the URL of the source and a way to
> clarify the last commit (maybe the date could often be sufficient)
>
>
>
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] NVARCHAR and Glorp

2019-10-14 Thread eftomi
Thanks, Sven. I found the "ultimate" place where strings are being prepared
for INSERT INTO clause - this happens in String>>#glorpPrintSQLOn:. Not so
easy to parametrize at a first glance. Maybe with
WideString>>#glorpPrintSQLOn: but I'm not sure how other platforms would be
happy. I decided to work on other issues right now so that I can publish a
relatively decent package ASAP.  

An interesting observation about UTF-8 and SQL Server 2019 is here:
https://sqlquantumleap.com/2018/09/28/native-utf-8-support-in-sql-server-2019-savior-false-prophet-or-both/.
  

Best wishes,
Tomaz



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



Re: [Pharo-users] How to install stripe library on Pharo 7 64bit ?

2019-10-14 Thread Paul DeBruicker
Are you sure you're using a released version of Pharo 7?

Running the load script in a stable released version of Pharo 7 loads with
no errors for me.  I'm not in a position to be able to support un-released
or non-stable or outdated versions of Pharo (e.g. pharo 8).

To get a stable version of Pharo 7 run this from a command line on mac or
linux:

curl https://get.pharo.org/64/ | bash

The missing baseUrl is my fault.  I override it in my own code to make nginx
do the ssl termination for the https connections.  I've uploaded a corrected
version.  

IT should be

StripeSystem>>#baseUrl
^'https://api.stripe.com/v1'


Also the API reference docs are here: https://stripe.com/docs/api


For any Stripe object I haven't created a class for the code should create
an instance of  a  StripeObject class

Hope this helps


Paul



Pharo Smalltalk Users mailing list wrote
> OK, did some more testing and here are the results.
> 
> 
> Pharo 7 
> - Image hangs when loading Zinc HTTP Components.  I tried loading Zinc
> HTTP
> Components separately through Metacello with the same results so I don't
> think the problem is with your code.  
> 
> 
> Pharo 8 
> - Stripe Loads fine,
> - 22/29 Stripe tests fail (On debug it says that StripeSystem class does
> not
> understand #baseUrl message)
> - Seaside not launched & can't right click Seaside Control Panel to start
> server (Fixed by reloading Seaside3 from Metacello.)
> - Stripe example apps (stripe & stripe-form) crash (Seaside Walkback 
> Error:
> Instances of UndefinedObject are not indexable)
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





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



Re: [Pharo-users] Aconcagua Canonical Repo(s)

2019-10-14 Thread Cyril Ferlicot
What is the relation with Units maintained by Zweindenker?

On Mon 14 Oct 2019 at 19:13, Sean P. DeNigris  wrote:

> It seems that this is now canonical: https://github.com/ba-st/aconcagua
>
> I assume its predecessor [1] was a port from this StHub repo [2]. There are
> two other repos on StHub [3] - the first of which has changes after the
> last
> in [1] and the other has changes which may have been/need to be merged. Can
> anyone shed further light?
>
> 1. https://github.com/mtaborda/aconcagua
> 2. http://smalltalkhub.com/#!/~maxi/Aconcagua
> 3. http://smalltalkhub.com/#!/~HernanWilkinson/Aconcagua
> http://smalltalkhub.com/#!/~BenoitAstruc/Aconcagua
>
> p.s. IMHO when porting from MCZ to GH, a good practice is to state in the
> GH
> README that it's a port, including the URL of the source and a way to
> clarify the last commit (maybe the date could often be sufficient)
>
>
>
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
> --
Cyril Ferlicot
https://ferlicot.fr


Re: [Pharo-users] Aconcagua Canonical Repo(s)

2019-10-14 Thread Sean P. DeNigris
To slightly further complicate matters, canonical does not quite have all
commits from its predecessor.



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



[Pharo-users] Aconcagua Canonical Repo(s)

2019-10-14 Thread Sean P. DeNigris
It seems that this is now canonical: https://github.com/ba-st/aconcagua

I assume its predecessor [1] was a port from this StHub repo [2]. There are
two other repos on StHub [3] - the first of which has changes after the last
in [1] and the other has changes which may have been/need to be merged. Can
anyone shed further light?

1. https://github.com/mtaborda/aconcagua
2. http://smalltalkhub.com/#!/~maxi/Aconcagua
3. http://smalltalkhub.com/#!/~HernanWilkinson/Aconcagua
http://smalltalkhub.com/#!/~BenoitAstruc/Aconcagua

p.s. IMHO when porting from MCZ to GH, a good practice is to state in the GH
README that it's a port, including the URL of the source and a way to
clarify the last commit (maybe the date could often be sufficient)



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



Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Richard Sargent
Samuel,

One thing I don't recall seeing in this thread is a discussion of the
semantics of the methods names.

I find it helpful to consider #asWhatever to be a conversion method, used
to convert one object to another essentially compatible class. e.g.
#asFloat sent to an integer would be expected to yield a floating point
number with the same value, but #asInteger sent to a floating point number
would lose precision but might still be sensible for some purposes. [more
on this below]

But, #printString and its ilk (#displayString, #storeString, others) are
not intended to be conversion methods. They are to provide an external
representation of a format suitable for the intended audience. Typically,
(and I say that guardedly), #printString's intended audience is the
programmers working on the system and #displayString is intended for the
system's users.

In simple cases, #printString is reversible and can be parsed to recover
the value of the original object. In general, it doesn't include enough
information to do so. The same is true of #displayString. If we consider a
slightly more complex example than a number, consider a User Profile. Its
#printString might be 'UserProfile(John Doe)'. Its #displayString might be
'John Doe'. Neither of those provide all the details of the object,
although they could be parsed and so used to look up an existing object.


--
Continuing from [more on this below] above...

I find #asString is one of the most problematic methods that I have ever
seen. It is deceptive, an "attractive nuisance", as one colleague liked to
say. Clarity comes from being explicit in one's programming. Say what you
mean and mean what you say. If you are trying to convert from one object
form to another, use a conversion method whose name is precise. If you are
trying to provide information for a programmer about an object,
#printString is the choice.(e.g. in a stack dump).

As a general rule, #asWhatever methods that are generally applicable to the
set of possible values. e.g. number conversion methods are a good example,
even though there are exceptions (loss of precision, NaN, and Inf are some).


I have seen a lot of #asWhatever methods added to the String hierarchy, but
almost all of them are dubious, in my opinion of course. Most strings are
not numbers, for example. String>>#asNumber is one of the worst things I
have ever seen, both from a consistency perspective and an implementation
perspective. 'abc123def456' asNumber has more variant results than I can
enumerate.



On Mon, Oct 14, 2019 at 9:28 AM Samuel Teixeira Santos 
wrote:

> Very clear to me now.
>
> Thank you and to others too by your previous answers
>


Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Samuel Teixeira Santos
Very clear to me now.

Thank you and to others too by your previous answers


Re: [Pharo-users] OSProcess and CommandShell available on GitHub for Pharo users

2019-10-14 Thread Sean P. DeNigris
David T. Lewis wrote
> they can now be loading in Pharo...

In Pharo 7.0.4, the following chugged for about an hour cycling back and
forth between OSP and Command Shell without completing:
baseline: 'OSProcess' with: [
spec
repository: 
'github://dtlewis290/OSProcess-Tonel';
loads: #(#'Core with Output') ]


I wonder if it's related to the old circular dependency problem we had which
IIRC was resolved with "Pipeability"...




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



Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Christopher Fuhrman
On Mon, Oct 14, 2019, 08:49 Samuel Teixeira Santos 
wrote:

> when you say when: "what this object converted *to a string means in my
> domain"* - what really means, specially about when you say *'domain'?*
>
> Could you give some example for this?
>
> Thanks
>

A good example might be PLU codes [1] on produce in North America. They're
4 or 5 digits, and employees of a grocery store usually know them by heart
(they're in the "employee of a grocery store" domain). Customers, however,
are interested in knowing what the vegetable or fruit is, not the code.

So, depending on the application domain, #asString might print the code
(for grocery store employees) or the name of the item (for customers).

Delving deeper, we find these codes even contain info about whether produce
is GMO, organic, etc. which could also be used by #asString depending on
requirements.

[1]: http://innvista.com/health/foods/plu-codes-alphabetical-order/

>


Re: [Pharo-users] OSProcess and CommandShell available on GitHub for Pharo users

2019-10-14 Thread Sean P. DeNigris
Sean P. DeNigris wrote
> ...to the GH README

Also:
- you can disable the GH issue tracker if you don't want reports there
- you don't need the code subfolder (src) in the URL since you have project
metadata



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



Re: [Pharo-users] OSProcess and CommandShell available on GitHub for Pharo users

2019-10-14 Thread Sean P. DeNigris
David T. Lewis wrote
> Alistair Grant and I, with the support of Feenk, have made GitHub
> repositories
> for OSProcess and CommandShell

Thank you to all involved!


David T. Lewis wrote
> my own development work remains on squeaksource so I prefer
> contributions there anyway

It might be good to add that disclaimer and the location of the canonical
repo to the GH README. Also, does anyone know whether, after loading from
GH, one can make enhancements and then simply save to an MCZ repo?



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



Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Samuel Teixeira Santos
I like the way you put because it's a nice way to remember and to teach too.

I'm just bit confusing, and I think this because Object Oriented it's not
one of my strong skills, when you say when: "what this object converted *to
a string means in my domain"* - what really means, specially about when you
say *'domain'?*

Could you give some example for this?

Thanks


Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Sean P. DeNigris
arcanosam wrote
> printString... v asString... There is something different about both?

I will add that conceptually:
- #printString = what a developer would want to see, e.g. in an inspector
- #displayString = a string suitable for UI (i.e. in production)
- #asString - while typically implemented to be the same as #printString,
the meaning for me is a bit different, which is "what this object converted
to a string means in my domain"

That said, IMHO as a community we are not great about properly
distinguishing these, especially #displayString.



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



Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Samuel Teixeira Santos
Thank you too Richard.

Very interesting and elucidative.

Regards to all.


Re: [Pharo-users] Smallest docker image for pharo >=7 ?

2019-10-14 Thread Norbert Hartl
Hi,

> Am 14.10.2019 um 09:07 schrieb Hernán Morales Durand 
> :
> 
> Hi guys,
> 
> Because I am lazy and want to avoid searching through all DockerHub 
> repository pages... Do you know a Dockerfile to generate the smallest 
> possible docker image for Pharo?

Please have a look at 

https://github.com/pharo-contributions/Docker-Alpine 


This was the first step in unify work on this. It’s based on alpine. It may 
need to be ironed out a bit as alpine has a different libc implementation. 

Further steps should include building a pharo minimal image to bring it down in 
size. 10 MB per docker image is theoretically possible.
> 
> I am also interested in which stage you use to install packages into the 
> image, and why? Do you copy the contained image into docker already built? or 
> do you prefer install packages on building? (as done by pip -r 
> requirements.txt)
> Anyone using xpra binding from subuser [1]?
> Anyone could make it work Pharo on Alpine since it uses different libc? 
> 

Building the docker image you can do either way. I have one public project 
where I provide the software as docker image. Doing this is easier when you 
build the pharo image inside the docker container. Because you can then use 
dockerhub [1] to build it. You just add your project there and it builds it and 
releases it.

In our inhouse products I use building the image outside of the docker 
container. The process is building the product image then load the test code 
and test it and when everything is fine use the image and package as a docker 
image. 

I don’t know subuser but using xpra will bloat the docker image because AFAIK 
it works over X11 which means you need those libraries in the docker container 
and in the pharo vm. What I’m working on is to be able to connect a running 
docker container directly from my laptop and use TelePharo [2] on it. 

Norbert
> Anyway sharing opinions would be also appreciated.
> 
> [1] http://subuser.org/news/0.3.html 
> 
> Cheers.
> 
> Hernán
> 
[1] https://hub.docker.com
 [2] https://github.com/pharo-ide/TelePharo 


Re: [Pharo-users] NVARCHAR and Glorp

2019-10-14 Thread Sven Van Caekenberghe
Hi Tomaz,

> On 11 Oct 2019, at 18:15, eftomi  wrote:
> 
> Dear all,
> 
> I'm working on ADO database driver for Glorp by using Pablo's PharoCOM. The
> structure of the driver is similar to Sven's P3DatabaseDriver and P3Client
> (thanks, Sven for very clear architecture :-) ) and the work is progressing
> quite nicely. I can connect to SQL Server, PostgreSQL and create tables,
> insert and read data directly with ADO Connection and Recordset objects, and
> with Glorp, too. In next days I'll do some more testing, including Oracle,
> and publish the prototype on GitHub. The goal is not PostgreSQL, of course,
> but to finally reach SQL Server, Oracle and possibly MS Access, at least
> from Windows systems.

Great to hear this, please keep us all posted of your progress.

> One thing is bothering me though - SQL Server supports Unicode with NCHAR
> and NVARCHAR types, and when using INSERT INTO with literal strings these
> should be prefixed with N, like in
> 
> N'This is a Unicode string'
> 
> Does somebody remember whether Glorp can prefix the strings in that way when
> constructing SQL statements? I checked all the constants and string
> conversions under DatabasePlatform but haven't found anything related to
> this kind of prefixing.

I don't know for sure.

Could you not add the N at the moment the string quotes are written ?

What I do know is this: the interface between P3DatabaseDriver and P3Client is 
essentially an SQL string to execute. That SQL string was built by the Glorp 
machinery, so it must know about certain specifics (like string quoting and 
escaping, etc). Also, in Glorp's Login #database specification, a platform is 
set, like PostgreSQLPlatform. So I am assuming some platform specific 
delegation is happening (or could happen).

I don't have a Glorp image ready, but there must be a way to find this out.

That being said, I do foresee a problem for you. You are building a more 
general driver that can access several different platforms, you will need to 
make that explicit, else you won't be able to do something specific for SQL 
Server.

HTH,

Sven

> Thanks and best wishes,
> Tomaz
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 




Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Richard O'Keefe
days keysAndValuesDo: [:key :value |
Transcript print: key; nextPutAll: ' has '; print: value;
nextPutAll: ' days'; cr].
Transcript endEntry.
works too and in some Smalltalks is easily the most efficient approach, as it
does not construct any strings you have no other use for.

In Pharo, however, there is a reason to prefer
Transcript nextPutAll: (key asString, ' has ', value asString, '
days', String cr).
The reason is that in Pharo 7, Transcript is an instance of
*ThreadSafe*Transcript,
and each public operation like #nextPut: or #print: locks the stream.
In fact we have
show: anObject
  self critical: [self print: anObject; endEntry].
print: anObject
  self nextPutAll: anObject asString.
nextPutAll: aString
  self critical: [stream nextPutAll: aString].
  ^aString
cr
  self nextPut: Character cr.
nextPut: aCharacter
  self critical: [stream nextPut: aCharacter].
  ^aCharacter

So the code I exhibited second (using #nextPutAll:) locks the Transcript *once*
ensuring that nothing else can be written between 'days' and cr, whereas both
versions you exhibited have a timing window between #show: and #cr where
another Smalltalk process could write something.

But you are asking about the difference between #asString and #printString.
So look up the definitions!  In a Playground, type
asString
and then Ctrl-m (for iMplementors).  We see almost at once that
Object>>
asString
  ^self printString
so that for numbers there is NO difference between the two (except a
little bit of
overhead for #asString).  But we also see
String>>
asString
  ^self
Symbol>>
asString
  "complicated code logically equivalent to"
  ^String withAll: self
Just for grins, the following interaction was with GNU Smalltalk.
st> #January asString
'January'
st> #January printString
'#January'
st> 31 asString
'31'
st> 31 printString
'31'
Pharo does exactly the same.

On Sun, 13 Oct 2019 at 23:51, Samuel Teixeira Santos
 wrote:
>
> Hi folks.
> I'm starting in Pharo studies by FUN Mooc.
> In Week 03, on An Overview of Essential Collections there is the example 
> below:
>
> | days |
> days := Dictionary new.
>
> days
> at: #January put: 31;
> at: #February put: 28;
> at: #March put: 31.
>
> days keysAndValuesDo:
> [ :k :v | Transcript show: k asString, ' has ', v printString, ' days'
> ; cr ]
>
> The code in blue I change for
>
> days keysAndValuesDo:
> [ :k :v | Transcript show: k asString, ' has ', v asString, ' days'
> ; cr ]
>
> And works too on Playground.
>
> There is something different about both? There is someone better than other?
>
> Thanks in advance,
>
>
> Samuel T. Santos



Re: [Pharo-users] Smallest docker image for pharo >=7 ?

2019-10-14 Thread Pierce Ng
On Mon, Oct 14, 2019 at 04:07:49AM -0300, Hernán Morales Durand wrote:
> Because I am lazy and want to avoid searching through all DockerHub
> repository pages... Do you know a Dockerfile to generate the smallest
> possible docker image for Pharo?
> Anyone could make it work Pharo on Alpine since it uses different libc?

Hi Hernán,

Please see following links:

- https://github.com/pharo-contributions/Docker-Alpine
- https://hub.docker.com/r/pierceng/pharovm-alpine
- https://hub.docker.com/r/pierceng/pharo7-alpine
- https://www.samadhiweb.com/blog/2019.07.20.alpine.pharo.minimal.html
- https://www.samadhiweb.com/blog/2019.08.11.minimizing.pharo.html

The Alpine-based VM can be made smaller by removing unused/irrelevant
modules.

Image-wise, currently I am using Pharo 7 minimal, which is just under
30MB, and that forms the lower bound of the Pharo image size.

However there is also the Pharo Candle effort that aims to make really
small images, which I hope to try out soon.

> I am also interested in which stage you use to install packages into the
> image, and why? Do you copy the contained image into docker already built?

For Pharo, I start with the regular or minimal image, then load my
packages. 

For Docker, I first build a container image for the VM only. Using that
I build a new container image from the Pharo image and other required
files.

> [1] http://subuser.org/news/0.3.html

Interesting. I use Firejail for big programs such as Chromium.

Pierce



[Pharo-users] Smallest docker image for pharo >=7 ?

2019-10-14 Thread Hernán Morales Durand
Hi guys,

Because I am lazy and want to avoid searching through all DockerHub
repository pages... Do you know a Dockerfile to generate the smallest
possible docker image for Pharo?

I am also interested in which stage you use to install packages into the
image, and why? Do you copy the contained image into docker already built?
or do you prefer install packages on building? (as done by pip -r
requirements.txt)
Anyone using xpra binding from subuser [1]?
Anyone could make it work Pharo on Alpine since it uses different libc?

Anyway sharing opinions would be also appreciated.

[1] http://subuser.org/news/0.3.html

Cheers.

Hernán