<?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"
	>

<channel>
	<title>random()</title>
	<atom:link href="http://blog.maxgarfinkel.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.maxgarfinkel.com</link>
	<description>All sorts, who knows?</description>
	<pubDate>Sun, 06 Jul 2008 21:41:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Visualize txt files with particles</title>
		<link>http://blog.maxgarfinkel.com/archives/33</link>
		<comments>http://blog.maxgarfinkel.com/archives/33#comments</comments>
		<pubDate>Sun, 06 Jul 2008 21:41:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[learning Java]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/?p=33</guid>
		<description><![CDATA[learning Java rolls on. Building on my last experiment I have created an app that can read in a text file and then map the words to particles ordered by their number of occurrences within the text.
javagraphics
You need to pass a link to a txt file when launching from the command line like this
java -jar [...]]]></description>
			<content:encoded><![CDATA[<p>learning Java rolls on. Building on my last experiment I have created an app that can read in a text file and then map the words to particles ordered by their number of occurrences within the text.</p>
<p><a href="http://blog.maxgarfinkel.com/wp-uploads/2008/07/javagraphics.jar">javagraphics</a></p>
<p>You need to pass a link to a txt file when launching from the command line like this</p>
<p>java -jar javagraphics.jar someText.txt</p>
<p>The bible is easy to get hold of as a txt file as was war and peace. This is still very much a badly written toy but I hope to develop it more.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/33/feed</wfw:commentRss>
		</item>
		<item>
		<title>Giving Java a go!</title>
		<link>http://blog.maxgarfinkel.com/archives/31</link>
		<comments>http://blog.maxgarfinkel.com/archives/31#comments</comments>
		<pubDate>Sun, 29 Jun 2008 21:04:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[learning Java]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/?p=31</guid>
		<description><![CDATA[Thought I would give Java a go today, wanted to try something I might do with flash and compare to see how much harder/time consuming it might be Vs how much more power you can get from Java. Well first results are in, and I was surprised to find it didn&#8217;t take much longer and [...]]]></description>
			<content:encoded><![CDATA[<p>Thought I would give Java a go today, wanted to try something I might do with flash and compare to see how much harder/time consuming it might be Vs how much more power you can get from Java. Well first results are in, and I was surprised to find it didn&#8217;t take much longer and was MUCH more powerful. I was using <a href="http://www.netbeans.org/" target="_blank">NetBeans</a> which is a very nice IDE. The piece is a particle field and I was originaly able to crank it up to 500,000 particles, the frame rate dropped but it was still under a frame a second on a 2.16 ghz Macbook Pro. I tried for a 1,000,000 partcles but it ran out of heap space, although I think there is probably a way around that. Well compared to flash this is amazing you could never get performance like that.<br />
It seems to me that not everything is going to be as easy as in flash but that the performance will make up<br />
for the difficulty. I will have to leave it there for now but hope to play some more soon! Here is the experiment for those interested. <a href="http://blog.maxgarfinkel.com/wp-uploads/2008/06/javagraphics.jar"> javagraphics</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/31/feed</wfw:commentRss>
		</item>
		<item>
		<title>Bash: Deleting a directory</title>
		<link>http://blog.maxgarfinkel.com/archives/30</link>
		<comments>http://blog.maxgarfinkel.com/archives/30#comments</comments>
		<pubDate>Thu, 26 Jun 2008 13:47:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Bash Linux &amp; Apache]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/?p=30</guid>
		<description><![CDATA[rm -r /directory/
]]></description>
			<content:encoded><![CDATA[<p>rm -r /directory/</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/30/feed</wfw:commentRss>
		</item>
		<item>
		<title>Bash: Get folder size</title>
		<link>http://blog.maxgarfinkel.com/archives/29</link>
		<comments>http://blog.maxgarfinkel.com/archives/29#comments</comments>
		<pubDate>Thu, 26 Jun 2008 13:35:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Bash Linux &amp; Apache]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/?p=29</guid>
		<description><![CDATA[du - estimate file space usage
du -options /path/to/file/or/folder

 -a all files, write out all files with there size.
 -h human readable e.g. 100k or 2M or 3G, etc
-s summarize, just the total.

e.g.

du -sh

 would output the size of the current directory.
]]></description>
			<content:encoded><![CDATA[<p><strong>du</strong> - estimate file space usage<br />
du -options /path/to/file/or/folder</p>
<ul>
<li> -a all files, write out all files with there size.</li>
<li> -h human readable e.g. 100k or 2M or 3G, etc</li>
<li>-s summarize, just the total.</li>
</ul>
<p>e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">du</span> -sh</pre></div></div>

<p> would output the size of the current directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/29/feed</wfw:commentRss>
		</item>
		<item>
		<title>Actionscript tree</title>
		<link>http://blog.maxgarfinkel.com/archives/20</link>
		<comments>http://blog.maxgarfinkel.com/archives/20#comments</comments>
		<pubDate>Mon, 02 Jun 2008 21:16:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/archives/20</guid>
		<description><![CDATA[Just finished an Actionscript tree. Its still not 100% right, there are some little details I want to sort out. It can be extremely processing intensive so it is possible to cause it to hang by making it iterate too much or have too many branches so be warned. I have set the time out [...]]]></description>
			<content:encoded><![CDATA[<p>Just finished an <a href="http://blog.maxgarfinkel.com/wp-uploads/2008/06/leaf_02.swf" target="_blank">Actionscript tree</a>. Its still not 100% right, there are some little details I want to sort out. It can be extremely processing intensive so it is possible to cause it to hang by making it iterate too much or have too many branches so be warned. I have set the time out period to 30 seconds so if you haven&#8217;t got a tree in 30 seconds, you broke it! The other point of note is that angle is in radians. Angles controls the angle at which the branches come off. Any who, enough talking, <a title="Actionscript tree" href="http://blog.maxgarfinkel.com/wp-uploads/2008/06/leaf_02.swf" target="_blank">here</a> it is. When I get a chance to, I will neaten up the code and post it up. Those of you who are observant may notice the swf is actulay called leaf_02.swf, this is &#8216;cos it was I started out wanting to draw a leaf, but that is harder than I thought (Not given up yet though :-)), so hopefully the next post will be a leaf!</p>
<p>Sorcecode for those interested - Not object oriented and almost no comments</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #000000; font-weight: bold;">function</span> bezierPoint<span style="color: #66cc66;">&#40;</span>origin:Point, <span style="color: #0066CC;">control</span>:Point, <span style="color: #0066CC;">end</span>:Point, loc:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:Point
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> p1:Point = Point.<span style="color: #006600;">interpolate</span><span style="color: #66cc66;">&#40;</span>origin, <span style="color: #0066CC;">control</span>, loc<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> p2:Point = Point.<span style="color: #006600;">interpolate</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">control</span>, <span style="color: #0066CC;">end</span>, loc<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> p:Point = Point.<span style="color: #006600;">interpolate</span><span style="color: #66cc66;">&#40;</span>p1, p2, loc<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> p;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> endPoint<span style="color: #66cc66;">&#40;</span>angle:<span style="color: #0066CC;">Number</span>, hypontinuse:<span style="color: #0066CC;">Number</span>, origin:Point<span style="color: #66cc66;">&#41;</span>:Point
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> ret:Point = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>hypontinuse<span style="color: #66cc66;">&#41;</span>+ origin.<span style="color: #006600;">x</span>, <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>hypontinuse<span style="color: #66cc66;">&#41;</span>+origin.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> ret;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> controlPoint<span style="color: #66cc66;">&#40;</span>origin:Point, hyp:<span style="color: #0066CC;">Number</span>, angle:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:Point
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> a:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">3.14159265</span> + <span style="color: #66cc66;">&#40;</span>angle + <span style="color: #cc66cc;">1.57079633</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">end</span>:Point = endPoint<span style="color: #66cc66;">&#40;</span>a , hyp, origin<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">end</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> drawBranch<span style="color: #66cc66;">&#40;</span>origin:Point, angle:<span style="color: #0066CC;">Number</span>, <span style="color: #0066CC;">size</span>:<span style="color: #0066CC;">Number</span>, <span style="color: #0066CC;">color</span>:<span style="color: #0066CC;">Number</span>, childNo:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> returnData = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> branch:Shape = <span style="color: #000000; font-weight: bold;">new</span> Shape<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">end</span>:Point = endPoint<span style="color: #66cc66;">&#40;</span>angle, <span style="color: #0066CC;">size</span>, origin<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">control</span>:Point = controlPoint<span style="color: #66cc66;">&#40;</span>Point.<span style="color: #006600;">interpolate</span><span style="color: #66cc66;">&#40;</span>origin,<span style="color: #0066CC;">end</span>,<span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span>, Point.<span style="color: #006600;">distance</span><span style="color: #66cc66;">&#40;</span>origin, <span style="color: #0066CC;">end</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">6</span>, angle<span style="color: #66cc66;">&#41;</span>;
	branch.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">color</span><span style="color: #66cc66;">&#41;</span>;
	branch.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</span>,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
	branch.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span>origin.<span style="color: #006600;">x</span>, origin.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>;
	branch.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">control</span>.<span style="color: #006600;">x</span>, <span style="color: #0066CC;">control</span>.<span style="color: #006600;">y</span>, <span style="color: #0066CC;">end</span>.<span style="color: #006600;">x</span>, <span style="color: #0066CC;">end</span>.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> thickEnd:Point = controlPoint<span style="color: #66cc66;">&#40;</span>origin, <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">size</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span>childNo, angle<span style="color: #66cc66;">&#41;</span>;
	branch.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">control</span>.<span style="color: #006600;">x</span>, <span style="color: #0066CC;">control</span>.<span style="color: #006600;">y</span>, thickEnd.<span style="color: #006600;">x</span>, thickEnd.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>;
	branch.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span>origin.<span style="color: #006600;">x</span>, origin.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>;
	returnData.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>branch<span style="color: #66cc66;">&#41;</span>;
	returnData.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">control</span><span style="color: #66cc66;">&#41;</span>;
	returnData.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">end</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> returnData;
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> drawTree<span style="color: #66cc66;">&#40;</span>origin, angle, <span style="color: #0066CC;">size</span>, depth, factor, fixedAngle, frequency, childNo<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>depth <span style="color: #66cc66;">&lt;</span>= <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #b1b100;">return</span>;
	<span style="color: #808080; font-style: italic;">//draw branch</span>
	<span style="color: #000000; font-weight: bold;">var</span> branch:<span style="color: #0066CC;">Array</span> = drawBranch<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>origin.<span style="color: #006600;">x</span>, origin.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>, angle, <span style="color: #0066CC;">size</span>, 0x514837, childNo<span style="color: #66cc66;">&#41;</span>;
	holder.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>branch<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">//find start, end, control</span>
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">1</span>; i <span style="color: #66cc66;">&lt;</span>= frequency; i++<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> randSeed:<span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">+0.75</span>;
		<span style="color: #000000; font-weight: bold;">var</span> frequencySeed:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">-1</span>
		<span style="color: #000000; font-weight: bold;">var</span> newAngle:<span style="color: #0066CC;">Number</span>;
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>i <span style="color: #66cc66;">%</span> <span style="color: #cc66cc;">2</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
			newAngle = <span style="color: #66cc66;">&#40;</span>angle+fixedAngle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>randSeed;
		<span style="color: #b1b100;">else</span>
			newAngle = <span style="color: #66cc66;">&#40;</span>angle-fixedAngle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>randSeed;
		<span style="color: #000000; font-weight: bold;">var</span> offset:<span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">/</span>frequency<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>i<span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">/</span>frequency<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> newOrigin:Point = bezierPoint<span style="color: #66cc66;">&#40;</span>origin, branch<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>, branch<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>, offset<span style="color: #66cc66;">&#41;</span>;
		drawTree<span style="color: #66cc66;">&#40;</span>newOrigin, newAngle, <span style="color: #0066CC;">size</span><span style="color: #66cc66;">/</span>factor, depth<span style="color: #cc66cc;">-1</span>, factor, fixedAngle, frequency+frequencySeed, <span style="color: #66cc66;">&#40;</span>frequency-i<span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">+1</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> p:Point = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">400</span>,<span style="color: #cc66cc;">550</span><span style="color: #66cc66;">&#41;</span>;
drawTree<span style="color: #66cc66;">&#40;</span>p, <span style="color: #cc66cc;">-1.5</span>, <span style="color: #cc66cc;">200</span>, <span style="color: #cc66cc;">8</span>, <span style="color: #cc66cc;">1.5</span>, <span style="color: #cc66cc;">0.7</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
drawTreeBtn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, createManager<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">function</span> createManager<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> len = len.<span style="color: #006600;">getLineText</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> depth = dep.<span style="color: #006600;">getLineText</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> frequency = freq.<span style="color: #006600;">getLineText</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> factor = fac.<span style="color: #006600;">getLineText</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> angle = angle.<span style="color: #006600;">getLineText</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #808080; font-style: italic;">//fix for typing issues caused by input</span>
	<span style="color: #000000; font-weight: bold;">var</span> length1:<span style="color: #0066CC;">Number</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>len<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> depth1:<span style="color: #0066CC;">Number</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>depth<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> frequency1:<span style="color: #0066CC;">Number</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>frequency<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> factor1:<span style="color: #0066CC;">Number</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>factor<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> angle1:<span style="color: #0066CC;">Number</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = holder.<span style="color: #006600;">numChildren</span><span style="color: #cc66cc;">-1</span>; i <span style="color: #66cc66;">&gt;</span>= <span style="color: #cc66cc;">0</span>; i--<span style="color: #66cc66;">&#41;</span>
		holder.<span style="color: #006600;">removeChildAt</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>;
	drawTree<span style="color: #66cc66;">&#40;</span>p, <span style="color: #cc66cc;">-1.5</span>, length1, depth1, factor1, angle1, frequency1, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/20/feed</wfw:commentRss>
		</item>
		<item>
		<title>Nice little generative animation (cpu heavy)</title>
		<link>http://blog.maxgarfinkel.com/archives/15</link>
		<comments>http://blog.maxgarfinkel.com/archives/15#comments</comments>
		<pubDate>Mon, 26 May 2008 21:47:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/archives/15</guid>
		<description><![CDATA[It may take a while to become visible as the background sometimes starts off white (click to view).
Some screen grabs of nice states of an earlier version.


]]></description>
			<content:encoded><![CDATA[<p>It may take a while to become visible as the background sometimes starts off white (<a href="http://blog.maxgarfinkel.com/wp-uploads/2008/06/particles.swf" target="_blank">click to view</a>).</p>
<p>Some screen grabs of nice states of an earlier version.</p>
<p><a href="http://blog.maxgarfinkel.com/wp-uploads/2008/06/blue.jpg"><img class="alignnone size-full wp-image-25" title="blue" src="http://blog.maxgarfinkel.com/wp-uploads/2008/06/blue.jpg" alt="" width="500" height="358" /></a></p>
<p><a href="http://blog.maxgarfinkel.com/wp-uploads/2008/06/red.jpg"><img class="alignnone size-full wp-image-26" title="red" src="http://blog.maxgarfinkel.com/wp-uploads/2008/06/red.jpg" alt="" width="500" height="359" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/15/feed</wfw:commentRss>
		</item>
		<item>
		<title>Temporarily disabled comments</title>
		<link>http://blog.maxgarfinkel.com/archives/12</link>
		<comments>http://blog.maxgarfinkel.com/archives/12#comments</comments>
		<pubDate>Tue, 26 Jun 2007 08:24:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/archives/12</guid>
		<description><![CDATA[Some mofos&#8217; are relentlessly spamming the comments, so I&#8217;m gonna turn them off for a bit and see if that stops &#8216;em. Wankers!
]]></description>
			<content:encoded><![CDATA[<p>Some mofos&#8217; are relentlessly spamming the comments, so I&#8217;m gonna turn them off for a bit and see if that stops &#8216;em. Wankers!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/12/feed</wfw:commentRss>
		</item>
		<item>
		<title>bash session killer</title>
		<link>http://blog.maxgarfinkel.com/archives/11</link>
		<comments>http://blog.maxgarfinkel.com/archives/11#comments</comments>
		<pubDate>Sat, 12 May 2007 13:52:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Bash Linux &amp; Apache]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/archives/11</guid>
		<description><![CDATA[I ran into a problem with a site I&#8217;m  building that will run on shared hosting. I wanted to use sessions in php but because of the hosting my sessions kept being unexpectedly ended. The solution was to define a new folder on the server for the sessions to be stored in. This was [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem with a site I&#8217;m  building that will run on shared hosting. I wanted to use sessions in php but because of the hosting my sessions kept being unexpectedly ended. The solution was to define a new folder on the server for the sessions to be stored in. This was done with the php.ini configuration file.</p>
<p>However this lead to another problem - the session files just seemed to get left on the server. As I understand it this is because the garbage collection mechanism in php won&#8217;t work if you change the folder where session files are stored.</p>
<p>The solution was in a little bit of BASH scripting. Basically the script is run by the cron tab at a sensible interval. When it runs it checks the directory specified and deletes anything older than the number of mins specified.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash"><span style="color: #666666; font-style: italic;">#! /bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>folder<span style="color: #000000; font-weight: bold;">/</span>; <span style="color: #c20cb9; font-weight: bold;">find</span> -cmin <span style="color: #000000;">+60</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span></pre></td></tr></table></div>

<p>A word of warning, make sure you get the path right. First time round I didn&#8217;t and it deleted EVERYTHING it could on my server. I lost all development work and a live site. So back up and use with caution. Still at least it proved my backup strategy works <img src='http://blog.maxgarfinkel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Don&#8217;t forget to make the .sh file executable (744) did it for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/11/feed</wfw:commentRss>
		</item>
		<item>
		<title>Rewriting URLs or mod_rewrite</title>
		<link>http://blog.maxgarfinkel.com/archives/10</link>
		<comments>http://blog.maxgarfinkel.com/archives/10#comments</comments>
		<pubDate>Thu, 26 Apr 2007 21:13:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Bash Linux &amp; Apache]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/archives/10</guid>
		<description><![CDATA[I started work on creating search engine friendly urls today with the help of the apache webservers mod_rewrite functions. Turned out to be both harder and easier than I expected! A great help was the site modrewrite.com.
I want to write properly about what I found out today but its a tad late so I save [...]]]></description>
			<content:encoded><![CDATA[<p>I started work on creating search engine friendly urls today with the help of the apache webservers mod_rewrite functions. Turned out to be both harder and easier than I expected! A great help was the site <a href="http://www.modrewrite.com/" title="A forum and informational site on mod_rewrite" target="_blank">modrewrite.com</a>.</p>
<p>I want to write properly about what I found out today but its a tad late so I save that for the next post. Just as a reminder to myself though remember you will need to cover <a href="http://en.wikipedia.org/wiki/Regular_expression" title="Yikeees an in depth explaination" target="_blank">regular expressions</a>, using multiple rules to catch different variable arrangements, and the knock on problems of a rewrite rule - namely loading images, style sheets and javascripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/10/feed</wfw:commentRss>
		</item>
		<item>
		<title>Bash backup scripts including mysql backup</title>
		<link>http://blog.maxgarfinkel.com/archives/9</link>
		<comments>http://blog.maxgarfinkel.com/archives/9#comments</comments>
		<pubDate>Thu, 12 Apr 2007 21:02:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Bash Linux &amp; Apache]]></category>

		<guid isPermaLink="false">http://blog.maxgarfinkel.com/archives/9</guid>
		<description><![CDATA[I run a few database-driven sites and when I developed them I needed a  script to back up the uploaded files and database. To make restoring the site easier, I basically just archived the whole site including the database. My back-up strategy was two part:
Part one:
A script on the web-server dumps the database into [...]]]></description>
			<content:encoded><![CDATA[<p>I run a few database-driven sites and when I developed them I needed a  script to back up the uploaded files and database. To make restoring the site easier, I basically just archived the whole site including the database. My back-up strategy was two part:</p>
<p>Part one:</p>
<p>A script on the web-server dumps the database into a text-file, and then combines that with a copy of the website contents and creates a compressed archive. I rename the last archive, if it exists, and delete any older ones. This means I only ever keep 2 back-ups on the live server. This script is controlled by the <a title="wikipedia entry" href="http://en.wikipedia.org/wiki/Crontab" target="_blank">cron tab</a>.</p>
<p>Part two:</p>
<p>A script on my machine at home, again controlled by the cron tab, executes. This connects to the remote server, and downloads the archive via <a title="wikipedia entry" href="http://en.wikipedia.org/wiki/Secure_copy">scp</a>, naming the archive using the current date.</p>
<p>It&#8217;s a fairly low-tech solution, but its simple and it works for me. The only tricky bit was setting up <a title="good tutorial" href="http://nosheep.net/story/password-less-ssh-login/" target="_blank">passwordless ssh login</a> so the script in part 2 could access the live server. It was a tad involved but I used the instructions <a title="good tutorial" href="http://nosheep.net/story/password-less-ssh-login/" target="_blank">here</a>. Also don&#8217;t forget to make the script exicutable!</p>
<p>Script one (Sits on the remote server)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="bash">&nbsp;
<span style="color: #666666; font-style: italic;">#! /bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#Variables</span>
<span style="color: #007800;">directory_to_backup=</span><span style="color: #ff0000;">&quot;/dir/on/remote/server&quot;</span>
<span style="color: #007800;">backup_name=</span><span style="color: #ff0000;">&quot;/path/and/name/of/archive1.tar&quot;</span>
<span style="color: #007800;">backup_old=</span><span style="color: #ff0000;">&quot;/path/and/name/of/archive2.tar&quot;</span>
<span style="color: #007800;">db=</span><span style="color: #ff0000;">&quot;/path/and/name/of/database/archive.tar&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If old backup exists remove it</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -e <span style="color: #007800;">$backup_name</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -e <span style="color: #007800;">$backup_old</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
    <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$backup_old</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$backup_name</span> <span style="color: #007800;">$backup_old</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;"># dump the DB</span>
mysqldump -u yourDbUsername -pyourDbPassword -h databaseHostName databaseName <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$db</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># create archive</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -e dbbackup.sql <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #c20cb9; font-weight: bold;">tar</span> -czvf <span style="color: #007800;">$backup_name</span> <span style="color: #007800;">$directory_to_backup</span> <span style="color: #007800;">$db</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #c20cb9; font-weight: bold;">tar</span> -czvf <span style="color: #007800;">$backup_name</span> <span style="color: #007800;">$directory_to_backup</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#remove DB backup</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$db</span></pre></td></tr></table></div>

<p>Script two (sits on backup server)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash"><span style="color: #666666; font-style: italic;">#! /bin/bash</span>
<span style="color: #007800;">filename=</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>y.<span style="color: #000000; font-weight: bold;">%</span>m.<span style="color: #000000; font-weight: bold;">%</span>d.<span style="color: #c20cb9; font-weight: bold;">tar</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">scp</span> USERNAME<span style="color: #000000; font-weight: bold;">@</span>HOST.COM:<span style="color: #000000; font-weight: bold;">/</span>remote<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #7a0874; font-weight: bold;">local</span><span style="color: #000000; font-weight: bold;">/</span>copy<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$filename</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.maxgarfinkel.com/archives/9/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
