<?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>Feet Have Been &#187; xangelo</title>
	<atom:link href="http://wheremy.feethavebeen.com/author/xangelo/feed/" rel="self" type="application/rss+xml" />
	<link>http://wheremy.feethavebeen.com</link>
	<description>Sometimes, you just go where your feet take you</description>
	<lastBuildDate>Tue, 17 Aug 2010 13:40:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Custom Select Element</title>
		<link>http://wheremy.feethavebeen.com/2010/08/custom-select-element/</link>
		<comments>http://wheremy.feethavebeen.com/2010/08/custom-select-element/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 22:04:59 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Concepts]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=475</guid>
		<description><![CDATA[Since the post on styling the input box I thought I&#8217;d post a another method to create custom drop-down lists. Again, most browsers won&#8217;t let you do very much in the way of styling. IE lets you mess with scrollbars and gecko and webkit let you adjust line-heights and padding, but really, you are STILL [...]]]></description>
			<content:encoded><![CDATA[<p>Since the post on styling the input box I thought I&#8217;d post a another method to create custom drop-down lists. Again, most browsers won&#8217;t let you do very much in the way of styling. IE lets you mess with scrollbars and gecko and webkit let you adjust line-heights and padding, but really, you are STILL left with the default select. However, utilizing some html, css and JavaScript (through jQuery) we can have our own pretty nifty looking drop down. This is part of a UI suite I&#8217;m hoping to work on called Clair. </p>
<div id="attachment_481" class="wp-caption aligncenter" style="width: 310px"><a href="http://wheremy.feethavebeen.com/wp-content/uploads/2010/08/all-browser.png"><img src="http://wheremy.feethavebeen.com/wp-content/uploads/2010/08/all-browser-300x260.png" alt="" title="Custom dropdown" width="300" height="260" class="size-medium wp-image-481" /></a><p class="wp-caption-text">Custom Dropdown</p></div>
<p>The functionality of our drop-down will mimic that of a regular dropdown box with one exception. Since we can not style the scrollbar, our drop-down will never display one. Instead, it will just keep expanding as you add new links. </p>
<p><strong>HTML</strong><br />
To start off with, our select needs a few different elements to work properly. First off, we need a container that will hold our select. We will also require a list of elements that we want to appear when you click the drop-down. Finally, we need a default element to hold the current selected item and an arrow to signify that we can click on it to display more options. I&#8217;ve assigned the classes and Id&#8217;s to the elements as necessary. <code>clair-select-active</code> is the default item that will be displayed as well as what is displayed when an element is clicked on.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;clair-select-container&quot;&gt;
  &lt;div class=&quot;clair-select&quot;&gt;
    &lt;div id=&quot;clair-select-active&quot;&gt;Where My.Feet Have Been&lt;/div&gt;
    &lt;ul class=&quot;clair-select-links&quot;&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Nookish&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Orange Pine Co&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Where My.Feet Have Been&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Your Website&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p><strong>CSS</strong><br />
Before we get to the clair specific styles, these are the default ones applied to the entire page:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14pt</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'bg.png'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#CCC</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The first style we get is the <code>clair-select</code> and the <code>clair-select-container</code> These style our entire select container.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.clair-select-container<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.clair-select</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#CCC</span><span style="color: #00AA00;">;</span>
  -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
  -o-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
  -khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
  border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">12px</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">230px</span><span style="color: #00AA00;">;</span>
  -moz-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
  box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
  opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0.7</span><span style="color: #00AA00;">;</span>
  filter<span style="color: #00AA00;">:</span> alpha<span style="color: #00AA00;">&#40;</span>opacity <span style="color: #00AA00;">=</span> <span style="color: #cc66cc;">70</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The purpose of <code>clair-select-container</code> is to make sure when we expand our select dropdown it doesn&#8217;t push elements out of the way. Instead of floats nicely above them, and our slight opacity setting will display a faint outline of what it&#8217;s coverting. </p>
<p>There is a lot of vendor specific styling going on in <code>clair-select</code>, but the only one that I think warrants explanation is <code>box-sizing</code> and <code>filter</code>. </p>
<ul>
<li><code>box-sizing</code>: is a CSS3 spec that allows us to change the way that the browser interprets the &#8220;box-model&#8221; I&#8217;ll have to do another post to fully explain the box-model, but essentially it is the difference between including padding and border sizes within the &#8220;width&#8221; element, or adding it on afterwards. This forces Firefox to render the box-model the way Internet Explorer would  <a class="simple-footnote" title="The IE way, takes your width and keeps your content that size, and adds borders and padding within it" id="return-note-475-1" href="#note-475-1"><sup>1</sup></a>. </li>
<li><code>filter</code>: is a <a href="http://msdn.microsoft.com/en-us/library/ms532847(VS.85).aspx">Microsoft proprietary spec</a> that allows us to use a number of IE only effects. The particular effect I am utilizing is alpha-blending which allows us to change the opacity of the element. I&#8217;ve turned the opacity done just a little so that things are still readable, while allowing us to see the background. This has the added benefit of a neat visual effect whereby it looks like our element is slightly inset.</li>
</ul>
<p>The next style we&#8217;re going to add is that of the active element. All we do here is add the arrow as a background image and position it to appear on the right side of the element.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#clair-select-active</span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'down.png'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Finally, we&#8217;re going to style all the links. Nothing too fancy here. We&#8217;re just getting rid of bullets, spacing everything out a little and treating the anchor tags as block elements within our li&#8217;s.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.clair-select-links</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.clair-select-links</span> li<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.clair-select-links</span> li a<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.clair-select-links</span> li a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#282828</span><span style="color: #00AA00;">;</span>
  -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
  -o-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
  -khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
  border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#DDD</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>JavaScript</strong><br />
To add functionality to our drop-down we need a bit of JavaScript. I&#8217;m utilizing jQuery, but your own JavaScript library should have similar functions. We need to add two kinds of functionality. </p>
<ol>
<li>We need to switch between minimized and maximized states whenever a user clicks on the <code>clair-select-active</code> element.</li>
<li>We need to switch to minimized and populate <code>clair-select-active</code> with the text from the menu item</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">$(document).ready(function(e) {
  // This is just for cross-browser prettiness
  $('#clair-select-active').css('cursor','pointer');
&nbsp;
  // This will toggle everything as necessary
  $('#clair-select-active').click(function(e) {
    if($('.clair-select-links').css('display') == 'block') {
      $('.clair-select-links').slideUp(); 
    }
    else {
      $('.clair-select-links').slideDown();
    }
  });
&nbsp;
  // This will populate clair-select-active with whatever you click on
  $('.clair-select-links a').click(function(e) {
    e.preventDefault(); 
    $('#clair-select-active').html($(this).html()); 
    $('.clair-select-links').slideUp(); 
  });
});</pre></div></div>

<p>And that&#8217;s it, you&#8217;ve built a custom select drop-down. With a little JavaScript trickery, we can even go so far as to include it within forms. We&#8217;d just need a hidden form element and then when we populate <code>clair-select-active</code> we would also populate the value attribute of our form element.</p>
<p>This solution works in the following scenarios: </p>
<ul>
<li>IE 7+</li>
<li>Firefox 3.5+</li>
<li>Chrome 3+</li>
<li>Opera 10+</li>
</ul>
<p>You can download all the files used in this tutorial here: <a href='http://wheremy.feethavebeen.com/wp-content/uploads/2010/08/custom-select.zip'>Custom Select Files</a></p>
<div class="simple-footnotes"><p class="notes">Notes:</p><ol><li id="note-475-1">The IE way, takes your width and keeps your content that size, and adds borders and padding within it <a href="#return-note-475-1">&#8617;</a></li></ol></div>]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/08/custom-select-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inconsistencies with File Upload</title>
		<link>http://wheremy.feethavebeen.com/2010/08/inconsistencies-with-file-upload/</link>
		<comments>http://wheremy.feethavebeen.com/2010/08/inconsistencies-with-file-upload/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 03:17:21 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[file upload]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=456</guid>
		<description><![CDATA[Before I even begin I want to state that this shouldn&#8217;t be used as a definitive source for this information. I am utilizing an older version of Firefox (3.0) and IE7 for all my tests. I can&#8217;t vouch for Chrome, Opera or Safari&#8217;s take on any of this, but I gather that it is much [...]]]></description>
			<content:encoded><![CDATA[<p>Before I even begin I want to state that this shouldn&#8217;t be used as a definitive source for this information. I am utilizing an older version of Firefox (3.0) and IE7 for all my tests. I can&#8217;t vouch for Chrome, Opera or Safari&#8217;s take on any of this, but I gather that it is much the same.</p>
<p>At some point in your web programming or web design career you will inevitably encounter the dreaded file upload &#8220;utility&#8221;. This piece of crap, is only present to allow users to select a file on their machine and eventually transfer it to your servers. Of course, this is a vital piece now, but perhaps at the time it was something that was easily overlooked. After all, at a time when your ISP speeds were approaching the 14.4kbps mark, uploading files was really something only the computer geeks did. </p>
<p>Now however, with profile pictures, online resumes, cloud storage and so much more, the file upload feature is front and center. Some places have gone so far as to eliminate the default HTML object and instead go with a Flash equivalent. This doesn&#8217;t really fix the issue, it&#8217;s like me saying &#8220;oh your computer doesn&#8217;t work? Here, use my iPad&#8221; <a class="simple-footnote" title="I really don&#8217;t have one http://wheremy.feethavebeen.com/2010/02/blagging-about-the-ipad/" id="return-note-456-1" href="#note-456-1"><sup>1</sup></a> It&#8217;s just a bypass. We need to fix this now! It&#8217;s already too late, we&#8217;re just playing catch up.</p>
<p><strong>Understanding the Process</strong><br />
File uploading is one of those features that, if you&#8217;re unlucky, you&#8217;ll have to design a layout around. That&#8217;s because, for some reason, every browser has decided that the File upload object is completely immune to CSS. No amount of styling can ever achieve what you want. It will always look like ass.</p>
<div id="attachment_470" class="wp-caption aligncenter" style="width: 295px"><a href="http://wheremy.feethavebeen.com/wp-content/uploads/2010/08/file-upload.png"><img src="http://wheremy.feethavebeen.com/wp-content/uploads/2010/08/file-upload.png" alt="File upload in Firefox and IE" title="File upload in Firefox and IE" width="285" height="266" class="size-full wp-image-470" /></a><p class="wp-caption-text">File upload in Firefox and IE</p></div>
<p>There is no easy way to style it, there is no way to replace it (unless you use flash, but that&#8217;s a whole different issue) and the only way to get around it is to hide it or integrate it directly into your design. There is absolutely no way to pretty it up. You can&#8217;t adjust the size of the button or the size of the input box. You are essentially stuck, with what you see. No way around it. Or is there? </p>
<p>Short of changing your entire design to work with default form elements (euych!) the only way to fix the file upload feature is to hide it completely. See, because we can still apply some style features to an encapsulating element <a class="simple-footnote" title="A div that contains the file upload field, for example" id="return-note-456-2" href="#note-456-2"><sup>2</sup></a>. So we could technically just hide the entire form field, and absolutely position it over our custom designed field. If we do it all right (we WILL have to use either a custom IE stylesheet or a bunch of hacks) we can make it look like our pretty file upload field is actually doing the work!</p>
<p><strong>The Code</strong><br />
The code for this is primarily CSS with some JavaScript sprinkled in to make sure that everything is positioned where it should be. I am utilizing the jQuery library for a lot of this simply because I use it in a lot of my projects. If you use any other libraries, they should all have equivalent methods and if they don&#8217;t, you should ditch them and switch to something else. If you are trying to follow along in straight JavaScript good luck. One of the primary reasons I work with a JavaScript library is because of cross browser inconsistencies. With a library, I can be sure that someone has gone through the painstaking task of setting up different kinds of math and implementation for the different browsers.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;File Upload&lt;/title&gt;
  &lt;style type=&quot;text/css&quot;&gt;
&nbsp;
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;fake-file&quot;&gt;
  &lt;input type=&quot;text&quot; id=&quot;fake-file-title&quot; name=&quot;fake_file_title&quot; value=&quot;&quot;&gt;
  &lt;button&gt;Browse&lt;/button&gt;
&lt;/div&gt;
&lt;div id=&quot;file-constraint&quot;&gt;
  &lt;input type=&quot;file&quot; id=&quot;real-file&quot;&gt;
&lt;/div&gt;
&nbsp;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>The CSS below is what we will be using to style our new input fields.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#fake-file</span> input <span style="color: #00AA00;">&#123;</span>
    -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">;</span> 
    -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    -o-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    -khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
  <span style="color: #cc00cc;">#fake-file</span> button <span style="color: #00AA00;">&#123;</span>
    -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">;</span> 
    -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    -o-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    -khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span> 
    border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Now it&#8217;s as simple as adding some positioning values to our file-constraint field. We will also alter the z-index and position it higher vertically than our fake file upload. Then we can simply utilize some JavaScript to make things work like it should.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#file-constraint</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> 
<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span> 
<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Bam instant hidden. Based on the position of your actual fake file field the top/left attributes will obviously change. The JavaScript is just as simple. I am utilizing jQuery to hook in to the onChange event for the real-file field, but it&#8217;s not necessary. You can do the same without a library. I just prefer jQuery because it means I can target all browsers the exact same way.</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">$('#real-file').change(function(e) {
var str = $(this).val(); 
str = str.split('\\')[str.length-1]; 
$('#fake-file-title').val(str);
});</pre></div></div>

<p>Basically we get the value of the file upload field. In Firefox this is just the name of the file, while in IE it contains the complete path to the file. I prefer stripping out the path, but that is up to you. Basically the value from the real file field is just assigned to the fake file field. </p>
<p>Working with file uploads are a hassle and this really only covers a portion of the client-side. There are still many things to take into account such as temporary file locations, file permissions, fake-ajax / standard uploading etc. This tutorial isn&#8217;t meant to be a complete compendium of all things file uploading, but merely to point out some annoying UI inconsistencies. </p>
<div class="simple-footnotes"><p class="notes">Notes:</p><ol><li id="note-456-1">I really don&#8217;t have one <a href="http://wheremy.feethavebeen.com/2010/02/blagging-about-the-ipad/">http://wheremy.feethavebeen.com/2010/02/blagging-about-the-ipad/</a> <a href="#return-note-456-1">&#8617;</a></li><li id="note-456-2">A div that contains the file upload field, for example <a href="#return-note-456-2">&#8617;</a></li></ol></div>]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/08/inconsistencies-with-file-upload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a new blog</title>
		<link>http://wheremy.feethavebeen.com/2010/08/building-a-new-blog/</link>
		<comments>http://wheremy.feethavebeen.com/2010/08/building-a-new-blog/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 14:46:07 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Announcements]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=466</guid>
		<description><![CDATA[Somewhere along the line building a blog became the new Hello World. Coding a simple setup from scratch really helps new developers push themselves and figure out a language a little better. It forces you to interface with a database, or work with flat files; date formatting and string manipulations galore. And it&#8217;s very easy [...]]]></description>
			<content:encoded><![CDATA[<p>Somewhere along the line building a blog became the new Hello World. Coding a simple setup from scratch really helps new developers push themselves and figure out a language a little better. It forces you to interface with a database, or work with flat files; date formatting and string manipulations galore. And it&#8217;s very easy to build a simple blog. It really is just a text area that saves some data to a database and another page that pulls it out.</p>
<p>But what about a full featured blog? I&#8217;m talking comments, categories, tags, a wysiwyg editor coupled with a theme engine to make it all look pretty. Those are a little rarer to come by, and most people just hop straight to WordPress. After all, it&#8217;s easier. </p>
<p>Over the weekend I began work on my own blog engine and I will hopefully be transitioning Where My Feet Have Been over to it sometime later this month. I want to force myself to finish it, so I will be porting over before everything is done. So there will be a lot of features implemented and tested before being pushed live. I&#8217;m also going to be doing a quick tutorial on the insides of the thing. </p>
<p>The new engine is tentatively nicknamed PHP Blog &#038; Journal or PB&#038;J and I&#8217;m hoping that it will provide all the features I need in a blog engine while still being easy to use and skin. The default theme is a minimalist one called Shipyard, and hopefully you&#8217;ll get a screenshot soon enough!</p>
<p>Here&#8217;s a list of planned features:</p>
<ul>
<li>Theme Engine (Mostly done)</li>
<li>Posts (Being worked on continuously. I have the database set up with the necessities and will be expanding it as I go.</li>
<li>Comments</li>
<li>Unlimited Nesting Categories</li>
<li>Tag with easy Tag Cloud support (it&#8217;s really just a count of how many times a tag appears. I&#8217;m surprised more blogs don&#8217;t do this to cut down on DB queries)</li>
<li>Static Pages</li>
<li>Basic Hook System &#8211; think Drupal but less stupid</li>
</ul>
<p>I think one of the things that I REALLY like about it so far is the easy of skinning everything. I&#8217;ll post a more detailed overview, but there really is no limit to what you can do. You need a few files (header.php, footer.php, main.php, single.php, sidebar.php, Themename.php) and you can do whatever you want. Want to get all the posts? <code>$blog->getPosts();</code> Want posts in specific categories? <code>$blog->getPosts(array('cat1','cat2','cat3')</code>. </p>
<p>From the administration point of view there really doesn&#8217;t need to be much. A way to list posts, categories and tags and a way to edit/create/delete them. And then a way to set global settings, such as the website name. </p>
<p>This is going to be the first major project I&#8217;ve undertaken utilizing my GridView and MySqlAdapter classes so I&#8217;ll be able to flesh them out and optimize them before re-releasing them. Wish me luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/08/building-a-new-blog/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Some useful array functions for JavaScript</title>
		<link>http://wheremy.feethavebeen.com/2010/07/some-useful-array-functions-for-javascript/</link>
		<comments>http://wheremy.feethavebeen.com/2010/07/some-useful-array-functions-for-javascript/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 20:40:43 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=450</guid>
		<description><![CDATA[JavaScript is a great language. There was a time when I was rather against it (mainly during the browser wars) but with modern libraries and the like, cross browser processing is exactly where it should be. However, there are a lot of times when you just need some simple processing done and most libraries &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript is a great language. There was a time when I was rather against it (mainly during the browser wars) but with modern libraries and the like, cross browser processing is exactly where it should be. However, there are a lot of times when you just need some simple processing done and most libraries &#8211; even their cores &#8211; are too bloated to be of any use.  Below I&#8217;ve outlined three functions has(), indexOf() and remove() that extend the existing Array prototype to add some much needed features.</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">Array.prototype.indexOf = function(val) {
	for(i = 0; i &lt; this.length; i++) {
		if(this[i] == val) {
			return i; 
		}
	}
	return -1;
};
&nbsp;
Array.prototype.has = function(val) {
	return this.indexOf(val) &gt; 0 ? true:false;
};
&nbsp;
Array.prototype.remove = function(val) {
	var x = this.indexOf(val), y = 0;
	for(i = 0; i &lt; this.length; i++) {
		if(i != x) {
			this[y]= this[i];
			y++;
		}
	}
	this.pop();
};</pre></div></div>

<p><strong>indexOf()</strong><br />
Often times you have a string and you need to figure out where in the array it appears. Since JavaScript doesn&#8217;t technically support associative arrays (array object conversion does occur implicitly) you can either loop through the array every time, or just extend array!</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">Example for indexOf()
var myArray = [&quot;an&quot;,&quot;array&quot;,&quot;with&quot;,&quot;a&quot;,&quot;bunch&quot;,&quot;of&quot;,&quot;words&quot;]; 
document.Write(myArray.indexOf(&quot;a&quot;));   // returns 3
document.Write(myArray.indexOf(&quot;491&quot;));  // returns -1</pre></div></div>

<p><strong>has()</strong><br />
Sometimes you just need to know if a value is present within an array. has() takes care of that returning a simple true:false boolean. Rather than re-inventing the wheel, it works in conjunction with indexOf()</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">Example for has()
var myArray = [&quot;an&quot;,&quot;array&quot;,&quot;with&quot;,&quot;a&quot;,&quot;bunch&quot;,&quot;of&quot;,&quot;words&quot;]; 
document.Write(myArray.has(&quot;with&quot;)); // returns true
document.Write(myArray.has(&quot;feet&quot;)); // returns false</pre></div></div>

<p><strong>remove()</strong><br />
Finally, sometimes removing a single element from an array is necessary.</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">Example for remove()
var myArray = [&quot;an&quot;,&quot;array&quot;,&quot;with&quot;,&quot;a&quot;,&quot;bunch&quot;,&quot;of&quot;,&quot;words&quot;]; 
myArray.remove(&quot;array&quot;); // myArray now contains [&quot;an&quot;,&quot;with&quot;,&quot;a&quot;,&quot;bunch&quot;,&quot;of&quot;,&quot;words&quot;]</pre></div></div>

<p>Hopefully the functions are of help! If there are a lot of people confused over Prototypal Inheritance, maybe that would be an interesting topic.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/07/some-useful-array-functions-for-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataGrid Control V2</title>
		<link>http://wheremy.feethavebeen.com/2010/07/datagrid-control-v2/</link>
		<comments>http://wheremy.feethavebeen.com/2010/07/datagrid-control-v2/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 02:43:04 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Controls]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[datagrid]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=400</guid>
		<description><![CDATA[I&#8217;ve been working on a series of &#8220;Control Objects&#8221; to include in my usual projects, and I thought I&#8217;d post one of the completed ones up here. Basically it mimcs the use of the DataGrid control in Visual Studio but in a way I find a lot easier and more in-tune with PHP. After creating [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a series of &#8220;Control Objects&#8221; to include in my usual projects, and I thought I&#8217;d post one of the completed ones up here. Basically it mimcs the use of the DataGrid control in Visual Studio but in a way I find a lot easier and more in-tune with PHP. After creating the DataGrid, you define a &#8220;source&#8221;. The Source is essentially a multi-dimensional array that you could assign with a simple</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resource</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>you would then pass $r as the source to the DataGrid. You have the ability to set some options (like specifying specific style sheets, JS libraries for AJAX editing or defining and renaming visible columns) and then a single build(); command will output the table. Of course, you can also build(true); to return the table incase you&#8217;re using some sort of theme system.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'f_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Angelo'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'l_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Rodrigues'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'f_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Darth'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'l_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Vader'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'f_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Luke'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'l_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Skywalker'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'f_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Han'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'l_name'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Solo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$DataGrid</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DataGrid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$DataGrid</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">configure</span><span style="color: #009900;">&#40;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'primary_key'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'sortable'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'striped'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'even_row'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'odd_row'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'striped'</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This not only defines display fields, but the order as well </span>
<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
  <span style="color: #0000ff;">'f_name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'First Name'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'l_name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Last Name'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$DataGrid</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDisplayFields</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$DataGrid</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Headers</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'css'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'js'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'object'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'js'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'function'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$DataGrid</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">source</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$DataGrid</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">build</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The code can be further simplified by using a new class called ControlObjectManager (or COM for short). COM can be used to instantiate multiple Controls at once and even assign shortcuts to commonly used Controls. For example, if you need DataGrids a lot, you can initiate them via a simple call like <code>$COM->init(array('dg'))</code> and as long as you set up that dg means DataGrid in the configuration for COM, you&#8217;re good to go. </p>
<p>I&#8217;ll post up some more on the COM when it&#8217;s done, but for now, here&#8217;s a link to the latest iteration of DataGrid v2. </p>
<p><a href="http://pastebin.com/nD969RJp">View on Pastebin</a> &#8211; Just note that this is the debug version of the script, so there are tons of comments and explanations.</p>
<p>The original DataGrid actually tied in to MySql directly and required the MySqlAdapter control to even function. This latest iteration removes all ties to any database instead focusing on a simple multi-dimensional array of data. As well it drops the code-base down quite a bit and condenses a lot of functionality. For example: originally you would have had to set the display columns and then order them, but by compressing them into a single function it not only makes MORE sense, but is easier to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/07/datagrid-control-v2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A quick fix</title>
		<link>http://wheremy.feethavebeen.com/2010/07/a-quick-fix/</link>
		<comments>http://wheremy.feethavebeen.com/2010/07/a-quick-fix/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 15:38:13 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Tech Tip]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[troubleshoot]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=422</guid>
		<description><![CDATA[Fixing computer problems is no longer the quick task it used to be. Now, when you&#8217;re dealing with custom built pc&#8217;s averaging about 6 separate major parts, with each part comprised of its own little pieces, it starts to border impossible &#8211; or at least impossible in a timely manner. And that&#8217;s just hardware too. [...]]]></description>
			<content:encoded><![CDATA[<p>Fixing computer problems is no longer the quick task it used to be. Now, when you&#8217;re dealing with custom built pc&#8217;s averaging about 6 separate major parts, with each part comprised of its own little pieces, it starts to border impossible &#8211; or at least impossible in a timely manner. And that&#8217;s just hardware too. Counting all the possible software issues and incompatibilities, fixing a problem can border on days. </p>
<p>And days is simply too long. Often when a customer comes to me with computer problems it goes a little like this:</p>
<ol>
<li>Sit down and get the customer to explain what happened</li>
<li>Keep pressing for more details. More often than not the customers description is very high level. &#8220;I clicked ok and it just showed up&#8221; isn&#8217;t very accurate. I need to know every detail leading up to the error. Most times that alone can identify a potential set of problems, or at least rule some things out.</li>
<li>Research. Contrary to popular belief, IT professionals don&#8217;t know every problem that could occur. We know the common ones and we know ones that we&#8217;ve experienced before, and we know some of the stranger ones. <a class="simple-footnote" title="I have been known to spend a lot of time on http://www.thedailywtf.com reading some of the stranger issues people have had" id="return-note-422-1" href="#note-422-1"><sup>1</sup></a> We need to look into other cases of your problem, we need to find patterns between occurrences and then apply them back to your case. We are not just Googling hoping to stumble across an answer. Although, we do use Google. </li>
<li>Come up with a solution</li>
</ol>
<p>Sadly, a lot of times the solution we come up with is simple: <b>Reformat</b>. </p>
<p>Yes I could spend 8 or 9 hours for the next 3 days removing all traces of the virus from your computer. Yes I could find the exact file that is corrupted on both your CD and your computer. Yes I could bake a pizza from scratch. But it&#8217;s not worth it. Not when there&#8217;s a solution that is fairly easy to follow and can get you back and computing faster than ever. Not to mention <b>reformatting</b> not only saves you time, it also saves you money, because I don&#8217;t charge you for solutions, I just charge for implementation.</p>
<p>That being said, every so often one of those really strange problems pop up and you can&#8217;t help but spend countless hours fixing it &#8211; but hey, we&#8217;re geeks.</p>
<div class="simple-footnotes"><p class="notes">Notes:</p><ol><li id="note-422-1">I have been known to spend a lot of time on <a href="http://www.thedailywtf.com">http://www.thedailywtf.com</a> reading some of the stranger issues people have had <a href="#return-note-422-1">&#8617;</a></li></ol></div>]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/07/a-quick-fix/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The man your man could smell like</title>
		<link>http://wheremy.feethavebeen.com/2010/07/the-man-your-man-could-smell-like/</link>
		<comments>http://wheremy.feethavebeen.com/2010/07/the-man-your-man-could-smell-like/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 14:56:05 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[commercial]]></category>
		<category><![CDATA[isaiah mustafa]]></category>
		<category><![CDATA[old spice]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=411</guid>
		<description><![CDATA[For the few people around that know me well, you&#8217;ll know I have a strange love for the newer Old Spice commercials. Those featuring Isaiah Mustafa. No other commercial gets me as excited about just.. being. If you&#8217;ve never seen one of these before, definitely check out the first one here, the second one is [...]]]></description>
			<content:encoded><![CDATA[<p>For the few people around that know me well, you&#8217;ll know I have a strange love for the newer Old Spice commercials. Those featuring <a href="http://en.wikipedia.org/wiki/Isaiah_Mustafa">Isaiah Mustafa</a>. No other commercial gets me as excited about just.. being. If you&#8217;ve never seen one of these before, definitely check out the first one <a href="http://wheremy.feethavebeen.com/2010/03/old-spice-steps-up-the-game/">here</a>, the second one is posted below. </p>
<p><object width="500" height="306"><param name="movie" value="http://www.youtube.com/v/uLTIowBF0kE&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/uLTIowBF0kE&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="306"></embed></object></p>
<p>See?! It&#8217;s just so damn awesome. I can&#8217;t get over it. Every time I see this commercial I get excited. It&#8217;s filled with levels of awesome I wasn&#8217;t even sure existed. Never mind the technical aspect of it (which is mind-boggling itself), it&#8217;s just friggin awesome. I was so excited the first time I saw it that I punched my sister and then watched it 7 or 8 more times laughing the entire time. </p>
<p>Dammit <a href="http://www.wk.com/">Weiden+Kennedy</a>, you&#8217;ve done it again.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/07/the-man-your-man-could-smell-like/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Failing my way to success</title>
		<link>http://wheremy.feethavebeen.com/2010/07/failing-my-way-to-success/</link>
		<comments>http://wheremy.feethavebeen.com/2010/07/failing-my-way-to-success/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 15:20:06 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[confidence]]></category>
		<category><![CDATA[failure]]></category>
		<category><![CDATA[fear]]></category>
		<category><![CDATA[success]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=403</guid>
		<description><![CDATA[I love talk radio. Since I got my car, it&#8217;s the only thing I listen to during my drive in to work and most times it&#8217;s what&#8217;s playing any other time I&#8217;m listening to the radio. I can&#8217;t help it. It presents the news in a completely biased manner but one that actively engages it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I love talk radio. Since I got my car, it&#8217;s the only thing I listen to during my drive in to work and most times it&#8217;s what&#8217;s playing any other time I&#8217;m listening to the radio. I can&#8217;t help it. It presents the news in a completely biased manner but one that actively engages it&#8217;s audience in a way television can never match. Sure I can <a href="http://www.twitter.com/torontostar">@torontostar</a> or hope you bump into me downtown, but you get to filter it. With talk radio, I can call you and speak to you unfiltered. I can put you on the spot, turn your ideas upside down and just rail against you for not knowing your facts. I can agree with you and make fun of the last caller. I can get involved. I could &#8211; but I don&#8217;t. The main reason being I don&#8217;t is because I don&#8217;t fully understand the ins and outs of what&#8217;s being discussed. It&#8217;s hard to make a comment when the first time you hear about something is while driving. I&#8217;m not really confident enough to do that. Much like I wasn&#8217;t confident enough in my own skills as a programmer and designer a few years ago. </p>
<p>Back then I was just starting out and just couldn&#8217;t bring myself to say &#8220;I&#8217;m a programmer, you don&#8217;t know what you&#8217;re talking about&#8221;, even if I felt that way. I couldn&#8217;t correct a guy who talked about &#8220;href&#8221; tags or someone who called a computer a &#8220;CPU&#8221;. And I got to thinking. Why. Why was I, who KNEW my stuff (not to sound like a complete ass) not nearly as confident as the other guy who clearly didn&#8217;t? Why did I not call him out when he blatantly BS&#8217;d his way through explanations? Why couldn&#8217;t I just be more confident? And I realized it stemmed from two fundamental truths. </p>
<ol>
<li>He was always told that he could do anything he wanted</li>
<li>I was afraid of failure</li>
</ol>
<p>One of those I obviously couldn&#8217;t do anything about, but I could try and fix the other. </p>
<p><strong>The only thing we have to fear is fear itself</strong><br />
In order to fix this fear of failure I had to try and figure out why I was afraid. The obvious &#8220;because you&#8217;ll fail&#8221; wouldn&#8217;t cut it this time, so I had to delve deeper than that. I had to figure out why exactly failure was such a bad thing. After all everyone talks about how you only learn if you make mistakes etc. etc. blah blah, so clearly making mistakes and failing is a good thing. I began to look back at previous times I had failed. I looked at everything, from falling down stairs (walking fail?) to not being able to deliver a project on time to formatting my hard-drive. The only thing these things had in common was that I had failed. That and they caught me off guard.</p>
<p>Wait what? That last bit seems pretty significant. </p>
<p>I looked at more times I failed and noticed the recurring trait. I never thought I would fail, I never even considered it and when it happened I was caught off guard. I didn&#8217;t know how to respond and it seemed like every failure inevitably ended with me doubting myself a little more. And now, it had gotten to the point where the apprehension about failing was far more intimidating than actually succeeding. </p>
<p>So I made a list. A list of all the things I could do to not be caught of guard. It was a very short list. It basically involved either being psychic or making another list of all possible points of failure. Clearly neither would be happening. So I decided to make a list of the most obvious things I could fail at for a task. I cut out anything I wouldn&#8217;t have any control over, like &#8220;friend moves away, has borrowed hard-drive, now you have no hard-drive&#8221; and left the generalized stuff on. And you know what? It didn&#8217;t help one bit. I still wasn&#8217;t confident, I still was afraid to speak my mind about anything. </p>
<p>Knowing the failures didn&#8217;t help. In fact just knowing them made them all seem so much worse. Gradually however, I started coming up with contingency plans for each point of failure. At first they started as reasons for why they couldn&#8217;t be counted as &#8220;real&#8221; failures. They weren&#8217;t excuses, but rather ways to deal with something if that particular failure came about. And the suddenly, once I had a contingency plan for a failure, there was no reason to worry about it. Sure it could happen, but so what? I had a back-up plan. And a back-up plan of my back-up plan was in the works. A failure just wasn&#8217;t that daunting anymore. </p>
<p>Sure a client could say &#8220;I&#8217;m not paying you for that.&#8221;, but then I could say &#8220;Well why don&#8217;t we meet and discuss your reservations about paying and see if we can come up with something where both of us are happy.&#8221; I could also say &#8220;Screw you buddy, see you in small claims.&#8221; It didn&#8217;t matter WHAT I said, it just mattered that I had various plans in case I failed. And that gave me a sense of confidence that I&#8217;ve never had before. </p>
<p>And the confidence brought something else that I hadn&#8217;t counted on. Success. I hadn&#8217;t suddenly gotten better at anything, but I wasn&#8217;t so afraid of failing and people responded to it. I spoke my mind at meetings and offered my input. Sometimes I was right and sometimes someone said I was wrong. It didn&#8217;t matter because my backup plan for saying something wrong was simple &#8220;Ask why.&#8221; And people suddenly realize you&#8217;re not just like everyone else. You want to know more, you&#8217;re willing to offer ideas and have them killed, you just want to know why.</p>
<p>And just like that, I was suddenly confident in my own abilities. Not just as a developer or a designer, but as a guitarist, as a gamer, as a person. I knew what I could and could not do, and I knew how to deal with both.</p>
<p>&#8212;-<br />
I realized this is sort of a random shift away from coding and stuff, but as a <a href="http://www.rarst.net">fellow blogger</a> once <a href="http://wheremy.feethavebeen.com/2009/11/my-apologies/#comment-427">pointed out</a> to me. It&#8217;s my goddam blog. </p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/07/failing-my-way-to-success/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Search array for Substring</title>
		<link>http://wheremy.feethavebeen.com/2010/07/search-array-for-substring/</link>
		<comments>http://wheremy.feethavebeen.com/2010/07/search-array-for-substring/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 14:56:22 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=397</guid>
		<description><![CDATA[Occasionally you&#8217;ll need to create some sort of auto-complete field. While you could power this entirely via AJAX requests on a per-character basis, with limited resources, you may want to look at this alternative. Essentially you&#8217;ll create a javascript array containing allowed values. Whenever a user types in some characters, we can use some regex [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally you&#8217;ll need to create some sort of auto-complete field. While you could power this entirely via AJAX requests on a per-character basis, with limited resources, you may want to look at this alternative.</p>
<p>Essentially you&#8217;ll create a javascript array containing allowed values. Whenever a user types in some characters, we can use some regex coupled with a quick iteration to see if whatever the user entered is valid. If it is, we can easily return the matched values.</p>
<p>The function below is written in straight JavaScript. I monitor my keypress events via jQuery, but any way you want to do it is fine. Just make sure you call arrayFind() with the string you want to find and the array you want to search in.</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">function arrayFind(needle,haystack) {
var matchList = [];
var regex = new RegExp(needle,'gi');
for(i in haystack) {
	if(haystack[i].match(regex)) {
		matchList[matchList.length] = haystack[i];
	}
}
return matchList;
}</pre></div></div>

<p>If you didn&#8217;t need to use a variable for the regex you could eliminate that line and just use /searchterm/gi for a global case-insensitive search of the array. Since we are however, we need to make use of the RegExp object.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/07/search-array-for-substring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone 4, Apple&#8217;s Vista</title>
		<link>http://wheremy.feethavebeen.com/2010/06/iphone-4-apples-vista/</link>
		<comments>http://wheremy.feethavebeen.com/2010/06/iphone-4-apples-vista/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 14:00:35 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[vista]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=387</guid>
		<description><![CDATA[Hey everyone, it&#8217;s me again, bringing you more news from the awesome world of mac. I know I&#8217;ve been a little quiet lately, but I&#8217;ve been really re-examining what this site is and what I want to provide people. But that&#8217;s not what this post is about. This post is about the iPhone4 and how [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everyone, it&#8217;s me again, bringing you more news from the awesome world of mac. I know I&#8217;ve been a little quiet lately, but I&#8217;ve been really re-examining what this site is and what I want to provide people. But that&#8217;s not what this post is about.</p>
<p>This post is about the iPhone4 and how it&#8217;s turning out to be Apple&#8217;s Vista.</p>
<p>&#8220;Hold on Angelo&#8221;, you may say. &#8220;The iPhone4 is glorious! It&#8217;s the most amazing thing out there. It&#8217;s an-BBBZZZZZZZZZZZZZZZ&#8221; and that&#8217;s about as far as you&#8217;d get before I started playing my vuvuzela to drown you out. Those of you who haven&#8217;t lined up yet? There&#8217;s a serious flaw in the iPhone where IT STOPS FUNCTIONING AS A PHONE DEPENDING ON HOW YOU HOLD IT.</p>
<p>I really WANT to continue bashing it, but I&#8217;m not even sure if I need any more ammunition. It&#8217;s a phone that ceases to be a phone if you hold it wrong. If that&#8217;s not an epic fail, I don&#8217;t know what is. You know what the best part is? It doesn&#8217;t seem like Apple is intending to fix it just yet. In fact, the Gospel according to Steve states</p>
<blockquote><p>&#8220;Gripping any phone will result in some attenuation of its antenna performance, with certain places being worse than others depending on the placement of the antennas. This is a fact of life for every wireless phone. If you ever experience this on your iPhone 4, avoid gripping it in the lower left corner in a way that covers both sides of the black strip in the metal band, or simply use one of many available cases.” &#8211; Steve-us</p></blockquote>
<p>Is it just me or did Steve say that this is unavoidable and that calls get dropped regardless of the phone? I&#8217;ve had my Blackberry for a while now (almost 2 years) and I&#8217;ve only dropped calls when I move into spaces where my carrier doesn&#8217;t provide coverage. I&#8217;ve never dropped calls standing in Downtown Toronto if I held my phone wrong. Congratulations you early adopting, line-standing, online reserving (if the website worked for you) mac fanboys. You have a phone that decides it doesn&#8217;t like being a phone if you hold it wrong.</p>
<p>Just to make the connection for those of you who couldn&#8217;t: Microsoft shipped a sub-par OS then fixed it up a few months later with a free download. Apple shipped a sub-par phone and then Steve-us himself told you you&#8217;re holding it wrong.</p>
<p>You can check out the original email and emailer here &#8211; <a href="http://www.sampletheweb.com/2010/06/24/steve-jobs-to-lefties-hold-the-iphone-4-differently-or-buy-a-case/">http://www.sampletheweb.com/2010/06/24/steve-jobs-to-lefties-hold-the-iphone-4-differently-or-buy-a-case/</a></p>
<p>You can check out Engadgets little apple-rail here:  <a href="http://www.engadget.com/2010/06/25/hey-apple-youre-holding-it-wrong/">http://www.engadget.com/2010/06/25/hey-apple-youre-holding-it-wrong/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2010/06/iphone-4-apples-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
