<?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>Disco Shiny</title>
	<atom:link href="http://discoshiny.com/feed" rel="self" type="application/rss+xml" />
	<link>http://discoshiny.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 16 Jun 2009 18:10:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Caching In On Performance Boosts</title>
		<link>http://discoshiny.com/post/caching-in-on-performance-boosts</link>
		<comments>http://discoshiny.com/post/caching-in-on-performance-boosts#comments</comments>
		<pubDate>Tue, 16 Jun 2009 18:10:24 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=69</guid>
		<description><![CDATA[Part of my intent in making this blog was to be able to talk about ongoing development in my various projects. Unfortunately, a lot of the work I typically do is simple HTML and CSS and it&#8217;s not challenging me to learn something new. Today, however, I have something to report.
I received an email from [...]]]></description>
			<content:encoded><![CDATA[<p>Part of my intent in making this blog was to be able to talk about ongoing development in my various projects. Unfortunately, a lot of the work I typically do is simple HTML and CSS and it&#8217;s not challenging me to learn something new. Today, however, I have something to report.</p>
<p>I received an email from Dreamhost last week informing me that they were throttling connections to my video hosting site because recent traffic spikes from the <a href="http://forums.somethingawful.com/showthread.php?threadid=3140021">Sonic Unleashed Let&#8217;s Play</a> were causing the Apache server to have problems. Now I&#8217;ll be the first to admit that my video hosting solution is not elegant or efficient. I started it small and hacked on features as I went. Yeah, one of <em>those</em>. Everyone makes one eventually, but in this case, mine got popular so I needed to fix it.<br />
<span id="more-69"></span><br />
I determined that I needed to implement a form of caching to cause my spaghetti code to run as infrequently as possible. Professional-level caching solutions require control of the server the site is running on, both hardware and software. These same solutions are also rather complicated and work to cache selectively only those parts of the site (and sometimes within individual pages) that do not change very often or ever. For my site, I know that once a video is added, the page that lets you view it almost never changes, so this is the part of the site that will be cached. This is also the part of the site that sees ~80% of the traffic total and closer to 100% of the traffic during the spikes. Fantastic.</p>
<p>The rewrite involved a few steps. First I removed all the code used to draw the page contents and put it in a function. The function, <code>printVideoPage</code>, takes the ID of the video in the database and returns a string of the page content. I also took this opportunity to optimize the way I use ADOdb because I have a better understanding of it now than when I wrote this 3 years ago.</p>
<p>The second function I wrote creates a cache file. This function, <code>updateCache</code>, also takes an ID. It opens the cache file located at the configured location with the configured file name and starts writing. It actually writes a PHP file which declares two variables, <code>$name</code> and <code>$contents</code>. When show.php includes the cache file for the requested ID, it can put the name of the video in the title and the contents where they belong.</p>
<p>For the average visitor to my site, this eliminates all SQL calls and a great deal of very bad PHP. If a cache file does not exist, the site displays an error. This means that the cache must absolutely be a correct and accurate representation of the database at all times which annoys me, but as long as I call <code>updateCache</code> any time I change or add a video record in the database, everything should be fine. I do not think there are any bugs, but there are certain aspects which have not yet been tested as much as they should be. show.php is functioning as expected which for now is the most important thing.</p>
<p>I cannot show you empirical evidence that my measures to reduce load have worked. I&#8217;m on shared hosting; I don&#8217;t get access to that kind of stuff. I can only hope it has made a difference and that Dreamhost sees that and unthrottles me. If that&#8217;s not good enough for them (and it really should be, Sonic 2006 had way more traffic and this didn&#8217;t happen), I am at the end of my bag of tricks on the current codebase and I will have to rewrite. Ughh.</p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/caching-in-on-performance-boosts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Body Classes Can Be A Smart Choice</title>
		<link>http://discoshiny.com/post/body-classes-can-be-a-smart-choice</link>
		<comments>http://discoshiny.com/post/body-classes-can-be-a-smart-choice#comments</comments>
		<pubDate>Sat, 23 May 2009 17:28:53 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=62</guid>
		<description><![CDATA[At my place of work, one of my projects is to develop our department website. Because this is a major website at the university, it has to follow all the rules. These include accessibility, cross-browser support, and conservative design sensibilities. But being a non-technical corporate environment, they want to have their cake and eat it [...]]]></description>
			<content:encoded><![CDATA[<p>At my place of work, one of my projects is to develop our department website. Because this is a major website at the university, it has to follow all the rules. These include accessibility, cross-browser support, and conservative design sensibilities. But being a non-technical corporate environment, they want to have their cake and eat it too, so I have to reconcile the JavaScript carousel and scrolling news widgets they wanted with the accessibility concerns for people with text readers or what have you.</p>
<p>I was poking around the internet and found the solution on another page at our university. I believe it was created by our competition, Creative Services, who we&#8217;re pretty sure take templates and butcher them to be Mason-branded. The implementation on that page was the answer no matter how much I loathe their cookie-cutter techniques. The answer is <code>&lt;body&gt;</code> classes.</p>
<p><span id="more-62"></span></p>
<p>In the past I had dismissed body classes as being a poor design strategy for a site. This was because I&#8217;d only ever seen poor implementations of them, parroted by Lynda.com. You should not use <code>&lt;body&gt;</code> classes automatically on every site you design. This encourages inconsistency in design between pages. It also bloats your CSS because if you&#8217;re using a <code>&lt;body&gt;</code> class, you&#8217;re using a lot of descending selectors and creating styles like <code>.bodyclass #sidebar ul li</code>.</p>
<p>But there are circumstances in which body classes can be used correctly and one of these circumstances is my problem. The idea is to first create your page without any JavaScript functionality at all, but with JavaScript functionality in mind. That carousel of images, for example, becomes a grid of images. The scrolling news shows only the top three items. The animation is not present. Then in your <code>$(document).ready()</code> block before anything else, you do this:</p>
<pre class="brush: jscript;">$('body').addClass('js_ready');</pre>
<p>You&#8217;ve just added a class to your body tag with JavaScript. If the user does not have JavaScript enabled, this will not trigger. So now you can put all your JavaScript styles under the <code>.js_ready</code> selector. Because of the specificity of CSS, adding more information to an element selector will override any other reference to that selector. So if you have <code>#carousel ul li</code> and <code>.js_ready #carousel ul li</code>, any styling in the latter block will override the former, making your page style differently in the presence of JavaScript. This may necessitate updating the prepackaged CSS that came with your widget to include the body selector.</p>
<p>Well that&#8217;s a pretty cool thing, and while I was realizing how it worked I thought of another possibility. Admittedly it&#8217;s not going to be widely used, but I guess it could make a good tech demo. What if you want to have different themes for your page? Each theme is under a different body class and could be changed via JavaScript. I imagine this would be most handy if you&#8217;re pitching to a client and you&#8217;ve created a couple different designs and you wish to cycle quickly through them for comparison. The theme change would not be persistent across pages without some extra work, and who wants to create more than one completely realized style per site anyway? But it was a neat idea I had. Maybe I will implement it here on Disco Shiny&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/body-classes-can-be-a-smart-choice/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Serial For Breakfast</title>
		<link>http://discoshiny.com/post/serial-for-breakfast</link>
		<comments>http://discoshiny.com/post/serial-for-breakfast#comments</comments>
		<pubDate>Wed, 20 May 2009 21:14:08 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=60</guid>
		<description><![CDATA[As I posted mere minutes ago, I&#8217;m working on an invoicing system. Part of this blog&#8217;s function is to be a regurgitation of things I think about when working of various projects, so here we go.

Being a central database for all our services and all jobs we&#8217;ve ever done, it becomes easy to update information [...]]]></description>
			<content:encoded><![CDATA[<p>As I posted mere minutes ago, I&#8217;m working on an <a href="http://discoshiny.com/post/mason-media-lab-invoicing-system">invoicing system</a>. Part of this blog&#8217;s function is to be a regurgitation of things I think about when working of various projects, so here we go.</p>
<p><span id="more-60"></span></p>
<p>Being a central database for all our services and all jobs we&#8217;ve ever done, it becomes easy to update information regarding our services and have them take effect immediately. It has occurred to me, however, that this could be very bad for invoices we have already submitted and been paid for if, say, we changed the price of plain paper. Those completed invoices would suddenly change. I&#8217;ve decided the answer is serialization.</p>
<p>When we submit an invoice to accounting, it changes status to &#8220;Submitted&#8221; (or it will when the admin section is up and running). At this point, we don&#8217;t want the invoices to change any more ever, so we load up an invoice in our Invoice class and call <code><a href="http://us2.php.net/serialize" target="_blank">serialize()</a></code> on it. This makes it a string which we then store in a new field. Upon loading an invoice, the class should check a) the status of the invoice and b) if the serialized field is populated. If the conditions are right, it replaces itself with an <code><a href="http://us2.php.net/unserialize" target="_blank">unserialize()</a></code>&#8216;d version of the invoice.</p>
<p>I&#8217;m just glad I thought of this before I started coding the admin section. If all goes well, though, nothing should change from the perspective of the parts of the application using the class. It just seems like something that could have easily slipped under the radar and then never gotten fixed because we don&#8217;t change our prices often at all and I would be gone the next time we did it.</p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/serial-for-breakfast/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mason Media Lab Invoicing System</title>
		<link>http://discoshiny.com/post/mason-media-lab-invoicing-system</link>
		<comments>http://discoshiny.com/post/mason-media-lab-invoicing-system#comments</comments>
		<pubDate>Wed, 20 May 2009 20:30:03 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=50</guid>
		<description><![CDATA[
XHTML
CSS
PHP
MySQL
jQuery/AJAX
PDF Creation

One major project I&#8217;ve been working on has been replacing the person who&#8217;s job it was to aggregate all our invoices, send them off to accounting, and report our numbers each month. Her system comprised a number of excel spreadsheets between which she would copy all relevant data. Naturally a database is a much [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_51" class="wp-caption alignleft" style="width: 160px"><a href="http://discoshiny.com/wp-content/uploads/2009/05/invoicing-screenshot.png"><img src="http://discoshiny.com/wp-content/uploads/2009/05/invoicing-screenshot-150x150.png" alt="The Front Page" title="MML Invoicing System" width="150" height="150" class="size-thumbnail wp-image-51" /></a><p class="wp-caption-text">The Front Page</p></div>
<ul class="projectTech">
<li>XHTML</li>
<li>CSS</li>
<li>PHP</li>
<li>MySQL</li>
<li>jQuery/AJAX</li>
<li>PDF Creation</li>
</ul>
<p>One major project I&#8217;ve been working on has been replacing the person who&#8217;s job it was to aggregate all our invoices, send them off to accounting, and report our numbers each month. Her system comprised a number of excel spreadsheets between which she would copy all relevant data. Naturally a database is a much better solution and so I set about creating one. The project is not yet complete, I still have to create the administration section. Most of the framework is in place, though, and the front end is what I consider to be beta status.</p>
<p><span id="more-50"></span></p>
<p>This project was a vehicle for me to learn JavaScript. Since our previous system of creating invoices was entirely based in Excel, the new system had to have at least as much functionality. This meant creating a rich web application which would carry out the calculations for costs automatically.</p>
<p>Using jQuery has allowed me to do a number of things with the site that are both aesthetically pleasing and highly functional. The page that allows users to search for and filter invoices, for instance, uses hidden form inputs combined with a table to simulate rich checkboxes. Clicking a table cell highlights or normalizes it, indicating that it is active or not. The actual form element is a hidden input for each table cell that toggles between &#8216;off&#8217; and &#8216;on&#8217; through the use of jQuery.</p>
<p>One very important feature of the new system relates to the way we are paid as a university organization. Each organization has one or more fund numbers which they can supply as a form of payment, and funds are automatically deducted when we submit the completed invoices to accounting. Unfortunately, these are simply numbers and are rather non-descriptive. This invoicing system uses PHP/cURL and AJAX to look up the unit name tied to a given org number so we can double check with clients. We have since caught three instances of clients giving us entirely the wrong department&#8217;s number.</p>
<p>The system is incomplete, as I have said. I am actively developing it and hope to have it deployed in beta or gold status by the next fiscal year. At this point we intend to start shopping it all over the university to other organizations that provide services within the university. This is highly tentative and should not be taken as official word.</p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/mason-media-lab-invoicing-system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blinded By JavaScript</title>
		<link>http://discoshiny.com/post/blinded-by-javascript</link>
		<comments>http://discoshiny.com/post/blinded-by-javascript#comments</comments>
		<pubDate>Tue, 12 May 2009 06:30:09 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=32</guid>
		<description><![CDATA[Before about a month ago I had never touched JavaScript, I thought it unnecessary. I had been able to do everything I ever wanted in CSS, and if some task could only be done in JavaScript, then it was not a task worth persuing. Well as of a month or so ago, I began a [...]]]></description>
			<content:encoded><![CDATA[<p>Before about a month ago I had never touched JavaScript, I thought it unnecessary. I had been able to do everything I ever wanted in CSS, and if some task could only be done in JavaScript, then it was not a task worth persuing. Well as of a month or so ago, I began a project at work to create an invoicing system. I&#8217;ll get into the specifics of the project in some other post, but a large part of it was using jQuery to create a true dynamic web application. Picking up jQuery does not strictly imply that you pick up JavaScript, but they are rather close enough that you begin to see the majesty and wonder of being able to manipulate the DOM so freely.</p>
<p>This is a trap. I fell for the trap.<span id="more-32"></span></p>
<p>A large part of the web designer&#8217;s job is to translate a mockup of a design from Photoshop or something into HTML/CSS. This means looking for logical divisions of content and thinking about how the box model can help you achieve this layout. When I created the current design, I saw two columns separated by the fake 3D effect and said &#8220;Ah! I will have two columns! One of them will have the repeating background trick and an image each at the top and bottom!&#8221; Easy to think, impossible to implement. First off, the sidebar needs to scale with the content, or the 3D illusion is broken. And thus begins my descent (the highest form of patriotic) into the trap. I turned to JavaScript.</p>
<p>All I need to do is grab the heights of the sidebar and content, find which is bigger, and resize the other! Oh, but I need to take into account the offset. Oh but I need to move that bottom image as well. And after not too long, I&#8217;ve created something that functions. Hooray. Unfortunately, this is a problem for a number of reasons,</p>
<ol>
<li>It is highly inelegant. It&#8217;s overly complicated and the browser should be doing it for me.</li>
<li>The syntax highlighting code breaks it because it takes longer to execute</li>
<li><strong>It can be easily solved in CSS with a little more creativity</strong></li>
</ol>
<p>Look, all that needs to happen is have the content div be the combined width of the current content and sidebar divs, images at the top and bottom (use an inner footer div that clears both and has an image background), and then have the two columns with no image backgrounds just take up however much height they need and let the browser sort it all out. <strong>That&#8217;s what browsers do best.</strong></p>
<p>I got caught up in the shine. I saw what JavaScript could do and was tempted to make bad layout choices by the fact that JavaScript can be used to crutch almost any situation. Learn from this. Think long and hard about each thing you want JavaScript to do. Can it be done no other way? Could you handle it in either the PHP/ASP/Perl/Python or the CSS? Because you should. Here are some things which you can and sometimes should use JavaScript for:</p>
<ol>
<li>Animation. This is a whole can of worms, another post maybe.</li>
<li>AJAX and all that cool web 2.0 stuff</li>
<li>Form validation. Can be used with number 2</li>
</ol>
<p>If it&#8217;s not one of those things, <strong>think again.</strong></p>
<p><em>This post brought to you once again by the <code>&lt;ol&gt;</code> tag.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/blinded-by-javascript/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monocle Radio</title>
		<link>http://discoshiny.com/post/monocle-radio</link>
		<comments>http://discoshiny.com/post/monocle-radio#comments</comments>
		<pubDate>Sat, 09 May 2009 15:25:03 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=22</guid>
		<description><![CDATA[
XHTML/CSS layout
PHP
MPD class for PHP
MySQL for user management
Icecast2 streaming server

Monocle Radio is a front end to Music Player Daemon, an application for Linux that does exactly what its name implies. The only way to use it is to run a front end, such as Monocle Radio.
SourceForge Page

In my freshman year of college I had an [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_23" class="wp-caption alignleft" style="width: 160px"><a href="http://discoshiny.com/wp-content/uploads/2009/05/monocle-screenshot.png"><img class="size-thumbnail wp-image-23" title="Monocle Radio Screenshot" src="http://discoshiny.com/wp-content/uploads/2009/05/monocle-screenshot-150x150.png" alt="Monocle Radio" width="150" height="150" /></a><p class="wp-caption-text">Monocle Radio</p></div>
<ul class="projectTech">
<li>XHTML/CSS layout</li>
<li>PHP</li>
<li><a href="http://mpd.24oz.com/" target="_blank">MPD class for PHP</a></li>
<li>MySQL for user management</li>
<li>Icecast2 streaming server</li>
</ul>
<p>Monocle Radio is a front end to <a href="http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki" target="_blank">Music Player Daemon</a>, an application for Linux that does exactly what its name implies. The only way to use it is to run a front end, such as Monocle Radio.</p>
<p><a href="http://sourceforge.net/projects/monoradio" target="_blank">SourceForge Page</a></p>
<p><span id="more-22"></span></p>
<p>In my freshman year of college I had an old computer I used as a server. I kept some backups on it as well as my music. I wanted to be able to listen to my music even when I was not in my room, so I decided to set up a streaming solution.</p>
<p>I looked into available solutions and at the time all the software I could find was either incomplete or too complete. My server was not powerful enough to handle <a href="http://ampache.org/" target="_blank">Ampache</a>, for instance. It was for this reason that I decided to make a web-based interface to suit my needs. I wanted something no-nonsense and responsive, even on my aging Pentium 2 box.</p>
<p>My roommate and a couple other people I know wanted to be able to listen as well and have control when I wasn&#8217;t using it, so I implemented a multi-user system. It was not very secure and focused more on getting the job done. It required users to be logged in to change the playlist or control the playback, but anyone could listen.</p>
<p>At its completion, Monocle Radio fulfilled my needs. I released a couple bug-fixing releases, but have since ceased development. I no longer maintain a server for my music due to bandwidth and power constraints. Also the old server was 2.5 feet tall and weighed well around 40lbs, an impractical machine at best.</p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/monocle-radio/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on Cross-Browser Coding</title>
		<link>http://discoshiny.com/post/thoughts-on-cross-browser-coding</link>
		<comments>http://discoshiny.com/post/thoughts-on-cross-browser-coding#comments</comments>
		<pubDate>Fri, 08 May 2009 16:37:30 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=10</guid>
		<description><![CDATA[I&#8217;ve met some people who hold low opinions of IE. Scratch that, I&#8217;ve met a whole lot of people for whom IE doesn&#8217;t butter their bread. I&#8217;m one of these people. These people tend to be web developers, because IE did a number of unfortunate things for people looking to create websites beyond the very [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve met some people who hold low opinions of IE. Scratch that, I&#8217;ve met a whole lot of people for whom IE doesn&#8217;t butter their bread. I&#8217;m one of these people. These people tend to be web developers, because IE did a number of unfortunate things for people looking to create websites beyond the very baseline. <span id="more-10"></span>There exist a number of &#8220;danger zones,&#8221;</p>
<ul>
<li>Transparent PNG support</li>
<li><span class="code">z-order</span></li>
<li>Rounded corners</li>
<li>Floats and margins</li>
<li>Expanding boxes</li>
</ul>
<p>Okay that&#8217;s all I can think of off the top of my head. The point is though, that none of these things are strictly necessary for a website. It&#8217;s easy enough to create a site that looks pretty much the same in IE5.5+ and the Firefox/Safari/Opera crowd, but if people choose to use a more modern browser, including newer versions of IE, the site will only get shinier.</p>
<p>Point of all this is, the people who don&#8217;t like IE and <em>actively leave out fixes for it</em> are not really professional level yet. Professional level developers neutrally regard or hate every browser equally. Firefox 2 has some weird layout issues, for instance, on sites that look fine in every other browser! CSS 3 support is still handled differently by everyone, each browser supporting a subset. The list continues.</p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/thoughts-on-cross-browser-coding/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Of H1 Images, Opacity, and Other Curios</title>
		<link>http://discoshiny.com/post/of-h1-images-opacity-and-other-curios</link>
		<comments>http://discoshiny.com/post/of-h1-images-opacity-and-other-curios#comments</comments>
		<pubDate>Fri, 08 May 2009 06:17:41 +0000</pubDate>
		<dc:creator>Kurt</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://discoshiny.com/?p=5</guid>
		<description><![CDATA[I am starting a blog. This may seem like an odd move to a lot of you for a couple reasons:

I don&#8217;t update the blog I have because I stopped being emo forever ago
I already sorta have a blog?

But I want to start a real blog. One in which I can chronicle my development revelations [...]]]></description>
			<content:encoded><![CDATA[<p>I am starting a blog. This may seem like an odd move to a lot of you for a couple reasons:</p>
<ol>
<li>I don&#8217;t update the blog I have because I stopped being emo forever ago</li>
<li>I already sorta have a blog?</li>
</ol>
<p>But I want to start a real blog. One in which I can chronicle my development revelations and tribulations. Strictly technical junk here, no personal life stuff. It all starts with this post about the development of said blog&#8230;</p>
<p><span id="more-5"></span></p>
<p>You see, I am not a designer. I have often been praised for my design sense, and I admit I may have some aesthetic sense about me, but I do not enjoy designing and creating designs from the bottom up, and coming up with even the most meagre of layouts causes me great mental anguish. I really like to focus on the backend of my projects. I cram as many neat gizmos and features as I can think of into each one (the mcguffins I have completed here thus far will be detailed below), but each is a slave to the design, not a driving force.</p>
<p>This site has to be my own. I have to design it, I have to pump up the design, and in this case, I have to make it Disco Shiny. So here I am, I&#8217;ve started down the path, and I am about 40% of the way to the point where I feel my own ability to embellish existing design can kick in and make it awesome. Anyway, let&#8217;s get into the things I&#8217;ve done so far on the technical side.</p>
<p>The first order of business was to make this content <span class="code">div</span> semi-transparent. The silly way is to use the <span class="code">opacity</span> CSS attribute which is undesirable for a couple reasons:</p>
<ol>
<li>Does not work in IE.</li>
<li>Everything inside an opacity-adjusted element is itself rendered at lower opacity, at least in Firefox.</li>
</ol>
<p>The solution is to use an image that is a strip of 80% opacity white. Some versions of IE hate on the alpha channel in PNGs powerhard, but the fix for it is easy and in JavaScript. All I had to do was include <a href="http://jquery.com/">jQuery</a> and the <a href="http://plugins.jquery.com/node/6885">pngFix</a> plugin, and I&#8217;m set! It feels a bit hackish, but it also fixes the second issue there, so I feel it&#8217;s good, clean fun all around.</p>
<p>I was just slightly pleased with myself after that, but I realized that I could do more. I&#8217;m still getting used to jQuery and JavaScript in general, but I&#8217;m loving every minute of it. I decided I wanted to use my own font for header images, but that it&#8217;s certainly not a font the average user would have on his computer. The solution to that is typically to use an image, but that&#8217;s messy and time-consuming, so I wrote a script to do it for me using PHP&#8217;s GD image functions (they are awful and clunky but that&#8217;s a rant for another post). It accepts some parameters, the least of which is the text you want to make into an image. The JavaScript is a piece of cake after that.</p>
<pre class="brush: jscript;">var color = &quot;333333&quot;;
if($(this).hasClass('red')) color = &quot;CC2233&quot;;
else if($(this).hasClass('blue')) color = &quot;223399&quot;;

var size = &quot;18&quot;;
if($(this).hasClass(&quot;huge&quot;)) size = &quot;35&quot;;

$(this).html('&lt;img src=&quot;&lt;?php bloginfo(&quot;template_directory&quot;); ?&gt;/futura.php?text='+$(this).html()+'&amp;amp;color='+color+'&amp;amp;size='+size+'&quot; alt=&quot;'+$(this).html()+'&quot; /&gt;');
</pre>
<p>This is wrapped in an <span class="code">each()</span> function that iterates over all H1 tags in the page. It replaces the text in each with an image of the text in my font of the moment which is Futura. The ramifications of this are that it has great accessibility while maintaining a comfortable viewing experience for the majority of my readers. Have an example:</p>
<h1 class="replace">Here is some header text that is NO LONGER plain</h1>
<p>And that&#8217;s about it for tonight I&#8217;m bushed. Development continues tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://discoshiny.com/post/of-h1-images-opacity-and-other-curios/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
