<?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>SleePyCode</title>
	<atom:link href="http://sleepycode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sleepycode.com</link>
	<description>/dev/random</description>
	<lastBuildDate>Sat, 12 May 2012 05:45:04 +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>Another Ubuntu upgrade, Another dovecot+postfix breakage</title>
		<link>http://sleepycode.com/2012/05/another-ubuntu-upgrade-another-dovecotpostfix-breakage/</link>
		<comments>http://sleepycode.com/2012/05/another-ubuntu-upgrade-another-dovecotpostfix-breakage/#comments</comments>
		<pubDate>Sat, 12 May 2012 05:42:31 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1713</guid>
		<description><![CDATA[It seems like every time I upgrade Ubuntu, dovecot+postfix breaks. Maybe its just my luck, but it has gotten fairly annoying to be the only service that breaks after any upgrade. This time I spent hours last weekend reinstalling, uninstalling and reinstalling postfix and dovecot about 4 or 5 times. Sad to say here I [...]]]></description>
			<content:encoded><![CDATA[<p>It seems like every time I upgrade Ubuntu, dovecot+postfix breaks.  Maybe its just my luck, but it has gotten fairly annoying to be the only service that breaks after any upgrade.</p>
<p>This time I spent hours last weekend reinstalling, uninstalling and reinstalling postfix and dovecot about 4 or 5 times.  Sad to say here I don&#8217;t know quite what fixed it but I was able to receive mail.</p>
<p>Now today I found out I wasn&#8217;t able to send mail.  So back into debug mode again to resolve that.</p>
<p>While doing some tests I realized that i couldn&#8217;t even log into my mail server under smtp (port 25).  After some digging around I came across this little post:<br />
<a href="http://www.howtoforge.com/ubuntu-11.10-saslauthd-sasl-plain-authentication-failed-no-mechanism-available">http://www.howtoforge.com/ubuntu-11.10-saslauthd-sasl-plain-authentication-failed-no-mechanism-available</a></p>
<p>The most important part here was a new line and change to an existing one:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
auxprop_plugin: sql
sql_engine: mysql
</pre>
<p>Which for me was that auxprop_plugin went from mysql to sql and I added the new line below.  This after a proper service restart resolved that problem.  However I still had a problem of connecting to mail across SMTP+SSL (ie SMTPS on 465).</p>
<p>First off, I discovered my SSL certs for dovecot where outdated (expired it seems).  While this shouldn&#8217;t of been causing the problem, I reissued the certificates.  A quick search turned up <a href="http://wiki.dovecot.org/SSL/CertificateCreation">makecert.sh</a> and I was quickly back in business after backing up, deleting and generating the new certificates.  I did modify the file and generate longer certificates though so it wouldn&#8217;t expire as fast (default is 1 year).</p>
<p>In my research, I found out a helpful command would tell me if SSL was working:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
$ openssl s_client -connect mail.sleepycode.com:465
CONNECTED(00000003)
482:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:/SourceCache/OpenSSL098/OpenSSL098-44/src/ssl/s23_clnt.c:607:
</pre>
<p>It failed as you can see. I will also mention you can test just TLS here by using:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
openssl s_client -starttls smtp -connect mail.sleepycode.com:465
</pre>
<p>I ran this command on the server directly, and it did give me more output, which became my basis for google searches.</p>
<pre class="wp-code-highlight prettyprint linenums:1">
openssl s_client -connect mail.sleepycode.com:465
CONNECTED(00000003)
139900418954912:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:749:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 226 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---
</pre>
<p>This problem here after many google searches not turning up too many results, I stumbled onto this blog post, which had my answer.<a href="http://abing.gotdns.com/posts/2008/getting-postfix-to-run-smtps-on-port-465/">http://abing.gotdns.com/posts/2008/getting-postfix-to-run-smtps-on-port-465/</a></p>
<pre class="wp-code-highlight prettyprint linenums:1">
smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
</pre>
<p>I had the options commented out.  So while the service was running on 465, the options where not set to enable TLS on that port.  A few quick changes and service restart later, everything was working.  Which leaves me with another note of being more careful doing file merging when using SSH during a upgrade.  I most likely botched the file at that time.</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2012/05/another-ubuntu-upgrade-another-dovecotpostfix-breakage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Airport Extreme ignoring ICMP requests</title>
		<link>http://sleepycode.com/2012/04/airport-extreme-ignoring-icmp-requests/</link>
		<comments>http://sleepycode.com/2012/04/airport-extreme-ignoring-icmp-requests/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 17:30:45 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Airtport Extreme]]></category>
		<category><![CDATA[DMZ]]></category>
		<category><![CDATA[ICMP]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1711</guid>
		<description><![CDATA[After setting up my ISPs Modem/router combo unit to not run the router and act only as a bridge. I came across an issue where I couldn&#8217;t update my IPv6 settings with my new IP address because my router was not responding to ICMP requests. Well, it turns out that I had enabled a default [...]]]></description>
			<content:encoded><![CDATA[<p>After setting up my ISPs Modem/router combo unit to not run the router and act only as a bridge.  I came across an issue where I couldn&#8217;t update my IPv6 settings with my new IP address because my router was not responding to ICMP requests.</p>
<p>Well, it turns out that I had enabled a default host, or as the rest of the world knows it, a DMZ.  The machine I put into the DMZ was my windows machine and its firewall was prohibiting ICMP request.</p>
<p>Simple solution here is to just remove the machine and let the router respond to the ICMP request.</p>
<p>I also should note that you can also disable ICMP requests by setting the DMZ to a unused IP on your network.  The request will silently fail as long as that IP is not in use on the network.  Probably the easiest way to do this is to tell the router to only assign a range of IPs such as from 100 to 200 for its DHCP.  All your normal systems will get a DHCP address in that range while systems you statically configure can obtain ones outside of that range and you can be sure that no normal system would get a DHCP address.</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2012/04/airport-extreme-ignoring-icmp-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenFiler with Rocket Raid card</title>
		<link>http://sleepycode.com/2012/04/openfiler-with-rocket-raid-card/</link>
		<comments>http://sleepycode.com/2012/04/openfiler-with-rocket-raid-card/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 05:53:42 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Filer]]></category>
		<category><![CDATA[Raid]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1700</guid>
		<description><![CDATA[Open filer, nor Linux in general likes working with the Rocket Raid cards. However despite what is said, it is possible to set this up. It took some time, searches, testing, frustration and putting a piece of tape over the cards speaker (The raid failure beep got annoying). Well the first problem is installing Open [...]]]></description>
			<content:encoded><![CDATA[<p>Open filer, nor Linux in general likes working with the Rocket Raid cards.  However despite what is said, it is possible to set this up.  It took some time, searches, testing, frustration and putting a piece of tape over the cards speaker (The raid failure beep got annoying).</p>
<p>Well the first problem is installing Open Filer.  It does not like installing onto the raid, for the same reason it takes work to get it to install the driver.  I gave up early on trying to get anything to work and just opted to run the OS on a single non raid drive plugged directly into the system board.  It took some time with the BIOS settings and toying with Open Filer to get it to recognize the drive.  I can&#8217;t be sure as to why but I assume its because the motherboard also had built in raid support and Open Filer was trying to load those drivers as well.  I changed some BIOS settings and worked with the open filer installer a few times of trial and error to install.  I think I had to load the IMB raid and usb mass storage drivers for it to get to the install screen.<br />
After completing this, I mostly reversed the changes I did to the BIOS.  I had to make some additional bios changes and move the SATA to a lower SATA port on the mother board for the BIOS to recognize the hard drive as a boot option.  In the end I needed it to boot of the stand alone hard drive while the raid card was plugged in,</p>
<p>After that the problem was down to getting the driver to work.  This was the most tricky part.  I found out during testing of installing the drivers the manufacture provides that it would not interact properly with the raid card.  In fact it would split the raid into two and send off alerts.  I got tired of the beeps and put tape over the speaker while I worked with it, although it could still be heard much to the disappointment of those around me.</p>
<p>How I got it to finally work was actually easier than I thought.  First off I downloaded the open source generic driver.  Then proceeded to untar it and changed my directory to hptdriver2/rr231x_0x-linux-src-v2.5/product/rr2310pm/linux</p>
<p>Then I ran the make commands:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
make
</pre>
<p>Then I exported some variables.</p>
<pre class="wp-code-highlight prettyprint linenums:1">
KERNEL_VER=`uname -a`
export TARGETNAME='rr2310_00'
</pre>
<p>Finally I changed back to hptdriver2/osm/linux and ran the install.sh command.  It will tell you that it failed to update the linux ram image.  Thats ok at this point.</p>
<p>Now to get the image to compile I had to copy the .ko file a few times.  I am sure there is a reason it wanted those drivers but none the less the copy command worked and things went just fine.</p>
<pre class="wp-code-highlight prettyprint linenums:1">
cp /lib/modules/`uname -r `/kernel/drivers/scsi/rr2310_00/rr2310_00.ko /lib/modules/`uname -r `/kernel/drivers/scsi/hptiop.ko
cp /lib/modules/`uname -r `/kernel/drivers/scsi/rr2310_00/rr2310_00.ko /lib/modules/`uname -r `/kernel/drivers/scsi/rr232x.ko
</pre>
<p>The I finally built the ram image.  My first couple tries failed.  Which is when I found out I needed to copy those files.  After it was still failing I found out that sata_mv driver had been removed by install.sh and the kernel wanted it (or at least thinks it did).  So I just told the image that it was built in and it succeeded to create it.</p>
<pre class="wp-code-highlight prettyprint linenums:1">
mkinitrd --builtin=sata_mv /boot/`uname -r`_hpt.img `uname -r`
</pre>
<p>Now that it completed.  I opened up the grub config file (in /boot/grub) and proceded to duplicate the first boot item and modified its ram image file to point to the new one.  I made sure to leave the old one incase it didn&#8217;t work and would have another way to boot the system.</p>
<p>Finally I issued a reboot and hoped for the best.  To my luck it finally started up, with no beeping and doing a &#8220;fdisk -l&#8221; in the console only showed the main OS disk and a single disk.  When I did it wrong or didn&#8217;t have the drivers linux would see each of the drives individually.</p>
<p>While I didn&#8217;t do this, at this point you should be able to copy over the OS to the raid card.  Windows recognizes the raid card just fine.  So you could use Hirens boot cd and run Raw Copy to clone it over.  Grub does work fine with the raid card.  It is only when it starts Linux without the Rocket Raid card drivers that it kernel panics and fails.  Having the Rocket Raid drivers in the ram image should let it start up fine.</p>
<p>I should also note here that I had tried many times and failed on the same system.  Prior to doing this I thought I searched for all instances of hpt* and rr2* and any other instances I could think of related to the driver and removed them.  Its possible something else still did exist and is how it worked.</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2012/04/openfiler-with-rocket-raid-card/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMF $user_info in as a class</title>
		<link>http://sleepycode.com/2012/01/smf-user_info-in-as-a-class/</link>
		<comments>http://sleepycode.com/2012/01/smf-user_info-in-as-a-class/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 05:20:54 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SMF]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1701</guid>
		<description><![CDATA[I wrote up this method while writing my Pastebin. It was an experiment mostly to not have to use as many globals in my main code. I think it turned out nice and easy. Knowing that SMF 3.0 will use OOP does not help as this is the least likely way this would be implanted [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote up this method while writing my Pastebin.  It was an experiment mostly to not have to use as many globals in my main code.  I think it turned out nice and easy.  Knowing that SMF 3.0 will use OOP does not help as this is the least likely way this would be implanted in the code.  At least this can act as a bridge at that time to the new code.</p>
<p>I should explain the _() method.  I set this up so I could do a <a href="http://php.net/manual/en/language.oop5.patterns.php#language.oop5.patterns.singleton">Singleton</a>.  It also allows me to use it in a sorta static method by doing &#8220;userInfo::_()->id;&#8221;.  Nice quick and easy.</p>
<p>I could of wrote this like my smcFunc class, but choose otherwise on the fact I wanted to use it as a object rather than a static method.  A setup like that should be possible, but I didn&#8217;t test that.</p>
<p>I never tested but I don&#8217;t think accessing multiple dimensional parts of the $user_info will work.  Things like $user_info['group'][1] most likely won&#8217;t work here.  I should add support to drill down into the array, but will save that for a later day.</p>
<pre class="wp-code-highlight prettyprint linenums:1">
/*
* userInfo as a class.  We kinda do a poor method, but its the best way for now.
*/
class userInfo
{
	public static $instanceID = 0;

	public static function _()
	{
		if (self::$instanceID == 0)
			self::$instanceID = new userInfo;

		return self::$instanceID;
	}

	public function __set($key, $value)
	{
		global $user_info;
		$user_info[$key] = $value;
	}

	public function __get($key)
	{
		global $user_info;
		return isset($user_info[$key]) ? $user_info[$key] : null;
	}

	public function __isset($key)
	{
		global $user_info;
		return isset($user_info[$key]);
	}

	public function __unset($key)
	{
		global $user_info;
		unset($user_info[$key], $user_info[$key]);
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2012/01/smf-user_info-in-as-a-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pastebin rewrote</title>
		<link>http://sleepycode.com/2012/01/pastebin-rewrote/</link>
		<comments>http://sleepycode.com/2012/01/pastebin-rewrote/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 05:16:34 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Pastebin]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[SMF]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1683</guid>
		<description><![CDATA[I have taken my original code I wrote for my SMF powered pastebin and rewrote this script. This was a massive rewrite from the original code and hopefully it works out well for anyone else who is looking into using it. I wrote it so it should be plugable with different databases, user information and [...]]]></description>
			<content:encoded><![CDATA[<p>I have taken my original code I wrote for my SMF powered pastebin and rewrote this script.  This was a massive rewrite from the original code and hopefully it works out well for anyone else who is looking into using it.</p>
<p>I wrote it so it should be plugable with different databases, user information and templating engines.  The design was mostly to implant it into my mixed environment of SMF and WordPress, but also to make it robust so it could be used in other ways.</p>
<p>The source of the code is up on GitHub at https://github.com/jdarwood007/pastebin</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2012/01/pastebin-rewrote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMF in WordPress</title>
		<link>http://sleepycode.com/2012/01/smf-in-wordpress/</link>
		<comments>http://sleepycode.com/2012/01/smf-in-wordpress/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 18:00:14 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[SMF]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1681</guid>
		<description><![CDATA[For some reason, while using WordPress and including SMF&#8217;s SSI.php, it would not detect my logged in SMF session. Baffled and almost thinking this was a SMF bug of some sorts, I began to debug this process. Well it turns out it is sorta a SMF old PHP support issue, but the problem lies in [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason, while using WordPress and including SMF&#8217;s SSI.php, it would not detect my logged in SMF session.  Baffled and almost thinking this was a SMF bug of some sorts, I began to debug this process.</p>
<p>Well it turns out it is sorta a SMF old PHP support issue, but the problem lies in WordPress.  This is the function in WordPress wp-includes/load.php</p>
<pre class="wp-code-highlight prettyprint linenums:1">
/**
 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.
 *
 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,
 * or $_ENV are needed, use those superglobals directly.
 *
 * @access private
 * @since 3.0.0
 */
function wp_magic_quotes() {
        // If already slashed, strip.
        if ( get_magic_quotes_gpc() ) {
                $_GET    = stripslashes_deep( $_GET    );
                $_POST   = stripslashes_deep( $_POST   );
                $_COOKIE = stripslashes_deep( $_COOKIE );
        }

        // Escape with wpdb.
        $_GET    = add_magic_quotes( $_GET    );
        $_POST   = add_magic_quotes( $_POST   );
        $_COOKIE = add_magic_quotes( $_COOKIE );
        $_SERVER = add_magic_quotes( $_SERVER );

        // Force REQUEST to be GET + POST.
        $_REQUEST = array_merge( $_GET, $_POST );
}
</pre>
<p>The problem here, is that they add magic quotes to the cookie.  Not quite sure why they are even doing this.  But it broke adding SMF.  The part in SMF which failed because of this is in SMFs Sources/Load.php in the loadUserSettings function</p>
<pre class="wp-code-highlight prettyprint linenums:1">
		// Fix a security hole in PHP 4.3.9 and below...
		if (preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:&quot;\d{1,8}&quot;);i:1;s:(0|40):&quot;([a-fA-F0-9]{40})?&quot;;i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1)
		{
			list ($id_member, $password) = @unserialize($_COOKIE[$cookiename]);
			$id_member = !empty($id_member) &amp;&amp; strlen($password) &gt; 0 ? (int) $id_member : 0;
		}
		else
			$id_member = 0;
</pre>
<p>Because of old PHP support in SMF, its trying to combat a cookie security issue that existed below PHP 4.3.9.  Now I don&#8217;t use that version, but I rather not strip out the code.  The preg match was failing because it was not finding that valid string in the cookie.  Since all the double quotes where escaped with a slash \.</p>
<p>For my code, I called in Settings.php from SMF and then did a stripslashes on the cookie.  Then I included SSI.php, with the results I expected of it finding my active SMF session.</p>
<pre class="wp-code-highlight prettyprint linenums:1">
		require_once(pBS::get('smf_dir') . '/Settings.php');
		if (isset($_COOKIE[$cookiename]))
			$_COOKIE[$cookiename] = stripslashes($_COOKIE[$cookiename]);

		require_once(pBS::get('smf_dir') . '/SSI.php');
</pre>
<p>I should note because SMF uses a lot of global variables, that I had to globalize all of those before hand.  I just borrowed the globals from SSI.php and put them into that scripts function.</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2012/01/smf-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Password Generator is open source</title>
		<link>http://sleepycode.com/2012/01/password-generator-is-open-source/</link>
		<comments>http://sleepycode.com/2012/01/password-generator-is-open-source/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 18:38:36 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Generator]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[Site]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1676</guid>
		<description><![CDATA[I have rewrote my Password Generator script and after doing so, I have enabled it so you can see the source of this code. Simply click the link on the right side when viewing that page and the entire source code will be revealed. Developers are welcome to reuse any part of the code as [...]]]></description>
			<content:encoded><![CDATA[<p>I have rewrote my <a href="http://sleepycode.com/passgen/">Password Generator</a> script and after doing so, I have enabled it so you can see the source of this code.  Simply click the link on the right side when viewing that page and the entire source code will be revealed.<br />
Developers are welcome to reuse any part of the code as long as credit is given where appropriate.  Although this script may be over the top for normal password generation, I developed it to create truly random passwords.</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2012/01/password-generator-is-open-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMF Package Manager Generator</title>
		<link>http://sleepycode.com/2011/12/package-manager-generator/</link>
		<comments>http://sleepycode.com/2011/12/package-manager-generator/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 01:28:26 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Generator]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Package Manager]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[SMF]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1656</guid>
		<description><![CDATA[Hello, Originally I had wrote my original SMF Package Manager Generator a few years ago. It was sloppy coding, poor JavaScript and relied heavily on the server. Not my absolute best work, but was something I was proud on at the time from my efforts to dive into JavaScripting. However, todays times are different. So [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,<br />
Originally I had wrote my <a href="http://sleepycode.com/pacmangen/">original SMF Package Manager Generator</a> a few years ago.  It was sloppy coding, poor JavaScript and relied heavily on the server.  Not my absolute best work, but was something I was proud on at the time from my efforts to dive into JavaScripting.</p>
<p>However, todays times are different.  So with JQuery out there, I decided to take breaks from my projects for a couple hours for a few days and put forth a effort to rewrite this.  Needless to say, I had the initial code wrote in only a few hours.  My original script took me a few days alone.  That didn&#8217;t count the package-info creator I made later which also took a while.</p>
<p>The new script attempts to rely all on JavaScripting via JQuery.  It was a fun experience to build it this way.  Although, because of JavaScript&#8217;s security measures, I couldn&#8217;t leave downloading the file outside of the server.  So alas, I still have to process the actual download via the server.  There is a work around with using Data URIs, however it didn&#8217;t provide the filename and sounds a bit flaky when the length of the url gets to be a bit long.  I included both as a option though.</p>
<p>Oh and <a href="https://github.com/jdarwood007/smf_package_maker">Its on github</a>, because I see no reason to not share the code.  Including the code I used to integrate it into my WordPress blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2011/12/package-manager-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery Week Calendar mouseover events</title>
		<link>http://sleepycode.com/2011/12/jquery-week-calendar-moseover-events/</link>
		<comments>http://sleepycode.com/2011/12/jquery-week-calendar-moseover-events/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 03:33:39 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1646</guid>
		<description><![CDATA[While working with a plugin for JQuery for week calendars. I came across a very annoying little bug. Using mouseover/out events did not seem to work correctly when hovering over the title and time. It just wouldn&#8217;t do what it should of. Well after debugging and messing around for a while, I was able to [...]]]></description>
			<content:encoded><![CDATA[<p>While working with a plugin for <a href="https://github.com/themouette/jquery-week-calendar">JQuery for week calendars</a>.  I came across a very annoying little bug.  Using mouseover/out events did not seem to work correctly when hovering over the title and time.  It just wouldn&#8217;t do what it should of.</p>
<p>Well after debugging and messing around for a while, I was able to figure out how to resolve this issue.  In jquery.weekcalendar.js open up the file and locate:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
          if ($target.hasClass('wc-cal-event')) {
            options.eventMouseover($target.data('calEvent'), $target, event);
          }
</pre>
<p>After that code we want to add:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
          if ($target.hasClass('wc-time') || $target.hasClass('wc-title')) {
            options.eventMouseover($target.parents('.wc-cal-event').data('calEvent'), $target, event);
          }
</pre>
<p>A little further down the file is:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
          if ($target.hasClass('wc-cal-event')) {
            if ($target.data('sizing')) { return;}
            options.eventMouseout($target.data('calEvent'), $target, event);
          }
</pre>
<p>We want to add after that:</p>
<pre class="wp-code-highlight prettyprint linenums:1">
          if ($target.hasClass('wc-time') || $target.hasClass('wc-title')) {
            if ($target.data('sizing')) { return;}
            options.eventMouseout($target.parents('.wc-cal-event').data('calEvent'), $target, event);
          }
</pre>
<p>This makes it work as I excepted it to.  My thoughts here are that the inner divs are removing the mouseover events.  So by attaching an event to them as well, it makes it work as well.</p>
<p>As a good GitHub person does, I submitted a pull request with these fixes in hopes that it gets merged into the plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2011/12/jquery-week-calendar-moseover-events/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>new Date() in javascript</title>
		<link>http://sleepycode.com/2011/12/new-date-in-javascript/</link>
		<comments>http://sleepycode.com/2011/12/new-date-in-javascript/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 00:43:40 +0000</pubDate>
		<dc:creator>SleePy</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://sleepycode.com/?p=1639</guid>
		<description><![CDATA[It appears that the date object in javascript can have some variances. I had a bug in my code which was only affecting FireFox users on Windows machines. After some debugging time, I figured out that the date object was returning a differently formated value. These are some examples: FireFox on Windows 7: Wed Dec [...]]]></description>
			<content:encoded><![CDATA[<p>It appears that the date object in javascript can have some variances.  I had a bug in my code which was only affecting FireFox users on Windows machines.  After some debugging time, I figured out that the date object was returning a differently formated value.</p>
<p>These are some examples:<br />
FireFox on Windows 7: Wed Dec 07 2011 16:26:38 GMT-0800 (Pacific Standard Time)<br />
IE 8 on Windows 7: Wed Dec 7 16:29:21 PST 2011<br />
Chrome on Windows 7: Wed Dec 07 2011 16:45:45 GMT -0800 (Pacific Standard Time)<br />
FireFox on OS X Lion: Wed Dec 07 2011 16:37:12 GMT-0800 (PST)<br />
Opera on OS X Lion: Wed Dec 07 2011 16:37:21 GMT-0800<br />
Safari on OS X Lion: Wed Dec 07 2011 16:44:54 GMT-0800 (PST)</p>
<p>It appears that the format of this is left up to the browser to decide.  It would be nice if they all followed a specific format.  Well it was because of the (Pacific Standard Time) not being recognized by php&#8217;s strtotime, that my code failed to work.  Some helpful members on IRC brought it to my knowledge that it is up to the browser really.</p>
<p>I find it interesting that out of all the tests, it appears IE just takes a completely method.  While the other browsers are at least semi-similar other than the time zone string at the end.  OS X at least appears to be consistent and it appears Opera may just be stripping the string from the end.</p>
<p>At least there is a simple solution.  Just use some regular expressions to strip off (Pacific Standard Time) and any other variation.</p>
<pre class="wp-code-highlight prettyprint linenums:1">
	$date = preg_replace('~\(([^(]+)\)~', '', $_POST['date']);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sleepycode.com/2011/12/new-date-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

