<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: arc code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Tue, 22 Jul 2008 23:07:11 GMT</pubDate>
    <description>DZone Snippets: arc code</description>
    <item>
      <title>mzscheme 352 Portfile (to get Arc working on OS X)</title>
      <link>http://snippets.dzone.com/posts/show/5056</link>
      <description># $Id$&lt;br /&gt;&lt;br /&gt;PortSystem 1.0&lt;br /&gt;&lt;br /&gt;name            mzscheme&lt;br /&gt;version         352&lt;br /&gt;categories      lang scheme&lt;br /&gt;platforms       darwin&lt;br /&gt;maintainers     nomaintainer&lt;br /&gt;description     MzScheme is an implementation of the Scheme programming language&lt;br /&gt;long_description    ${description}&lt;br /&gt;&lt;br /&gt;homepage        http://www.plt-scheme.org/software/mzscheme/&lt;br /&gt;set subdir      ${version}/mz/&lt;br /&gt;master_sites \&lt;br /&gt;  http://download.plt-scheme.org/bundles/${subdir} \&lt;br /&gt;  http://plt.cs.uchicago.edu/bundles/${subdir} \&lt;br /&gt;  http://www.cs.utah.edu/plt/download/${subdir} \&lt;br /&gt;  ftp://archive.informatik.uni-tuebingen.de/unix/language/plt/${subdir} \&lt;br /&gt;  ftp://infogroep.be/pub/plt/bundles/${subdir} \&lt;br /&gt;  http://gd.tuwien.ac.at/languages/scheme/plt/${subdir}&lt;br /&gt;distfiles       mz-${version}-src-unix.tgz&lt;br /&gt;checksums       md5 218bad0defbdbb72d94d8a3fb4fa6545&lt;br /&gt;&lt;br /&gt;depends_lib     port:jpeg \&lt;br /&gt;                port:libpng \&lt;br /&gt;                port:libiconv&lt;br /&gt;&lt;br /&gt;worksrcdir		plt/src&lt;br /&gt;&lt;br /&gt;post-patch {&lt;br /&gt;	reinplace "s|collects|share/mzscheme|g" \&lt;br /&gt;		${worksrcpath}/mzscheme/src/startup.ss \&lt;br /&gt;		${worksrcpath}/mzscheme/src/startup.inc&lt;br /&gt;	reinplace "s|~/Library/PLT Scheme/|${prefix}/share/mzscheme/|g" \&lt;br /&gt;		${worksrcpath}/mzscheme/src/file.c&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;configure.env	CFLAGS="-I${prefix}/include" \&lt;br /&gt;				CPPFLAGS="-I${prefix}/include" \&lt;br /&gt;				LDFLAGS="-L${prefix}/lib"&lt;br /&gt;&lt;br /&gt;destroot.destdir	prefix=${destroot}${prefix}&lt;br /&gt;post-destroot	{&lt;br /&gt;	file delete -force ${destroot}${prefix}/install \&lt;br /&gt;		${destroot}${prefix}/share/man&lt;br /&gt;	file rename ${destroot}${prefix}/collects \&lt;br /&gt;		${destroot}${prefix}/share/mzscheme&lt;br /&gt;	xinstall -m 755 -d ${destroot}${prefix}/share/doc/ \&lt;br /&gt;		${destroot}${prefix}/share/mzscheme/${version}/&lt;br /&gt;	system "cd ${destroot}${prefix}/share/mzscheme/${version} &amp;&amp; ln -s .. collects"&lt;br /&gt;	file rename ${destroot}${prefix}/man \&lt;br /&gt;		${destroot}${prefix}/share/man&lt;br /&gt;	file rename ${destroot}${prefix}/doc \&lt;br /&gt;		${destroot}${prefix}/share/doc/mzscheme&lt;br /&gt;	file delete -force ${destroot}${prefix}/lib/buildinfo&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Wed, 30 Jan 2008 17:08:23 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5056</guid>
      <author>automatthew (Matthew King)</author>
    </item>
    <item>
      <title>Rubylike slice for strings and lists</title>
      <link>http://snippets.dzone.com/posts/show/5055</link>
      <description>(slice "hello" 2 4) =&gt; "ll"&lt;br /&gt;Comparable to: "hello"[2...4]&lt;br /&gt;&lt;br /&gt;(slice "hello" 2 -1) =&gt; "ll"&lt;br /&gt;Comparable to: "hello"[2...-1]&lt;br /&gt;&lt;br /&gt;(slice "hello" '(2 2)) =&gt; "ll"&lt;br /&gt;Comparable to: "hello"[2,2]&lt;br /&gt;&lt;br /&gt;(slice "hello" 1) =&gt; "ello"&lt;br /&gt;Comparable to: "hello"[2..-1]&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;(def slice (str x (o y))&lt;br /&gt;  (if (atom x)&lt;br /&gt;    (if &lt;br /&gt;      ; (slice "hello" 1) =&gt; "ello"&lt;br /&gt;      (no y) &lt;br /&gt;        (subseq str x)&lt;br /&gt;      ; (slice "hello" 2 -1) =&gt; "ll"&lt;br /&gt;      (&lt; y 0) &lt;br /&gt;        (subseq str x (+ (len str) y))&lt;br /&gt;      ; (slice "hello" 2 4) =&gt; "ll"&lt;br /&gt;      (subseq str x y))&lt;br /&gt;    ; (slice "hello" '(2 2)) =&gt; "ll"&lt;br /&gt;    (subseq str (car x) (+ (car x) (cadr x)))))&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 30 Jan 2008 13:26:39 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5055</guid>
      <author>mdemare (Michiel de Mare)</author>
    </item>
    <item>
      <title>Graphical Plotter //Javascript Class</title>
      <link>http://snippets.dzone.com/posts/show/682</link>
      <description>&lt;a href="http://www.jsfromhell.com/dhtml/graphical-plotter"&gt;&lt;br /&gt;&lt;br /&gt;[UPDATED CODE AND HELP CAN BE FOUND HERE]&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An unuseful thing to draw using javascript, it's slow as hell :)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//+ Jonas Raoni Soares Silva&lt;br /&gt;//@ http://jsfromhell.com/dhtml/graphical-plotter [v1.0]&lt;br /&gt;&lt;br /&gt;Canvas = function(){&lt;br /&gt;	var o = this;&lt;br /&gt;	( o.penPos = { x: 0, y: 0 }, o.pixelSize = 10, o.pen = { style: "solid", size: 1, color: "#000" }, o.brush = { style: "solid", color: "#000" } );&lt;br /&gt;};&lt;br /&gt;with( { p: Canvas.prototype } ){&lt;br /&gt;	p.pixel = function( x, y, color ) {&lt;br /&gt;		var o = this, s = document.body.appendChild( document.createElement( "div" ) ).style;&lt;br /&gt;		return ( s.position = "absolute", s.width = ( o.pen.size * o.pixelSize ) + "px", s.height = ( o.pen.size * o.pixelSize ) + "px", s.fontSize = "1px", s.left = ( x * o.pixelSize ) + "px", s.top = ( y * o.pixelSize ) + "px", s.backgroundColor = color || o.pen.color, o );&lt;br /&gt;	};&lt;br /&gt;	p.line = function( x1, y1, x2, y2 ){&lt;br /&gt;		if( Math.abs( x1 - x2 ) &lt; Math.abs( y1 - y2 ) )&lt;br /&gt;			for( y = Math.min( y1, y2 ) - 1, x = Math.max( y1, y2 ); ++y &lt;= x; canvas.pixel( ( y * ( x1 - x2 ) - x1 * y2 + y1 * x2 ) / ( y1 - y2 ), y ) );&lt;br /&gt;		else&lt;br /&gt;			for( x = Math.min( x1, x2 ) - 1, y = Math.max( x1, x2 ); ++x &lt;= y; canvas.pixel( x, ( x * ( y1 - y2 ) - y1 * x2 + x1 * y2 ) / ( x1 - x2 ) ) );&lt;br /&gt;		return this;&lt;br /&gt;	};&lt;br /&gt;	p.arc = function( x, y, raio, startAngle, degrees ) {&lt;br /&gt;		for( degrees += startAngle; degrees --&gt; startAngle; this.pixel( Math.cos( degrees * Math.PI / 180 ) * raio + x, Math.sin( degrees * Math.PI / 180 ) * raio + y ) ); return this;&lt;br /&gt;	};&lt;br /&gt;	p.rectangle = function( x, y, width, height, rotation ){&lt;br /&gt;		return this.moveTo( x, y ).lineBy( 0, height ).lineBy( width, 0 ).lineBy( 0, -height ).lineBy( -width, 0 );&lt;br /&gt;	};&lt;br /&gt;	p.moveTo = function( x, y ){ var o = this; return ( o.penPos.x = x, o.penPos.y = y, o ); };&lt;br /&gt;	p.moveBy = function( x, y ){ var o = this; return o.moveTo( o.penPos.x + x, o.penPos.y + y ); };&lt;br /&gt;	p.lineTo = function( x, y ){ var o = this; return o.line( o.penPos.x, o.penPos.y, x, y ).moveTo( x, y ); };&lt;br /&gt;	p.lineBy = function( x, y ){ var o = this; return o.lineTo( o.penPos.x + x, o.penPos.y + y ); };&lt;br /&gt;	p.curveTo = function( cx, cy, x, y ){};&lt;br /&gt;	p.polyBezier = function( points ){};&lt;br /&gt;	p.path = function( points ){};&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;canvas = new Canvas;&lt;br /&gt;&lt;br /&gt;canvas.pen.color = "#f00";&lt;br /&gt;canvas.rectangle( 30, 20, 20, 20 );&lt;br /&gt;canvas.pen.color = "#080";&lt;br /&gt;canvas.rectangle( 35, 25, 10, 10 );&lt;br /&gt;canvas.pen.color = "#008";&lt;br /&gt;canvas.arc( 50, 30, 10, 180, 270 );&lt;br /&gt;canvas.arc( 30, 30, 10, 0, 270 );&lt;br /&gt;canvas.pen.color = "#ff0";&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 09 Sep 2005 07:25:34 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/682</guid>
      <author>jonasraoni (Jonas Raoni Soares Silva)</author>
    </item>
  </channel>
</rss>
