Re: [Pharo-users] String representation of Class

2014-11-12 Thread p...@highoctane.be
Le 12 nov. 2014 08:32, Hilaire hila...@drgeo.eu a écrit :

 Hi,

 Dr. Geo script are becoming first class citizen -- before it was just a
 method hooked to an existing DrGeoUserScripts class ; then, it was easy
 to export the script method as a string to include it in the XML sketch
 file.

 Now to save a Dr. Geo sketch using a script, the whole script class
 needs to be embedded in the sketch XML representation.

 Is it possible to export a whole class as a string, then import it back
 from a string representation to a class?

Isn't that a fileOut/fileIn thing?

Phil

 Thanks

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





Re: [Pharo-users] String representation of Class

2014-11-12 Thread Hilaire
Le 12/11/2014 09:08, p...@highoctane.be a écrit :
 Is it possible to export a whole class as a string, then import it back
 from a string representation to a class?
 
 Isn't that a fileOut/fileIn thing?
 

Yes, however I don't want it on a .st file (to avoid possible trouble on
the end user DrGeo installation) but on a string within Smalltalk.

Hilaire



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




Re: [Pharo-users] String representation of Class

2014-11-12 Thread Sven Van Caekenberghe
String streamContents: [ :out | Association fileOutOn: out ]

I am not sure it covers everything, but for some script methods this will do.

 On 12 Nov 2014, at 09:21, Hilaire hila...@drgeo.eu wrote:
 
 Le 12/11/2014 09:08, p...@highoctane.be a écrit :
 Is it possible to export a whole class as a string, then import it back
 from a string representation to a class?
 
 Isn't that a fileOut/fileIn thing?
 
 
 Yes, however I don't want it on a .st file (to avoid possible trouble on
 the end user DrGeo installation) but on a string within Smalltalk.
 
 Hilaire
 
 
 
 -- 
 Dr. Geo - http://drgeo.eu
 iStoa - http://istoa.drgeo.eu
 
 




Re: [Pharo-users] String representation of Class

2014-11-12 Thread p...@highoctane.be
On Wed, Nov 12, 2014 at 9:21 AM, Hilaire hila...@drgeo.eu wrote:

 Le 12/11/2014 09:08, p...@highoctane.be a écrit :
  Is it possible to export a whole class as a string, then import it back
  from a string representation to a class?
 
  Isn't that a fileOut/fileIn thing?
 

 Yes, however I don't want it on a .st file (to avoid possible trouble on
 the end user DrGeo installation) but on a string within Smalltalk.


Why not use FileSystem memory for those things? This would keep the files
inside the image.

Phil


 Hilaire



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






Re: [Pharo-users] String representation of Class

2014-11-12 Thread kilon alios
and if you want a json like implementation there is filetree. I think json
is a much better format than XML but I am nowhere near to an experienced
web developer.

On Wed, Nov 12, 2014 at 11:15 AM, p...@highoctane.be p...@highoctane.be
wrote:

 On Wed, Nov 12, 2014 at 9:21 AM, Hilaire hila...@drgeo.eu wrote:

 Le 12/11/2014 09:08, p...@highoctane.be a écrit :
  Is it possible to export a whole class as a string, then import it back
  from a string representation to a class?
 
  Isn't that a fileOut/fileIn thing?
 

 Yes, however I don't want it on a .st file (to avoid possible trouble on
 the end user DrGeo installation) but on a string within Smalltalk.


 Why not use FileSystem memory for those things? This would keep the files
 inside the image.

 Phil


 Hilaire



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







Re: [Pharo-users] String representation of Class

2014-11-12 Thread Hilaire
Le 12/11/2014 10:15, p...@highoctane.be a écrit :
 Why not use FileSystem memory for those things? This would keep the
 files inside the image.
 

because I didn't know about it :)
But fileout(UTF8 conversion, again...) seems to be broken, see my other
post.

Hilaire

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




Re: [Pharo-users] String representation of Class

