<?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>Tyson Maly Computer Engineer in Finance &#187; perl</title>
	<atom:link href="http://www.tysonmaly.com/category/programming/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tysonmaly.com</link>
	<description>Computer Engineering and Finance</description>
	<lastBuildDate>Sun, 18 Oct 2009 04:13:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Technical Analysis and Charting with Perl Tk and gnuplot</title>
		<link>http://www.tysonmaly.com/2008/06/01/technical-analysis-and-charting-with-perl-tk-and-gnuplot/</link>
		<comments>http://www.tysonmaly.com/2008/06/01/technical-analysis-and-charting-with-perl-tk-and-gnuplot/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 03:58:16 +0000</pubDate>
		<dc:creator>info</dc:creator>
				<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.tysonmaly.com/?p=37</guid>
		<description><![CDATA[I had a little fun with perl this weekend.  First I compiled the ta-lib which gives you access to all sorts of technical analysis functions like double exponential moving average.  While the library itself does not install the perl module like a typical module off of CPAN, it is easy enough to figure it out [...]]]></description>
			<content:encoded><![CDATA[<p>I had a little fun with perl this weekend.  First I compiled the ta-lib which gives you access to all sorts of technical analysis functions like double exponential moving average.  While the library itself does not install the perl module like a typical module off of CPAN, it is easy enough to figure it out if you know a little bit about perl.  Second thing I did with perl is setup a script to take a file with historical price and volume data and graph it with gnuplot via a Tk interface.  This is really nice since gnuplot has some really great looking financial plots.  Here is a basic plot I created of Sprint since 1984.  What is nice with the x11 terminal and a pipe to gnuplot, you can quickly change the graphs in the window to show some other data.  This beats writing the data out to a file then loading it.</p>
<p><a href="http://www.tysonmaly.com/wp-content/uploads/2008/06/sprint.jpg"><img class="alignnone size-medium wp-image-38" title="sprint" src="http://www.tysonmaly.com/wp-content/uploads/2008/06/sprint-300x221.jpg" alt="" width="300" height="221" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tysonmaly.com/2008/06/01/technical-analysis-and-charting-with-perl-tk-and-gnuplot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kernel Density Estimation with Perl and RSPerl</title>
		<link>http://www.tysonmaly.com/2008/05/12/kernel-density-estimation-with-perl-and-rsperl/</link>
		<comments>http://www.tysonmaly.com/2008/05/12/kernel-density-estimation-with-perl-and-rsperl/#comments</comments>
		<pubDate>Tue, 13 May 2008 04:04:06 +0000</pubDate>
		<dc:creator>info</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[kernel density estimation]]></category>
		<category><![CDATA[probability]]></category>
		<category><![CDATA[RSPerl]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://www.tysonmaly.com/?p=34</guid>
		<description><![CDATA[I recently was searching for a way to do kernel density estimatation.  I came across a module for matlab, but I do not have a copy of matlab.  I tried porting it over to perl, but I was having some problems getting the inverse discrete fourier transforms working in Math::FFT the way I [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was searching for a way to do kernel density estimatation.  I came across a module for matlab, but I do not have a copy of matlab.  I tried porting it over to perl, but I was having some problems getting the inverse discrete fourier transforms working in Math::FFT the way I wanted them to work.  In the end, I ended up compiling the latest version of the R language 2.7.0 and then installing RSPerl which is a bridge to allow you to call R from perl and vice versa.  One of the maintainers helped me out.  There are some environment scripts you should source in your shell rc file first.  Once you have that done, one of the perl modules that came with RSPerl had an extra =cut that I had to take out. The tie call in the RReferences.pm was not needed since no TIESCALAR was ever defined.  After these small changes, the whole thing worked like a charm.  I am including an example here since I did not find anything like it in any of the other examples.  Given a sample of some random variable, this will perform a kernel density estimation using gaussian kernel.  It will create a plot.  Then it will dump the X and Y values seen in the plot to the screen.  You can of course use these values for other things.</p>
<pre>
#!/usr/local/bin/perl -w
use strict;

# stuff to get R started
use R;
use RReferences;
&#038;R::initR("--silent");

# sample of random variable
my $x = [1,2,2,3];

# do the kernel density estimation  $h will be the reference to the result
my $h = &#038;R::callWithNames("density", {'x',$x,'kernel','gaussian','na.rm','TRUE'});

# plot the result
&#038;R::callWithNames("plot", {'x',$h,'main','gaussian'});

# sleep for a few seconds so the plot window does not vanish
sleep(3);

# get the x values from the result object
my @xv = $h->getEl('x');

# get the y values from the result object
my @yv = $h->getEl('y');

print "X values\n";
print join("\n",@xv) . "\n";

print "Y values\n";
print join("\n",@yv) . "\n";
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tysonmaly.com/2008/05/12/kernel-density-estimation-with-perl-and-rsperl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto Update your CPAN modules</title>
		<link>http://www.tysonmaly.com/2008/03/28/auto-update-your-cpan-modules/</link>
		<comments>http://www.tysonmaly.com/2008/03/28/auto-update-your-cpan-modules/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 19:57:33 +0000</pubDate>
		<dc:creator>info</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.tysonmaly.com/2008/03/28/auto-update-your-cpan-modules/</guid>
		<description><![CDATA[I was looking across some perlmonks posting, and I came across a reply to a post that seemed useful.  Putting this in a crontab will automatically update the CPAN modules  that you have installed in your system.
perl -MCPAN -e 'CPAN::Shell-&#62;install(CPAN::Shell-&#62;r)'
]]></description>
			<content:encoded><![CDATA[<p>I was looking across some perlmonks posting, and I came across a reply to a post that seemed useful.  Putting this in a crontab will automatically update the CPAN modules  that you have installed in your system.</p>
<pre class="code"><font><tt><font><font size="2"><tt class="codetext"><font size="-1">perl -MCPAN -e 'CPAN::Shell-&gt;install(CPAN::Shell-&gt;r)'</font></tt></font></font></tt></font></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tysonmaly.com/2008/03/28/auto-update-your-cpan-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>parsing Outlook emails in a PST file with perl on windows xp</title>
		<link>http://www.tysonmaly.com/2008/03/26/parsing-outlook-emails-in-a-pst-file-with-perl-on-windows-xp/</link>
		<comments>http://www.tysonmaly.com/2008/03/26/parsing-outlook-emails-in-a-pst-file-with-perl-on-windows-xp/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 19:54:40 +0000</pubDate>
		<dc:creator>info</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[redemption]]></category>
		<category><![CDATA[strawberry]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.tysonmaly.com/2008/03/26/parsing-outlook-emails-in-a-pst-file-with-perl-on-windows-xp/</guid>
		<description><![CDATA[I wanted to make a program to scan a particular folder in my outlook 2003 that holds messages placed there by a rule.  However, due to outlook security, a pop up appears to confirm access to outlook when you try to access the emails.  This is a major roadblock to automating email access [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to make a program to scan a particular folder in my outlook 2003 that holds messages placed there by a rule.  However, due to outlook security, a pop up appears to confirm access to outlook when you try to access the emails.  This is a major roadblock to automating email access on windows xp.  I could not find  a clear example on the web that used another pst file so I created this example.  I hope this helps someone out down the line.</p>
<p>There is a solution called Outlook Redemption that solved the pop-up problem for me.  You can install a copy on windows from the site http://www.dimastr.com/redemption/ .</p>
<p>Once you have this installed, make sure you have a copy of strawberry perl http://strawberryperl.com/ .  I happen to use version 5.8 but I will switch to 5.10 soon.    With this installed, you will also need the module  Win32 installed, but this is easy since you can install perl modules with CPAN on windows when you have strawberry perl setup.</p>
<p>Here is the code that scans a different pst file called otherpst  and a folder within that pst file called scanme</p>
<p>#!perl   # windows notation</p>
<p>use strict;<br />
use Win32::OLE;<br />
use Win32::OLE::Const;<br />
use Win32::OLE::Const &#8216;Microsoft Outlook&#8217;;<br />
my $outlook;<br />
eval {<br />
$outlook = Win32::OLE-&gt;GetActiveObject(&#8217;Outlook.Application&#8217;)<br />
};<br />
if ($@ || !defined($outlook)) {<br />
$outlook = Win32::OLE-&gt;new(&#8217;Outlook.Application&#8217;, sub {$_[0]-&gt;Quit;})<br />
or die(&#8221;Cannot create outlook\n&#8221;);<br />
}</p>
<p>my $namespace = $outlook-&gt;GetNamespace(&#8217;MAPI&#8217;);</p>
<p># get the proper pst file<br />
my $folder = $namespace-&gt;{&#8217;Folders&#8217;}{&#8217;otherpst&#8217;};</p>
<p># now get the folder within the pst file<br />
my $folder2 = $folder-&gt;{&#8217;Folders&#8217;}{&#8221;scanme&#8221;};</p>
<p># get all the messages<br />
my $msgs = $folder2-&gt;{Items};</p>
<p># a count of the number of messages in the folder</p>
<p>my $ncon = $msgs-&gt;{Count};</p>
<p># a redemption object that stops the annoying popup</p>
<p>my $tysonmaly = new Win32::OLE(&#8217;Redemption.SafeMailItem&#8217;);</p>
<p>my $con;</p>
<p># for each message in the scanme folder print the body out to STDOUT</p>
<p>foreach my $ii (1 .. $ncon) {<br />
$con = $msgs-&gt;Item($ii);<br />
$tysonmaly-&gt;{&#8217;Item&#8217;} = $con;</p>
<p># you can access other  things like the subject or sent time or sender but this just shows body access</p>
<p>print $tysonmaly-&gt;{Body} . &#8220;\n&#8221;;</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tysonmaly.com/2008/03/26/parsing-outlook-emails-in-a-pst-file-with-perl-on-windows-xp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
