<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stefan-Marr.de &#187; Command-line</title>
	<atom:link href="http://soft.vub.ac.be/~smarr/tag/command-line/feed/" rel="self" type="application/rss+xml" />
	<link>http://soft.vub.ac.be/~smarr</link>
	<description>personal and research notes</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:41:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>How to use Pharo/Squeak from the Command-line</title>
		<link>http://soft.vub.ac.be/~smarr/2009/09/how-to-use-pharosqueak-from-the-command-line/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-use-pharosqueak-from-the-command-line</link>
		<comments>http://soft.vub.ac.be/~smarr/2009/09/how-to-use-pharosqueak-from-the-command-line/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 07:54:15 +0000</pubDate>
		<dc:creator>Stefan</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Benchmarks]]></category>
		<category><![CDATA[Command-line]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Language Shootout]]></category>
		<category><![CDATA[Pharo]]></category>
		<category><![CDATA[Smalltalk]]></category>
		<category><![CDATA[Squeak]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://soft.vub.ac.be/~smarr/?p=254</guid>
		<description><![CDATA[Along the way to measure the performance of a Smalltalk implementation for commodity multi-core systems, I tried to use Pharo as a more convenient development platform. Well, and I failed in the first attempt&#8230; To remind myself and document some of the necessary steps in this environment, I wrote up the following tutorial. Command-line Scripts [...]]]></description>
			<content:encoded><![CDATA[<p>Along the way to measure the performance of a Smalltalk implementation for commodity multi-core systems, I tried to use Pharo as a more convenient development platform. Well, and I failed in the first attempt&#8230;</p>
<p>To remind myself and document some of the necessary steps in this environment, I wrote up the following tutorial.</p>

<h1>Command-line Scripts with a Headless Pharo</h1>


<p>For some tasks like benchmarking and automated testing, an integration
with other tools comes in handy.
For such use cases, Pharo can be used headless, i.e., without its  
graphical
user interface.</p>

<p>This brief tutorial will demonstrate how to use the Debian Language  
Shootout
benchmarks with a fresh Pharo image.</p>

<h2>Step 1: Setup Pharo and a Fresh Image</h2>

<ul>
  <li>download a Pharo image, the sources file, and a VM from the
    <a href="http://www.pharo-project.org/pharo-download">download page</a></li>
  <li> extract all archives in the same folder</li>
  <li> start Pharo, from the commandline, on a MacOSX it should look  
like this:
<code>"Squeak 4.2.1beta1U.app/Contents/MacOS/Squeak VM Opt" \
          pharo1.0-10418-BETAdev09.08.3.image
    </code></li></ul>

<h2>Step 2: Load OSProcess</h2>

<p>For output on the shell, we need an extra package from the SqueakSource
repository.</p>

<p>It can be loaded by simply executing the following code in a workspace  
window:
<br/>
<pre>
ScriptLoader loadLatestPackage: 'OSProcess' from:
'http://www.squeaksource.com/OSProcess'
</pre>

<p>To execute this code snippet, select it and press cmd+d or use the &#8220;do  
it&#8221;
item in the context menu.</p>

<h2>Step 3: Load Common Benchmark Code</h2>

<p>Now we can load the common parts of all shootout benchmarks into our  
image.</p>
<ul>
<li>On way to do this is to grab the code shown <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&amp;lang=squeak&amp;lang2=squeak">here</a></li> and save it to a file called <code>common.st</code>.</li>
  <li>Open the file browser from the Menu -&gt; Tools -&gt; File Browser.</li>
  <li>Select <code>common.st</code> and press <code>filein</code> to load the code.</li></ul>

<p>Now you can close all windows in your image and save and quit it.</p>

<h2>Step 4: Run a Benchmark</h2>
<ul>
<li>Grab the code of a benchmark like <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=fannkuch&amp;lang=squeak&amp;id=1">Fannkuch</a></li>
  <li>Save it to a file named like <code>fannkuch.st</code></li>
  <li>Add a run script to the end of the code in <code>fannkuch.st</code>, like  
this:<br/>
<pre>
    Tests fannkuch.
    SmalltalkImage current snapshot: false andQuit: true.
</pre></li>
  <li>Run it with a headless Pharo:<br/>
<pre>
    "Squeak 4.2.1beta1U.app/Contents/MacOS/Squeak VM Opt" \
        -headless pharo1.0-10418-BETAdev09.08.3.image \
        $PWD/fannkuch.st 6
</pre><br/>
important is here the absolute path to the script, clearly inconvenient and uncommon on the command-line.</li></ul>
]]></content:encoded>
			<wfw:commentRss>http://soft.vub.ac.be/~smarr/2009/09/how-to-use-pharosqueak-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