2014-11-12 Thread Hilaire
Le 12/11/2014 10:22, Hilaire a écrit :
 Later I test directly from the browser  with a dummy class with one
 method with non ascii character. Fileout sometimes work (for example, I
 add a space in the method body, save, remove the space, save again,...),
 some time not.
 
 tested on Pharo 3.0


Reported here
https://pharo.fogbugz.com/f/cases/14462/ZNInvalidUTF8-when-fileout-method-body-with-non-ascii-characters

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




Re: [Pharo-users] question on syntax negate numbers

2014-11-12 Thread José Comesaña

 Note that −− is not allowed for parsing reasons (i just checked the
 latest version)
 now honestly, dont you think that a) is a serious contender? that is all i
 wanted to say.
 werner

Well, I don't understand why the book says that because in fact you can
define a -- binary method:

SmallInteger-- aNumber
^ aNumber - self.

works perfectly (although it is nonsense, I know)


Re: [Pharo-users] question on syntax negate numbers

2014-11-12 Thread Werner Kassens

On 11/12/2014 11:29 AM, José Comesaña wrote:
 Well, I don't understand why the book says that because in fact you can
 define a -- binary method:
yes, that is what i said, it's just an irritating bug in the book.
werner



Re: [Pharo-users] Memoization Question

2014-11-12 Thread p...@highoctane.be
Looking at LRUCache tests, I've found this:

testFibonacci
After an idea by Jan Vrany.
Recursively enter the cache and its access protection

| fibCache |
fibCache := self newCache.
fibCache
maximumWeight: 32;
beThreadSafe;
factory: [ :key |
key  2
ifTrue: [ key ]
ifFalse: [ (fibCache at: key - 1) + (fibCache at: key - 2)
] ].
self assert: (fibCache at: 40) equals: 102334155

the factory thing basically solves the problem.

Is there more docs about the caching somewhere? I read the code, comments,
and unit tests but still, will value an explanation.

Keying by object works, but with symbols, it isn't behaving. I think I miss
something here.

Is the cache size set at a given limit?

I see keyIndex is Dictionary new. What if I do have a lot of keys? Is the
dictionary being copied over and over to get to the right size?

Phil


Phil

Phil






On Tue, Nov 11, 2014 at 7:52 PM, p...@highoctane.be p...@highoctane.be
wrote:

 I should ask more questions :-).

 Now, this still doesn't answer the question on how to use this to memoize
 object methods.

 I think that what is closest to what I am looking for is this:

 http://wiki.tcl.tk/10779
 http://wiki.tcl.tk/10981


 I am use we can do something like that in Pharo, with some memoize method
 in Object playing around with thisContext.

 SomeClasssomeMethodWith: aSomething and: aSomethingElse



 Like self haltIf: aSymbol will break if aSymbol is in the call stack.

 Any guru having a way to do that?

 Phil




 On Tue, Nov 11, 2014 at 7:21 PM, Torsten Bergmann asta...@gmx.de wrote:

 Werner Kassens wrote:
 Hi,
 now this a nice idea, especially the memoizedUsing:cache idea. i would
 really appreciate it, if that would be MIT licenced.
 werner

 It already is, thanks to the permission of author John Cromartie who
 answered
 us today. Both methods are in a slice already:

 Details in https://pharo.fogbugz.com/f/cases/14458

 Thx
 T.






Re: [Pharo-users] Memoization Question

2014-11-12 Thread Sven Van Caekenberghe
Hi Phil,

 On 12 Nov 2014, at 12:54, p...@highoctane.be wrote:
 
 Looking at LRUCache tests, I've found this:
 
 testFibonacci
 After an idea by Jan Vrany.
 Recursively enter the cache and its access protection
 
 | fibCache |
 fibCache := self newCache.
 fibCache 
 maximumWeight: 32;
 beThreadSafe;
 factory: [ :key |
 key  2
 ifTrue: [ key ]
 ifFalse: [ (fibCache at: key - 1) + (fibCache at: key - 2) ] 
 ].
 self assert: (fibCache at: 40) equals: 102334155
 
 the factory thing basically solves the problem.

