<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>strange tractor</title>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/</link>
    <description>a strange tractor, plowing strange fields</description>
    <language>en</language>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>blosxom/2.1.2</generator>

  <item>
    <title>Javascript Argument library</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#js_argLib</link>
    <category>/maxmsp/javascript/libraries</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/libraries/js_argLib</guid>
    <description> 
&lt;P&gt;The following standardised library for handling argument setup
is being implemented using the new #include mechanism.

&lt;P&gt;This library provides the same argument and attribute parsing as non-javascript
patchers.  Arguments are read in order, and associated with the correct variable.
Attributes (named @ATTRIBUTE/value pairs) are properly named and declared,
and behave the same way as patcher attributes.

&lt;P&gt;Syntax example
&lt;BR&gt;----------------------------------------------- 
&lt;CODE&gt;&lt;BR&gt;include(&quot;&amp;lt;argHandler&amp;gt;&quot;); 
&lt;BR&gt;  
&lt;BR&gt;args = new argHandler;
&lt;BR&gt;// note - declare arguments in order;  
&lt;BR&gt;var ARG1 = 100;
&lt;BR&gt;args.setUpArgument(&quot;ARG1&quot;);   
&lt;BR&gt;// match declaration with setUpArgument line
&lt;BR&gt; 
&lt;BR&gt;var ARG2 = 0;  
&lt;BR&gt;args.setUpArgument(&quot;ARG2&quot;); 
&lt;BR&gt;   
&lt;BR&gt;// note - attributes can be declared in any order;
&lt;BR&gt;var ATTR1 = 100;
&lt;BR&gt;args.setUpAttribute(&quot;ATTR1&quot;);
&lt;BR&gt;// match declaration with setUpAttribute line     
&lt;BR&gt;   
&lt;BR&gt;args.argumentParser(jsarguments);  
&lt;BR&gt;// required : reads supplied arguments
&lt;BR&gt;
&lt;BR&gt;args.reportAttributes();
&lt;BR&gt;// posts all attributes as per a non-js patcher
&lt;/CODE&gt;
&lt;BR&gt;----------------------------------------------- 

&lt;P&gt;Note : the nature of argument and attribute handling requires &lt;CODE&gt;eval()&lt;/CODE&gt; calls.
These are minimised as much as possible, to one per &lt;CODE&gt;argumentParser()&lt;/CODE&gt; call, 
and one per &lt;CODE&gt;reportAttributes()&lt;/CODE&gt; call. &lt;CODE&gt;argumentParser()&lt;/CODE&gt; is only called when the
js/jsui object is initialised, and &lt;CODE&gt;reportAttributes()&lt;/CODE&gt; should only be used within
the standardised &lt;CODE&gt;getstate()&lt;/CODE&gt; function call.

  
</description>
  </item>
  <item>
    <title>Javascript Inlet/Outlet library</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#js_ioletLib</link>
    <category>/maxmsp/javascript/libraries</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/libraries/js_ioletLib</guid>
    <description> 
&lt;P&gt;The following standardised library for handling inlet and outlet setup
is being implemented using the new #include mechanism.

&lt;P&gt;Syntax example
&lt;BR&gt;----------------------------------------------- 
&lt;CODE&gt;&lt;BR&gt;include(&quot;&amp;lt;IOletHandler&amp;gt;&quot;); 
&lt;BR&gt;  
&lt;BR&gt;iolet = new IOletHandler;
&lt;BR&gt;// note - declare inlets and outlets in order!  
&lt;BR&gt;iolet.declareInlet(&quot;inlet1&quot;); 
&lt;BR&gt;iolet.declareOutlet(&quot;outlet1&quot;);   
&lt;BR&gt;iolet.declareOutlet(&quot;outlet2&quot;);
&lt;BR&gt;   
&lt;BR&gt;iolet.setupIOlets();
&lt;/CODE&gt;
&lt;BR&gt;----------------------------------------------- 


  
</description>
  </item>
  <item>
    <title>Javascript Includes Part2</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#javascript_includes2</link>
    <category>/maxmsp/javascript/extensions</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/extensions/javascript_includes2</guid>
    <description>
&lt;P&gt;Having implemented an include mechanism, and a main javascript code template, it made sense to develop
a standard include-file template as well.  When starting to do so, I took the time to tidy up
the original code template, including standardising a certain amount of descriptive documentation.  

