<?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>potatoeskillme &#187; Code</title>
	<atom:link href="http://potatoeskillme.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://potatoeskillme.com</link>
	<description></description>
	<lastBuildDate>Tue, 20 Oct 2009 19:10:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TI-86 Intervalometer for Canon XTi</title>
		<link>http://potatoeskillme.com/code/ti-86-intervalometer-for-canon-xti/</link>
		<comments>http://potatoeskillme.com/code/ti-86-intervalometer-for-canon-xti/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 07:33:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://potatoeskillme.com/?p=150</guid>
		<description><![CDATA[
I just came across this instructable yesterday and forgot all about that TI-86 in my backpack buried somewhere in the closet. So I dug it out, found the 2.5mm cable and gave it a whirl using my Canon 400D. It didn&#8217;t work at first, but after a bit of googling all I had to do [...]]]></description>
			<content:encoded><![CDATA[<p>
I just came across <a href="http://www.instructables.com/id/Turn-a-TI-Graphing-Calculator-into-an-Intervalomet/" target="_blank">this instructable</a> yesterday and forgot all about that TI-86 in my backpack buried somewhere in the closet. So I dug it out, found the 2.5mm cable and gave it a whirl using my Canon 400D. It didn&#8217;t work at first, but after a bit of googling all I had to do was splice the cable (red and white on the calculator side to red on the camera side then reconnect ground) and make sure the camera was in manual focus. It worked!</p>
<p>Here&#8217;s the first test run:<br />
<object type="application/x-shockwave-flash" width="640" height="360" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#038;photo_secret=df2a1c9d31&#038;photo_id=3975562397&#038;hd_default=false"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#038;photo_secret=df2a1c9d31&#038;photo_id=3975562397&#038;hd_default=false" height="360" width="640"></embed></object></p>
<p>I was inspired by this, but somewhat unhappy with the lack of options using the code supplied in the instructable. It&#8217;s been almost a decade since the last time I programmed something in TI-BASIC, but alas, I wanted more options. So I hacked away and ended up making 3 basic modes for the intervalometer:</p>
<p><b>Shoot:</b> Fires the shutter at will by pushing the F1 button<br />
<b>XLoop:</b> Input a number and interval and it will shoot that number of times at the given interval<br />
<b>Lapse:</b> For extra long time lapses, loops infinitely and exposes at the supplied interval</p>
<p>The loop and lapse modes also display the number of shots. Code for the program is below:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p150code2'); return false;">View Code</a> TI-BASIC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p1502"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
</pre></td><td class="code" id="p150code2"><pre class="ti-basic" style="font-family:monospace;">:Lbl Z
:ClLCD
:Disp &quot;XTiControl V 0.5&quot;,&quot;&quot;,&quot;Approx Intervals:&quot;,&quot;800 = 5sec&quot;,&quot;2000 = 10sec&quot;
:Menu(1,&quot;Shoot&quot;,R,2,&quot;XLoop&quot;,L,3,&quot;Lapse&quot;,A,5,&quot;Quit&quot;,Q
:End
:
:Lbl Q
:ClLCD
:Stop
:
:Lbl R
:ClLCD
:Disp &quot;Ready to fire&quot;
:Menu(1,&quot;Fire&quot;,F,5,&quot;Quit&quot;,Z
:End
:
:Lbl F
:1-&gt;E
:ClLCD
:Disp &quot;Shooting...&quot;
:Send(E)
:Goto R
:End
:
:Lbl L
:ClLCD
:Input &quot;How many shots? &quot;,N
:Input &quot;Interval: &quot;,I
:ClLCD
:For(B,1,N
:ClLCD
:Disp &quot;Shooting: &quot;+B	
:For(T,1,I
:End
:Send(B)
:End
:Goto Z
:
:Lbl A
:ClLCD
:Input &quot;Interval: &quot;,V
:1-&gt;X:While X&gt;0
:ClLCD
:Disp &quot;Shooting: &quot;,X
:Disp &quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;Press ON to quit&quot;
:For(H,1,V
:End
:Send(V)
:X+1-&gt;X
:End</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://potatoeskillme.com/code/ti-86-intervalometer-for-canon-xti/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MintTv</title>
		<link>http://potatoeskillme.com/code/minttv/</link>
		<comments>http://potatoeskillme.com/code/minttv/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 07:03:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://potatoeskillme.com/?p=49</guid>
		<description><![CDATA[A modified script (based on the earlier one for feisty) to sync audio with TvTime in Ubuntu 8.10 &#8212; I&#8217;m actually testing this on Linux Mint 6 which is based on 8.10. So for those of you out there with SAA7134 tuner chipsets, look closely at the sox line below. I&#8217;m using alsa rather than [...]]]></description>
			<content:encoded><![CDATA[<p>A modified script (based on the <a href="/code/mytv/">earlier one for feisty</a>) to sync audio with TvTime in Ubuntu 8.10 &#8212; I&#8217;m actually testing this on Linux Mint 6 which is based on 8.10. So for those of you out there with SAA7134 tuner chipsets, look closely at the sox line below. I&#8217;m using alsa rather than ossdsp this time, and once I got it working the volume was very faint so I also added the -v flag to adjust the volume of the input. BE CAREFUL with the -v flag&#8230; the number value is a FACTOR, not the actual volume level! 8 bumps up the volume quite a bit.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p49code4'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p494"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p49code4"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
tvtime <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #007800;">t</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> tvtime<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span>
<span style="color: #c20cb9; font-weight: bold;">sox</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">2</span> <span style="color: #660033;">-v</span> <span style="color: #000000;">8</span> <span style="color: #660033;">-r</span> <span style="color: #000000;">32000</span> <span style="color: #660033;">-w</span> <span style="color: #660033;">-t</span> alsa hw:<span style="color: #000000;">1</span>,<span style="color: #000000;">0</span> <span style="color: #660033;">-t</span> alsa hw:<span style="color: #000000;">0</span>,<span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #7a0874; font-weight: bold;">wait</span> <span style="color: #007800;">$t</span>
<span style="color: #c20cb9; font-weight: bold;">killall</span> <span style="color: #660033;">-9</span> <span style="color: #c20cb9; font-weight: bold;">sox</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://potatoeskillme.com/code/minttv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP cURL</title>
		<link>http://potatoeskillme.com/code/php-curl/</link>
		<comments>http://potatoeskillme.com/code/php-curl/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 18:45:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://potatoeskillme.com/?p=32</guid>
		<description><![CDATA[A useful PHP snippit &#8211; cURL is a multi-protocol server communication library. The code below grabs the data of a url and stores each line in an array.

?View Code PHP1
2
3
4
5
6
7
8
9
$url = &#34;http://google.com&#34;;
$ch = curl_init&#40;&#41;;
$timeout = 60; // set to zero for no timeout
curl_setopt &#40;$ch, CURLOPT_URL, $url&#41;;
curl_setopt &#40;$ch, CURLOPT_RETURNTRANSFER, 1&#41;;
curl_setopt &#40;$ch, CURLOPT_CONNECTTIMEOUT, $timeout&#41;;
$rawdata= explode&#40;&#34;\n&#34;, curl_exec&#40;$ch&#41;&#41;;
curl_close&#40;$ch&#41;;
unset&#40;$ch&#41;;

]]></description>
			<content:encoded><![CDATA[<p>A useful PHP snippit &#8211; cURL is a multi-protocol server communication library. The code below grabs the data of a url and stores each line in an array.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p32code6'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p326"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p32code6"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://google.com&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$timeout</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// set to zero for no timeout</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #000088;">$timeout</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rawdata</span><span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://potatoeskillme.com/code/php-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export MySQL Data to CSV File</title>
		<link>http://potatoeskillme.com/code/export-mysql-data-to-csv-file/</link>
		<comments>http://potatoeskillme.com/code/export-mysql-data-to-csv-file/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 17:49:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://potatoeskillme.com/?p=27</guid>
		<description><![CDATA[Just an example of using INTO OUTFILE for dumping sql data directly to a CSV file including column labels as the first row. Because I tend to forget these things over time, I&#8217;m posting this for future reference.

?View Code SQLSELECT 'Firstname', 'Lastname', 'Email', 'Company', 'Title',
'Address1', 'Address2', 'City', 'State', 'Zip', 'Phone1'
UNION
SELECT users.firstname, users.lastname, users.email, users.company, users.title,
users.address1, [...]]]></description>
			<content:encoded><![CDATA[<p>Just an example of using INTO OUTFILE for dumping sql data directly to a CSV file including column labels as the first row. Because I tend to forget these things over time, I&#8217;m posting this for future reference.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p27code8'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p278"><td class="code" id="p27code8"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #ff0000;">'Firstname'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Lastname'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Email'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Company'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Title'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'Address1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Address2'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'City'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'State'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Zip'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Phone1'</span>
<span style="color: #993333; font-weight: bold;">UNION</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> users<span style="color: #66cc66;">.</span>firstname<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>lastname<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>email<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>company<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>title<span style="color: #66cc66;">,</span>
users<span style="color: #66cc66;">.</span>address1<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>address2<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>city<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>state<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>zip<span style="color: #66cc66;">,</span> users<span style="color: #66cc66;">.</span>phone1
<span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">OUTFILE</span> <span style="color: #ff0000;">'/tmp/dump_users.csv'</span>
<span style="color: #993333; font-weight: bold;">FIELDS</span> TERMINATED <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">''</span>
<span style="color: #993333; font-weight: bold;">LINES</span> TERMINATED <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>'</span>
<span style="color: #993333; font-weight: bold;">FROM</span> users;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://potatoeskillme.com/code/export-mysql-data-to-csv-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

