<?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>Jasongraphix &#187; Code</title>
	<atom:link href="http://jasongraphix.com/journal/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://jasongraphix.com</link>
	<description>A journal of art, thoughts, and projects by Jason Beaird.</description>
	<lastBuildDate>Sun, 29 Jan 2012 03:39:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>View Multiple Link BGs</title>
		<link>http://jasongraphix.com/journal/view-multiple-link-bgs/</link>
		<comments>http://jasongraphix.com/journal/view-multiple-link-bgs/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 15:14:51 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Background]]></category>
		<category><![CDATA[background image]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firefox extension]]></category>
		<category><![CDATA[firefox extensions]]></category>
		<category><![CDATA[multiple backgrounds]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://jasongraphix.com/?p=873</guid>
		<description><![CDATA[Have you ever right-clicked on a website graphic in Firefox expecting to find that handy &#8220;View Background Image&#8221; context menu item only to realize it wasn&#8217;t there because the element you right-clicked on was a link? No? Well it happens to me all the time. A little over a year ago I made a little [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="View Link Background Image" src="http://static.jasongraphix.com/uploads/viewlinkbgimag.png" width="293" height="269" class="floatright border" />Have you ever right-clicked on a website graphic in Firefox expecting to find that handy &#8220;View Background Image&#8221; context menu item only to realize it wasn&#8217;t there because the element you right-clicked on was a link? No? Well it happens to me all the time. A little over a year ago I made a <a href="http://www.jasongraphix.com/downloads/linkbackimage/" rel="external">little Firefox extension</a> to add that functionality for links. </p>
<p>Ever since Firefox 3.6 came out though, my little extension has been broken. I had no idea why until I dug into the JavaScript and discovered that Firefox was returning the CSS background image URL as <code>url("imageurl")</code> instead of <code>url(imageurl)</code>. Stripping the double quotes was an easy fix but I also knew that FF 3.6 supported <a href="http://snook.ca/archives/html_and_css/multiple-bg-css-gradients" rel="external">multiple backgrounds</a>. Out of curiosity I set up a little html link styled with 2 background images and to my surprise <code>getPropertyValue("background-image")</code> returned <code>url("imageurl1"), url("imageurl2")</code>. Sweet! A few more lines of JavaScript and not only did the extension work again, but <em>it works on links with multiple background images</em>!</p>
<p><a href="http://www.jasongraphix.com/downloads/linkbackimage/" rel="external">Grab v1.8 of View Link Background Image</a></p>
<h4>Now for the sad part&#8230;</h4>
<p>As I was experimenting with multiple background image support in Firefox 3.6, I discovered that the &#8220;View Background Image&#8221; context menu item is now missing when you right-click on elements that have multiple backgrounds. While the extension update adds the ability to see all the backgrounds applied to a link, Firefox itself lacks the ability to do the same for other elements. I&#8217;m sure I can take care of that with another extension update. For now though, I&#8217;m just happy to say it works again.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/view-multiple-link-bgs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Directory</title>
		<link>http://jasongraphix.com/journal/mobile-directory/</link>
		<comments>http://jasongraphix.com/journal/mobile-directory/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 17:07:25 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[directiry]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://jasongraphix.com/?p=508</guid>
		<description><![CDATA[Here at Cyberwoven, everybody has a little sheet of paper on their desk that lists all of the office phone extensions. That little sheet of paper is useful, but very limited in the amount of information it can convey. Many of us in the office have iPhones, so I thought it might be fun to [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">
// <![CDATA[ 
document.domain="jasongraphix.com"; 
// ]]&gt;</script><object type="text/html" width="350" height="480" data="http://www.jasongraphix.com/sandbox/directory/" style="float:right; border:5px solid #1f1e36; margin:0 -100px 10px 10px;"></object>Here at Cyberwoven, everybody has a little sheet of paper on their desk that lists all of the office phone extensions. That little sheet of paper is useful, but very limited in the amount of information it can convey. Many of us in the office have iPhones, so I thought it might be fun to create a simple mobile directory page. </p>
<p>Over the course of a lunch break I created a webpage with a simple list that showed exactly what the extension sheet had on it, making each <code>&lt;li&gt;</code> expand on click to show more contact information: cell number, email, twitter, website, instant messenger, etc. This webpage was similar to any other wepage really except that it was a little narrower and contained 2 extra lines of meta data in the header:</p>
<p><code>&lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt;</code><br />
<br />
<code>&lt;meta name="viewport" content="width=device-width, height=device-height, user-scalable=no"/&gt;</code></p>
<p>I learned about the first meta tag from <a href="http://daringfireball.net/linked/2008/10/03/fullscreen-iphone-web-apps" rel="external">a short post</a> on Daring Fireball a while back. It&#8217;s just a simple tag that loads pages added to your home screen as a standalone app; without the standard Safari chrome. The viewport meta tag just defines some rules for the display of the page. By setting the width and height to device-width and device-height, I&#8217;m just forcing the page to fit to the viewport whether it&#8217;s in portrait or landscape mode. Setting user-scalable to &#8220;no&#8221; just prevents the user from zooming in or out, which is acceptable since I&#8217;m designing the content to fit the screen. You can learn more about these meta tags (and a lot of other great iPhone mobile app tips) from the <a href="http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariHTMLRef/Introduction.html">HTML section</a> of Apple&#8217;s Safari Reference Library</a>.</p>
<p>As I mentioned above, those two meta tags are really the only iPhone specific bits in this simple web application. The rest is just plain ole&#8217; HTML, CSS and jQuery with a smidge of PHP just to handle some variables and authentication. Rather than explaining all that I&#8217;ll just let you grab the demo. Feel free to use this as is or modify it to your heart&#8217;s content. I used an HTML file to store the directory data, but this example could easily be modified to pull from an XML file or from a database.</p>
<p><strong><a href="/sandbox/directory/mobiledirectory.zip">Download Mobile Directory Demo</a> &#8211; Zip (28KB)</strong><br />
<a href="/sandbox/directory/" rel="external">View the Demo</a> (password is &#8220;stapler&#8221;)</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/mobile-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Link Background Image</title>
		<link>http://jasongraphix.com/journal/link-background-image/</link>
		<comments>http://jasongraphix.com/journal/link-background-image/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 19:32:32 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[background image]]></category>
		<category><![CDATA[background image on link]]></category>
		<category><![CDATA[firefox extension]]></category>
		<category><![CDATA[linkbackimage]]></category>
		<category><![CDATA[view background image]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/link-background-image/</guid>
		<description><![CDATA[Update 2/11/2010: Added support for Multiple Background Images Over a year ago I posted about the lack of a View Background Image option in Firefox when right-clicking on links. As a web designer, I use that context menu item on a regular basis, so for it to not be there for links seemed like a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 2/11/2010:</strong> <a href="http://jasongraphix.com/journal/view-multiple-link-bgs/">Added support for Multiple Background Images</a></p>
<p>Over a year ago I <a href="/archive/2007/07/view_background">posted</a> about the lack of a <strong>View Background Image</strong> option in Firefox when right-clicking on links.  As a web designer, I use that context menu item on a regular basis, so for it to not be there for links seemed like a glaring omission.</p>
<p>To my surprise, a <a target="_blank" title="James Booker" href="http://www.jamesbooker.co.uk/">very kind volunteer</a> came to the rescue with a head-start on an extension and an invitation to improve on it.  The problem was that his simple extension did exactly what I wanted it to.  When you right-clicked on a link, there was a &#8220;View Background Image&#8221; item that, when you clicked on it, linked to the CSS background-image of that element.</p>
<p>I didn&#8217;t feel the need to improve on James&#8217; extension until it stopped working in Firefox3. Yes, there are many other ways of discovering the background-image of an element in Firefox (specifically through <a title="You need this extension." target="_blank" href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug</a> and the <a title="You need this extension too..." target="_blank" href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer Toolbar</a>) but I wanted my context menu item back, so I dove into the extensions folder and added the following functionality:</p>
<ul>
<li>It checks for a background image on the link you right-clicked on.</li>
<li>If it&#8230;
<ul>
<li>Finds an image: You get a &#8220;View Link Background Image&#8221; context menu item.</li>
<li>Doesn&#8217;t find an image, but finds one on its immediate parent: You get a &#8220;View Parent Background Image&#8221; context menu item.</li>
<li>Finds no image on the link or its immediate parent: You get a disabled &#8220;View Link Background Image&#8221; context menu item.</li>
</ul>
</li>
</ul>
<p>While it doesn&#8217;t seem like a mission-critical extension, I&#8217;ve started relying on it for my day-to-day work and thought you might find it useful as well.</p>
<p>So without further ado, you can <strong><a href="/downloads/linkbackimage/">download the extension here</a></strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/link-background-image/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Date-Ahh</title>
		<link>http://jasongraphix.com/journal/date-ahh/</link>
		<comments>http://jasongraphix.com/journal/date-ahh/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 02:30:35 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[data visualization]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[play]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/date-ahh/</guid>
		<description><![CDATA[This is really random, but any date written out in mmddyy format could be used as a unique hexadecimal RGB color code. Today&#8217;s date for instance could be represented as #081508. Because of the linear and cyclical nature of time, I thought it would be interesting to see what a series of dates would look [...]]]></description>
			<content:encoded><![CDATA[<p>This is really random, but any date written out in mmddyy format could be used as a unique hexadecimal RGB color code.  Today&#8217;s date for instance could be represented as <span style="color:#081508;">#081508</span>.  Because of the linear and cyclical nature of time, I thought it would be interesting to see what a series of dates would look like represented by blocks colored with the hex code for each day.</p>
<p>This was surprisingly easy to do in php:</p>
<pre lang="php">
$first_date = "2008-01-01";
$end_date = "2009-12-31";
$alpha = strtotime($first_date);
$omega = strtotime($end_date);
while($alpha &lt;= $omega){
$ufirst = strtotime("+1 day", $alpha);
$formatted = date("m/d/Y", $alpha);
$color = date("mdy", $alpha);
echo '&lt;div class="day" style="background-color:#'.$color.'" title="'.$formatted.'"&lt;&amp;nbsp;&lt;/div&gt;';
}
</pre>
<p>I made a little <a href="/sandbox/colorfuldates/">demo page</a> where you can see what any year (between 1970 and 2037 &#8211; the boundaries of php strtotime) looks like. I also made another page the just shows the <a href="/sandbox/colorfuldates/10.php">last 10 years</a>.</p>
<p><img src="http://static.jasongraphix.com/uploads/dateahh.png" class="border" width="420" height="830" alt="Dateahh!" /></p>
<p>I chose to show 10 years so that I&#8217;d get a little bit of the 90s in there, which obviously produce a much brighter blue color.  If I were able to render 100 years this way, it would be a very subtle gradient from the dark greens all the way to that bright blue you see at the top.  Yea, it&#8217;s mostly useless, but I thought it was an interesting way to visualize data.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/date-ahh/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Textbox Hints</title>
		<link>http://jasongraphix.com/journal/textbox-hints/</link>
		<comments>http://jasongraphix.com/journal/textbox-hints/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 20:14:58 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[password box]]></category>
		<category><![CDATA[textbox]]></category>
		<category><![CDATA[textbox hints]]></category>
		<category><![CDATA[textbox value]]></category>
		<category><![CDATA[type="password"]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/textbox-hints/</guid>
		<description><![CDATA[Update 6/4/09: I just wrote a new blog post about using the title attribute as the hint text. The method described below is still practical for some forms, but using the title text is a more practical and widely-applicable method of providing textbox hints. Check out the new post. There are typically only two types [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 6/4/09:</strong> I just wrote a new blog post about using the title attribute as the hint text. The method described below is still practical for some forms, but using the title text is a more practical and widely-applicable method of providing textbox hints. Check out <a href="http://jasongraphix.com/journal/title-based-textbox-hints/">the new post.</a></p>
<p>There are typically only two types of forms that tend to get squeezed into tight quarters in page layouts: login, and search. For this reason, web designers are often tempted to save space by hiding the labels on these forms and assuming that a user will intuitively know what to type into each textbox.  With a simple search form, this is logical because you have a textbox next to a button that says &#8220;Search&#8221;, &#8220;Go&#8221;, or perhaps &#8220;I&#8217;m feeling Lucky&#8221;. Login forms are a little trickier.  For most of us, seeing two text boxes and a &#8220;login&#8221; button is all we need to play McGyver, but the average user often needs those &#8220;Username:&#8221; and &#8220;Password:&#8221; labels to know what to enter.</p>
<p>A common solution to this problem is to use javascript to show and hide &#8220;hints&#8221;. This is one of those tasks that has a dozen different (perfectly acceptable) methods, and everyone tends to stand behind their choice as boldly as they do their favorite presidential candidate. I&#8217;ve tried a few of these methods, but because I tend to do it a bit differently, I thought I&#8217;d share.</p>
<p>Most of the solutions out there either insert a value into the textbox or they move around a label.  Inserting a value into a textbox is the most obvious/common solution and has its pros and cons, but the deal breaker is the fact that a value inserted into a password box will still display as dots/asterisks. As far as I know, you can&#8217;t dynamically change the type of an input from <code>password</code> to <code>text</code>, so that solution is out.  Moving around a label tag is something I first read about on the ALA article: <a href="http://www.alistapart.com/articles/makingcompactformsmoreaccessible">Making Compact Forms More Accessible</a>. It&#8217;s an ingenious idea really, but:</p>
<ol>
<li>I usually only need to make compact login forms, so it doesn&#8217;t have to be portable across other types of forms.</li>
<li>The area for the form typically won&#8217;t accommodate leaving the labels in place for users without javascript.</li>
<li>Occasionally I like to use a different font for the login box hints to make it jive with a home page design.</li>
</ol>
<p>With those things in mind, I decided to try using a background image for on the textbox instead of the label.  Also, I tend to incorporate jQuery into most projects lately, so it made sense for me to write it in that &#8211; although it could just as easily be rewritten as straight Javascript if necessary.</p>
<p><strong><a href="/sandbox/textboxhints/">Check out the working demo.</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/textbox-hints/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>View Background Image</title>
		<link>http://jasongraphix.com/journal/view-background-image/</link>
		<comments>http://jasongraphix.com/journal/view-background-image/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 18:32:12 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[background image]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firefox extensions]]></category>
		<category><![CDATA[link background]]></category>
		<category><![CDATA[view background image]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/view-background-image/</guid>
		<description><![CDATA[Update 11/5/2008: There&#8217;s now an extension for this! Of all the context menus in Firefox, my second most-clicked item (behind View Page Source) is View Background Image. This stock functionality is one of the many reason I still prefer to use Firefox over Safari, even though Safari&#8217;s rendering is notably faster. The problem I have [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 11/5/2008:</strong> <a href="http://jasongraphix.com/journal/link-background-image/">There&#8217;s now an extension for this!</a></p>
<p><img alt="View Background Image of a Link" src="http://static.jasongraphix.com/uploads/view-background-image.jpg" width="216" height="375" align="right" class="border" /></p>
<p>Of all the context menus in Firefox, my second most-clicked item (behind <em>View Page Source</em>) is <em>View Background Image</em>. This stock functionality is one of the many reason I still prefer to use Firefox over Safari, even though Safari&#8217;s rendering is notably faster. The problem I have with <em>View Background Image</em> though is that the image I want to view is often associated with a link element. When you right-click on a link though, this menu item is sadly missing.</p>
<p>The only alternative I&#8217;ve found, short of digging around in the page source and CSS, involves the <a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer Toolbar</a>.  If you have this extension installed, you can click on <em>Images &raquo; View Image Information</em> to see a list of all background images that are associated with the page you are viewing. That usually does the trick, but it would be much more ideal if there were an extension that just makes <em>View Background Image</em> work on links.  After all of my searching and discussions with friends and coworkers I&#8217;ve concluded that there is no extension out there that can make this happen.  I&#8217;ve never made a Firefox extension before, but I have toyed around with Javascript/XUL and could probably figure it out if I get desperate enough.  Before I attempt this though, I figured I&#8217;d ask, &#8220;What do you do when you want to see the background image of a link?&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/view-background-image/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Sorting Time Strings</title>
		<link>http://jasongraphix.com/journal/sorting-time-strings/</link>
		<comments>http://jasongraphix.com/journal/sorting-time-strings/#comments</comments>
		<pubDate>Mon, 11 Dec 2006 21:40:26 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[am]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[order by]]></category>
		<category><![CDATA[pm]]></category>
		<category><![CDATA[sorting time]]></category>
		<category><![CDATA[sorting time strings]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/sorting-time-strings/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>OK, so I&#8217;m working on a MySQL database of tour reservations that has time values stored as strings in an AM/PM time format.  The hour portion of the value does not contain a leading 0, so &#8220;6:00 AM&#8221;, &#8220;11:35 AM&#8221;, &#8220;4:45 PM&#8221; are all possible values. I&#8217;ve written a query to pull a sorted list of the unique tour times from the database that looks something like this:</p>
<pre>
SELECT DISTINCT reservation_time,
FROM reservations
WHERE DATEDIFF(reservation_date, '2006-12-11')=0
AND is_canceled=0
ORDER BY SUBSTRING(reservation_time, -2),
CAST(SUBSTRING_INDEX(reservation_time,':',1 ) AS UNSIGNED),
CAST(SUBSTRING(reservation_time,-5, 2) AS UNSIGNED);
</pre>
<p>My problem is what follows the <code>ORDER BY</code> statement.  I&#8217;m sorting the list of time values 3 times: first by the last 2 digits of the time (AM or PM), then by the hour, then by the minutes.  I can&#8217;t use SUBSTRING( reservation_time, 2 ) to get the hour value because some have one digit and some have 2.  This also means I have to get the minutes by counting from the right side instead of from the left. My question, to all my SQL fluent friends out there is whether or not this is the best way to get this data. Ordering the data 3 times seems a bit inefficient, but then I&#8217;m no SQL wizard.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/sorting-time-strings/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ActiveX Update Woes</title>
		<link>http://jasongraphix.com/journal/activex-update-woes/</link>
		<comments>http://jasongraphix.com/journal/activex-update-woes/#comments</comments>
		<pubDate>Wed, 05 Apr 2006 21:42:11 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[activeX]]></category>
		<category><![CDATA[activex update]]></category>
		<category><![CDATA[eolas]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[infringement]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/activex-update-woes/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>Are all of your client sites April 11th Compliant?  I&#8217;ve spent much of my day so far going through client websites (many of which <a href="http://www.ericksonmarketing.com" title="Erickson Marketing Studio, LLC">we</a> didn&#8217;t even build) looking for instances of applet, object and embed tags (mostly flash) to make sure they won&#8217;t break on April 11th.  On that day, Microsoft will be releasing a security update for IE containing a particularly annoying <a href="http://support.microsoft.com/kb/912945">ActiveX update</a>.  Any ActiveX control that a user interacts with will now need to be activated.  For instance, if you have a flash movie or multimedia object and a user clicks on it, they will get a nice message like this:</p>
<div align="center"><img src="http://static.jasongraphix.com/uploads/activexactivation.gif" width="350" height="213" alt="ActiveX Activation" /></div>
</p>
<p>One way of avoiding this annoying activation routine is to call your objects via an external script file.  Fortunately we&#8217;ve been doing this at work with our flash files for quite a while using Geoff Stearns&#8217; <a href="http://blog.deconcept.com/flashobject/">FlashObject</a>.  By using FlashObject, swf files will not require activation and users will be able to interact with the flash just as if they never got that silly ActiveX update.</p>
<p>So why is all this happening and who should we blame?  You guessed it. Micro$oft:</p>
<blockquote><p>A jury in 2003 found that Microsoft&#8217;s Internet Explorer browser infringed on a patent owned by Eolas and the University of California. The software vendor was ordered to pay $521 million in damages. Microsoft has vowed to fight the ruling, but so far has been unsuccessful in getting the patent invalidated. &#8211; <a href="http://www.toptechnews.com/story.xhtml?story_id=13200003C9IO">Click here to read the full story at Top Tech News</a></p></blockquote>
<p>Thank you Microsoft! To read more about making your sites April 11th compliant, visit the msdn page: <a href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp">Activating ActiveX Controls</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/activex-update-woes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>nearestSentence Function</title>
		<link>http://jasongraphix.com/journal/nearestsentence-function/</link>
		<comments>http://jasongraphix.com/journal/nearestsentence-function/#comments</comments>
		<pubDate>Mon, 20 Mar 2006 17:33:15 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[crop string]]></category>
		<category><![CDATA[last sentence]]></category>
		<category><![CDATA[nearest sentence]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/nearestsentence-function/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>I wanted to be able to take a string of text, a blog entry in this case, and crop it down to the nearest sentence to a given maximum length value.  I am sure this function exists in php, but I couldn&#8217;t find it so I wrote my own and figured some of you might find this handy:</p>
<pre>
function nearestSentence($s) {
//Max length of string before
//looking for last sentence.
$maxL = 350;

//Strip html tags and convert
//html entities (like &amp;)
//to single characters before counting.
$toCount = strip_tags(html_entity_decode($s));

//Crop the string down to the max length.
if (strlen($toCount) <= $maxL) {
$s2 = $s;
} else {
$s2 = substr($toCount, 0, $maxL);
}
//Look for position of the last ., ?, or !
$lastPunct = max(strrpos($s2, '.'), strrpos($s2, '?'), strrpos($s2, '!'));
//Crop the string again down to the nearest punctuation.
$s3 = substr($s2, 0, $lastPunct+1);
//Return string with html entites re-inserted.
return htmlentities($s3);
}
</pre>
<p>So, if you had some text like:</p>
<blockquote><div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat? Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis! At vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla?</div>
</blockquote>
<p>Then, you would get:</p>
<blockquote><div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat?</div>
</blockquote>
<p>If you have some flexibility for the length of your blurb, I think this looks a lot better than just cropping your string down to a particular length and adding... but maybe that's just me.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/nearestsentence-function/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Derailed</title>
		<link>http://jasongraphix.com/journal/derailed/</link>
		<comments>http://jasongraphix.com/journal/derailed/#comments</comments>
		<pubDate>Thu, 16 Mar 2006 22:25:23 +0000</pubDate>
		<dc:creator>Jason Beaird</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://beta.jasongraphix.com/journal/derailed/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>At work, we&#8217;re about to get started on a pretty straightforward reservation application.  We have a client that offers tours of their facility and they need a web app to take and manage reservations for said tours.  I know that I could code this out in php/mysql pretty easily, but it seemed like the perfect opportunity to give Ruby on Rails a shot.</p>
<p>I have to admit here that I&#8217;m pretty excited about the possiblity of using rails.  I&#8217;ve heard so much from so many of my colleagues about it&#8217;s ease of use and flexibility that I was chomping at the bit to give this puppy a whirl.  I followed Dan Benjamin&#8217;s EXCELLENT <a href="http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger">installation guide</a> for OS X Tiger, and carefully (making a few mistakes along the way) followed the &#8220;<a href="http://developer.apple.com/tools/rubyonrails.html">Using Ruby on Rails for WebDevelopment on OS X</a>&#8221; tutorial.  Now, as a graphic designer, the majority of my college career was spent learning how to draw, paint, take pretty pictures, and be able to differenciate between the Madonna paintings of Cimabue and Giotto.  I took some basic programming classes, but never learned anything about models, controllers, and views.  Regardless, I was still able to walk through the installation, and basic app creation described in the tutorials above.</p>
<p>At the end of the day, I&#8217;ve got a sweet little expense tracking application (that was explained in the using rails tutorial), and one simple problem: how to deploy it.  At work, we use CVS for out repository, but I guess I&#8217;m going to have to get friendly with SVN because Capistrano (aka SwitchTower) seems to require it, and I haven&#8217;t seen any other options for deployment.  I did see this little guide at nubyonrails (fun name) about <a href="http://nubyonrails.com/pages/shovel_dreamhost">deploying to Dreamhost</a>, but it too uses Capistrano and Subversion.  Is this the way to go?  Do I really have to source control my tiny little example app in order to stick it up on a subdomain of my site?  I&#8217;m not REALLY expecting answers on all this.  This is more just a journal on my thoughts and progress on the topic, but <a href="http://www.iamjp.com/blog/why-i-heart-rails-routes">SOMEBODY</a> ;) out there has to be able to tell me if I&#8217;m on the right trail.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasongraphix.com/journal/derailed/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