&lt;P&gt;One thing that became clear was that the amount of comments et.c. added significantly to the size of an included file.
As a result, I decided to provide a method for removing this overhead, in the form of a &apos;cleaned&apos; include file, stripped
of comments and extraneous whitespace.  A &apos;clean&apos; include file would be file-suffixed &apos;.h.js&apos;, and the
&apos;full&apos; version, used for code maintenance would retain the &apos;.js&apos; suffix. The original include code was modified
to use a &apos;clean&apos; include file first, if present, or, in its absence, the &apos;full&apos; version.  

&lt;P&gt;To simplify the process of &apos;cleaning&apos; header files, a simple perl utility, called strippa was written capable of generating
a &apos;clean&apos; include file from every javascript file in directory.  The utility is also capable of modifying the
self-reporting &apos;post&apos; messages in include files.

&lt;P&gt;The revised requirements for an include file are thus:


&lt;P&gt;Requirements:
&lt;UL&gt;&lt;LI&gt;The same code fragment for the function include() must be present in javascript using includes.
&lt;LI&gt;Include files with comments should be named in the form &lt;CODE&gt;name.js&lt;/CODE&gt;.
&lt;LI&gt;Include files with comments should contain the start and end lines
&lt;BR&gt;&lt;CODE&gt;post(&quot;included IOletHandler.js\n&quot;);&lt;/CODE&gt;
&lt;BR&gt;and
&lt;BR&gt;&lt;CODE&gt;post(&quot;including IOletHandler.js\n&quot;);&lt;/CODE&gt;
&lt;BR&gt;to aid in debugging
&lt;LI&gt;Streamlined include files, cleaned of comments etc should be named in the form &lt;CODE&gt;name.h.js&lt;/CODE&gt;.
&lt;LI&gt;Include files without comments should contain the start and end lines
&lt;BR&gt;&lt;CODE&gt;post(&quot;included IOletHandler.h.js\n&quot;);&lt;/CODE&gt;
&lt;BR&gt;and
&lt;BR&gt;&lt;CODE&gt;post(&quot;including IOletHandler.h.js\n&quot;);&lt;/CODE&gt;
&lt;BR&gt;to aid in debugging
&lt;/UL&gt;
</description>
  </item>
  <item>
    <title>Javascript Includes</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#javascript_includes</link>
    <category>/maxmsp/javascript/extensions</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/extensions/javascript_includes</guid>
    <description>
&lt;P&gt;A basic #include type functionality was implemented to allow the easier and more modular development
of Javascript within MAX/MSP.  This would allow the use of reusable Javascript code in a clean and straightforward
fashion, 

&lt;P&gt;The #include functionality was modelled after the C preprocessor, allowing the inclusion of local Javascript files
as well as those in a central &apos;library&apos; location (chosen to be %MAXROOT%/Cycling &apos;74/jsincludes)

&lt;P&gt;Requirements:
&lt;UL&gt;&lt;LI&gt;The same code fragment for the function include() must be present in javascript using includes.
&lt;LI&gt;Include files should be named in the form &lt;CODE&gt;name.h.js&lt;/CODE&gt;.
&lt;LI&gt;Include files should contain the start and end lines
&lt;BR&gt;&lt;CODE&gt;post(&quot;included IOletHandler.h.js\n&quot;);&lt;/CODE&gt;
&lt;BR&gt;and
&lt;BR&gt;&lt;CODE&gt;post(&quot;including IOletHandler.h.js\n&quot;);&lt;/CODE&gt;
&lt;BR&gt;to aid in debugging
&lt;/UL&gt;

&lt;P&gt;The use of this mechanism is as follows
&lt;BR&gt;&lt;CODE&gt;includes = &quot;&quot;;&lt;/CODE&gt;         &lt;I&gt;clear include buffer&lt;/I&gt;
&lt;BR&gt;&lt;CODE&gt;include(&quot;&amp;lt;library&amp;gt;&quot;);&lt;/CODE&gt;  &lt;I&gt;loads library.h.js from %MAXROOT%/Cycling &apos;74/jsincludes/&lt;/I&gt;
&lt;BR&gt;&lt;CODE&gt;include(&quot;local&quot;);&lt;/CODE&gt;      &lt;I&gt;loads local.h.js from same folder as parent .js file&lt;/I&gt;
&lt;BR&gt;&lt;CODE&gt;eval(includes);&lt;/CODE&gt;  	&lt;I&gt;interprets the code&lt;/I&gt;
&lt;BR&gt;&lt;CODE&gt;includes = &quot;&quot;;&lt;/CODE&gt; 	&lt;I&gt;frees up buffer&lt;/I&gt;