Good ;-)

 Is there more docs about the caching somewhere? I read the code, comments, 
 and unit tests but still, will value an explanation.

I tried to comment everything, the class comments (check AbstractCache too) are 
quite extensive. What else do you want to know ?

 Keying by object works, but with symbols, it isn't behaving. I think I miss 
 something here.

I don't understand, AFAIK you can use any object as both key and value, most 
tests use Symbols. Can you elaborate ?

 Is the cache size set at a given limit?

I think you are looking for CacheWeight (read the class comment).

Basically, a cache has a weight, if it is exceeded, it starts removing items. 
How you compute the weight is up to you, the default is that each entry has a 
weight of 1, so you end up counting the entries. But you could use something 
like file or byte size of the value.

 I see keyIndex is Dictionary new. What if I do have a lot of keys? Is the 
 dictionary being copied over and over to get to the right size?

Yes, of course it is a dictionary that grows when needed, what else do you want 
? You want to predefine it at a certain size ?

Sven

PS: BTW, the implementation is slightly more complicated than what you would 
expect, it uses a double linked list and an index dictionary, to achieve proper 
O(1) performance in its common operations (accessing, adding  evicting 
entries).

 Phil
 
 
 Phil
 
 Phil
 
 
 
 
 
 
 On Tue, Nov 11, 2014 at 7:52 PM, p...@highoctane.be p...@highoctane.be 
 wrote:
 I should ask more questions :-).
 
 Now, this still doesn't answer the question on how to use this to memoize 
 object methods.
 
 I think that what is closest to what I am looking for is this:
 
 http://wiki.tcl.tk/10779
 http://wiki.tcl.tk/10981
 
 
 I am use we can do something like that in Pharo, with some memoize method in 
 Object playing around with thisContext.
 
 SomeClasssomeMethodWith: aSomething and: aSomethingElse
 
 
 
 Like self haltIf: aSymbol will break if aSymbol is in the call stack.
 
 Any guru having a way to do that?
 
 Phil
 
  
 
 
 On Tue, Nov 11, 2014 at 7:21 PM, Torsten Bergmann asta...@gmx.de wrote:
 Werner Kassens wrote:
 Hi,
 now this a nice idea, especially the memoizedUsing:cache idea. i would
 really appreciate it, if that would be MIT licenced.
 werner
 
 It already is, thanks to the permission of author John Cromartie who answered
 us today. Both methods are in a slice already:
 
 Details in https://pharo.fogbugz.com/f/cases/14458
 
 Thx
 T.
 
 
 
 




Re: [Pharo-users] Anyone having a Rserve client?

2014-11-12 Thread Blondeau Vincent
Hi,

Last two weeks, I began to write a binding with nativeboost to call the R 
functions.

It is a proof of concept for now :
http://www.smalltalkhub.com/#!/~VincentBlondeau/RProjectConnector
if you want to participate, just ask me!

You have to download the right libraries to do it work. It is the .dll in the 
same folder of the R.exe executable. I think that it is the same for Linux and 
MacOS.
And copy them it in the same folder that the pharo executable.

I think that nativeboost binding will be faster than RServer and more easy to 
use that why I started this.

Cheers,
Vincent



 -Message d'origine-
 De : Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] De la part de
 stepharo
 Envoyé : lundi 10 novembre 2014 11:14
 À : Any question about pharo is welcome
 Objet : Re: [Pharo-users] Anyone having a Rserve client?

 I know that vincent did a binding to connect to R.
 On 10/11/14 10:28, p...@highoctane.be wrote:
  I am doing some R work and wanted to integrate with Pharo.
 
  Is there any support for Rserve around?
 
  http://www.rforge.net/Rserve/dev.html
 
  At this point I am doing OProcess style stuff with littler but Rserve
  would be cooler.
 
  There are binding for Ruby and Python.
 
  e.g.
  http://pythonhosted.org//pyRserve/
  https://github.com/ralhei/pyRserve
 
  Stats are becoming bigger and bigger and the leader of the pack is R.
 
  DHB is fine and I do use some of it but let's face it, it is nowhere
  near the power of R...
 
 
  Phil




