Help in thinking about how to save a "program"
Hi all. Iâm new to Pharo and loving it. As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way. Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought. At the moment, it just lives in the Playground Iâve developed it on. I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident. I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it. But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward. Can one save the contents of a Playground in a Pharonic way? Is there a better approach? Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice. Glenn Glenn Hoetker ghoetker@me.com <mailto:ghoetker@me.com> http://hoetker.faculty.asu.edu <http://hoetker.faculty.asu.edu/>
If you have a playground script maybe just having it as a .st file and running it with Pharo is good enough. Like pharo Pharo60.image myscript.st Check https://github.com/guillep/Scale Or get into Iceberg (Git) or Monticello to save your code as a package. Check deep into pharo, there is a chapter on these things. Gofer may also be a solution. Are you on Discord? Phil Le 12 juin 2017 01:22, "Glenn Hoetker" <ghoetker@me.com> a écrit :
Hi all. Iâm new to Pharo and loving it. As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way.
Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought.
At the moment, it just lives in the Playground Iâve developed it on. I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident.
I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it. But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward.
Can one save the contents of a Playground in a Pharonic way? Is there a better approach?
Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice.
Glenn
Glenn Hoetker ghoetker@me.com http://hoetker.faculty.asu.edu
On Monday 12 June 2017 04:52 AM, Glenn Hoetker wrote:
Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought.
Playground saves your scripts in pharo-local/play-cache folder. Use Tools->File Browser to look in play-cache/ or pharo-local/play-cache/ folder. You will find all your playground scripts saved in *.ph files. Note down this name (or rename it to something easy to remember) and make a copy. Pass this file as an argument: $ ./pharo Pharo myscript.st BTW, Playground is just that and a file is for unstructured stream of bytes. You may want to start using System Browser to create classes and methods, tests etc. for code worth preserving. Pharo offers you a lot of services like live debug, cross-refs, tracking changes, packaging etc. It is a lot easier than you think ;-). HTH .. Subbu
Hi Glenn, Another very useful tool you can use to save/manipulate/store Smalltalk scripts is ScriptManager (http://catalog.pharo.org/catalog/project/ScriptManager).  There are plenty of similar tools but this one is very easy to use and simple and has been doing the job for years for me. hth ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein) From: Glenn Hoetker <ghoetker@me.com> To: pharo-users@lists.pharo.org Sent: Sunday, June 11, 2017 7:23 PM Subject: [Pharo-users] Help in thinking about how to save a "program" Hi all.  Iâm new to Pharo and loving it.  As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way. Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment.  Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use).  If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought. At the moment, it just lives in the Playground Iâve developed it on.  I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident. I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it.  But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward. Can one save the contents of a Playground in a Pharonic way?  Is there a better approach? Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice. Glenn Glenn Hoetkerghoetker@me.comhttp://hoetker.faculty.asu.edu
On Mon, Jun 12, 2017 at 7:22 AM, Glenn Hoetker <ghoetker@me.com> wrote:
Hi all. Iâm new to Pharo and loving it. As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way.
Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought.
At the moment, it just lives in the Playground Iâve developed it on. I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident.
I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it. But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward.
Can one save the contents of a Playground in a Pharonic way? Is there a better approach?
Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice.
Great to hear you are enjoying Pharo. The heavy part of saving to disk as a Monticello package is an optional secondary step, but to make you code "permanent" in the image you do need a class to hang it on, and a package to hold that. Doing this only in-Image is quite light and quick to do, and makes it easy to find later. In a System Browser create package "GHBibDeskStuff", class GBibDeskKeywordFixer. Create your method so you can use it from playground like this... GBibDeskKeywordFixer new fixFile. Then to the class side of GBibDeskKeywordFixer also add a method #fixFile like this... GBibDeskKeywordFixer class >> fixFile self new fixFile. so that from playground you can drop the "new" and use it like this... GBibDeskKeywordFixer fixFile Feels like you've added a new command to Pharo? Note that "GBibDeskKeywordFixer class >>" is just a documentation convention indicating you should click the <Class> button to add a method to the class-side. cheers -ben
Hi glenn Do you use Citezen to parse? I create a class and put the script as methods and save. You should kill script as fast as possible up the give birth to nice method. GHBibDesk new loadFrom: '' GHBibDesk new analysis should be your scripts :) :) On Mon, Jun 12, 2017 at 1:22 AM, Glenn Hoetker <ghoetker@me.com> wrote:
Hi all. Iâm new to Pharo and loving it. As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way.
Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought.
At the moment, it just lives in the Playground Iâve developed it on. I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident.
I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it. But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward.
Can one save the contents of a Playground in a Pharonic way? Is there a better approach?
Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice.
Glenn
Glenn Hoetker ghoetker@me.com http://hoetker.faculty.asu.edu
Hi Stephan, Thank you for the helpful info and nice welcome to the Pharo community. Iâd not been using Citezen. Since your email, Iâve found the Smalltalkhub site for it and had two quick questions. 1. Is it compatible with Pharo 6? 2. Is there a manual or getting started document you could point me to? (I love the ability in Pharo to peruse well-documented classes and methods in a package, but for a new user and big package, itâs hard to get started!). Iâve made the jump to creating a class with methods for my small script. Less work than I thoughtâitâs really just a change of thinking. Again, thank you. Glenn Glenn Hoetker ghoetker@me.com <mailto:ghoetker@me.com> http://hoetker.faculty.asu.edu <http://hoetker.faculty.asu.edu/>
On Jun 13, 2017, at 10:53 PM, Stephane Ducasse <stepharo.self@gmail.com <mailto:stepharo.self@gmail.com>> wrote:
Hi glenn
Do you use Citezen to parse? I create a class and put the script as methods and save. You should kill script as fast as possible up the give birth to nice method.
GHBibDesk new loadFrom: '' GHBibDesk new analysis
should be your scripts :) :)
On Mon, Jun 12, 2017 at 1:22 AM, Glenn Hoetker <ghoetker@me.com <mailto:ghoetker@me.com>> wrote:
Hi all. Iâm new to Pharo and loving it. As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way.
Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought.
At the moment, it just lives in the Playground Iâve developed it on. I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident.
I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it. But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward.
Can one save the contents of a Playground in a Pharonic way? Is there a better approach?
Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice.
Glenn
Glenn Hoetker ghoetker@me.com <mailto:ghoetker@me.com> http://hoetker.faculty.asu.edu
Hi Glenn, I made also the transition for the plain "dead" text-files based mindset to live objects. My approach to bridge these two words was to create Grafoscopio [1], where I can save my scripts and put them inside a broader context/narrative. This environment let's me go from scripting/files to objects / code browser and back and I have found this is useful for non programmers (researchers, hacktivists, journalist), because they can have a notebook for their explorations. For example, recently we started a pretty specific project at [2] using this interactive notebook + code browser approach (see screenshot attached below). [1] http://mutabit.com/grafoscopio/index.en.html [2] http://smalltalkhub.com/#!/~Offray/DPYA If you're interested in Grafoscopio, please follow the manual and take into account that now we're trying to migrate to Pharo 6. Cheers, Offray On 11/06/17 18:22, Glenn Hoetker wrote:
Hi all. Iâm new to Pharo and loving it. As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way.
Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought.
At the moment, it just lives in the Playground Iâve developed it on. I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident.
I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it. But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward.
Can one save the contents of a Playground in a Pharonic way? Is there a better approach?
Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice.
Glenn
Glenn Hoetker ghoetker@me.com <mailto:ghoetker@me.com> http://hoetker.faculty.asu.edu
H Offray, Thanks for the helpful reply and nice welcome to the Pharo community. Grafoscopio looks wonderful and the Panama Papers application of it, in particular, is really impressive. I look forward to experimenting with it. Best wishes, Glenn p.s. Previously, I had actually Googled my way Grafoscopioâs Spanish language site and wasnât aware it had a corresponding English site. Perhaps a link between the English/Spanish sites would be helpful for some? If I just overlooked such a link, sorry to mention it. Glenn Hoetker ghoetker@me.com <mailto:ghoetker@me.com> http://hoetker.faculty.asu.edu <http://hoetker.faculty.asu.edu/>
On Jun 14, 2017, at 2:10 PM, Offray Vladimir Luna Cárdenas <offray.luna@mutabit.com <mailto:offray.luna@mutabit.com>> wrote:
Hi Glenn,
I made also the transition for the plain "dead" text-files based mindset to live objects. My approach to bridge these two words was to create Grafoscopio [1], where I can save my scripts and put them inside a broader context/narrative. This environment let's me go from scripting/files to objects / code browser and back and I have found this is useful for non programmers (researchers, hacktivists, journalist), because they can have a notebook for their explorations. For example, recently we started a pretty specific project at [2] using this interactive notebook + code browser approach (see screenshot attached below). [1] http://mutabit.com/grafoscopio/index.en.html <http://mutabit.com/grafoscopio/index.en.html> [2] http://smalltalkhub.com/#!/~Offray/DPYA <http://smalltalkhub.com/#!/~Offray/DPYA>
<hmnillffiajnlhpp.png>
If you're interested in Grafoscopio, please follow the manual and take into account that now we're trying to migrate to Pharo 6.
Cheers,
Offray
On 11/06/17 18:22, Glenn Hoetker wrote:
Hi all. Iâm new to Pharo and loving it. As I transition from a text-file based mindset, Iâm a little stuck and would appreciate help in how to think about a situation in a Pharonic (Pharo-ish, Pharoc?) way.
Iâm crafting a short program to help me process a large text file (specifically: extract, sorting, and regularizing the âkeywordâ fields of a large BibTex file). Especially since I donât really know what Iâm doing, working in a Playground has been a great development environment. Now that the program is complete (under 30 lines, wonderful), I want to be able to save it for future reference (and perhaps for future use). If Iâd written a shell script, Iâd just save âfixBibDeskKeyWords.shâ to a directory. Iâm not sure what to do in the Pharo environment, thought.
At the moment, it just lives in the Playground Iâve developed it on. I could save the image and leave that Playground open, but Iâm just positive thatâs not a best practice. I also worry about what happens if I closed/cleared that Playground by accident.
I think I understand that, if I created a new package, I could use Monticello to save it to a local cache and load it into a new image whenever I needed it. But, given that itâs short, highly specialized and fairly linear, the idea of creating a âGHBibDeskStuffâ package with one class (âGBibDeskKeywordFixerâ containing a single âFixFileâ method seems really heavy and awkward.
Can one save the contents of a Playground in a Pharonic way? Is there a better approach?
Thank you to all involved in this wonderful programming ecosystem. I appreciate any advice.
Glenn
Glenn Hoetker ghoetker@me.com <mailto:ghoetker@me.com> http://hoetker.faculty.asu.edu <http://hoetker.faculty.asu.edu/>
participants (7)
-
Ben Coman -
Benoit St-Jean -
Glenn Hoetker -
K K Subbu -
Offray Vladimir Luna Cárdenas -
phil@highoctane.be -
Stephane Ducasse