<?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>Ngayxanh Web Design Resources &#187; pattern</title>
	<atom:link href="http://blog.ngayxanh.com/tag/pattern/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ngayxanh.com</link>
	<description>PSD, Vector, Tutorial, Article for Web Designer</description>
	<lastBuildDate>Thu, 13 Aug 2009 00:27:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to create a skewed checkerboard pattern in Illustrator</title>
		<link>http://blog.ngayxanh.com/photoshop-illustrator-tutorials/how-to-create-a-skewed-checkerboard-pattern-in-illustrator/</link>
		<comments>http://blog.ngayxanh.com/photoshop-illustrator-tutorials/how-to-create-a-skewed-checkerboard-pattern-in-illustrator/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 15:41:13 +0000</pubDate>
		<dc:creator>veerle@duoh.com</dc:creator>
				<category><![CDATA[Photoshop-Illustrator, Tutorials]]></category>
		<category><![CDATA[checkerboard]]></category>
		<category><![CDATA[checkerboard pattern]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[illustrator]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[pieters]]></category>
		<category><![CDATA[prefect]]></category>
		<category><![CDATA[skewed]]></category>
		<category><![CDATA[Symbol]]></category>
		<category><![CDATA[Transform]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video tutorial]]></category>
		<category><![CDATA[vimeo]]></category>

		<guid isPermaLink="false">http://veerle.duoh.com/blog/comments/how_to_create_a_skewed_checkerboard_pattern_in_illustrator/</guid>
		<description><![CDATA[A reader asked me if I could explain to him how to create the Bavarian flag in Illustrator. Instead of explaining this with text and images I decided to capture another screencast tutorial instead.]]></description>
			<content:encoded><![CDATA[<p></p><p>A reader asked me if I could explain to him how to create the <a href="http://en.wikipedia.org/wiki/File:Flag_of_Bavaria_(lozengy).svg" title="View more info about this flag on Wikipedia ">Bavarian flag</a> in Illustrator. Instead of explaining this with text and images I decided to capture another screencast tutorial instead.
</p>
<p>As usually there are probably other ways of doing this. I&#8217;m only showing one way. It basically comes down to these simple steps:</p>
<ol>
<li>Draw 2 squares: 1 black and 1 white</li>
<li>Turn them into a Symbol</li>
<li>Apply Transform effect to repeat them horizontally</li>
<li>Apply Transform effect to repeat the line of squares vertically</li>
<li>Expand everything and move squares to make 1 prefect rectangle</li>
<li>Skew and resize the checkerboard (to match the Bavarian flag)</li>
</ol>
<ul>
<li><a href="http://www.xtreak.com/go/veerle/158151/bavarian-flag.mp4.zip">Download the video tutorial from Xtreak</a> (1130 x 860 pixels)</li>
<li><a href="http://vimeo.com/5507917">Download the video tutorial from Vimeo</a> (1130 x 860 pixels)</li>
</ul>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5507917&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5507917&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p><a href="http://vimeo.com/5507917">How to create a skewed checkerboard pattern in Illustrator</a> from <a href="http://vimeo.com/veerlepieters">Veerle Pieters</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Maybe turning the squares into a Symbol (step 2) might not be needed if you&#8217;re expanding the squares again, but I thought I show this anyway. If you don&#8217;t expand the the Symbols and you only expand the Transform effect you can change the color of the squares in one instance by changing the color of the symbol. However, if you decide to expand all the Symbol&#8217;s instances, all squares become editable and so you can give each one of them a different color.</p>
<p><img src="http://feeds.feedburner.com/~r/veerlesblog/~4/afq-LuYicqo" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ngayxanh.com/photoshop-illustrator-tutorials/how-to-create-a-skewed-checkerboard-pattern-in-illustrator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I don&#8217;t love JavaScript&#8217;s Module Pattern</title>
		<link>http://blog.ngayxanh.com/uncategorized/why-i-dont-love-javascripts-module-pattern/</link>
		<comments>http://blog.ngayxanh.com/uncategorized/why-i-dont-love-javascripts-module-pattern/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 17:30:36 +0000</pubDate>
		<dc:creator>Jonathan Snook</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[closure functions]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[logging code]]></category>
		<category><![CDATA[love]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[public api]]></category>
		<category><![CDATA[wrapper function]]></category>

		<guid isPermaLink="false">http://snook.ca/archives/javascript/no-love-for-module-pattern</guid>
		<description><![CDATA[<p>The Module Pattern is  the use of closures to create, in essence, <a href="http://www.crockford.com/javascript/private.html">private functions</a> that are only accessible by other functions created within that closure. Functions can be attached to an object and returned outside of that function call. This establishes a public API and only the functions defined within that public API will have access to those hidden functions.</p>
 <p>The <a href="http://yuiblog.com/blog/2007/06/12/module-pattern/">YUI blog</a> documents this well but here is a simple example of the Module Pattern:</p>
<pre><code>var ManageChildren = (function(){
    var children = [];
    
    return {
      addChild: function() { /* add to children array */ },
      removeChild: function() { /* remove from children array */ }      
    }
 })();</code></pre>
 
 <p>In this example, the ManageChildren object will have two methods: addChild and removeChild. From outside the wrapper function, you cannot access the children array that is defined within.</p>
 <p>After having worked with and used this pattern for some time, I now avoid it. </p>
 <h2>Debugging</h2>
 <p>When it comes to troubleshooting a particular troublesome page, I like to crank open Firebug's console and play around willy-nilly. The ability to reshape objects lets me test theories before putting them into practice with real code. It also allows me to inspect things to make sure they're working as they should. </p>
 <p>Going back to that example I just showed, what if you needed to determine the length of the children array? It's not exposed. Which means you have to insert logging code, or <a href="http://snook.ca/archives/javascript/firebug-breakpoints/">create a breakpoint</a>. In either case, you're forcing a page refresh to re-execute the code. </p>
 <p>Now imagine this code was minified and deployed to a live server. It works locally but stopped working on a live server. How much do you feel like trying to add logging code or breakpoints? (Try adding a breakpoint to minified code in Firebug.)</p>
<p>Avoiding the Module Pattern makes debugging easier.</p>
 <h2>Make extending easier</h2>
 <p>Another frustration I have with it is the difficulty in being able to extend that object. You can't just add additional functions onto it because you won't have access to the properties defined within. </p>
 <p>Take a look at this attempt to extend our object:</p>
 <pre><code>ManageChildren.getLength = function(){
    return children.length;
 }</code></pre>
 <p>That won't work. Neither will <kbd>this.children.length</kbd>, or anything else you try, because <kbd>children</kbd> is a variable that's only available to any function declared within that closure.</p>
 <h2>Aspect-oriented Programming</h2>
 <p>One other trick with JavaScript that I sometimes like to take advantage of is similar to <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">aspect-oriented programming</a>. While aspect-oriented programming is a deep subject, the key thing I took away from it was the ability to append code before or after a function call. It feels like an event handler. Here's another fun example:</p>
 <pre><code>var oldChild = ManageChildren.addChild;
ManageChildren.addChild = function(){
    /* do what you need to */
    oldChild();
}</code></pre>
 <p>See what I did? I took the old function and replaced it with my own. Then I proceeded to call the old function. With the module pattern, though, I wouldn't have access to any of those hidden properties. I could never actually add an element to the <kbd>children</kbd> array because it's private. </p>
 <h2>JavaScript should  be malleable</h2>
 <p>One of the features that attracts me to developing in JavaScript is the ability to manipulate objects so readily. As a result, the module pattern is something I try to avoid.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/snookca?a=FnAQUluW47o:nTjk74m0KdQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/snookca?d=yIl2AUoC8zA" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/snookca?a=FnAQUluW47o:nTjk74m0KdQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/snookca?i=FnAQUluW47o:nTjk74m0KdQ:F7zBnMyn0Lo" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/snookca?a=FnAQUluW47o:nTjk74m0KdQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/snookca?i=FnAQUluW47o:nTjk74m0KdQ:gIN9vFwOqvQ" border="0"/></a>
</div><img src="http://feeds.feedburner.com/~r/snookca/~4/FnAQUluW47o" height="1"/>]]></description>
			<content:encoded><![CDATA[<p></p><p>The Module Pattern is  the use of closures to create, in essence, <a href="http://www.crockford.com/javascript/private.html">private functions</a> that are only accessible by other functions created within that closure. Functions can be attached to an object and returned outside of that function call. This establishes a public API and only the functions defined within that public API will have access to those hidden functions.</p>
<p>The <a href="http://yuiblog.com/blog/2007/06/12/module-pattern/">YUI blog</a> documents this well but here is a simple example of the Module Pattern:</p>
<pre><code>var ManageChildren = (function(){
    var children = [];

    return {
      addChild: function() { /* add to children array */ },
      removeChild: function() { /* remove from children array */ }
    }
 })();</code></pre>
<p>In this example, the ManageChildren object will have two methods: addChild and removeChild. From outside the wrapper function, you cannot access the children array that is defined within.</p>
<p>After having worked with and used this pattern for some time, I now avoid it. </p>
<h2>Debugging</h2>
<p>When it comes to troubleshooting a particular troublesome page, I like to crank open Firebug&#8217;s console and play around willy-nilly. The ability to reshape objects lets me test theories before putting them into practice with real code. It also allows me to inspect things to make sure they&#8217;re working as they should. </p>
<p>Going back to that example I just showed, what if you needed to determine the length of the children array? It&#8217;s not exposed. Which means you have to insert logging code, or <a href="http://snook.ca/archives/javascript/firebug-breakpoints/">create a breakpoint</a>. In either case, you&#8217;re forcing a page refresh to re-execute the code. </p>
<p>Now imagine this code was minified and deployed to a live server. It works locally but stopped working on a live server. How much do you feel like trying to add logging code or breakpoints? (Try adding a breakpoint to minified code in Firebug.)</p>
<p>Avoiding the Module Pattern makes debugging easier.</p>
<h2>Make extending easier</h2>
<p>Another frustration I have with it is the difficulty in being able to extend that object. You can&#8217;t just add additional functions onto it because you won&#8217;t have access to the properties defined within. </p>
<p>Take a look at this attempt to extend our object:</p>
<pre><code>ManageChildren.getLength = function(){
    return children.length;
 }</code></pre>
<p>That won&#8217;t work. Neither will <kbd>this.children.length</kbd>, or anything else you try, because <kbd>children</kbd> is a variable that&#8217;s only available to any function declared within that closure.</p>
<h2>Aspect-oriented Programming</h2>
<p>One other trick with JavaScript that I sometimes like to take advantage of is similar to <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">aspect-oriented programming</a>. While aspect-oriented programming is a deep subject, the key thing I took away from it was the ability to append code before or after a function call. It feels like an event handler. Here&#8217;s another fun example:</p>
<pre><code>var oldChild = ManageChildren.addChild;
ManageChildren.addChild = function(){
    /* do what you need to */
    oldChild();
}</code></pre>
<p>See what I did? I took the old function and replaced it with my own. Then I proceeded to call the old function. With the module pattern, though, I wouldn&#8217;t have access to any of those hidden properties. I could never actually add an element to the <kbd>children</kbd> array because it&#8217;s private. </p>
<h2>JavaScript should  be malleable</h2>
<p>One of the features that attracts me to developing in JavaScript is the ability to manipulate objects so readily. As a result, the module pattern is something I try to avoid.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/snookca?a=FnAQUluW47o:nTjk74m0KdQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/snookca?d=yIl2AUoC8zA" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/snookca?a=FnAQUluW47o:nTjk74m0KdQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/snookca?i=FnAQUluW47o:nTjk74m0KdQ:F7zBnMyn0Lo" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/snookca?a=FnAQUluW47o:nTjk74m0KdQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/snookca?i=FnAQUluW47o:nTjk74m0KdQ:gIN9vFwOqvQ" border="0"/></a>
</div>
<p><img src="http://feeds.feedburner.com/~r/snookca/~4/FnAQUluW47o" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ngayxanh.com/uncategorized/why-i-dont-love-javascripts-module-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