Ce message et les pièces jointes sont confidentiels et réservés à l'usage 
exclusif de ses destinataires. Il peut également être protégé par le secret 
professionnel. Si vous recevez ce message par erreur, merci d'en avertir 
immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant 
être assurée sur Internet, la responsabilité de Worldline ne pourra être 
recherchée quant au contenu de ce message. Bien que les meilleurs efforts 
soient faits pour maintenir cette transmission exempte de tout virus, 
l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne 
saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Worldline liability cannot be triggered for the 
message content. Although the sender endeavours to maintain a computer 
virus-free network, the sender does not warrant that this transmission is 
virus-free and will not be liable for any damages resulting from any virus 
transmitted.


Re: [Pharo-users] Anyone having a Rserve client?

2014-11-12 Thread p...@highoctane.be
Nice to know.

I'll give it a shot on my Ubuntu 14.04 in the evening. As I may have more
than one image connecting to the R, I will still need something with RServe
at one point I guess.


Phil

On Wed, Nov 12, 2014 at 1:16 PM, Blondeau Vincent 
vincent.blond...@worldline.com wrote:

 Hi,

 Last two weeks, I began to write a binding with nativeboost to call the R
 functions.

 It is a proof of concept for now :
 http://www.smalltalkhub.com/#!/~VincentBlondeau/RProjectConnector
 if you want to participate, just ask me!

 You have to download the right libraries to do it work. It is the .dll in
 the same folder of the R.exe executable. I think that it is the same for
 Linux and MacOS.
 And copy them it in the same folder that the pharo executable.

 I think that nativeboost binding will be faster than RServer and more easy
 to use that why I started this.

 Cheers,
 Vincent



  -Message d'origine-
  De : Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] De la
 part de
  stepharo
  Envoyé : lundi 10 novembre 2014 11:14
  À : Any question about pharo is welcome
  Objet : Re: [Pharo-users] Anyone having a Rserve client?
 
  I know that vincent did a binding to connect to R.
  On 10/11/14 10:28, p...@highoctane.be wrote:
   I am doing some R work and wanted to integrate with Pharo.
  
   Is there any support for Rserve around?
  
   http://www.rforge.net/Rserve/dev.html
  
   At this point I am doing OProcess style stuff with littler but Rserve
   would be cooler.
  
   There are binding for Ruby and Python.
  
   e.g.
   http://pythonhosted.org//pyRserve/
   https://github.com/ralhei/pyRserve
  
   Stats are becoming bigger and bigger and the leader of the pack is R.
  
   DHB is fine and I do use some of it but let's face it, it is nowhere
   near the power of R...
  
  
   Phil
 



 Ce message et les pièces jointes sont confidentiels et réservés à l'usage
 exclusif de ses destinataires. Il peut également être protégé par le secret
 professionnel. Si vous recevez ce message par erreur, merci d'en avertir
 immédiatement l'expéditeur et de le détruire. L'intégrité du message ne
 pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra
 être recherchée quant au contenu de ce message. Bien que les meilleurs
 efforts soient faits pour maintenir cette transmission exempte de tout
 virus, l'expéditeur ne donne aucune garantie à cet égard et sa
 responsabilité ne saurait être recherchée pour tout dommage résultant d'un
 virus transmis.

 This e-mail and the documents attached are confidential and intended
 solely for the addressee; it may also be privileged. If you receive this
 e-mail in error, please notify the sender immediately and destroy it. As
 its integrity cannot be secured on the Internet, the Worldline liability
 cannot be triggered for the message content. Although the sender endeavours
 to maintain a computer virus-free network, the sender does not warrant that
 this transmission is virus-free and will not be liable for any damages
 resulting from any virus transmitted.



