<?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>Barryvan &#187; Projects</title>
	<atom:link href="http://www.barryvan.com.au/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.barryvan.com.au</link>
	<description>Music, Programming, Design</description>
	<lastBuildDate>Wed, 23 Jun 2010 04:18:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Generative Music</title>
		<link>http://www.barryvan.com.au/2010/03/generative-music/</link>
		<comments>http://www.barryvan.com.au/2010/03/generative-music/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 08:08:11 +0000</pubDate>
		<dc:creator>Barry van Oudtshoorn</dc:creator>
				<category><![CDATA[Ambient]]></category>
		<category><![CDATA[Chillout]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">http://www.barryvan.com.au/?p=443</guid>
		<description><![CDATA[Continuing my HTML5 and canvas experiments, I&#8217;ve put together a generative music system. Essentially, a series of particles move across a field, occasionally triggering sounds &#8212; the sound triggered depends on their location in the field. There is, of course, a little bit more to it than that. Under the hood, I&#8217;ve got a series [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing my HTML5 and canvas experiments, I&#8217;ve put together a generative music system. Essentially, a series of particles move across a field, occasionally triggering sounds &#8212; the sound triggered depends on their location in the field.</p>
<p>There is, of course, a little bit more to it than that. Under the hood, I&#8217;ve got a series of HTML5 Audio objects that are used to provide polyphonic audio using a simple round-robin algorithm (I encoded the audio in OGG, so you&#8217;ll need to use an OGG-friendly browser, like <a href="http://www.getfirefox.com">Firefox</a>). The particles are much simpler than those in my <a href="/2010/03/canvas-swarms/">previous canvas dalliance</a>, in that they don&#8217;t swarm, and their motion is more linear.</p>
<div class="screenshots">
<a href="/demos/generative.html"><br/><br />
<img alt="Generative Audio Screenshot" src="/wp-content/uploads/2010/03/generative.png" class="aligncenter size-full"/><br/><br />
View (and hear!) it live<br/><br />
</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.barryvan.com.au/2010/03/generative-music/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New theme!</title>
		<link>http://www.barryvan.com.au/2009/10/new-theme-2/</link>
		<comments>http://www.barryvan.com.au/2009/10/new-theme-2/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 10:29:13 +0000</pubDate>
		<dc:creator>Barry van Oudtshoorn</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://www.barryvan.com.au/?p=292</guid>
		<description><![CDATA[Well, I spent the weekend quickly working up a new theme for my site. I wanted something was a) a lot simpler, and b) showed off some of the cool new CSS 3 features available. Cool CSS features used: Columns (Gecko, Webkit, Presto) Web fonts (Gecko, Webkit, Presto, Trident) CSS gradients (Webkit) CSS transforms (Gecko, [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I spent the weekend quickly working up a new theme for my site. I wanted something was a) a lot simpler, and b) showed off some of the cool new CSS 3 features available.</p>
<h2>Cool CSS features used:</h2>
<ul>
<li>Columns (Gecko, Webkit, Presto)</li>
<li>Web fonts (Gecko, Webkit, Presto, Trident)</li>
<li>CSS gradients (Webkit)</li>
<li>CSS transforms (Gecko, Webkit)</li>
<li>Text shadow (Gecko, Webkit, Presto)</li>
<li>Assorted CSS3 selectors and pseudo-selectors (Gecko, Webkit, Presto)</li>
</ul>
<p>In case you&#8217;re wondering, Gecko is Firefox&#8217;s rendering engine, Webkit is Chrome &#038; Safari, Presto is Opera, and Trident is Internet Explorer. Now you know. Tell your friends!</p>
<p>All in all, lots of fun stuff to play with.</p>
<h2>Rendering bugs</h2>
<p>Of course, the fun thing about playing with cutting edge features is that you get to find all sorts of bizarre glitches and rendering issues. Here are a few that I&#8217;ve noticed during development.</p>
<h3>Missing letters (Presto)</h3>
<p>Letters just seem to go missing randomly from words &#8212; &#8220;you&#8221; becomes &#8220;yo&#8221;, for example. I think that this is caused either wholly by the downloaded font, the use of columns, or a combination of the two. Quite annoying.</p>
<h3>Pixel creep in columns (Webkit)</h3>
<p>Every now and then, pixels from a word in column B will find their way to the very bottom of column A. It&#8217;s even worse when you set a box-shadow on an element &#8212; the top of the shadow is rendered in the previous column. I&#8217;m guessing that Webkit&#8217;s column-rendering algorithm basically renders the entire area in a long strip, then cuts it into chunks and shoves them on the page. Annoying.</p>
<h3>Disappearing column rules (Gecko)</h3>
<p>Apparently, setting the &#8220;overflow&#8221; property (or &#8220;overflow-x&#8221; or &#8220;overflow-y&#8221;) on an element that is rendered in columns prevents the column rule from being rendered in Gecko. I really have no idea why this should be the case &#8212; it&#8217;s a very strange behaviour.</p>
<h3>HTML 5 element styling (Trident)</h3>
<p>Internet Explorer can&#8217;t style elements that aren&#8217;t bog-standard HTML. Unless you use &#8220;document.createElement(&#8216;elemName&#8217;)&#8221; on them first. Ridiculous.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryvan.com.au/2009/10/new-theme-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS minifier and alphabetiser</title>
		<link>http://www.barryvan.com.au/2009/08/css-minifier-and-alphabetiser/</link>
		<comments>http://www.barryvan.com.au/2009/08/css-minifier-and-alphabetiser/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 08:27:30 +0000</pubDate>
		<dc:creator>Barry van Oudtshoorn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Minify]]></category>
		<category><![CDATA[Obfuscate]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.barryvan.com.au/?p=231</guid>
		<description><![CDATA[Update: This project is now hosted on GitHub: http://barryvan.github.com/CSSMin/ There are quite a few CSS minifiers out there, which can bring the raw size of your CSS files down substantially. Very few of them, however, will also optimise your CSS for gzip compression. To that end, I&#8217;ve written a small Java application that will read [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update: This project is now hosted on GitHub: <a href="http://barryvan.github.com/CSSMin/">http://barryvan.github.com/CSSMin/</a></strong></p>
<p>There are quite a few CSS minifiers out there, which can bring the raw size of your CSS files down substantially. Very few of them, however, will also optimise your CSS for gzip compression. To that end, I&#8217;ve written a small Java application that will read in a CSS file and output its contents to stdout or another file in a format that&#8217;s optimised for gzipping.</p>
<h2>The problem</h2>
<p>A file will be most compressed when there are many recurring strings in the file. This means that when writing CSS files, this code:</p>
<pre class="brush: css">.pony {
border: solid red 1px;
font-weight: bold;
}
.lemur {
border: solid red 1px;
font-weight: normal;
}</pre>
<p>will be better-compressed than this:</p>
<pre class="brush: css">.pony {
border: solid red 1px;
font-weight: bold;
}
.lemur {
font-weight: normal;
border: red solid 1px;
}</pre>
<h2>What it does</h2>
<p>Specifically, my CSS minifier will perform the following transformations on the file:</p>
<ul>
<li>All comments are removed.</li>
<li>The properties within all selectors are ordered alphabetically.</li>
<li>The values for all properties are ordered alphabetically.</li>
<li>All unnecessary whitespace is removed.</li>
</ul>
<p>By way of example, the following CSS snippet:</p>
<pre class="brush: css">body {
padding: 8px;
margin: 0;
background-color: blue;
color: white;
font-family: &quot;Trebuchet MS&quot;, sans-serif;
}

h1 {
margin: 0;
padding: 0;
font-size: 200%;
color: #0F0;
font-weight: bold;
}

p {
margin: 0 0 2em;
line-height: 2em;
}</pre>
<p>would be formatted to:</p>
<pre class="brush: css">body{background-color:blue;color:white;font-family:&quot;Trebuchet MS&quot;,sans-serif;margin:0;padding:8px;}h1{color:#0F0;font-size:200%;font-weight:bold;margin:0;padding:0;}p{line-height:2em;margin:0 0 2em;}</pre>
<h2>Compression results</h2>
<p>A (very) large real-world CSS file of 78.2KB has a minified size of 63.7KB, which is a size decrease of nearly 20%. GZipping these two files, the un-minified file is reduced to 13.2KB, whilst the minified file weighs in at just 11.5KB &#8212; nearly 13% smaller.</p>
<p>Clearly, removing unnecessary whitespace and reordering the contents of the CSS selectors can greatly improve the compression of your CSS files, and thus make your pages deliver more quickly.</p>
<h2>Comparison with YUI CSS Compression</h2>
<p>As you can see in the chart below, the <a href="http://yuilibrary.com/downloads/#yuicompressor">YUI compressor</a> manages to make the original file around 1KB smaller than my minifier. However, when the two minified files are gzipped, my compression results in a file that is 11.5KB in size, whilst YUI only reduces down to 11.8KB.<br />
<img src="/projects/cssmin/YUIComparison.png" alt="A chart comparing YUI's CSS compression and mine" title="Original: 78.2, Original/GZ: 13.2; YUI: 62.7, YUI/GZ: 11.9; Mine: 63.7, Mine/GZ: 11.5"/></p>
<h2>Download</h2>
<p>The source for this applet is available freely, and is a single Java file. It&#8217;s not particularly pretty, because I knocked this together in about half an hour.<br />
<a href="/projects/cssmin/CSSMin.java">Download</a><br />
License: Mozilla Public License (In other words, do whatever you like with it. Credit is greatly appreciated, but not required.</p>
<h2>Usage</h2>
<p>First, if you haven&#8217;t done so yet, compile the code:</p>
<pre class="brush: php"># javac CSSMin.java</pre>
<p>Then, you can call the minifier by running</p>
<pre class="brush: php"># java CSSMin in.css [out.css]</pre>
<p>If you do not specify an output file, the resultant CSS will be printed to stdout (and can then be redirected as you wish).</p>
<h2>Contact</h2>
<p>If you have any questions or comments about this app, or if you find a bug or some weird behaviour, just comment on this post, and I&#8217;ll see what I can do.</p>
<p>If you find this utility useful, let me know! If you want to extend it, you&#8217;re free to do whatever you like with it, as it&#8217;s under the MPL. It would be nice, though, if you dropped me a line to let me know what you&#8217;re doing with it. <img src='http://www.barryvan.com.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Future work</h2>
<ul>
<li>Replace &#8220;0[px,em,%,etc]&#8221; with &#8220;0&#8243;.</li>
<li>Replace &#8220;0 [0 [0 [0]]]&#8221; with &#8220;0&#8243;.</li>
<li>Replace &#8220;0.6&#8243; with &#8220;.6&#8243; wherever possible.</li>
<li>Replace all &#8220;rgb(64, 64, 64)&#8221; with &#8220;#404040&#8243;.</li>
<li>Shorten colours from #112233 to #123 wherever possible.</li>
<li>Remove all empty rules.</li>
<li>Ordering of property valus according to the CSS spec, not just alphabetically.</li>
<li>A cleaner interface, including the ability to stream and process from stdin.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.barryvan.com.au/2009/08/css-minifier-and-alphabetiser/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>
