<?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>burnsforce.com</title>
	<atom:link href="http://burnsforce.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://burnsforce.com</link>
	<description>I only know enough binary to ask where the bathroom is</description>
	<lastBuildDate>Sat, 24 Sep 2011 08:30:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Arduino LCD HD44780 + LM335 Temperature Sensor</title>
		<link>http://burnsforce.com/arduino-lcd-hd44780-lm335-temperature-sensor/</link>
		<comments>http://burnsforce.com/arduino-lcd-hd44780-lm335-temperature-sensor/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 08:30:52 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[hd44780]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[lcd]]></category>
		<category><![CDATA[LM335]]></category>
		<category><![CDATA[LM335A]]></category>
		<category><![CDATA[picture]]></category>
		<category><![CDATA[schematic]]></category>
		<category><![CDATA[sensor]]></category>
		<category><![CDATA[temperature]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=633</guid>
		<description><![CDATA[This was the next logical step in my home monitoring project.  I&#8217;ve simply added an LM335A temperature sensor to the breadboard and have the output being posted to the LCD every second. &#160; First the drawing: The next step was to write the code that reads the temperature on Analog Pin 0, then writes it [...]]]></description>
			<content:encoded><![CDATA[<p>This was the next logical step in my home monitoring project.  I&#8217;ve simply added an LM335A temperature sensor to the breadboard and have the output being posted to the LCD every second.</p>
<p>&nbsp;</p>
<p>First the drawing:</p>
<p><a href="http://burnsforce.com/wp-content/uploads/2011/09/lcd_temp_sensor_bb.png"><img class="aligncenter size-full wp-image-637" title="lcd_temp_sensor_bb_blog" src="http://burnsforce.com/wp-content/uploads/2011/09/lcd_temp_sensor_bb_blog.png" alt="" width="483" height="378" /></a></p>
<p>The next step was to write the code that reads the temperature on Analog Pin 0, then writes it the LCD.  This could not have been easier.</p>
<p>&nbsp;</p>
<p>Code:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;LM335A.h&gt;</span>
<span style="color: #339933;">#include &lt;LiquidCrystal.h&gt;</span>
<span style="color: #993333;">float</span> raw<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// initialize the library with the numbers of the interface pins</span>
LiquidCrystal lcd<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">7</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">8</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">9</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">11</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">12</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
LM335A InsideTemp<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//pass the analog input pin number</span>
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  lcd.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">16</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  lcd.<span style="color: #202020;">clear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">//user must call ReadTemp before any valid temp data is available</span>
  raw <span style="color: #339933;">=</span> analogRead<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  InsideTemp.<span style="color: #202020;">ReadTemp</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lcd.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>InsideTemp.<span style="color: #202020;">Fahrenheit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lcd.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #009900;">&#41;</span><span style="color: #0000dd;">223</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lcd.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;F&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lcd.<span style="color: #202020;">setCursor</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// bottom left</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Working project:<br />
<a href="http://burnsforce.com/wp-content/uploads/2011/09/arduino_lcd_temp_sensor.jpg"><img class="aligncenter size-full wp-image-639" title="arduino_lcd_temp_sensor_blog" src="http://burnsforce.com/wp-content/uploads/2011/09/arduino_lcd_temp_sensor_blog.jpg" alt="" width="382" height="254" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Things are coming along on the home monitor.  I&#8217;ll soon be using some multiplexers and 8bit shift registers to help reduce the number of pins used on the arduino.  Keep checking back for more updates!</p>
]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/arduino-lcd-hd44780-lm335-temperature-sensor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino LCD HD44780 Simple Tutorial</title>
		<link>http://burnsforce.com/arduino-lcd-hd44780-simple-tutorial/</link>
		<comments>http://burnsforce.com/arduino-lcd-hd44780-simple-tutorial/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 08:00:20 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[16x2]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[hd44780]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[lcd]]></category>
		<category><![CDATA[schematic]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=627</guid>
		<description><![CDATA[Connecting any LCD using the HD44780 standard to an arduino is extremely simple.  I&#8217;ve created a quick schematic showing how to connect the 16&#215;2  HD44780 to an arduino.  I&#8217;ll be using this setup in my future projects, so this is simply for future reference. &#160;]]></description>
			<content:encoded><![CDATA[<p>Connecting any LCD using the HD44780 standard to an arduino is extremely simple.  I&#8217;ve created a quick schematic showing how to connect the 16&#215;2  HD44780 to an arduino.  I&#8217;ll be using this setup in my future projects, so this is simply for future reference.</p>
<p><a href="http://burnsforce.com/wp-content/uploads/2011/09/simple_lcd_bb.png"><img class="aligncenter size-full wp-image-645" title="simple_lcd_bb_blog" src="http://burnsforce.com/wp-content/uploads/2011/09/simple_lcd_bb_blog.png" alt="" width="377" height="308" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/arduino-lcd-hd44780-simple-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino to be sold at radio shack!</title>
		<link>http://burnsforce.com/arduino-sold-radio-shack/</link>
		<comments>http://burnsforce.com/arduino-sold-radio-shack/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 19:44:42 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[Radio Shack]]></category>
		<category><![CDATA[sold]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=615</guid>
		<description><![CDATA[Big news broke today for home electronic enthusiasts.  Radio Shack is going to start caring Arduino products.  Surely we will be paying a premium for the convenience, but this is a good sign for those of us who enjoy tinkering at home.  There is a new wave of DIYers that are learning how easy it can [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://burnsforce.com/wp-content/uploads/2011/09/arduino.png"><img class="alignleft size-full wp-image-616" style="margin: 7px;" title="arduino" src="http://burnsforce.com/wp-content/uploads/2011/09/arduino.png" alt="" width="116" height="80" /></a>Big news broke today for home electronic enthusiasts.  Radio Shack is going to start caring Arduino products.  Surely we will be paying a premium for the convenience, but this is a good sign for those of us who enjoy tinkering at home.  There is a new wave of DIYers that are learning how easy it can be to automate simple tasks around the house and office.  Increasing the accessibility of Arduino should also increase the options of sensors and IC&#8217;s we see at our local stores as well.  This is great news, I can&#8217;t wait to see where this takes us.  <a href="http://arduino.cc/blog/2011/09/20/arduino-is-you/">Click Here</a> to read the full blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/arduino-sold-radio-shack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino LM335 Temperature Sensor Tutorial</title>
		<link>http://burnsforce.com/arduino-lm335-tutorial-started/</link>
		<comments>http://burnsforce.com/arduino-lm335-tutorial-started/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 22:09:53 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[LM335]]></category>
		<category><![CDATA[LM335A]]></category>
		<category><![CDATA[sensor]]></category>
		<category><![CDATA[temp]]></category>
		<category><![CDATA[temperature]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=586</guid>
		<description><![CDATA[Getting started with the LM335 Temperature sensor can be a bit tricky.  I ran into some problems when I started getting incorrect data.  I googled around for the problem, and all of the schematics and drawings at the top of google were incorrect.  They either had a static resistor on the data pin, or they [...]]]></description>
			<content:encoded><![CDATA[<p>Getting started with the LM335 Temperature sensor can be a bit tricky.  I ran into some problems when I started getting incorrect data.  I googled around for the problem, and all of the schematics and drawings at the top of google were incorrect.  They either had a static resistor on the data pin, or they show the data pin on the arduino directly connected to the LM335 Temperature sensor&#8217;s data pin.</p>
<p>The trick to correctly calibrating the temperature sensor is to connect a 10k potentiometer to the data pin.  Once the potentiometer is wired in place, you can calibrate the LM335 to read the correct temperature.  The correct wiring of the LM335 can be seen below:</p>
<p style="text-align: center;"><a href="http://burnsforce.com/wp-content/uploads/2011/09/simple_lm335_bb.png"><img class="aligncenter size-full wp-image-621" title="simple_lm335_bb_blog" src="http://burnsforce.com/wp-content/uploads/2011/09/simple_lm335_bb_blog.png" alt="" width="418" height="297" /></a></p>
<p><a href="http://burnsforce.com/wp-content/uploads/2011/09/DSC_0025.jpg"><img class="alignleft size-thumbnail wp-image-590" title="DSC_0025" src="http://burnsforce.com/wp-content/uploads/2011/09/DSC_0025-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Once everything is wired up, I simply used the <a title="lm335a.h" href="http://greenrobotics.net/files/LM335A.zip">lm335a.h</a> library written by greenrobotics.net.  This is a nice library, a quick test sketch can be seen below here:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Example using the LM335A library for reading temperatures</span>
<span style="color: #666666; font-style: italic;">// Created by Jonathan Merrill, February 20, 2010.</span>
<span style="color: #666666; font-style: italic;">// http://www.greenrobotics.net</span>
<span style="color: #666666; font-style: italic;">//  Released into the public domain.</span>
&nbsp;
<span style="color: #339933;">#include </span>
&nbsp;
LM335A InsideTemp<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//pass the analog input pin number</span>
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">57600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;starting&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">3000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">//user must call ReadTemp before any valid temp data is available</span>
  InsideTemp.<span style="color: #202020;">ReadTemp</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Fahrenheit: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">//functions to get the temperature in various unitsfs</span>
  Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>InsideTemp.<span style="color: #202020;">Fahrenheit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Celsius: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>InsideTemp.<span style="color: #202020;">Celsius</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Kelvin: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>InsideTemp.<span style="color: #202020;">Kelvin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Once I get motived, I&#8217;ll be sending this temperature data from my home to my blog, here.  I&#8217;ll be sure to post more updates as they come.</p>
]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/arduino-lm335-tutorial-started/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flot Example: Format data in Flot readable JSON</title>
		<link>http://burnsforce.com/flot-format-data-flot-readable-json/</link>
		<comments>http://burnsforce.com/flot-format-data-flot-readable-json/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 20:10:39 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Flot]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[encode]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[flot]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=574</guid>
		<description><![CDATA[I recently started learning the flot library.  Unfortunately, there aren&#8217;t any good examples of how to format the data with JSON in a flot friendly manner.  Below is some basic code that should retrieve data from a database, format it and then JSON encode it. I&#8217;ve written the example mostly in psuedo-code, most beginners should [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started learning the flot library.  Unfortunately, there aren&#8217;t any good examples of how to format the data with JSON in a flot friendly manner.  Below is some basic code that should retrieve data from a database, format it and then JSON encode it.  I&#8217;ve written the example mostly in psuedo-code, most beginners should be able to pick up the key points of the following example.</p>
<p>&nbsp;</p>
<p>The script below simply returns JSON, you should create this script in a web accessible directory:</p>
<p><em><strong>getDataforFlot.php</strong></em></p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$mergedData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get the first set of data you want to graph from the database</span>
<span style="color: #000088;">$databaseData1</span> <span style="color: #339933;">=</span> someFunctionToGetDataFromDatabase<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//loop through the first set of data and pull out the values we want, then format</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$databaseData1</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'x_value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'y_value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data1</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//send our data values to $mergedData, add in your custom label and color</span>
<span style="color: #000088;">$mergedData</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span>  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Data 1&quot;</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'data'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'color'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'#6bcadb'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get the second set of data you want to graph from the database</span>
<span style="color: #000088;">$databaseData2</span> <span style="color: #339933;">=</span> someFunctionToGetDataFromDatabase<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$databaseData2</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'x_value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'y_value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data2</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//send our data values to $mergedData, add in your custom label and color</span>
<span style="color: #000088;">$mergedData</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Data 2&quot;</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'data'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'color'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'#6db000'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//now we can JSON encode our data</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mergedData</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Next, just put the following JQuery into your page to render the data using AJAX:</p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// usually, we'll just call the same URL, a script</span>
                <span style="color: #006600; font-style: italic;">// connected to a database, but in this case we only</span>
                <span style="color: #006600; font-style: italic;">// have static example files so we need to modify the</span>
                <span style="color: #006600; font-style: italic;">// URL</span>
                url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;/getDataforFlot.php&quot;</span><span style="color: #339933;">,</span>
                method<span style="color: #339933;">:</span> <span style="color: #3366CC;">'GET'</span><span style="color: #339933;">,</span>
                dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span>
                success<span style="color: #339933;">:</span> onOutboundReceived
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> onOutboundReceived<span style="color: #009900;">&#40;</span>series<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> length <span style="color: #339933;">=</span> series.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> finalData <span style="color: #339933;">=</span> series<span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
            lines<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> show<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            points<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> show<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> hoverable<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            grid<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> hoverable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> clickable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        $.<span style="color: #660066;">plot</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#YOUR-DIV-ID-HERE), finalData, options);
    }
});</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/flot-format-data-flot-readable-json/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ninja Bread Men!!</title>
		<link>http://burnsforce.com/ninja-bread-men/</link>
		<comments>http://burnsforce.com/ninja-bread-men/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 02:39:31 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[bread]]></category>
		<category><![CDATA[cute]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[ginger]]></category>
		<category><![CDATA[gingerbread]]></category>
		<category><![CDATA[gingerbread men]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[men]]></category>
		<category><![CDATA[ninja]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=563</guid>
		<description><![CDATA[I made these ninja bread men.  Being the coolest cookies I&#8217;ve ever seen, I had to post them.  Attack of the ninja bread men!!! You can buy your own set of ninja bread men here]]></description>
			<content:encoded><![CDATA[<p>I made these ninja bread men.  Being the coolest cookies I&#8217;ve ever seen, I had to post them.  Attack of the ninja bread men!!!</p>
<p><a href="http://www.amazon.com/gp/product/B003YUBQHO/ref=as_li_ss_tl?ie=UTF8&amp;tag=burnsforce-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B003YUBQHO">You can buy your own set of ninja bread men here</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=&amp;l=as2&amp;o=1&amp;a=B003YUBQHO" border="0" alt="" width="1" height="1" /></p>
<p><a href="http://burnsforce.com/wp-content/uploads/2011/01/ninja_2.jpg"><img class="size-full wp-image-567 alignnone" title="ninja_thumb_2" src="http://burnsforce.com/wp-content/uploads/2011/01/ninja_thumb_2.jpg" alt="" width="200" height="301" /></a> <a href="http://burnsforce.com/wp-content/uploads/2011/01/ninja_1.jpg"><img class="size-full wp-image-564 alignnone" title="ninja_thumb_1" src="http://burnsforce.com/wp-content/uploads/2011/01/ninja_thumb_1.jpg" alt="" width="200" height="301" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/ninja-bread-men/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reddit Secret Santa 2010</title>
		<link>http://burnsforce.com/reddit-secret-santa-2010/</link>
		<comments>http://burnsforce.com/reddit-secret-santa-2010/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 04:39:55 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[bomb]]></category>
		<category><![CDATA[plush]]></category>
		<category><![CDATA[red]]></category>
		<category><![CDATA[reddit]]></category>
		<category><![CDATA[santa]]></category>
		<category><![CDATA[secret]]></category>
		<category><![CDATA[tf2]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=523</guid>
		<description><![CDATA[It looks like I&#8217;m three for three with these reddit gift exchanges.  This year I think was the best year so far. I came home today from a hard days work to find a bomb waiting for me in the mail! Fortunately, this bomb is a little softer and a little less explosive. I also [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://burnsforce.com/wp-content/uploads/2010/12/reddit_secret_santa_2010.jpg"><img class="alignleft size-full wp-image-569" style="margin: 7px;" title="demo_christmas_thumb" src="http://burnsforce.com/wp-content/uploads/2010/12/demo_christmas_thumb.jpg" alt="" width="200" height="133" /></a>It looks like I&#8217;m three for three with these reddit gift exchanges.  This year I think was the best year so far.</p>
<p>I came home today from a hard days work to find a bomb waiting for me in the mail!</p>
<p>Fortunately, this bomb is a little softer and a little less explosive.</p>
<div id="_mcePaste">I also received a RED team parking permit!! This will look great next to my linux jesus shark.</div>
<div>This year I bought my secret santee a thinkgeek wool hat that says &#8220;Geek&#8221;.   I read my santees post on redditgifts and he seems to be very happy with it.  He&#8217;s a long distance runner in New Jersey who apparently needed a new hat anyway.</div>
<div>This has been a great holiday season so far.  Happy Holidays.</div>
]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/reddit-secret-santa-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Got hacked, back up</title>
		<link>http://burnsforce.com/got-hacked-back-up/</link>
		<comments>http://burnsforce.com/got-hacked-back-up/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 21:54:36 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=466</guid>
		<description><![CDATA[It finally happened, my server was hacked.  The attacker was on a path of destruction and simply destroyed all of my data and locked me out of the server.  Fortunately, I keep good backups.  Unfortunately, I&#8217;ve been busy with a new job so I haven&#8217;t been able to restore any of it until today Notes: [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://burnsforce.com/wp-content/uploads/2010/12/hacked.jpg"><img class="alignleft size-full wp-image-467" style="margin: 7px;" title="hacked" src="http://burnsforce.com/wp-content/uploads/2010/12/hacked.jpg" alt="" width="160" height="110" /></a>It finally happened, my server was hacked.  The attacker was on a path of destruction and simply destroyed all of my data and locked me out of the server.  Fortunately, I keep good backups.  Unfortunately, I&#8217;ve been busy with a new job so I haven&#8217;t been able to restore any of it until today</p>
<p>Notes:</p>
<p>I believe this attack was initiated by a former co-worker, as the timing for the intrusion lines up directly with my leaving my old position.  This leads me to believe that the server/sites were not necessarily mis-configured or vulnerable, rather a former manager / co-worker who knew some of my common passwords simply logged in and destroyed my data.</p>
<p>It also could have been a Steam phisher that I upset a few months back.  He messaged me a link to his phishing page saying that I would receive a free game for logging in.  I immediately knew what was going on and started taunting the phisher and then ddosed his phishing page.  The attacker very well could be related.</p>
<p>However, this is no execuse.  I broke one of the basic first rules of web security, use different passwords for everything.  Now, all services and users have their own unique password&#8230;.so far&#8230;.so good.</p>
]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/got-hacked-back-up/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dump Asterisk Realtime Voicemail users into Voicemail.conf</title>
		<link>http://burnsforce.com/dump-asterisk-realtime-voicemail-users-into-voicemail-conf/</link>
		<comments>http://burnsforce.com/dump-asterisk-realtime-voicemail-users-into-voicemail-conf/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 15:28:39 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Realtime]]></category>
		<category><![CDATA[Users]]></category>
		<category><![CDATA[voicemail]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=438</guid>
		<description><![CDATA[While I&#8217;ve been lazy about updating my site, I have not been lazy with writing new scripts and coming up with ideas to write about. The first in the set that I&#8217;m going to make public is a script to dump your Asterisk Realtime Voicemail database users into a flat voicemail.conf file. I used this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://burnsforce.com/wp-content/uploads/2010/03/digium-logo.gif"><img class="alignleft size-full wp-image-446" style="margin: 7px;" title="digium-logo" src="http://burnsforce.com/wp-content/uploads/2010/03/digium-logo.gif" alt="" width="156" height="120" /></a>While I&#8217;ve been lazy about updating my site, I have not been lazy with writing new scripts and coming up with ideas to write about.</p>
<p>The first in the set that I&#8217;m going to make public is a script to dump your Asterisk Realtime Voicemail database users into a flat voicemail.conf file.  I used this technique while troubleshooting to revert back to the standard setup while I was working on the realtime config.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">function</span> get_mailbox <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
   <span style="color: #007800;">mailbox</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span> mysql <span style="color: #660033;">-u</span> dbuser <span style="color: #660033;">--password</span>=dbpass asterisk <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;select mailbox from voicemail_users where uniqueid = '<span style="color: #007800;">$i</span>'&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #007800;">mailbox</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$mailbox</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> get_password <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
    <span style="color: #007800;">password</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>mysql <span style="color: #660033;">-u</span> dbuser <span style="color: #660033;">--password</span>=dbpass asterisk <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;select password from voicemail_users where uniqueid = '<span style="color: #007800;">$i</span>'&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">password</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$password</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> get_fullname <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
    <span style="color: #007800;">name</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>mysql <span style="color: #660033;">-u</span> dbuser <span style="color: #660033;">--password</span>=dbpass asterisk <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;select fullname from voicemail_users where uniqueid = '<span style="color: #007800;">$i</span>'&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">name</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$name</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> get_email <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
    <span style="color: #007800;">email</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>mysql <span style="color: #660033;">-u</span> dbuser <span style="color: #660033;">--password</span>=dbpass asterisk <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;select email from voicemail_users where uniqueid = '<span style="color: #007800;">$i</span>'&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">email</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$email</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> write_file <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$mailbox</span> =&gt; <span style="color: #007800;">$password</span>,<span style="color: #007800;">$name</span>,<span style="color: #007800;">$email</span>,,attach=yes|saycid=no|envelope=no|delete=no&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>test_dump.txt
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">i</span>=<span style="color: #000000;">1</span>; i<span style="color: #000000; font-weight: bold;">&lt;</span>=<span style="color: #000000;">151</span>; i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span>
get_mailbox
get_password
get_fullname
get_email
write_file
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/dump-asterisk-realtime-voicemail-users-into-voicemail-conf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk Voicemail Check Disk Usage Script</title>
		<link>http://burnsforce.com/asterisk-voicemail-check-disk-usage-script/</link>
		<comments>http://burnsforce.com/asterisk-voicemail-check-disk-usage-script/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 21:34:47 +0000</pubDate>
		<dc:creator>patrickrb</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[size]]></category>
		<category><![CDATA[space]]></category>
		<category><![CDATA[usage]]></category>
		<category><![CDATA[voicemail]]></category>

		<guid isPermaLink="false">http://burnsforce.com/?p=390</guid>
		<description><![CDATA[This latest script was written to prevent 3:00am phone calls. I was recently called because our voicemail server was beginning to run out of disk space. The following script simply scans the voicemail directory, if a user is over 100MB it looks up their extension in the asterisk database and then sends them an email [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://burnsforce.com/wp-content/uploads/2010/03/digium-logo.gif"><img class="alignleft size-full wp-image-446" style="margin: 7px;" title="digium-logo" src="http://burnsforce.com/wp-content/uploads/2010/03/digium-logo.gif" alt="" width="156" height="120" /></a>This latest script was written to prevent 3:00am phone calls.   I was recently called because our voicemail server was beginning to run out of disk space.  The following script simply scans the voicemail directory, if a user is over 100MB it looks up their extension in the asterisk database and then sends them an email notification to clean it out.  Below is the script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#set the maximum disk usage for a user to approx 100MB</span>
<span style="color: #007800;">size_limit</span>=<span style="color: #000000;">100000</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> send_email <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
    <span style="color: #007800;">subject</span>=<span style="color: #ff0000;">&quot;Voicemail Over Limit&quot;</span>
    <span style="color: #007800;">message</span>=<span style="color: #ff0000;">&quot;/tmp/emailmessage.txt.<span style="color: #007800;">$f</span>&quot;</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Hello <span style="color: #007800;">$name</span>, &quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$message</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$message</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This is a notification that your voicemail is currently over the allowed limit.  You are currently using <span style="color: #007800;">$humansize</span>.  Please either manually delete the voicemails, or you can send an email to patb@codero.com for help with wiping all of the new and saved voicemails in your mailbox.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$message</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$message</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Thank you,&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$message</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Admin&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$message</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$subject</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$email</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$message</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>asterisk<span style="color: #000000; font-weight: bold;">/</span>voicemail<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #007800;">size</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>asterisk<span style="color: #000000; font-weight: bold;">/</span>voicemail<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$f</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$size</span>&quot;</span> <span style="color: #660033;">-gt</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$size_limit</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
    <span style="color: #000000; font-weight: bold;">then</span>
&nbsp;
        <span style="color: #007800;">humansize</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-sh</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>asterisk<span style="color: #000000; font-weight: bold;">/</span>voicemail<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$f</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #666666; font-style: italic;">#Query the database for the users email address</span>
        <span style="color: #007800;">email</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>mysql <span style="color: #660033;">-u</span> asterisk <span style="color: #660033;">--password</span>=dbpassword asterisk <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;select email from voicemail_users where mailbox = '<span style="color: #007800;">$f</span>'&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #666666; font-style: italic;">#Parse just the email address out of the above query</span>
        <span style="color: #007800;">email</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$email</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
        <span style="color: #007800;">name</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>mysql <span style="color: #660033;">-u</span> asterisk <span style="color: #660033;">--password</span>=dbpassword asterisk <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;select fullname from voicemail_users where mailbox = '<span style="color: #007800;">$f</span>'&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #007800;">name</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$name</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2,$3}'</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #666666; font-style: italic;">#echo &quot;$name    $f  $email  $humansize&quot;</span>
        send_email <span style="color: #007800;">$email</span> <span style="color: #007800;">$name</span> <span style="color: #007800;">$humansize</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #666666; font-style: italic;"># take action on each file. $f store current file name</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://burnsforce.com/asterisk-voicemail-check-disk-usage-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Database Caching using apc
Object Caching 910/1070 objects using apc

Served from: burnsforce.com @ 2012-02-05 06:34:47 -->