Re: [Pharo-users] Anyone having a Rserve client?

2014-11-12 Thread Thierry Goubier
2014-11-12 13:41 GMT+01:00 p...@highoctane.be p...@highoctane.be:

 Nice to know.

 I'll give it a shot on my Ubuntu 14.04 in the evening. As I may have more
 than one image connecting to the R, I will still need something with RServe
 at one point I guess.


And the remote capabilities can be interesting if one has to run R on a
server somewhere (or on multiple servers).

But it's cool to have all those options.

Thierry



 Phil

 On Wed, Nov 12, 2014 at 1:16 PM, Blondeau Vincent 
 vincent.blond...@worldline.com wrote:

 Hi,

 Last two weeks, I began to write a binding with nativeboost to call the R
 functions.

 It is a proof of concept for now :
 http://www.smalltalkhub.com/#!/~VincentBlondeau/RProjectConnector
 if you want to participate, just ask me!

 You have to download the right libraries to do it work. It is the .dll in
 the same folder of the R.exe executable. I think that it is the same for
 Linux and MacOS.
 And copy them it in the same folder that the pharo executable.

 I think that nativeboost binding will be faster than RServer and more
 easy to use that why I started this.

 Cheers,
 Vincent



  -Message d'origine-
  De : Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] De la
 part de
  stepharo
  Envoyé : lundi 10 novembre 2014 11:14
  À : Any question about pharo is welcome
  Objet : Re: [Pharo-users] Anyone having a Rserve client?
 
  I know that vincent did a binding to connect to R.
  On 10/11/14 10:28, p...@highoctane.be wrote:
   I am doing some R work and wanted to integrate with Pharo.
  
   Is there any support for Rserve around?
  
   http://www.rforge.net/Rserve/dev.html
  
   At this point I am doing OProcess style stuff with littler but Rserve
   would be cooler.
  
   There are binding for Ruby and Python.
  
   e.g.
   http://pythonhosted.org//pyRserve/
   https://github.com/ralhei/pyRserve
  
   Stats are becoming bigger and bigger and the leader of the pack is R.
  
   DHB is fine and I do use some of it but let's face it, it is nowhere
   near the power of R...
  
  
   Phil
 



 Ce message et les pièces jointes sont confidentiels et réservés à l'usage
 exclusif de ses destinataires. Il peut également être protégé par le secret
 professionnel. Si vous recevez ce message par erreur, merci d'en avertir
 immédiatement l'expéditeur et de le détruire. L'intégrité du message ne
 pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra
 être recherchée quant au contenu de ce message. Bien que les meilleurs
 efforts soient faits pour maintenir cette transmission exempte de tout
 virus, l'expéditeur ne donne aucune garantie à cet égard et sa
 responsabilité ne saurait être recherchée pour tout dommage résultant d'un
 virus transmis.

 This e-mail and the documents attached are confidential and intended
 solely for the addressee; it may also be privileged. If you receive this
 e-mail in error, please notify the sender immediately and destroy it. As
 its integrity cannot be secured on the Internet, the Worldline liability
 cannot be triggered for the message content. Although the sender endeavours
 to maintain a computer virus-free network, the sender does not warrant that
 this transmission is virus-free and will not be liable for any damages
 resulting from any virus transmitted.





[Pharo-users] Glamour stream presentations

2014-11-12 Thread Evan Donahue
Hello,

I was just wondering if it was possible to use list/table presentations (or
an analogous presentation) in Glamour to display streams that load on
demand as you page through them  (rather than loading all entries into
memory before displaying the first page). If not, does anyone have any tips
on the best way to go about creating one?

Thanks,
Evan


Re: [Pharo-users] Ploting all history of the commits in a Monticello repository

