<?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>RuddWire</title>
	<atom:link href="http://www.ruddwire.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ruddwire.com</link>
	<description>Ruddwire.com: food, book, theatre reviews, data presentation projects, code snippets, millisecond date calculators</description>
	<lastBuildDate>Sat, 17 Jul 2010 00:45:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Perl script make MySQL query, binds variables, outputs JSON</title>
		<link>http://www.ruddwire.com/1049/tech/perl-script-make-mysql-query-binds-variables-outputs-json/</link>
		<comments>http://www.ruddwire.com/1049/tech/perl-script-make-mysql-query-binds-variables-outputs-json/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 00:40:11 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=1049</guid>
		<description><![CDATA[An example of a Perl script that is called by an ajax request.  The script takes in just one parameter, opens a MySQL DB connection, binds the parameter to the query, and sends the query.  The result is then formatted into JSON and returned to the browser.
This can be seen in action on [...]]]></description>
			<content:encoded><![CDATA[<p>An example of a Perl script that is called by an ajax request.  The script takes in just one parameter, opens a MySQL DB connection, binds the parameter to the query, and sends the query.  The result is then formatted into JSON and returned to the browser.</p>
<p>This can be seen in action on this page: <a href="http://www.ruddwire.com/friendly-data/naics-explorer/">http://www.ruddwire.com/friendly-data/naics-explorer/</a>, in the NAICS search box.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> DBI<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> CGI <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">:</span>standard<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$mySQL</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$result</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'({&quot;failure&quot;:1})'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#QUERY PARAMS</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$q</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ref</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$table</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$tableRow</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CGI<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
    <span style="color: #0000ff;">$q</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'q'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$q</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/\s+/%/</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;"># REPLACE SPACES WITH WILD CARD CHARACTER, CAUSES TO SEARCH FOR ALL WORDS, NOT JUST PHRASE</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">### Connect to the database.</span>
	<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span> <span style="color: #339933;">=</span> DBI<span style="color: #339933;">-&gt;</span><span style="color: #006600;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;DBI:mysql:database=***DBNAME***;host=localhost&quot;</span><span style="color: #339933;">,</span>
                         <span style="color: #ff0000;">&quot;***USERNAME***&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;***PASSWORD***&quot;</span><span style="color: #339933;">,</span>
                         <span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'RaiseError'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    	<span style="color: #666666; font-style: italic;">### GET INDUSTRY NAME AND CODE</span>
    	<span style="color: #0000ff;">$mySQL</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;SELECT code,industry FROM naics2007IndustryIndex WHERE industry LIKE ? ORDER BY industry&quot;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
     <span style="color: #0000ff;">$sth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$mySQL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$</span><span style="color: #009900;">&#123;</span><span style="color: #000066;">q</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;%&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ref</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">fetchrow_hashref</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span><span style="color: #339933;">,</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #000066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">%$ref</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		  	  <span style="color: #0000ff;">$value</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/&quot;/\\&quot;/g</span><span style="color: #339933;">;</span>
			  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>${value}<span style="color: #000099; font-weight: bold;">\&quot;</span>,&quot;</span><span style="color: #339933;">;</span>
		  <span style="color: #009900;">&#125;</span>
&nbsp;
		  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/,$//</span><span style="color: #339933;">;</span>
		  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;[${tableRow}],&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		  <span style="color: #0000ff;">$table</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">$tableRow</span><span style="color: #339933;">;</span>
		  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #0000ff;">$table</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/,$//</span><span style="color: #339933;">;</span>
&nbsp;
	  	<span style="color: #0000ff;">$result</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'{&quot;failure&quot;:0,&quot;result&quot;:['</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$table</span><span style="color: #339933;">.</span><span style="color: #ff0000;">']}'</span><span style="color: #339933;">;</span>         
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">### END IF QUERY</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Content-type: text/javascript; charset=iso-8859-1<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$result</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/1049/tech/perl-script-make-mysql-query-binds-variables-outputs-json/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Midtowners&#8230;</title>
		<link>http://www.ruddwire.com/919/photos/more-midtowners/</link>
		<comments>http://www.ruddwire.com/919/photos/more-midtowners/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 01:30:49 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Midtown Manhattan]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[midtown manhattan]]></category>
		<category><![CDATA[pretzel]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=919</guid>
		<description><![CDATA[Some Midtown Manhattan characters: sharp dressers, determined eaters...]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter size-large wp-image-1038" title="Death Of a Model" src="http://www.ruddwire.com/wp-content/uploads/2010/03/IMG_1103-682x1024.jpg" alt="Death Of a Model" width="409" height="614" />&#8220;Death of a Model&#8221;</p>
<p style="text-align: center;">
<p style="text-align: center;"><img class="size-full wp-image-920 aligncenter" title="Professor Pretzel" src="http://www.ruddwire.com/wp-content/uploads/2010/03/thumb.jpg" alt="Professor Pretzel" width="384" height="512" /></p>
<p style="text-align: center;"><strong>T<span style="font-size: medium;"><span style="font-size: small;">his is where we have fun with captions:</span></span></strong></p>
<p style="text-align: center;">Professor Pretzel</p>
<p style="text-align: center;">Mr. Serious Munchies</p>
<p style="text-align: center;">Midtown Mangeur</p>
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;"><img class="aligncenter size-full wp-image-925" title="A Gentleman Through Time" src="http://www.ruddwire.com/wp-content/uploads/2010/03/thumb1.jpg" alt="A Gentleman Through Time" width="341" height="512" />A Gentleman Through Time</p>
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;"><img class="aligncenter size-full wp-image-926" title="The Mystery Guest on Park Avenue" src="http://www.ruddwire.com/wp-content/uploads/2010/03/thumb2.jpg" alt="The Mystery Guest on Park Avenue" width="512" height="341" />The Mystery Guest on Park Avenue</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-931" title="Downtowner will not stop in Midtown!" src="http://www.ruddwire.com/wp-content/uploads/2010/03/IMG_0062.jpg" alt="Downtowner will not stop in Midtown!" width="337" height="640" />Downtowner will not stop in Midtown!</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-933" title="IMG_0066" src="http://www.ruddwire.com/wp-content/uploads/2010/03/IMG_0066.jpg" alt="IMG_0066" width="595" height="640" />Just follow the suits, mister.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-934" title="IMG_0067" src="http://www.ruddwire.com/wp-content/uploads/2010/03/IMG_0067.jpg" alt="IMG_0067" width="320" height="640" />Just follow the suits, lady.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-954" title="IMG_0150" src="http://www.ruddwire.com/wp-content/uploads/2010/03/IMG_0150.jpg" alt="IMG_0150" width="422" height="640" />Hot Dogs and Bowties</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-956" title="IMG_0108" src="http://www.ruddwire.com/wp-content/uploads/2010/03/IMG_0108.jpg" alt="IMG_0108" width="384" height="640" />Nice coat!</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-957" title="IMG_0100" src="http://www.ruddwire.com/wp-content/uploads/2010/03/IMG_0100.jpg" alt="IMG_0100" width="384" height="640" />Mr Snappy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/919/photos/more-midtowners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl script makes MySQL query; outputs to JSON</title>
		<link>http://www.ruddwire.com/1025/tech/perl-script-makes-mysql-query-outputs-to-json/</link>
		<comments>http://www.ruddwire.com/1025/tech/perl-script-makes-mysql-query-outputs-to-json/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 01:37:34 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=1025</guid>
		<description><![CDATA[<p>An example of a perl script that is called by an ajax request.  The script takes in a few parameters, opens a mySQL DB connection, and then makes a rather tortuous query.  The result is then formatted in to JSON and returned to the browser.</p>]]></description>
			<content:encoded><![CDATA[<p>An example of a Perl script that is called by an ajax request.  The script takes in a few parameters, opens a MySQL DB connection, and then makes a rather tortuous query.  The result is then formatted into JSON and returned to the browser.</p>
<p>This can be seen in action on this page: <a href="http://www.ruddwire.com/friendly-data/naics-explorer/">http://www.ruddwire.com/friendly-data/naics-explorer/</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> DBI<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> CGI <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">:</span>standard<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sth</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$mySQL</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$result</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'({&quot;failure&quot;:1})'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#QUERY PARAMS</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$strLn</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$classification</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$getDef</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$getIndus</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$naicsMatch</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$countMatch</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@subClasses</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ref</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$table</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$tableRow</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> scrubInputText <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">my</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$it</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$shellChars</span> <span style="color: #339933;">=</span> q<span style="color: #339933;">-</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">&amp;;</span><span style="color: #ff0000;">`'<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\|</span><span style="color: #000099; font-weight: bold;">\*</span><span style="color: #000099; font-weight: bold;">\?</span><span style="color: #000099; font-weight: bold;">\~</span>&lt;&gt;<span style="color: #000099; font-weight: bold;">\^</span><span style="color: #000099; font-weight: bold;">\(</span><span style="color: #000099; font-weight: bold;">\)</span><span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\]</span><span style="color: #000099; font-weight: bold;">\{</span><span style="color: #000099; font-weight: bold;">\}</span><span style="color: #000099; font-weight: bold;">\$</span><span style="color: #000099; font-weight: bold;">\\</span>n<span style="color: #000099; font-weight: bold;">\\</span>r]-;    #`</span>
&nbsp;
    <span style="color: #0000ff;">$it</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/$shellChars//g</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$it</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/^\s+|\s+$//g</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000066;">return</span> <span style="color: #0000ff;">$it</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CGI<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #0000ff;">$strLn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&amp;scrubInputText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'strLn'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$classification</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&amp;scrubInputText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'cls'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$getDef</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&amp;scrubInputText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'getDef'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$getIndus</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&amp;scrubInputText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'getIndus'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">###HANDLE GROUPED SECTOR CODES, IE: 31-33</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$classification</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">/-/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    	<span style="color: #0000ff;">@subClasses</span> <span style="color: #339933;">=</span> <span style="color: #000066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;-&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$classification</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #0000ff;">$naicsMatch</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;AND (&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$subClass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$subClasses</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$subClass</span> <span style="color: #339933;">&lt;=</span> <span style="color: #0000ff;">$subClasses</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$subClass</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    		<span style="color: #0000ff;">$naicsMatch</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">&quot;code LIKE '${subClass}%' OR &quot;</span><span style="color: #339933;">;</span>
    		<span style="color: #0000ff;">$countMatch</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">&quot;code LIKE '${subClass}%' OR &quot;</span><span style="color: #339933;">;</span>
    	<span style="color: #009900;">&#125;</span>
    	<span style="color: #0000ff;">$countMatch</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/ OR $//</span><span style="color: #339933;">;</span>
    	<span style="color: #0000ff;">$naicsMatch</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/ OR $//</span><span style="color: #339933;">;</span>
    	<span style="color: #0000ff;">$naicsMatch</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">&quot;)&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
       <span style="color: #0000ff;">$naicsMatch</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;AND code LIKE '${classification}%'&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$strLn</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$countMatch</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;code LIKE Concat(naics2007.code,'%')&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">### Connect to the database.</span>
	<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span> <span style="color: #339933;">=</span> DBI<span style="color: #339933;">-&gt;</span><span style="color: #006600;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;DBI:mysql:database=***DBNAME***;host=localhost&quot;</span><span style="color: #339933;">,</span>
                         <span style="color: #ff0000;">&quot;***USERNAME***&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;***PASSWORD***&quot;</span><span style="color: #339933;">,</span>
                         <span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'RaiseError'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$getDef</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    	<span style="color: #0000ff;">$mySQL</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;SELECT definition FROM naics2007definitions WHERE code='${classification}'&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elsif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$getIndus</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    	<span style="color: #666666; font-style: italic;">### GET FINAL INDUSTRY NAME</span>
    	<span style="color: #0000ff;">$mySQL</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;SELECT code,industry FROM naics2007IndustryIndex WHERE code LIKE '${classification}' ORDER BY industry&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    	<span style="color: #666666; font-style: italic;">### GET INDUSTRY CLASSIFICATIONS</span>
&nbsp;
&nbsp;
 		<span style="color: #0000ff;">$mySQL</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;SELECT code,title, &quot;</span><span style="color: #339933;">.</span>
     	<span style="color: #ff0000;">&quot;(SELECT COUNT(code) FROM naics2007IndustryIndex WHERE &quot;</span><span style="color: #339933;">.</span>
     	<span style="color: #ff0000;">&quot;CASE naics2007.code &quot;</span><span style="color: #339933;">.</span>
     	<span style="color: #ff0000;">&quot;WHEN '31-33' THEN (code LIKE '31%' OR code LIKE '32%' OR code LIKE '33%') &quot;</span><span style="color: #339933;">.</span>
     	<span style="color: #ff0000;">&quot;WHEN '44-45' THEN (code LIKE '44%' OR code LIKE '45%') &quot;</span><span style="color: #339933;">.</span>
     	<span style="color: #ff0000;">&quot;WHEN '48-49' THEN (code LIKE '48%' OR code LIKE '49%') &quot;</span><span style="color: #339933;">.</span>
     	<span style="color: #ff0000;">&quot;ELSE code LIKE Concat(naics2007.code,'%') END) AS c&quot;</span><span style="color: #339933;">.</span>
     	<span style="color: #ff0000;">&quot; FROM naics2007 WHERE (CHAR_LENGTH(code) = $strLn OR code LIKE '__-__')&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$naicsMatch</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
     <span style="color: #0000ff;">$sth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$mySQL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ref</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">fetchrow_hashref</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span><span style="color: #339933;">,</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #000066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">%$ref</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		  	  <span style="color: #0000ff;">$value</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/&quot;/\\&quot;/g</span><span style="color: #339933;">;</span>
			  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>${value}<span style="color: #000099; font-weight: bold;">\&quot;</span>,&quot;</span><span style="color: #339933;">;</span>
		  <span style="color: #009900;">&#125;</span>
&nbsp;
		  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/,$//</span><span style="color: #339933;">;</span>
		  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;[${tableRow}],&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		  <span style="color: #0000ff;">$table</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">$tableRow</span><span style="color: #339933;">;</span>
		  <span style="color: #0000ff;">$tableRow</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #0000ff;">$table</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/,$//</span><span style="color: #339933;">;</span>
&nbsp;
	  	<span style="color: #0000ff;">$result</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'{&quot;failure&quot;:0,&quot;result&quot;:['</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$table</span><span style="color: #339933;">.</span><span style="color: #ff0000;">']}'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">### END IF QUERY</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Content-type: application/json; charset=iso-8859-1<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$result</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/1025/tech/perl-script-makes-mysql-query-outputs-to-json/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>macbook pro turns on but screen stays black &#8212; my solution</title>
		<link>http://www.ruddwire.com/1017/tech/macbook-pro-turns-on-but-screen-stays-black-my-solution/</link>
		<comments>http://www.ruddwire.com/1017/tech/macbook-pro-turns-on-but-screen-stays-black-my-solution/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 17:26:24 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[black screen]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macbook pro]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=1017</guid>
		<description><![CDATA[The Apple Macbook Pro would turn on, but the screen would not.  The screen would stay black.  I could tell the computer was on because when I hit the &#8220;caps lock&#8221; key, the green light on the key would turn on and off.
I fixed this the following way (this is basically resetting the Power Management [...]]]></description>
			<content:encoded><![CDATA[<p>The Apple Macbook Pro would turn on, but the screen would not.  The screen would stay black.  I could tell the computer was on because when I hit the &#8220;caps lock&#8221; key, the green light on the key would turn on and off.</p>
<p>I fixed this the following way (this is basically resetting the Power Management Unit &#8212; PMU):</p>
<p>I disconnected the computer from the power cord, and from all other cables.</p>
<p>I held down the power button for several seconds to turn off the computer.</p>
<p>I let it sit 5 minutes.</p>
<p>I restarted the laptop while holding down the Shift key.  This restarted the computer in Safe Mode, with the screen visible again.</p>
<p>After I logged in (in Safe Mode) to make sure everything was ok, I simply restarted the computer the normal way, and the screen behaved normally again.</p>
<p>=================================</p>
<p>If that doesn&#8217;t work for you, you could try these steps, documented at apple.com:</p>
<p><a href="http://support.apple.com/kb/ht1379">Holding down Command, Option, P, and R to reset your PRAM and NVRAM</a></p>
<p><a href="http://support.apple.com/kb/HT1431?viewlocale=en_US">Resetting PowerBook and iBook Power Management Unit (PMU)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/1017/tech/macbook-pro-turns-on-but-screen-stays-black-my-solution/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New Leaf Restaurant in Fort Tryon Park</title>
		<link>http://www.ruddwire.com/976/new-york-city/restaurants/new-leaf-restaurant-in-fort-tryon-park/</link>
		<comments>http://www.ruddwire.com/976/new-york-city/restaurants/new-leaf-restaurant-in-fort-tryon-park/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 00:24:38 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[New York City]]></category>
		<category><![CDATA[bars]]></category>
		<category><![CDATA[restaurants]]></category>
		<category><![CDATA[manhattan]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=976</guid>
		<description><![CDATA[Inside Fort Tryon Park in Northern Manhattan.  Only had drinks at the bar there late one Sunday night.  What a great place.  The bartender was genial, the vodkas were home infused, the cocktails were a delight.  The building itself is quite a charmer.  Old beams and bricks from the early years. [...]]]></description>
			<content:encoded><![CDATA[<p>Inside Fort Tryon Park in Northern Manhattan.  Only had drinks at the bar there late one Sunday night.  What a great place.  The bartender was genial, the vodkas were home infused, the cocktails were a delight.  The building itself is quite a charmer.  Old beams and bricks from the early years.  Drive up on a foggy night and you&#8217;re sure to feel cozy.</p>
<p><a href="http://www.nyrp.org/About/New_Leaf_Restaurant_Bar">http://www.nyrp.org/About/New_Leaf_Restaurant_Bar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/976/new-york-city/restaurants/new-leaf-restaurant-in-fort-tryon-park/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>La Bonne Soup in Midtown</title>
		<link>http://www.ruddwire.com/978/new-york-city/restaurants/la-bonne-soup-in-midtown/</link>
		<comments>http://www.ruddwire.com/978/new-york-city/restaurants/la-bonne-soup-in-midtown/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 23:08:24 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[New York City]]></category>
		<category><![CDATA[restaurants]]></category>
		<category><![CDATA[french]]></category>
		<category><![CDATA[manhattan]]></category>
		<category><![CDATA[midtown manhattan]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=978</guid>
		<description><![CDATA[The Maitr&#8217; D is a good fellow, and knows how to handle a busy night.  Our waiter was a little slow, or a little busy.  The food was great, and reasonably priced for midtown Manhattan.  Get a table on the balcony on a warm night, like we did, and sparks will surely [...]]]></description>
			<content:encoded><![CDATA[<p>The Maitr&#8217; D is a good fellow, and knows how to handle a busy night.  Our waiter was a little slow, or a little busy.  The food was great, and reasonably priced for midtown Manhattan.  Get a table on the balcony on a warm night, like we did, and sparks will surely fly.<br />
<a href="http://www.labonnesoupe.com/"> http://www.labonnesoupe.com/</a></p>
<address>48 West 55th Street</address>
<address>between 5th and 6th avenues</address>
<address> New York, NY 10019</address>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/978/new-york-city/restaurants/la-bonne-soup-in-midtown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UNIX/AWK Tricks: How to copy a long list of files into a directory</title>
		<link>http://www.ruddwire.com/999/tech/unixawk-tricks/</link>
		<comments>http://www.ruddwire.com/999/tech/unixawk-tricks/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 22:39:40 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[AWK]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=999</guid>
		<description><![CDATA[

Make your list of files, with complete paths, call it &#8220;imgList.txt&#8221;. Put every file on a new line.
Write a small awk script with the following 1 line:
{ printf(&#8221;cp %s images/\n&#8221;,$0);}

Save the script as &#8220;copyList.awk&#8221;
Do the following command:
awk -f copyList.awk imgList.txt &#124; sh


Brief explanation of the awk script:

%s means you&#8217;re putting a string in that spot [...]]]></description>
			<content:encoded><![CDATA[<div class="mtb">
<ol>
<li>Make your list of files, with complete paths, call it &#8220;imgList.txt&#8221;. Put every file on a new line.</li>
<li>Write a small awk script with the following 1 line:
<div class="code">{ printf(&#8221;cp %s images/\n&#8221;,$0);}</div>
</li>
<li>Save the script as &#8220;copyList.awk&#8221;</li>
<li>Do the following command:
<div class="code">awk -f copyList.awk imgList.txt | sh</div>
</li>
</ol>
<p>Brief explanation of the awk script:</p>
<ul>
<li>%s means you&#8217;re putting a string in that spot of your output,</li>
<li>$0 is the string you&#8217;re putting there</li>
<li>$0 is a match for each line in the file &#8220;imgList.txt&#8221;</li>
<li>images/ is the directory to copy your files to (in this example relative to where the command will be run from &#8211; can be absolute, of course)</li>
<li>\n stands for new line</li>
</ul>
<p>brief explanation of the command:</p>
<ul>
<li>awk executes the awk code found in &#8220;copyList.awk&#8221; on the lines found in &#8220;imgList.txt&#8221; and pipes the output to the shell ( | sh).</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/999/tech/unixawk-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Character Entities in Javascript</title>
		<link>http://www.ruddwire.com/994/tech/html-character-entities-in-javascript/</link>
		<comments>http://www.ruddwire.com/994/tech/html-character-entities-in-javascript/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 22:34:23 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=994</guid>
		<description><![CDATA[Sometimes you need to write html character entities in javascript, but html character entities can&#8217;t be used, because they don&#8217;t get interpreted by javascript. In javascript, you need to use the equivalent unicode character codes instead.
HTML character entity, wrong:
formElement.value = "Direcci&#38;#243;n";
You get: Direcci&#38;#243;n
Unicode character code, correct:
formElement.value = "Direcci\u00F3n";
You get: Dirección
Unicode character charts are located here: [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to write html character entities in javascript, but html character entities can&#8217;t be used, because they don&#8217;t get interpreted by javascript. In javascript, you need to use the equivalent unicode character codes instead.</p>
<p><span style="font-weight: bold;">HTML character entity, wrong:</span><br />
<code>formElement.value = "Direcci&amp;#243;n";</code><br />
You get: Direcci&amp;#243;n</p>
<p><span style="font-weight: bold;">Unicode character code, correct:</span><br />
<code>formElement.value = "Direcci\u00F3n";</code><br />
You get: Dirección</p>
<p>Unicode character charts are located here: <a href="http://www.unicode.org/charts/">http://www.unicode.org/charts/</a>.  The chart you will most likely need is the <a href="http://www.unicode.org/charts/PDF/U0080.pdf">Latin-1</a> chart.   Character codes must be preceded by \u.  That is, character code 00F3 is written in JavaScript as \u00F3.</p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/994/tech/html-character-entities-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy MySQL Commands</title>
		<link>http://www.ruddwire.com/991/tech/handy-mysql-commands/</link>
		<comments>http://www.ruddwire.com/991/tech/handy-mysql-commands/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 22:30:20 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[mySQL]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=991</guid>
		<description><![CDATA[To reset an auto_increment field to 1:
ALTER TABLE tbl_name AUTO_INCREMENT = 1;

To load a local csv file into an empty existing table:
LOAD DATA LOCAL INFILE &#8216;/completePathToLocalData.csv&#8217; INTO TABLE tableName FIELDS TERMINATED BY &#8216;,&#8217; ENCLOSED BY &#8216;&#8221;&#8216; LINES TERMINATED BY &#8216;\n&#8217; IGNORE 1 LINES;
This assumes you&#8217;ve already created your empty table with the same number of [...]]]></description>
			<content:encoded><![CDATA[<div class="mtb">To reset an auto_increment field to 1:</p>
<div class="code">ALTER TABLE tbl_name AUTO_INCREMENT = 1;</div>
</div>
<div class="mtb">To load a local csv file into an empty existing table:</p>
<div class="code">LOAD DATA LOCAL INFILE &#8216;/completePathToLocalData.csv&#8217; INTO TABLE tableName FIELDS TERMINATED BY &#8216;,&#8217; ENCLOSED BY &#8216;&#8221;&#8216; LINES TERMINATED BY &#8216;\n&#8217; IGNORE 1 LINES;</div>
<p>This assumes you&#8217;ve already created your empty table with the same number of fields that your csv file has.</p></div>
<p><a name="js"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/991/tech/handy-mysql-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the FBI handles my lottery winnings&#8230;</title>
		<link>http://www.ruddwire.com/983/humour/the-fbi-handles-my-lottery-winnings/</link>
		<comments>http://www.ruddwire.com/983/humour/the-fbi-handles-my-lottery-winnings/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 13:19:48 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[humour]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.ruddwire.com/?p=983</guid>
		<description><![CDATA[A really good piece of scam spam I found in my inbox:
Anti-Terrorist And Monetory Crimes Division
FBI Headquarters In Washington, D.C.
Federal Bureau Of Investigation
J. Edgar Hoover Building
935 Pennsylvania Avenue, NW Washington, D.C. 20535-0001
Website: www.fbi.gov
Attn: Beneficiary,
This is to Officially inform you that it has come to our notice and we have thoroughly completed an Investigation with the [...]]]></description>
			<content:encoded><![CDATA[<h3><strong>A really good piece of scam spam I found in my inbox:</strong></h3>
<p>Anti-Terrorist And Monetory Crimes Division<br />
FBI Headquarters In Washington, D.C.<br />
Federal Bureau Of Investigation<br />
J. Edgar Hoover Building<br />
935 Pennsylvania Avenue, NW Washington, D.C. 20535-0001<br />
Website: www.fbi.gov</p>
<p>Attn: Beneficiary,</p>
<p>This is to Officially inform you that it has come to our notice and we have thoroughly completed an Investigation with the help of our Intelligence Monitoring Network System that you legally won the sum of $800,000.00 USD from a Lottery Company outside the United States of America. During our investigation we discovered that your e-mail won the money from an Online Balloting System and we have authorized this winning to be paid to you via a Certified Cashier&#8217;s Check.</p>
<p>Normally, it will take up to 10 business days for an International Check to be cashed by your local bank. We have successfully notified this company on your behalf that funds are to be drawn from a registered bank within the United States Of America so as to enable you cash the check instantly without any delay, henceforth the stated amount of $800,000.00 USD has been deposited with Bank Of America.</p>
<p>We have completed this investigation and you are hereby approved to receive the winning prize as we have verified the entire transaction to be Safe and 100% risk free, due to the fact that the funds have been deposited at Bank Of America you will be required to settle the following bills directly to the Lottery Agent in-charge of this transaction Which is Barclays Bank, United Kingdom. According to our discoveries, you were required to pay for the following -</p>
<p>(1) Deposit Fee&#8217;s ( Fee&#8217;s paid by the company for the deposit into an American Bank which is &#8211; Bank Of America )</p>
<p>(2) Cashier&#8217;s Check Conversion Fee ( Fee for converting the Wire Transfer payment into a Certified Cashier&#8217;s Check )</p>
<p>(3) Shipping Fee&#8217;s ( This is the charge for shipping the Cashier&#8217;s Check to your home address and this fee includes Insurance )</p>
<p>The total amount for everything is $300.00 (Three Hundred-US Dollars). We have tried our possible best to indicate that this $300.00 should be deducted from your winning prize but we found out that the funds have already been deposited at Bank Of America and cannot be accessed by anyone apart from you the winner, therefore you will be required to pay the required fee&#8217;s to the Agent in-charge of this transaction via Western Union Money Transfer</p>
<p>In order to proceed with this transaction, you will be required to contact the agent in-charge ( MR. GARY HUSTON) via e-mail. Kindly look below to find appropriate contact information:</p>
<p>NAME: MR. GARY HUSTON<br />
OFFICE ADDRESS: DIRECTORS FOR FOREIGN OPERATIONS AND SWIFT CARD PAYMENT CENTRE,<br />
15th/16th New Scotland Yard,Broadway,London,SW1H 0BG,UNITED KINGDOM<br />
Email : huston.swiftcent@live.co.uk<br />
Cell  : +447956337992</p>
<p>You will be required to e-mail him with the following information for verification:</p>
<p>FULL NAME:<br />
ADDRESS:<br />
CITY:<br />
STATE:<br />
ZIP CODE:<br />
DIRECT CONTACT NUMBER:</p>
<p>You will also be required to request Western Union details on how to send the required $300.00 in order to immediately ship your prize of $800,000.00 USD via Certified Cashier&#8217;s Check drawn from Bank Of America, also include the following transaction code in order for him to immediately identify this transaction : EA2948-910.</p>
<p>This letter will serve as proof that the Federal Bureau Of Investigation is authorizing you to pay the required $300.00 ONLY to MR. GARY HUSTON via information in which he shall send to you, if you do not receive your winning prize of $800,000.00 we shall be held responsible for the loss and this shall invite a penalty of $3,000 which will be made PAYABLE ONLY to you (The Winner).</p>
<p>Mr. Bill Nicholson<br />
Special Agent.<br />
Washington DC FBI.<br />
Room, 7367<br />
J. Edgar Hoover Building<br />
935 Pennsylvania Avenue, NW<br />
Washington, D.C. 20535-0001</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruddwire.com/983/humour/the-fbi-handles-my-lottery-winnings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
