<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>scripts &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/scripts/</link>
	<description>Feed of posts on WordPress.com tagged "scripts"</description>
	<pubDate>Thu, 26 Nov 2009 19:06:54 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[List Windows services in Word]]></title>
<link>http://soulfulsyntax.wordpress.com/2009/11/26/list-windows-services-in-word/</link>
<pubDate>Thu, 26 Nov 2009 17:31:57 +0000</pubDate>
<dc:creator>ChocolateSoul</dc:creator>
<guid>http://soulfulsyntax.wordpress.com/2009/11/26/list-windows-services-in-word/</guid>
<description><![CDATA[I can&#8217;t recall why I wrote this but I&#8217;m posting it, just in case someone might find it u]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I can&#8217;t recall why I wrote this but I&#8217;m posting it, just in case someone might find it useful. This VB script queries the local SCM (Service Control Manager) on the host computer, then populates a Word document with the service information/properties!</p>
<p>&#160;</p>
<p>Set objWord = CreateObject(&#8220;Word.Application&#8221;)<br />
objWord.Visible = True<br />
Set objDoc = objWord.Documents.Add()<br />
Set objSelection = objWord.Selection<br />
objSelection.TypeText &#8220;Brian Bernard&#8217;s Services Report&#8221;<br />
objSelection.TypeParagraph()<br />
objSelection.TypeText &#8220;&#8221; &#38; Now<br />
objSelection.TypeParagraph()<br />
objSelection.TypeParagraph()<br />
strComputer = &#8220;.&#8221;<br />
Set objWMIService = _<br />
GetObject(&#8220;winmgmts:\\&#8221; &#38; strComputer &#38; &#8220;\root\cimv2&#8243;)<br />
Set colItems = objWMIService.ExecQuery(&#8220;Select * from Win32_Service&#8221;)</p>
<p>For Each objItem in colItems<br />
objSelection.TypeText objItem.DisplayName &#38; &#8221; &#8212; &#8221; &#38; objItem.State<br />
objSelection.TypeParagraph()<br />
Next</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Generate a winning Word document]]></title>
<link>http://soulfulsyntax.wordpress.com/2009/11/26/generate-a-winning-word-document/</link>
<pubDate>Thu, 26 Nov 2009 17:21:51 +0000</pubDate>
<dc:creator>ChocolateSoul</dc:creator>
<guid>http://soulfulsyntax.wordpress.com/2009/11/26/generate-a-winning-word-document/</guid>
<description><![CDATA[This is a fun script that I wrote last year, while the NBA Playoffs were running. It utilizes VB to ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This is a fun script that I wrote last year, while the NBA Playoffs were running. It utilizes VB to automatically open an instance of Microsoft Word and populates it with the LA Lakers logo. The best part about this script is that you don&#8217;t have to direct it to choose an image that is saved on the local computer (although you can use a local path); I chose to direct it to a website that is hosting the logo. i love discovering things like this!</p>
<p>Set objWord = CreateObject(&#8220;Word.Application&#8221;)<br />
objWord.Visible = True<br />
Set objDoc = objWord.Documents.Add()<br />
Set objSelection = objWord.Selection<br />
Set objShape = objDoc.Shapes<br />
objShape.AddPicture(&#8220;https://www.sidelinescolorado.com/images/lakers_logo.jpg&#8221;)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Send email using Powershell]]></title>
<link>http://soulfulsyntax.wordpress.com/2009/11/26/send-email-using-powershell/</link>
<pubDate>Thu, 26 Nov 2009 17:12:54 +0000</pubDate>
<dc:creator>ChocolateSoul</dc:creator>
<guid>http://soulfulsyntax.wordpress.com/2009/11/26/send-email-using-powershell/</guid>
<description><![CDATA[This script leverages Powershell to automate the sending of a custom email message using Outlook. Si]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This script leverages Powershell to automate the sending of a custom email message using Outlook. Simply modify the &#8216;NewMail.Subject&#8217;, &#8216;NewMail.To&#8217; and &#8216;NewMail.Body&#8217; values that I&#8217;ve used, to adapt it for your purposes. Remember to save this script with the required ‘*.ps1′ extension or it will not work!</p>
<p>&#8216;@<br />
$olMailItem = 0<br />
$olApp = new-object -comobject Outlook.application<br />
$NewMail = $olApp.CreateItem($olMailItem)<br />
$NewMail.Subject = &#8220;Testing&#8221;<br />
$NewMail.To = &#8220;Brian Bernard&#8221;<br />
$NewMail.Body = &#8220;Verbum sat sapienti.&#8221; `<br />
$NewMail.Send()</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Delete email using Powershell]]></title>
<link>http://soulfulsyntax.wordpress.com/2009/11/26/delete-email-using-powershell/</link>
<pubDate>Thu, 26 Nov 2009 17:06:37 +0000</pubDate>
<dc:creator>ChocolateSoul</dc:creator>
<guid>http://soulfulsyntax.wordpress.com/2009/11/26/delete-email-using-powershell/</guid>
<description><![CDATA[Here is a Powershell script that I wrote that can automatically delete email messages from Outlook. ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here is a Powershell script that I wrote that can automatically delete email messages from Outlook. It will delete any email in your Inbox that matches the From value specified in the Items.Restrict variable, so modify this to your desired Display Name to have it work for you. Remember to save this script with the required &#8216;*.ps1&#8242; extension or it will not work!</p>
<p>&#8216;@<br />
$olFolderInbox = 6<br />
$o = new-object -comobject Outlook.application<br />
$n = $o.GetNamespace(&#8220;MAPI&#8221;)<br />
$f = $n.GetDefaultFolder($olFolderInbox)<br />
$Items = $f.Items<br />
$FilteredItems = $Items.Restrict(&#8220;[From] = &#8216;Sanaa Lathan&#8217;&#8221;)<br />
for ($i = $FilteredItems.Count; $i -gt 0; $i&#8211;) {<br />
$FilteredItems.Item($i).Delete()<br />
}</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[#twatch Perl library]]></title>
<link>http://dangerousprototypes.com/2009/11/26/twatch-perl-library/</link>
<pubDate>Thu, 26 Nov 2009 14:35:10 +0000</pubDate>
<dc:creator>Ian</dc:creator>
<guid>http://dangerousprototypes.com/2009/11/26/twatch-perl-library/</guid>
<description><![CDATA[philalex wrote a Perl library to control the #twatch. You can leave suggestions and comments in the ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img class="alignnone size-full wp-image-2533" title="twatch-perl" src="http://wherelabs.wordpress.com/files/2009/11/twatch-perl.png" alt="" width="450" height="269" /></p>
<p>philalex wrote a <a href="http://bazaar.launchpad.net/~alexandre-philippe/twatch/trunk/annotate/head%3A/Twatch.pm">Perl library</a> to control the <a href="http://dangerousprototypes.com/twatch-manual/">#twatch</a>. You can leave suggestions and comments <a href="http://whereisian.com/forum/index.php?topic=169.0;topicseen">in the forum</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ OS_Teleport(Touch &amp; Collision) LSL Script]]></title>
<link>http://opensimtinker.wordpress.com/2009/11/26/os_teleporttouch-collision-lsl-script/</link>
<pubDate>Thu, 26 Nov 2009 08:07:43 +0000</pubDate>
<dc:creator>WhiteStar Magic</dc:creator>
<guid>http://opensimtinker.wordpress.com/2009/11/26/os_teleporttouch-collision-lsl-script/</guid>
<description><![CDATA[Here is a Simple, Quick Point to Point TP which can Teleport you to In-World or HyperGrid Location d]]></description>
<content:encoded><![CDATA[Here is a Simple, Quick Point to Point TP which can Teleport you to In-World or HyperGrid Location d]]></content:encoded>
</item>
<item>
<title><![CDATA[Popping Blisters]]></title>
<link>http://epdunne4891.wordpress.com/2009/11/24/popping-blisters/</link>
<pubDate>Wed, 25 Nov 2009 04:05:07 +0000</pubDate>
<dc:creator>Grizzly Skag Bear</dc:creator>
<guid>http://epdunne4891.wordpress.com/2009/11/24/popping-blisters/</guid>
<description><![CDATA[Winona is a ghost town again.  Sometimes it&#8217;s called &#8220;summer&#8221;.  It&#8217;s worse t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Winona is a ghost town again.  Sometimes it&#8217;s called &#8220;summer&#8221;.  It&#8217;s worse than summer now, though.  At least it&#8217;s green, warm, and the sun doesn&#8217;t go down at 4 in the afternoon.  A person just feels limited if they can&#8217;t go outside and enjoy the day past 4PM.</p>
<p>This Thanksgiving holiday will be plenty of time to definitely maybe start writing the movie again.  It&#8217;s priority number 5 behind researching stereotyping in advertising, finishing up my portfolio for advertising, painting some stuff I&#8217;m a bit behind on, and creating a webpage for my internet com class.</p>
<p>I&#8217;m looking forward to seeing some family members I haven&#8217;t seen in a long while.  You know, those family members you only see 2-4 times a year.  They&#8217;re the ones I actually look forward to seeing.  I highly doubt the <a href="http://www.cackaloo.com/wp-content/uploads/2009/07/black-sheep.jpg">family members</a> I could care less about seeing know how to operate computers.</p>
<p>What&#8217;s that?  <a href="http://blogs.citypages.com/food/2009/01/drink_of_the_we_34.php">Bloody Mary&#8217;s</a> you say?  Why yes, I believe I&#8217;ll have 3.  At twin cities prices though.  I just hope we don&#8217;t run into that prick of a bartender that looked like a skinnier <a href="http://www.cnn.com/2009/SHOWBIZ/TV/11/24/jon.kate.season.end/index.html">Jon Gosselin</a>, but was still just as big of a <a href="http://douchebagalert.com/db/">douche bag</a>.  If you don&#8217;t want a 5% tip or less, then I suggest smiling at the very least, and not looking so <a href="http://www.suzannesutton.com/_borders/bored_students.jpg">deliberately disinterested</a>.  And I wonder how those people are hired for jobs before me&#8230;.?  Someone please tell me if my fly is down or if I, for some reason, have a swastika on my cheek next time I go in for an interview, please.</p>
<p>Word</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Cone Surface Generator]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/24/cone-surface-generator/</link>
<pubDate>Tue, 24 Nov 2009 19:48:49 +0000</pubDate>
<dc:creator>mark5136</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/24/cone-surface-generator/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by mark.bearak  &#8216;Script copyrighted by architecture.coll]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Option Explicit<br />
&#8216;Script written by mark.bearak <br />
&#8216;Script copyrighted by architecture.collective<br />
&#8216;Script version Tuesday, November 24, 2009 2:13:04 PM</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim i,j,k, strAttractor, arrAttractor, testDistance, dblDistance, strCir, counter,arrPoints()<br />
 Dim intX : intX = 192<br />
 Dim intY : intY = 96<br />
 Dim intStep : intStep = 4<br />
 Dim arrStrAttractors : arrStrAttractors = Rhino.GetObjects (&#8220;Select points&#8221;,1)<br />
 ReDim arrAttractors(UBound(arrStrAttractors ))<br />
 Dim d : d = Rhino.GetInteger (&#8220;max distance of falloff?&#8221;, 24)<br />
 k=0<br />
 For Each strAttractor In arrStrAttractors<br />
  arrAttractors(k) = Rhino.pointcoordinates (strAttractor)<br />
  k=k+1<br />
 Next<br />
 ReDim arrCount (1)<br />
 arrCount(0) = intX/intStep+1<br />
 arrCount(1) = intY/intStep+1<br />
 counter = 0<br />
 For i = 0 To intX Step 4<br />
  For j = 0 To intY Step 4<br />
   ReDim Preserve arrPoints(counter)<br />
   dblDistance = d<br />
   For Each arrAttractor In arrAttractors<br />
    testDistance = Rhino.Distance (array(i,j,0), arrAttractor)<br />
    If testDistance &#60; dblDistance Then<br />
     dblDistance = testDistance<br />
    End If<br />
   Next<br />
   &#8217;Call Rhino.AddPoint (array(i,j,0))<br />
   &#8217;Call Rhino.AddCone (array(i,j,0),array(i,j,(d-dblDistance+1)*-3),intStep/2)<br />
   arrPoints(counter) = array(i,j,(d-dblDistance+1)*((d-dblDistance+1)*-0.2))<br />
   counter = counter + 1<br />
  Next<br />
 Next<br />
 Call Rhino.AddSrfPtGrid (arrCount, arrPoints)<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Production Announcement - You Tube]]></title>
<link>http://microfilums.wordpress.com/2009/11/23/production-announcement-you-tube/</link>
<pubDate>Mon, 23 Nov 2009 17:07:14 +0000</pubDate>
<dc:creator>microfilums</dc:creator>
<guid>http://microfilums.wordpress.com/2009/11/23/production-announcement-you-tube/</guid>
<description><![CDATA[The script for my next Mircofilum, You Tube, is all but finished. The good news &#8211; it features ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://microfilums.wordpress.com/files/2009/07/friends.jpg"><img class="alignleft size-medium wp-image-202" title="Friends" src="http://microfilums.wordpress.com/files/2009/07/friends.jpg?w=300" alt="" width="300" height="215" /></a>The script for my next Mircofilum, <em>You Tube</em>, is all but finished. The good news &#8211; it features the return of the dolls.</p>
<p>My last film <em>I-Cons</em> was, among other things, a satire about the inanity of Facebook. As the  title suggests, <em>You Tube</em> is a comment on what people post and watch on the most popular video sharing site of the century.</p>
<p>Only funny.</p>
<p>Anyway, the lighting is in place. My camera finger is twitchy again. Can&#8217;t wait to get started.</p>
<p>Meanwhile, in case anyone missed it, here is another chance to see the first incarnation of &#8216;the dolls&#8217;. Here at <a href="http://www.metacafe.com/watch/3543099/me_my_friends/">Metacafe</a>, and below at YouTube.</p>
<p><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/uTA_ZbidN58&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' /><param name='allowfullscreen' value='true' /><param name='wmode' value='transparent' /><embed src='http://www.youtube.com/v/uTA_ZbidN58&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='transparent'></embed></object></span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Rotated Aperture Script]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/23/rotated-aperture-script/</link>
<pubDate>Mon, 23 Nov 2009 00:07:48 +0000</pubDate>
<dc:creator>mark5136</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/23/rotated-aperture-script/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by &lt;insert name&gt; &#8216;Script copyrighted by &lt;insert]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Option Explicit<br />
&#8216;Script written by &#60;insert name&#62;<br />
&#8216;Script copyrighted by &#60;insert company name&#62;<br />
&#8216;Script version Sunday, November 22, 2009 5:55:22 PM</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim i,j,k, strAttractor, arrAttractor, testDistance, dblDistance, line1, line2, line3, line4, curve1, curve2, curve3, curve4, square<br />
 Dim arrStrAttractors : arrStrAttractors = Rhino.GetObjects (&#8220;Select points&#8221;,1)<br />
 ReDim arrAttractors(UBound(arrStrAttractors ))<br />
 Dim d : d = Rhino.GetInteger (&#8220;max distance of falloff?&#8221;, 6)<br />
 k=0<br />
 For Each strAttractor In arrStrAttractors<br />
  arrAttractors(k) = Rhino.pointcoordinates (strAttractor)<br />
  k=k+1<br />
 Next<br />
 For i = 1 To 18<br />
  For j = 1 To 12<br />
   dblDistance = d<br />
   For Each arrAttractor In arrAttractors<br />
    testDistance = Rhino.Distance (array(i,j,0), arrAttractor)<br />
    If testDistance &#60; dblDistance Then<br />
     dblDistance = testDistance<br />
    End If<br />
   Next<br />
   line1 = rhino.Addline  (array(i-0.7,j-1),array(i-0.3,j-1))<br />
   line2 = rhino.addline (array(i,j-0.3),array(i,j-0.7))<br />
   line3 = rhino.AddLine (array(i-0.3,j),array(i-0.7,j))<br />
   line4 = rhino.addline (array(i-1,j-0.3),array(i-1,j-0.7))<br />
   curve1 = rhino.AddFilletcurve (line2,line1,0.3)<br />
   curve2 = rhino.AddFilletcurve (line3,line2,0.3)<br />
   curve3 = rhino.addfilletcurve (line4,line3,0.3)<br />
   curve4 = rhino.AddFilletcurve (line1,line4,0.3)<br />
   square = Rhino.JoinCurves (array(line1,line2,line3,line4,curve1,curve2,curve3,curve4),True)<br />
   If dblDistance &#60; d Then<br />
    Call Rhino.ScaleObject (square(0), array(i,j,0),array(dblDistance*(1/d),dblDistance*(1/d),dblDistance*(1/d)))<br />
    Call Rhino.RotateObject(square(0),array(i,j,0), (d-dblDistance)*10)<br />
   End If</p>
<p>  Next<br />
 Next<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Hexagon Generator]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/22/hexagon-generator/</link>
<pubDate>Sun, 22 Nov 2009 23:37:59 +0000</pubDate>
<dc:creator>mark5136</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/22/hexagon-generator/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by mark.bearak &#8216;Script copyrighted by architecture.colle]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Option Explicit<br />
&#8216;Script written by mark.bearak<br />
&#8216;Script copyrighted by architecture.collective<br />
&#8216;Script version Wednesday, 28 October 2009 11:14:25</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim l,k,u,v<br />
 Dim strSrf : strSrf = Rhino.getobject (&#8220;select surface&#8221;, <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /><br />
 Dim intU : intU = 10<br />
 Dim intV : intV = 39<br />
 ReDim arrFrame(intU,intV)<br />
 Dim UDomain : UDomain = Rhino.SurfaceDomain(strSrf, 0)<br />
 Dim VDomain : VDomain = Rhino.SurfaceDomain(strSrf, 1)<br />
 Dim UStep : UStep = (UDomain(1) &#8211; UDomain(0)) / intU<br />
 Dim VStep : VStep = (VDomain(1) &#8211; VDomain(0)) / intV<br />
 For l = 0 To intV<br />
  For k = 0 To intU<br />
   u = UDomain(0) + UStep * k<br />
   v = VDomain(0) + VStep * l<br />
   arrFrame(k,l) = Rhino.SurfaceFrame (strSrf, Array(U,V))<br />
   &#8217;Call Rhino.addPoint (arrFrame(k,l)(0))<br />
   If l &#62; 2 And l Mod 3 = 0 Then<br />
    Call Rhino.AddPolyline (array(arrFrame(k,l)(0),array(arrFrame(k,l-1)(0)(0),arrFrame(k,l-1)(0)(1)+1,arrFrame(k,l-1)(0)(2)),_<br />
    array(arrFrame(k,l-2)(0)(0),arrFrame(k,l-2)(0)(1)+1,arrFrame(k,l-2)(0)(2)),arrFrame(k,l-3)(0),array(arrFrame(k,l-2)(0)(0),arrFrame(k,l-2)(0)(1)-1,arrFrame(k,l-2)(0)(2)),_<br />
    array(arrFrame(k,l-1)(0)(0),arrFrame(k,l-1)(0)(1)-1,arrFrame(k,l-1)(0)(2)),arrFrame(k,l)(0)))<br />
   End If<br />
  Next<br />
 Next<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Pyramid Growth Script]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/22/pyramid-growth-script/</link>
<pubDate>Sun, 22 Nov 2009 23:14:42 +0000</pubDate>
<dc:creator>mark5136</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/22/pyramid-growth-script/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by &lt;insert name&gt; &#8216;Script copyrighted by &lt;insert]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Option Explicit<br />
&#8216;Script written by &#60;insert name&#62;<br />
&#8216;Script copyrighted by &#60;insert company name&#62;<br />
&#8216;Script version Sunday, November 22, 2009 5:55:22 PM</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim strCrv, arrPt, arrParam, arrNormal, arrNewPt, arrPLVs<br />
 Dim strObject : strObject = Rhino.GetObject (&#8220;select your surface&#8221;, <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /><br />
 strCrv = Rhino.DuplicateSurfaceBorder (strObject)<br />
 arrPLVs = Rhino.PolylineVertices (strCrv(0))<br />
 arrPt = Rhino.CurveAreaCentroid (strCrv)<br />
 arrParam = Rhino.SurfaceClosestPoint(strObject, arrPoint)<br />
 arrNormal = Rhino.SurfaceNormal(strObject, arrParam)<br />
 arrNewPt = array(arrPt(0)(0)+arrNormal(0),arrPt(0)(1)+arrNormal(1),arrPt(0)(2)+arrNormal(2))<br />
 Call Rhino.AddLine (arrPt(0), arrNewPt)<br />
 Call Rhino.AddSrfPt (array(arrPLVs(0),arrPLVs(1),arrNewPt))<br />
 Call Rhino.AddSrfPt (array(arrPLVs(1),arrPLVs(2),arrNewPt))<br />
 Call Rhino.AddSrfPt (array(arrPLVs(2),arrPLVs(0),arrNewPt))<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Diamond Panels]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/22/diamond-panels/</link>
<pubDate>Sun, 22 Nov 2009 22:30:54 +0000</pubDate>
<dc:creator>mark5136</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/22/diamond-panels/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by &lt;insert name&gt; &#8216;Script copyrighted by &lt;insert]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Option Explicit<br />
&#8216;Script written by &#60;insert name&#62;<br />
&#8216;Script copyrighted by &#60;insert company name&#62;<br />
&#8216;Script version Sunday, November 22, 2009 5:13:11 PM</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim l,k,u,v<br />
 Dim strsrf : strSrf = Rhino.GetObject (&#8220;select surface&#8221;, <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /><br />
 Dim intU : intU = 12<br />
 Dim intV : intV = 12<br />
 ReDim arrFrame(intU,intV)<br />
 Dim UDomain : UDomain = Rhino.SurfaceDomain(strSrf, 0)<br />
 Dim VDomain : VDomain = Rhino.SurfaceDomain(strSrf, 1)<br />
 Dim UStep : UStep = (UDomain(1) &#8211; UDomain(0)) / intU<br />
 Dim VStep : VStep = (VDomain(1) &#8211; VDomain(0)) / intV<br />
 For l = 0 To intV<br />
  For k = 0 To intU<br />
   u = UDomain(0) + UStep * k<br />
   v = VDomain(0) + vStep * l<br />
   arrFrame(k,l) = Rhino.SurfaceFrame (strSrf, Array(U,V))<br />
   Call Rhino.AddPoint (arrFrame(k,l)(0))<br />
   If (l &#62; 0 And k &#62; 0 And l Mod 2 = 0 And k Mod 2 = 0) Or (l &#62; 1 And k &#62; 1 And l Mod 2 = 1 And k Mod 2 = 1)Then<br />
    Call Rhino.AddSrfPt (array(arrFrame(k-1,l)(0),arrFrame(k-2,l-1)(0),arrFrame(k-1,l-2)(0)))<br />
    Call Rhino.AddSrfPt (array(arrFrame(k,l-1)(0),arrFrame(k-1,l-2)(0),arrFrame(k-1,l)(0)))<br />
   End If<br />
  Next<br />
 Next<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[hexagon surface]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/22/hexagon-surface/</link>
<pubDate>Sun, 22 Nov 2009 22:03:46 +0000</pubDate>
<dc:creator>mark5136</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/22/hexagon-surface/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by mark.bearak &#8216;Script copyrighted by architecture.colle]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Option Explicit<br />
&#8216;Script written by mark.bearak<br />
&#8216;Script copyrighted by architecture.collective<br />
&#8216;Script version Wednesday, 28 October 2009 11:14:25</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim i,j,k,l,u,v,c, strSrf, arrPt()<br />
 strSrf = Rhino.getobject (&#8220;select surface&#8221;)<br />
 <br />
 Dim intU : intU = 12<br />
 Dim intV : intV = 24<br />
 ReDim arrFrame(intU,intV)<br />
 Dim UDomain : UDomain = Rhino.SurfaceDomain(strSrf, 0)<br />
 Dim VDomain : VDomain = Rhino.SurfaceDomain(strSrf, 1)<br />
 Dim UStep : UStep = (UDomain(1) &#8211; UDomain(0)) / intU<br />
 Dim VStep : VStep = (VDomain(1) &#8211; VDomain(0)) / intV<br />
 For l = 0 To intV<br />
  c=0<br />
  For k = 0 To intU<br />
   u = UDomain(0) + UStep * k<br />
   v = VDomain(0) + vStep * l<br />
   arrFrame(k,l) = Rhino.SurfaceFrame (strSrf, Array(U,V))<br />
   If Rhino.IsPointOnSurface (strSrf, arrFrame(k,l)(0)) Then<br />
    Call Rhino.AddPoint (arrFrame(k,l)(0))<br />
    ReDim Preserve arrPt(c)<br />
    arrPt(c) = arrFrame(k,l)(0)<br />
    c = c+1<br />
   End If<br />
  Next<br />
  If IsArray (arrPt) Then<br />
   Call Rhino.AddCurve (arrPt)<br />
  End If<br />
 Next<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[In Search Of - Finding Your Story &amp; Voice]]></title>
<link>http://gideonsway.wordpress.com/2009/11/21/in-search-of-finding-your-story-voice/</link>
<pubDate>Sun, 22 Nov 2009 06:39:43 +0000</pubDate>
<dc:creator>JG Sarantinos</dc:creator>
<guid>http://gideonsway.wordpress.com/2009/11/21/in-search-of-finding-your-story-voice/</guid>
<description><![CDATA[Humans have been telling stories to each other since time immemorial. They serve a deep psychologica]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Humans have been telling stories to each other since time immemorial. They serve a deep psychological and sociological need. Let us examine a few key concepts:</p>
<p><span style="text-decoration:underline;"><strong>WHAT IS A STORY?<br />
</strong></span></p>
<p>Quite simply, it is a journey of inter-connected events with a beginning, middle and an end providing</p>
<ul>
<li>dramatic fulfillment</li>
<li>education</li>
<li>knowledge</li>
<li>entertainment</li>
<li>emotional stimulation and,</li>
<li>a satisfying conclusion (we love closure)</li>
</ul>
<p>Stories began as visual medium when our forebearers painted images on cave walls. or drew with sticks in the sand. They were accompanied by words or grunts. As complex language developed, stories were increasingly verbalized, and later on written. Stories today can be exclusively composed of images, written words or speech, but often times are a combination. Cinema is primarily a visual medium, with a lesser proportion of words (dialogue). Television is more dialogue based than cinema in general.</p>
<p>A story must have a <strong>purpose</strong>. For instance, the Australian Aboriginal woman at a rock formation called &#8220;The Devil&#8217;s Marbles&#8221; in the Northern Territory told stories to keep youngsters away from these rocks to avoid danger. A story can be as dry as a depiction of actual events or &#8220;life-like&#8221; events. Even fantasy fairy tales emulate &#8220;life-like&#8221; events through suspension of disbelief. Whatever dungeons and dragons we use, the events in a story must feel authentic .</p>
<p>Stories also need a <strong>theme</strong> (exploration of the human condition). What topics or concepts is your story exploring? Racism? The power of the human spirit during disaster? Love always triumphs over evil? Revenge? And the list goes on. This has been discussed in an earlier blog in the 36 dramatic situations by Georges Polti.  Be careful that you are only exploring one central theme and perhaps one or two minor ones. Otherwise your story loses focus which must be found.</p>
<p>In order to make a story compelling, there must be a protagonist (hero), a goal, a dilemma, conflict, an antagonist (nemesis) and a moral (leading to growth) to create a complete experience. And more importantly, an audience. Stories help us communicate with each other, and add meaning and enrichment to our lives. They bring people together through sharing and help us evolve and grow stronger.</p>
<p><a href="http://www.dramatica.com/">Dramatica</a> defines story as a grand argument dealing with a problem or an inequity. Huh? Basically, it raises the issue of a hero with a conflict as they are yanked from their natural world through a critical or inciting incident, and how they go about solving it.</p>
<p>During a recent seminar by <strong><a href="http://jengrisanticonsultancy.com/">Jen Grisanti</a></strong> (a Hollywood writers&#8217; consultant and wonderful person too), she spoke of the importance of finding your story. What is the writer specifically trying to say? Why are they taking up her with a series of events? Is your story too episodic? What do you want your audience to get from watching your film? What message are you trying to convey to your audience?</p>
<p>The movie &#8220;Tootsie&#8221; spent close to a decade in development until the writer Larry Gelbart finally decided that &#8216;Tootsie&#8221; was a story about a man who had to become a woman in order to better understand them and himself. It wasn&#8217;t so much a story of desperation, the lengths people go to to make it as an actor, or about a guy liking to dress up. Consider &#8220;What Women Want&#8221; with Mel Gibson and Helen Hunt which was essentially the same story with body rather than clothes swapping.</p>
<p>Jen Grisanti sees stories as media for building communities. Pretty powerful stuff. A good story must have <strong>clarity</strong> and must be <strong>relevant</strong> to the times. How does the story make you feel? These are primal concepts, but difficult to nail down. It must also possess deeper symbolism to have a greater impact on us. She sees the important aspects of raising the emotional stakes in a story as being</p>
<ul>
<li>anticipation</li>
<li>expectation</li>
<li>participation</li>
<li>surprise and,</li>
<li>a delayed payoff</li>
</ul>
<p><span style="text-decoration:underline;"><strong>WHAT IS A PLOT?</strong></span></p>
<p>A plot is simply the way a story is executed, or a cause and effect series of events. A road map. It is the mechanics of your story; how the sequence of events are put together. Many writers confuse the two and think writing event after event constitutes a story, especially in action films. Is your plot linear, non-linear or avariant? Classic examples of unconventional plotting include &#8220;Memento&#8221;, &#8220;Reservoir Dogs&#8221; and &#8220;Run Lola Run&#8221;. Plot also relates to <strong>structure</strong>, the most common being the Aristotelian three act structure. Is there a clear <strong>concept</strong> or story idea, which is more specific than a theme? Good versus evil isn&#8217;t a story concept.  Is there a well defined central/main character with a clear motivation, goal, a dilemma and obstacles. One way to enhance your plotting is to consider what is the worse case scenario if your main character doesn&#8217;t achieve their goal. The ultimate failure to achieve a goal is death.</p>
<p><strong>Subplots</strong> are secondary or tertiary storylines. Some readers have complained that, because a writer hasn&#8217;t really found their story, some subplots are actually more intriguing than the main plot. It happens in unpolished scripts. Even to me! Another problem I recently grappled with is my choice of main character to drive the plot. In the end I switched the boy to a girl (literally not surgically) and everything fell into  place.</p>
<p><span style="text-decoration:underline;"><strong>FINDING YOUR VOICE</strong></span></p>
<p>These are the less tangible qualities that define you as a writer. Jen Grisanti claims that many newer writers lack a distinct voice which distinguishes them from other writers.</p>
<p>This is a difficult process of self exploration. It means that we need to delve deeper into our psyches than ever before. She made us define a critical or life changing incident where the rug was pulled from under our feet and we are forced to deal with a new reality. Sound familiar? In doing so, we help shape our characters which are products of our creativity and therefore ourselves. Imagine placing your profile on a social website. Think of how you would describe your personality? What are your likes and dislikes? What do you value most in your relationships with other people? Certain patterns will emerge which define you as an individual. Are you easy going? Wound up tight? Chatty? Pensive? Conventional? Alternative? Think about how a producer might discuss what qualities you possess as a writer. If a project is greenlit and a producer is looking for a writer and they say &#8220;This project is perfect for xxxx (insert your name)&#8221;, it&#8217;s because of your voice.</p>
<p>Part of finding your voice involves common themes in the stories we like to tell. Are we animal lovers? Philanthropists? Comedians? Feminists? Optimists? Cynical? Interested in human suffering? Are your characters strong, successful people? Are you strong and successful or do you aspire to be? Are characters underdogs? What is their disposition? Happy? Smarmy? Cheerful? Quirks?</p>
<p>Finding your story and finding your voice is rather like wanting a quick definition of the meaning of life. The only way to find it is to keep searching. And the search lies in the writing. So what are you waiting for?</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Sketches, Synopses, Proposals, Scripts...]]></title>
<link>http://declanmay.com/2009/11/21/sketches-synopses-proposals-scripts/</link>
<pubDate>Sat, 21 Nov 2009 18:19:50 +0000</pubDate>
<dc:creator>declanmay</dc:creator>
<guid>http://declanmay.com/2009/11/21/sketches-synopses-proposals-scripts/</guid>
<description><![CDATA[PDF versions of my work are available to professional parties interested in my work. There are 7 PDF]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>PDF versions of my work are available to professional parties interested in my work.  There are 7 PDF files available:<br />
- Television Sketches (23)<br />
- Radio Sketches (18)<br />
- TV Treatments (5)<br />
- Complete TV Comedy Scripts (2)<br />
- Complete TV Drama/SciFi Scripts (3)<br />
- Novel (1)<br />
- Sitcom Proposals (8)<br />
To access these files, drop me a line at <a href="declanmay@declanmay.com">declanmay@declanmay.com</a> and I will email them to you.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Distance based attractor ]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/20/distance-based-attractor/</link>
<pubDate>Fri, 20 Nov 2009 19:26:24 +0000</pubDate>
<dc:creator>cappelqu</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/20/distance-based-attractor/</guid>
<description><![CDATA[]]></description>
<content:encoded><![CDATA[<div class='snap_preview'>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Cossin surface 3]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/20/cossin-surface-3/</link>
<pubDate>Fri, 20 Nov 2009 19:21:57 +0000</pubDate>
<dc:creator>cappelqu</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/20/cossin-surface-3/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by &lt;ClaesAppelquist&gt; &#8216;Script copyrighted by &lt;CH]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Option Explicit<br />
&#8216;Script written by &#60;ClaesAppelquist&#62;<br />
&#8216;Script copyrighted by &#60;CHarc&#62;<br />
&#8216;Script version Thursday, November 05, 2009 2:31:54 PM</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim c,d<br />
 Dim counter : counter = 0<br />
 Dim i : i = 60<br />
 Dim j : j = 60<br />
 ReDim arrCrvs(i*2+1)<br />
 ReDim arrPts(j)<br />
 For d = 0 To i<br />
  For c = 0 To j<br />
   arrPts(c) = array(c,sin(c+d*(c/4))+d,cos(c+d*(c/4))+sin(d*c/4))<br />
  Next<br />
  arrCrvs(counter) = rhino.AddCurve (arrPts)<br />
  counter = counter + 1<br />
  For c = 0 To j<br />
   arrPts(c) = array(c,sin(c+d*(c/4))+d+0.025,sin(c+d*(c/4))+cos(c/2)+0.01)<br />
  Next<br />
  arrCrvs(counter) = rhino.AddCurve (arrPts)<br />
  counter = counter + 1<br />
 Next<br />
 Call Rhino.AddLoftSrf (arrCrvs)<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Cossin surface ]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/20/cossin-surface/</link>
<pubDate>Fri, 20 Nov 2009 19:14:32 +0000</pubDate>
<dc:creator>cappelqu</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/20/cossin-surface/</guid>
<description><![CDATA[Option Explicit &#8216;Script written by &lt;ClaesAppelquist&gt; &#8216;Script copyrighted by &lt;CH]]></description>
<content:encoded><![CDATA[<div class='snap_preview'>
<p>Option Explicit<br />
&#8216;Script written by &#60;ClaesAppelquist&#62;<br />
&#8216;Script copyrighted by &#60;CHarc&#62;<br />
&#8216;Script version Thursday, November 05, 2009 2:31:54 PM</p>
<p>Call Main()<br />
Sub Main()<br />
 Dim c,d<br />
 Dim counter : counter = 0<br />
 Dim i : i = 60<br />
 Dim j : j = 60<br />
 ReDim arrCrvs(i*2+1)<br />
 ReDim arrPts(j)<br />
 For d = 0 To i<br />
  For c = 0 To j<br />
   arrPts(c) = array(c,sin(c+d*(c/4))+d,cos(c+d*(c/4))+sin(d*c/4))<br />
  Next<br />
  arrCrvs(counter) = rhino.AddCurve (arrPts)<br />
  counter = counter + 1<br />
  For c = 0 To j<br />
   arrPts(c) = array(c,sin(c+d*(c/4))+d+0.025,sin(c+d*(c/4))+cos(c/2)+0.01)<br />
  Next<br />
  arrCrvs(counter) = rhino.AddCurve (arrPts)<br />
  counter = counter + 1<br />
 Next<br />
 Call Rhino.AddLoftSrf (arrCrvs)<br />
End Sub</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Extract from Under Milk Wood by Dylan Thomas]]></title>
<link>http://readmorestuff.wordpress.com/2009/11/20/extract-from-under-milk-wood-by-dylan-thomas/</link>
<pubDate>Fri, 20 Nov 2009 12:17:12 +0000</pubDate>
<dc:creator>jamesnee</dc:creator>
<guid>http://readmorestuff.wordpress.com/2009/11/20/extract-from-under-milk-wood-by-dylan-thomas/</guid>
<description><![CDATA[Alone until she dies, Bessie Big Head, hired help, born in the work house, smelling of the cow shed,]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Alone until she dies, Bessie Big Head, hired help, born in the work house, smelling of the cow shed, snores base and gruff on a couch of straw in a loft in salt lake farm and picks a posy of daises in Sunday meadow to put on the grave of Gommer Owen who kissed her once by the pig sty when she wasn’t looking and never kissed her again although she was looking all the time.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[50% off all the alcohol!]]></title>
<link>http://epdunne4891.wordpress.com/2009/11/19/50-off-all-the-alcohol/</link>
<pubDate>Fri, 20 Nov 2009 03:37:30 +0000</pubDate>
<dc:creator>Grizzly Skag Bear</dc:creator>
<guid>http://epdunne4891.wordpress.com/2009/11/19/50-off-all-the-alcohol/</guid>
<description><![CDATA[I&#8217;m a fan of liquor stores, but I&#8217;d be a bigger fan of them if they opened and closed mo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;m a fan of liquor stores, but I&#8217;d be a bigger fan of them if they opened and closed more frequently in the same spots.  You can&#8217;t beat six bottles of an assortment of wine, shot stuff and <a href="http://www.stumbleupon.com/">extra dry vermouth</a> for 28$.  That&#8217;s the America I want to live in. In moderation of course though.</p>
<p>As I posted last week, I was supposed to start writing the script again, but haven&#8217;t started up again.  There is a ton more to think about this time.  Factoring in the budget, locations to film, people I know or don&#8217;t know; it&#8217;s all weighing down on how I write the next part of the movie.  It&#8217;s very apparent this is a lot easier in tinsel town since they have A: Money, and B: resources.</p>
<p>I have a few goals with this movie, and I&#8217;ll tell you one of them: I fully expect this movie to be better than every Colin Farrell movie ever made, COMBINED.  Now, I understand your thinking, &#8220;But Erik, no one has ever attempted to out act, produce and direct anything Colin Farrell has ever done, how will you do it?&#8221;</p>
<p>Once you see the movie, you will know.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Week 4: Pseudo-code]]></title>
<link>http://parametricrealizationsfa09.wordpress.com/2009/11/20/week-4-pseudo-code/</link>
<pubDate>Fri, 20 Nov 2009 00:30:46 +0000</pubDate>
<dc:creator>ellemotion</dc:creator>
<guid>http://parametricrealizationsfa09.wordpress.com/2009/11/20/week-4-pseudo-code/</guid>
<description><![CDATA[Inspirational image Surface Pseudo-code: 1. draw a hexagon, HEX(0,0), given (v1, radius) 2. collect ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div id="attachment_803" class="wp-caption alignleft" style="width: 510px"><a href="http://parametricrealizationsfa09.wordpress.com/files/2009/11/inspiration.jpg"><img class="size-full wp-image-803" title="inspiration" src="http://parametricrealizationsfa09.wordpress.com/files/2009/11/inspiration.jpg" alt="" width="500" height="250" /></a><p class="wp-caption-text">Inspirational image</p></div>
<p>Surface Pseudo-code:</p>
<p>1. draw a hexagon, HEX(0,0), given (v1, radius)</p>
<p>2. collect vertices and center in array (0-6)</p>
<p>3. draw all other hexagons</p>
<p>3.1. for i=1 to n, j=1 to m</p>
<p>HEX(i,j)(v1)=HEX(i-1,j)(v3)</p>
<p>HEX(i+1,j)(v6)=HEX(i,j)(v1)</p>
<p>3.2. collect  vertices + centers HEX(i,j)(v0-6)</p>
<p>4. draw middle circles: center=HEX(i,j)(v0), radius = by attractor</p>
<p>4.1. split circles in 12</p>
<p>4.2. collect pieces (1-12)</p>
<p>4.3. collect piece ends (1,2)</p>
<p>5. draw hexagon circles:</p>
<p>5.1. center HEX(i,j) = (v1,3,5) (z-c)</p>
<p>5.2. center HEX(i,j) = (v2,4,6) (z+c)</p>
<p>5.3. split all in 6, collect ends</p>
<p>6. draw curve &#8211; middle to hex. circle:</p>
<p>6.1. rotate YZ-plane 30 deg.</p>
<p>6.2. draw vert. lines through middle end, hex. end</p>
<p>6.3. draw circle 1 &#8211; tangent to line 1 and ? / circle 2 &#8211; tangent to line 2 and circle 1</p>
<p>6.4. trim circles and join</p>
<p>7. draw curve &#8211; middle to middle circles:</p>
<p>7.1. same procedure</p>
<p>8. copy/rotate curve to 5th surface edge</p>
<p>9. patch 5 curves &#8211; get surface</p>
<p>10. mirror/copy surfaces</p>
<p>11. run drill script</p>
<p>12. end</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[FUNÇÕES: Validação de CNPJ e CPF]]></title>
<link>http://sqlfromhell.wordpress.com/2009/11/19/validacao-de-cnpj-e-cpf/</link>
<pubDate>Thu, 19 Nov 2009 23:50:20 +0000</pubDate>
<dc:creator>Paulo R. Pereira</dc:creator>
<guid>http://sqlfromhell.wordpress.com/2009/11/19/validacao-de-cnpj-e-cpf/</guid>
<description><![CDATA[Boa noite pessoas! No blog do Rogério, encontrei um ótimo algoritmo de validação de CNPJ e CPF para ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Boa noite pessoas!</p>
<p>No <a href="http://blogdozunga.blogspot.com/2009/02/precisava-de-uma-rotina-para-validar.html" target="_blank">blog do Rogério</a>, encontrei um ótimo algoritmo de validação de CNPJ e CPF para ORACLE, para que ninguém tenha que ficar transitando de &#8216;PL\SQL&#8217; para &#8216;T-SQL&#8217;, já realizei este trabalho e vou detalhar um pouco o funcionamento deste algoritmo.</p>
<p>Primeiro precisamos de um CNPJ ou CPF para validar, assim identifiquei um que estava &#8220;vagando&#8221; na internet.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>DECLARE @CPF_CNPJ VARCHAR(20)<br />
SET @CPF_CNPJ = '02.841.834/0001-55'</code></div>
<p>Ok, tenho o CNPJ/CPF para validar, mas tenho que remover os caracteres não numéricos, desta forma utilizarei a função SOMENTE_NUMEROS que desenvolvi para o <a href="http://sqlfromhell.wordpress.com/2009/11/18/somente-numeros-com-cte/" target="_blank">artigo anterior</a>:</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>SET @CPF_CNPJ = dbo.SOMENTE_NUMEROS(@CPF_CNPJ)</code></div>
<p>A primeira valiação verifica se a quantidade de caracteres é de um CPF ou de um CNPJ</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>IF LEN(@CPF_CNPJ) NOT IN (11, 14)<br />
BEGIN<br />
  SELECT 'Inválido'<br />
  RETURN<br />
END</code></div>
<p>Em sequida, defino quatro variáveis que serão utilizadas para a validação dos digitos verificadores do CNPJ e CPF.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>DECLARE<br />
  @DIGITO1 INT,<br />
  @DIGITO2 INT,<br />
  @VALOR1 INT,<br />
  @VALOR2 INT</code></div>
<p>Também há outras variáveis a serem utilizadas durante a operação.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>DECLARE<br />
  @I INT,<br />
  @J INT,<br />
  @TOTAL_TMP INT,<br />
  @COEFICIENTE_TMP INT,<br />
  @DIGITO_TMP INT,<br />
  @VALOR_TMP INT</code></div>
<p>As variáveis DIGITO1 e DIGITO2 armazenarão os digitos verificadores do CNPJ/CPF.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>SET @DIGITO1 = SUBSTRING(@CPF_CNPJ, LEN(@CPF_CNPJ) - 1, 1)<br />
SET @DIGITO2 = SUBSTRING(@CPF_CNPJ, LEN(@CPF_CNPJ), 1)<br />
</code></div>
<p>Feito isso, determino um laço de repetição para dois loops, um para cada digito.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>SET @J = 1<br />
WHILE @J &#60;= 2<br />
BEGIN</code></div>
<p> Determino os valores inicias das variáveis de validação.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>  SELECT<br />
    @TOTAL_TMP = 0,<br />
    @COEFICIENTE_TMP = 2<br />
</code></div>
<p>Agora, aplico o algoritmo para gerar cada um dos digitos verificadores.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>  SET @I = ((LEN(@CPF_CNPJ) - 3) + @J)<br />
  WHILE @I &#62;= 0<br />
  BEGIN<br />
    SELECT<br />
      @DIGITO_TMP = SUBSTRING(@CPF_CNPJ, @I, 1),<br />
      @TOTAL_TMP = @TOTAL_TMP + (@DIGITO_TMP * @COEFICIENTE_TMP),<br />
      @COEFICIENTE_TMP = @COEFICIENTE_TMP + 1<br />
</code><code>    IF (@COEFICIENTE_TMP &#62; 9) AND LEN(@CPF_CNPJ) = 14<br />
      SET @COEFICIENTE_TMP = 2<br />
</code><code>    SET @I = @I - 1<br />
  END<br />
</code><code>  SET @VALOR_TMP = 11 - (@TOTAL_TMP % 11)<br />
</code><code>  IF (@VALOR_TMP &#62;= 10)<br />
    SET @VALOR_TMP = 0 </code></div>
<p>Identifico qual dos digitos verificadores foi gerado e prossigo para o próximo digito no laço de repetição.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>  IF @J = 1<br />
    SET @VALOR1 = @VALOR_TMP<br />
  ELSE<br />
    SET @VALOR2 = @VALOR_TMP<br />
</code><code>  SET @J = @J + 1<br />
END</code></div>
<p>Por fim, verifico se os digitos gerados têm o mesmo valor dos presente no CNPJ/CPF.</p>
<div style="border:1px;background-color:#000000;color:#ffffff;font-weight:bold;border-color:#ffffff;margin:5px;padding:5px;"><code>IF @VALOR1 = @DIGITO1 AND @VALOR2 = @DIGITO2<br />
  SELECT 'Válido'<br />
ELSE<br />
  SELECT 'Inválido'</code></div>
<p>Para o próximo artigo, ainda estou estudando uma forma interessante de trabalhar com máscaras e CTE.</p>
<p><strong>Disponíveis para download:</strong></p>
<p>Função SOMENTE_NUMEROS (com CTE):<br />
<a href="http://www.4shared.com/file/152602089/d1b4b224/SOMENTE_NUMEROS_-_CTE_-_Func.html" target="_blank">http://www.4shared.com/file/152602089/d1b4b224/SOMENTE_NUMEROS_-_CTE_-_Func.html</a></p>
<p>Função SOMENTE_NUMEROS (com WHILE):<br />
<a href="http://www.4shared.com/file/152602109/18af521b/SOMENTE_NUMEROS_-_WHILE_-_Func.html" target="_blank">http://www.4shared.com/file/152602109/18af521b/SOMENTE_NUMEROS_-_WHILE_-_Func.html</a></p>
<p>Função VALIDA_CPF_CNPJ:<br />
<a href="http://www.4shared.com/file/152602115/8022f71/VALIDA_CPF_CNPJ_-_Func.html" target="_blank">http://www.4shared.com/file/152602115/8022f71/VALIDA_CPF_CNPJ_-_Func.html</a></p>
<p><strong>Artigos relacionados:</strong></p>
<p>Blog do Rogério &#8211; Validação CNPJ/CPF com PL/SQL<br />
<a href="http://blogdozunga.blogspot.com/2009/02/precisava-de-uma-rotina-para-validar.html" target="_blank">http://blogdozunga.blogspot.com/2009/02/precisava-de-uma-rotina-para-validar.html</a></p>
<p>FUNÇÕES: Somente Números (com CTE)<br />
<a href="http://sqlfromhell.wordpress.com/2009/11/18/somente-numeros-com-cte/" target="_blank">http://sqlfromhell.wordpress.com/2009/11/18/somente-numeros-com-cte/</a></p>
<p>FUNÇÕES: Somente Números (com WHILE)<br />
<a href="http://sqlfromhell.wordpress.com/2009/11/17/somente-numeros-com-while/" target="_blank">http://sqlfromhell.wordpress.com/2009/11/17/somente-numeros-com-while/</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Trading Local pics]]></title>
<link>http://stevecoxon.wordpress.com/2009/11/19/trading-local-pics/</link>
<pubDate>Thu, 19 Nov 2009 22:51:06 +0000</pubDate>
<dc:creator>Steve Coxon</dc:creator>
<guid>http://stevecoxon.wordpress.com/2009/11/19/trading-local-pics/</guid>
<description><![CDATA[This set of pics uploaded by Exeter Northcott on flickr gives a flavour of the event.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This <a title="Trading Local on flickr" href="http://www.flickr.com/photos/exeternorthcott/sets/72157622704582717/show/" target="_blank">set of pics </a>uploaded by Exeter Northcott on flickr gives a flavour of the event.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Text file processing with IDL]]></title>
<link>http://bubuitalia.wordpress.com/2009/11/19/text-file-processing-with-idl/</link>
<pubDate>Thu, 19 Nov 2009 22:39:16 +0000</pubDate>
<dc:creator>bubuitalia</dc:creator>
<guid>http://bubuitalia.wordpress.com/2009/11/19/text-file-processing-with-idl/</guid>
<description><![CDATA[A friend recently asked me how to process a text file. It was a collection of measurements of plants]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A friend recently asked me how to process a text file. It was a collection of measurements of plants roots (size and mass) made at various depths from different pits; looking like (after some formatting):</p>
<pre>
id     depth_name     mass     size
1     30-50              0.5         10
1     30-50              0.45       3
1     30-50              0.3         4.2
1     50-70              0.7         5
1     50-70              0.72       5.3
...    ...                     ...           ...
2     30-50             0.8         4
</pre>
<p>This friend needed to sum up roots lengths for a same pit and depth.<br />
First you have to format well your file. By well formatted, I mean: use a separator like a comma &#8216;,&#8217; or a space (if not ambiguous). Then read the file with the READ_ASCII command:</p>
<pre>
pro process_file
textfile='path/to_my/textfile.txt'
data=read_ascii(textfile, template=ascii_template(textfile))
end
</pre>
<pre>read_ascii</pre>
<p> excepts a file template (you can indicate to jump some heading line, choose a column separator and indicate the data type per column). In this case, I choose a string format for the second column.<br />
Alright. The read_ascii command stores the text file value in the data structure. In this case, data has the following fields:<br />
data.field1 stores pits ids<br />
data.field2 stores depths labels<br />
data.field3 stores the mass column<br />
data.field4 stores the roots length column.<br />
Note the structure is &#8216;field&#8217; par idl, you can&#8217;t change it.</p>
<p>Le&#8217;s say we want the list of pits ids:<br />
listpitds=data.field1(uniq(data.field1))<br />
uniq function returns ending position of continuous series of values in an array.<br />
Let&#8217;s loop over the list of pit ids, and for each pit id, get the list of unique depths-labels (again!) and for these selected lines, sum up roots lengths:</p>
<pre>
for ipid=0, n_elements(listpits)-1 do begin
  ; now get list of depths NAMES
  wherePits = where(data.field1 EQ listpits[ipid])
  allDepths=data.field2(wherePits)
  listDepths=allDepths[uniq(allDepths)]

  ; now for this pit id, sum for each type of depths
  for idepths=0, n_elements(listDepths)-1 do begin
    ; get position of data to sum
    wts = where( (data.field1 eq listpits[ipid]) AND (strcmp(data.field2, listDepths[idepths]) ) )
    print, 'pits: ',strcompress(listpits[ipid]), ', at depth: ', listDepths[idepths],' cm total root length is ',total(data.field5[wts])
  endfor
endfor
</pre>
<p>Easy no?<br />
Complete program is below:</p>
<pre>
pro process_file

textfile='E:\field_data.csv'

;myTemplate=ascii_template(textfile)
;save, myTemplate,filename='E:\myTemplate.sav'
restore, 'E:\myTemplate.sav'
data = read_ascii(textfile, template=myTemplate)

; now data are in data.field1, data.field2 etc.
; to see: help,data,/structure
data.field2=strcompress(data.field2)
; what is the list of id (i.e. of pits)?
; Caution: assume list already sorted, i.e. pits id are not mixed...

; get list of pits id
listpits=data.field1[uniq(data.field1)]

; loop over the list of pits
for ipid=0, n_elements(listpits)-1 do begin
  ; now get list of depths NAMES
  wherePits = where(data.field1 EQ listpits[ipid])
  allDepths=data.field2(wherePits)
  listDepths=allDepths[uniq(allDepths)]

  ; now for this pit id, sum for each type of depths
  for idepths=0, n_elements(listDepths)-1 do begin
    ; get position of data to sum
    wts = where( (data.field1 eq listpits[ipid]) AND (strcmp(data.field2, listDepths[idepths]) ) )
    print, 'pits: ',strcompress(listpits[ipid]), ', at depth: ', listDepths[idepths],' cm total root length is ',total(data.field5[wts])
  endfor
endfor
end
</pre>
</div>]]></content:encoded>
</item>

</channel>
</rss>