2014-11-12 Thread Pierre CHANSON
Hi Offray !

from Pharo you can access the monticello repository with the following
code: myRepository := MCSmalltalkhubRepository location: anUrl.

then you can get: myRepository allVersionNames.

Finally you can get the commits informations (message, author, date etc.)
using: myRepository versionInfoFromVersionNamed: aVersionName.

For exemple supposing you want to list all the commit date and time logs
from your repository, result contained in a dictionary with the version
names as keys you can execute:

-=-=-=-=-=-=-=-=-=-=-=-=

result:= Dictionary new.
repo := (MCSmalltalkhubRepository location: '
http://smalltalkhub.com/mc/Offray/Ubakye/main').

(repo allVersionNames sortedAs: [ :e | e extractNumber ]) asArray do: [ :v
| vers := repo versionInfoFromVersionNamed:v. result add: ( v - (Array
with: (vers date) with: (vers time)))].

-=-=-=-=-=-=-=-=-=-=-=-=

Cheers,

Pierre








2014-11-10 14:53 GMT-03:00 Offray Vladimir Luna Cárdenas off...@riseup.net
:

 Hi,

 I don't know if the terminology is the proper one. Anyway I'm trying to
 plot a time line of the history of a project which is stored on [1] and
 [2] (after rebranding) and also of the commits to documentation on [3]
 using Pharo/Roassal.

 [1] http://smalltalkhub.com/#!/~Offray/Ubakye/
 [2] http://smalltalkhub.com/#!/~Offray/Grafoscopio/
 [3] http://mutabit.com/deltas/repos.fossil/grafoscopio/timeline?n=200

 Given I don't know any API of the sites, I thought it would be easier by
 scraping the data on the web pages and the using it into Roassal, but after
 testing some solutions on python, I came back to pharo to see if I can made
 everything on it, including the data collection.

 For [1] and [2] I think that is possible to send a message to Monticello
 to show all commits of a specific package (like it actually does from the
 UI) and export them with the information about date of commit for all
 commits. For [3] I'm thinking in using some combination of Zinc with
 Soup[4] despite of the lack of tutorials.

 [4] http://www.squeaksource.com/@Y-xGMSBYZmiWQToh/GJDsBRqL

 So here are my questions:

 - There is any way to say to Monticello to export all commits dates and
 times for a specific package?
 - There is any advised scraping strategy for getting the same information
 from the web page at [3]?

 The plot I would like to do is similar to the one of the ebola example at
 [5], but using high as number of commits and x axis as dates.

 [5] https://dl.dropboxusercontent.com/u/31543901/
 AgileVisualization/QuickStart/0101-QuickStart.html

 Any help is welcomed, as always.

 Cheers,

 Offray




Re: [Pharo-users] Is there a way to store workspace 'gists' in Pharo?

2014-11-12 Thread stepharo
In fact I try to avoid utilities class by defining as few as possible 
but the mandatory/handy class side methods on the most relevant class.
My point is that if you script is useful then it can be an interesting 
method with some parameters and its instantiation  can be just a class 
side method

calling a method with the right parameters.



I usually create a method and a class.
because script do not compose well.

ᐧ



Thanks, that sounds interesting. And, just for clarity, do you mean 
that you create a single class e.g. MyGists and then create methods 
for each of your useful snippets? Or, is there a benefit in creating a 
class per gist?


Cheers




[Pharo-users] Opentalk or remoting libraries

2014-11-12 Thread Annick Fron
Hi,

Are there some libraries in pharo to do remote calls like in Opentalk or Corba ?

Annick


Re: [Pharo-users] Opentalk or remoting libraries

2014-11-12 Thread S Krish
How about lightweight XMLRPC ? Just for messages, not features around it.

On Wed, Nov 12, 2014 at 10:47 PM, Annick Fron l...@afceurope.com wrote:

 Hi,

 Are there some libraries in pharo to do remote calls like in Opentalk or
 Corba ?

 Annick