<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>VulgarisOverIP</title>
	<link>http://www.vulgarisoip.com</link>
	<description>CTO during the week, CBO during the weekend</description>
	<pubDate>Mon, 06 Aug 2007 20:05:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>jquery.suggest 1.1</title>
		<link>http://www.vulgarisoip.com/2007/08/06/jquerysuggest-11/</link>
		<comments>http://www.vulgarisoip.com/2007/08/06/jquerysuggest-11/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 19:59:53 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[jquery.suggest]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/2007/08/06/jquerysuggest-11/</guid>
		<description><![CDATA[It&#8217;s been a while since my last post, and I&#8217;ve got a lot of great ideas to get down on blog, but first I&#8217;d like to announce a new version of jquery.suggest. Some new features include:

Improved cross-browser compatibility (tested to work the same across Firefox/Safari/IE6/IE7)
Cache bug has been fixed that caused suggestions to &#8220;forget&#8221; to [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since my last post, and I&#8217;ve got a lot of great ideas to get down on blog, but first I&#8217;d like to announce a new version of jquery.suggest. Some new features include:</p>
<ul>
<li>Improved cross-browser compatibility (tested to work the same across Firefox/Safari/IE6/IE7)</li>
<li>Cache bug has been fixed that caused suggestions to &#8220;forget&#8221; to hide</li>
<li>Moved some stylings from JavaScript to CSS</li>
<li>Cleaned up code, started heavy commenting</li>
<li>Not exactly a new feature, but jquery.suggest will soon be on jQuery&#8217;s plugin page</li>
</ul>
<p>For more information, please see <a href="http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/">this previous post</a>. While the plugin works in Opera, it&#8217;s not perfect (which is why I didn&#8217;t mention it above) and I&#8217;m still working on it.</p>
<p><a href="http://www.vulgarisoip.com/files/jquery.suggest.js">Download it here</a> (example CSS <a href="http://www.vulgarisoip.com/files/jquery.suggest.css">here</a>) and give me some feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/08/06/jquerysuggest-11/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Updated minify library for PHP 4</title>
		<link>http://www.vulgarisoip.com/2007/07/11/updated-minify-library-for-php-4/</link>
		<comments>http://www.vulgarisoip.com/2007/07/11/updated-minify-library-for-php-4/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 00:05:22 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/2007/07/11/updated-minify-library-for-php-4/</guid>
		<description><![CDATA[I&#8217;ve updated my PHP 4 version of minify which you can download here. This new version now supports external linking to minified JavaScript and CSS through the use of &#60;link&#62; and &#60;script&#62; tags. You can find instructions on implementing this method here, it&#8217;s the same as standard minify.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated my PHP 4 version of <a href="http://code.google.com/p/minify/">minify</a> which you can <a href="http://www.vulgarisoip.com/files/minify_php4.zip">download here</a>. This new version now supports external linking to minified JavaScript and CSS through the use of &lt;link&gt; and &lt;script&gt; tags. You can find instructions on implementing this method <a href="http://code.google.com/p/minify/wiki/UserGuide">here</a>, it&#8217;s the same as standard minify.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/07/11/updated-minify-library-for-php-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery 1.1.3 is out</title>
		<link>http://www.vulgarisoip.com/2007/07/01/jquery-113-is-out/</link>
		<comments>http://www.vulgarisoip.com/2007/07/01/jquery-113-is-out/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 02:08:25 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/2007/07/01/jquery-113-is-out/</guid>
		<description><![CDATA[Get it while it&#8217;s hot.
Can&#8217;t wait to update all my sites. 
]]></description>
			<content:encoded><![CDATA[<p><a href="http://groups.google.com/group/jquery-en/browse_thread/thread/d0181c1e08f256ec/94cff51a52ecc91c#94cff51a52ecc91c">Get it while it&#8217;s hot.</a><br />
Can&#8217;t wait to update all my sites. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/07/01/jquery-113-is-out/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jquery.suggest, an alternative jQuery based autocomplete library</title>
		<link>http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/</link>
		<comments>http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comments</comments>
		<pubDate>Fri, 29 Jun 2007 17:11:12 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[jquery.suggest]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/</guid>
		<description><![CDATA[Update 2:  After reading Peter-Paul Koch&#8217;s amazing book on Javascript, I&#8217;ve come to realize that the offset problem with the drop down in IE is probably caused by the use of em&#8217;s on padding/margins of autocomplete&#8217;s offsetParents.
Update 1: I realize the drop down is slightly off in IE 6&#38;7, I think it has something [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 2:  </strong>After reading <a href="http://www.quirksmode.org/">Peter-Paul Koch&#8217;s</a> <a href="http://www.amazon.com/ppk-JavaScript-1-e-VOICES/dp/0321423305/ref=pd_bbs_sr_1/105-3629605-9695644?ie=UTF8&amp;s=books&amp;qid=1186417991&amp;sr=8-1">amazing book on Javascript</a>, I&#8217;ve come to realize that the offset problem with the drop down in IE is probably caused by the use of em&#8217;s on padding/margins of autocomplete&#8217;s offsetParents.</p>
<p><strong>Update 1:</strong> I realize the drop down is slightly off in IE 6&amp;7, I think it has something to do with Wordpress or K2&#8217;s stylesheets. Also, I&#8217;m in the process of updating the script to work better when the window is resized. Keep checking back here for more updates.</p>
<p>Try it:</p>
<p><script src="http://www.vulgarisoip.com/files/jquery.js" type="text/javascript"></script><script src="http://www.vulgarisoip.com/files/jquery.suggest.js" type="text/javascript"></script><script src="http://www.vulgarisoip.com/files/jquery.dimensions.js" type="text/javascript"></script></p>
<link href="http://www.vulgarisoip.com/files/jquery.suggest.css" rel="stylesheet" type="text/css" />
<input size="30" style="position: absolute" id="suggest" /><script type="text/javascript">         jQuery.noConflict(); jQuery(function() {  jQuery("#suggest").suggest("http://www.vulgarisoip.com/files/search.php",{ onSelect: function() {alert("You selected: " + this.value)}}); });</script><br />
jquery.suggest is my attempt at a jQuery autocompleter that functions much like <a href="http://www.google.com/webhp?complete=1&amp;hl=en">Google Suggest</a>. I used code and techniques from two popular jQuery autocompleters:</p>
<ul>
<li><a href="http://www.dyve.net/jquery/?autocomplete">autocomplete</a></li>
<li><a href="http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js">Interface autocompleter</a></li>
</ul>
<p>Originally, I used the first library in all my code but found that it just didn&#8217;t have the flexibility I needed and it had not been maintained in a long time. The biggest missing feature is the ability to run a function upon selecting something from the drop down.</p>
<p>While the Interface autocompleter seems to be rather up to date, there&#8217;s still a lot of problems with it. It&#8217;s tied to the Interface 1 library (which looks dead), the &lt;iframe&gt; code with is supposed to help cover forms in IE doesn&#8217;t work over HTTPS and the caching system is so screwed up I ended up having to manually disabling it.</p>
<p>I also found that the two implementations acted differently in different browsers including IE 6&amp;7, Firefox and Safari. Sometimes tab would select an item, sometimes it would move to the next &lt;input&gt; element. Sometimes typing in something (which I didn&#8217;t want to match) and hitting enter would submit the form as usual, sometimes it would force me to select the first match.</p>
<p>Anyways, enough complaining, here&#8217;s the feature list:</p>
<ul>
<li>Smart cache system that takes a maximum cache size in bytes and uses <a href="http://en.wikipedia.org/wiki/Cache_algorithms">MRU</a> list to discard items. Oh, and the caching works correcly.</li>
<li>Doesn&#8217;t assume that you have to choose an item from the drop down list. If an item is selected and you hit enter or tab, that item is copied to the &lt;input&gt; element. Otherwise, hitting enter or tab works just like a normal &lt;input&gt; element.</li>
<li>Event handler for selecting a drop down item.</li>
<li>Works the same in Firefox, Safari, IE 6&amp;7.</li>
</ul>
<p>It&#8217;s really easy to use, here&#8217;s the code for the suggest box above:</p>
<p><code>jQuery(function() {<br />
jQuery("#suggest").suggest("files/search.php",{<br />
onSelect: function() {alert("You selected: " + this.value)}});<br />
});</code></p>
<p>Here&#8217;s the <a href="http://www.vulgarisoip.com/files/jquery.suggest.css">stylesheet</a> and the <a href="http://www.vulgarisoip.com/files/search.phps">source</a> for the PHP file (blatantly stolen from <a href="http://www.dyve.net/jquery/?autocomplete">autocomplete</a>) which returns the items. And finally, download the source to the <a href="http://www.vulgarisoip.com/files/jquery.suggest.js">suggest library here</a>. You can find more information about possible options at the bottom of the source.</p>
<p>The only requirement is <a href="http://code.jquery.com/jquery-latest.js">jQuery</a> itself and the <a href="http://dev.jquery.com/browser/trunk/plugins/dimensions/jquery.dimensions.js">dimensions</a> plugin, although the script will try to use the <a href="http://dev.jquery.com/browser/trunk/plugins/bgiframe/jquery.bgiframe.js">bgiframe</a> plugin if possible (to fix IE 6).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Execute JavaScript injected using innerHTML attribute, even with Safari</title>
		<link>http://www.vulgarisoip.com/2007/06/22/execute-javascript-injected-using-innerhtml-attribute-even-with-safari/</link>
		<comments>http://www.vulgarisoip.com/2007/06/22/execute-javascript-injected-using-innerhtml-attribute-even-with-safari/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 06:39:46 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/2007/06/22/execute-javascript-injected-using-innerhtml-attribute-even-with-safari/</guid>
		<description><![CDATA[A common AJAX technique is to return straight HTML and use the innerHTML element attribute to insert it into the DOM. Unfortunately, JavaScript inserted into the DOM this way (inside a &#60;script&#62; tag) will not execute in all browsers.
I found this out when trying to implement a dynamically changing PlotKit graph on my companies intranet [...]]]></description>
			<content:encoded><![CDATA[<p>A common AJAX technique is to return straight HTML and use the innerHTML element attribute to insert it into the DOM. Unfortunately, JavaScript inserted into the DOM this way (inside a &lt;script&gt; tag) will not execute in all browsers.</p>
<p>I found this out when trying to implement a dynamically changing <a href="http://www.liquidx.net/plotkit/">PlotKit</a> graph on my companies intranet site. It worked in Firefox (of course) and IE was coaxed into working be <a href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/innerhtml.asp">using the DEFER attribute</a>. But the best Safari could do was leave a big blank space where my beautiful graph should be. Even though there was probably only one other employee that used Safari, I knew there was no way this was going to stand. There must be a solution, right?</p>
<p>Some googling turned up <a href="http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/1ff1571335298030/9150ad93b408065c?lnk=st&amp;q=safari+innerhtml+script+element&amp;rnum=5&amp;hl=en#9150ad93b408065c">this posting</a>, where the problem was solved using a combination of cloneNode(), innerHTML and appendChild(). Fancy. It works with Opera and IE, <strong>but not with Safari</strong>.</p>
<p>Then, my eureka moment came. I replaced the &lt;script&gt; tag in the RPC with a &lt;div class=&#8221;javacript&#8221;&gt; tag, still keeping all the script inside the &lt;div&gt;. Next, I added <code>.javascript { display: none; }</code> to the style sheet and did some jQuery magic:</p>
<p><code>$('#ajaxLoading').ajaxStop(function() {<br />
$('.javascript').each(function() {<br />
eval($(this).text());<br />
});<br />
});</code></p>
<p>This simple function runs every time an AJAX call is completed and uses eval() to manually run the JavaScript. It&#8217;s ugly, it&#8217;s probably violating some sort of standard, but guess what? <strong>It works in Safari</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/06/22/execute-javascript-injected-using-innerhtml-attribute-even-with-safari/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;Minify&#8221; your external JavaScript and CSS with PHP</title>
		<link>http://www.vulgarisoip.com/2007/06/21/minify-your-external-javascript-and-css-with-php/</link>
		<comments>http://www.vulgarisoip.com/2007/06/21/minify-your-external-javascript-and-css-with-php/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 04:29:47 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/2007/06/21/minify-your-external-javascript-and-css-with-php/</guid>
		<description><![CDATA[First off, I have to say that most of the work that went into this project was already done for me by someone named rgrove. You can find the original (PHP 5) version of Minify here. All I&#8217;ve done is convert the code to run on servers still using PHP 4 (download here). This article [...]]]></description>
			<content:encoded><![CDATA[<p>First off, I have to say that most of the work that went into this project was already done for me by someone named <a href="http://code.google.com/u/rgrove/">rgrove</a>. You can find the original (PHP 5) version of Minify <a href="http://code.google.com/p/minify/">here</a>. All I&#8217;ve done is convert the code to run on servers still using PHP 4 (<a href="http://www.vulgarisoip.com/files/minify_php4.zip">download here</a>). This article presents a justification for using Minify over other techniques, and the results of converting <a href="http://www.appelrouthtutoring.com">www.appelrouthtutoring.com</a> to use the library.</p>
<p>Most modern web sites today are seperated into the three main parts: semantic HTML, presentational CSS and functional JavaScript. Any HTML page you visit can be supported by multiple CSS and JavaScript files, each one requiring it&#8217;s own HTTP connection and download. When a website starts using multiple style sheets and the latest fancy JavaScript libraries (I&#8217;m looking at you <a href="http://www.jquery.com">jQuery</a>, <a href="http://www.prototypejs.org/">Prototype</a>, <a href="http://mochikit.com/">MochiKit</a>, <a href="http://developer.yahoo.com/yui/">YUI</a>, <a href="http://extjs.com/">Ext</a>, <a href="http://dojotoolkit.org/">Dojo Toolkit</a>&#8230;) mixed with their own personal scripts, things can start getting pretty slow even on the fastest connections.</p>
<p>One solution is caching these files, but this still requires an HTTP connection every time the browser has to check for the latest versions. You could use an expiration time far off in the future, but you better make sure your code works perfectly the first time a user downloads it. Another problem with this technique is that pages served over HTTPS will never be cached; obviously for security reasons.</p>
<p>A second solution used by many major sites like <a href="http://www.google.com">Google</a> and by libraries like <a href="http://www.jquery.com">jQuery</a>, is to pre-compress any JavaScript so that file downloads are quicker. <a href="http://dean.edwards.name/packer/">Dean Edward&#8217;s packer</a> is an excellent tool in this regard. While this is a big help to anyone stuck with dial-up, users with fast connections will not notice a remarkable difference due to the identical latency for downloading an uncompressed or compressed JavaScript file. This also adds another step to the building, testing and deployment process because you definitely don&#8217;t want to be developing a site while debugging obfuscated code.</p>
<p>Minify is a PHP library that automates the process of concatenating and compressing multiple CSS and JavaScript files. This is a &#8220;free&#8221; way to improve the experience for anyone visiting your site; everything just loads faster. How much faster? Before I deployed the minified version of <a href="http://www.appelrouthtutoring.com">www.appelrouthtutoring.com</a>, I tested the average download time of the homepage with Fasterfox, a Firefox extension. I reloaded the homepage <strong>10 times</strong>, clearing the cache every time, and found the average load time to be <strong>3.343 seconds</strong>.</p>
<p>That would be a good average time for a content heavy site like <a href="http://www.cnn.com">www.cnn.com</a>, but not for the super simple mostly text web site I tested. After uploading the site using my modified Minify library, the average load time dropped to <strong>1.228 seconds</strong>. Again, that&#8217;s an average after 10 reloads with <strong>no caching</strong>. That&#8217;s a speedup of <strong>272%(!)</strong>, with absolutely no effect on the development process for the site.</p>
<p>I found a similar speedup on the intranet part of the site. Load time fell from an average of <strong>4.994 seconds</strong> to <strong>2.329 seconds</strong> (214% speedup!). While this doesn&#8217;t exactly double the productivity of employees using the intranet, it sure makes life a lot easier.</p>
<p>It&#8217;s code time (the exact code I use on the homepage):</p>
<p>[do this before writing any HTML]</p>
<p><code>require_once('minify_php4/minify.php');</code></p>
<p><code>// Create new Minify objects.<br />
$minifyCSS = new Minify(TYPE_CSS);<br />
$minifyJS  = new Minify(TYPE_JS);</code></p>
<p><code>// Specify the files to be minified.<br />
// Full URLs are allowed as long as they point<br />
// to the same server running Minify.<br />
$minifyCSS-&gt;addFile(array(<br />
'/styles/fonts.css',<br />
'/styles/nifty.css',<br />
'/styles/public.css',<br />
'/styles/calendar.css',<br />
'/styles/navigation.css'<br />
));</code></p>
<p><code>$minifyJS-&gt;addFile(array(<br />
'/scripts/jquery.js',<br />
'/scripts/nifty.js',<br />
'/scripts/public.js'<br />
));</code></p>
<p>[do this in &lt;head&gt;]</p>
<p><code>&lt;style type="text/css"&gt;&lt;?php<br />
echo $minifyCSS-&gt;combine();<br />
?&gt;&lt;/style&gt;<br />
&lt;script type="text/javascript"&gt;&lt;?php<br />
echo $minifyJS-&gt;combine();<br />
?&gt;&lt;/script&gt;</code></p>
<p>It&#8217;s so easy, it should be a crime to load multiple external files the old-fashioned way. Let&#8217;s all make the web a better place and start cutting down those load times!</p>
<p><a href="http://www.vulgarisoip.com/files/minify_php4.zip">Get the source here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/06/21/minify-your-external-javascript-and-css-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery focus plugin available</title>
		<link>http://www.vulgarisoip.com/2007/02/22/jquery-focus-plugin-available/</link>
		<comments>http://www.vulgarisoip.com/2007/02/22/jquery-focus-plugin-available/#comments</comments>
		<pubDate>Thu, 22 Feb 2007 18:59:42 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/?p=21</guid>
		<description><![CDATA[Update (June 21, 2007): I&#8217;ve deleted the links to the jQuery.focus() plugin and jQuery page (for now). You&#8217;ll find BlockUI to be a MUCH better and MORE complete jQuery solution. I&#8217;ve removed jQuery.focus() out of humility.
If you look in the new jQuery tab you&#8217;ll see my first released plugin for jQuery: jQuery.focus(). I know, jQuery [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update (June 21, 2007):</strong> I&#8217;ve deleted the links to the jQuery.focus() plugin and jQuery page (for now). You&#8217;ll find <a href="http://malsup.com/jquery/block/">BlockUI</a> to be a MUCH better and MORE complete jQuery solution. I&#8217;ve removed jQuery.focus() out of humility.</p>
<p>If you look in the new jQuery tab you&#8217;ll see my first released plugin for jQuery: jQuery.focus(). I know, jQuery already has a .focus() method. But that only works on &lt;input&gt;&#8217;s, now it works for everything! It creates a nice fade effect that blocks out everything on site EXCEPT for the element you .focus(). Click here to see a demonstration and please let me know if you find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/02/22/jquery-focus-plugin-available/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scripting with jQuery or: How I Learned to Stop Worrying and Love the DOM</title>
		<link>http://www.vulgarisoip.com/2007/01/29/scripting-with-jquery-how-i-learned-to-stop-worrying-and-love-the-dom/</link>
		<comments>http://www.vulgarisoip.com/2007/01/29/scripting-with-jquery-how-i-learned-to-stop-worrying-and-love-the-dom/#comments</comments>
		<pubDate>Mon, 29 Jan 2007 20:57:49 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/?p=18</guid>
		<description><![CDATA[To understand my new found infatuation with jQuery, I&#8217;d like to begin with a story about the problem that led to this posting.
The :hover pseudo-selector is one of the most powerful tools when working with a CSS compliant browser. With it, you can create rollovers, menus and other visual tricks without resorting to the &#8220;messiness&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>To understand my new found infatuation with jQuery, I&#8217;d like to begin with a story about the problem that led to this posting.</p>
<p>The :hover pseudo-selector is one of the most powerful tools when working with a CSS compliant browser. With it, you can create rollovers, menus and other visual tricks without resorting to the &#8220;messiness&#8221; of Javascript. Tiny pieces of interactive logic describing complicated visual states can be included as snippets of text that <strong>even</strong> your designer can understand and use. If only it were that easy.</p>
<p>Because of IE&#8217;s limits, an entire generation of web developers have learned to use anchors (&lt;a&gt;&#8217;s) for everything from menu items to blocks of text. Clearly, these are not the applications this element was semantically design for. Up until version 7, Internet Explorer never allowed you (the highly competent web developer that you are!) to use :hover selectors for anything except anchors. Of course you could always just use javascript to manually attach effects to a particular element, but that seems ridiculous when you end up having to write dozens of lines of code just to get 4 list items (&lt;li&gt;&#8217;s) to change classes on mouse over. <a href="http://www.alistapart.com">A List Apart</a> is a site that I look to for direction when simplifying a design, but even <a href="http://alistapart.com/articles/horizdropdowns">their solutions</a> to this problem makes me cringe.</p>
<blockquote><p><strong>Me:</strong> Now that I&#8217;ve laid out the problem, can you guess the solution?</p>
<p><strong>You:</strong> jQuery, of course!!!</p>
<p><strong>Me:</strong> Nope, what the heck is jQuery? Anyways, I&#8217;m going to write a super awesome script that just plugs into any project, re-downloads all the CSS files using bleeding edge AJAX code, parses that CSS using only the tightest regular expresssions, and then shoves all those :hover&#8217;s down IE&#8217;s throat.</p></blockquote>
<p><a href="http://www.vulgarisoip.com/files/fixCSS.js">Here it is.</a> I even had the temerity to name it &#8220;fixCSS&#8221; because I thought that a couple pages of Javascript code would unify every browser on the market and allow anyone to use use compliant CSS blissfully unaware that there was any sort of scripting on the site.</p>
<p>It works too, go ahead. Download it, add <a href="http://www.prototypejs.org/">Prototype.js</a>, put some :hover&#8217;s in your CSS, fire up IE in your favorite virtual machine (you aren&#8217;t running IE locally are you?!?!) and wait for the page to load. It just works.</p>
<p>But there&#8217;s a problem. If you created a simple test with one small CSS file and one small HTML file and ran it on your local development server you probably didn&#8217;t notice it. But if you are running on a busy server with multiple CSS files and another 100k of html and images, you are definately going to notice something is wrong with IE. For about 2-3 seconds nothing seems to work. You can move the mouse and click, but rollovers don&#8217;t work, clicking doesn&#8217;t work and hell, the mouse cursor doesn&#8217;t even change over links. Then suddenly, after a couple of seconds of violently swinging your mouse back and forth across the screen, menus start dropping down and you can safely navigate to another page. And when you do, guess what happens&#8230;</p>
<p>You see, before writing this script I forgot the cardinal rule of web programming: implementation doesn&#8217;t matter, speed does. Visitors to your site don&#8217;t care if your CSS is the pinnacle of seperation of presentation and content, they care if they care about using your site. And compared to loading for 2 seconds, loading for 5 seconds is an eternity.</p>
<p>I learned this the hard way after 1 day of visitors using this script. My site needed a rewrite, fast, and I thought it would be a good opportunity to put into use a very interesting library: <a href="http://jquery.com/">jQuery</a>.</p>
<p>I had come across jQuery when I began planning phase 2 of fixCSS: more selectors! I was going to fix &gt;, +, [], and any other symbol I could find on my keyboard that IE didn&#8217;t respond to in CSS files. By this time I realized that simple parsing of the CSS files wasn&#8217;t going to be powerful enough, I needed a CSS interpreter in Javascript. Prototype, another popular and powerful Javascript library, at the time had a function called $$(). In theory, you supply this function with a CSS selector and get back a nice array of elements. In practice, I supplied it with CSS selectors and got back hours of frustration.</p>
<p>I then began to scour the net for a single function that could do what I required. I don&#8217;t remember how I first came across jQuery, but I do remember the initially feelings I had when I wrote this:</p>
<p><code>$('ul .menu_item').hover(function() {<br />
$(this).addClass('hover');<br />
}, function() {<br />
$(this).removeClass('hover');<br />
})</code></p>
<p>If you&#8217;ve ever programmed anything in your life, you can guess what this does. Upon seeing code like this and thinking about the days I had wasted on fixCSS, I almost became depressed. I immediately deleted fixCSS.js (just to get you guys a copy I had to look through my old CVS repos) and Prototype, rewrote all my Javascript into a few small snippets of code and ended up cutting <strong>50kb</strong>(!) from the average page I was working on.</p>
<p>It&#8217;s all so clear to me now. There&#8217;s no reason (and no possible way) to implement a real-time CSS file interpreter for web sites. The ability to decode CSS selectors in Javascript provides a common language for those designing a site and those developing it. By incorporating style selectors with powerfully augmented DOM elements and lot&#8217;s of functions mapping onto arrays, jQuery has boiled down site scripting to it&#8217;s core: select some nodes, select the event you want to capture (optional!) and do some logic. I&#8217;ve learned that it&#8217;s alright to use Javascript to make up for the inadequecies of Microsoft, Apple and all those other bastards. Learn to forget about which browser you&#8217;re using, try jQuery on your next site and you&#8217;ll see that scripting can be fun again.</p>
<p>[tags]jquery, hover, selectors, css, javascript, dom, prototype[/tags]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2007/01/29/scripting-with-jquery-how-i-learned-to-stop-worrying-and-love-the-dom/feed/</wfw:commentRss>
		</item>
		<item>
		<title>UPDATE: Send email with PHP and GMail hosted for your domain</title>
		<link>http://www.vulgarisoip.com/2006/10/13/update-send-email-with-php-and-gmail-hosted-for-your-domain/</link>
		<comments>http://www.vulgarisoip.com/2006/10/13/update-send-email-with-php-and-gmail-hosted-for-your-domain/#comments</comments>
		<pubDate>Sat, 14 Oct 2006 04:47:50 +0000</pubDate>
		<dc:creator>pvulgaris</dc:creator>
		
		<category><![CDATA[GMail]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[phpgmailer]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/?p=17</guid>
		<description><![CDATA[Due to the amount of requests emailed to me for working source code I have now posted the modified PHPMailer I use in my own projects. Click here to download the library. Here&#8217;s an example of how to use the code:
require_once('/phpgmailer/class.phpgmailer.php');
$mail = new PHPGMailer();
$mail-&#62;Username = 'user@domain.com'; 
$mail-&#62;Password = 'password';
$mail-&#62;From = 'user@domain.com'; 
$mail-&#62;FromName = 'User Name';
$mail-&#62;Subject [...]]]></description>
			<content:encoded><![CDATA[<p>Due to the amount of requests emailed to me for working source code I have now posted the modified <a href="http://phpmailer.sourceforge.net/">PHPMailer</a> I use in my own projects. <a href="http://www.vulgarisoip.com/files/phpgmailer.zip">Click here</a> to download the library. Here&#8217;s an example of how to use the code:</p>
<p><code>require_once('/phpgmailer/class.phpgmailer.php');</code><br />
<code>$mail = new PHPGMailer();</code><br />
<code>$mail-&gt;Username = 'user@domain.com'; </code><br />
<code>$mail-&gt;Password = 'password';</code><br />
<code>$mail-&gt;From = 'user@domain.com'; </code><br />
<code>$mail-&gt;FromName = 'User Name';</code><br />
<code>$mail-&gt;Subject = 'Subject';</code><br />
<code>$mail-&gt;AddAddress('myfriend@domain.com');</code><br />
<code>$mail-&gt;Body = 'Hey buddy, here's an email!';</code><br />
<code>$mail-&gt;Send();</code></p>
<p>This will work for any GMail or <a href="http://www.google.com/hosted">Google Hosted</a> email account. Just make sure to include the @domain.com part for the username, even if it&#8217;s for standard GMail. Hope this saves people some hastle.</p>
<p>[tags]gmail, php, google, phpmailer[/tags]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2006/10/13/update-send-email-with-php-and-gmail-hosted-for-your-domain/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Handling multiple web development projects using VMware</title>
		<link>http://www.vulgarisoip.com/2006/09/19/handling-multiple-web-development-projects-using-vmware/</link>
		<comments>http://www.vulgarisoip.com/2006/09/19/handling-multiple-web-development-projects-using-vmware/#comments</comments>
		<pubDate>Tue, 19 Sep 2006 22:40:42 +0000</pubDate>
		<dc:creator>vulgarisoip</dc:creator>
		
		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[VMWare]]></category>

		<category><![CDATA[XAMPP]]></category>

		<guid isPermaLink="false">http://www.vulgarisoip.com/?p=16</guid>
		<description><![CDATA[This morning a client that I&#8217;m currently developing for called me to inform me that they needed to use their web application immediately. I had to host it for them myself as they didn&#8217;t have their own server, but I was already working on another project that I was already hosting.
Normally this involves editting my [...]]]></description>
			<content:encoded><![CDATA[<p>This morning a client that I&#8217;m currently developing for called me to inform me that they needed to use their web application immediately. I had to host it for them myself as they didn&#8217;t have their own server, but I was already working on another project that I was already hosting.</p>
<p>Normally this involves editting my httpd.conf file, adding a virtual server, messing with the firewall and restarting Apache. But today I decided to try something new: setup a VMware Workstation session running Ubuntu server and use the Shared Folders feature to link my project to the document root. I&#8217;ve been really pleased with the results and now, if I need to setup another server for a client, I can just clone my current session, share another project folder and it&#8217;s up in minutes.</p>
<p>For me, the biggest upside to doing it this way is that each application can assume they are running with default settings including standard HTTP/S ports. This means no fancy setup of name servers when you are trying to host multiple sites, each with SSL. Another nice thing is the added security between clients who are now partitioned into their own virtual servers and not having to restart Apache or MySQL for all your other projects. It&#8217;s real easy, here&#8217;s how I did it:</p>
<ol>
<li><strong>Install VMware and get it running</strong><br /> Go to <a href="www.vmware.com">www.vmware.com</a>, create a profile and get a VMware Workstation key, download the program and follow the instructions. Setting it up has never been a problem and is kind of beyond the scope of this article, just don&#8217;t forget to run <code>vmware-config-tools.pl</code> after installing it.</li>
<li><strong>Download Ubuntu Server and install it</strong><br /> Head over to <a href="http://www.ubuntu.com/server">http://www.ubuntu.com/server</a> and follow the links to download the SERVER version of Ubuntu, the standard version has too much stuff we don&#8217;t need. Create a new VMware session (make sure to choose Linux, or specifically Ubuntu as the OS) and remove the sound and floppy hardware in the session settings. In the cdrom settings, make sure the device is pointed to the ISO you just downloaded. Boot up the machine and keep hitting enter until you&#8217;re done (you may to choose &#8216;yes&#8217; instead of &#8216;no&#8217; once during the partitioning sequence). I chose not to install the LAMP version because I&#8217;m going to download <a href="http://www.apachefriends.org/en/xampp.html">xampp</a> to host the web site, but do whatever you&#8217;re more comfortable with. The whole installation process took about 10 minutes on my 2.6 GHz P4 dual-core with 2 gigs of RAM, but VMware&#8217;s cloning feature means you only have to go through this once. I suggest you update the system with a <code>sudo apt-get upgrade</code> upon logging on for the first time.</li>
<li><strong>Setup XAMPP (or roll your own LAMP)</strong><br /> Over time I&#8217;ve found that downloading <a href="http://www.apachefriends.org/en/xampp.html">xampp</a>, untarring it, and running <code>sudo /opt/lampp/lampp start</code> is a lot easier than setting up Apache, PHP and MySQL seperately. The easiest way to download xampp to the Ubuntu server session is to find a mirror from sourceforge and use wget. For example, here&#8217;s how I installed it from the command prompt:
<p><code>wget http://superb-west.dl.sourceforge.net/sourceforge/xampp/xampp-linux-1.5.4.tar.gz</code><br />
<code>sudo tar xvfz xampp-linux-1.5.4.tar.gz -C /opt</code><br />
<code>sudo /opt/lampp/lampp start</code></li>
<li><strong>Setup the shared folder for the document root</strong><br /> Before you can install VMware tools and allow folders to be shared, you have to download the right tools. Enter this at the command prompt:
<p><code>sudo apt-get install make gcc linux-headers-`uname -r` build-essential xinetd</code></p>
<p>Now, to install VMware tools, on the menu bar click &#8216;VM&#8217; and then &#8216;Install VMware Tools&#8230;&#8217;. This will load the tools on a CD on your session. To actually instally the tools run these commands:</p>
<p><code>sudo mount /dev/cdrom<br />
cd /tmp<br />
tar zxf /media/cdrom0/vmware-linux-tools.tar.gz<br />
umount /dev/cdrom<br />
cd vmware-tools-distrib<br />
sudo ./vmware-install.pl<br />
</code></p>
<p>To share the folder find the menu bar, click on &#8216;VM&#8217;, click on &#8216;Settings&#8230;&#8217;, click on &#8216;Options&#8217;, click on &#8216;Shared folders&#8217; and finally click &#8216;Add&#8230;&#8217;. Enter a name for the folder, find your project directory and hit &#8216;OK&#8217;. Your project directory will now be located in the Ubuntu session at: <code>/mnt/hgfs/[your project directory]</code>. If you are using xampp, you can point your htdocs directory here by typing the following:</p>
<p><code>sudo rm -rf /opt/lampp/htdocs<br />
sudo ln -s /mnt/hgfs/[your project directory] /opt/lampp/htdocs</code></li>
</ol>
<p>That&#8217;s it! If you don&#8217;t want to go through all the hastle again, I suggest you clone your VMware session now and just keep cloning it everytime you want to make a new server. To view the web site, just point your browser to the server&#8217;s IP address. Let me know what you think, I&#8217;m off to create a new session to host my own Wordpress blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vulgarisoip.com/2006/09/19/handling-multiple-web-development-projects-using-vmware/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
