<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Lea Hayes&#039; Blog</title>
	<atom:link href="http://leahayes.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://leahayes.wordpress.com</link>
	<description>Software, website development and anything else that takes my fancy!</description>
	<lastBuildDate>Fri, 25 Nov 2011 11:52:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='leahayes.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Lea Hayes&#039; Blog</title>
		<link>http://leahayes.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://leahayes.wordpress.com/osd.xml" title="Lea Hayes&#039; Blog" />
	<atom:link rel='hub' href='http://leahayes.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Unit testing with JavaScript and NodeJS</title>
		<link>http://leahayes.wordpress.com/2011/10/06/unit-testing-with-javascript-and-nodejs/</link>
		<comments>http://leahayes.wordpress.com/2011/10/06/unit-testing-with-javascript-and-nodejs/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 21:05:49 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jsnode]]></category>
		<category><![CDATA[v8]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=280</guid>
		<description><![CDATA[In my latest project I needed a way to execute JavaScript from the command line. I knew a little about the Rhino project which achieves this and of course the Google V8 Project. I experimented a little with V8 and the default shell sample application that it ships with. I found it easy to introduce [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=280&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my latest project I needed a way to execute JavaScript from the command line. I knew a little about the Rhino project which achieves this and of course the Google V8 Project.</p>
<p>I experimented a little with V8 and the default shell sample application that it ships with. I found it easy to introduce native functionality using C++ and this seemed to perform well. I then discovered the <a href="http://nodejs.org/">nodejs</a> project. nodejs is built on top of V8 and includes lots of general purpose functionality which is great for running JavaScript from the command line and fantastic for developing server applications.</p>
<p>Instead of reinventing the wheel with my custom V8 shell I decided to use nodejs. nodejs has an excellent module system which makes it easy to add new functionality.<span id="more-280"></span></p>
<p>Unit testing is important because it helps us to develop code of a high quality. I tend to use QUnit from the jQuery project to perform unit testing on client JavaScripts. Whilst QUnit may not be the most comprehensive unit testing library, it is very easy to use and provides detailed output.</p>
<p>It is now necessary to develop unit tests for command line and server application JavaScripts. Unfortunately the regular QUnit framework cannot be used because it requires the DOM to report feedback. Fortunately the <a href="https://github.com/kof/node-qunit">node-qunit</a> module can be added to nodejs which adds support for QUnit style unit testing.</p>
<p>Whilst there are notable differences between the way in which these two QUnit variants behave, it is possible to write unit tests that are compatible with both versions. For example, `QUnit.module` should be used instead of `module` because `module` means something different in nodejs.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/280/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=280&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2011/10/06/unit-testing-with-javascript-and-nodejs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>
	</item>
		<item>
		<title>Building server and client applications using JavaScript</title>
		<link>http://leahayes.wordpress.com/2011/09/29/building-server-and-client-applications-using-javascript/</link>
		<comments>http://leahayes.wordpress.com/2011/09/29/building-server-and-client-applications-using-javascript/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 01:11:28 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jsnode]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[v8]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=274</guid>
		<description><![CDATA[JavaScript has become an essential tool that allows web developers to produce sophisticated web applications that often use AJAX to communicate with the server. JavaScript source code is becoming increasingly more complex and so it has become necessary for web browser developers to increase the performance of their JavaScript virtual machines. Google Chrome features the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=274&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>JavaScript has become an essential tool that allows web developers to produce sophisticated web applications that often use AJAX to communicate with the server. JavaScript source code is becoming increasingly more complex and so it has become necessary for web browser developers to increase the performance of their JavaScript virtual machines.</p>
<p>Google Chrome features the v8 JavaScript environment which provides outstanding performance by compiling JavaScript into machine code (as opposed to being processed by a virtual machine). The performance boost is massive. V8 is released under an open-source license (<a href="http://code.google.com/p/v8/">http://code.google.com/p/v8/</a>) which can be compiled and used as a standalone JavaScript processor, or more interestingly integrated into custom applications!<span id="more-274"></span></p>
<p>V8 could easily be integrated into an application (or game) to provide an extremely powerful and flexible scripting language. It is possible to map functions and classes between the V8 execution context and a C++ application.</p>
<p>A while back I bumped into a project called <a href="http://nodejs.org">nodejs</a>. Initially I wasn&#8217;t sure what this project was offering nor how it related to JavaScript. It turns out that nodejs is built on top of the powerful V8 JavaScript engine and provides networking capabilities that can be used to produce server applications extremely easily. I would thoroughly recommend watching the video on the project home page for some excellent tutorials.</p>
<p>Here is a very simple web server written in JavaScript that can be executed using nodejs:<br />
<pre class="brush: jscript;">
var http = require('http');
var server = http.createServer(function(request, response) {
   response.writeHead(200, {&quot;Content-Type&quot;: &quot;text/html&quot;});
   response.write('&lt;h1&gt;Hello World!&lt;/h1&gt;');
   response.end();
});

// start web server on port 8080 (http://localhost:8080)
server.listen(8080);
</pre></p>
<p>This is also an excellent resource:<br />
<a href="http://www.nodebeginner.org/">http://www.nodebeginner.org/</a></p>
<p>One of the things that confused me was that I thought that nodejs could only be used to develop web server applications. But this isn&#8217;t true because nodejs can be used to develop client applications that run from the command line. Better still, nodejs can be compiled to work on Mac, Unix and Windows.</p>
<p>There are also a vast selection of modules that can be used alongside nodejs to allow interaction with databases, frameworks for developing powerful web servers easily. Some JavaScript libraries can be used by  a web browser and nodejs environment when implementation specific features (like the DOM in a web browser, or process in nodejs) are not needed.</p>
<p>I do not think that nodejs is a replacement for PHP at the moment because the project is still in its infancy. This could, however, be the case in the future once nodejs and various modules have had a little time to mature. It is certainly a fun project to experiment with.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/274/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=274&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2011/09/29/building-server-and-client-applications-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>
	</item>
		<item>
		<title>Documenting JavaScript with jsdoc3</title>
		<link>http://leahayes.wordpress.com/2011/08/28/documenting-javascript-with-jsdoc3/</link>
		<comments>http://leahayes.wordpress.com/2011/08/28/documenting-javascript-with-jsdoc3/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 20:05:11 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jsdoc3]]></category>
		<category><![CDATA[documenting]]></category>
		<category><![CDATA[jsdoc]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=245</guid>
		<description><![CDATA[JavaScript is an extremely dynamic language which allows it to be applied in a variety of interesting ways. Some prefer to take the structured approach whilst others prefer an object-oriented approach using the prototype object or a library that offers a more classical approach. This diversity makes docblock type documentation seem impossible&#8230;but it isn&#8217;t!! Thanks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=245&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>JavaScript is an extremely dynamic language which allows it to be applied in a variety of interesting ways. Some prefer to take the structured approach whilst others prefer an object-oriented approach using the prototype object or a library that offers a more classical approach. This diversity makes docblock type documentation seem impossible&#8230;but it isn&#8217;t!!</p>
<p>Thanks to <a href="https://github.com/micmath/jsdoc">jsdoc3</a> this task is made significantly simpler. It&#8217;s rich selection of tags makes it possible to document even the most abstract concepts that JavaScript permits. It is also extremely easy to create plugins and custom templates. Jsdoc is a command-line tool that works on any platform that supports Java. See project pages for information about usage.</p>
<h3>Useful Links:</h3>
<ul>
<li><a href="https://github.com/micmath/jsdoc">jsdoc3 project on GitHub</a></li>
<li><a href="http://usejsdoc.org/">Documentation (under development)</a></li>
<li><a href="http://groups.google.com/group/jsdoc-users/">Discussion Forums</a></li>
</ul>
<p><span id="more-245"></span></p>
<h2>A Few Examples</h2>
<p>Here are some examples of how jsdoc3 can be applied:</p>
<h3>Function</h3>
<p><pre class="brush: jscript;">
/**
 * Do something really neat
 */
function foo() {
}

/**
  * Do something really neat with parameters - last is optional!
  * @param {string|number} lookup Name or ID of user
  * @param {string} type Type of records to lookup
  * @param {string} [count] Maximum count of entries to retrieve
  * @returns List of records
  */
function getRecords(lookup, type, count) {
}
</pre></p>
<p>Note that the other variant of functions can be documented in the same way:</p>
<p><pre class="brush: jscript;">
/**
 * Do something really neat
 */
foo = function() {
};
</pre></p>
<h3>Namespace</h3>
<p>Straightforward namespaces can be documented with the following:</p>
<p><pre class="brush: jscript;">
/**
 * Root namespace
 * @namespace root
 */
root = {
   /**
    * Do something really neat
    */
   foo: function() {
   }
};

/**
 * Nested namespace
 * @namespace root.nested
 */
root.nested = {
   /**
    * Do something else that is really neat
	*/
   bar: function() {
   }
};
</pre></p>
<p>Namespaces can still be documented when a more abstract mechanism is used. @lends allows members to be added to an existing namespace:</p>
<p><pre class="brush: jscript;">
/**
 * Root namespace
 * @namespace root
 */
$namespace('root', /** @lends root **/ {
   /**
    * Do something really neat
    */
   foo: function() {
   }
});

/**
 * Nested namespace
 * @namespace root.nested
 */
$namespace('root.nested', /** @lends root.nested **/ {
   /**
    * Do something else that is really neat
    */
   bar: function() {
   }
});
</pre></p>
<h3>Class (with prototype object)</h3>
<p><pre class="brush: jscript;">
/**
 * Base class of a game entity
 * @class Entity
 */
Entity = function() {
};

/**
 * Render entity
 * @param {CanvasRenderingContext2D} dc Device context
 */
Entity.prototype.render = function(dc) {
   // Instance method!
};

/**
 * Get new instance of entity
 * @param {string} type Type of entity to instantiate
 * @returns {@link Entity}
 */
Entity.getInstance: function(type) {
   // Static method!
};
</pre></p>
<h3>Classes (with classical approach)</h3>
<p><pre class="brush: jscript;">
/**
 * Base class of a game entity
 * @class Entity
 */
$class('Entity', /** @lends Entity# **/ {
   /**
   * Render entity
   * @param {CanvasRenderingContext2D} dc Device context
   */
   render: function(dc) {
      // Instance method!
   }
}, /** @lends Entity **/ {
   /**
    * Get new instance of entity
    * @param {string} type Type of entity to instantiate
    * @returns {@link Entity}
    */
   getInstance: function(type) {
      // Static method!
   }
});
/**
 * Ball entity
 * @class Ball
 * @extends Entity
 */
$class('Ball', 'Entity', /** @lends Ball# **/ {
   /**
    * Force ball to bounce
    */
   bounce: function() {
      // Instance method!
   }
});
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/245/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=245&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2011/08/28/documenting-javascript-with-jsdoc3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>
	</item>
		<item>
		<title>Using namespaces with jQuery Widgets</title>
		<link>http://leahayes.wordpress.com/2011/08/19/using-namespaces-with-jquery-widgets/</link>
		<comments>http://leahayes.wordpress.com/2011/08/19/using-namespaces-with-jquery-widgets/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 20:20:55 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Namespaces]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=230</guid>
		<description><![CDATA[Creating plugins for jQuery is a relatively straightforward task, however poorly named plugins can conflict with one another (or even with core jQuery functionality). I have seen numerous attempts at solving this problem which each have their advantages and disadvantages. My take on this problem is to define widgets in a completely separate namespace and then refer [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=230&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Creating plugins for jQuery is a relatively straightforward task, however poorly named plugins can conflict with one another (or even with core jQuery functionality). I have seen numerous attempts at solving this problem which each have their advantages and disadvantages.</p>
<p>My take on this problem is to define widgets in a completely separate namespace and then refer to them using a single jQuery plugin `widget`. This plugin depends upon the following jQuery variant of my `$namespace` function from <a title="PrototypeJS Extension: Namespaces for JavaScript" href="http://leahayes.wordpress.com/2010/01/19/prototypejs-extension-namespaces-for-javascript/">here</a>.<span id="more-230"></span></p>
<p>The source in this post is available under multiple licenses: <a href="http://www.opensource.org/licenses/bsd-license.php">BSD</a>, <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU/GPLv2</a>, <a href="http://www.gnu.org/licenses/gpl-3.0.html">GNU/GPLv3</a>.</p>
<p><pre class="brush: jscript;">
/*!
 * (c) 2010-2011 Rotorz Limited. All rights reserved.
 * License:	BSD, GNU/GPLv2, GNU/GPLv3
 * Author:	Lea Hayes
 * Website:	http://leahayes.co.uk
*/
$global = window;
$namespace = function(ns, extension) {
    if (ns == '')
        return $global;

    if (typeof ns === 'string') {
        var fragments = ns.split('.');
        var node = $global;
        for (var i = 0; i &lt; fragments.length; ++i) {
            var f = fragments[i];
            node = !node[f] ? (node[f] = {}) : node[f];
        }
    }
    else
        node = ns;

    if (extension)
        $.extend(node, extension);

    return node;
};
</pre></p>
<p>Each widget can be defined as a class within a vendor specific namespace (like `my` for example) using something like the following:</p>
<p><pre class="brush: jscript;">
$namespace('my').SpecialWidget = function(options) {
    this.color = options.color;
};

// Invoked automatically when element is attached to object.
my.SpecialWidget.prototype.attach = function(element) {
    this.element = element;
    element.css('color', this.color);
};

my.SpecialWidget.prototype.enable = function() {
    this.element.css('opacity', 1.0);
};
my.SpecialWidget.prototype.disable = function() {
    this.element.css('opacity', 0.5);
};
</pre></p>
<p>The following jQuery `widget` plugin will then make the above work in a fairly standard jQuery fashion:</p>
<p><pre class="brush: jscript;">
(function($) {

$.fn.widget = function(name, a, b) {
    if (!name) return this.data('widget');
    this.each(function() {
        var widget;
        if (message === 'init') {
            a = $namespace(a);
            widget = new a(b || {});
            widget.attach(this);
            this.data('widget', widget);
        }
        else {
            widget = this.data('widget');
            widget[message].apply(widget, Array.prototype.slice.call(arguments, 1));
        }
    });
    return this;
};

})(jQuery);
</pre></p>
<p>The special widget can then be used as follows:</p>
<p><pre class="brush: jscript;">
// Attach widget to element.
$('div.my-special-widget')
    .widget('init', my.SpecialWidget, { color: 'red' });

// Disable widget.
$('div.my-special-widget')
    .widget('disable');

// Interact with widget object directly.
var widget = $('div.my-special-widget').widget();
widget.enable();
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=230&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2011/08/19/using-namespaces-with-jquery-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>
	</item>
		<item>
		<title>Improve consistency of button element across browsers</title>
		<link>http://leahayes.wordpress.com/2011/08/08/improve-consistency-of-button-element-across-browsers/</link>
		<comments>http://leahayes.wordpress.com/2011/08/08/improve-consistency-of-button-element-across-browsers/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 14:28:47 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[browser compatability]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=212</guid>
		<description><![CDATA[The button element can be styled easily for the desired look, however as soon as padding is specified the button appearance is drastically different across web browsers. So I did some searching and found several different fixes and found that a combination of all of them does the trick (mostly). I have added the following [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=212&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The button element can be styled easily for the desired look, however as soon as padding is specified the button appearance is drastically different across web browsers. So I did some searching and found several different fixes and found that a combination of all of them does the trick (mostly).</p>
<p>I have added the following to the end of <a href="http://meyerweb.com/eric/tools/css/reset/index.html">Eric Meyers fantastic reset stylesheet</a>.<br />
<pre class="brush: css;">
/* Fix for IE7 */
button {
    overflow: visible;
    width: 0px;
    /* Default padding that can be overridden as desired. */
    padding: 2pt 4pt;
}
/* Fix for IE7+ */
button {
    width: auto;
}
/* Fix for FF */
button::-moz-focus-inner {
    padding: 0px;
    border: none;
}
</pre></p>
<p>I threw a crude test together and viewed it with Chrome, FireFox, IE9/IE8/IE7 and Opera and it seems to be a solved case. There are minor differences but it is certainly an improvement. IE7 still adds padding above and beneath button text. Please post a comment if you know how to fix that problem!</p>
<p><strong>References:<br />
</strong></p>
<ul>
<li><span class="Apple-style-span" style="font-weight:normal;"><a href="http://www.viget.com/inspire/styling-the-button-element-in-internet-explorer/">http://www.viget.com/inspire/styling-the-button-element-in-internet-explorer/ </a></span></li>
<li><a href="http://www.aheadcreative.com/removing-unwanted-button-padding-in-firefox/">http://www.aheadcreative.com/removing-unwanted-button-padding-in-firefox/</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/212/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=212&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2011/08/08/improve-consistency-of-button-element-across-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>
	</item>
		<item>
		<title>Business Process and Data with MVC (Model-View-Controller)</title>
		<link>http://leahayes.wordpress.com/2011/04/21/business-process-and-data-with-mvc-model-view-controller/</link>
		<comments>http://leahayes.wordpress.com/2011/04/21/business-process-and-data-with-mvc-model-view-controller/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 10:49:44 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[UML]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[business data]]></category>
		<category><![CDATA[business process]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[Website]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=184</guid>
		<description><![CDATA[I have been thinking about the general issues with the MVC and the Vespa concept &#8220;Vespa: A better MVC&#8221;. The idea of splitting the Model component has really helped me a lot with a project that I am working on. Let me emphasise that this doesn&#8217;t define how the model-view-controller (MVC) design pattern is supposed to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=184&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been thinking about the general issues with the MVC and the Vespa concept <a title="&quot;Vespa: A better MVC&quot;" href="http://www.thunderguy.com/semicolon/2008/06/23/vespa-a-better-mvc/" target="_blank">&#8220;Vespa: A better MVC&#8221;</a>. The idea of splitting the <strong>Model</strong> component has really helped me a lot with a project that I am working on.</p>
<p>Let me emphasise that this doesn&#8217;t define how the model-view-controller (MVC) design pattern is supposed to be used. It merely suggests a slight alternative which allows the <strong>Model</strong> component to be split into <em>business process</em> and <em>business data</em>.</p>
<p>I decided to split <strong>Model</strong> into <strong>Service</strong> and <strong>Model</strong> (yes I stuck to the same name, but it has a lesser more specific goal). In my project a <strong>Service</strong> represents a <em>business process</em> whereas a <strong>Model</strong> only represents <em>business data</em>. I allow the <strong>Model</strong> to access data via an encapsulated PDO connection.<span id="more-184"></span></p>
<p>Plural <strong>Model</strong> classes are used to access singular <strong>Model</strong> representations. For example, a user &#8216;Bob&#8217; can be retrieved via a service which will in turn utilise the <strong>UsersModel</strong> class.</p>
<p>The following diagram shows the classes and I have labelled the dependancy arrows to offer an idea of the process.</p>
<div id="attachment_186" class="wp-caption aligncenter" style="width: 610px"><a href="http://leahayes.files.wordpress.com/2011/04/service-mvc-001.png"><img class="size-full wp-image-186" title="Service MVC Class Diagram with Process" src="http://leahayes.files.wordpress.com/2011/04/service-mvc-001.png?w=600&#038;h=296" alt="" width="600" height="296" /></a><p class="wp-caption-text">Service MVC Class Diagram with Process</p></div>
<p>Here are some rules that I am considering for my project:</p>
<ul>
<li><strong>Controller</strong> objects can load and utilise all <strong>Service </strong>and <strong>Model</strong> methods and fields.</li>
<li><strong>Controller</strong> objects cannot instantiate a <strong>Model</strong> independently. This is a business process and must thus be undertaken by a <strong>Service</strong>. A business process could potentially decide to use an alternative model under certain situations.</li>
<li><strong>Model</strong> and <strong>Service</strong> objects may interact with a data source.</li>
<li><strong>Model</strong> objects must conform to the interface dictated by the corresponding <strong>Service</strong> class(es).</li>
<li><strong>Model</strong> and <strong>Service</strong> objects can be overridden or adapted.</li>
<li><strong>Service</strong> objects can be accessed by any <strong>View</strong>, <strong>Controller</strong>, <strong>Service</strong> or <strong>Model</strong>.</li>
</ul>
<p>The relationship between <strong>Model</strong> and <strong>Service</strong> is many-to-many. A service can utilise many data models, and a data model can be processed and interpreted by many services.</p>
<p>I hope that you have enjoyed this article. Please feel free to leave comments!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/184/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=184&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2011/04/21/business-process-and-data-with-mvc-model-view-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>

		<media:content url="http://leahayes.files.wordpress.com/2011/04/service-mvc-001.png" medium="image">
			<media:title type="html">Service MVC Class Diagram with Process</media:title>
		</media:content>
	</item>
		<item>
		<title>Encoding Video for Websites</title>
		<link>http://leahayes.wordpress.com/2010/12/22/encoding-video-for-websites/</link>
		<comments>http://leahayes.wordpress.com/2010/12/22/encoding-video-for-websites/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 21:34:26 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=176</guid>
		<description><![CDATA[These days there are many more web browsers in active use which are running on different devices. It is important to design and develop websites which are going to work on the majority of these platforms. HTML5 has many new offerings which intend to address many cross-comparability issues, and web browsers have been quite fast the uptake [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=176&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>These days there are many more web browsers in active use which are running on different devices. It is important to design and develop websites which are going to work on the majority of these platforms. HTML5 has many new offerings which intend to address many cross-comparability issues, and web browsers have been quite fast the uptake of this standard.</p>
<p>Despite this, there still isn&#8217;t a single video encoding which will work across the board (without additional components). I have been reading into this over the past few weeks and stumbled upon a solution. Video which is encoded as MPEG4 AVC (the H.264 codec) will play on just about everything except Mozilla Firefox. But, not to fear because there are Adobe Flash files which are able to stream H.264 encoded videos. So the idea is to utilise HTML5 H.264 video support for all browsers possible, and then fall back to Flash for other browsers.</p>
<p>This approach also means that video will play on devices like the Apple iPad.</p>
<p>When encoding video I found the following configurations to offer sufficient quality results at acceptable file sizes. I found this to be a process of trial and error to find something which was actually going to play smoothly at a good quality for my client.</p>
<ul>
<li>Frame Rate: 25 fps</li>
<li>Video Bits per Second: between 300 Kbps and 1500 Kbps (Depending upon quality)</li>
<li>Audio Bits per Second: Either 128 Kbps or 256 Kbps</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/176/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=176&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2010/12/22/encoding-video-for-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>
	</item>
		<item>
		<title>Redesign of &#8220;My Art Gallery&#8221;</title>
		<link>http://leahayes.wordpress.com/2010/06/13/redesign-of-my-art-gallery/</link>
		<comments>http://leahayes.wordpress.com/2010/06/13/redesign-of-my-art-gallery/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 15:48:03 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Website]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=158</guid>
		<description><![CDATA[My Art Gallery (http://my-art-gallery.co.uk/) is my fathers online art gallery which features most of his artwork. The website also includes a variety of downloads including backgrounds, 3D models, textures, etc. which people can use in their own artwork. I originally created this website in 2006 using ASP.NET in conjunction with a MS-SQL database which has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=158&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em><a title="My Art Gallery - Artwork of Tony Hayes" href="http://my-art-gallery.co.uk/" target="_blank">My Art Gallery</a> (<a href="http://my-art-gallery.co.uk/">http://my-art-gallery.co.uk/</a>)</em> is my fathers online art gallery which features most of his artwork. The website also includes a variety of downloads including backgrounds, 3D models, textures, etc. which people can use in their own artwork. I originally created this website in 2006 using ASP.NET in conjunction with a MS-SQL database which has served well for 4 years.</p>
<p>After 4 years the website began to look a little dated and so it felt necessary to bring it up to date both visually and functionally. The web has changed significantly and nowadays people tend to expect facilities like <a title="RSS" href="http://en.wikipedia.org/wiki/RSS" target="_blank">RSS</a>, comments and <a title="Trackback" href="http://en.wikipedia.org/wiki/Trackback" target="_blank">track-backs</a>.<span id="more-158"></span></p>
<p>Over the past week or so I have designed and implemented a new website which this time is built upon PHP with MySQL and <em><a title="WordPress - Blog Tool and Publishing Platform" href="http://wordpress.org/" target="_blank">WordPress </a></em>and utilizes the plug-ins <em><a title="NextGEN Gallery by Alex Rabe" href="http://wordpress.org/extend/plugins/nextgen-gallery/" target="_blank">NextGen Gallery</a></em> and <em><a title="WP-Door by Rajeevan" href="http://wordpress.org/extend/plugins/wp-door/" target="_blank">WP Door</a></em>. This has led to many new features which help make the website both more flexible and easier to use at the same time.</p>
<p style="text-align:center;"><a href="http://leahayes.files.wordpress.com/2010/06/myart-newold.jpg?w=1024"><img class="size-large wp-image-159 aligncenter" title="My Art Gallery - New and Old" src="http://leahayes.files.wordpress.com/2010/06/myart-newold.jpg?w=590&#038;h=223" alt="" width="590" height="223" /></a></p>
<p>Here is a list of some of these improvements:</p>
<ul>
<li>Easier maintenance of website for the author (my father in this case).</li>
<li>Built-in statistics using <em><a title="WordPress.com Stats by Andy" href="http://wordpress.org/extend/plugins/stats/" target="_blank">WordPress.com Stats</a></em>.</li>
<li>Additional horizontal viewing area because navigation menu moved from left side to top.</li>
<li>More control over how images are presented in pages, posts and galleries.</li>
<li>Content warning message cannot be bypassed.</li>
<li>URIs are now &#8220;pretty&#8221; which helps to make the website easier to navigate and help to future-proof links.<br />
i.e.  <a href="http://my-art-gallery.co.uk/gallery/fantasy/">http://my-art-gallery.co.uk/gallery/fantasy/<br />
</a> instead of <span style="color:#800000;">http://www.my-art-gallery.co.uk/Listing.aspx?g_id=1</span></li>
<li>News is now posted as a blog which provides a lot of added functionality and is additionally printer friendly.</li>
<li>Search support for both images and posts/pages.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/158/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=158&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2010/06/13/redesign-of-my-art-gallery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>

		<media:content url="http://leahayes.files.wordpress.com/2010/06/myart-newold.jpg?w=1024" medium="image">
			<media:title type="html">My Art Gallery - New and Old</media:title>
		</media:content>
	</item>
		<item>
		<title>UML Simpler with Cadifra</title>
		<link>http://leahayes.wordpress.com/2010/04/07/uml-simpler-with-cadifra/</link>
		<comments>http://leahayes.wordpress.com/2010/04/07/uml-simpler-with-cadifra/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 11:33:50 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[OOP]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=143</guid>
		<description><![CDATA[Cadifra is an excellent UML editor which makes designing with UML a breeze. Cadifra is great for illustrating concepts in technical reports, but gains its real purpose during the design process where ideas change and evolve rapidly (especially when working with other team members). Cadifra makes it easy and very quick to change diagrams in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=143&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Cadifra is an excellent UML editor which makes designing with UML a breeze. Cadifra is great for illustrating concepts in technical reports, but gains its real purpose during the design process where ideas change and evolve rapidly (especially when working with other team members). Cadifra makes it easy and very quick to change diagrams in this fashion, and very neatly too.</p>
<p>Cadifra supports <b>Class</b>, <b>Object</b>, <b>Use Case</b>, <b>Sequence</b> and <b>State</b> diagrams. <span id="more-143"></span>A page can include elements from all of these different diagrams if necessary. Whilst Cadifra does support a lot of UML&#8217;s features, I have noticed that it does not yet include all connector types. This doesn&#8217;t usually cause too many problems, however it is usually possible to use a &#8220;Dependency&#8221; connector with an appropriate label.</p>
<p>The feature which I love the most is the breaking and connecting of diagram fragments. This is particularly useful when copying and pasting, but is also very useful when rearranging within class diagrams.<br />
<div id="attachment_147" class="wp-caption aligncenter" style="width: 310px"><a href="http://leahayes.files.wordpress.com/2010/04/diagram1.png"><img src="http://leahayes.files.wordpress.com/2010/04/diagram1.png?w=300&#038;h=260" alt="Cadifra Screenshot" title="Cadifra Screenshot" width="300" height="260" class="size-medium wp-image-147" /></a><p class="wp-caption-text">Cadifra Screenshot</p></div></p>
<div style="font-size:xx-small;margin-bottom:12px;">* Screenshot was taken from Cadifra website.</div>
<p>Anyone who is using UML should definitely give the Cadifra demo a try.</p>
<p>Here are some useful links:</p>
<ul>
<li><b>Cadifra Home Page</b> &#8211; <a href="http://www.cadifra.com/">http://www.cadifra.com/</a></li>
<li><b>Cadifra Demo</b> &#8211; <a href="http://www.cadifra.com/download/">http://www.cadifra.com/download/</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=143&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2010/04/07/uml-simpler-with-cadifra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>

		<media:content url="http://leahayes.files.wordpress.com/2010/04/diagram1.png?w=300" medium="image">
			<media:title type="html">Cadifra Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>J2ME: Alert followed by Alert</title>
		<link>http://leahayes.wordpress.com/2010/03/22/j2me-alert-followed-by-alert/</link>
		<comments>http://leahayes.wordpress.com/2010/03/22/j2me-alert-followed-by-alert/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 20:40:57 +0000</pubDate>
		<dc:creator>Lea Hayes</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[J2ME]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Mobile Development]]></category>

		<guid isPermaLink="false">http://leahayes.wordpress.com/?p=119</guid>
		<description><![CDATA[I have been working on a J2ME application. There is an instance where a message box appears to confirm an action with the user, if the user confirms the action then a subsequent alert may be shown. Whilst in theory this should have been straightforward the application just kept throwing an IllegalArgumentException. In the API [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=119&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been working on a J2ME application. There is an instance where a message box appears to confirm an action with the user, if the user confirms the action then a subsequent alert may be shown. Whilst in theory this should have been straightforward the application just kept throwing an <code style="color:#008080;">IllegalArgumentException</code>.</p>
<p>In the API <a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Display.html#setCurrent(javax.microedition.lcdui.Alert, javax.microedition.lcdui.Displayable)">documentation</a> for J2ME I found that the <code><span style="color:#008080;">Display</span>.setCurrent(alert, nextDisplayable)</code> function will throw such an exception when <code>nextDisplayable</code> is an <code style="color:#008080;">Alert</code> instance. However, I was not using this function. The alert was being displayed using <code><span style="color:#008080;">Display</span>.setCurrent(displayable)</code>, and upon selecting &#8220;Confirm&#8221; was simply displaying another alert again with <code><span style="color:#008080;">Display</span>.setCurrent(displayable)</code>.</p>
<p>With thanks to James Mernin&#8217;s blog (<a href="http://www.mernin.com/blog/?p=26&amp;cpage=1">Alert after Alert in J2ME</a>) I found that this is in fact a result of the same limitation within J2ME. For my purposes I found that the simplest solution was to create a blank canvas, and upon the first paint event switch to the intended alert. This essentially breaks the chain into <code style="color:#008080;">Alert</code> -&gt; <code style="color:#008080;">Canvas</code> -&gt; <code style="color:#008080;">Alert</code>.<br />
<span id="more-119"></span></p>
<p>In light of this new information I decided to amend my <a href="http://leahayes.wordpress.com/2010/03/03/simplified-display-management-for-j2me/">DisplayManager</a> so that it deals with this issue transparently. The <code><span style="color:#008080;">DisplayManager</span>.setCurrent(displayable)</code> method can be replaced with the following:<br />
<pre class="brush: java;">
public static final void setCurrent(Displayable d) {
   // Switch to new displayable.
   current = d;
   if (current instanceof javax.microedition.lcdui.Alert &amp;&amp;
            display.getCurrent() instanceof javax.microedition.lcdui.Alert) {
      // Switch to a black canvas temporarily!
      display.setCurrent(new BlackCanvas());
   }
   else
      display.setCurrent(current);
}
</pre></p>
<p>If an alert is about to be displayed, the above code will show a blank canvas if an alert is already shown. The blank canvas will then show the alert as soon as it is first painted. I implemented this blank canvas as shown below:<br />
<pre class="brush: java;">
public final class DisplayManager {
   ...

   private static class BlackCanvas extends Canvas {
      protected void paint(Graphics g) {
         // Paint canvas to black to reduce flicker.
         // Note: You may decide to change this to suite your needs.
         g.setColor(0x000000);
         g.fillRect(0, 0, getWidth(), getHeight());

         // Now show the alert that we really wanted!
         DisplayManager.setCurrent(DisplayManager.getCurrent());
      }
   }
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/leahayes.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/leahayes.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/leahayes.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/leahayes.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/leahayes.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/leahayes.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/leahayes.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/leahayes.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/leahayes.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/leahayes.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/leahayes.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/leahayes.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/leahayes.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/leahayes.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=leahayes.wordpress.com&amp;blog=9773064&amp;post=119&amp;subd=leahayes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://leahayes.wordpress.com/2010/03/22/j2me-alert-followed-by-alert/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1145f411fbaf1bfbadb679b1f9fc8ba0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leahayes</media:title>
		</media:content>
	</item>
	</channel>
</rss>
