<?xml version="1.0"?>
<rss version="2.0"><channel><title>Devplace</title><link>http://www.devplace.nl/blog</link><lastBuildDate>Sat, 26 Dec 09 10:54:52 +0100</lastBuildDate><generator>Habari 0.7-alpha http://habariproject.org/</generator><item><title>Loading SyntaxHighlighter on demand</title><link>http://www.devplace.nl/blog/loading-syntaxhighlighter-on-demand</link><description>SyntaxHighlighter is a great JavaScript script, but it lacks one important feature in my opinion.&#xD;
&#xD;
For this blog, I needed a syntax highlighter for the code examples that will be shown here. I soon found &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter"&gt;SyntaxHighlighter&lt;/a&gt; as I was looking for an unobtrusive JavaScript solution. But there's one thing that I didn't like about it. You need to load all JavaScript files in advance even if you don't need syntax highlighting on a given page. This is not a problem when you're building static pages, because then you can just include the needed JavaScript files yourself. For this blog however I wanted SyntaxHighlighter to be loaded on demand without specifying for which page the SyntaxHighlighter should be loaded.&#xD;
&#xD;
So I came up with the nifty JavaScript solution below. It uses &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; because jQuery is already loaded on all pages of this blog. But it shouldn't be so hard to do the same without jQuery.&#xD;
&#xD;
&lt;pre class="brush: javascript"&gt;&#xD;
$(document).ready(&#xD;
	function() {&#xD;
&#xD;
		// only load syntax hilighter when needed&#xD;
		// So check for any HTML &amp;lt;pre&amp;gt; elements for which the class attribute starts with 'brush'&#xD;
		if ($(&amp;quot;pre[class^=brush]&amp;quot;).length &amp;gt; 0) {&#xD;
	&#xD;
			var jsPath = themeUrl + '/js/hilighter/';&#xD;
			var cssPath = themeUrl + '/css/hilighter/';&#xD;
	&#xD;
			// Defines which languages should be supported&#xD;
			var brushes = ['Bash','Php','Plain','JScript', 'Sql'];&#xD;
	&#xD;
			var jsBrushes = '';&#xD;
			for (var i = 0; i &amp;lt; brushes.length; i) {&#xD;
				jsBrushes  = '&amp;lt;script src=&amp;quot;' + jsPath + 'shBrush' + brushes[i] + '.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;';&#xD;
			}&#xD;
	&#xD;
			// Append SyntaxHighlighter scripts to the HTML head&#xD;
			$(&amp;quot;head&amp;quot;).append(&#xD;
				'&amp;lt;script src=&amp;quot;' + jsPath + 'shCore.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;' +&#xD;
				  jsBrushes +&#xD;
				  '&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;' + cssPath + 'shCore.css&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt;' +&#xD;
				  '&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;' + cssPath + 'shThemeDefault.css&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt;'&#xD;
			);&#xD;
			// Apply SyntaxHilighlighter&#xD;
			SyntaxHighlighter.all();&#xD;
		}&#xD;
	}&#xD;
);&#xD;
&lt;/pre&gt;&#xD;
&#xD;
I think the script is pretty much self-explanatory. First we check if there are one or more PRE-elements having a classname that starts with "brush". If one or more of such PRE-elements exist in our HTML code, the appropriate SyntaxHighlighter CSS and JavaScript files will be loaded by adding script tags to the HTML head.</description><pubDate>Tue, 01 Sep 09 22:12:07 +0200</pubDate><guid isPermaLink="false">tag:devplace.vandesande.no-ip.org,2009:loading-syntaxhighlighter-on-demand/1251835910</guid></item><item><title>About me</title><link>http://www.devplace.nl/blog/about-me</link><description>Hi, my name is Joris van de Sande.&#xD;
&#xD;
&lt;span class="image right"&gt;&lt;img src="/blog/user/files/images/digger.gif" alt="Screenshot of Digger" title="Screenshot of Digger computer game"&gt;&lt;/span&gt; From the moment that I was born in 1983, I have always been interested in technology. My first experience with a PC was back in 1991 when my parents bought their first PC (based on an &lt;a href="http://en.wikipedia.org/wiki/Intel_80286"&gt;Intel 80286 processor&lt;/a&gt;). In these days I used the computer to play games like &lt;a href="http://en.wikipedia.org/wiki/Tetris"&gt;Tetris&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Digger_%28computer_game%29"&gt;Digger&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Space_invaders"&gt;Space Invaders&lt;/a&gt; and to create documents in &lt;a href="http://en.wikipedia.org/wiki/Word_perfect"&gt;Word Perfect 5.1&lt;/a&gt; (for &lt;a href="http://en.wikipedia.org/wiki/DOS"&gt;DOS&lt;/a&gt;). &#xD;
&#xD;
Fast forward a few years (I think it must be 1996) and I was playing around with &lt;a href="http://en.wikipedia.org/wiki/DBase"&gt;DBase III&lt;/a&gt; databases. A couple of months later my dad learned me how to interact with the DBase databases via the programming language &lt;a href="http://en.wikipedia.org/wiki/Clipper_%28programming_language%29"&gt;Clipper&lt;/a&gt; and how to create a simple user interface with it. After some time my first useful program called "Taal" (which means "Language" in Dutch) was born. I used it to learn foreign languages like English and German.&#xD;
&#xD;
&lt;span class="image left"&gt;&lt;a href="http://www.php.net"&gt;&lt;img src="/blog/user/files/images/php_logo.png" alt="PHP Logo" title="PHP Programming Language"&gt;&lt;/a&gt;&lt;/span&gt; In 1999 I created a simple HTML website for my group of friends, to let the world know about our existence. That was one of my first experiences with building websites. One year later I redesigned the website (with Dreamweaver) and I wanted the website to be more interactive, so I stumbled upon &lt;a href="http://www.php.net"&gt;PHP&lt;/a&gt; (version 3.x at that time) and started writing PHP scripts. Soon a &lt;a href="http://www.mysql.com/"&gt;MySql&lt;/a&gt; database was in use too.&#xD;
&#xD;
&lt;span class="image right"&gt;&lt;img src="/blog/user/files/images/aboutme/softwaredesign_gone_wrong.jpg" alt="Software Design gone Wrong" title="Software Design gone Wrong (&amp;copy; geeksaresexy.net)"&gt;&lt;br&gt;&lt;small&gt;&amp;copy; &lt;a href="http://www.geeksaresexy.net/gas-cartoons/"&gt;geeksaresexy.net&lt;/a&gt;&lt;/small&gt;&lt;/span&gt; A couple of years, programs and websites later I went to college and I received my bachelor degree in Computer Science in 2005. In November 2005, I started working as a Junior Application Programmer at &lt;a href="http://www.prezent.nl"&gt;Prezent Internet&lt;/a&gt;. At that time I was mainly working on customer websites (build in &lt;a href="http://www.php.net"&gt;PHP&lt;/a&gt;), creating frontends and new modules for the CMS that was build in house.&#xD;
&#xD;
Today I work as a Software Architect at &lt;a href="http://www.prezent.nl"&gt;Prezent Internet&lt;/a&gt;. I am responsible for the architecture of most web applications that are build by Prezent Internet today. Besides that I spend my days coding (&lt;a href="http://www.php.net"&gt;PHP&lt;/a&gt;, JavaScript, HTML, CSS and MySql), teaching my colleagues about software design and object oriented programming, maintaining the CMS and sometimes I even act as a system administrator (for Windows and Linux).&#xD;
&#xD;
When I have some spare time I like to listen to music, watch (action) movies or one of my favorite TV series (&lt;a href="http://www.cbs.com/primetime/numb3rs/"&gt;Numb3rs&lt;/a&gt;, &lt;a href="http://www.cbs.com/primetime/ncis/"&gt;NCIS&lt;/a&gt; and &lt;a href="http://www.fox.com/house/"&gt;House&lt;/a&gt;), drink some beer with my friends, visit a dance festival, browse the Internet for interesting (open source) projects and other stuff that I am interested in, play with different operating systems and I like programming. </description><pubDate>Fri, 14 Aug 09 21:30:52 +0200</pubDate><guid isPermaLink="false">tag:habari.vandesande.no-ip.org,2009:about/1250278276</guid></item></channel></rss>