&lt;P&gt;This code should have been fairly straightforward, but issues with line-end characters caused a certain amount of
headscratching.  The current code, which grabs lines one at a time, might be slower, but it more forgiving
of EOL issues.  The implementation reads all the included module code into a single buffer then &lt;CODE&gt;evals()&lt;/CODE&gt; it.
That uses a higher memory footprint, but less processing overhead. 
</description>
  </item>
  <item>
    <title>Javascript in MAX/MSP</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#javascript</link>
    <category>/maxmsp/javascript</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/javascript</guid>
    <description>
&lt;P&gt;Having decided there were numerous advantages in using Javascript within MAX/MSP
for the development process, it became important to consider the development process.

&lt;P&gt;After carrying out some brief tests to ensure that the jsui was indeed capable of handling the kind
of UI interactivity required, I concentrated on structuring my Javascript development in a more
convenient and rationalised manner.

&lt;P&gt;One of the first stages was sidestepping the very limited coding envirinment included in MAX (a very primitive
text editor) in favour of the Komodo IDE, and use of the command

&lt;P&gt;
&lt;CODE&gt;this.autowatch = 1;&lt;/CODE&gt;  

&lt;P&gt;which causes MAX/MSP to reload a js or jsui object when it has been modified. This combination
meant that I could edit documents in a fully-fledged IDE, with minimal overhead.
</description>
  </item>
  <item>
    <title>Javascript Standardised IO methods</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#javascript_standardcode</link>
    <category>/maxmsp/javascript</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/javascript_standardcode</guid>
    <description>
&lt;P&gt;The following functionality was developed to allow a consistent approach to MAX/MSP IO from a js/jsui object:

&lt;UL&gt;
&lt;LI&gt;inlet/outlet declarations - set up an inlet or outlet and tooltip in one line
&lt;P&gt;&lt;CODE&gt;
	declareInlet(&quot;tooltip for the first inlet&quot;); &lt;BR&gt;
	declareOutlet(&quot;tooltip for the first outlet&quot;);&lt;BR&gt;
	declareOutlet(&quot;tooltip for the 2nd outlet&quot;);&lt;BR&gt;
   &lt;CODE&gt;

&lt;LI&gt;argument handling - set up an argument, and its default value, in two lines.  all object argument-value
pairs are correctly parsed at object creation time.  
&lt;P&gt;&lt;CODE&gt;
    var ARGUMENT1 = 127;&lt;BR&gt;
    setUpArgument(&quot;ARGUMENT1&quot;);  &lt;BR&gt;  
    &lt;BR&gt;
    var ARGUMENT2 = 0;&lt;BR&gt;
    setUpArgument(&quot;ARGUMENT2&quot;);   &lt;BR&gt;
&lt;CODE&gt;

&lt;LI&gt;attribute handling  - set up an attribue, and its default value, in two lines.  all object attributes are correctly
parsed at object creation time, all attributes can be queried with &lt;CODE&gt;getstate&lt;/CODE&gt;, and set/read with appropriate 
messages
&lt;P&gt;&lt;CODE&gt;
    var ATTRIBUTE1 = &quot;RGBA&quot;;&lt;BR&gt;
    setUpAttribute(&quot;ATTRIBUTE1&quot;);&lt;BR&gt;
&lt;/CODE&gt;

&lt;LI&gt;pattr data storage/retrieval(*) - standardises storage and retrieval routines for use with pattr messages.
&lt;/UL&gt;

&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
(*)&lt;I&gt;not fully implemented as yet&lt;/I&gt;
</description>
  </item>
  <item>
    <title>Javascript standardised code</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#javascript_standardmethods</link>
    <category>/maxmsp/javascript</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/javascript_standardmethods</guid>
    <description>
&lt;P&gt;The following public functions have been or will be implemented in the template as &apos;hardcoded&apos; methods, or stubs,
providing handling of a standardised MAX message set.

&lt;P&gt;(hardcoded public functions)

&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;getstate()&lt;/CODE&gt; - return all attribute values
&lt;LI&gt;&lt;CODE&gt;getvalueof()&lt;/CODE&gt;  - return state for pattr handling
&lt;LI&gt;&lt;CODE&gt;setvalueof()&lt;/CODE&gt;  - set state for pattr handling
&lt;/UL&gt;

&lt;P&gt;(stubs for public functions)

&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;anything()&lt;/CODE&gt;  - respond to uncaught messages
&lt;LI&gt;&lt;CODE&gt;bang()&lt;/CODE&gt;      - handle &apos;bang&apos; messages
&lt;LI&gt;&lt;CODE&gt;loadbang()&lt;/CODE&gt;  - handle loadbang state
&lt;LI&gt;&lt;CODE&gt;msg_int()&lt;/CODE&gt;   - handle integer values as messages
&lt;LI&gt;&lt;CODE&gt;msg_float()&lt;/CODE&gt; - handle float value as messages
&lt;LI&gt;&lt;CODE&gt;list(array)&lt;/CODE&gt; - handle data lists as messages
&lt;/UL&gt;



