<?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>Limina.Log &#187; Programming</title>
	<atom:link href="http://log.liminastudio.com/tag/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://log.liminastudio.com</link>
	<description>The Limina.Studio weblog: Art, Design and Development</description>
	<lastBuildDate>Wed, 08 Sep 2010 16:32:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Photoshop to Flash: Best Practices</title>
		<link>http://log.liminastudio.com/programming/photoshop-to-flash-best-practices</link>
		<comments>http://log.liminastudio.com/programming/photoshop-to-flash-best-practices#comments</comments>
		<pubDate>Fri, 09 Jul 2010 21:22:39 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Photoshop]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=651</guid>
		<description><![CDATA[Building out a Flash interface from a PSD can be a time consuming process, so to make things most efficient, here are some handy guidelines for preparing Photoshop files.  Designers may want to duplicate their PSD and save it as a new file specifically for Flash import if they want to keep extra hidden layers, [...]]]></description>
			<content:encoded><![CDATA[<p>Building out a Flash interface from a PSD can be a time consuming process, so to make things most efficient, here are some handy guidelines for preparing Photoshop files.  Designers may want to duplicate their PSD and save it as a new file specifically for Flash import if they want to keep extra hidden layers, etc..</p>
<ul>
<li>Turn off or delete all unused or irrelevant layers.</li>
<li>Merge all adjustment layers or masks into regular layers.  Masked layers or groups cannot be used!</li>
<li>Layer effects are OK!  However, if you turn one off and don&#8217;t plan on using it at all, make sure you remove the effect by dragging it onto the trash icon in the Layers palette.</li>
<li>Vector graphics are <em>always</em> preferred!  If you are using Illustrator to design any assets, please provide the Illustrator file too, as Flash cannot import Smart Vector Objects.</li>
<li>Vector graphics are especially preferred for layers intended to be animated.  Imported bitmaps will often look shoddy and low-resolution when moving around and rotating.</li>
<li>If an Illustrator file can&#8217;t be provided, rasterize any Smart Vector Objects or other non-standard layers.</li>
<li>Keep groups and layers orderly and named accurately whenever possible <img src='http://log.liminastudio.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/programming/photoshop-to-flash-best-practices/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Error #2078 with no code</title>
		<link>http://log.liminastudio.com/programming/flash-error-2078-with-no-code</link>
		<comments>http://log.liminastudio.com/programming/flash-error-2078-with-no-code#comments</comments>
		<pubDate>Fri, 25 Jun 2010 20:28:50 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=635</guid>
		<description><![CDATA[I was getting this error: Error #2078: The name property of a Timeline-placed object cannot be modified. &#8230;even though I had no code addressing any Timeline-placed objects. What gived? I was trying to give an instance name of &#8220;name&#8221; to the object. Change it and you&#8217;re good. Word to the wise!]]></description>
			<content:encoded><![CDATA[<p>I was getting this error:</p>
<pre>Error #2078: The name property of a Timeline-placed object cannot be modified.</pre>
<p>&#8230;even though I had no code addressing any Timeline-placed objects.  What gived?  I was trying to give an instance name of &#8220;name&#8221; to the object.  Change it and you&#8217;re good.  Word to the wise!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/programming/flash-error-2078-with-no-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>byteSlice()</title>
		<link>http://log.liminastudio.com/itp/byteslice</link>
		<comments>http://log.liminastudio.com/itp/byteslice#comments</comments>
		<pubDate>Sat, 01 May 2010 03:17:33 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thesis]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=605</guid>
		<description><![CDATA[Here&#8217;s a weird little function I just wrote to &#8220;slice&#8221; an integer out of a byte: int byteSlice(byte input, byte startIndex, byte endIndex){ // generates an integer value from an arbitrary slice of a byte // Example: // // index: 01234567 // input = B01101100 (int 108) // // startIndex = 1 // endIndex = [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a weird little function I just wrote to &#8220;slice&#8221; an integer out of a byte:</p>
<pre>int byteSlice(byte input, byte startIndex, byte endIndex){

  // generates an integer value from an arbitrary slice of a byte
  // Example:
  //
  // index:   01234567
  // input = B01101100 (int 108)
  //
  // startIndex = 1
  // endIndex = 4
  // slice = B1101
  // returns int 13

  byte output;

  // shift left to shave off bits before startIndex
  output = input << startIndex;
  // shift right to shave off bits after endIndex
  output = output >> (7-endIndex) + startIndex;

  return int(output);
}</pre>
<p>This basically takes out a chunk of a byte and gives you the integer representation of its bits.  The input index byte datatypes are a neurotic memory optimization, since the indices can&#8217;t be greater than 7. <img src='http://log.liminastudio.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   Example Arduino implementation:</p>
<pre>void setup(){

  Serial.begin(9600);
  byte in = 108;

  Serial.print(in, DEC);
  Serial.print("\t");
  Serial.println(in, BIN);
  Serial.println("----------------");
  Serial.print(byteSlice(in, 0, 7), DEC);
  Serial.print("\t");
  Serial.println(byteSlice(in, 0, 7), BIN);
  Serial.println("----------------");
  Serial.print(byteSlice(in, 1, 4), DEC);
  Serial.print("\t");
  Serial.println(byteSlice(in, 1, 4), BIN);
  Serial.println("----------------");
  Serial.print(byteSlice(in, 3, 6), DEC);
  Serial.print("\t");
  Serial.println(byteSlice(in, 3, 6), BIN);
}

void loop(){
}</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/byteslice/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting a byte to an array and vice-versa</title>
		<link>http://log.liminastudio.com/itp/converting-a-byte-to-an-array-and-vice-versa</link>
		<comments>http://log.liminastudio.com/itp/converting-a-byte-to-an-array-and-vice-versa#comments</comments>
		<pubDate>Mon, 19 Apr 2010 00:48:00 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thesis]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[Bitmath]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=596</guid>
		<description><![CDATA[Here are two super-useful Arduino utility functions I just devised for my thesis: byte arrayToByte(int arr[], int len){ // Convert -1 to 0 and pack the array into a byte int i; byte result = 0; for(i=len-1; i&#62;=0; i--){ if(arr[i] == -1){ result &#38;= ~(0 &#60;&#60; i); } else { result &#124;= (1 &#60;&#60; i); [...]]]></description>
			<content:encoded><![CDATA[<p>Here are two super-useful Arduino utility functions I just devised for my thesis:</p>
<pre>byte arrayToByte(int arr[], int len){
  // Convert -1 to 0 and pack the array into a byte
  int i;
  byte result = 0;

  for(i=len-1; i&gt;=0; i--){
    if(arr[i] == -1){
      result &amp;= ~(0 &lt;&lt; i);
    } else {
      result |= (1 &lt;&lt; i);
    }
  }
  return result;
}</pre>
<pre>int* byteToArray(byte in){
  int i, temp, out[8];

  for(i=0; i&lt;8; i++){     temp = (in &gt;&gt; i) &amp; 1;
    if(temp == 0) temp = -1;
    out[i] = temp;
  }
  return out;
}</pre>
<p>The first function takes in an array of up to 8 integers valued 1 or -1 and generates a corresponding byte; the second does the reverse.  Easy to modify for other integer values.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/converting-a-byte-to-an-array-and-vice-versa/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementing the Perceptron Rule</title>
		<link>http://log.liminastudio.com/itp/implementing-the-perceptron-rule</link>
		<comments>http://log.liminastudio.com/itp/implementing-the-perceptron-rule#comments</comments>
		<pubDate>Sat, 17 Apr 2010 21:41:52 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Learning Bit by Bit]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thesis]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Neural Networks]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=586</guid>
		<description><![CDATA[A perceptron is one of the simplest forms of neural networks: a linear classifier.  It is a method of associating input patterns with output patterns, with the advantage that it is forgiving of noise in the input. The network consists of an input and output layer (and optional &#8220;hidden&#8221; layers in between) with weighted connections [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://en.wikipedia.org/wiki/Perceptron">perceptron</a> is one of the simplest forms of neural networks: a <a href="http://en.wikipedia.org/wiki/Linear_classifier">linear classifier</a>.  It is a method of associating input patterns with output patterns, with the advantage that it is forgiving of noise in the input.</p>
<p>The network consists of an input and output layer (and optional &#8220;hidden&#8221; layers in between) with weighted connections between all of them.  To train a perceptron, you present an input pattern and the output pattern it should learn to output.  Then you step through each pair of neurons in each pair of layers and modify their weights with this equation:</p>
<p>∆w<sub>i</sub> = c (d &#8211; sign( ∑x<sub>i</sub>w<sub>i</sub>)) x<sub>i</sub></p>
<p>&#8230;where w<sub>i</sub> is the ith weight (real-valued), c is the learning constant (i.e. 0.1), d is the desired output for this node (1 or -1), and x<sub>i</sub> is the input activation (1 or -1).  The input activation term indicates that the input node in question &#8220;contributes&#8221; to the output or &#8220;inhibits&#8221; it.  sign() is given by:</p>
<p>sign(x) = 1 if x ≥ 0, else -1</p>
<p>Here&#8217;s a C++ implementation from my <a href="http://github.com/virgildisgr4ce/Neuroduino">Neuroduino</a> Arduino library:</p>
<pre>int Neuroduino::signThreshold(double sum){
	if (sum &gt;= _net.Theta) {
		return 1;
	} else {
		return -1;
	}
}

double Neuroduino::weightedSum(int l, int node){
	// calculates input activation for a particular neuron
	int i;
	double currentWeight, sum = 0.0;

	for (i=0; i&lt;_net.Layer[l-1]-&gt;Units; i++) {
		currentWeight = _net.Layer[l]-&gt;Weight[node][i];
		sum += currentWeight * _net.Layer[l-1]-&gt;Output[i];
	}

	return sum;
}

void Neuroduino::adjustWeights(int trainArray[]){
	int l,i,j;
	int in,out, error;
	int activation;	// for each "rightmost" node
	double delta;

	for (l=1; l&lt;_numLayers; l++) {
		// cycle through each pair of nodes
		for (i=0; i&lt;_net.Layer[l]-&gt;Units; i++) {
			// "rightmost" layer
			// calculate current activation of this output node
			activation = signThreshold(weightedSum(l,i));
			out = trainArray[i];	// correct activation
			error = out - activation;	// -2, 2, or 0

			for (j=0; j&lt;_net.Layer[l-1]-&gt;Units; j++) {
				// "leftmost" layer

				in = _net.Layer[l-1]-&gt;Output[j];

				delta = _net.Eta * in * error;
				_net.Layer[l]-&gt;Weight[i][j] += delta;
			}
		}
	}
}

void Neuroduino::simulateNetwork(){
	/*****
	 Calculate activations of each output node
	 *****/
	int l,j;

	for (l=_numLayers-1; l&gt;0; l--) {
		// step backwards through layers
		// TODO: this will only work for _numLayers = 2!
		for (j=0; j &lt; _net.Layer[l]-&gt;Units; j++) {
			_output[j] = signThreshold(weightedSum(1, j));
		}
	}
}</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/implementing-the-perceptron-rule/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Least Common Multiple algorithm in AS3 / Java</title>
		<link>http://log.liminastudio.com/itp/least-common-multiple-algorithm-in-as3-java</link>
		<comments>http://log.liminastudio.com/itp/least-common-multiple-algorithm-in-as3-java#comments</comments>
		<pubDate>Wed, 14 Apr 2010 21:42:29 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Writing and Reading Poetry in the Digital Age]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=581</guid>
		<description><![CDATA[Today I needed to find the Least Common Multiple of more than 2 numbers for my recombinatory poem tool, and discovered it&#8217;s more of a sophisticated problem than I had initially thought.  Here is my implementation, using recursive greatest common divisor reduction: function gcd(a, b){ // Euclidean algorithm var t; while (b != 0){ t [...]]]></description>
			<content:encoded><![CDATA[<p>Today I needed to find the <a href="http://en.wikipedia.org/wiki/Least_common_multiple">Least Common Multiple</a> of more than 2 numbers for my recombinatory poem tool, and discovered it&#8217;s more of a sophisticated problem than I had initially thought.  Here is my implementation, using recursive <a href="http://en.wikipedia.org/wiki/Euclidean_algorithm">greatest common divisor</a> reduction:</p>
<pre>function gcd(a, b){
	// Euclidean algorithm
	var t;
	while (b != 0){
		t = b;
		b = a % b;
		a = t;
	}
	return a;
}

function lcm(a, b){
	return (a * b / gcd(a, b));
}

function lcmm(args){
	// Recursively iterate through pairs of arguments
	// i.e. lcm(args[0], lcm(args[1], lcm(args[2], args[3])))

	if(args.length == 2){
		return lcm(args[0], args[1]);
	} else {
		var arg0 = args[0];
		args.shift();
		return lcm(arg0, lcmm(args));
	}
}</pre>
<p>Just pass in an array like so:</p>
<pre>trace(lcmm([1,2,3,4]));</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/least-common-multiple-algorithm-in-as3-java/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gestures on the &lt;canvas&gt;</title>
		<link>http://log.liminastudio.com/itp/gestures-on-the</link>
		<comments>http://log.liminastudio.com/itp/gestures-on-the#comments</comments>
		<pubDate>Sat, 26 Sep 2009 00:59:38 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Drawing Machines]]></category>
		<category><![CDATA[ITP]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Recursion]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=419</guid>
		<description><![CDATA[I&#8217;ve begun developing an algorithmic, recursive gestural tree using JavaScript to draw into the HTML5 &#60;canvas&#62; element.  After running into a few initial problems, like discovering I was overflowing my browser stack limit, I progressed to some scribbly sketches. Fixing the locating problems yielded these: I then decided to move towards a continuous, single line composed [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve begun developing an algorithmic, recursive gestural tree using JavaScript to draw into the <a href="https://developer.mozilla.org/en/Canvas_tutorial/Drawing_shapes">HTML5 &lt;canvas&gt; element</a>.  After running into a few initial problems, like discovering I was overflowing my <a href="http://tests.novemberborn.net/javascript/callstack-size.html">browser stack limit</a>, I progressed to some scribbly sketches.</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-1.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-420" title="Picture 1" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-1-150x74.png" alt="Picture 1" width="150" height="74" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-2.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-421" title="Picture 2" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-2-150x150.png" alt="Picture 2" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-3.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-422" title="Picture 3" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-3-150x150.png" alt="Picture 3" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-4.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-423" title="Picture 4" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-4-150x150.png" alt="Picture 4" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-5.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-424" title="Picture 5" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-5-150x150.png" alt="Picture 5" width="150" height="150" /></a></p>
<p><a href="http://liminastudio.com/projects/dm/gestures/test1.html">Fixing the locating problems</a> yielded these:</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-9.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-435" title="Picture 9" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-9-150x150.png" alt="Picture 9" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-10.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-436" title="Picture 10" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-10-150x150.png" alt="Picture 10" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-11.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-437" title="Picture 11" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-11-150x150.png" alt="Picture 11" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-12.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-438" title="Picture 12" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-12-150x150.png" alt="Picture 12" width="150" height="150" /></a></p>
<p>I then decided to move towards a <a href="http://liminastudio.com/projects/dm/gestures/scribbler_01.html">continuous, single line</a> composed of <a href="http://liminastudio.com/projects/dm/gestures/scribbler_02.html">Bezier segments</a>:</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-13.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-441" title="Picture 13" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-13-150x150.png" alt="Picture 13" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-16.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-442" title="Picture 16" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-16-150x150.png" alt="Picture 16" width="150" height="150" /></a> <a href="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-17.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-443" title="Picture 17" src="http://log.liminastudio.com/wp-content/uploads/2009/09/Picture-17-150x150.png" alt="Picture 17" width="150" height="150" /></a></p>
<p>This could easily pave the way for a recursive sketching algorithm that composes each Bezier segment from <em>n</em> number of smaller Bezier segments down to a predefined number of levels.  The larger question, in this investigation, remains: what determines the high-level gestures?</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/gestures-on-the/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using MPD to control system volume</title>
		<link>http://log.liminastudio.com/miscellaneous/using-mpd-to-control-system-volume</link>
		<comments>http://log.liminastudio.com/miscellaneous/using-mpd-to-control-system-volume#comments</comments>
		<pubDate>Thu, 28 May 2009 17:10:41 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MPD]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=374</guid>
		<description><![CDATA[I&#8217;m a big fan of the Music Player Daemon on my home linux (Ubuntu) server, and I use a variety of clients to control it (mpc, Pitchfork, GMPC, even a custom Chumby interface I adapted).  But until now there was a disjunction between volume controls—mpd&#8217;s default configuration is to control the &#8220;PCM&#8221; mixer channel instead [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of the <a href="http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki">Music Player Daemon</a> on my home linux (Ubuntu) server, and I use a variety of clients to control it (<a href="http://mpd.wikia.com/wiki/Client:Mpc">mpc</a>, <a href="http://mpd.wikia.com/wiki/Client:Pitchfork">Pitchfork</a>, GMPC, even a custom <a href="http://www.chumby.com/">Chumby</a> interface I adapted).  But until now there was a disjunction between volume controls—mpd&#8217;s default configuration is to control the &#8220;PCM&#8221; mixer channel instead of &#8220;Master,&#8221; which meant I couldn&#8217;t control the Master volume remotely, but was controlling Master locally.</p>
<p>Finally last night I realized you could change that in the /etc/mpd.conf file.  Here&#8217;s what I used in mine:</p>
<pre>############################# MIXER ############################
#
# MPD needs to know what mixer settings to change when you
# adjust the volume. If you don't specify one here, MPD will
# pick one based on which ones it was compiled with support for.
#
# An example for controlling an ALSA mixer:
#
mixer_type "alsa"
mixer_device "default"
mixer_control "Master"</pre>
<p>Now it works perfectly; I can control the system volume from any of my clients (Pitchfork being the one that gets used the most).</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/miscellaneous/using-mpd-to-control-system-volume/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scraping Gmail IMAP Messages to MySQL Database</title>
		<link>http://log.liminastudio.com/itp/scraping-gmail-imap-messages-to-mysql-database</link>
		<comments>http://log.liminastudio.com/itp/scraping-gmail-imap-messages-to-mysql-database#comments</comments>
		<pubDate>Thu, 23 Apr 2009 21:35:55 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=308</guid>
		<description><![CDATA[For my ITP Student List visualization endeavors, I discovered that there&#8217;s a gmail account someone started in 2006 that is subscribed to the list and receives all its messages.  This is, to my knowledge, the only permanent archive of the list.  So I wanted to offload all those messages to a database so I could [...]]]></description>
			<content:encoded><![CDATA[<p>For my ITP Student List visualization endeavors, I discovered that there&#8217;s a gmail account someone started in 2006 that is subscribed to the list and receives all its messages.  This is, to my knowledge, the only permanent archive of the list.  So I wanted to offload all those messages to a database so I could make a nice handy API for future visualizations.</p>
<p><span id="more-308"></span>It&#8217;s taken a week or two of solid hacking and research.  First I heard about a Python module to do it, which turned out to be really old, then I turned to Perl and, though I did get connected via <a href="http://search.cpan.org/dist/Mail-IMAPClient/lib/Mail/IMAPClient.pod">Mail::IMAPClient</a> (which I recommend), I then discovered a class called <a href="http://emailtodb.moldo.pl/">emailtodb</a> for PHP.</p>
<p>This class turned out to be really busted; unless I&#8217;m missing some crazy PHP principles, it was bizarrely illogical.  I have heavily modified it and it&#8217;s a lot faster.  <a href="http://log.liminastudio.com/wp-content/uploads/2009/04/emailtodb_tedb0t.zip">Download my zip</a> of the class and example usage.  I haven&#8217;t really documented it, but leave a comment if you are confused about something.</p>
<p>So!  Here&#8217;s how you connect to Gmail IMAP with PHP:</p>
<p><code>$mbox = imap_open ("{imap.gmail.com:993/imap/ssl/novalidate-cert}[Gmail]/All Mail", "user_id", "password");</code></p>
<p>Here I&#8217;m connecting to the &#8220;All Mail&#8221; mailbox since I wanted to offload ALL the messages on the server.  You can also replace that with INBOX, which is the more typical usage.  I discovered <code>/novalidate-cert</code> by trial and error; I&#8217;m guessing you don&#8217;t need it if your client domain is SSL certified (or something? I still don&#8217;t really get SSL).</p>
<p>The biggest challenge was dealing with multipart MIME messages.  In the end it turned out to be fairly simple but the original code looks like it was written on crack, so I had to spend a lot of time fixing it.</p>
<p>Efficiency: Although I&#8217;m sure I could optimize the hell out of it, right now it goes at about .3 seconds on average for non-multipart messages and anywhere from 1-2 seconds or more for multipart messages (which usually just means it&#8217;s extracting an embedded attachment like an image).</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/scraping-gmail-imap-messages-to-mysql-database/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Getting ProMIDI to work in Processing on OS X Leopard</title>
		<link>http://log.liminastudio.com/itp/getting-promidi-to-work-in-processing-on-os-x-leopard</link>
		<comments>http://log.liminastudio.com/itp/getting-promidi-to-work-in-processing-on-os-x-leopard#comments</comments>
		<pubDate>Wed, 22 Apr 2009 20:43:45 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ProMIDI]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=309</guid>
		<description><![CDATA[There is a commonly used MIDI library for Processing called ProMIDI.  They don&#8217;t seem to document this on their site (their documentation is terrible in general), but it will not work out-of-the-box on Leopard, due to Apple not supporting a certain Java MIDI class after 10.4.8.  Luckily some folks stepped in and made MMJ, a [...]]]></description>
			<content:encoded><![CDATA[<p>There is a commonly used MIDI library for Processing called <a href="http://www.texone.org/promidi/">ProMIDI</a>.  They don&#8217;t seem to document this on their site (their documentation is terrible in general), but it will not work out-of-the-box on Leopard, due to Apple not supporting a certain Java MIDI class after 10.4.8.  Luckily some folks stepped in and made <a href="http://www.humatic.de/htools/mmj.htm">MMJ</a>, a Java MIDI subsystem.  Read on for all the details.<span id="more-309"></span></p>
<p>From their site:</p>
<blockquote><p>As of Mac OS X version 10.4.8 Apple do no longer support the com.apple.audio.midi java package, which on previous OS X versions allowed java applications to easily access the CoreMIDI system. <strong>mmj</strong> steps into that hole by providing a universal binary JNI wrapper to CoreMIDI, that is deployable accross system versions and processor architectures. If you need to work with Midi from java on both PowerPC and Intel Macs with all Java runtimes &gt;= 1.4, this is what you need.</p></blockquote>
<p>Here&#8217;s what you do:</p>
<ol>
<li>Download the library <a href="http://www.humatic.de/webapps/php/download/pick.php?app=mmj">here</a>.</li>
<li>Look for <code>/Library/Java/Extensions</code> on your harddisk.  If the path doesn&#8217;t exist, go ahead and make it.</li>
<li>Copy <code>libmmj.jnilib</code> and <code>mmj.jar</code> from the zip file to that extensions path.</li>
<li>If you want to send or receive MIDI from within your computer, you&#8217;ll need a software bus.  On OS X Leopard (not sure if this is on previous versions?), this is REALLY easy, and instructions follow.  On Windows I think you have to use <a href="http://www.midiox.com/">MidiOx/Yoke</a> or something similar.
<ol>
<li>Open the Audio/MIDI Setup program in /Applications/Utilities.</li>
<li>Double click on the red IAC Driver button.</li>
<li>Check &#8220;Device is online.&#8221;</li>
<li>Click &#8220;Apply&#8221; if possible, on mine it is grayed out but it doesn&#8217;t seem to matter.</li>
</ol>
</li>
<li>Now when you run your <code>midiIO.printDevices();</code> command you will see:</li>
</ol>
<blockquote><p><code>input 0 : IAC Driver - Bus 1<br />
output 0 : IAC Driver - Bus 1</code></p></blockquote>
<p>&#8230;or whatever you named the bus (that is the default), and usually the &#8220;Java Sound Synthesizer&#8221; as well.  Bingo!  Now you just set your other program (like Ableton Live, etc.) to use that same bus and you can start to send MIDI back and forth.  Enjoy!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/getting-promidi-to-work-in-processing-on-os-x-leopard/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
