<h2><a href="http://www.itworld.com/it-managementstrategy/111334/good-job-adobe-flash-team">Flash Player installer without the cruft</a></h2>
<div class="views-field-body">
<div class="field-content"><p>John Welch explains that if you look into the package contents of the Flash Player installer you will find the true installer at the following location:</p>
<p>/Contents/Resources/</p>
<p>This installer will not force you to quit all of your browsers.</p>
<h2><a href="/archive/2010/02/15/parse-class-values-retrieving-custom-meta-data-html-elements-class-name">Parse class values: Retrieving custom meta data from an HTML element's class name</a></h2>
<div class="views-field-body">
<div class="field-content"><h2>The problem</h2>
<p>I had HTML that had class information on each object that signified how deeply it was indented (e.g. "indent-5"). I needed to use the value of the indent to make various comparisons in another. To solve this problem I created a simple utility function.</p>
<p>NOTE: All functions were written with a dependancy on jQuery.</p>
<h2>Original</h2>
<p>I created an array of the object's classes by splitting the string at the instance of a space. I made the assumption that the indent class would always be the first and accessed the first element of the object class array I created. I then took this string and removed the "indent-" part and parsed the rest as an integer. The result was an integer I could use for numeric comaprisons in my main function.</p>
<pre><code>function parseObjLevelNumber(obj) {
var objClass = $(obj).attr("class");
var objClassArray = new Array();
objClassArray = objClass.split(" ");
var objLevel = parseInt(objClassArray[0].replace(/indent-/, ""));
return objLevel;
}
</code></pre>
<h2>Revision 1 - RegEx</h2>
<p>When I looked at my code again I realized that my original function could be made more generic so that it could be a general purpose utility function. Since the new function could not assume an object class array position or the string that should be removed I made these two values arguments to the function.</p>
<p>When first writing this I ran into a minor problem when trying to use the RegEx string as a normal string. Apparently you need to convert a string into a RegEx variable if you want it to be used as a variable.</p>
var objClassArray = $(obj).attr("class").split(" ");
var attrNameRegEx = new RegExp(attrName);
var classValue = objClassArray[pos].replace(attrNameRegEx, "");
return classValue;
}
</code></pre>
<h2>Revision 2 - JSON</h2>
<p>As much as the RegEx version of the function was better it still forced one to make assumptions about what position in the array the item you wanted was. I removed position as an argument and tried to find a way one could access the class attribute by name. For example if you wanted the "indent" level of an object you would only need to ask for "indent."</p>
<p>I decided that the best way to do this would be to create a JSON object that contains all the class attributes a element has.</p>
<p>I first set up my empy JSON array. I then loop through the values in the object's class array (e.g. "indent-1") and I split those values against the "-" to create another array called "keyValue." Then I push values into the JSON array with the assumption that the prefix, "[0]," will always be the key and the suffix, "[1]," will always be the value.</p>
<h2><a href="/archive/2010/01/18/prevent-loss-unsaved-data-onbeforeunload">Prevent the loss of unsaved data with OnBeforeUnload</a></h2>
<div class="views-field-body">
<div class="field-content"><p>Sometime last year I learned about the onUnload event, which is available on the "window" object. Today I thought I could use it to prevent a user from leaving a web page if, for example, there is unsaved data that will be lost. I quickly realized that it would not work. The "onunload" event happens after the user has already "unloaded" the page. I needed an event that fired before the user action and naturally came upon, "onBeforeUnload."</p>
<p>The onBeforeUnload event is Microsoft specific and is not included in the W3C specification but fortunately seems to be a de facto standard in the modern web browsers. Support is in the latest versions of FireFox, Safari, Chrome and Internet Explorer. Below is a code example and screenshots of resulting dialog boxes in Safari and Google Chrome.</p>
<p>Safari's dialog default formatting is close to an exact match of all other browsers. Google Chromem however, displays a much smarter dialog. It didn't take much thought to realize that they did this for their web applications. If for example, you try to reload an unsaved e-mail in Gmail you will trigger an "onBeforeUnload" event.</p>
<p>To clear the beforeUnload event just set the value of it to null as follows:</p>
<p><code>window.onbeforeunload = null;</code></p>
<p><a href="/code/before-unload/index.html">See the example.</a></p></div>
<h2><a href="/archive/2009/05/03/it-only-took-several-years">It only took several years</a></h2>
<div class="views-field-body">
<div class="field-content"><p>I've <em>finally</em> redesigned and relaunched CreativeBOX (everything isn't perfect yet - but if I waited until then this relaunch would never happen.) I can't even count how many years this has been delayed. A lot has changed since my last real updates to the site, the most significant being my graduation from college (woot!) and my job at <a href="http://www.oho.com/">OHO Interactive</a>.</p>
<p>This site used to be my <acronym title="Graphical User Interface">GUI</acronym> playground back in the golden age of Mac interface customization (raise your hand if you can vividly remember MacPlaza, MacOSZone, GUI Junky, ResExcellence, <a href="http://www.iconfactory.com">IconFactory's</a> PixelPalooza etc.) It was a fun time and was what partially inspired me to go into the design field. On CreativeBox I offered custom desktop pictures, startup screens, Kaleidoscope schemes, icons, and even software developed by my younger brother. I loved the GUI community so much that I even ran a site called MacCommunity for a while that reported on the releases of new GUI goodies. Yea, I was very much a Mac geek. As a matter of fact I still am but my priorities have changed.</p>
<p>I eventually got exhausted creating icons and desktop pictures but I never tired of running web sites. While trying to re-imagine CreativeBox I ran several web sites during college for student organizations. I just couldn't stay away from the marketing, analyzing web analytics, brainstorming, designing and development that was involved. There is a beautiful complexity in building and running a web site and with this, the new CrativeBox, I hope to share some of it.</p></div>
<h2><a href="/archive/2009/01/28/open-during-construction">Open During Construction</a></h2>
<div class="views-field-body">
<div class="field-content"><p>Yup. I am back and ready for another go at running the Creative[BOX]. While under construction I will be posting, designing, configuring, and learning how to manage this Drupal system. It should be a fun ride.</p></div>
<span class="field-content">I'm really liking HyperDock. Very strong chance that I'll buy it when it comes out of beta. <a href="http://hyperdock.bahoom.de/" title="http://hyperdock.bahoom.de/">http://hyperdock.bahoom.de/</a></span>
<span class="field-content">Big news! #Drupal 7 has hit beta. I'll have to give it another spin in the near future. <a href="http://drupal.org/drupal-7.0-beta1" title="http://drupal.org/drupal-7.0-beta1">http://drupal.org/drupal-7.0-beta1</a></span>