Re: [Pharo-users] [Deploy] Deploying application - New Best Practices?
Hi sergio This is great to hear that you will deploy your app. I really want that we really improve the deployment of Pharo App. Could you log and report to us what worked with you and what did not work. I would like that the community build and share some scripts. Sven in the past shared with us his build scripts and it was a great start. There are in the deep into pharo book. Can you check if they help you. Stef On Sat, May 27, 2017 at 8:18 AM, Pierce Ng wrote: > On Fri, May 26, 2017 at 03:47:42PM -0400, sergio ruiz wrote: > > I have a feeling things have progressed at this point. Can anyone point > me in > > the right direction to learn current best practices? > > Some things I'm now doing differently, based on reading up on current best > practices: > > Initial deployment - creating uid/gid, creating directories, deploying VM, > copying image and various artefacts, templating daemontools run file, etc > is > done using Ansible. Check out Ansible, Chef and Puppet. > > For my blog, content management is under version control using Fossil and > is > pushed from my workstation where I write/check the post to my blog server: > > http://www.samadhiweb.com/blog/2016.08.12.fossil.html > > This approach also works for pushing application changes. I use Fossil, > but for > Git you can find any number of tutorials on the web on how to push-hook > and all > that. Better Git support built into Pharo should make this easier. > > > In the past, I would have added some kind of remote desktop server into > my > > image, and run it headless on the server. When I needed to update the > source > > code with monticello, I would use a VNC client to log in, update my > source > > code, save the image, etc > > The latest thinking is to blow away whatever is currently running, deploy > new > artefacts (image, etc) freshly built from CI, and restart the application. > Fashionable memes are "cattle, not pets" and "no snowflakes". > > I still build my images with RFBServer running so that I can VNC into them. > Over time I do that less and less. > > Pierce > > >
Re: [Pharo-users] Renamed instance attribute by code
oki On Fri, May 26, 2017 at 6:38 PM, Hilaire wrote: > No, I mean #definedClasses also returns the traits of the package, then > requesting instVar to those traits seems to brake things, but I did not > investigated further as I bypassed the problem by discarding Traits. > > > Le 26/05/2017 à 13:08, Stephane Ducasse a écrit : > > Hi Hilaire > > > > do you mean that you had a trait definition in package and that it got > > some influence of the rename instance variable refactoring because one > > of your class uses a trait? > > > > Stef > > -- > Dr. Geo > http://drgeo.eu > > > >
Re: [Pharo-users] [Deploy] Deploying application - New Best Practices?
> On 26 May 2017, at 21:47, sergio ruiz wrote: > > Hey, all.. > > I have a Pharo application that I ready to deploy to production. I haven’t > done this in a lot of years, so I thought I might check around on what the > current best practices are. > > The app is a Teapot(REST) based application that processes SMS and MMS > messages, including saving files to the file system, etc.. > > In the past, I would have added some kind of remote desktop server into my > image, and run it headless on the server. When I needed to update the source > code with monticello, I would use a VNC client to log in, update my source > code, save the image, etc. My current approach is more or less what you find here https://github.com/svenvc/pharo-server-tools That include a REPL and Metrics server for operational purposes. > I have a feeling things have progressed at this point. Can anyone point me in > the right direction to learn current best practices? > > I will most likely be updating this to a gemstones app, but while this is in > beta, i just want to worry about user experience of the application.. > > Thanks! > > > peace, > sergio > photographer, journalist, visionary > > Public Key: http://bit.ly/29z9fG0 > #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV > http://www.Village-Buzz.com > http://www.ThoseOptimizeGuys.com > http://www.coffee-black.com > http://www.painlessfrugality.com > http://www.twitter.com/sergio_101 > http://www.facebook.com/sergio101
Re: [Pharo-users] Edit methods protocol by code
2017-05-26 11:42 GMT+02:00 Hilaire : > "Buggy" > org := MyClass organization protocolOrganizer. > org addProtocolNamed: 'code'. > org allProtocols do: [:aProtocol | org moveMethodsFrom: aProtocol name > to: 'code']. > org removeEmptyProtocols. > In Pharo 6 we introduced tags API: (MyClass methodsTaggedWith: #oldProtocol) do: [:each | each tagWith: #code]
Re: [Pharo-users] Moving Class to a Package programmaticaly
2017-05-26 19:22 GMT+02:00 Thierry Goubier : > > This should work: > > org := (RPackageOrganizer default packageNamed: 'MyPackage'). > tag := org addClassTag: #Classes. > org definedClasses do: [ :aClass | > aClass category: tag categoryName ]. In Pharo 6 there is new tag API for classes: #MyPackage asPackage definedClasses do: [:each | each tagWith: #Classes]
Re: [Pharo-users] Moving Class to a Package programmaticaly
2017-05-27 13:58 GMT+02:00 Denis Kudriashov : > > 2017-05-26 19:22 GMT+02:00 Thierry Goubier : > >> >> This should work: >> >> org := (RPackageOrganizer default packageNamed: 'MyPackage'). >> tag := org addClassTag: #Classes. >> org definedClasses do: [ :aClass | >> aClass category: tag categoryName ]. > > > In Pharo 6 there is new tag API for classes: > > #MyPackage asPackage definedClasses do: [:each | each tagWith: #Classes] > > Will: #MyPackage asPackage definedClasses do: [:each | each tagWith: #MyPackage] put the classes in the #MyPackage or in the #MyPackage-MyPackage system category? Will that API stay the same when we will be able to put a class in multiple categories (or a method in multiple protocols)? Regards, Thierry
Re: [Pharo-users] Moving Class to a Package programmaticaly
2017-05-27 14:15 GMT+02:00 Thierry Goubier : > Will: > > #MyPackage asPackage definedClasses do: [:each | each tagWith: #MyPackage] > > put the classes in the #MyPackage or in the #MyPackage-MyPackage system > category? > #tagWith: not touches package of class. It only adds receiver into package tag. I not understand the question about system category because I don't know what it is exactly in current system. Now in class definition we have "package: " part. And it will be modified with new tag-suffix. It will become "package: 'ActualPackageName-TagName'" > > Will that API stay the same when we will be able to put a class in > multiple categories (or a method in multiple protocols)? > Yes but #tagWith: will add extra tag into class/method. It will not remove existing tags. But in Pharo6 it is only new API. Multiple tags are not supported and #tagWith: removes existing tag.
Re: [Pharo-users] Moving Class to a Package programmaticaly
2017-05-27 14:45 GMT+02:00 Denis Kudriashov : > > 2017-05-27 14:15 GMT+02:00 Thierry Goubier : > >> Will: >> >> #MyPackage asPackage definedClasses do: [:each | each tagWith: #MyPackage] >> >> put the classes in the #MyPackage or in the #MyPackage-MyPackage system >> category? >> > > #tagWith: not touches package of class. It only adds receiver into package > tag. > I not understand the question about system category because I don't know > what it is exactly in current system. > The package and tag names are translated into a 'PackageName-TagName' system category. But: the tag #PackageName has a special meaning in RPackage (for now). It means : what is defined in the package, and not in any other tag. > Now in class definition we have "package: " part. And it will be modified > with new tag-suffix. It will become "package: 'ActualPackageName-TagName'" > Just like it is now in system category then. > > >> >> Will that API stay the same when we will be able to put a class in >> multiple categories (or a method in multiple protocols)? >> > > Yes but #tagWith: will add extra tag into class/method. It will not remove > existing tags. > But in Pharo6 it is only new API. Multiple tags are not supported and > #tagWith: removes existing tag. > > The problem I foresee is that at a certain point in the future, not advertised, that semantic will change to not mean 'remove existing tag'. If I start using that API, I'll need to add a test in my stuff that will flag that API semantic change without name change. Thierry
Re: [Pharo-users] How to use uFFI with String
Yes, I did. I found it difficult to understand. It would be nice to have some clear examples in the documentation, for example, really simple and common situations such as a C function returning an integer in a passed-by-reference argument. Speaking of documentation, in "Pharo by Example 50," I found this statement: > (Recall that you should set halosEnabled in the Preferences browser.) However, nowhere else in the book is there any reference to halosEnabled or Preferences browser. Did you guys forget and leave out a chunk of the book? Stephane Ducasse-3 wrote > Did you read the UFFI chapter? > > https://ci.inria.fr/pharo-contribution/view/Books/job/PharoBookWorkInProgress/174/artifact/book-result/UnifiedFFI/UnifiedFFI.pdf > > https://ci.inria.fr/pharo-contribution/view/Books/job/PharoBookWorkInProgress/174/artifact/book-result/UnifiedFFI/ > > > I'm turning it into a booklet but I will not write it because I'm bad in > FFI > Now if you have corrections, suggestions, please do some pull requests > > https://github.com/SquareBracketAssociates/Booklet-uFFI > > Stef > > On Mon, May 22, 2017 at 10:42 PM, horrido < > horrido.hobbies@ > > wrote: > >> There is shockingly very little documentation on how to use uFFI. In >> particular, I have the following situation... >> >> A shared C lib has the following function: >> >> void get_machine(char *machine) { >> uname(&uname_s); >> strcpy(machine, uname_s.machine); >> } >> >> It copies the content of a string value into the buffer passed to it >> (char >> *machine). >> >> I want to call this function from Pharo, thus: >> >> buffer := String new: 64. >> self ffiCall: #( void get_machine(String buffer) ). >> >> The buffer never receives the string value (it just contains the 64 >> initiialized spaces). >> >> Clearly, I'm misunderstanding the proper mechanism for doing this. >> >> [There are other functions in the shared C lib that work fine, such as: >> >> uint get_uptime() { >> sysinfo(&info); >> return info.uptime; >> } >> >> Returning integers or floats is no problem. But passing arguments by >> reference seems to be verboten.] >> >> >> >> -- >> View this message in context: http://forum.world.st/How-to- >> use-uFFI-with-String-tp4947890.html >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. >> >> -- View this message in context: http://forum.world.st/How-to-use-uFFI-with-String-tp4947890p4948427.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Re: [Pharo-users] Moving Class to a Package programmaticaly
2017-05-27 15:05 GMT+02:00 Thierry Goubier : > The problem I foresee is that at a certain point in the future, not > advertised, that semantic will change to not mean 'remove existing tag'. > > If I start using that API, I'll need to add a test in my stuff that will > flag that API semantic change without name change. > That's true. Also you can think that multiple tags are working and implement your code with exta untag logic to ensure singe tag property: aClass untagFrom: #existingTag. aClass tagWith: #newTag
Re: [Pharo-users] Moving Class to a Package programmaticaly
Thanks Thierry Le 26/05/2017 à 19:22, Thierry Goubier a écrit : > > This should work: -- Dr. Geo http://drgeo.eu
Re: [Pharo-users] Edit methods protocol by code
Pharo5, sorry. I used a different code to make it work: org := aClass organization protocolOrganizer. org addProtocolNamed: 'code'. org allMethods do: [:aMethod | org classify: aMethod inProtocolNamed: 'code']. org removeEmptyProtocols. Le 27/05/2017 à 03:37, Ben Coman a écrit : > Usual starting question, what version? > cheers -ben > -- Dr. Geo http://drgeo.eu
[Pharo-users] Dictionary whose values are dictionaries
Hi I'm looking for an implementation of dictionary whose value is also a dictionary. Stef
Re: [Pharo-users] Dictionary whose values are dictionaries
On sam. 27 mai 2017 at 20:29, Stephane Ducasse wrote: > Hi > > I'm looking for an implementation of dictionary whose value is also a > dictionary. > > Stef > Hi! I don't remember the exact name but I know that an algo at synectique use such a collection. The name is something like Ktree or something like this but I don't have a computer to check this week end. — >From my phone Cyril -- Cheers Cyril Ferlicot
Re: [Pharo-users] Dictionary whose values are dictionaries
Looks like a JsonObject On Sat, May 27, 2017 at 8:28 PM, Stephane Ducasse wrote: > Hi > > I'm looking for an implementation of dictionary whose value is also a > dictionary. > > Stef >
Re: [Pharo-users] Dictionary whose values are dictionaries
On sam. 27 mai 2017 at 20:35, Cyril Ferlicot wrote: > > On sam. 27 mai 2017 at 20:29, Stephane Ducasse > wrote: > >> Hi >> >> I'm looking for an implementation of dictionary whose value is also a >> dictionary. >> >> Stef >> > Hi! > > I don't remember the exact name but I know that an algo at synectique use > such a collection. The name is something like Ktree or something like this > but I don't have a computer to check this week end. > > — > From my phone > Cyril > -- > Cheers > Cyril Ferlicot > I think the exact name was KeyedTree. — >From my phone Cyril -- Cheers Cyril Ferlicot
Re: [Pharo-users] Dictionary whose values are dictionaries
Stef Cyril is right; there is a class KeyedTree which is a subclass of Dictionary and is in effect a set of nested dictionaries. There was a brief discussion of this in April, initiated by Markus Böhm, who wanted a neat way of looking up entries in nested dictionaries. KeyedTree uses the idea of a path, which is an array of the successive keys needed to locate an entry in an embedded dictionary. Sven also saw this, and has extended NeoJSONObject to provide the same embedding and path lookup. To see Sven’s brief explanation, find the original thread, entitled “ [Pharo-users] Hot to retrieve values from Nested Dictionaries” (note the typo in the original post) starting on 24 April 2017, or see the class comment for NeoJSONObject. Hope this helps. Peter Kenny From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of Cyril Ferlicot Sent: 27 May 2017 19:42 To: Any question about pharo is welcome Subject: Re: [Pharo-users] Dictionary whose values are dictionaries On sam. 27 mai 2017 at 20:35, Cyril Ferlicot mailto:cyril.ferli...@gmail.com> > wrote: On sam. 27 mai 2017 at 20:29, Stephane Ducasse mailto:stepharo.s...@gmail.com> > wrote: Hi I'm looking for an implementation of dictionary whose value is also a dictionary. Stef Hi! I don't remember the exact name but I know that an algo at synectique use such a collection. The name is something like Ktree or something like this but I don't have a computer to check this week end. — >From my phone Cyril -- Cheers Cyril Ferlicot I think the exact name was KeyedTree. — >From my phone Cyril -- Cheers Cyril Ferlicot
Re: [Pharo-users] Dictionary whose values are dictionaries
hi, i'm using a multi-valued dictionary https://github.com/vonbecmann/multi-valued-dictionary in the following way itemsByKey := MultiValuedDictionary dictionary: IdentityDictionary collection: IdentityDictionary so i can check the existence of an item by its key (an ordered pair) (itemsByKey at: anItem key first ifAbsent: nil) ifNotNil: [ :dict | (dict at: anItem key second ifAbsent: nil) ifNotNil: [ :found | ^ found ] ]. and i add an item like this itemsByKey at: anItem key first add: (Association basicNew key: anItem key second value: anItem). hth On Sat, May 27, 2017 at 3:28 PM, Stephane Ducasse wrote: > Hi > > I'm looking for an implementation of dictionary whose value is also a > dictionary. > > Stef > -- Bernardo E.C. Sent from a cheap desktop computer in South America.
Re: [Pharo-users] Dictionary whose values are dictionaries
You could just use a regular Dictionary, but with association keys: dict at: outerKey -> innerKey put: innerValue
Re: [Pharo-users] [Pharo-dev] Chrome DevTools Protocol and Pharo
Hi Aik-Siong, (Moving to pharo-users as Serge suggestion) On Sat, May 27, 2017 at 08:22:27PM -0700, askoh wrote: > Wonderful contribution. Having full control of an internet browser will give > Smalltalk more freedom to innovate. > > Now, can we make Pharo be a web server on demand? Then we can give anyone a > URL > and they can see the app or info we want to present. Pharo can communicate > with > anyone using a browser either automatically or under developer control. Pharo includes the Zinc framework, which includes a basic server (ZnServer). There's also Seaside, which is more complete for making web applications. Cheers, Alistair
Re: [Pharo-users] [Pharo-dev] Chrome DevTools Protocol and Pharo
(Moving to pharo-users as Serge suggested) Sending the email also made me realise that it would be possible to check for the presence of a particular node while waiting for Chrome to load the page, which would avoid the long timeout. I'll look at adding this later. Cheers, Alistair On Sun, May 28, 2017 at 10:49:14AM +0700, serge.stinckw...@gmail.com wrote: > Thank you guys for your contributions, but I think that this kind of > discussions should be done on pharo-users mailing-list, not here. > > pharo-dev should be use only if you contribute to core-pharo. > > Thank you > > Envoy? de mon iPhone > > On May 27, 2017, at 3:23 PM, Alistair Grant [via Smalltalk] > <[hidden email] > > wrote: > > > Hi Torsten and All, > > Quick Introduction for those not familiar with Pharo-Chrome: > > Pharo-Chrome enables Pharo to control and query Chrome / > Chromium, in particular to retrieve the DOM of a page. This > is useful as many modern pages are just a template which then > loads some javascript to asynchronously build the DOM, meaning > that the ZnEasy / Soap combination doesn't get the bulk of the > information on a page. > > > > Pharo-Chrome is now mostly working, i.e. it is possible to > open a connection to Chrome, navigate to a requested URL, wait > for it to load, retrieve the DOM and then navigate the DOM > using a subset of the Soap API, e.g. #findAllStrings:, > #findAllTags:, attributeAt:, etc.. > > GoogleChrome class>>exampleNavigation has been updated to > retrieve the DOM from http://pharo.org. > > GoogleChrome class>>get: is analogous to ZnEasy class>>get:, > although it returns a ChromeNode, not an html string. > > I wasn't able to get rid of the delay while waiting for the > page to finish loading. This actually makes sense, since, as > mentioned above, many modern pages build the DOM > asynchronously, so there's no clear indication of when it is > complete. The default delay is currently 2000 milliseconds, > which is about twice the maximum I saw needed (983ms), but > this can be changed (ChromeTabPage>>pageLoadDelay:). > > I had three use cases for this library: one which works with > ZnEasy+Soap, one that used to work with ZnEasy+Soap, but > doesn't due to a page redesign, and one which I hadn't got > working before. All three are working now. > > Unlike Soap, I've currently modelled the nodes as a single > class, and have only implemented a subset of Soap's methods, > but is enough for what I need. > > I've introduced a dependency on the Beacon logging framework. > I find it useful, but can remove it if you don't want the > additional dependency. (I'm planning to add some GoogleChrome > specific logging classes and use those to better understand > what pageLoadDelay should be). > > I was focussed on trying to understand the events that Chrome > generates, so documentation is still lacking (read "missing" > :-)). > > I'll generate a pull request after some more testing, tweaking > and documenting, but if you would like to take a look, the > code is available at: > > https://github.com/akgrant43/Pharo-Chrome/tree/development > > I haven't yet updated BaselineOfChrome with the Beacon > dependency. I did merge in your two commits from May 23. > > If you, or anyone else, finds this useful, I welcome any > feedback. > > P.S. I've just realised that I need to tidy up #sendMessage:, > #sendMessageDictionary and #sendMessageDictionary:wait:. I'll > do that as part of the genral tidy up. > > Cheers, Alistair > > > On Sun, May 21, 2017 at 09:37:56PM +, > Alistair Grant wrote: > > > Hi Torsten, > > > > On Fri, May 19, 2017 at 09:20:48PM +, Alistair Grant > > wrote: > > > > > > On Fri, May 19, 2017 at 10:50:41PM +0200, Torsten Bergmann > > > wrote: > > > > Hi Alistair, > > > > > > > > cant look right now but two things: > > > > > > > > - there are also events in the protocol - if we could > > > > hook Pharo into them > > > > this would solve the problem without abusing delay > > > > (because then you will > > > > get informed when the page loading is finished) > > > > > > That would be great. It will be a while before I get a > > > chance to look > > > at this (I want to finish some proposed changes to the > > > FileSystem packages first), but I'll try and include it > > > then. > > > > I've got basic event listening working. It requi