<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>gragusa&#039;s things</title>
	<atom:link href="http://gragusa.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gragusa.wordpress.com</link>
	<description>open source personal notes</description>
	<lastBuildDate>Thu, 21 Jul 2011 18:37:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='gragusa.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>gragusa&#039;s things</title>
		<link>http://gragusa.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://gragusa.wordpress.com/osd.xml" title="gragusa&#039;s things" />
	<atom:link rel='hub' href='http://gragusa.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Indro Montanelli &#8211; Aspra critica a partiti e magistrati</title>
		<link>http://gragusa.wordpress.com/2011/07/21/indro-montanelli-aspra-critica-a-partiti-e-magistrati/</link>
		<comments>http://gragusa.wordpress.com/2011/07/21/indro-montanelli-aspra-critica-a-partiti-e-magistrati/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 18:37:25 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
		
		<guid isPermaLink="false">http://gragusa.wordpress.com/2011/07/21/indro-montanelli-aspra-critica-a-partiti-e-magistrati/</guid>
		<description><![CDATA[Check out this video on YouTube: Sent from a mobile device.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=39&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Check out this video on YouTube:</p>
<span style="text-align:center; display: block;"><a href="http://gragusa.wordpress.com/2011/07/21/indro-montanelli-aspra-critica-a-partiti-e-magistrati/"><img src="http://img.youtube.com/vi/swb0n0lIG38/2.jpg" alt="" /></a></span>
<p>Sent from a mobile device.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=39&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2011/07/21/indro-montanelli-aspra-critica-a-partiti-e-magistrati/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>
	</item>
		<item>
		<title>Prova</title>
		<link>http://gragusa.wordpress.com/2011/05/30/prova/</link>
		<comments>http://gragusa.wordpress.com/2011/05/30/prova/#comments</comments>
		<pubDate>Mon, 30 May 2011 13:14:47 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
				<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://gragusa.wordpress.com/?p=37</guid>
		<description><![CDATA[1 Prova elyxer Allora proviamo sto blog. &#60;&#60;echo=TRUE&#62;&#62;= summary(rnorm(100)) @ Quindi appare self evident that: lim x &#8594; 8 1 x-8 = &#8734; thus referes.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=37&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 class="section"><span class="section_label">1</span> <a id='magicparlabel-2' /><br />
Prova elyxer</h2>
<div class="standard"><a id='magicparlabel-9' /><br />
Allora proviamo sto blog.</div>
<div class="chunk"><a id='magicparlabel-13' /><br />
&lt;&lt;echo=TRUE&gt;&gt;=</div>
<div class="chunk"><a id='magicparlabel-20' /><br />
summary(rnorm(100))</div>
<div class="chunk"><a id='magicparlabel-24' /><br />
@</div>
<div class="standard"><a id='magicparlabel-68' /><br />
Quindi appare self evident that:</p>
<p>     lim </p>
<p>     x &rarr; 8</p>
<p>    1</p>
<p>     x-8</p>
<p>   = &infin; </p>
<p> thus referes.</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=37&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2011/05/30/prova/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>
	</item>
		<item>
		<title>Book to check out</title>
		<link>http://gragusa.wordpress.com/2010/09/02/book-to-check-out/</link>
		<comments>http://gragusa.wordpress.com/2010/09/02/book-to-check-out/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 21:56:56 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
				<category><![CDATA[R]]></category>

		<guid isPermaLink="false">https://gragusa.wordpress.com/2010/09/02/book-to-check-out/</guid>
		<description><![CDATA[These two books seem interesting. R in a Nutshell Joseph Adler O&#8217;Reilly, 2010 ISBN: 978-0-596-80170-0 Graphics for Statistics and Data Analysis with R Kevin J. Keen Chapman and Hall/CRC, 2010 ISBN: 9781584880875 Only thing is that R cannot really fit a nutshell!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=33&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>These two books seem interesting.</p>
<p>R in a Nutshell<br />
Joseph Adler<br />
O&#8217;Reilly, 2010<br />
ISBN: 978-0-596-80170-0</p>
<p>Graphics for Statistics and Data Analysis with R<br />
Kevin J. Keen<br />
Chapman and Hall/CRC, 2010<br />
ISBN: 9781584880875</p>
<p>Only thing is that R cannot really fit a nutshell!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=33&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2010/09/02/book-to-check-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>
	</item>
		<item>
		<title>Now, I am happy</title>
		<link>http://gragusa.wordpress.com/2010/07/19/now-i-am-happy/</link>
		<comments>http://gragusa.wordpress.com/2010/07/19/now-i-am-happy/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 21:50:46 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
				<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://gragusa.wordpress.com/?p=23</guid>
		<description><![CDATA[Many sources [here and here] have been discussing the performance benefit optimized BLAS/Lapack and I wanted to try directly. I wanted to give it a try as I am using R for some heavy duty matrix calculations. I downloaded the MKL Intel Blas/Lapack libraries and installed it. This went very smooth. I then tried to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=23&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:13.3333px;">Many sources [<a href="http://psyccomputing.blogspot.com/2010/04/compiling-64-bit-r-2101-with-mkl-in.html">here</a> and <a href="http://www.revolutionanalytics.com/why-revolution-r/benchmarks.php">here</a>] have been discussing the performance benefit optimized BLAS/Lapack and I wanted to try directly. </span></p>
<p>I wanted to give it a try as I am using R for some heavy duty matrix calculations.</p>
<p><span style="font-size:13.3333px;">I <a href="http://software.intel.com/en-us/articles/non-commercial-software-development/">downloaded</a> the MKL Intel Blas/Lapack libraries and installed it. This went very smooth.</span></p>
<p>I then tried to follow Michael&#8217;s suggestions to compile R 2.11.1 (well, it&#8217;s suggestions are about 2.10). It compiled fine, but I could not get R to use more than one core (no matter how hard I tried!). To get a multithreaded version of R I had to <strong>disable</strong> compilation of R as a shared library. It&#8217;s probably better not to compile R as a shared library anyway (see <a style="color:#5588aa;text-decoration:none;" href="http://cran.r-project.org/doc/manuals/R-admin.html#Configuration-options">here</a> for details).</p>
<p>This is my configuration (including compiler flags and commands)<br />
<code><br />
$ gcc -v<br />
gcc version 4.4.0 20090514 (Red Hat 4.4.0-6) (GCC)<br />
export FFLAGS="-march=core2 -O3"<br />
export CFLAGS="-march=core2 -O3"<br />
export CXXFLAGS="-march=core2 -O3"<br />
export FCFLAGS="-march=core2 -O3"<br />
MKL_LIB_PATH=/opt/intel/mkl/10.2.5.035/lib/em64t<br />
export LD_LIBRARY_PATH=$MKL_LIB_PATH<br />
export LDFLAGS="-L${MKL_LIB_PATH},-Bdirect,--hash-style=both,-Wl,-O1"<br />
MKL="-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_lapack -lmkl_core -liomp5 -lpthread"<br />
./configure --with-blas="$MKL" --with-lapack<br />
make<br />
make check<br />
</code></p>
<h3>Benchmark</h3>
<p>The simple R-benchmark-25.R test script is a quick-running survey of general R performance. The Community-developed test consists of three sets of small benchmarks, referred to in the script as Matrix Calculation, Matrix Functions, and Program Control.</p>
<p>See <a href="http://r.research.att.com/benchmarks/">Simon Urbanek&#8217;s notes</a> about benchmarking and a reference benchmark.</p>
<p>Below, the results of my new R with MKL:</p>
<p><code><br />
   R Benchmark 2.5<br />
   ===============<br />
Number of times each test is run__________________________:  3</p>
<p>   I. Matrix calculation<br />
   ---------------------<br />
Creation, transp., deformation of a 2500x2500 matrix (sec):  0.517999999999953<br />
2400x2400 normal distributed random matrix ^1000____ (sec):  0.68966666666673<br />
Sorting of 7,000,000 random values__________________ (sec):  1.0783333333333<br />
2800x2800 cross-product matrix (b = a' * a)_________ (sec):  0.605999999999995<br />
Linear regr. over a 3000x3000 matrix (c = a \ b')___ (sec):  0.260333333333392<br />
                      --------------------------------------------<br />
                 Trimmed geom. mean (2 extremes eliminated):  0.600455102863175 </p>
<p>   II. Matrix functions<br />
   --------------------<br />
FFT over 2,400,000 random values____________________ (sec):  0.541333333333303<br />
Eigenvalues of a 640x640 random matrix______________ (sec):  0.892333333333378<br />
Determinant of a 2500x2500 random matrix____________ (sec):  0.28133333333335<br />
Cholesky decomposition of a 3000x3000 matrix________ (sec):  0.231333333333358<br />
Inverse of a 1600x1600 random matrix________________ (sec):  0.332666666666645<br />
                      --------------------------------------------<br />
                Trimmed geom. mean (2 extremes eliminated):  0.370025581291834 </p>
<p>   III. Programmation<br />
   ------------------<br />
3,500,000 Fibonacci numbers calculation (vector calc)(sec):  1.01633333333333<br />
Creation of a 3000x3000 Hilbert matrix (matrix calc) (sec):  0.431666666666653<br />
Grand common divisors of 400,000 pairs (recursion)__ (sec):  1.68333333333336<br />
Creation of a 500x500 Toeplitz matrix (loops)_______ (sec):  0.709333333333348<br />
Escoufier's method on a 45x45 matrix (mixed)________ (sec):  0.58400000000006<br />
                      --------------------------------------------<br />
                Trimmed geom. mean (2 extremes eliminated):  0.749491068589986 </p>
<p>Total time for all 15 tests_________________________ (sec):  9.85600000000015<br />
Overall mean (sum of I, II and III trimmed means/3)_ (sec):  0.55016494784761<br />
                      --- End of test ---<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=23&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2010/07/19/now-i-am-happy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>
	</item>
		<item>
		<title>R Random Number Generator</title>
		<link>http://gragusa.wordpress.com/2010/07/04/r-random-number-generator/</link>
		<comments>http://gragusa.wordpress.com/2010/07/04/r-random-number-generator/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 20:32:30 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
				<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://gragusa.wordpress.com/?p=17</guid>
		<description><![CDATA[I was programming a particle filter routine that makes heavy use of rnorm. When I completed the coding effort, I was not satisfied at all with the speed of the computation. Speed is paramount here as the output of my routine is a likelihood function that is then passed to a Metropolis-Hasting mcmc. With my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=17&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was programming a particle filter routine that makes heavy use of rnorm. When I completed the coding effort, I was not satisfied at all with the speed of the computation.</p>
<p>Speed is paramount here as the output of my routine is a likelihood function that is then passed to a Metropolis-Hasting mcmc.</p>
<p>With my surprise, the biggest improvement came from changing the normal random number  from &#8220;Inversion&#8221; (the default) to &#8220;Kinderman-Ramage&#8221;.<br />
<code><br />
RNGkind(normal.kind = 'Kinderman-Ramage')<br />
</code><br />
I am getting a speed up of about 25%: not bad at all. But then I am wondering why &#8220;Kinderman-Ramage&#8221; is not the default normal RNG. The &#8220;Kenderman-Ramage&#8221; algorithm used to be buggy in <code>R</code>, but it is fixed in recent implementations (see <a href="http://epub.wu.ac.at/dyn/virlib/wp/eng/mediate/epub-wu-01_9f5.pdf?ID=epub-wu-01_9f5">this article</a>).</p>
<p>This is an example of the speed up on my machine:<br />
<code><br />
&gt; RNGkind(normal.kind = 'Inversion')<br />
&gt; system.time(rnorm(1000000))<br />
user  system elapsed<br />
0.125   0.006   0.131</code></p>
<p><code> &gt; RNGkind(normal.kind = 'Kinderman-Ramage')<br />
&gt; system.time(rnorm(1000000))<br />
user  system elapsed<br />
0.06    0.00    0.06<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=17&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2010/07/04/r-random-number-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>
	</item>
		<item>
		<title>Eclipse for R</title>
		<link>http://gragusa.wordpress.com/2010/05/11/eclipse-for-r/</link>
		<comments>http://gragusa.wordpress.com/2010/05/11/eclipse-for-r/#comments</comments>
		<pubDate>Tue, 11 May 2010 17:13:16 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
				<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://gragusa.wordpress.com/?p=10</guid>
		<description><![CDATA[I found this interesting post that discusses using Eclipse, R, and Sweave. I probably should try Eclipse one day.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=10&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I found this interesting <a href="http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html" target="_self">post</a> that discusses using Eclipse, R, and Sweave.</p>
<p>I probably should try Eclipse one day.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=10&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2010/05/11/eclipse-for-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>
	</item>
		<item>
		<title>Strip JSTOR first page</title>
		<link>http://gragusa.wordpress.com/2008/09/13/strip-jstor-first-page/</link>
		<comments>http://gragusa.wordpress.com/2008/09/13/strip-jstor-first-page/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 19:40:51 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
				<category><![CDATA[Apple Script]]></category>

		<guid isPermaLink="false">http://gragusa.wordpress.com/?p=6</guid>
		<description><![CDATA[This simple apple script will strip the first page of a jstor document. It requires Adobe Acrobat to be installed on your machine to run. Copy it in the script editor, save it as an application, and then add it to the Finder as a button. on run tell application "Finder" if selection is {} [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=6&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This simple apple script will strip the first page of a jstor document. It requires Adobe Acrobat to be installed on your machine to run. Copy it in the script editor, save it as an application, and then add it to the Finder as a button. </p>
<p><code>on run<br />
	tell application "Finder"<br />
		if selection is {} then<br />
			quit<br />
		else<br />
			set finderSelection to selection as alias list<br />
		end if<br />
	end tell<br />
	deletepage(finderSelection)<br />
end run<br />
</code></p>
<p><code><br />
on open (theList)<br />
	deletepage(theList)<br />
end open<br />
</code></p>
<p><code><br />
on deletepage(listOfAliases)<br />
	repeat with eachitem in listOfAliases<br />
		tell application "Adobe Acrobat Professional"<br />
			activate<br />
			open eachitem<br />
			set Doc_Ref to the front document<br />
			delete first page<br />
			close Doc_Ref saving yes<br />
		end tell<br />
	end repeat<br />
end deletepage<br />
</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/gragusa.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/gragusa.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=6&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2008/09/13/strip-jstor-first-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>
	</item>
		<item>
		<title>TextMate Emacs-like indentation (for R files)</title>
		<link>http://gragusa.wordpress.com/2007/11/11/textmate-emacs-like-indentation-for-r-files/</link>
		<comments>http://gragusa.wordpress.com/2007/11/11/textmate-emacs-like-indentation-for-r-files/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 09:04:41 +0000</pubDate>
		<dc:creator>gragusa</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://gragusa.wordpress.com/2007/11/11/textmate-emacs-like-indentation-for-r-files/</guid>
		<description><![CDATA[If you use OS X, TextMate is hands down the best editor available for this platform. It integrate perfectly with the OS X environment. While the Project Window is probably the greatest thing about TextMate for the everyday user, its extensibility is what makes it a wonderful companion in editing. The biggest complain I have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=3&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you use OS X, <a href="http://macromates.com/">TextMate</a> is hands down the best editor available for this platform. It integrate perfectly with the OS X environment. While the Project Window is probably the greatest thing about <a href="http://macromates.com/">TextMate</a> for the everyday user, its extensibility is what makes it a wonderful companion in editing.</p>
<p>The biggest complain I have about TextMate is that it does not handle indentation very well. I write a lot of <a href="http://www.r-project.org/">R</a> code and I am used to the indentation provided by <a title="ess" href="http://ess.r-project.org/">ess</a> (Emacs Speak Statistics).  Frustrated, I decided to do something about it. After looking for option I realized that I could combine the feature of Emacs with those of TextMate to improve indentation. In practice I was able to use emacs (with ess) as beckend for the indentation. If you want to try  follow the following steps:</p>
<blockquote><p>1. Install ess (Emacs Speak Statistics) from <a title="ess" href="http://ess.r-project.org" target="_blank">http://ess.r-project.or </a> in /usr/share/emacs/site-lisp;</p>
<p>2. In TextMate go to Bundles|Bundle Editor|Show Bundle Editor&#8230;</p>
<p>3. Create a new command, say Tidy</p>
<p>4.  Add the following script:<br />
<code><br />
#!/usr/bin/perl<br />
my $in;<br />
my $now = "tidyRcode";<br />
my $file = "/tmp/tmptx_${now}.R";<br />
my $eb=$ENV{'TM_BUNDLE_SUPPORT'};<br />
open FILE, "&gt;$file" or die "unable to open $file $!";<br />
while () {<br />
print FILE $_;<br />
}<br />
close(FILE);<br />
`emacs -batch --eval "(require 'ess)" ${file} --eval '(indent-region (point-min) (point-max) nil)' -f ess-fix-miscellaneous -f save-buffer &amp;&gt; /dev/null`;<br />
my $in = `cat ${file}`;<br />
print $in;</code></p>
<p>5. Select the following options:</p>
<ul>
<li>Input: Selected Text or Document;</li>
<li>Output: Replace Selected Text;</li>
<li>Key Equivalent: Shift+Cmd+H;</li>
<li>Scope Selector: source.r</li>
</ul>
<p>You can see the picture below with my setting</p>
<p><a title="TextMate Emacs-like indentation (for R files)" href="http://gragusa.files.wordpress.com/2007/11/picture-4.png"><img src="http://gragusa.files.wordpress.com/2007/11/picture-4.thumbnail.png?w=600" alt="TextMate Emacs-like indentation (for R files)" /></a></p></blockquote>
<p>Now you are ready to go. While you are editing R code, simply select and press Shift+Cmd+H and you will see your code&#8230;.the ess way.</p>
<p>UPDATE: The perl code does not work on Leopard (at least my Leopard with Emacs 22.1.1 + Textmate 1.5.9).</p>
<p>This version in Ruby works:</p>
<blockquote>
<div id="_mcePaste">#!/usr/bin/ruby</div>
<div id="_mcePaste">require &#8220;ftools&#8221;</div>
<div id="_mcePaste"># Handle selection (less useful, probably) or full file.</div>
<div id="_mcePaste">tmp_file = &#8220;/tmp/textmate-tidy.#{$}.R&#8221;</div>
<div id="_mcePaste">selected = ENV['TM_SELECTED_TEXT'] || &#8221;</div>
<div id="_mcePaste">if (selected.empty?)</div>
<div id="_mcePaste">raise(&#8220;No selected text or file.&#8221;) if (ENV['TM_FILEPATH'].empty?)</div>
<div id="_mcePaste">File.copy(ENV['TM_FILEPATH'], tmp_file)</div>
<div id="_mcePaste">else</div>
<div id="_mcePaste">File.open(tmp_file, &#8216;w&#8217;) { |fout| fout.print selected }</div>
<div id="_mcePaste">end</div>
<div id="_mcePaste">user = ENV['USER'] ||&#8221;</div>
<div id="_mcePaste">user_opt = &#8220;-u #{user}&#8221; unless (user.empty?)</div>
<div id="_mcePaste">cmd = &#8220;emacs -u \&#8221;#{user}\&#8221; -batch \&#8221;#{tmp_file}\&#8221; -eval \&#8221;(require &#8216;ess)\&#8221; -eval \&#8221;(indent-region (point-min) (point-max) nil)\&#8221; -f ess-fix-miscellaneous -f save-buffer &amp;&gt; /dev/null&#8221;</div>
<div id="_mcePaste">system(cmd) || raise(&#8220;Failed to indent with Emacs.&#8221;)</div>
<div id="_mcePaste">system(&#8220;cat #{tmp_file}&#8221;)</div>
<div id="_mcePaste">File.delete(tmp_file)</div>
</blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/gragusa.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/gragusa.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gragusa.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gragusa.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gragusa.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gragusa.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gragusa.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gragusa.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gragusa.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gragusa.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gragusa.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gragusa.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gragusa.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gragusa.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gragusa.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gragusa.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gragusa.wordpress.com&amp;blog=2099579&amp;post=3&amp;subd=gragusa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gragusa.wordpress.com/2007/11/11/textmate-emacs-like-indentation-for-r-files/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/65adf361b275e979436c76ca318ae709?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gragusa</media:title>
		</media:content>

		<media:content url="http://gragusa.files.wordpress.com/2007/11/picture-4.thumbnail.png" medium="image">
			<media:title type="html">TextMate Emacs-like indentation (for R files)</media:title>
		</media:content>
	</item>
	</channel>
</rss>
