<?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>soderlind.no</title>
	<atom:link href="http://soderlind.no/feed/" rel="self" type="application/rss+xml" />
	<link>http://soderlind.no</link>
	<description>I code for fun</description>
	<lastBuildDate>Fri, 16 Jul 2010 13:05:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Node.js</title>
		<link>http://soderlind.no/archives/2010/06/30/node-js/</link>
		<comments>http://soderlind.no/archives/2010/06/30/node-js/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 21:54:25 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=994</guid>
		<description><![CDATA[If you haven&#8217;t looked at Node.js, you should. Node.js is “evented I/O for V8 javascript”.  With Node.js (and its well documented api) you can write extremely high performance non-blocking event driven network servers in JavaScript. Here&#8217;s a simple chat server and client I wrote using Node.js, Faye and the Connect middleware. app.js (the chat server, [...]]]></description>
			<content:encoded><![CDATA[<p>
If you haven&#8217;t looked at <a href="http://nodejs.org/">Node.js</a>, you should. Node.js is “<a href="http://membership.thinkvitamin.com/library/javascript/nodejs/introduction">evented I/O</a> for V8 javascript”.  With Node.js (and its <a href="http://nodejs.org/api.html">well documented api</a>) you can write <a href="http://groups.google.com/group/nodejs/msg/afb6e7273042f90a">extremely high performance</a> non-blocking event driven network servers in JavaScript.
</p>
<p>
Here&#8217;s a simple chat server and client I wrote using Node.js, <a href="http://faye.jcoglan.com/">Faye</a> and the <a href="http://howtonode.org/connect-it">Connect middleware</a>.
</p>
<p><span id="more-994"></span><br />
app.js (the chat server, run using <code><a href="http://github.com/extjs/Connect">connect</a> app.js -p 8080</code>):</p>
<pre class="brush: jscript;">
var Faye = require('./lib/faye-node');

var fayeServer = new Faye.NodeAdapter({
  mount:    '/faye',
  timeout:  45
});
var cometServer = {
    handle: function(req, res, next){
                  if (fayeServer.call(req, res)) return;

                  // Handle non-Faye requests
                  res.writeHead(200, {'Content-Type': 'text/plain'});
                  res.end('Hello, non-Faye request');
    }
};

module.exports = require('./lib/connect').createServer([
    { module: cometServer }
]);
</pre>
<p>client.html:</p>
<pre class="brush: jscript;">
&lt;html&gt;
	&lt;head&gt;
		&lt;script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'&gt;&lt;/script&gt;
		&lt;script type=&quot;text/javascript&quot; src=&quot;http://localhost:8080/faye.js&quot;&gt;&lt;/script&gt;
		&lt;script type=&quot;text/javascript&quot;&gt;
			$(document).ready(function() {
			    var client = new Faye.Client('http://localhost:8080/faye');
				// receive chat messages
				client.subscribe('/messages', function(message) {
					var p = $(&quot;&lt;div class='chat' style='display:block;'&gt;&lt;div class='content'&gt;&quot; + message.text + &quot;&lt;/div&gt;&lt;/div&gt;&quot;);
					$('#chats').append(p);
					$('#chats').scrollTop($('#chats').attr(&quot;scrollHeight&quot;));
				});
		    	// send message to the chat server
				$(&quot;#pubmsg&quot;).keyup(function(event) {
				  	if (event.keyCode == '13' || event.keyCode == undefined) {
				    	client.publish('/messages', {
						  text: $(&quot;#pubmsg&quot;).val()
						});
						$(&quot;#pubmsg&quot;).val(&quot;&quot;).focus();
				  	}
				});	

				$('#pubsend').click(function() {
				  $('#pubmsg').keyup();
				});
		    });
		&lt;/script&gt;
		&lt;style type=&quot;text/css&quot;&gt;
			#chats {
				width: 300px;
				height:200px;
				border: solid 1px #000;
				overflow:auto;
			}
		&lt;/style&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;div id=&quot;chats&quot;&gt;&lt;/div&gt;
		&lt;input type=&quot;text&quot; id=&quot;pubmsg&quot; value=&quot;&quot; style=&quot;width:296px;margin:0px&quot;/&gt; &lt;input type=&quot;button&quot; id=&quot;pubsend&quot; value=&quot;send&quot; /&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/06/30/node-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010: Customize out of the box Application Pages (AccessDenied, Confirmation, Error, Login, RequestAccess, Signout, WebDeleted )</title>
		<link>http://soderlind.no/archives/2010/05/26/customize-out-of-the-box-application-pages-accessdenied-confirmation-error-login-requestaccess-signout-webdeleted/</link>
		<comments>http://soderlind.no/archives/2010/05/26/customize-out-of-the-box-application-pages-accessdenied-confirmation-error-login-requestaccess-signout-webdeleted/#comments</comments>
		<pubDate>Wed, 26 May 2010 13:38:26 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[sharepoint 2010]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=981</guid>
		<description><![CDATA[In SharePoint 2010, for security reasons, master pages are not applied to the application pages AccessDenied, Confirmation, Error, Login, RequestAccess, Signout and WebDeleted, instead you’ll have to create a new custom application page and run the power shell command Set-SPCustomLayoutsPage.(source http://live.visitmix.com/MIX10/Sessions/PR02 &#8211; a must-see): In WSS3.0 and MOSS2007 it was a real headache to customise [...]]]></description>
			<content:encoded><![CDATA[<p>In SharePoint 2010, for security reasons, master pages are not applied to the application pages AccessDenied, Confirmation, Error, Login, RequestAccess, Signout and WebDeleted, instead you’ll have to create a new custom application page and run the power shell command Set-SPCustomLayoutsPage.(source <a href="http://live.visitmix.com/MIX10/Sessions/PR02">http://live.visitmix.com/MIX10/Sessions/PR02</a> &#8211; a must-see):</p>
<p><span id="more-981"></span></p>
<div id="_mcePaste" style="padding-left: 30px;">In WSS3.0 and MOSS2007 it was a real headache to customise pages such as the Access Denied page or Sign Out page without editing the out of the box SharePointRoot files.</div>
<div id="_mcePaste" style="padding-left: 30px;">In SPF2010 and SPS2010 this has changed with the introduction of PowerShell commands to point the location of the application page to a newly created customised one.</div>
<pre style="padding-left: 30px;">Get-SPCustomLayoutsPage -Identity "AccessDenied | Confirmation | Error | Login | RequestAccess | Signout | WebDeleted</pre>
<pre style="padding-left: 30px;">Set-SPCustomLayoutsPage</pre>
<div id="_mcePaste" style="padding-left: 30px;">&#8220;Following PS Command replaces Request Access Page (reqacc.aspx) in layouts folder, assuming customized version of Request Access page is deployed to custompages folder under layouts directory</div>
<pre style="padding-left: 30px;">Set-SPCustomLayoutsPage -Identity "RequestAccess" -RelativePath "/_layouts/custompages/reqacc.aspx" -WebApplication "{replace with web app url}"</pre>
<pre style="padding-left: 30px;"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">(source <a href="http://www.sharepointadminwiki.com/display/sp2010/Customise+out+of+the+box+Application+Pages">http://www.sharepointadminwiki.com/display/sp2010/Customise+out+of+the+box+Application+Pages</a>)</span></pre>
<div id="_mcePaste">Set-SPCustomLayoutsPage: <a href="http://technet.microsoft.com/en-us/library/ff607768.aspx">http://technet.microsoft.com/en-us/library/ff607768.aspx</a></div>
<div id="_mcePaste">Get-SPCustomLayoutsPage: <a href="http://technet.microsoft.com/en-us/library/ff607821.aspx">http://technet.microsoft.com/en-us/library/ff607821.aspx</a></div>
<p>So, don’t change the files (error.aspx, login.aspx etc) in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS, but use them as templates for the new custom pages</p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/05/26/customize-out-of-the-box-application-pages-accessdenied-confirmation-error-login-requestaccess-signout-webdeleted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My iPad 64GB 3G</title>
		<link>http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/</link>
		<comments>http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/#comments</comments>
		<pubDate>Tue, 11 May 2010 23:55:12 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=957</guid>
		<description><![CDATA[My iPad is running these apps: You&#8217;ll find them at the iTunes app store: Air Video BBC News Brushes IMDb Movies &#38; TV Kindle Labyrinth 2 SketchBook Pro sobees for Facebook TV-Guide Wikipanion]]></description>
			<content:encoded><![CDATA[<p><strong>My iPad is running these apps:</strong></p>
<p><strong> </strong></p>
<p><strong>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/air-video/' title='air-video'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/air-video-100x100.jpg" class="attachment-thumbnail" alt="air-video" title="air-video" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/bbc-news/' title='bbc-news'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/bbc-news-100x100.jpg" class="attachment-thumbnail" alt="bbc-news" title="bbc-news" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/brushes/' title='brushes'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/brushes-100x100.jpg" class="attachment-thumbnail" alt="brushes" title="brushes" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/imdb/' title='imdb'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/imdb-100x100.jpg" class="attachment-thumbnail" alt="imdb" title="imdb" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/kindle/' title='kindle'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/kindle-100x100.jpg" class="attachment-thumbnail" alt="kindle" title="kindle" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/labyrinth-2/' title='Labyrinth 2'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/Labyrinth-2-100x100.jpg" class="attachment-thumbnail" alt="Labyrinth 2" title="Labyrinth 2" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/sketchbook-pro/' title='SketchBook Pro'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/SketchBook-Pro-100x100.jpg" class="attachment-thumbnail" alt="SketchBook Pro" title="SketchBook Pro" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/sobees/' title='sobees'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/sobees-100x100.jpg" class="attachment-thumbnail" alt="sobees" title="sobees" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/tv-guide/' title='TV Guide'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/TV-Guide-100x100.jpg" class="attachment-thumbnail" alt="TV Guide" title="TV Guide" /></a>
<a href='http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/wikipanion/' title='wikipanion'><img width="100" height="100" src="http://soderlind.no/wp-content/uploads/2010/05/wikipanion-100x100.jpg" class="attachment-thumbnail" alt="wikipanion" title="wikipanion" /></a>
</p>
<p></strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>You&#8217;ll find them at the iTunes app store:</strong></p>
<ul>
<li><a href="http://itunes.apple.com/no/app/air-video-watch-your-videos/id306550020?mt=8">Air Video</a></li>
<li><a href="http://itunes.apple.com/no/app/bbc-news/id364147881?mt=8">BBC News</a></li>
<li><a href="http://itunes.apple.com/no/app/id363590649?mt=8">Brushes</a></li>
<li><a href="http://itunes.apple.com/no/app/imdb-movies-tv/id342792525?mt=8">IMDb Movies &amp; TV</a></li>
<li><a href="http://itunes.apple.com/no/app/kindle/id302584613?mt=8">Kindle</a></li>
<li><a href="http://itunes.apple.com/no/app/labyrinth-2-hd/id307758975?mt=8">Labyrinth 2</a></li>
<li><a href="http://itunes.apple.com/no/app/sketchbook-pro/id364253478?mt=8">SketchBook Pro</a></li>
<li><a href="http://itunes.apple.com/no/app/sobees-for-facebook/id370382132?mt=8">sobees for Facebook</a></li>
<li><a href="http://itunes.apple.com/no/app/tv-guide-for-ipad/id364307077?mt=8">TV-Guide</a></li>
<li><a href="http://itunes.apple.com/no/app/wikipanion-for-ipad/id364195592?mt=8">Wikipanion</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/05/12/my-ipad-64gb-3g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>radial navigation in html5</title>
		<link>http://soderlind.no/archives/2010/03/25/radial-navigation-in-html5/</link>
		<comments>http://soderlind.no/archives/2010/03/25/radial-navigation-in-html5/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 18:00:41 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=923</guid>
		<description><![CDATA[Sorry no IE  (might work in IE9 platform preview), so open these in a modern browser: DONUT™ &#8211; Radial Navigator ASK KEN™Visual Knowledge Browser]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://soderlind.no/wp-content/uploads/2010/03/radial-navigation.png" rel="wp-prettyPhoto[g923]"><img class="aligncenter size-medium wp-image-924" style="border: 1px solid #000;" title="radial-navigation" src="http://soderlind.no/wp-content/uploads/2010/03/radial-navigation-300x225.png" alt="" width="300" height="225" /></a></p>
<p>Sorry no IE  (might work in <a href="http://ie.microsoft.com/testdrive/">IE9 platform preview</a>), so open these in a modern browser:</p>
<ul>
<li><a href="http://quasipartikel.at/donut/">DONUT™ &#8211; Radial Navigator</a></li>
<li><a href="http://askken.heroku.com/">ASK KEN™Visual Knowledge Browser</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/03/25/radial-navigation-in-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress plugin template</title>
		<link>http://soderlind.no/archives/2010/03/04/wordpress-plugin-template/</link>
		<comments>http://soderlind.no/archives/2010/03/04/wordpress-plugin-template/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 10:21:45 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[wp-plugins]]></category>
		<category><![CDATA[admin_print_scripts]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugins_url]]></category>
		<category><![CDATA[wp_enqueue_script]]></category>
		<category><![CDATA[wp_localize_script]]></category>
		<category><![CDATA[wp_print_scripts]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=873</guid>
		<description><![CDATA[UPDATE: You can create a personalized plugin template by using my WordPress Plugin Template Creator When I  rewrote my WP-DenyHost plugin, I wanted to do it as fast as possible. Instead of reinventing the wheel (again), I googled after a plugin template and found a very good one at Pressography. It had most of what [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE</strong>: You can create a personalized plugin template by using my <a href="http://soderlind.no/wordpress-plugin-template-creator/">WordPress Plugin Template Creator</a></p>
<p>When I  rewrote my <a href="http://soderlind.no/archives/2008/04/18/wp-denyhost/">WP-DenyHost</a> plugin, I wanted to do it as fast as possible. Instead of reinventing the wheel (again), I googled after a plugin template and found a very good one at <a href="http://pressography.com/plugins/wordpress-plugin-template/">Pressography</a>. It had most of what I needed in a plugin template.</p>
<p><span id="more-873"></span></p>
<h3>Modifications to the Pressography plugin template</h3>
<p>I&#8217;ve made some changes to the Pressography plugin template and I have explained them below.  Before you continue to read this article, you should view the video at <a href="http://pressography.com/plugins/wordpress-plugin-template/">Pressography</a>, it presents the idea behind the plugin template and how it works. You get the full source of my modified plugin template by using my <a href="http://soderlind.no/wordpress-plugin-template-creator/">WordPress Plugin Template Creator</a></p>
<p>Being able to use new functionality in WordPress, I&#8217;ve decided that my plugins will only support WordPress one <a href="http://en.wikipedia.org/wiki/Software_versioning#Incrementing_sequences">minor version</a> lower than the current i.e. the current is 2.9 and hence my plugins and this plugin template will only supports WordPress 2.8 and later.</p>
<h3>plugins_url()</h3>
<p>WordPress 2.8 extended the <a href="http://codex.wordpress.org/Function_Reference/plugins_url">plugins_url</a>() function which makes it easy to find the plugin location. In the plugin template constructor, I use plugins_url() to find the languages files and the plugin itself:</p>
<pre class="brush: php; gutter: false;">
function __construct(){
	//Language Setup
	$locale = get_locale();
	$mo = plugins_url(&quot;/languages/&quot; . $this-&gt;localizationDomain . &quot;-&quot;.$locale.&quot;.mo&quot;, __FILE__);
	load_textdomain($this-&gt;localizationDomain, $mo);

	//&quot;Constants&quot; setup
	$this-&gt;url = plugins_url(basename(__FILE__), __FILE__);
	$this-&gt;urlpath = plugins_url('', __FILE__);

	//Initialize the options
	$this-&gt;getOptions();

	//Actions
	add_action(&quot;admin_menu&quot;, array(&amp;$this,&quot;admin_menu_link&quot;));
	add_action('wp_print_scripts', array(&amp;$this,'{plugin_slug}_script'));
	add_action(&quot;init&quot;, array(&amp;$this,&quot;{plugin_slug}_init&quot;));
}
</pre>
<h3>Adding JavaScript</h3>
<p>I&#8217;ve done it and I still see plugin authors adding scripts using the wp_head function. There&#8217;s only one correct way of adding scripts, and that&#8217;s using <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a> via one of the script hooks (admin_print_scripts, wp_print_scripts etc). wp_enqueue_script makes sure that the script loads in the correct order and that a script is only loaded once (e.g. If another plugin has already loaded jQuery, my plugin will not load jQuery, but use the script already loaded).</p>
<p>I&#8217;ve added the wp_print_scripts hook to the plugin template (see the constructor above)  since it&#8217;s the generic load-script-hook. The wp_print_scripts hook adds the  {plugin_slug}_script function in which  I enqueue the scripts:</p>
<pre class="brush: php; gutter: false;">
function {plugin_slug}_script() {
	if (is_admin()){ // Only run when in wp-admin. Other conditional tags at http://codex.wordpress.org/Conditional_Tags
		wp_enqueue_script('jquery'); // other scripts included with WordPress: http://tinyurl.com/y875age
		wp_enqueue_script('jquery-validate', 'http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js', array('jquery'));
		wp_enqueue_script('{plugin_slug}_script', $this-&gt;url.'?{plugin_slug}_javascript', array('jquery-validate')); // load embedded javascript
		wp_localize_script( '{plugin_slug}_script', '{plugin_slug}_lang', array(
			'required' =&gt; __('Please enter a number.', $this-&gt;localizationDomain),
			'number'   =&gt; __('Please enter a number.', $this-&gt;localizationDomain),
			'min'	   =&gt; __('Please enter a value greater than or equal to 1.', $this-&gt;localizationDomain),
		));
	}
}
</pre>
<p>wp_localize_script, in the code above, creates a JavaScript object that passes the language strings to the embedded JavaScript:</p>
<pre class="brush: jscript; gutter: false;">
&lt;script type='text/javascript'&gt;
/* CDATA[ */
var {plugin_slug}_lang = {
	required: &quot;Please enter a number.&quot;,
	number: &quot;Please enter a number.&quot;,
	min: &quot;Please enter a value greater than or equal to 1.&quot;
};
/* ]]&gt; */
&lt;/script&gt;
</pre>
<h3>Embedding JavaScript</h3>
<p>When I write my plugins I like to keep the code in one file, that&#8217;s why I also embed the JavaScript code:</p>
<pre class="brush: php; gutter: false;">
if (isset($_GET['{plugin_slug}_javascript'])) {

	Header(&quot;content-type: application/x-javascript&quot;);
	echo&lt;&lt;&lt;ENDJS
/**
* @desc {Full Plugin Name}
* @author {Author} - {URL}
*/

jQuery(document).ready(function(){
	jQuery(&quot;#{plugin_slug}_options&quot;).validate({
		rules: {
			{plugin_slug}_option1: {
				required: true,
				number: true,
				min: 1
			}
		},
		messages: {
			{plugin_slug}_option1: {
				// the {plugin_slug}_lang object is define using wp_localize_script() in function {plugin_slug}_script()
				required: {plugin_slug}_lang.required,
				number: {plugin_slug}_lang.number,
				min: {plugin_slug}_lang.min
			}
		}
	});
});

ENDJS;
}
</pre>
<p>Note: If you prefer to keep your JavaScript code in a separate file, you can add it by adding the following to {plugin_slug}_script:</p>
<pre class="brush: php; gutter: false; highlight: [5];">
function {plugin_slug}_script() {
	if (is_admin()){ // Only run when in wp-admin. Other conditional tags at http://codex.wordpress.org/Conditional_Tags
		wp_enqueue_script('jquery'); // other scripts included with WordPress: http://tinyurl.com/y875age
		wp_enqueue_script('jquery-validate', 'http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js', array('jquery'));
		wp_enqueue_script('{plugin_slug}_script', $this-&gt;urlpath.'/myscript.js', array('jquery)); //load your script
		wp_localize_script( '{plugin_slug}_script', '{plugin_slug}_lang', array(
			'required' =&gt; __('Please enter a number.', $this-&gt;localizationDomain),
			'number'   =&gt; __('Please enter a number.', $this-&gt;localizationDomain),
			'min'	   =&gt; __('Please enter a value greater than or equal to 1.', $this-&gt;localizationDomain),
		));
	}
}
</pre>
<h3>WordPress Plugin Template Creator</h3>
<p>While writing this article, I decided to create a tool that will create a personalized plugin template. The <a href="http://soderlind.no/wordpress-plugin-template-creator/">WordPress Plugin Template Creator</a> takes your input, creates the necessary slugs and returns a personalized plugin template you can build your own plugin with.</p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/03/04/wordpress-plugin-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When .LESS is more</title>
		<link>http://soderlind.no/archives/2010/03/04/when-less-is-more/</link>
		<comments>http://soderlind.no/archives/2010/03/04/when-less-is-more/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 22:01:06 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=864</guid>
		<description><![CDATA[@the-border: 1px; @base-color: #111; #header { color: @base-color * 3; border-left: @the-border; border-right: @the-border * 2; } #footer { color: (@base-color + #111) * 1.5; } ul { list-style-type: none; height: 30px; li { float: left; padding-right: 15px; a { padding: 5px; display: block; color: black; text-decoration: none; } a:hover { background-color: @menu_color - #222; [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
@the-border: 1px;
@base-color: #111;

#header {
	color: @base-color * 3;
	border-left: @the-border;
	border-right: @the-border * 2;
}

#footer {
	color: (@base-color + #111) * 1.5;
}

ul
{
	list-style-type: none;
	height: 30px;

	li
	{
		float: left;
		padding-right: 15px;

		a
		{
			padding: 5px;
			display: block;
			color: black;
			text-decoration: none;
		}

		a:hover
		{
			background-color: @menu_color - #222;
		}
	}
}
</pre>
<p>Curious? 4GuysFromRolla has a nice <a href="http://www.4guysfromrolla.com/articles/030310-1.aspx">article about .LESS</a></p>
<p>btw, if you&#8217;re not doing ASP.NET, you can create css from .less by using the command line compiler:</p>
<pre><span style="color: #993366;"><strong>dotless.Compiler.exe -m Styles.less Styles.css</strong></span></pre>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/03/04/when-less-is-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery 101: Adding unobtrusive ajax to your existing form page</title>
		<link>http://soderlind.no/archives/2010/02/25/jquery-101-adding-unobtrusive-ajax-to-your-existing-form-page/</link>
		<comments>http://soderlind.no/archives/2010/02/25/jquery-101-adding-unobtrusive-ajax-to-your-existing-form-page/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 17:50:48 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=787</guid>
		<description><![CDATA[Using jQuery and the form and validate plugins, it is simple to add  unobtrusive ajax to your existing form page 1, Modify your existing form page Add &#60;input type="hidden" name="isAjax" id="isAjax" value="0" /&#62; to your form. This field will tell the processing script, process_input.php in my example, if the values in the form were submitted using [...]]]></description>
			<content:encoded><![CDATA[<p>Using <a href="http://jquery.com/">jQuery</a> and the <a href="http://jquery.malsup.com/form/">form</a> and <a href="http://docs.jquery.com/Plugins/Validation">validate</a> plugins, it is simple to add  <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">unobtrusive</a> ajax to your existing form page</p>
<p><strong>1, Modify your existing form page</strong></p>
<ol>
<li>Add <code>&lt;input type="hidden" name="isAjax" id="isAjax" value="0" /&gt;</code> to your form. This field will tell the processing script, process_input.php in my example, if the values in the form were submitted using ajax or as an ordinary form submit, defaulting to isAjax = 0 (false).</li>
<li>Add <code>class="required"</code> to the fields that requires input</li>
<li>Add the <code>&lt;div id="result"&gt;&lt;/div&gt;</code> where you want the ajax output</li>
</ol>
<pre class="brush: xml;">
&lt;form id=&quot;form1&quot; name=&quot;form1&quot; method=&quot;post&quot; action=&quot;process_input.php&quot;&gt;
	&lt;input type=&quot;hidden&quot; name=&quot;isAjax&quot; id=&quot;isAjax&quot; value=&quot;0&quot; /&gt;
	Name: &lt;input type=&quot;text&quot; name=&quot;name&quot; class=&quot;required&quot; id=&quot;name&quot; value=&quot;&quot; /&gt; &lt;br /&gt;
	&lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;submit&quot; /&gt;
&lt;/form&gt;
&lt;div id=&quot;result&quot;&gt;&lt;/div&gt;
</pre>
<p><span id="more-787"></span><br />
<strong>2, update your process_input.php code</strong></p>
<p>The process_input.php, uses the value in isAjax to decide how output is displayed</p>
<pre class="brush: php; html-script: false;">
&lt;?php
if ($_POST['isAjax']) {
	// out will be return, using ajax, to the calling form page
	echo &quot;Hello &quot; . $_POST['name'];
} else {
	// no javascript, this page will do the output
	echo &quot;&lt;h1&gt;Welcome&lt;/h1&gt;&quot;;
	echo $_POST['name'];
}
?&gt;
</pre>
<p><strong>3, Add the jQuery code</strong></p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://github.com/malsup/form/raw/master/jquery.form.js?v2.38&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
jQuery(document).ready(function(){        // wait until the page is loaded before executing the jQuery code
    var v = $(&quot;#form1&quot;).validate({        // enable form validation
        submitHandler: function(form) {
            $(&quot;#isAjax&quot;).val(1),          // set the hidden input isAjax to 1 (true)
                $(form).ajaxSubmit({      // submit the form using ajax
                    target: &quot;#result&quot;     // put output from process_input.php into &lt;div id=&quot;result&quot;&gt;&lt;/div&gt;
                });
        }
    });
});
&lt;/script&gt;
</pre>
<p><strong>Here&#8217;s the complete form page</strong></p>
<pre class="brush: jscript;">
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://github.com/malsup/form/raw/master/jquery.form.js?v2.38&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
jQuery(document).ready(function(){
	var v = $(&quot;#form1&quot;).validate({
		submitHandler: function(form) {
			$(&quot;#isAjax&quot;).val(1),
			$(form).ajaxSubmit({
				target: &quot;#result&quot;
			});
		}
	});
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id=&quot;form1&quot; name=&quot;form1&quot; method=&quot;post&quot; action=&quot;process_input.php&quot;&gt;
	&lt;input type=&quot;hidden&quot; name=&quot;isAjax&quot; id=&quot;isAjax&quot; value=&quot;0&quot; /&gt;
	Name: &lt;input type=&quot;text&quot; name=&quot;name&quot; class=&quot;required&quot; id=&quot;name&quot; value=&quot;&quot; /&gt; &lt;br /&gt;
	&lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;submit&quot; /&gt;
&lt;/form&gt;
&lt;div id=&quot;result&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/02/25/jquery-101-adding-unobtrusive-ajax-to-your-existing-form-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fighting spam</title>
		<link>http://soderlind.no/archives/2010/02/10/fighting-spam/</link>
		<comments>http://soderlind.no/archives/2010/02/10/fighting-spam/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:48:42 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[wp-plugins]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=745</guid>
		<description><![CDATA[I have reduced the number of  splog attacks on my site I use the Akismet and WP-DenyHost anti-spam plugins for WordPress. Akismet is a must-have and has, since I installed it, caught 304,056 spams (!!).  When Akismet catch a spammer, it logs the spammers IP address. WP-DenyHost, written by me, prevents spammers from getting access to my site a second [...]]]></description>
			<content:encoded><![CDATA[<p>I have reduced the number of  <a href="http://en.wikipedia.org/wiki/Spam_blog">splog</a> attacks on my site</p>
<p style="text-align: center;"><a href="http://soderlind.no/wp-content/uploads/2010/02/soderlind.no-spam-vs-visits.png" rel="wp-prettyPhoto[g745]"><img class="aligncenter size-medium wp-image-746" title="soderlind.no spam vs visits" src="http://soderlind.no/wp-content/uploads/2010/02/soderlind.no-spam-vs-visits-300x171.png" alt="" width="300" height="171" /></a></p>
<p>I use the <a href="http://wordpress.org/extend/plugins/akismet/">Akismet</a> and <a href="http://soderlind.no/archives/2008/04/18/wp-denyhost/">WP-DenyHost</a> anti-spam plugins for WordPress. Akismet is a must-have and has, since I installed it, caught 304,056 spams (!!).  When Akismet catch a spammer, it logs the spammers IP address. WP-DenyHost, written by me, prevents spammers from getting access to my site a second time by blocking access from this IP address.</p>
<p>I installed WP-DenyHost in the fall 2009 and, as you can see from <a href="http://soderlind.no/wp-content/uploads/2010/02/soderlind.no-spam-vs-visits.png" rel="wp-prettyPhoto[g745]">the graph</a> above, the number of spam has dropped dramatically.</p>
<p>.</p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/02/10/fighting-spam/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mobile blogging</title>
		<link>http://soderlind.no/archives/2010/02/02/mobile-blogging/</link>
		<comments>http://soderlind.no/archives/2010/02/02/mobile-blogging/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 21:07:51 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=738</guid>
		<description><![CDATA[[wpvideo 73jyWIka width="400"] Earlier WordPress.org has release their WordPress for iPhone and WordPress for Blackberry, today they released WordPress for Android You&#8217;ll find WordPress for Android in the Android Market. If you are visiting my site from an Android device, you can download it here]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">[wpvideo 73jyWIka width="400"]</p>
<p>Earlier <a href="http://wordpress.org">WordPress.org</a> has release their <a href="http://iphone.wordpress.org/">WordPress for iPhone</a> and <a href="http://blackberry.wordpress.org/">WordPress for Blackberry</a>, today they released <a href="http://android.wordpress.org/">WordPress for Android</a></p>
<p>You&#8217;ll find WordPress for Android in the Android Market. If you are visiting my site from an Android device, you can download it <a href="market://search/?q=pname:org.wordpress.android">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/02/02/mobile-blogging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery 1.4 Released</title>
		<link>http://soderlind.no/archives/2010/01/15/jquery-1-4-is-released/</link>
		<comments>http://soderlind.no/archives/2010/01/15/jquery-1-4-is-released/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 12:09:44 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=721</guid>
		<description><![CDATA[*DRUM ROLL*  jQuery 1.4 is released !!! It has a lot of new features and enhancements like the examples below: jQuery(&#34;&#60;div&#62;&#34;, { &#34;class&#34;: &#34;test&#34;, text: &#34;Click me!&#34;, click: function(){ $(this).toggleClass(&#34;test&#34;); } }).appendTo(&#34;body&#34;); jQuery(&#34;&#60;input&#62;&#34;, { type: &#34;text&#34;, val: &#34;Test&#34;, focusin: function() { $(this).addClass(&#34;active&#34;); }, focusout: function() { $(this).removeClass(&#34;active&#34;); } }).appendTo(&#34;form&#34;);]]></description>
			<content:encoded><![CDATA[<p>*DRUM ROLL*  <a href="http://jquery14.com/day-01/jquery-14"><strong>jQuery 1.4</strong></a><strong> is released !!! </strong></p>
<p><strong></strong>It has a lot of <a href="http://api.jquery.com/category/version/1.4/">new features and enhancements</a> like the <a href="http://net.tutsplus.com/tutorials/javascript-ajax/jquery-1-4-released-the-15-new-features-you-must-know/">examples</a> below:</p>
<pre class="brush: jscript; gutter: true;">
jQuery(&quot;&lt;div&gt;&quot;, {
    &quot;class&quot;: &quot;test&quot;,
    text: &quot;Click me!&quot;,
    click: function(){
        $(this).toggleClass(&quot;test&quot;);
    }
}).appendTo(&quot;body&quot;);

jQuery(&quot;&lt;input&gt;&quot;, {
    type: &quot;text&quot;,
    val: &quot;Test&quot;,
    focusin: function() {
        $(this).addClass(&quot;active&quot;);
    },
    focusout: function() {
        $(this).removeClass(&quot;active&quot;);
    }
}).appendTo(&quot;form&quot;);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/archives/2010/01/15/jquery-1-4-is-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
