<?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>JJ Is Me &#187; Code</title>
	<atom:link href="http://jjis.me/a/category/blog/code/feed" rel="self" type="application/rss+xml" />
	<link>http://jjis.me</link>
	<description>Me And My Code</description>
	<lastBuildDate>Mon, 30 Apr 2012 17:58:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Enter/Return Press Event Listener</title>
		<link>http://jjis.me/a/957</link>
		<comments>http://jjis.me/a/957#comments</comments>
		<pubDate>Thu, 09 Feb 2012 19:28:39 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[jQuery & Javascript]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=957</guid>
		<description><![CDATA[Disclaimer: I&#8217;m feeling lazy and this one is an easy one Wanna add an event listener to your form elements that fires a click() event for another element, but don&#8217;t want to write the code over and over again? When would this come in handy? When you are using ajax to process forms instead of [...]]]></description>
			<content:encoded><![CDATA[<h2>Disclaimer: I&#8217;m feeling lazy and this one is an easy one</h2>
<p><em>Wanna add an event listener to your form elements that fires a click() event for another element, but don&#8217;t want to write the code over and over again?</em></p>
<p><span id="more-957"></span></p>
<pre class="brush: jscript; title: ; notranslate">
var enter_key_press = function( obj, btn ) {
    var obj = obj;
    var btn = btn;

    obj.unbind('keyup');
    obj.bind('keyup',function(event) {
        if(event.keyCode == 13){
            btn.click();
        }
    });
}

// to call it
enter_key_press( jQuery('#element_needing_event_listener'), jQuery('#element_with_desired_click_event') );
</pre>
<p>When would this come in handy? When you are using ajax to process forms instead of the typical submit button. You want to capture the Enter/Return key press if the user fills out a form. This prevents them from having to click on the submit button or tab until the submit button has focus.</p>
<p>
<input id="random_field" type="text" name="random_field" value="" />
<input id="has_click_event" onclick="alert('hey, it worked');" type="button" name="has_click_event" value="I have the click event" /></p>
<p>Place the cursor in the input field above and press Enter/Return on the keyboard. The anchor&#8217;s click event will be fired and you&#8217;ll see an alert message popup.</p>
<p><script type="text/javascript">//<![CDATA[
 var enter_key_press = function( obj, btn ) { var obj = obj; var btn = btn; obj.unbind('keyup'); obj.bind('keyup',function(event) { if(event.keyCode == 13){ btn.click(); } }); }
enter_key_press( jQuery('#random_field'), jQuery('#has_click_event') );
// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/957/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3 Gradients, Border Radius and Internet Explorer 9</title>
		<link>http://jjis.me/a/912</link>
		<comments>http://jjis.me/a/912#comments</comments>
		<pubDate>Sun, 29 Jan 2012 19:35:07 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[HTML5/CSS3]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[IE9]]></category>
		<category><![CDATA[internet explorer]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=912</guid>
		<description><![CDATA[Internet Explorer 9 breaks border-radius declarations when used alongside filters for CSS background gradients. By utilizing SVG CSS markup, we can easily style elements with both declarations and still have it cross-browser compatible.]]></description>
			<content:encoded><![CDATA[<p>Currently I am rebuilding <a href="http://beta.tnyb.it">beta.tnyb.it</a>. Most of the rebuild is focused on bringing in a new design as well as some much needed performance increases (both back-end and front-end). The redesign utilizes a lot of CSS3 and HTML5 in order to make a smooth transition from a desktop environment to a tablet environment when using the account dashboard. This type of design has lead me to discover a major flaw with IE9&#8242;s ability to render an element that has both a gradient and a border-radius declaration. IE9 will render the gradient background, but then ignore the border-radius declaration in the CSS.</p>
<p>
<pre class="brush: css; title: ; wrap-lines: false; notranslate">
#my-element {
	background: #82c9ef; /* Old browsers */
	/* background gradient for cross-browser compatibility */
	background:  -moz-linear-gradient(top, #82c9ef 0%, #59ACD9 100%); /* FF3.6+ */
	background:  -webkit-gradient(linear, left top, left bottom, color-stop(0%, #82c9ef), color-stop(100%, #59ACD9)); /* Chrome,Safari4+ */
	background: -webkit-linear-gradient(top, #82c9ef 0%, #59ACD9 100%); /* Chrome10+,Safari5.1+ */
	background-image:  -ms-linear-gradient(top, #82c9ef 0%, #59ACD9 100%); /* IE10+ */
	background: -o-linear-gradient(top, #82c9ef 0%, #59ACD9 100%); /* Opera11.10+ */
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#82c9ef', endColorstr='#59ACD9', GradientType=0 ); /* IE6-9 */
	background: linear-gradient(top, #82c9ef 0%,#59ACD9 100%); /* W3C */
	/* border radius for cross-compatibility */
	border-radius: 6px;
	-moz-border-radius: 6px;
	-webkit-border-radius: 6px;
}
</pre>
</p>
<p>&nbsp;</p>
<h5>Example (pure CSS3 and IE gradient filter)</h5>
<div id="my-element">missing border radius because of the &#8216;filter&#8217; declaration</div>
<p>&nbsp;</p>
<hr size=1 />
<p>&nbsp;</p>
<h2>So how do you fix it? SVG of course!</h2>
<p>Interestingly enough, Microsoft has a <a href="http://ie.microsoft.com/testdrive/graphics/svggradientbackgroundmaker/default.html">website specifically designed</a> for this problem. Using the their <a href="http://ie.microsoft.com/testdrive/graphics/svggradientbackgroundmaker/default.html">tool</a>, you can specify your gradients and it will automatically generate the SVG source and CSS markup needed. In IE9, you can clear the filter, assuming you need a border-radius, and use the SVG CSS markup the site generates for you. This creates the exact same gradient you specify with pure CSS3 markup, but allows for a border-radius in IE9.</p>
<p>The beauty of this is that it is compatible with all modern browsers. The background gradient is fluid and there&#8217;s not a visible difference between the SVG markup and the CSS3 markup. You could, theoretically, use this as a workable solution for all desktop browsers. The only flaw I have found is noted below, under &#8216;Issues&#8217;.</p>
<p>
<pre class="brush: css; title: ; wrap-lines: false; notranslate">
/* you can remove all CSS code not needed since we're targeting IE */
#my-element {
	background: transparent none; /* reset the background, just in case */
	filter: ''; /* clear the filter since it's the reason for the border-radius missing */
	background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9Imc5ODEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+CjxzdG9wIHN0b3AtY29sb3I9IiM4MkM5RUYiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiM1OUFDRDkiIG9mZnNldD0iMSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c5ODEpIiAvPgo8L3N2Zz4=');
}
</pre>
</p>
<h5>Example Fixed in IE9 (Removed cross-browser CSS3 and IE gradient filter)</h5>
<div id="my-element" class="for-ie">filter declaration removed and SVG background used instead</div>
<p>&nbsp;</p>
<hr size=1 />
<p>&nbsp;</p>
<h2>Are there any issues with this method?</h2>
<p>The only issue I have found so far is that the SVG markup kills performance in Chrome. I&#8217;m not sure if this because of the UI I have built specifically for <a href="http://tnyb.it">tnyb.it&#8217;s</a> new design or if it&#8217;s just a Chrome bug, but it brings Chrome to a hault. Until I can test more thoroughly, I&#8217;m only using the SVG markup in IE9 and sticking with CSS3 markup for all other browsers. I&#8217;m trying to move away from images as much as possible and only use them for logos/icons/etc. If it&#8217;s a background, there&#8217;s no reason you can&#8217;t use CSS these days.</p>
<p>&nbsp;</p>
<hr size=1 />
<p>&nbsp;</p>
<h5>For those without IE9, here&#8217;s a before and after</h5>
<p><a href="http://jjis.me/wp-content/uploads/2012/01/border-radius-SVG-IE9-fix2.png"><img src="http://jjis.me/wp-content/uploads/2012/01/border-radius-SVG-IE9-fix2.png" alt="" title="border-radius-SVG-IE9-fix" width="556" height="259" class="aligncenter size-full wp-image-936" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/912/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery Multi-Accordion</title>
		<link>http://jjis.me/a/719</link>
		<comments>http://jjis.me/a/719#comments</comments>
		<pubDate>Sat, 27 Aug 2011 05:15:00 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[jQuery & Javascript]]></category>
		<category><![CDATA[accordion]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=719</guid>
		<description><![CDATA[I&#8217;ve developed my previous accordion a little further now. I&#8217;ve turned into a full plugin, plus it allows for multiple accordions on the same page. The way this differs, however, is that it allows you to create one accordion that closes open elements in another accordion and vice-versa. You may ask how this is different [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve developed my previous accordion a little further now. I&#8217;ve turned into a full plugin, plus it allows for multiple accordions on the same page. The way this differs, however, is that it allows you to create one accordion that closes open elements in another accordion and vice-versa. You may ask how this is different than a single accordion with tedious amounts of HTML and CSS. Well, the answer is simple: this is less work. By using jQuery&#8217;s traversing, I allow you to have more freedom in your HTML and CSS design, as well as fewer restraints on the hierarchical relationship between each accordion.</p>
<p>There is no CSS required for this plugin to work. The only CSS I recommend is setting the collapsible elements to &#8216;display: none&#8217;. This will keep the browser from rendering them initially causing that jittery appearance when the page first loads for the user.</p>
<p><span id="more-719"></span><br />
You can view the code below, with an example following:</p>
<h2>HTML:</h2>
<pre class="brush: xml; title: ; wrap-lines: false; notranslate">
&lt;div id=&quot;content-container&quot;&gt;
	&lt;!-- subsection of content container accordion 1 and 2 --&gt;
	&lt;div class=&quot;sub-content&quot;&gt;
		&lt;!-- Clickable headers (the actual anchor tags) that trigger the accordion --&gt;
		&lt;div class=&quot;accordion-headers&quot;&gt;
			&lt;a href=&quot;#&quot; class=&quot;clickable-header-accordion-1&quot;&gt;Click Me&lt;/a&gt;
			&lt;a href=&quot;#&quot; class=&quot;clickable-header-accordion-2&quot;&gt;Click Me&lt;/a&gt;
		&lt;/div&gt;
		&lt;!-- Accordion 1 header shows/hides this group --&gt;
		&lt;ul class=&quot;collapsible accordion1-collapsibles&quot;&gt;
			&lt;li&gt;First Accordion :: Item 1&lt;/li&gt;
			&lt;li&gt;First Accordion :: Item 2&lt;/li&gt;
			&lt;li&gt;First Accordion :: Item 3&lt;/li&gt;
			&lt;li&gt;First Accordion :: Item 4&lt;/li&gt;
		&lt;/ul&gt;
		&lt;!-- Accordion 2 header shows/hides this group --&gt;
		&lt;ul class=&quot;collapsible accordion2-collapsibles&quot;&gt;
			&lt;li&gt;Second Accordion :: Item 1&lt;/li&gt;
			&lt;li&gt;Second Accordion :: Item 2&lt;/li&gt;
			&lt;li&gt;Second Accordion :: Item 3&lt;/li&gt;
			&lt;li&gt;Second Accordion :: Item 4&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/div&gt;
	&lt;!-- // --&gt;

	&lt;!-- next subsection of content container accordion 1 and 2 --&gt;
	&lt;div class=&quot;sub-content&quot;&gt;
		&lt;!-- Clickable headers (the actual anchor tags) that trigger the accordion --&gt;
		&lt;div class=&quot;accordion-headers&quot;&gt;
			&lt;a href=&quot;#&quot; class=&quot;clickable-header-accordion-1&quot;&gt;Click Me&lt;/a&gt;
			&lt;a href=&quot;#&quot; class=&quot;clickable-header-accordion-2&quot;&gt;Click Me&lt;/a&gt;
		&lt;/div&gt;
		&lt;!-- Accordion 1 header shows/hides this group --&gt;
		&lt;ul class=&quot;collapsible accordion1-collapsibles&quot;&gt;
			&lt;li&gt;First Accordion :: Item 1&lt;/li&gt;
			&lt;li&gt;First Accordion :: Item 2&lt;/li&gt;
			&lt;li&gt;First Accordion :: Item 3&lt;/li&gt;
			&lt;li&gt;First Accordion :: Item 4&lt;/li&gt;
		&lt;/ul&gt;
		&lt;!-- Accordion 2 header shows/hides this group --&gt;
		&lt;ul class=&quot;collapsible accordion2-collapsibles&quot;&gt;
			&lt;li&gt;Second Accordion :: Item 1&lt;/li&gt;
			&lt;li&gt;Second Accordion :: Item 2&lt;/li&gt;
			&lt;li&gt;Second Accordion :: Item 3&lt;/li&gt;
			&lt;li&gt;Second Accordion :: Item 4&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/div&gt;
	&lt;!-- // --&gt;
&lt;/div&gt;
</pre>
<p>&nbsp;</p>
<p><strong>Again, please note: </strong>The CSS that is recommended is setting the collapsible elements to &#8216;disaply: none;&#8217;. Aside from that, there is no additional CSS required other than what is needed for your design.</p>
<p>&nbsp;</p>
<h2>jQuery and Javascript:</h2>
<pre class="brush: jscript; title: ; wrap-lines: false; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.multi-accordion.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
	var accordions = [
		{
			'parent'      : '.sub-content',                  // parent element containing the clickable header and collapsible
			'header'      : '.clickable-header-accordion-1', // clickable header
			'collapsible' : '.accordion1-collapsibles'        // collapsible element
		},
		{
			'parent'      : '.sub-content',                      // parent element containing the clickable header and collapsible
			'header'      : '.clickable-header-accordion-2',     // clickable header
			'collapsible' : '.accordion2-collapsibles',          // collapsible element
			'afterclose'  : function() { alert('after close'); },// callback that is fired onced the accordion is closed
			'afteropen'   : function() { alert('after open'); }  // callback that is fired after the accordion is opened
		}
	];
	$().accordion(accordions);
});
&lt;/script&gt;
</pre>
<p>&nbsp;</p>
<h2>Working Example:</h2>
<p>You can view a working example at <a href="http://jjis.me/jquery.multi-accordion.html">http://jjis.me/jquery.multi-accordion.html</a></p>
<p><a href="http://jjis.me/jquery.multi-accordion.js">Download the jQuery Multi-Accordion plugin</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/719/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WretchedBlues NOOKcolor Theme</title>
		<link>http://jjis.me/a/486</link>
		<comments>http://jjis.me/a/486#comments</comments>
		<pubDate>Fri, 18 Mar 2011 20:27:59 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[NOOKcolor]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[nook]]></category>
		<category><![CDATA[nookcolor]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=486</guid>
		<description><![CDATA[Here it is. It&#8217;s the updated, and brand spankin&#8217; new theme for the NOOKcolors running Froyo. XDA Forum Thread Change Log on XDA Downloads 0.1.4.10 WretchedBlues Sweetened Theme [bottom status bar [all densities]] (Status bar mod credited to brianf21 over at XDA Developers) 0.1.3.27 WretchedBlues Sweetened Theme [bottom status bar [all densities]] (Status bar mod [...]]]></description>
			<content:encoded><![CDATA[<p>Here it is. It&#8217;s the updated, and brand spankin&#8217; new theme for the NOOKcolors running Froyo.</p>
<p><span id="more-486"></span></p>
<p><a href="http://forum.xda-developers.com/showthread.php?t=944278">XDA Forum Thread</a><br />
<a href="http://forum.xda-developers.com/showpost.php?p=11176587&amp;postcount=2">Change Log on XDA</a></p>
<div class="hr"></div>
<h2>Downloads</h2>
<h2>0.1.4.10</h2>
<ul>
<li><a href="http://jjis.me/wretched/WretchedBlues-Sweetened-0.1.4.10.zip">WretchedBlues Sweetened Theme [bottom status bar [all densities]]</a><br />
<em>(Status bar mod credited to <a href="http://forum.xda-developers.com/showthread.php?t=999214">brianf21 over at XDA Developers</a>)</em></li>
</ul>
<h2>0.1.3.27</h2>
<ul>
<li><a href="http://jjis.me/wretched/WretchedBlues-Sweetened-0.1.3.27.1.zip">WretchedBlues Sweetened Theme [bottom status bar [all densities]]</a><br />
<em>(Status bar mod credited to <a href="http://forum.xda-developers.com/showthread.php?t=999214">brianf21 over at XDA Developers</a>)</em></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-Sweetened_0.1.3.27-Revert.zip">Revert from Sweetened to unModded WretchedBlues</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1.3.zip">WretchedBlues unModded Theme [all densities]</a></li>
</ul>
<h2>0.1.2</h2>
<ul>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1.2.zip">WretchedBlues Theme [no additional mods [all densities]]</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-Sweetened-0.1.2.zip">WretchedBlues Sweetened Theme [bottom status bar [all densities]]</a><br />
Status bar mod credited to <a href="http://forum.xda-developers.com/showthread.php?t=999214">brianf21 over at XDA Developers</a></li>
</ul>
<h2>0.1.1</h2>
<ul>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1.1.zip">WretchedBlues Theme [no additional mods [all densities]]</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-Sweetened-0.1.1.zip">WretchedBlues Sweetened Theme [bottom status bar [all densities]]</a><br />
Status bar mod credited to <a href="http://forum.xda-developers.com/showthread.php?t=999214">brianf21 over at XDA Developers</a></li>
</ul>
<h2>0.1.1</h2>
<ul>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1.zip">WretchedBlues Theme [no additional mods]</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1.zip">WretchedBlues Theme 0.1.1 [no additional mods [all densities]]</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1-Softkeys.zip">WretchedBlues Theme [Softkeys Mod]</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1-Mapped-Keys.zip">WretchedBlues Theme [Mapped Vol +- Keys]</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1-Softkeys-Revert.zip">WretchedBlues Theme [Remove Softkeys Mod from theme]</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1-Mapped-Keys-Revert.zip">WretchedBlues Theme [Remove Key Mapping from theme]</a></li>
</ul>
<div class="hr"></div>
<h2>Modders</h2>
<p>Here are links to my most recent framework-res files</p>
<ul>
<li><a href="http://jjis.me/wretched/WretchedBlues-0.1.3-framework.apk.zip">WretchedBlues unModded</a></li>
<li><a href="http://jjis.me/wretched/WretchedBlues-Sweetened-0.1.3.27-framework-res.apk.zip">WretchedBlues Sweetened</a></li>
</ul>
<div class="hr"></div>
<h2>Screenies</h2>
<div class="thumb-group">
<h3>Without Mods</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211942.png"><img class="alignnone size-medium wp-image-470" title="snap20110317_211942" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211942-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h3>With Softkeys</h3>
<p><span><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110328_171403.png"><img class="alignnone size-medium wp-image-514" title="snap20110328_171403" src="http://jjis.me/wp-content/uploads/2011/03/snap20110328_171403-175x300.png" alt="" width="175" height="300" /></a></span><span><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110328_171409.png"><img class="alignnone size-medium wp-image-516" title="snap20110328_171409" src="http://jjis.me/wp-content/uploads/2011/03/snap20110328_171409-175x300.png" alt="" width="175" height="300" /></a></span></p>
</div>
<div class="thumb-group">
<h3>Popup/full/dark</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163603.png"><img class="alignnone size-medium wp-image-455" title="snap20110314_163603" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163603-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h3>Notification Pulldown</h3>
<p><span><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213603.png"><img class="alignnone size-medium wp-image-468" title="snap20110317_213603" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213603-175x300.png" alt="" width="175" height="300" /></a></span><span><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213606.png"><img class="alignnone size-medium wp-image-469" title="snap20110317_213606" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213606-175x300.png" alt="" width="175" height="300" /></a></span></p>
</div>
<div class="thumb-group">
<h3>Popup Full Bright</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_164802.png"><img class="alignnone size-medium wp-image-456" title="snap20110314_164802" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_164802-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h3>Popup Full Bright/Dark</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163415.png"><img class="alignnone size-medium wp-image-449" title="snap20110314_163415" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163415-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h3>Basic Form Elements</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163546.png"><img class="alignnone size-medium wp-image-454" title="snap20110314_163546" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163546-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h3>Settings w/ Line Item Pressed</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211958.png"><img class="alignnone size-medium wp-image-471" title="snap20110317_211958" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211958-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<h2>MDPI Version (deprecated &#8211; no longer supported)</h2>
<div class="thumb-group">
<h3>Home Screen</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/Custom___NOOKcolor-GUI.png"><img class="alignnone size-medium wp-image-493" title="Custom___NOOKcolor-GUI" src="http://jjis.me/wp-content/uploads/2011/03/Custom___NOOKcolor-GUI-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h3>With Softkeys</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/Custom___NOOKcolor-GUI_w_softkeys.png"><img class="alignnone size-medium wp-image-494" title="Custom___NOOKcolor-GUI_w_softkeys" src="http://jjis.me/wp-content/uploads/2011/03/Custom___NOOKcolor-GUI_w_softkeys-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h3>Settings/List Press/Grid Examples</h3>
<p><a rel="facebox" href="http://jjis.me/wp-content/uploads/2011/03/Custom___Settings-NOOKcolor.png"><img class="alignnone size-medium wp-image-495" title="Custom___Settings-NOOKcolor" src="http://jjis.me/wp-content/uploads/2011/03/Custom___Settings-NOOKcolor-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/486/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NOOKcolor Clean HDPI Theme (screenshots)</title>
		<link>http://jjis.me/a/447</link>
		<comments>http://jjis.me/a/447#comments</comments>
		<pubDate>Mon, 14 Mar 2011 16:50:22 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[NOOKcolor]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[nook]]></category>
		<category><![CDATA[nookcolor]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=447</guid>
		<description><![CDATA[Here are some screenshots of the new NOOKcolor HDPI theme (I need a new name for it) I&#8217;ve been working on. Basic Form Elements Settings w/ Line Item Pressed Popup Full Bright Popup Full Bright/Dark Popup/full/dark Notification Pulldown New Wifi and Battery Indicators With Softkeys]]></description>
			<content:encoded><![CDATA[<p>Here are some screenshots of the new NOOKcolor HDPI theme (I need a new name for it) I&#8217;ve been working on.</p>
<div class="thumb-group">
<h2>Basic Form Elements</h2>
<p><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163546.png" rel="facebox"><img class="alignnone size-medium wp-image-454" title="snap20110314_163546" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163546-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h2>Settings w/ Line Item Pressed</h2>
<p><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211958.png" rel="facebox"><img class="alignnone size-medium wp-image-471" title="snap20110317_211958" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211958-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h2>Popup Full Bright</h2>
<p><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_164802.png" rel="facebox"><img class="alignnone size-medium wp-image-456" title="snap20110314_164802" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_164802-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h2>Popup Full Bright/Dark</h2>
<p><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163415.png" rel="facebox"><img class="alignnone size-medium wp-image-449" title="snap20110314_163415" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163415-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h2><strong>Popup/full/dark</strong></h2>
<p><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163603.png" rel="facebox"><img class="alignnone size-medium wp-image-455" title="snap20110314_163603" src="http://jjis.me/wp-content/uploads/2011/03/snap20110314_163603-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h2>Notification Pulldown</h2>
<p><span><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213603.png" rel="facebox"><img class="alignnone size-medium wp-image-468" title="snap20110317_213603" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213603-175x300.png" alt="" width="175" height="300" /></a></span><span><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213606.png" rel="facebox"><img class="alignnone size-medium wp-image-469" title="snap20110317_213606" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_213606-175x300.png" alt="" width="175" height="300" /></a></span></p>
</div>
<div class="thumb-group">
<h2>New Wifi and Battery Indicators</h2>
<p><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211942.png" rel="facebox"><img class="alignnone size-medium wp-image-470" title="snap20110317_211942" src="http://jjis.me/wp-content/uploads/2011/03/snap20110317_211942-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
<div class="thumb-group">
<h2>With Softkeys</h2>
<p><a href="http://jjis.me/wp-content/uploads/2011/03/snap20110318_190210.png" rel="facebox"><img class="alignnone size-medium wp-image-474" title="snap20110318_190210" src="http://jjis.me/wp-content/uploads/2011/03/snap20110318_190210-175x300.png" alt="" width="175" height="300" /></a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/447/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nook Froyo Theme Mock-up</title>
		<link>http://jjis.me/a/443</link>
		<comments>http://jjis.me/a/443#comments</comments>
		<pubDate>Tue, 01 Feb 2011 20:00:31 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[NOOKcolor]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[nook]]></category>
		<category><![CDATA[nookcolor]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=443</guid>
		<description><![CDATA[This theme has been updated. You are being redirected to the new screenshots. Please the updated theme page for the new WretchedBlues NOOKcolor theme You will be redirect automatically in just a second.]]></description>
			<content:encoded><![CDATA[<p>This theme has been updated. You are being redirected to the new screenshots.<br />
Please the updated theme page for the new <a href="http://jjis.me/a/447/">WretchedBlues NOOKcolor theme</a></p>
<p><span id="more-443"></span><br />
You will be redirect automatically in just a second.<br />
<meta http-equiv="refresh" content="4;url=http://jjis.me/a/447" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/443/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I forgot about this hidden gem: Internet Explorer and Fade-In pitfalls</title>
		<link>http://jjis.me/a/407</link>
		<comments>http://jjis.me/a/407#comments</comments>
		<pubDate>Thu, 16 Sep 2010 15:48:23 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[jQuery & Javascript]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=407</guid>
		<description><![CDATA[jQuery&#8217;s fadeIn() method is a wonderful thing. It&#8217;s a great way to bring things in and out of the UI without a sudden jolt, visually. The downside to this, however, is Internet Explorer and the way it handles filters for transparency. When an element is faded in, and it contains fonts, IE does not remove [...]]]></description>
			<content:encoded><![CDATA[<p>jQuery&#8217;s fadeIn() method is a wonderful thing. It&#8217;s a great way to bring things in and out of the UI without a sudden jolt, visually. The downside to this, however, is Internet Explorer and the way it handles filters for transparency. When an element is faded in, and it contains fonts, IE does not remove the filter by default. This prevents the fonts from smoothing like they should.</p>
<h2>Internet Explorer post standard jQuery fadeIn() method</h2>
<p><a href="http://jjis.me/wp-content/uploads/2010/09/ie-fadeIn-filter-effects.jpg"><img class="size-full wp-image-408 alignnone" title="Internet Explorer with jQuery fadeIn() filter effects" src="http://jjis.me/wp-content/uploads/2010/09/ie-fadeIn-filter-effects.jpg" alt="" width="600" height="91" /></a></p>
<p><span id="more-407"></span></p>
<p>In searching for a solution, I stumbled across a rather simple removeFilter() method someone created. This worked nice, but it meant you had to do chaining or a callback in order for the fadeIn() to work and then have the filter removed so the fonts would smooth. I&#8217;m lazy and I like to do everything in a single method if I can. So, let combine the fadeIn/fadeOut methods in to a single method and add the filter removal as well.</p>
<pre class="brush: jscript; title: ; wrap-lines: false; notranslate">
(function($) {
	 $.fn.removeFilter = function() {
		if ($.browser.msie) {
			x = this.get(0)
			x.style.removeAttribute(&quot;filter&quot;);
		 }
	 }
})(jQuery);

(function($){
	 $.fn.fadeToggle = function(options) {
		  options  = typeof(options) != 'undefined'?options:'';
		  speed    = typeof(options.speed)!='undefined'?options.speed:'';
		  easing   = typeof(options.easing)!='undefined'?options.easing:'';
		  callback = typeof(options.callback)!='undefined'?options.callback:'';
		  callback = function(callback) {
			   $(this).removeFilter();
			   callback;
		  }

		  this.animate(
			   {opacity: 'toggle'},
			   speed,
			   easing,
			   callback
		  );
	 }
})(jQuery);
</pre>
<p>&nbsp;</p>
<h2>Use:</h2>
<pre class="brush: jscript; title: ; notranslate">
// normal speed
$('#objectId').fadeToggle();

// set fade in/out speed
$('#objectId').fadeToggle({ speed: 'fast' });
</pre>
<p>&nbsp;</p>
<h2>Internet Explorer post fadeToggle() method</h2>
<p><a href="http://jjis.me/wp-content/uploads/2010/09/ie-fadeToggle.jpg"><img src="http://jjis.me/wp-content/uploads/2010/09/ie-fadeToggle.jpg" alt="" title="Internet Explorer with fadeToggle method" width="600" height="91" class="alignnone size-full wp-image-411" /></a></p>
<p>&nbsp;</p>
<h2>Using removeFilter() method as a standalone method</h2>
<p>There may instances where you just need to remove the filter. In that case, the following works:</p>
<pre class="brush: jscript; title: ; wrap-lines: false; notranslate">

// as callback within fadeIn() method
$('#objectId').fadeIn('fast', function() {
        $(this).removeFilter();
});

// simply remove the filer on a specific object or objects
$('#objectId').removeFilter();
</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/407/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inline Images With Data URLs</title>
		<link>http://jjis.me/a/362</link>
		<comments>http://jjis.me/a/362#comments</comments>
		<pubDate>Wed, 11 Aug 2010 22:16:49 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=362</guid>
		<description><![CDATA[This particular trick comes in very handy for the mobile platforms. Instead of linking to your CSS and your images, you can use this method to embed the images inline within the CSS. This keeps the browser from having to make multiple calls, thus speeding up the load time of your application. You can also [...]]]></description>
			<content:encoded><![CDATA[<p>This particular trick comes in very handy for the mobile platforms. Instead of linking to your CSS and your images, you can use this method to embed the images inline within the CSS. This keeps the browser from having to make multiple calls, thus speeding up the load time of your application. You can also use this method within an IMG tag as well.</p>
<pre class="brush: php; title: ; wrap-lines: false; notranslate">
	/* ***********************************************************
	* START :::
	*	64bit encodes images for CSS embedding
        *      Alternatively, if you are not using PNGs, you can specify the Mime Type
        *      PNG is the default mime
	*********************************************************** */
	function data_url($file, $mime='') {  

		$mime = empty($mime) ? 'image/png' : $mime;

		$contents = file_get_contents($file);
		$base64   = base64_encode($contents);
		return ('data:' . $mime . ';base64,' . $base64);
	}
	/* ***********************************************************
	* END :::
	*********************************************************** */
</pre>
<h2>In the CSS style sheet</h2>
<p>You would need to either tell your server to process files with the .css extension or save your CSS files with the .php extension. It&#8217;s your call.</p>
<pre class="brush: css; title: ; wrap-lines: true; notranslate">

 body { background-image: url('&lt;?php echo data_url('http://domain.com/images/file.png'); ?&gt;') no-repeat; }

/* output code would be something like */
body { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAIAAACTCYeWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAI5JREFUeNrs2sENACEIRUF1LY0mqRbb2OQPHUwexIu7qlbq3JmJxZ8VPMorr7zy8NZeeXhrrzw8vJtXHh4eHh7eU6c8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8fMj4kAQPDw8P76lTHh7ezSsPb+2Vh7f2yiv/7/mS8dHlo2d3dyz+CTAAYEXI+4xG4igAAAAASUVORK5CYII=') no-repeat; }
</pre>
<h2>Within HTML img tags</h2>
<pre class="brush: xml; title: ; wrap-lines: true; notranslate">

&lt;img src=&quot;&lt;?php echo data_url('http://domain.com/images/file.png'); ?&gt;&quot; border=0 /&gt;

&lt;!-- output code would be something like --&gt; &lt;img src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAIAAACTCYeWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAI5JREFUeNrs2sENACEIRUF1LY0mqRbb2OQPHUwexIu7qlbq3JmJxZ8VPMorr7zy8NZeeXhrrzw8vJtXHh4eHh7eU6c8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8fMj4kAQPDw8P76lTHh7ezSsPb+2Vh7f2yiv/7/mS8dHlo2d3dyz+CTAAYEXI+4xG4igAAAAASUVORK5CYII=&quot; border=0 /&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/362/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make print_r() Pretty</title>
		<link>http://jjis.me/a/350</link>
		<comments>http://jjis.me/a/350#comments</comments>
		<pubDate>Wed, 11 Aug 2010 21:01:10 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=350</guid>
		<description><![CDATA[This is literally print_r() dressed up. I normally run this within my general $app object so to call it, I would use $app->debug($var). As with print_r(), it loops indefinitely using lists to format a readable layout in HTML. This helps the developer avoid having to view source and scroll&#8230;and scroll&#8230;and scroll to find the output [...]]]></description>
			<content:encoded><![CDATA[<p>This is literally print_r() dressed up.  I normally run this within my general $app object so to call it, I would use $app->debug($var). As with print_r(), it loops indefinitely using lists to format a readable layout in HTML. This helps the developer avoid having to view source and scroll&#8230;and scroll&#8230;and scroll to find the output of an array or object.</p>
<p><span id="more-350"></span></p>
<pre class="brush: php; title: ; notranslate">
class System_Application {

	/* ***********************************************************
	* START :::
	*	Used for writing variables and arrays to screen
	*	for debugging. If array, it will place a line break
	*	after each value for easy on-screen viewing
	*
	*	$app-&gt;debug($var);
	*
	*	if var is empty, it will display &quot;Hello World&quot;
	*	$show defaults to true. setting this false will wrap the
	*	output in a div with a display:none so it won't show
	*	except if you view HTML source
	*********************************************************** */
	function debug($var=false,$show=true) {

		$display=(!$show)?' style=&quot;display: none;&quot;':'';

		echo '&lt;div class=&quot;light-font&quot;'.$display.'&gt;&amp;nbsp;';
		if ( is_array($var) || is_object($var) ):
			foreach ($var as $key=&gt;$val) :
				echo $key;
				if (is_array($val) || is_object($val)) :
					echo '&lt;ul style=&quot;margin:0;padding:0 0 0 15px;list-style:none;&quot;&gt;';
					foreach ($val as $key1=&gt;$val1) :
						echo '&lt;li&gt;'.$key . '['.$key1.']' . ' = ';
							if (is_array($val1) || is_object($val1)) :
								$this-&gt;debug_array($val1);
							else :
								echo $val1.'&lt;/li&gt;';
							endif;
					endforeach;
					echo '&lt;/ul&gt;';
				else :
					echo ' = ' . $val.'&lt;br /&gt;';
				endif;
			endforeach;
		else:
			echo $var;
		endif;

		if (empty($var)) :
			echo 'Hello World ';
		endif;

		echo '&lt;/div&gt;';
	}

		function debug_array($var) {
			echo '&lt;ul style=&quot;margin:0;padding:0 0 0 25px;list-style:none;&quot;&gt;';
			foreach ($var as $key1=&gt;$val1) :

				echo '&lt;li&gt;[' . $key1 . '] = ';

				if (is_array($val1) || is_object($val1)) :
					$this-&gt;debug_array($val1);
				else :
					echo $val1.'&lt;/li&gt;';
				endif;

			endforeach;
			echo '&lt;/ul&gt;';
		}

	/* ***********************************************************
	* END :::
	*********************************************************** */
}

$app = new System_Application;
</pre>
<h2>Use:</h2>
<pre class="brush: php; title: ; notranslate">

/* an example of an icon array I have for twitter app icons */
	var $icon = array(
		'toolbar' =&gt; array(
			'logout'    =&gt; 'hi-res/Logout.png',
		     'compose'   =&gt; 'hi-res/Compose.png',
		     'reload'    =&gt; 'hi-res/Reload.png',
		     'scrolltop' =&gt; 'hi-res/Scroll-Top-Alt.png'
		),
		'tweet'     =&gt; array(
			'profile'   =&gt; 'hi-res/Profile.png',
			'reply'     =&gt; 'hi-res/Reply.png',
			'dm'        =&gt; 'hi-res/DM.png',
			'links'     =&gt; 'hi-res/Links.png',
			'favorite'  =&gt; 'hi-res/Favorite-Alt.png'
		)
	);

$app-&gt;debug($icon);
</pre>
<h2>Results:</h2>
<pre class="brush: xml; title: ; notranslate">
&lt;p class=&quot;light-font&quot;&gt;
        toolbar&lt;ul style=&quot;margin:0;padding:0 0 0 15px;list-style:none;&quot;&gt;
                        &lt;li&gt;toolbar[logout] = hi-res/Logout.png&lt;/li&gt;
                        &lt;li&gt;toolbar[compose] = hi-res/Compose.png&lt;/li&gt;
                        &lt;li&gt;toolbar[reload] = hi-res/Reload.png&lt;/li&gt;
                        &lt;li&gt;toolbar[scrolltop] = hi-res/Scroll-Top-Alt.png&lt;/li&gt;
                &lt;/ul&gt;
        tweet&lt;ul style=&quot;margin:0;padding:0 0 0 15px;list-style:none;&quot;&gt;
                        &lt;li&gt;tweet[profile] = hi-res/Profile.png&lt;/li&gt;
                        &lt;li&gt;tweet[reply] = hi-res/Reply.png&lt;/li&gt;
                        &lt;li&gt;tweet[dm] = hi-res/DM.png&lt;/li&gt;
                        &lt;li&gt;tweet[links] = hi-res/Links.png&lt;/li&gt;
                        &lt;li&gt;tweet[favorite] = hi-res/Favorite-Alt.png&lt;/li&gt;
                &lt;/ul&gt;
&lt;/p&gt;
</pre>
<h2>Which translates to: </h2>
<div class="light-font">toolbar
<ul style="margin:0;padding:0 0 0 15px;list-style:none;">
<li>toolbar[logout] = hi-res/Logout.png</li>
<li>toolbar[compose] = hi-res/Compose.png</li>
<li>toolbar[reload] = hi-res/Reload.png</li>
<li>toolbar[scrolltop] = hi-res/Scroll-Top-Alt.png</li>
</ul>
<p>tweet
<ul style="margin:0;padding:0 0 0 15px;list-style:none;">
<li>tweet[profile] = hi-res/Profile.png</li>
<li>tweet[reply] = hi-res/Reply.png</li>
<li>tweet[dm] = hi-res/DM.png</li>
<li>tweet[links] = hi-res/Links.png</li>
<li>tweet[favorite] = hi-res/Favorite-Alt.png</li>
</ul>
</div>
<p>&nbsp;<br />
&nbsp;<br />
There ya go. That&#8217;s all there is too it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/350/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Error Handling</title>
		<link>http://jjis.me/a/327</link>
		<comments>http://jjis.me/a/327#comments</comments>
		<pubDate>Wed, 11 Aug 2010 04:44:17 +0000</pubDate>
		<dc:creator>jj_jiles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://jjis.me/?p=327</guid>
		<description><![CDATA[In the world of the Internet, as a developer, we need to protect ourselves from prying eyes. One of the easiest ways a hacker can crack your code is if you tell them what they did wrong. For that reason, it&#8217;s important to suppress errors from the public. But, this doesn&#8217;t mean we should eliminate [...]]]></description>
			<content:encoded><![CDATA[<p>In the world of the Internet, as a developer, we need to protect ourselves from prying eyes. One of the easiest ways a hacker can crack your code is if you tell them what they did wrong. For that reason, it&#8217;s important to suppress errors from the public. But, this doesn&#8217;t mean we should eliminate the knowledge when an error occurs and what triggered it.  For that reason, I have written a fairly simple class that will allow for error suppression, error debugging and error reporting.</p>
<p><span id="more-327"></span></p>
<p>When in debug mode, the error is displayed on screen in a fairly elegant manner. Barring CSS overrides and surrounding DOM elements, the error is output in a legible manner so that it can be easily read.</p>
<p>When errors are suppressed, the error is caught and handled elegantly and then emailed to the specified email address.</p>
<p><strong><em>The one drawback: </em></strong> if there is a parse error in the file that includes the Error.Handling.Class.php file, it will not call this class. It will use PHP&#8217;s internal error handler and print the error to screen. If anyone knows a way around this, let me know and I will implement it.</p>
<h2>Examples:</h2>
<ul>
<li class="none"><a href="http://jjis.me/error.static.parse.php" target="_new">Parse error in debug mode</a></li>
<li class="none"><a href="http://jjis.me/error.static.exception.php" target="_new">Exception errors in debug mode</a></li>
<li class="none"><a href="http://jjis.me/error.static.suppressed.php" target="_new">Both errors when suppressed</a></li>
</ul>
<h2>Code:</h2>
<pre class="brush: php; title: ; wrap-lines: false; notranslate">
&lt;?php
/*
	*	Script Name: Forms
	*	Author: JJ Jiles
	*	Website: http://jjis.me
	*	Version: 1
	*	Copyright (C) March 31 2010
	*
	*	Error Catching and Debugging
	*
*/

class Error_Debug {
	#
	# a couple of basic settings
	#
	# Display Errors?:
	#	True|False
	#	This is overridden should there be a $config-&gt;show_errors var
	#
	# Email To:
	#	email for the person who needs to receive the error
	#
	# Style Sheet:
	#	Set the link to the style sheet.
	#	Exclude from the server path ( http://domain.com )
	#
	# Suppressed Error Message
	#	This is the error message that will be displayed if error reporting is turned off
	#
	var $errors = array(
			'display'     =&gt; false,
			'email_to'    =&gt; 'email@domain.com',
			'email_from'  =&gt; 'email@domain.com',
			'style_sheet' =&gt; 'css/error-reports.css',
			'suppressed_error_message' =&gt; '&lt;div align=&quot;center&quot;&gt;&lt;b style=&quot;font-size: 150%;&quot;&gt;lnnl&lt;b style=&quot;font-size: 200%;&quot;&gt; (-_-) &lt;/b&gt;lnnl&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;aw snap! something broke!&lt;/div&gt;'
		);

	function Error_Debug() { return true; }

	/* ***********************************************************************
	* START :::
	*
	*	Initial error catching method
	*	This will determine if it's a parse error, or other
	*	types of errors.
	*
	*	PARSE:
	*		stops everything dead in its tracks. If display
	*		errors is allowed, then show the error message
	*		otherwise suppress the error and email it
	*
	*
	*	ALL OTHERS:
	*		Run the backtrace through the previous called
	*		functions and display the information for debugging
	*		If display errors is false, suppress the error
	*		and email the error
	*********************************************************************** */
	function catch_error($n='', $s='', $f='', $l='') {
		global $security, $config;	

		#
		# check to see if the $config object exists. if so, use it's setting
		$this-&gt;errors['display'] = (isset($config-&gt;show_errors) ) ? $config-&gt;show_errors : $this-&gt;errors['display'];

		#
		# if this is a parse error, we need to handle it differently
		# because it completely stops all PHP parsing, we catch it immediately
		# and display a simple output
		if( empty($n) &amp;&amp; false === is_null($aError = error_get_last()) ) :

			#
			# suppress the error and show something entertaining
			if ( !$this-&gt;errors['display'] ) :
				echo $this-&gt;errors['suppressed_error_message'];

			#
			# for debugging, display the information about the error
			else :
				$err = error_get_last();
				$this-&gt;echo_css();
				echo &quot;&lt;div id=\&quot;error-container\&quot;&gt;&quot;
					. &quot;&lt;div id=\&quot;error-wrapper\&quot;&gt;&quot;
					. &quot;&lt;table id=\&quot;primary-error\&quot;&gt;\n&quot;
					. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;Error Type: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot; . $err['type'] . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
					. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;Message: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot; . $err['message'] . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
					. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;File: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot; . $err['file'] . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
					. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;On line: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot;.$err['line'].&quot;&lt;/td&gt;&lt;/tr&gt;\n&lt;/table&gt;\n&quot;;

			endif;

		#
		# exception errors get sent to either backtracing or suppression
		else :

			#
			# backtrace the error and display the information for debugging
			if ( @$this-&gt;errors['display'] ) : $this-&gt;error_backtrace($n, $s, $f, $l);

			#
			# suppress the error and email it
			else : $this-&gt;error_thrown($n, $s, $f, $l); 

			endif;

			return true;

		endif;
		exit();
	}
	/* ***********************************************************************
	* END :::
	*********************************************************************** */

	/* ***********************************************************************
	* START :::
	*
	*	Backtraces through the errors and displays a nice
	*	It's pretty simple. Not a lot that needs explaining
	*
	*********************************************************************** */
	function error_backtrace($errno, $errstr, $error_file, $error_line) {
		global $css;

		$errorsThrown = debug_backtrace();

		#
		# we skip the first two errors
		# they are the initial calls from error catching
		# we can ignore them
		#
		if ( isset($errorsThrown[2]) ) :
			$errorThrown  = $errorsThrown[2];

			#
			# echo css
			$this-&gt;echo_css();

			#
			# this is the primary error that started it all
			echo &quot;&lt;div id=\&quot;error-container\&quot;&gt;&quot;
				. &quot;&lt;div id=\&quot;error-wrapper\&quot;&gt;&quot;
				. &quot;&lt;table id=\&quot;primary-error\&quot;&gt;\n&quot;
				. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;Error: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot; . $errstr . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
				. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;Line: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot; . $error_line . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
				. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;File: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot; . $error_file . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
				. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;Calling Function: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot; . $errorThrown['function'] . &quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
				. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;File Name: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot;.$errorThrown['file'].&quot;&lt;/td&gt;&lt;/tr&gt;\n&quot;
				. &quot;&lt;tr&gt;&lt;td class=\&quot;left\&quot;&gt;&lt;strong&gt;On line: &lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&quot;.$errorThrown['line'].&quot;&lt;/td&gt;&lt;/tr&gt;\n&lt;/table&gt;\n&quot;;

			#
			# for additional debugging, loop through all previous function calls
			# this assists in debugging if you call a method multiple times
			# now we can figure out which instance caused the error
			#
			echo &quot;&lt;p&gt;All previously executed functions: &lt;/p&gt;\n&quot;;

			echo &quot;&lt;table id=\&quot;previous-errors\&quot; cellpadding=5 cellspacing=0 border=0 style=\&quot;border: 1px solid #333;\&quot;&gt;&quot;
				. &quot;&lt;tr style=\&quot;background: #d3d3d3;\&quot;&gt;&quot;
				. &quot;&lt;th&gt;order&lt;/th&gt;&quot;
				. &quot;&lt;th&gt;function name&lt;/th&gt;&quot;
				. &quot;&lt;th&gt;file name&lt;/th&gt;&quot;
				. &quot;&lt;th&gt;line&lt;/th&gt;&quot;
				. &quot;&lt;/tr&gt;&quot;;

			$count = 0;
			array_reverse($errorsThrown);

			#
			# loop thu the backtrace and output
			foreach ($errorsThrown as $error) :
				$is_db = (bool) strchr($error['file'], 'Database.php');
				if ($count &gt; 1 &amp;&amp; !$is_db) :
					echo '&lt;tr&gt;'
					. '&lt;td&gt;' . ($count-1) . '&lt;/td&gt;'
					. '&lt;td&gt;' . $error['function'] . '()&lt;/td&gt;'
					. '&lt;td&gt;' . $error['file'] . '&lt;/td&gt;'
					. '&lt;td&gt;' . $error['line'] . '&lt;/td&gt;'
					. '&lt;/tr&gt;';
				endif;
				$count++;

			endforeach;

			#
			# close it all up
			echo '&lt;/table&gt;'
				. '&lt;p&gt;&amp;nbsp;&lt;/p&gt;'
				. '&lt;/div&gt;&lt;/div&gt;';
		exit();
		endif;
	}
	/* ***********************************************************************
	* END :::
	*********************************************************************** */

	/* ***********************************************************************
	* START :::
	*
	*	Backtraces through the errors and displays a nice
	*	It's pretty simple. Not a lot that needs explaining
	*
	*********************************************************************** */
	function error_thrown($errno, $errstr, $error_file, $error_line) {
		global $security;

		$errorThrown = debug_backtrace();
		$errorFunction = '';

		#
		# we skip the first two errors
		# they are the initial calls from error catching
		# we can ignore them
		#
		if (isset($errorThrown[2])) :
			$errorThrown = $errorThrown[2];
			$errorFunction = &quot;\n&quot;.'Calling Function: '.$errorThrown['function'];

			$referer = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';

			$server_r = '';
			$server_out = $_SERVER;
			foreach ($server_out as $key=&gt;$val) {
				$server_r .= $key.' ::: '.$val.&quot;\n\r&quot;;
			}

			$message = '';
			$message .= &quot;Error Thrown: [{$errno}] {$errstr}{$errorFunction}\n&quot;
					. &quot;File Name: {$error_file}\n&quot;
					. &quot;On line: {$error_line}\n&quot;
					. &quot;Server: &quot; . $_SERVER['SERVER_NAME'] . &quot;\n&quot;
					. &quot;URL: &quot; . $_SERVER['REQUEST_URI'] . &quot;\n&quot;
					. &quot;Referer: {$referer}&quot;
					. &quot;\n\n\n&quot;
					. &quot;Server Output: \n&quot;
					. $server_r
					. &quot;\n&quot;;

			if ( !error_log(
				$message, 1,
				$this-&gt;errors['email_to'],
				&quot;From: &quot; . $this-&gt;errors['email_from']
				)
			) :

				echo $this-&gt;errors['suppressed_error_message'];

			endif;
		endif;
	}
	/* ***********************************************************************
	* END :::
	*********************************************************************** */

	/* ***********************************************************************
	* START :::
	*
	*	echo the css style sheet so the error reporting is pretty
	*
	*********************************************************************** */
	function echo_css() {
		$css_url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this-&gt;errors['style_sheet'];

		echo '&lt;link rel=&quot;stylesheet&quot; id=&quot;mainstyle&quot; type=&quot;text/css&quot; href=&quot;' . $css_url . '&quot; /&gt;';
	}
	/* ***********************************************************************
	* END :::
	*********************************************************************** */

}

	# Upon All Errors, call the error handling function
	 	set_error_handler(array(new Error_Debug(),'catch_error'));

	# Register function to execute at the end of the script
		register_shutdown_function(array(new Error_Debug(),'catch_error'));

	# Hide error messages
		error_reporting(0);
?&gt;
</pre>
<h2>Some CSS styling for you: </h2>
<pre class="brush: php; title: ; wrap-lines: false; notranslate">
#error-container { width: 100%; color: #333!important; position: relative; background-color: #f3f3f3; border-bottom: 1px dotted #333; }
#error-wrapper { font: 110%/0.8em arial!important; letter-spacing: 0.02em; width: 850px!important; background-color: #f3f3f3!important; padding: 10px!important; }
#error-wrapper a { color: #cc6600; }
#primary-error td { color: #333!important; padding: 4px!important; border: 1px solid #f3f3f3!important; }
#primary-error td.left { width: 120px; text-align: right; padding: 8px 4px 8px 8px!important; margin: 0 8px 1px 0!important; background-color: #d3d3d3!important; }
#error-wrapper p { text-align: left; padding: 18px; clear: both!important; }
#previous-errors th { color: #333!important; padding: 6px; }
#previous-errors td { color: #333!important; padding: 4px; border-top: 1px solid #666; border-right: 1px solid #666; }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jjis.me/a/327/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