&lt;P&gt;The following private functions are implemented in the template as &apos;hardcoded&apos; methods, or stubs, to support
the implementation of the standardised MAX message set.

&lt;P&gt;(hardcoded private functions)

&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;generic_assistance()&lt;/CODE&gt;  - used in inlet/outlet handling
&lt;LI&gt;&lt;CODE&gt;declareInlet()&lt;/CODE&gt;  - used in inlet/outlet handling
&lt;LI&gt;&lt;CODE&gt;declareOutlet()&lt;/CODE&gt;  - used in inlet/outlet handling
&lt;LI&gt;&lt;CODE&gt;setUpArgument()&lt;/CODE&gt;  - used in argument/attribute handling
&lt;LI&gt;&lt;CODE&gt;argumentParser()&lt;/CODE&gt;  - used in argument/attribute handling
&lt;LI&gt;&lt;CODE&gt;attributeCheck()&lt;/CODE&gt;  - used in argument/attribute handling
&lt;LI&gt;&lt;CODE&gt;setUpAttribute()&lt;/CODE&gt;  - used in argument/attribute handling
&lt;LI&gt;&lt;CODE&gt;validateAttribute()&lt;/CODE&gt;  - used in argument/attribute handling
&lt;LI&gt;&lt;CODE&gt;reportAttributes()&lt;/CODE&gt;  - used in argument/attribute handling
&lt;/UL&gt;

&lt;P&gt;(stubs for private functions)

&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;flatten()&lt;/CODE&gt;   - used in pattr handling
&lt;LI&gt;&lt;CODE&gt;inflate()&lt;/CODE&gt;   - used in pattr handling
&lt;/UL&gt;

&lt;P&gt;Some of these methods are implemented using &apos;eval&apos;, which is known to be inefficient.
All of this usage of eval currently occurs at the initialisation stage, but a method for avoiding repeated calls to
eval is required.  This may be resoved by my intention to try and implement &lt;CODE&gt;#include&lt;/CODE&gt; functionality, 
which also replace the need for hardcoded functions.


  
</description>
  </item>
  <item>
    <title>Javascript : template js document</title>
    <pubDate>Fri, 01 Jun 2012 04:37:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#javascript2</link>
    <category>/maxmsp/javascript</category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/maxmsp/javascript/javascript2</guid>
    <description>
&lt;P&gt;Javascript maps slightly awkwardly to the MAX/MSP paradigm, but much has been provided to provide a 
framework which &apos;hooks in&apos; to the MAX box/patcher model.  However, I realised that much of the code required to 
handle this would be duplicated from one js/jsui object to the next, so one of the first taks I undertook was
to develop a &apos;template&apos; javascript document, which was (a) well structured and (b) contained as much
useful reusable io functionality as possible.

&lt;P&gt;The current implementation of this template provides a consistent framework for the development of new javascript
objects, with the folllwing advantages

&lt;UL&gt;
&lt;LI&gt;consistent style and layout
&lt;LI&gt;clear division of code into distinct functional sets
&lt;UL&gt;
	&lt;LI&gt;load-time initialisation code
	&lt;LI&gt;MAX-usable external methods - standard methods
	&lt;LI&gt;MAX-usable external methods - object-specific methods	
	&lt;LI&gt;private methods - standard methods (not to be edited)
	&lt;LI&gt;private methods - object-specific
&lt;/UL&gt;
&lt;LI&gt;standard in-code documentation style
&lt;LI&gt;provision of consistent support methods
&lt;LI&gt;provision of consistent &apos;stub&apos; methods for expected normal MAX messages
&lt;LI&gt;support methods allowing cleaner and more consistent IO setup
&lt;/UL&gt;
</description>
  </item>
  <item>
    <title>Reboot...</title>
    <pubDate>Fri, 01 Jun 2012 00:00:00 -0500</pubDate>
    <link>http://www.strangetractor.org/cgi-bin/tractor.cgi/2012/06/01#intro</link>
    <category></category>
    <guid isPermaLink="false">http://www.strangetractor.org/cgi-bin/tractor.cgi/intro</guid>
    <description>
&lt;p&gt;June 2012
&lt;br&gt;
Officially restarting the Strange Tractor site from scratch.&lt;/p&gt;
</description>
  </item>
  </channel>
</rss>
