<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">

    <title type="text">Blog</title>
    <subtitle type="text">Blog:</subtitle>
    <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/blog/index/" />
    <link rel="self" type="application/atom+xml" href="http://rwbaker.com/index.php/blog/atom/" />
    <updated>2008-11-07T15:16:04Z</updated>
    <rights>Copyright (c) 2008, rich</rights>
    <generator uri="http://expressionengine.com/" version="1.6.3">ExpressionEngine</generator>
    <id>tag:rwbaker.com,2008:10:09</id>


    <entry>
      <title>Print Stylesheet in ASP.NET Themes</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/print_stylesheet_in_aspnet_themes/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.23</id>
      <published>2008-10-09T12:05:01Z</published>
      <updated>2008-10-09T12:21:34Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term=".NET"
        scheme="http://rwbaker.com/index.php/site/category/dotnet/"
        label=".NET" />
      <content type="html"><![CDATA[
        <p>
Last post I talked about ASP.NET Themes -- all CSS files in the theme folder will be loaded, no matter what.  This makes having a matching print stylesheet a little difficult since you can't specify media types for you theme stylesheets.
</p>

<p>
Enter the <code>@media</code> tag.  In your <code>print.css</code> stylesheet, you can use this tag to specify your media type in the stylsheet instead of in the <code>&lt;link&gt;</code> tag as you normally would.
</p>

<pre><code>
@media Print 
{
	body,a {color:#000;}
}
</code></pre>

<p>And as an added bonus: this even works in IE 6. Who would have thought?</p> 
      ]]></content>
    </entry>

    <entry>
      <title>Stylesheet order in ASP.NET Themes</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/stylesheet_order_in_aspnet_themes/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.22</id>
      <published>2008-10-09T11:43:00Z</published>
      <updated>2008-11-07T15:16:04Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term=".NET"
        scheme="http://rwbaker.com/index.php/site/category/dotnet/"
        label=".NET" />
      <content type="html"><![CDATA[
        <p>
I've started using ASP.NET Themes in my latest projects.  They're interesting, but just goofy enough to make me hate them.  The latest quirk I've discovered is that <strong>all</strong> <abbr title="Cascading Style Sheets">CSS</abbr> files in a theme are loaded, regardless if you want them or not.
</p>

<p>
Cascading Style Sheets is built on the idea of inheritance, in which <em>order</em> or styles is very important.  So, when you can't control what styles are loaded at what time, it's hard to overwrite things when needed.
</p>

<h3>Problem</h3>
<p>
My theme is called cojui.  Inside the <code>App_Themes/cojui/</code> folder I have <code>cojui.css</code>.  In that stylesheet, I import my other stylesheets: <code>reset-min.css</code> &amp; <code>masterpages.css</code>. 
</p>

<pre><code>
@import "stylesheets/reset-min.css";
@import "stylesheets/masterpages.css";

/* My main styles follow below */
</code></pre>

<p>
Visual Studio reads <code>cojui.css</code> first since it's in the root of the theme directory. Then, <abbr title="Visual Studio">VS</abbr> loads the rest of the stylesheets, <strong>in alphabetical order</strong>.  This causes <code>reset-min.css</code> to reset all my styles since <code>cojui.css</code> has already been processed -- not the intended effect.
</p>

<h3>Solution</h3>
<p>
<div class="img">
<img src="http://rwbaker.com/files/general/themesDirStructure.gif" width="195" height="192" />
</div>
I put all my CSS files in <code>App_Themes/cojui/stylesheets/</code> folder and add an underscore ( _ ) to the stylesheets I want to load first.  This only gives me levels of granularity in load order, but for now it's working.  I also renamed <code>cojui.css</code> to <code>main.css</code> to let other people know it's the 'main' stylesheet since it's no longer in the root directory.
</p>

<div class="update">
<p><strong>Update: </strong>I've since decided this is NOT a good way of doing things. </p>
<p>I re-evaluated what should be a .NET theme, and what shouldn't.  Themes should be limited to theme-specific style only.  <code>_masterpages.css</code> and <code>_reset.css</code> are utility stylesheets, but not 'style specific' stylesheets.  So, I've moved them into a 'stylesheet' folder ouside of the App_Themes folder.</p>
</div> 
      ]]></content>
    </entry>

    <entry>
      <title>Reference JS file when using MasterPages</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/reference_js_file_when_using_masterpages/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.21</id>
      <published>2008-10-09T10:56:00Z</published>
      <updated>2008-10-09T11:09:57Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term=".NET"
        scheme="http://rwbaker.com/index.php/site/category/dotnet/"
        label=".NET" />
      <content type="html"><![CDATA[
        <h3>Problem</h3>
<p>
I need to reference a JS file in the <code>&lt;head&gt;</code> in a Master Page in Visual Studio 2008.  In Visual Studio 2005, I did:
</p>

<pre><code>
&lt;script type="text/javascript" src="&lt;%= Page.ResolveClientURL("~/javascript/jquery/jquery-1.2.6.min.js")%&gt;"&gt;&lt;/script&gt;
</code></pre>

<p>
but this gives me an error: <blockquote>The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;). </blockquote>
</p>
<p>
I tried hunting down the error, and stumbled on <a href="http://www.west-wind.com/weblog/posts/5758.aspx">Rick Strahl's post</a> about a similar issue.  Unfortunately, this didn't work for me.
</p>

<h3>Solution</h3>
<p>
Luckily some of my friends are better developers then I am.  Turns out, the fix <strong>is</strong> to follow Rick Strahl's tip, but to <code>databind()</code> the head in the MasterPage's <code>PageLoad()</code>
<p>

<pre><code>
&lt;head id="html_head" runat="server"&gt;
	&lt;title&gt;City of Jacksonville&lt;/title&gt;
	&lt;script type="text/javascript" src="&lt;%# Page.ResolveClientURL("~/javascript/jquery/jquery-1.2.6.min.js")%&gt;"&gt;&lt;/script&gt;
	&lt;script type="text/javascript" src="&lt;%# Page.ResolveClientURL("~/javascript/actions.js")%&gt;"&gt;&lt;/script&gt;
&lt;/head&gt;
</code></pre>

<p>
Then, in the MasterPage's code behind
</p>

<pre><code>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
	html_head.DataBind()
End Sub
</code></pre> 
      ]]></content>
    </entry>

    <entry>
      <title>USA.gov Redesign</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/usagov_redesign/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.20</id>
      <published>2008-09-26T10:53:01Z</published>
      <updated>2008-09-26T10:58:38Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="General"
        scheme="http://rwbaker.com/index.php/site/category/general/"
        label="General" />
      <content type="html"><![CDATA[
        <p><a href="http://www.andyrutledge.com/">Mr. Rutledge</a> has yet another Redux out, and it&#8217;s a doozy.&nbsp; This time he takes a look at USA.gov and redesigns it for the new ObamAmerica.&nbsp; <a href="http://www.andyrutledge.com/usa-dot-gov-redux.php">It&#8217;s absolutely perfect.</a>
</p> 
      ]]></content>
    </entry>

    <entry>
      <title>IA Summit 2008 wrap up</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/ia_summit_2008_wrap_up/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.14</id>
      <published>2008-05-07T02:02:00Z</published>
      <updated>2008-05-07T03:09:45Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="Conferences"
        scheme="http://rwbaker.com/index.php/site/category/conferences/"
        label="Conferences" />
      <content type="html"><![CDATA[
        <p>IA Summit finished up almost a month ago, but I&#8217;m just now getting around to my summary.
</p>
<ul>
<li><a href="http://www.iasummit.org/2008/" title="IA Summit 2008">IA Summit 2008</a> site</li>
<li>Flickr photos <a href="http://www.flickr.com/photos/tags/iasummit2008/" title="Flickr photos of IA Summit 2008">here</a> and <a href="http://www.flickr.com/photos/tags/iasummit08/" title="Flickr photos of IA Summit 2008">here</a></li>
<li>SlideShare sets <a href="http://www.slideshare.net/tag/iasummit2008" title="IA Summit 2008 Slides">here</a> and <a href="http://www.slideshare.net/tag/iasummit08" title="IA Summit 2008 Slides">here</a></li>
<li>Podcasts for day <a href="http://boxesandarrows.com/view/ia-summit-2008-day-1" title="1"> 1</a> (April 12), <a href="http://boxesandarrows.com/view/ia-summit-2008-day-2" title="2"> 2</a> (April 13), and <a href="http://boxesandarrows.com/view/ia-summit-2008-day-3" title="3"> 3</a> (April 14)</li>
</ul>
<br />
Podcasts of a few good sessions I went to:
<br />
<ul>
<li>Keynote: <a href="http://www.boxesandarrows.com/files/banda/ia-summit-2008-day-1/2008_IA_Summit_Keynote_Address.mp3" title="Journey to the Center of Design">Journey to the Center of Design</a> - <a href="http://www.uie.com/" title="Jared Spool">Jared Spool</a></li>
<li><a href="http://www.boxesandarrows.com/files/banda/ia-summit-2008-day-1/Content_Page_Design_Best_Practices.m4a" title="Content Page Design Best Practices">Content Page Design Best Practices</a> - <a href="http://www.lukew.com/" title="Luke Wroblewski">Luke Wroblewski</a></li>
<li><a href="http://www.boxesandarrows.com/files/banda/ia-summit-2008-day-1/How_to_be_a_User_Experience_Team_of_One.m4a" title="How to be a User Experience Team of One">How to be a User Experience Team of One</a> - <a href="http://ugleah.tumblr.com/" title="Leah Buley">Leah Buley</a></li>
<li><a href="http://www.boxesandarrows.com/files/banda/ia-summit-2008-day-2/The_Information_Architect_and_the_Fighter_Pilot.m4a" title="The information Architect and the Fighter Pilot">The information Architect and the Fighter Pilot</a> - <a href="http://mmilan.typepad.com/" title="Matthew Milan">Matthew Milan</a></li>
</ul>
<p>
I also heard <a href="http://boxesandarrows.com/files/banda/ia-summit-2008-day-1/Inspiration_from_the_Edige%3C/i%3ENew_Patterns_for_Interface_Design.m4a" title="Inspiration from the Edge: New Patterns for Interaction Design">Inspiration from the Edge: New Patterns for Interaction Design</a> by <a href="http://www.poetpainter.com/thoughts/" title="Stephen Anderson">Stephen Anderson</a> was also good, but I&#8217;ve yet to find the time to listen to it.
</p>
<p>
I took <strong>a lot</strong> of notes, and I&#8217;ll be sure to post them as soon as I get the chance to clean them up a bit.
</p> 
      ]]></content>
    </entry>

    <entry>
      <title>Web Form Design by Luke Wroblewski</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/web_form_design_by_luke_wroblewski/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.13</id>
      <published>2008-05-07T01:13:00Z</published>
      <updated>2008-05-07T01:54:05Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="Books"
        scheme="http://rwbaker.com/index.php/site/category/books/"
        label="Books" />
      <content type="html"><![CDATA[
        <p><a href="http://www.lukew.com/">Luke&#8217;s</a> book is out, go get it! <a href="http://www.rosenfeldmedia.com/announcements/2008/05/web_form_design_now_on_sale.php">Web Form Design</a> is fantastic book about all things web forms (no kidding, right?). The book is packed full of great information backed with studies and real world examples.&nbsp; I was lucky enough meet Luke at the Web Form Design all day session at IA Summit 2008.&nbsp; He really knows his stuff, and he put a lot of it in this book!
</p>
<p>
If you buy it at the <a href="http://www.rosenfeldmedia.com/announcements/2008/05/web_form_design_now_on_sale.php">Rosenfeld Media&#8217;s site</a>, the book is $36 and you get the ebook for free. Here is a 15% coupon to almost cover shipping: 242415
</p> 
      ]]></content>
    </entry>

    <entry>
      <title>New jQuery UI release 1.5b4</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/new_jquery_ui_release_15b4/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.12</id>
      <published>2008-05-07T00:56:00Z</published>
      <updated>2008-05-07T03:20:07Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="jQuery"
        scheme="http://rwbaker.com/index.php/site/category/jquery/"
        label="jQuery" />
      <content type="html"><![CDATA[
        <p>One more step closer to being out of beta; and a new site to boot. Check it out at <a href="http://ui.jquery.com">http://ui.jquery.com</a>
</p> 
      ]]></content>
    </entry>

    <entry>
      <title>Expand with JavaScript; Link without JavaScript</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/expand_with_javascript_link_without_javascript/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.7</id>
      <published>2008-04-08T00:37:21Z</published>
      <updated>2008-04-08T01:38:05Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="jQuery"
        scheme="http://rwbaker.com/index.php/site/category/jquery/"
        label="jQuery" />
      <content type="html"><![CDATA[
        <p>Over at <a href="http://www.godbit.com">GodBit</a>, someone needed to show a div when a heading was clicked, but if the user didn&#8217;t have javascript, the heading was a link to a detail page. This sounded like an interesting idea, so I poked around and here is what I ended up with:</p>

<pre><code>
$(document).ready(function(){
 $("h3 a").parent().next("div").hide();
 $("h3 a").click(function() {
  $("h3 a").parent().next("div").slideToggle();
  return false;
 })
});
</code></pre>
</p>
<p>The key here is <code>return false;</code>&#8212;that stops the click from triggering the link.
</p> 
      ]]></content>
    </entry>

    <entry>
      <title>Implementing IE min&#45;width with Javascript</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/implementing_ie_min_width_with_javascript/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.6</id>
      <published>2008-03-25T11:07:00Z</published>
      <updated>2008-03-25T12:13:24Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="jQuery"
        scheme="http://rwbaker.com/index.php/site/category/jquery/"
        label="jQuery" />
      <content type="html"><![CDATA[
        <p><code>min-width</code> works in Firefox and Safari, and even IE 7, but not IE 6 -- big surprise.  However, we can fake it fairly well.  With a little <a href="http://jquery.com">jQuery</a> fun, we can read the min-width value, and then implement it using javascript fairly nicely.</p>

<p>First off, we know we have to attach this to the resize of the browser.  IE seems to execute the resize event many, many times during an actual window resize<sup>1</sup> -- almost as if it were trying to execute it once every pixel resized (just a guess).</p>

<p>Enter the <a href="http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/">wresize jQuery plugin</a>.  This plugin tries to catch when the resize starts, and more importantly, when it finishes, and then executes a function.  The one downside to this plugin is that we cant execute a function that requires us to pass any variables to it. Luckily, we don't need to for this.</p>

<p>Here are the things we need to do:
<ol>
<li>Get the min-width value; if it's not set then we'll default to 760px.</li>
<li>jQuery will give us the value text, so it will return "960px" or the like. We need to strip out the text to convert it from a string to a number.</li>
<li>Then, we need to calculate what size the browser window should be before we invoke the <code>min-width</code>.</li>
<li>Then, we wait.  Wait for the browser to be just the right size.</li>
<li>Set the <code>min-width</code> on the first div inside the body element.</li>
<li>Un-set the <code>min-width</code> when the browser window widens.</li>
</ol>
</p>

<p> Simple, right?  Here's the actual <code>min-width</code> function:</p>

<pre>
<code>
function minwidth() {
  if ( (jQuery.browser.msie) && (jQuery.browser.version==6) ) {
    var cssprop = jQuery("body div").css("min-width");
    if ( cssprop == null ) {
      cssprop = 760; //No min-width; default to min-width of 760
    } else {
      cssprop = parseInt(cssprop); //Convert value to numeric;
    };
    
    //get document margin to figure browser width to look for
    var margin = parseInt( jQuery("body").css("margin-left") ) + parseInt( jQuery("body").css("margin-right") );

    //21px is the width of the scroll bar.
    if (clientwidth() < (cssprop + margin + 21)) {
      jQuery(document.body).width(cssprop); //Set fixed-width
    } else {
      jQuery(document.body).width("auto"); //Un-set fixed-width
    };
  };
};
</code>
</pre>

<p>
Now that's just the function; we haven't used it yet.  We need to execute this function on page load, and use the wresize plugin to execute the same function on resize.  Luckily, that's simple too.
</p>

<pre>
<code>
$(document).ready(function(){
  minwidth(); //call IE minwidth on page load
  $( window ).wresize( minwidth ); //IE Resize event - resize for min-width
});
</code>
</pre>

<p>We didn't cover the <code>clientwidth()</code> function -- that's how we're getting the browser's window size.  Check out the <a href="http://rwbaker.com/resources/ieminwidth/index.html">example page</a> for the final result.</p>

<p>
<sup>1</sup><a href="http://snook.ca/archives/javascript/ie6_fires_onresize/">http://snook.ca/archives/javascript/ie6_fires_onresize/</a>
</p> 
      ]]></content>
    </entry>

    <entry>
      <title>Google Reader&#45;like Interface Bug Resolved</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/google_reader_like_interface_bug_resolved/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.5</id>
      <published>2008-03-25T09:49:00Z</published>
      <updated>2008-03-25T10:53:07Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="jQuery"
        scheme="http://rwbaker.com/index.php/site/category/jquery/"
        label="jQuery" />
      <content type="html"><![CDATA[
        <p>Well I know everyone was on the edge of their seats, however, all can relax: <a href="http://rwbaker.com/index.php/blog/comments/creating_google_reader_interface_from_scratch_but_stuck_on_a_bug/">the bug</a> has been fixed.</p>

<p>All I did was create a way to manage what &#8216;view state&#8217; I was in, rather then doing a if/then of the current class name.&nbsp; My only made-up explanation I can come up with for why this works is that on page load, <a href="http://jquery.com">jQuery</a> builds a giant array of your page elements and properties.&nbsp; When I start swapping class names around, that array isn&#8217;t being updated. Therefor, I just needed to come up with a method for tracking the state and query that rather then the current class name. Now all is well.</p>

<p><a href="http://rwbaker.com/resources/threadreader/index.html">See it in action</a>, or, you can download the <a href="http://rwbaker.com/resources/threadreader/source/dotnet2/threadReader_dotnet.zip">.NET project</a> and see it in action.&nbsp; I don&#8217;t care for .NET, but it&#8217;s what I had at the time&#8212;that and I don&#8217;t know php (yet).
</p> 
      ]]></content>
    </entry>

    <entry>
      <title>Creating Google Reader Interface from Scratch; but Stuck on a Bug</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/creating_google_reader_interface_from_scratch_but_stuck_on_a_bug/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.4</id>
      <published>2008-03-15T01:37:00Z</published>
      <updated>2008-03-15T04:19:57Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="jQuery"
        scheme="http://rwbaker.com/index.php/site/category/jquery/"
        label="jQuery" />
      <content type="html"><![CDATA[
        <p>With a little down time at work, I started to make a few jQuery example pages for some quick documentation.&nbsp; One thing led to another, and I&#8217;ve decided to build a light version of the Google Reader interface.  <a href="http://rwbaker.com/resources/threadreader/">Check it out.</a>
</p>

<h3>Ground Rules</h3>
<ol>
<li><em>No cheating.</em> I didn&#8217;t want to see how Google did it&#8212;I wanted to plan the app from scratch. This way, I get a little practice planning the app&#8217;s architecture; How I track if each article is read, collapsed, etc. </li>
<li><em>Baby steps.</em> Rome wasn&#8217;t built in a day, and this app won&#8217;t be up and running full speed ahead any time soon.&nbsp; For starters, I&#8217;m just building the thread view.&nbsp; Perhaps sometime later we&#8217;ll have the feed menu on the side, but not today.</li>
</ol>

<h3>Progress</h3>
<dl>
<dt>Day 1</dt>
<dd>Day 1 was basic framework and concept. This is were I started with the basic expand and collapse example, and it grew from there.</dd>
<dt>Day 2</dt>
<dd>Thread views done. Mark all read and mark all unread buttons working, threads expanding and collapsing, and a read all button.</dd>
<dt>Day 3</dt>
<dd>I realized that I was missing the Expanded View and List View tabs.&nbsp; Adding these in required changing the way I track the read state of each thread, basically a complete change on my methodology&#8212;more on this later.&nbsp; I also found a doozy of a bug&#8212;more on this later, too.</dd>
<dt>Day 4</dt>
<dd>Major code overhall.&nbsp; Slimmed down my code to make shorted lines and smarter actions.&nbsp; I pulled out any duplicate actions and created reusable, chainable functions.</dd>
</dl>

<h3>The Bug</h3>
<p>I wrote a <a href="http://groups.google.com/group/jquery-en/browse_thread/thread/c6d9518199e2e227">detailed, albeit probably jumbled</a>, post to on jQuery&#8217;s Google Group about my bug.&nbsp; Here&#8217;s a quick recap:&nbsp; I have two functions that depend on a wrapper div&#8217;s class.&nbsp; When I first load the page, I set that wrapper&#8217;s class based on a cookie.&nbsp; From then on, my two functions don&#8217;t function based on what the wrapper div currently <em>is</em>, but what it <em>was</em> at page load. Somehow it&#8217;s not seeing the current wrapper class.&nbsp; Do you know why? Two gold stars to anyone who solves it!</p>

<h3>The Future</h3>
<p>I started building this interface just to see what I could do with <a href="http://jquery.com">jQuery</a>.  Once I get all the bugs worked out, I'd be nice to hook it up to a <abbr title="Really Simple Syndication">RSS</abbr> feed and see it actually function.  Perhaps a good excuse to start learning PHP, and maybe even <a href="http://codeigniter.com/">Code Igniter.</a></p> 
      ]]></content>
    </entry>

    <entry>
      <title>Implimenting Syntax Highlighting on Instiki</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/implimenting_syntax_highlighting_on_instiki/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.3</id>
      <published>2008-03-06T14:05:00Z</published>
      <updated>2008-03-06T14:23:17Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <content type="html"><![CDATA[
        <a href="www.instiki.org">Instiki</a> is a light wiki built on <a href="http://www.rubyonrails.org/">Ruby On Rails</a>, however I'm not sure if it is still be maintained.  I use it to maintain a lot of ideas and examples, mostly code heavy content.  One thing that could make Instiki better would be syntax highlighting -- so lets implement it.

<h3>Implementation</h3>

First off, download <a href="http://code.google.com/p/syntaxhighlighter/">Syntax Highlighter</a> by Alex Gorbatchev. Move the respective files to:
<ul>
<li>/instiki/public/javascripts/highlighter/</li>
<li>/instiki/public/stylesheets/highlighter/</li>
<li>/instiki/public/flash/highlighter/</li>
</ul>

You'll need to make the 'flash' folder and the highlighter folders, but I think this keeps things organized.

Now, lets open <code>/instiki/app/views/layouts/default.rhtml</code> and start implementing.

I'm not entirely sure how/where all the javascript is being rolled into the main template page of Instiki, so instead of tracking that down we can just put some good ol' fashioned <code>&lt;style&gt;&lt;/style&gt;</code> links.

Right after <code>&lt;%= javascript_include_tag :defaults %&gt;</code> put:

<pre name="code" class="html">
	&lt;link type="text/css" rel="stylesheet" href="/stylesheets/highlighter/SyntaxHighlighter.css"&gt;&lt;/link&gt;
	
	&lt;script type="text/javascript" src="/javascripts/highlighter/shCore.js"&gt;&lt;/script&gt;
	&lt;script type="text/javascript" src="/javascripts/highlighter/shBrushCss.js"&gt;&lt;/script&gt;
	&lt;script type="text/javascript" src="/javascripts/highlighter/shBrushJScript.js"&gt;&lt;/script&gt;
	&lt;script type="text/javascript" src="/javascripts/highlighter/shBrushXml.js"&gt;&lt;/script&gt;
	&lt;script type="text/javascript" src="/javascripts/highlighter/shBrushVb.js"&gt;&lt;/script&gt;
</pre>

Now I only added the few language files that I needed -- You, of course, should link to whichever ones you need.

At the bottom of <code>default.rhtml</code>, right above <code>&lt;/body&gt;</code> put:

<pre name="code" class="html">
	&lt;script language="javascript"&gt;
		dp.SyntaxHighlighter.ClipboardSwf = '/flash/highlighter/clipboard.swf';
		dp.SyntaxHighlighter.HighlightAll('code');
	&lt;/script&gt;
</pre>
	
<h3>Usage</h3>
Using a <code>&lt;pre&gt;</code> tag, set <code>name</code> attribute to <code>code</code> and <code>class</code> attribute to the language of your choosing.
<pre>
&lt;pre name="code" class="js"&gt;
... some code here ...
&lt;/pre&gt;
</pre>
For the full run down of it's usage and options, check out the <a href="http://code.google.com/p/syntaxhighlighter/wiki/Usage">project page</a>.

<h3>Languages</h3>

<table>
<tr><th>Language</th><th>Class Name(s)</th></tr>
<tr><td>C++</td><td><code>cpp, c, c++</code></td></tr>
<tr><td>C#</td><td><code>c#, c-sharp, csharp</code></td></tr>
<tr><td>CSS</td><td><code>css</code></td></tr>
<tr><td>Delphi</td><td><code>delphi, pascal</code></td></tr>
<tr><td>Java</td><td><code>java</code></td></tr>
<tr><td>Java Script</td><td><code>js, jscript, javascript</code></td></tr>
<tr><td>PHP</td><td><code>php</code></td></tr>
<tr><td>Python</td><td><code>py, python</code></td></tr>
<tr><td>Ruby</td><td><code>rb, ruby, rails, ror</code></td></tr>
<tr><td>Sql</td><td><code>sql</code></td></tr>
<tr><td>VB</td><td><code>vb, vb.net</code></td></tr>
<tr><td>XML/HTML</td><td><code>xml, html, xhtml, xslt</code></td></tr>
</table>

<h3>Caveat</h3>
The <code>name</code> attribute on a <code>&lt;pre&gt;</code> tag is not valid XHTML. 
      ]]></content>
    </entry>

    <entry>
      <title>Coffee = Yummy</title>
      <link rel="alternate" type="text/html" href="http://rwbaker.com/index.php/site/coffee/" />
      <id>tag:rwbaker.com,2008:index.php/blog/index/1.1</id>
      <published>2008-02-18T03:23:01Z</published>
      <updated>2008-02-18T03:33:08Z</updated>
      <author>
            <name>rich</name>
            <email>rich@rwbaker.com</email>
                  </author>

      <category term="General"
        scheme="http://rwbaker.com/index.php/site/category/general/"
        label="General" />
      <content type="html"><![CDATA[
        <p>oh mr coffee. why are you so yummy
<br />
you make me so happy mr coffee
<br />
so happy in my tummy
</p>
<p>
(by the way, Hello World)
</p> 
      ]]></content>
    </entry>


</feed>