<?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>Make Some Code</title>
	<atom:link href="http://makesomecode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://makesomecode.com</link>
	<description>Ning, Arduino, PHP, and other cool stuff</description>
	<lastBuildDate>Fri, 27 Apr 2012 19:40:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>tar and gzip files from linux command line</title>
		<link>http://makesomecode.com/2012/04/25/tar-and-gzip-files-from-linux-command-line/</link>
		<comments>http://makesomecode.com/2012/04/25/tar-and-gzip-files-from-linux-command-line/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 14:23:53 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[command line]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=799</guid>
		<description><![CDATA[Sometimes it&#8217;s hard to rememeber all the options you need to include to tar and gzip files or a folder from the command line. Here it is&#8230; tar -cvzf tarballname.tar.gz myfilestocompress To untar and unzip simply do: tar xvfz filename.tar.gz And if there are only certain files you want in the tar then do: tar ...]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s hard to rememeber all the options you need to include to tar and gzip files or a folder from the command line. Here it is&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cvzf</span> tarballname.tar.gz myfilestocompress</pre></div></div>

<p>To untar and unzip simply do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xvfz filename.tar.gz</pre></div></div>

<p>And if there are only certain files you want in the tar then do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf filename.tar.gz <span style="color: #000000; font-weight: bold;">*/</span>dir.you.want<span style="color: #000000; font-weight: bold;">/*</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2012/04/25/tar-and-gzip-files-from-linux-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MIME Media Types</title>
		<link>http://makesomecode.com/2012/04/20/mime-media-types/</link>
		<comments>http://makesomecode.com/2012/04/20/mime-media-types/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 21:45:31 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=795</guid>
		<description><![CDATA[A useful reference for different MIME types: IANA &#124; MIME Media Types.]]></description>
			<content:encoded><![CDATA[<p>A useful reference for different MIME types:</p>
<p><a href='http://www.iana.org/assignments/media-types/index.html'>IANA | MIME Media Types</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2012/04/20/mime-media-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing SSH2 Extension for PHP on CentOS 5</title>
		<link>http://makesomecode.com/2012/04/20/installing-ssh2-extension-for-php-on-centos-5/</link>
		<comments>http://makesomecode.com/2012/04/20/installing-ssh2-extension-for-php-on-centos-5/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 20:54:21 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=792</guid>
		<description><![CDATA[Here is a great tutorial from Dynamic Hosting Blog on installing ssh2 extension for php. I use this often for wordpress installations since I don&#8217;t normally setup my server with ftp. This will allow me to download and install updates/plugins using ssh instead of using the less secure ftp. via Installing SSH2 Extension for PHP ...]]></description>
			<content:encoded><![CDATA[<p>Here is a great tutorial from Dynamic Hosting Blog on installing ssh2 extension for php. I use this often for wordpress installations since I don&#8217;t normally setup my server with ftp. This will allow me to download and install updates/plugins using ssh instead of using the less secure ftp.</p>
<p>via <a href='http://blog.dynamichosting.biz/2011/01/10/installing-ssh2-extension-for-php-on-centos-5/'>Installing SSH2 Extension for PHP on CentOS 5 | Dynamic Hosting Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2012/04/20/installing-ssh2-extension-for-php-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show Categories Filter on Custom Post Type List</title>
		<link>http://makesomecode.com/2012/04/05/show-categories-filter-on-custom-post-type-list/</link>
		<comments>http://makesomecode.com/2012/04/05/show-categories-filter-on-custom-post-type-list/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 14:49:56 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=742</guid>
		<description><![CDATA[Found this useful thread on displaying a category filter on a custom post type in wordpress. Here&#8217;s the code: add_action&#40; 'restrict_manage_posts', 'my_restrict_manage_posts' &#41;; function my_restrict_manage_posts&#40;&#41; &#123; global $typenow; $taxonomy = 'your_custom_taxonomy_name'; if&#40; $typenow != &#34;page&#34; &#38;&#38; $typenow != &#34;post&#34; &#41;&#123; $filters = array&#40;$taxonomy&#41;; foreach &#40;$filters as $tax_slug&#41; &#123; $tax_obj = get_taxonomy&#40;$tax_slug&#41;; $tax_name = $tax_obj-&#62;labels-&#62;name; $terms ...]]></description>
			<content:encoded><![CDATA[<p>Found this useful thread on displaying a category filter on a custom post type in wordpress. Here&#8217;s the code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'restrict_manage_posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_restrict_manage_posts'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_restrict_manage_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$typenow</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$taxonomy</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'your_custom_taxonomy_name'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$typenow</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;page&quot;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$typenow</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;post&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$filters</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$taxonomy</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$filters</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tax_slug</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$tax_obj</span> <span style="color: #339933;">=</span> get_taxonomy<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tax_slug</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$tax_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tax_obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">labels</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$terms</span> <span style="color: #339933;">=</span> get_terms<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tax_slug</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;select name='<span style="color: #006699; font-weight: bold;">$tax_slug</span>' id='<span style="color: #006699; font-weight: bold;">$tax_slug</span>' class='postform'&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;option value=''&gt;Show All <span style="color: #006699; font-weight: bold;">$tax_name</span>&lt;/option&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$terms</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$term</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;option value='</span><span style="color: #339933;">.</span> <span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slug</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$tax_slug</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slug</span> ? <span style="color: #0000ff;">' selected=&quot;selected&quot;'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">' ('</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">count</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">')&lt;/option&gt;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/select&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><a href="http://wordpress.org/support/topic/show-categories-filter-on-custom-post-type-list?replies=15#post-1970569">WordPress › Support » Show Categories Filter on Custom Post Type List</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2012/04/05/show-categories-filter-on-custom-post-type-list/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using term_description as keyword meta</title>
		<link>http://makesomecode.com/2012/04/04/using-term_description-as-keyword-meta/</link>
		<comments>http://makesomecode.com/2012/04/04/using-term_description-as-keyword-meta/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 16:48:25 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=727</guid>
		<description><![CDATA[I found a good use for WordPress&#8217;s taxonomy description. I&#8217;m using it to display keywords for the meta tag. When a user visits the archive page of a taxonomy the keyword meta will be displayed in the header. Put the following code in your header file. Then make sure to put in a comma&#160;separated&#160;list of ...]]></description>
			<content:encoded><![CDATA[<p>I found a good use for WordPress&#8217;s taxonomy description. I&#8217;m using it to display keywords for the meta tag. When a user visits the archive page of a taxonomy the keyword meta will be displayed in the header.</p>
<p>Put the following code in your header file. Then make sure to put in a comma&nbsp;separated&nbsp;list of keywords in the description field of your custom taxonomy or category.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$desc</span> <span style="color: #339933;">=</span> term_description<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> get_query_var<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'taxonomy'</span> <span style="color: #009900;">&#41;</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: #000088;">$desc</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;meta name=&quot;keywords&quot; content=&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$desc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>via <a href="http://codex.wordpress.org/Function_Reference/term_description">Function Reference/term description « WordPress Codex</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2012/04/04/using-term_description-as-keyword-meta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upload issues on WordPress with Mediatemple DV server</title>
		<link>http://makesomecode.com/2011/11/22/upload-issues-on-wordpress-with-mediatemple-dv-server/</link>
		<comments>http://makesomecode.com/2011/11/22/upload-issues-on-wordpress-with-mediatemple-dv-server/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 22:24:23 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[dv]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mediatemple]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=484</guid>
		<description><![CDATA[I was having some trouble a while back uploading media to my WordPress install. I would continually get an error stating that the media couldn&#8217;t be moved to the correct folder. I had tried all the forum solutions including even changing permissions to 777. Nothing seemed to work. After stumbling across a few threads on ...]]></description>
			<content:encoded><![CDATA[<p>I was having some trouble a while back uploading media to my WordPress install. I would continually get an error stating that the media couldn&#8217;t be moved to the correct folder. I had tried all the forum solutions including even changing permissions to 777. Nothing seemed to work. After stumbling across a few threads on wordpress and finding a <a href="http://www.mediatemple.net/go/order/?refdom=kamposer.com">Mediatemple</a> community wiki article I came up with a solution.<span id="more-484"></span></p>
<p>First I needed to enable fastCGI for my domain that I was having issues with. <a href="http://www.mediatemple.net/go/order/?refdom=kamposer.com">Mediatemple</a> has an excellent article on how to do that:<br />
<a href="http://kb.mediatemple.net/questions/1890/%28dv%29+How+do+I+enable+FastCGI%3F#dv_40"> http://kb.mediatemple.net/questions/1890/%28dv%29+How+do+I+enable+FastCGI%3F#dv_40</a></p>
<p>After enabling fastCGI I noticed my website was broken. I was getting a 503 error after about waiting 30 seconds for the page to load. After googling around I found the following article on how to resolve some of the common problems faced when enabling fastCGI on a DV server:<br />
<a href="http://wiki.mediatemple.net/w/%28dv%29_4.0:Enable_FastCGI"> http://wiki.mediatemple.net/w/%28dv%29_4.0:Enable_FastCGI</a></p>
<p>Issuing the following command as root via ssh solved the problem:<br />
<code>chown apache:apache /var/run/mod_fcgid/sock &amp;&amp; service httpd restart</code></p>
<h2>Resources:</h2>
<p><a href="http://kb.mediatemple.net/questions/1890/%28dv%29+How+do+I+enable+FastCGI%3F#dv_40">http://kb.mediatemple.net/questions/1890/%28dv%29+How+do+I+enable+FastCGI%3F#dv_40</a><br />
<a href="http://wordpress.org/support/topic/solution-to-mediatemple-dv-upload-error-problem"> http://wordpress.org/support/topic/solution-to-mediatemple-dv-upload-error-problem</a><br />
<a href="http://wiki.mediatemple.net/w/%28dv%29_4.0:Enable_FastCGI"> http://wiki.mediatemple.net/w/%28dv%29_4.0:Enable_FastCGI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2011/11/22/upload-issues-on-wordpress-with-mediatemple-dv-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nginx and Weird “400 Bad Request” Responses &#124; Life Scaling</title>
		<link>http://makesomecode.com/2011/09/20/nginx-and-weird-%e2%80%9c400-bad-request%e2%80%9d-responses-life-scaling/</link>
		<comments>http://makesomecode.com/2011/09/20/nginx-and-weird-%e2%80%9c400-bad-request%e2%80%9d-responses-life-scaling/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 22:53:35 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[400 bad request]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=473</guid>
		<description><![CDATA[I noticed the other day that Google Chrome was giving me a 400 bad request when I tried to visit one of my web sites. My server is built on linode using nginx as a front end and apache as the back. No other browsers were giving me this problem. I cleared the cache and ...]]></description>
			<content:encoded><![CDATA[<p>I noticed the other day that Google Chrome was giving me a 400 bad request when I tried to visit one of my web sites. My server is built on linode using nginx as a front end and apache as the back. No other browsers were giving me this problem. I cleared the cache and this fixed the problem, but I had a sneeking suspicion that it would happen again.&nbsp;Oren Solomianik of&nbsp;<a href="http://orensol.com/">Life Scaling</a>&nbsp;came up with a solution that seems to do the trick. See the link below.</p>
<p>trackback uri</p>
<p>via <a href="http://orensol.com/2009/01/18/nginx-and-weird-400-bad-request-responses/">Nginx and Weird “400 Bad Request” Responses | Life Scaling</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2011/09/20/nginx-and-weird-%e2%80%9c400-bad-request%e2%80%9d-responses-life-scaling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Producteev PHP Library</title>
		<link>http://makesomecode.com/2011/09/02/producteev-php-library/</link>
		<comments>http://makesomecode.com/2011/09/02/producteev-php-library/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 01:19:05 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[producteev]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=422</guid>
		<description><![CDATA[Our organisation started using Producteev a while back for task management. It&#8217;s a pretty decent platform and has a nice api. Angelo R. from http://xangelo.ca has done some work to create a PHP Library for the api. It works well but I noticed that any time you added a space to value that you where sending to Producteev the code ...]]></description>
			<content:encoded><![CDATA[<p>Our organisation started using Producteev a while back for task management. It&#8217;s a pretty decent platform and has a <a title="Producteev API" href="http://code.google.com/p/producteev-api/wiki/APIDocumentation" target="_blank">nice api</a>. Angelo R. from <a href="http://xangelo.ca">http://xangelo.ca</a> has done some work to create a <a href="http://code.google.com/p/producteev-php/">PHP Library</a> for the api. It works well but I noticed that any time you added a space to value that you where sending to Producteev the code broke. I found the problem and have created a new library with the added fix:</p>
<p><span style="font-size: medium;"><strong><a href="http://greatwitenorth.github.com/Producteev-PHP-Library/">Download Producteev PHP Library</a></strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2011/09/02/producteev-php-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>chrome.extension.sendRequest won&#8217;t pass object</title>
		<link>http://makesomecode.com/2011/07/27/chrome-extension-sendrequest-wont-pass-object/</link>
		<comments>http://makesomecode.com/2011/07/27/chrome-extension-sendrequest-wont-pass-object/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 07:09:59 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=384</guid>
		<description><![CDATA[Recently I had a bit of trouble with Google&#8217;s chrome.extension.sendRequest function used in their Chrome extensions API. I found that I was not able to pass my variable outside of the function. I came accross this post that helped explain the reason why. Although I didn&#8217;t come up with the ideal solution this did end ...]]></description>
			<content:encoded><![CDATA[<p>Recently I had a bit of trouble with Google&#8217;s chrome.extension.sendRequest function used in their Chrome extensions API. I found that I was not able to pass my variable outside of the function. I came accross <a href="http://stackoverflow.com/questions/2591814/javascript-global-variable-not-working-properly">this post</a> that helped explain the reason why.<span id="more-384"></span> Although I didn&#8217;t come up with the ideal solution this did end up working for me in the end:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> doSomething<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    chrome.<span style="color: #660066;">extension</span>.<span style="color: #660066;">sendRequest</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> thing <span style="color: #339933;">=</span> response.<span style="color: #660066;">data</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">//Do something with our variable. </span>
        <span style="color: #006600; font-style: italic;">//The rest of the function goes here before the next bracket</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Instead of trying to pass the variable out of chrome.extension.sendRequest I simply just wrapped the whole function in it and that seemed to solve my problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2011/07/27/chrome-extension-sendrequest-wont-pass-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up SMS with CactiEZ and Gnokii</title>
		<link>http://makesomecode.com/2011/07/19/setting-up-sms-with-cactiez-and-gnokii/</link>
		<comments>http://makesomecode.com/2011/07/19/setting-up-sms-with-cactiez-and-gnokii/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 23:26:57 +0000</pubDate>
		<dc:creator>Nick Verwymeren</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[gnokii]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[server monitoring]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[text message]]></category>

		<guid isPermaLink="false">http://makesomecode.com/?p=319</guid>
		<description><![CDATA[Cacti is a great tool for monitoring devices on you network through SNMP. One common request is how do I get Cacti to SMS me when soemthing goes wrong? Hopefully this tutorial will walk you through getting everything up and running. At the moment this will allow you to receive an SMS for dead hosts. In another tutorial I'll extend it to also work with thresholds.]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Cacti is a great tool for monitoring devices on you network through SNMP. One common request is how do I get Cacti to SMS me when soemthing goes wrong? Hopefully this tutorial will walk you through getting everything up and running. At the moment this will allow you to receive an SMS for dead hosts. In another tutorial I&#8217;ll extend it to also work with thresholds.</p>
<p><span id="more-319"></span></p>
<p>These instructions are known to work with a fresh install of Cacti EZ. We are using and ISO of CactiEZ v0.6. It can be downloaded at the site: <a href="http://mirror.cactiusers.org/dl/2d341570fe9e08f41bf2e0aeac22fb5f/4df05350/CactiEZ-v0.6.tar.gz">http://mirror.cactiusers.org/dl/2d341570fe9e08f41bf2e0aeac22fb5f/4df05350/CactiEZ-v0.6.tar.gz</a></p>
<p>If this link doesn&#8217;t work just google cactiez.</p>
<p>This setup will use an open source command line program called Gnokii. Basically it allows you to communicate to mobile phones via the command line. There are many phones supported. To find out more please visit their homepage gnokii.org.</p>
<p>I&#8217;ll be using an old Nokia 6070 with a CA-42 cable. These can be picked up really cheap now on ebay. My whole setup with cable and phone only cost $27. Most Nokia phones are supported. Gnokii even supports Bluetooth.</p>
<h2>Installing Gnokii</h2>
<p>The following instructions will tell you how to get Gnokii installed on a CactiEZ installation.</p>
<p>First ssh into new install of cactiez:</p>
<pre class="brush: bash; title: ; notranslate">ssh root@ip-of-cacti-ez</pre>
<p>The password will be CactiEZ</p>
<p>Lets move to the tmp directory to download some stuff:</p>
<pre class="brush: bash; title: ; notranslate">cd /tmp</pre>
<p>Download the latest installation of Gnokii. In our case it was 0.6.30. Please visit the gnokii website to find the most recent version for you.</p>
<pre class="brush: bash; title: ; notranslate">wget http://www.gnokii.org/download/gnokii/gnokii-0.6.30.tar.gz</pre>
<p>Untar and unzip the archive:</p>
<pre class="brush: bash; title: ; notranslate">tar xvfz gnokii-0.6.30.tar.gz</pre>
<p>Change into the created directory:</p>
<pre class="brush: bash; title: ; notranslate">cd gnokii-0.6.30</pre>
<p>Now we will simply try to follow the installation instructions found on the Gnokii website:</p>
<pre class="brush: bash; title: ; notranslate">./configure</pre>
<p>You&#8217;ll notice an error straight away:</p>
<p style="padding-left: 30px;">configure: error: in `/tmp/gnokii-0.6.30&#8242;:</p>
<p style="padding-left: 30px;">configure: error: no acceptable C compiler found in $PATH</p>
<p style="padding-left: 30px;">See `config.log&#8217; for more details</p>
<h2>GCC</h2>
<p>Gnokii is telling us it needs a C compiler. I suppose CactiEZ does not ship with one, so lets install one:</p>
<pre class="brush: bash; title: ; notranslate">yum install gcc</pre>
<p>Select Y when asked if it&#8217;s OK to download</p>
<p>Once that installs lets try again:</p>
<pre class="brush: bash; title: ; notranslate">./configure</pre>
<p>We get a new error:</p>
<p style="padding-left: 30px;"><em>checking for intltool >= 0.35.0&#8230; ./configure: line 5826: intltool-update: command not found</em></p>
<p style="padding-left: 30px;"><em>configure: error: Your intltool is too old. You need intltool 0.35.0 or later.</em></p>
<p>Let&#8217;s use yum to install intltool:</p>
<pre class="brush: bash; title: ; notranslate">yum install intltool</pre>
<p>Once that installs lets try again (you can skip this if you want, it&#8217;s just to show you the process I went through):</p>
<pre class="brush: bash; title: ; notranslate">./configure</pre>
<h2>Intltool</h2>
<p>Still the same error. But at least yum has installed the dependencies needed for intltool. Now we&#8217;ll manually upgrade intltool by downloading the latest version:</p>
<pre class="brush: bash; title: ; notranslate">cd /tmp
wget http://launchpad.net/intltool/trunk/0.41.1/+download/intltool-0.41.1.tar.gz
tar xvfz intltool-0.41.1.tar.gz
cd intltool-0.41.1</pre>
<p>Let&#8217;s install the new version of intltool using the instructions from:</p>
<p>http://www.linuxfromscratch.org/blfs/view/cvs/general/intltool.html</p>
<pre class="brush: bash; title: ; notranslate">./configure --prefix=/usr
make
make install
install -v -m644 -D doc/I18N-HOWTO \/usr/share/doc/intltool-0.41.1/I18N-HOWTO</pre>
<p>And we&#8217;ll try installing Gnokii again:</p>
<pre class="brush: bash; title: ; notranslate">./configure</pre>
<p>This time the error outputs:</p>
<p style="padding-left: 30px;"><em>configure: error: in `/tmp/gnokii-0.6.30&#8242;:</em></p>
<p style="padding-left: 30px;"><em>configure: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config.</em></p>
<p style="padding-left: 30px;"><em>Alternatively, you may set the environment variables GLIB_CFLAGS and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.</em></p>
<p style="padding-left: 30px;"><em>To get pkg-config, see <http://pkg-config.freedesktop.org/>.</em></p>
<p style="padding-left: 30px;"><em>See `config.log&#8217; for more details</em></p>
<h2>pkg-config</h2>
<p>Lets move back to the tmp directory to download pkg-config:</p>
<pre class="brush: bash; title: ; notranslate">cd /tmp
wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.25.tar.gz
tar xvfz pkg-config-0.25.tar.gz
cd pkg-config-0.25
./configure --prefix=/usr
make
make install</pre>
<p>And we&#8217;ll try installing Gnokii again:</p>
<pre class="brush: bash; title: ; notranslate">./configure</pre>
<p style="padding-left: 30px;"><em>configure: error: Package requirements (glib-2.0) were not met:</em></p>
<p style="padding-left: 30px;"><em>No package &#8216;glib-2.0&#8242; found</em></p>
<p style="padding-left: 30px;"><em>Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.</em></p>
<p style="padding-left: 30px;"><em>Alternatively, you may set the environment variables GLIB_CFLAGS and GLIB_LIBS to avoid the need to call pkg-config.</em></p>
<p style="padding-left: 30px;"><em>See the pkg-config man page for more details.</em></p>
<h2>Glib-2.0</h2>
<p>Fortunately glib-2.0 has a yum package that we can install:</p>
<pre class="brush: bash; title: ; notranslate">yum install glib2-devel</pre>
<h2>Installing Gnokii</h2>
<p>OK everything should be ready to go now to install Gnokii. Let&#8217;s give it a try:</p>
<pre class="brush: bash; title: ; notranslate">cd /tmp/gnokii-0.6.30
./configure
gmake
gmake install</pre>
<p>Now Gnokii is installed but we have a few more things to do before we&#8217;re done.</p>
<h2>Configuring Gnokii</h2>
<p>Gnokii needs a configuration file before it will work with your mobile phone. You can get a list of config files and phones from the Gnokii website:</p>
<p><a href="http://wiki.gnokii.org/index.php/Config">http://wiki.gnokii.org/index.php/Config</a></p>
<p>The config file will be can be put in the users home folder using the file name .gnokiirc</p>
<pre class="brush: bash; title: ; notranslate">touch ~/.gnokiirc</pre>
<p>Before we create our config file we need to find out what port our phone is connected to.</p>
<pre class="brush: bash; title: ; notranslate">dmesg | tail</pre>
<p style="padding-left: 30px;"><em>usb 4-1: new full speed USB device using address 6</em></p>
<p style="padding-left: 30px;"><em>drivers/usb/class/cdc-acm.c: Ignoring extra header</em></p>
<p style="padding-left: 30px;"><em>drivers/usb/class/cdc-acm.c: This device cannot do calls on its own. It is no modem.</em></p>
<p style="padding-left: 30px;"><em>cdc_acm 4-1:1.0: ttyACM0: USB ACM device</em></p>
<p>The main bit of info we&#8217;re interested in is the <strong>ttyACM0</strong>. Yours may say something different. This is the value we&#8217;ll use for the port variable in the config file.</p>
<p>Then use your favourite text editor to edit the file. We&#8217;ll use vi because it comes with the CactiEZ installation:</p>
<pre class="brush: bash; title: ; notranslate">vi ~/.gnokiirc</pre>
<p>Insert the text for your config. In my case I found a working config on the website for the Nokia 6070:</p>
<p>[global]</p>
<p>model = 6510</p>
<p>port = /dev/ttyACM0</p>
<p>connection = serial</p>
<p>To Use vi press &#8216;i&#8217; to insert new text. To save the file and leave vi, type ESC+:+x (press ESC key, type : followed by x and [enter] key).</p>
<p>I will change the permissions on this file since the apache user group will need to access these files.</p>
<pre class="brush: bash; title: ; notranslate">chmod 777 ~/.gnokiirc
chmod 777 /dev/ttyACM0</pre>
<h2>Testing it out</h2>
<p>Now we need to test out our configuration. Plug in your phone to the computer, or if your using bluetooth make sure it&#8217;s paired. First we&#8217;ll ask Gnokii to identify the connected phone:</p>
<pre class="brush: bash; title: ; notranslate">gnokii --identify</pre>
<p>Be patient. This could take a minute or two. Once it finishes you&#8217;ll get an output looking something like this:</p>
<p style="padding-left: 30px;"><em>IMEI : xxxxxxxxxxxxxxx</em></p>
<p style="padding-left: 30px;"><em>Manufacturer : Nokia</em></p>
<p style="padding-left: 30px;"><em>No flags section in the config file.</em></p>
<p style="padding-left: 30px;"><em>Model : RM-166</em></p>
<p style="padding-left: 30px;"><em>Product name : RM-166</em></p>
<p style="padding-left: 30px;"><em>Revision : V 04.22</em></p>
<p>This means everything is all good. Let&#8217;s try and text someone.</p>
<pre class="brush: bash; title: ; notranslate">echo &quot;Hi this is the computer&quot; | gnokii --sendsms +15555552233 -r</pre>
<p>If you get a text it means we&#8217;re all good to go. Now we just have to tell Cacti how to use our new SMS capabilities.</p>
<h2>Modifying Cacti</h2>
<p>CactiEZ comes with an alerting and threshold plugin installed. This plugin on its own can email us with dead host notifications or when thresholds are exceeded. We need to find these files and add a line of code telling them to also shoot out a text message. Also we&#8217;ll need to add a config variable so that we can add mobile phone numbers through Cacti&#8217;s web based interface. Here&#8217;s the files we&#8217;re wanting to change:</p>
<p>/var/www/html/plugins/thold/cli_thresholds.php<br />
/var/www/html/plugins/thold/includes/settings.php<br />
/var/www/html/plugins/thold/includes/polling.php</p>
<h3>Modifying the files</h3>
<p>The easiest method is to just overwrite the files with ones I&#8217;ve already created. Let&#8217;s also make sure to backup the old ones in case anything goes wrong. Download and unzip the modified files:</p>
<pre class="brush: bash; title: ; notranslate">cd /tmp/
wget http://makesomecode.com/resources/cacti.zip
unzip cacti.zip
cp /var/www/html/plugins/thold/cli_thresholds.php /var/www/html/plugins/thold/cli_thresholds.php.old
cp /var/www/html/plugins/thold/includes/settings.php /var/www/html/plugins/thold/includes/settings.php.old
cp /var/www/html/plugins/thold/includes/polling.php /var/www/html/plugins/thold/includes/polling.php.old
mv cli_thresholds.php /var/www/html/plugins/thold/
mv settings.php /var/www/html/plugins/thold/includes/
mv polling.php /var/www/html/plugins/thold/includes/
</pre>
<h2>Settings in Cacti</h2>
<p>Go to &#8216;<strong>Settings</strong>&#8216; under the &#8216;<strong>Configuration</strong>&#8216; heading in the left menu. Click on &#8216;<strong>Alerting/Thold</strong>&#8216;. You&#8217;ll see a few new options below. In order for this to work you must have <strong>dead host notifications</strong> and <strong>Send alerts as SMS text</strong> enabled. Then put write in your phone number in the <strong>Dead Host Notifications SMS Number</strong> text box. Make sure you include your country code in the phone number as this helps to reduce possible problems down the road. Here in australia the number would look something like this:</p>
<p>61455555555</p>
<p>If you need to send to multiple phones just comma separate them with no spaces in between.</p>
<p><a href="http://makesomecode.com/2011/07/19/setting-up-sms-with-cactiez-and-gnokii/cacti-2/" rel="attachment wp-att-342"><img class="alignnone size-full wp-image-342" title="cacti" src="http://makesomecode.com/wp-content/uploads/2011/07/cacti1.jpg" alt="" width="500" /></a></p>
<p>Well that&#8217;s it! Now you just need to test it out. Go and unplug a host that you&#8217;re currently monitoring and you should get a txt within a couple of minutes (remember the poller only runs every 2 mins or so). Also make sure that if the phone attached to the cacti machine gets unplugged or the machine gets restarted you&#8217;ll have to chmod it&#8217;s port again back to 777.</p>
]]></content:encoded>
			<wfw:commentRss>http://makesomecode.com/2011/07/19/setting-up-sms-with-cactiez-and-gnokii/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.852 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-16 18:32:03 -->
<!-- Compression = gzip -->
