<?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>chaoscontrol.org</title>
	<atom:link href="http://www.chaoscontrol.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chaoscontrol.org</link>
	<description></description>
	<lastBuildDate>Fri, 18 May 2012 14:43:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CSS, Minification&#8230; and You.</title>
		<link>http://www.chaoscontrol.org/css-minification-and-you/</link>
		<comments>http://www.chaoscontrol.org/css-minification-and-you/#comments</comments>
		<pubDate>Mon, 14 May 2012 18:51:01 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.chaoscontrol.org/?p=58</guid>
		<description><![CDATA[If you run Yahoo&#8217;s YSlow or use FireBug to display page load times, one of the recommendations to increase your site&#8217;s performance is to optimize CSS and JavaScript transfers by &#8220;minifying&#8221; them. Minification is the process of stripping out any of the unnecessaries that developers add to their files to make them easier to read [...]]]></description>
			<content:encoded><![CDATA[<p>If you run Yahoo&#8217;s <a title="YSlow" href="http://www.yslow.com" target="_blank">YSlow</a> or use FireBug to display page load times, one of the recommendations to increase your site&#8217;s performance is to optimize CSS and JavaScript transfers by &#8220;minifying&#8221; them.</p>
<p>Minification is the process of stripping out any of the unnecessaries that developers add to their files to make them easier to read and prettier to view. Things like white space (spaces), comment characters, line breaks, tabs, etc.</p>
<p>Example,</p>
<p><strong>Original (279 bytes):</strong></p>
<pre name="code" class="css">body {
font-family: helvetica, arial, sans-serif;
color: block;
line-height: 1.2em;
}

/* make divs centered */
.center {
display: block;
margin: 0 auto;
}

#box {
border: 1px solid #000;
padding: 15px;
margin-top: 5px;
}</pre>
<p><strong>Minified (165 bytes):</strong></p>
<pre name="code" class="css">body{font-family:helvetica,arial,sans-serif;color:block;line-height:1.2em}
.center{display:block;margin:0 auto}#box{border:1px solid #000;padding:15px;
margin-top:5px}</pre>
<p>The original CSS is now 41% smaller after minification! For low traffic websites, saving 114 bytes on a page load isn&#8217;t significant but for high volume sites, 1000 page loads (ignoring caching for the sake of argument) is about 111K of less data to be transferred. Now imagine a site like amazon.com getting millions of hits &#8211; the bandwidth savings becomes quite significant.</p>
<p>So, web developers. Reduce your bandwidth footprint and minify your CSS and Javascript files! You can use the free tool below to do so:</p>
<p><a title="CSS/JS Minify-O-Matic!" href="http://minify.chaoscontrol.org">CSS/JavaScript Minify-O-Matic!</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chaoscontrol.org/css-minification-and-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>String Conversion Functions</title>
		<link>http://www.chaoscontrol.org/string-conversion-functions/</link>
		<comments>http://www.chaoscontrol.org/string-conversion-functions/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 17:54:48 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://chaoscontrol/?p=22</guid>
		<description><![CDATA[I had been doing some nerdy spring-cleaning and found this while digging through the &#8216;junk&#8217; folder. Maybe useful so I&#8217;m posting it here. // Convert ASCII Text to Binary function text2bin($string) { $string_array = explode("\r\n", chunk_split($string, 1)); for ($n = 0; $n &#60; count($string_array) - 1; $n++) { $newstring .= substr("0000".base_convert(ord($string_array[$n]), 10, 2), -8); } [...]]]></description>
			<content:encoded><![CDATA[<p>I had been doing some nerdy spring-cleaning and found this while digging through the &#8216;junk&#8217; folder. Maybe useful so I&#8217;m posting it here.</p>
<pre name="code" class="php">
// Convert ASCII Text to Binary
function text2bin($string) {
    $string_array = explode("\r\n", chunk_split($string, 1));
    for ($n = 0; $n &lt; count($string_array) - 1; $n++) {
        $newstring .= substr("0000".base_convert(ord($string_array[$n]), 10, 2), -8);
    }
    $newstring = chunk_split($newstring, 8, " ");
    return $newstring;
}

// Convert Binary to ASCII Text
function bin2text($string) {
    $string = str_replace(" ", "", $string);
    $string_array = explode("\r\n", chunk_split($string, 8));
    for ($n = 0; $n &lt; count($string_array) - 1; $n++) {
        $newstring .= chr(base_convert($string_array[$n], 2, 10));
    }
    return $newstring;
}

// Convert ASCII Text to Hexadecimal
function ascii2hex($string) {
    return chunk_split(bin2hex($string), 2, " ");
}	

// Convert Hexadecimal to ASCII Text
function hex2ascii($string) {
    $string = str_replace(" ", "", $string);
    for ($n=0; $n &lt; strlen($string); $n+=2) {
        $newstring .=  pack("C", hexdec(substr($string, $n, 2)));
    }
    return $newstring;
}

// Convery Binary to Hexadecimal
function binary2hex($string) {
    $string = str_replace(" ", "", $string);
    $string_array = explode("\r\n", chunk_split($string, 8));
    for ($n = 0; $n &lt; count($string_array) - 1; $n++) {
        $newstring .= base_convert($string_array[$n], 2, 16);
    }
    $newstring = chunk_split($newstring, 2, " ");
    return $newstring;
}

// Convert Hexadecimal to Binary
function hex2binary($string) {
    $string = str_replace(" ", "", $string);
    $string_array = explode("\r\n", chunk_split($string, 2));
    for ($n = 0; $n &lt; count($string_array) - 1; $n++) {
        $newstring .= substr("0000".base_convert($string_array[$n], 16, 2), -8);
    }
    $newstring = chunk_split($newstring, 8, " ");
    return $newstring;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chaoscontrol.org/string-conversion-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uninstall MySQL on OS X</title>
		<link>http://www.chaoscontrol.org/uninstall-mysql-on-os-x/</link>
		<comments>http://www.chaoscontrol.org/uninstall-mysql-on-os-x/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 17:49:59 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://chaoscontrol/?p=18</guid>
		<description><![CDATA[If you look through the MySQL support docs, there is no clear description for uninstalling MySQL in OS X. Here&#8217;s how: Make sure MySQL isn&#8217;t running. If you have the preference pane installed, stop the server. Otherwise you can stop it from the terminal: sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop Edit /etc/hostconfig sudo nano /etc/hostconfig Password: AFPSERVER=-NO- AUTHSERVER=-NO- TIMESYNC=-NO- [...]]]></description>
			<content:encoded><![CDATA[<p>If you look through the <a href="http://dev.mysql.com/doc/">MySQL support docs</a>, there is no clear description for uninstalling MySQL in OS X. Here&#8217;s how:</p>
<p>Make sure MySQL isn&#8217;t running. If you have the preference pane installed, stop the server. Otherwise you can stop it from the terminal:</p>
<pre name="code" class="c">sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop</pre>
<p><strong>Edit /etc/hostconfig</strong></p>
<pre name="code" class="c">sudo nano /etc/hostconfig
Password:

AFPSERVER=-NO-
AUTHSERVER=-NO-
TIMESYNC=-NO-
QTSSERVER=-NO-
MYSQLCOM=-YES-</pre>
<p>Remove or comment out (# marks the line as a comment) the line that says “MYSQLCOM=-YES-”.</p>
<p><strong>Remove MySQL</strong><br />
Still in the terminal&#8230;.</p>
<pre name="code" class="c">sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
sudo rm /etc/my.cnf</pre>
<p>That&#8217;s it. MySQL is gone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chaoscontrol.org/uninstall-mysql-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php5 Cookie Class (mmm&#8230;. cookies!)</title>
		<link>http://www.chaoscontrol.org/php5-cookie-class-mmm-cookies/</link>
		<comments>http://www.chaoscontrol.org/php5-cookie-class-mmm-cookies/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 17:46:40 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://chaoscontrol/?p=15</guid>
		<description><![CDATA[A php5 class for dealing with cookies. Technically it requires php 5.2 because of the added &#8216;httponly&#8217; option but removing any reference to it will allow it to run under any 5.x build. Example usage: require 'cookies.class.php'; $cookie = new cookies('360000'); // Pass expiration value if ($cookie-&#62;set('example', 'example') === TRUE) { // Pass cookie name [...]]]></description>
			<content:encoded><![CDATA[<p>A php5 class for dealing with cookies. Technically it requires php 5.2 because of the added &#8216;httponly&#8217; option but removing any reference to it will allow it to run under any 5.x build.</p>
<p>Example usage:</p>
<pre name="code" class="php">require 'cookies.class.php';
$cookie = new cookies('360000'); // Pass expiration value

if ($cookie-&gt;set('example', 'example') === TRUE) { // Pass cookie name and value
echo 'Cookie is set!';
 }
echo $cookie-&gt;value('example');
</pre>
<p>Here&#8217;s the full code:</p>
<pre name="code" class="php">
&lt;?php

/**
 * ------------------------------------------------------------------------------------------------
 * php class for cookie manipulation.
 *  - Sets, deletes, checkes existance of, and returns values from cookies.
 * ------------------------------------------------------------------------------------------------
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 * the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program. If
 * not, see &lt;http://www.gnu.org/licenses/lgpl.html&gt;
 * ------------------------------------------------------------------------------------------------
 * @author          Chris Sprague (chris@chaoscontrol.org)
 * @license         LGPL http://www.gnu.org/licenses/lgpl.html
 * @link            http://chaoscontrol.org
 * @version    	    1.0.0
 * @requires        php 5.2.0
 * ------------------------------------------------------------------------------------------------
 */

 class cookies {

    /* Class Variables ------------------------------------------------------------------------- */

    /**
     * Name of the cookie
     * @var $mixed
     */
    public $name;

    /**
     * Class constructor
     *
     * @param int $expires Number of seconds until cookie expires
     * @param mixed $path
     * @param bool $secure
     * @param bool $httponly
     */
    public function __construct($expires, $path = '/', $secure = FALSE, $httponly = FALSE) {
        $this-&gt;expiration = $expires;
        $this-&gt;path = $path;
        $this-&gt;domain = '.' . $_SERVER["SERVER_NAME"];
        $this-&gt;secure = $secure;
        $this-&gt;httponly = $httponly;
    }

    /**
     * Deletes a cookie
     *
     * @param mixed $name
     * @return bool
     */
    public function delete($name) {
        if (headers_sent() === FALSE) {

           setcookie (
                $name,
                "",
                time() - 3600 * 25,
                $this-&gt;path,
                $this-&gt;domain,
                $this-&gt;secure,
                $this-&gt;httponly);

            // Confirm Deletion
            if ($this-&gt;check($name) === FALSE) {
                return TRUE;
            }
        }
        return FALSE;
    }

    /**
     * Creates a cookie
     *
     * @param mixed $name
     * @param mixed $data
     * @return bool
     */
    public function set($name, $data = '') {
        if (headers_sent() === FALSE) {

            setcookie (
                $name,
                serialize($data),
                time() + $this-&gt;expiration,
                $this-&gt;path,
                $this-&gt;domain,
                $this-&gt;secure,
                $this-&gt;httponly);

            // Set $_COOKIE value for same page load
            $_COOKIE[$name] = serialize($data);

            // Confirm Set
            if ($this-&gt;check($name) === TRUE) {
                return TRUE;
            }
        }
        return FALSE;
    }

    /**
     * Returns the value of a cookie
     *
     * @param mixed $name
     * @return mixed
     */
    public function value($name) {
        if ($this-&gt;check($name) === TRUE) {
            return unserialize($_COOKIE[$name]);
        }
        return FALSE;
    }

    /**
     * Check the existance of a cookie
     *
     * @param mixed $name
     * @return bool
     */
    public function check($name) {
        return isset($_COOKIE[$name]);
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chaoscontrol.org/php5-cookie-class-mmm-cookies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Last.FM Top Albums WP Plugin</title>
		<link>http://www.chaoscontrol.org/last-fm-top-albums-wp-plugin/</link>
		<comments>http://www.chaoscontrol.org/last-fm-top-albums-wp-plugin/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 17:42:31 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://chaoscontrol/?p=10</guid>
		<description><![CDATA[I&#8217;ve been meaning to package this into a proper WordPress plugin but.. one day. In the meantime, here it is in it&#8217;s raw form. What it does is get your top albums from Last.FM and displays the album art in a pretty table. The XML file gets cached so it wont make an API call to the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to package this into a proper WordPress plugin but.. one day. In the meantime, here it is in it&#8217;s raw form.</p>
<p>What it does is get your top albums from <a href="http://last.fm" target="blank">Last.FM</a> and displays the album art in a pretty table. The XML file gets cached so it wont make an API call to the Last.FM servers on each page load.</p>
<p>It uses simplexml so you&#8217;ll need to be running at least php 5.</p>
<p>Dirty Install: Add your username and API key, create a folder in your wordpress plugins directory called CCO-LastFM_Top_Albums and save the below code in index.php of said directory. Call the function in your template.</p>
<p>* I should note that this has been minimally tested.</p>
<pre name="code" class="php">&lt;?php
/*
Plugin Name: Last.FM Top Albums
Plugin URI: http://www.chaoscontrol.org/wordpress/lastfm-top-albums-wp-plugin
Description: Gets your top played albums (with art) from last.fm
Version: 1.0
Author: Chris Sprague
Author URI: http://www.chaoscontrol.org/about
License: GPL2
*/

/*  Copyright 2011  Chris Sprague  (email : chris@chaoscontrol.org)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
function last_fm_top_albums() {

    // Your Last.FM Username
    $user = '';
    // Last.FM API Key (http://www.last.fm/api/account)
    $api = '';
     // overall | 7day | 3month | 6month | 12month
    $period = "7day";
    // Number of albums to pull
    $limit = '10';
    // Number of rows to display on
    $rows = '2';                               

    $as = 'http://ws.audioscrobbler.com/2.0/';
    $method = '?method=user.gettopalbums';

    $uri = $as;
    $uri .= $method;
    $uri .= '&amp;user=' . $user;
    $uri .= '&amp;period=' . $period;
    $uri .= '&amp;limit=' . $limit;
    $uri .= '&amp;api_key=' . $api;

    $cachedFile = WP_PLUGIN_DIR . '/CCO-LastFM_Top_Albums/' . $user . '.xml';
    $cachedTTL = '300'; // Number of seconds

    if (!file_exists($cachedFile) OR (filemtime($cachedFile) &lt; time() - $cachedTTL)) {
            $xml = file_get_contents($uri);
            $fh = fopen($cachedFile, 'wb+');
            fwrite($fh, $xml);
            fclose($fh);
    }

    $xml = simplexml_load_file($cachedFile);
    $div = $limit / $rows;
    $i = 1;

    echo '&lt;p&gt;';
    foreach ($xml-&gt;topalbums-&gt;album as $album) {
        echo '
        &lt;a href="' . $album-&gt;url . '"&gt;
            &lt;img src=' . $album-&gt;image . ' /&gt;
        &lt;/a&gt;';

        if ($i &gt;= $div) {
            echo '&lt;/p&gt;&lt;p&gt;';
            $i = 1;
        } else {
            $i++;
        }
    }
    echo '&lt;/p&gt;';
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chaoscontrol.org/last-fm-top-albums-wp-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>B&#8217;ak&#8217;tun Countdown Widget</title>
		<link>http://www.chaoscontrol.org/baktun-countdown-widget/</link>
		<comments>http://www.chaoscontrol.org/baktun-countdown-widget/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 17:36:47 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://chaoscontrol/?p=7</guid>
		<description><![CDATA[Displays a countdown to December 21st 2012, marking the end of the 13th b&#8217;ak&#8217;tun of the Mayan long count calendar. AKA, the end of the world for the doomsdayists. Mac OS X 10.4 Tiger is required. If you’re using Safari, click the download link. When the widget download is complete, show Dashboard, click the Plus [...]]]></description>
			<content:encoded><![CDATA[<p>Displays a countdown to December 21st 2012, marking the end of the 13th b&#8217;ak&#8217;tun of the Mayan long count calendar. AKA, the end of the world for the doomsdayists.</p>
<p><a href="http://chaoscontrol/wp-content/uploads/2011/03/baktun_countdown.png"><img src="http://chaoscontrol/wp-content/uploads/2011/03/baktun_countdown.png" alt="B&#039;ak&#039;tun Countdown Dashboard Widget" title="B&#039;ak&#039;tun Countdown Dashboard Widget" width="302" height="106" class="aligncenter size-full wp-image-55" /></a></p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p><em>Mac OS X 10.4 Tiger is required. If you’re using Safari, click the download link. When the widget download is complete, show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it. If you’re using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chaoscontrol.org/baktun-countdown-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

