<?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>Pure-Essence.Net</title>
	<atom:link href="http://pure-essence.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://pure-essence.net</link>
	<description>You have to visit this geeky girl&#039;s blog.</description>
	<lastBuildDate>Wed, 23 May 2012 01:27:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='pure-essence.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Pure-Essence.Net</title>
		<link>http://pure-essence.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://pure-essence.net/osd.xml" title="Pure-Essence.Net" />
	<atom:link rel='hub' href='http://pure-essence.net/?pushpress=hub'/>
		<item>
		<title>Jackson Ignore Property/Convenience Method</title>
		<link>http://pure-essence.net/2012/05/23/jackson-ignore-propertyconvenience-method/</link>
		<comments>http://pure-essence.net/2012/05/23/jackson-ignore-propertyconvenience-method/#comments</comments>
		<pubDate>Wed, 23 May 2012 01:27:02 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jackson]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jstl]]></category>
		<category><![CDATA[pojo]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2207</guid>
		<description><![CDATA[Here’s something I learned about Jackson and you may run into it. What gets serialized by default? Properties of an object are initially determined by process called auto-detection: all member methods and fields are checked to find: &#8220;Getter&#8221; methods: all no-argument public member methods which return a value, and conform to naming convention of &#8220;getXxx&#8221; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2207&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cowtowncoder.com/blog/archives/2011/02/entry_443.html" target="_blank">Here’s something</a> I learned about <a href="http://jackson.codehaus.org/" target="_blank">Jackson</a> and you may run into it.</p>
<p><b>What gets serialized by default?</b></p>
<p>Properties of an object are initially determined by process called auto-detection: all member methods and fields are checked to find:</p>
<ul>
<li>&#8220;Getter&#8221; methods: all no-argument public member methods which return a value, and conform to naming convention of &#8220;getXxx&#8221; (or &#8220;isXxx&#8221;, if return type is boolean; called &#8220;is-getter&#8221;) are considered to infer existence of property with name &#8220;xxx&#8221; (where property name is inferred using bean convention, i.e. the leading capitali letter(s) is changed to lower case</li>
<li>field properties: all public member fields are considered to represent properties, using field name as is.</li>
</ul>
<p>This means <strong>Jackson</strong> will map any convenience methods you create on the POJO that’s public and starts with “get” and returns a value.  This may NOT be the behavior you want.</p>
<p>@JsonIgnoreProperties can be used at a class level and it works for me.</p>
<p>But in order to prevent me from tediously adding all of convenience methods on my POJO to the list, I started to use “return” as the keyword instead of “get” so Jackson will ignore those methods by default.  Of course if you want <a href="http://www.cs.wcupa.edu/~rkline/Java/jstl-examples.html" target="_blank">JSTL</a> to be able to show the convenience method output on the screen, the convenience method has to begin with “get”. So I’m using a mix of solutions to this problem.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2207&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2012/05/23/jackson-ignore-propertyconvenience-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Generics &#8211; conditionally instantiate a class</title>
		<link>http://pure-essence.net/2012/05/08/java-generics-conditionally-instantiate-a-class/</link>
		<comments>http://pure-essence.net/2012/05/08/java-generics-conditionally-instantiate-a-class/#comments</comments>
		<pubDate>Tue, 08 May 2012 00:56:06 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[instantiate]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2201</guid>
		<description><![CDATA[From Class to list of Enums So if I want to instantiate a class via some condition, I can do the following but still how do I know what type to use? https://github.com/dodozhang21/JavaGenerics<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2201&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><b>From Class to list of Enums</b><br />
<pre class="brush: java; wrap-lines: false;">
public static &lt;T extends Enum&gt; List&lt;T&gt; getList(Class&lt;T&gt; clazz) {
    return Arrays.asList(clazz.getEnumConstants());
}
</pre></p>
<p>So if I want to instantiate a class via some condition, I can do the following but still how do I know what type to use?<br />
<pre class="brush: java; wrap-lines: false;">
public class Foo {
	public String getName() {
		return &quot;hi&quot;;
	}
}
</pre></p>
<p><pre class="brush: java; wrap-lines: false;">
public class Foo2013 extends Foo {
	public String getAge() {
		return &quot;age&quot;;
	}
}
</pre></p>
<p><pre class="brush: java; wrap-lines: false;">
public class FooFactory {
	@SuppressWarnings(&quot;unchecked&quot;) // what do I need to do to not having to use this??
	public static &lt;F extends Foo&gt; F getFoo(int year) {
		try {
			if (year &gt;= 2013) {
				return (F) Foo2013.class.newInstance();
			} else {
				return (F) Foo.class.newInstance();
			}
		} catch (InstantiationException e) {
			// TODO
		} catch (IllegalAccessException e) {
			// TODO
		}
		return null;
	}
}
</pre></p>
<p><pre class="brush: java; wrap-lines: false;">
public class FooFactoryTest {
	@Test
	public void testFooFactory() {
		Foo foo = FooFactory.getFoo(2011);
		Assert.assertEquals(Foo.class, foo.getClass());

		Foo foo2013 = FooFactory.getFoo(2013);  // &lt;-- how can I do Foo2013 foo2013 without repeating the logic?
//		foo2013.getAge();
		Assert.assertEquals(Foo2013.class, foo2013.getClass());
	}
}
</pre></p>
<p><a href="https://github.com/dodozhang21/JavaGenerics" target="_blank">https://github.com/dodozhang21/JavaGenerics</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2201&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2012/05/08/java-generics-conditionally-instantiate-a-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>CSS Positions</title>
		<link>http://pure-essence.net/2012/03/04/css-positions/</link>
		<comments>http://pure-essence.net/2012/03/04/css-positions/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 02:32:59 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[non php code]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2190</guid>
		<description><![CDATA[A coworker asked me about CSS positions. I admit I&#8217;m no expert in this topic. However, I want to illustrate my brief understanding. Maybe you will find them helpful. Position: static Default, you don&#8217;t have to set it. Position: relative It&#8217;s like a ghost image. Setting the corresponding properties of top, left, right, or bottom [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2190&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A coworker asked me about CSS positions. I admit I&#8217;m no expert in this topic. However, I want to illustrate my brief understanding. Maybe you will find them helpful.</p>
<p><b>Position: static</b><br />
Default, you don&#8217;t have to set it.</p>
<p><b>Position: relative</b><br />
It&#8217;s like a ghost image. Setting the corresponding properties of top, left, right, or bottom will move this element out of the its original document location but it will not affect any surrounding elements. The surrounding elements will treat it as if its position never changed.</p>
<p><b>Position: absolute</b><br />
Takes the element out of its normal document location. The corresponding properties of top, left, right, bottom will be based off its first parent element whose position is not static. <a href="http://jsfiddle.net/dodozhang21/Q7mpg/" target="_blank">Check out this example</a> to get an idea. The parent element is bubbled all the way up until it finds the document window.</p>
<p><b>Position: fixed</b><br />
Similar to the absolute position except its parent element is the browser window. I&#8217;ve tried using this many years ago and found that IE didn&#8217;t support it. It <a href="http://stackoverflow.com/questions/1193255/position-fixed-and-internet-explorer">sounds like pre IE 8 never supported it</a> properly. Because of this, I never found a great use for it.</p>
<p>If I confused you, <a href="http://www.vanseodesign.com/css/css-positioning/">the positions are explained in greater details here</a>. I find it very well written.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2190/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2190&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2012/03/04/css-positions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>幸福是什么感觉</title>
		<link>http://pure-essence.net/2011/10/23/%e5%b9%b8%e7%a6%8f%e6%98%af%e4%bb%80%e4%b9%88%e6%84%9f%e8%a7%89/</link>
		<comments>http://pure-essence.net/2011/10/23/%e5%b9%b8%e7%a6%8f%e6%98%af%e4%bb%80%e4%b9%88%e6%84%9f%e8%a7%89/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 13:16:02 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[chinese]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2181</guid>
		<description><![CDATA[幸福是什么？其实幸福没有绝对的答案，关键在于你的生活态度。善于抓住幸福的人才懂得什么是幸福。一直以为感受幸福是件很困难的事，那是一种灯火阑珊处的境界。经过岁月的流年以后，才明白，幸福其实很简单，只要心灵有所满足、有所慰藉就是幸福。 幸福就是一种满足感。 健康的活着就是一种莫大的幸福!! 幸福无处不在 只要用心细细体会 你就能感觉到。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2181&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>幸福是什么？其实幸福没有绝对的答案，关键在于你的生活态度。善于抓住幸福的人才懂得什么是幸福。一直以为感受幸福是件很困难的事，那是一种灯火阑珊处的境界。经过岁月的流年以后，才明白，幸福其实很简单，只要心灵有所满足、有所慰藉就是幸福。<br />
幸福就是一种满足感。<br />
健康的活着就是一种莫大的幸福!!<br />
幸福无处不在 只要用心细细体会 你就能感觉到。</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2181/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2181&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2011/10/23/%e5%b9%b8%e7%a6%8f%e6%98%af%e4%bb%80%e4%b9%88%e6%84%9f%e8%a7%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>Daily wtf Watson story: Active Directory</title>
		<link>http://pure-essence.net/2011/10/01/daily-wtf-watson-story-active-directory/</link>
		<comments>http://pure-essence.net/2011/10/01/daily-wtf-watson-story-active-directory/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 11:38:27 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[dailywtf]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2178</guid>
		<description><![CDATA[A coworker of my husband&#8217;s, let&#8217;s call him Watson, has some interesting ways of dealing with situations. As a system administrator, he has unique powers. Two days ago my husband received a support ticket regarding a temporary employee unable to log into her machine. My husband updated her password and verified and he could log [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2178&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A coworker of my husband&#8217;s, let&#8217;s call him Watson, has some interesting ways of dealing with situations.  As a system administrator, he has unique powers.</p>
<p>Two days ago my husband received a support ticket regarding a temporary employee unable to log into her machine. My husband updated her password and verified and he could log in and closed the ticket.  A day later, the ticket was reopened with the same issue.  This time my husband tried her login on a different machine and true enough, he got the invalid username or password error.  He searched Active Directory looking for the temporary employee&#8217;s login and found nothing. It appeared someone had deleted the employee&#8217;s account.  </p>
<p>My husband scratched his head and inquired Watson:</p>
<p>&#8220;Watson, did you do anything with Mary&#8217;s account?&#8221;</p>
<p>Watson: &#8220;Yes, the manager requested that I delete her account.&#8221;</p>
<p>My husband got the manager on the phone and asked about the situation. The manager confirmed that he created a ticket to have Mary removed from a certain mailing list. As my husband was on the phone with the manager, Watson was listening and became rather irritated and printed the ticket and showed it to my husband.  The ticket titled &#8220;Remove Mary from mailing list ABC&#8221;.  My husband said to Watson:</p>
<p>&#8220;Watson, the ticket requested her removed from a mailing list, you deleted her entire Active Directory account!&#8221;</p>
<p>Watson: &#8220;How else was I supposed to get her off that mailing list?&#8221;</p>
<p>My husband: &#8220;Remove her from the mailing list?&#8221;</p>
<p>Watson barked: &#8220;Yes! I could have done that!&#8221; and stormed off and did not say anything else.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2178&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2011/10/01/daily-wtf-watson-story-active-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery read only elements</title>
		<link>http://pure-essence.net/2011/09/22/jquery-read-only-elements/</link>
		<comments>http://pure-essence.net/2011/09/22/jquery-read-only-elements/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 00:47:40 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[non php code]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[readonly]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2171</guid>
		<description><![CDATA[There is a business requirement on a project I have at work to only allow a certain number of properties editable at a certain stage of the domain object&#8217;s life cycle. And like always, the properties defined to be editable could change in the future. I already have a page that allows the user to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2171&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There is a business requirement on a project I have at work to only allow a certain number of properties editable at a certain stage of the domain object&#8217;s life cycle. <b>And like always, the properties defined to be editable could change in the future.<b></p>
<p>I already have a page that allows the user to edit all properties of the domain object, I really do not wish to duplicate that code. Please note that if you set an input element on a form as <b>disabled</b>, the value associated with the element will <b>NOT be submitted via form post</b>, that certainly is NOT what I&#8217;m looking for. I want the values of the *read only* fields still be submitted by the form but I just don&#8217;t want the user to edit the values. So I looked into using the readonly attribute in HTML. <a href="http://stackoverflow.com/questions/155291/can-html-checkboxes-be-set-to-readonly" target="_blank">It&#8217;s complete crap</a>. </p>
<p>For <a href="http://www.faqs.org/docs/htmltut/forms/_INPUT_DISABLED.html">faqs.org</a>:</p>
<blockquote><p>It&#8217;s important to understand that READONLY merely prevents the user from changing the value of the field, not from interacting with the field. In checkboxes, for example, you can check them on or off (thus setting the CHECKED state) but you don&#8217;t change the value of the field.</p></blockquote>
<p>Basically it works half-hearted and most browsers (IE, FF) do not indicate (by default) that a field is readonly. So the users will probably be left wondering why they cannot edit the field.</p>
<p>I searched around for an alternative and found <a href="http://plugins.jquery.com/project/readonly" target="_blank">this wonderful jQuery plugin readonly</a>. Even though I couldn&#8217;t get it to work right for my application, the idea behind it is genius. You basically put overlay layers on top of any input fields you wish to make read only. The plugin seems a bit outdated. Perhaps it doesn&#8217;t work well with the newer version of jQuery but the idea still works well. Therefore I implemented my own.</p>
<p>This implementation automatically makes all input fields read only unless the input field has the class <b>excludeMeFromReadOnly</b>. This is just my implementation for demonstration. I do not provide any support for this code. Use where you see fit.</p>
<p><b>CSS</b><br />
<pre class="brush: css; wrap-lines: false;">
.readOnlyOverlay {
	position: absolute;
	background-color: #666;
	opacity: 0.3;
	filter: alpha(opacity=30);
	padding: 0pt !IMPORTANT;
	margin: 0pt !IMPORTANT;
}
</pre></p>
<p><b>javascript function generateOverlay</b><br />
<pre class="brush: jscript; wrap-lines: false;">
function generateOverlay(element) {
	var dimension = getDimensions($(element));
	//console.log('top=' + dimension.top + ' left=' + dimension.left +' width='+ dimension.width + ' height=' + dimension.height);

	// disassociate corresponding label attributes so the value of the element cannot be changed by clicking on the labels
	var id = $(element).attr('id');
	var label = $('label[for=&quot;'+id+'&quot;]');
	$(label).removeAttr('for');
	
	// set my tabindex to -1 so tabs will ignore me
	$(element).attr('tabIndex', -1);
	$(label).attr('tabIndex', -1);

	// create a div overlay
	var overlay = $('&lt;div class=&quot;readOnlyOverlay&quot;&gt;&amp;nbsp;&lt;/div&gt;').appendTo('body');
	$(overlay).css('top', dimension.top).css('left', dimension.left).css('width', dimension.width).css('height', dimension.height);
}
</pre></p>
<p><b>javascript function getDimensions</b><br />
<pre class="brush: jscript; wrap-lines: false;">
function getDimensions(element){
	var ret = {};

	// The multiple acquisitions of the CSS styles are required to cover any border and padding the elements may have.
	// The Ternary (parseInt(...) || 0) statements fix a bug in IE6 where it returns NaN,
	//  which doesn't play nicely when adding to numbers...
	ret.width = $(element).width() 
	  + (parseInt($(element).css('borderLeftWidth')) || 0)
	  + (parseInt($(element).css('borderRightWidth')) || 0)
	  + (parseInt($(element).css('padding-left')) || 0)
	  + (parseInt($(element).css('padding-right')) || 0);
	ret.height = $(element).height() 
	  + (parseInt($(element).css('borderTopWidth')) || 0) 
	  + (parseInt($(element).css('borderBottomWidth')) || 0)
	  + (parseInt($(element).css('padding-bottom')) || 0)
	  + (parseInt($(element).css('padding-bottom')) || 0);
	var offsets = $(element).offset();
	ret.left = offsets.left;
	ret.top = offsets.top;

	return ret;
}
</pre></p>
<p><b>jQuery selector</b><br />
<pre class="brush: jscript; wrap-lines: false;">
// select all input,select elements. I'd wrap my form in a div.
$('div#formContent input, div#formContent select, div#formContent textarea').each(function(i, element) {
	// if the element doesn't have the class named excludeMeFromReadOnly, overlay it to make it look like it's read only
	if(!$(element).hasClass('excludeMeFromReadOnly')) {
		generateOverlay($(element));
	}
});
</pre></p>
<p>Please note, the plugin contains a lot more logic including IE hacks etc. Fortunately for me, I really don&#8217;t care about IE prior to version 8 in my particular scenario. Therefore I don&#8217;t need all of those hacks.</p>
<p><b>&#8212;&gt;<a href="http://regretless.com/stuff/jQuery/readOnlyOverlay.html" target="_blank">Example code</a> (<a href="http://jsfiddle.net/dodozhang21/dVGNV/" target="_blank">example at jsFiddle</a>)&lt;&#8212;</b></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2171/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2171&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2011/09/22/jquery-read-only-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery.each vs Javascript for loop</title>
		<link>http://pure-essence.net/2011/09/02/jquery-each-vs-javascript-for-loop/</link>
		<comments>http://pure-essence.net/2011/09/02/jquery-each-vs-javascript-for-loop/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 21:31:15 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[for loop]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2164</guid>
		<description><![CDATA[Being a big jQuery fan, I use jQuery.each method a lot in my Javascript code. Until recently I didn&#8217;t think too hard what jQuery.each really is. Its description says it&#8217;s an iterator but it certainly is NOT a true iterator. For example: Let me know what you expect the code below to return. Before I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2164&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Being a big jQuery fan, I use jQuery.each method a lot in my Javascript code. Until recently I didn&#8217;t think too hard what jQuery.each really is.</p>
<p><a href="http://api.jquery.com/jQuery.each/">Its description</a> says it&#8217;s an iterator but it certainly is NOT a true iterator.</p>
<p>For example:</p>
<p>Let me know what you expect the code below to return.</p>
<p><pre class="brush: jscript; wrap-lines: false;">
var myVars = ['foo1', 'foo2', 'foo3'];

function containsValue(myValue, myCollection) {
	jQuery.each(myCollection, function(i, val) {
		if(val == myValue) {
			return true;
		}
	});
	return false;
}

$(document).ready(function() {
	console.log(containsValue('foo2', myVars));
});
</pre></p>
<p>Before I know better, I&#8217;d expect it to return true. Since myCollection DOES CONTAIN the value &#8216;foo2&#8242;. However the function <b>containsValue WILL ALWAYS RETURN FALSE</b>. That&#8217;s because when you return out of jQuery.each, it simply exits out of jQuery.each but not the containing function. In fact, whether you do anything in the callback function at all, jQuery.each ALWAYS RETURNS the collection you pass in.</p>
<p>e.g.<br />
<pre class="brush: jscript; wrap-lines: false;">
var returnedVar = jQuery.each(myVars, function(i, val) {});
console.log(returnedVar === myVars); // evaluates to true
</pre></p>
<p>In my opinion, jQuery.each acts more like a closure than an iterator. Sure you may use it as an iterator as long as you not returning anything. If you are just changing behaviors or collecting information, it will mimic an iterator. But you need to know, it really is not an iterator.</p>
<p>Personally I&#8217;m going to start to use <a href="http://www.w3schools.com/js/js_loop_for_in.asp" target="_blank">Javascript&#8217;s native for..in statement</a> instead of jQuery.each for Javascript collection variables. There is also an argument that jQuery.each may never perform faster than the native support for an iterator. Therefore below I will rewrite the function above using for..in.</p>
<p><pre class="brush: jscript; wrap-lines: false;">
function containsValueWithFor(myValue, myCollection) {
	for (index in myCollection) {
		if(myCollection[index] == myValue) {
			return true;
		}
	}
	return false;
}

console.log(containsValueWithFor('foo2', myVars)); // true

var myMap = {'lala':'foo1', '2':'foo2', 'b':'foo3'};

console.log(containsValueWithFor('foo2', myMap)); // true as well for an object/map
</pre></p>
<p><b>&#8212;&gt;<a href="http://regretless.com/stuff/jQuery/jQueryEach.html" target="_blank">Example code</a>&lt;&#8212;</b></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2164&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2011/09/02/jquery-each-vs-javascript-for-loop/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>2011 nfjs Central Iowa Software Symposium</title>
		<link>http://pure-essence.net/2011/08/08/2011-nfjs-central-iowa-software-symposium/</link>
		<comments>http://pure-essence.net/2011/08/08/2011-nfjs-central-iowa-software-symposium/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 18:37:25 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[plug]]></category>
		<category><![CDATA[Central Iowa Software Symposium]]></category>
		<category><![CDATA[nfjs]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2152</guid>
		<description><![CDATA[My survey responses to the 2011 nfjs Central Iowa Software Symposium event for my company. Benefits to you and the company from attending this event: Keep up to date regarding the current technologies and development in the Java community. Information that your co-workers / the company should be aware of: Functional programming is making a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2152&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My survey responses to the <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/home" target="_blank">2011 nfjs Central Iowa Software Symposium</a> event for my company.</p>
<p><b>Benefits to you and the company from attending this event:</b><br />
Keep up to date regarding the current technologies and development in the Java community.</p>
<p><b>Information that your co-workers / the company should be aware of:</b><br />
Functional programming is making a big splash on the JVM. We really should come out of the traditional OO &amp; imperative programming mindset and start think of solving programming challenges in a multi-paradigm fashion. We should upgrade from CVS to Git <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><b>Information that you learned that may have negative impacts to the company:</b><br />
None</p>
<p><b>Would recommend this event / company presenting to someone else?  Why?</b><br />
Yes. The presenters have great knowledge about their topics. They always make me think harder and different about what I am doing at work.</p>
<p><b>Additional Comments or Suggestions:</b><br />
I greatly enjoyed learning more about <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/session?id=23443" title="SUPER FUNNY &amp; ENJOYABLE" target="_blank">Scala</a>, <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/session?id=23444" target="_blank">akka</a> and <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/session?id=22500" target="_blank">functional programming thinking</a>. <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/session?id=23655" target="_blank">The multi-paradigm session</a> by <a href="http://twitter.com/#!/tedneward" target="_blank">Ted Neward</a> opened my eyes.  I took logic &amp; functional programming courses in college and was super impressed by how concise and powerful those languages can be used to solve particular issues.  Now many frameworks on the JVM prove that as Java programmers (who are innately OO &amp; imperative), we may fully utilize the power of programming languages of other paradigms. This motivates me to explore a newer realm of programming.</p>
<p>I learned a lot from <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/session?id=22487" target="_blank">the Seven wastes of software development session</a> e.g. communication is 38% tone, 7% words &amp; 55% body languages. Therefore we should avoid plain emails for especially business rules discussion; converse with a coworker face to face is a much more effective way of communication.  I think I don’t always do well in this area.  Perhaps programmers are generally shy and introverted.  I need to learn to open up more.</p>
<p>I also loved <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/session?id=22476" target="_blank">the Spock session</a> although I feel Spock as a framework is yet completely mature for prime time. The fact it doesn’t have a version 1.x release somewhat speaks for this.  (And it’s not yet in maven central repository.)  I love its various features.  But it’s still under heavy development phase as its community is actively adding more features to the framework. If we start using it now, we may need to upgrade our code dramatically later to get its full effects e.g. the @Unroll feature is going to change soon.  However, I’m super excited to revisit it in a few months or so to see where it’s at. The fact that it’s a test framework great for both state testing &amp; interaction testing (mocking) is awesome!  It sounds like the mocking part of it is yet as mature as other mocking frameworks e.g. Mockito. For example, it doesn’t support partial mock/spy. This does not make me want to switch from Mockito to use it.</p>
<p>I will also use <a href="http://www.nofluffjuststuff.com/conference/des_moines/2011/08/session?id=23648" target="_blank">many of the new features of Groovy I learned</a> since I just started using Groovy for testing.  The SQL class Groovy has is extremely powerful and gave me many ideas as how I can utilize it to make testing more dynamic and more maintenance free.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2152&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2011/08/08/2011-nfjs-central-iowa-software-symposium/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>QUnit &#8211; test your javascript</title>
		<link>http://pure-essence.net/2011/07/24/qunit-test-your-javascript/</link>
		<comments>http://pure-essence.net/2011/07/24/qunit-test-your-javascript/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 16:28:06 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[non php code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[qunit]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2139</guid>
		<description><![CDATA[After over ten years of javascript programming, I&#8217;m finally seriously considering writing at least unit tests for my javascript. Since I&#8217;m such a big fan of jQuery, QUnit seems like the obvious choice. It&#8217;s sad but better late than never. The truth is, in my opinion, the fact that javascript test frameworks do not yet [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2139&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After over ten years of javascript programming, I&#8217;m finally seriously considering writing at least unit tests for my javascript. Since I&#8217;m such a big fan of jQuery, <a href="http://docs.jquery.com/QUnit">QUnit</a> seems like the obvious choice.</p>
<p>It&#8217;s sad but better late than never.</p>
<p>The truth is, in my opinion, the fact that javascript test frameworks do not yet maturely work with many of the continuous integration software deters programmers from using them. What&#8217;s the point of unit testing if they don&#8217;t automatically get run? Based on my research, <a href="http://www.jsunit.net/" target="_blank">JSUnit</a> is the only one that integrates with ANT innately. But JSUnit is more of an abandomware now so people are looking for alternatives.</p>
<p><strong>QUnit + CI topics</strong></p>
<ul>
<li>
<a href="http://lostechies.com/joshuaflanagan/2008/09/18/running-jquery-qunit-tests-under-continuous-integration/" target="_blank">jQuery tests under CI</a>
</li>
<li>
<a href="http://jupiterjs.com/#news/syn-a-standalone-synthetic-event-library" target="_blank">Syn instead of Selenium?</a>
</li>
<li>
<a href="http://docs.jquery.com/Qunit#Integration_into_Browser_Automation_Tools" target="_blank">QUnit and automated browser tools</a>
</li>
</ul>
<p>&gt;&gt; <a href="http://regretless.com/stuff/qunit/testSuite.html" target="_blank">Run my test suite</a> &lt;&lt;</p>
<p><strong>QUnit simple example:</strong></p>
<p>HTML:<br />
<pre class="brush: xml; wrap-lines: false;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Test Suite&lt;/title&gt;
	&lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/qunit/git/qunit.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/qunit/git/qunit.js&quot;&gt;&lt;/script&gt;
	&lt;!-- Your source files go here --&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;functions.js&quot;&gt;&lt;/script&gt;

	&lt;!-- Your tests files go here --&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;isEvenTest.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;startsWithTest.js&quot;&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
	&lt;h1 id=&quot;qunit-header&quot;&gt;QUnit example&lt;/h1&gt;
	&lt;h2 id=&quot;qunit-banner&quot;&gt;&lt;/h2&gt;
	&lt;div id=&quot;qunit-testrunner-toolbar&quot;&gt;&lt;/div&gt;
	&lt;h2 id=&quot;qunit-userAgent&quot;&gt;&lt;/h2&gt;
	&lt;ol id=&quot;qunit-tests&quot;&gt;&lt;/ol&gt;

	&lt;!-- Any HTML you may require for your tests to work properly --&gt;
	&lt;div id=&quot;qunit-fixture&quot;&gt;test markup, will be hidden&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></p>
<p>Source javascript file:<br />
<pre class="brush: jscript; wrap-lines: false;">
function isEven(val) {
	return val % 2 === 0;
}

function startsWith(data, startsWithStr) {
	data = jQuery.trim(data);
	startsWithStr = jQuery.trim(startsWithStr);
	if(data) {
		return data.toUpperCase().lastIndexOf(startsWithStr.toUpperCase(), 0) === 0;
	} else if(data === startsWithStr) {
		return true;
	} else {
		return false;
	}
}
</pre></p>
<p>Sample test file:<br />
<pre class="brush: jscript; wrap-lines: false;">
$(document).ready(function(){

	module(&quot;startsWithTest&quot;);

	test('startsWith', function() { 
		ok(startsWith(&quot;ll-925&quot;, &quot;ll-&quot;), 'Starts with ll-'); 
		ok(!startsWith(&quot;ll-925&quot;, &quot;xl-&quot;), 'Does not start with xl-'); 
		ok(!startsWith(&quot;&quot;, &quot;xx-&quot;), 'Does not start with xx-'); 
		ok(startsWith(&quot; xx-sdgj &quot;, &quot;xx-&quot;), 'Trimming test: starts with xx-'); 
		ok(startsWith(&quot; xx-sdgj&quot;, &quot; xx- &quot;), 'Trimming test 2: starts with xx-'); 
		ok(startsWith(&quot;&quot;, &quot; &quot;), 'Empty string starts with empty string'); 
		ok(startsWith(&quot;Mn-u59&quot;, &quot;mN-&quot;), 'Non case sensitive test'); 
//		raises(startsWith(foo, &quot; &quot;), 'Undefined test 1');  // undefined is obviously not considered a normal exception
	}) 

});
</pre></p>
<p>&gt;&gt; <a href="https://github.com/dodozhang21/QUnit-Example" target="_blank">git repo for the source</a> &lt;&lt;</p>
<p><strong>Additional resources:</strong></p>
<ul>
<li><a href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-test-your-javascript-code-with-qunit/" target="_blank">QUnit tutorials</a></li>
<li><a href="http://docs.jquery.com/QUnit#API_documentation" target="_blank">API documentation</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2139&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2011/07/24/qunit-test-your-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
		<item>
		<title>My father&#8217;s Gui Lin experience</title>
		<link>http://pure-essence.net/2011/07/24/my-fathers-gui-lin-experience/</link>
		<comments>http://pure-essence.net/2011/07/24/my-fathers-gui-lin-experience/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 14:52:32 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[chinese]]></category>
		<category><![CDATA[love n family]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://pure-essence.net/?p=2122</guid>
		<description><![CDATA[Gui Lin (Chinese: 桂林; pinyin: Guìlín;) is a prefecture-level city in China, situated in the northeast of the Guangxi Zhuang Autonomous Region on the west bank of the Li River. Its name means &#8220;forest of Sweet Osmanthus&#8221;, owing to the large number of fragrant Sweet Osmanthus trees located in the city. The city has long [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2122&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Guilin" target="_blank">Gui Lin</a> (Chinese: 桂林; pinyin: Guìlín;) is a prefecture-level city in China, situated in the northeast of the Guangxi Zhuang Autonomous Region on the west bank of the Li River. Its name means &#8220;forest of Sweet Osmanthus&#8221;, owing to the large number of fragrant Sweet Osmanthus trees located in the city. The city has long been renowned for its unique scenery.</p>
<p>My father and his girlfriend&#8217;s family visited Gui Lin about a month ago.</p>
<p>Although the scenery was exceptional like you&#8217;d expect but his experience was far from it.  Gui Lin is a cyclone for tourist traps.  He shared some of his bad experience and they were so jaw dropping, I have to blog about them.</p>
<p><strong>The Taxi</strong><br />
There is no meter on any of the taxi in that city. You bargain the price prior to your ride with the taxi driver and then s/he takes you to your destination.  See a problem with this particular arrangement or lack of governmental enforcement of honesty? Well, he&#8217;s experienced it.</p>
<p>On the way back from a previous trip, my father inquired the average cab fare from his hotel to the dock for his next day&#8217;s cruise. The driver indicated around 60 <a href="http://en.wikipedia.org/wiki/Renminbi" target="_blank">rmb</a>. The next morning, a different taxi driver wanted 80 rmb for the ride.  My father did not give in since he thought the fare should be 60 rmb. The taxi driver instead of not agreeing to the ride, took the 60 rmb and dropped them off at a different dock than their actual desired destination.  It took them a while to figure out they were at the WRONG dock since they were unfamiliar with the area.  They were late for their cruise and had to spend additional fare in order to travel to the correct dock.</p>
<p><strong>The Bamboo Raft Ride</strong><br />
A bamboo raft takes you down the stream of the river slowly by its current. My father had arranged a taxi to pick them up at the end of the trip.  Although the price of the ride was advertised to include food, they provided inedible dishes on the raft so they could market other dishes for extra cost. There were various vendors who stationed at different locations down the stream.  Some claimed the fish dishes were prepared with fish freshly caught in the river earlier in the morning.  They charged a lot for them.  My father and his girlfriend&#8217;s family did not purchase any.  They were later dropped off at a dock in which they thought was the end of the trip.  However, after a half hour wait for the taxi, my father called the taxi driver he paid for.  The taxi driver informed my dad that he was dropped at the wrong location. The raft people dropped them off way prior to the end of the trip.  My father was once more duped for exercising his right of not purchasing overpriced marketed tourist goods.</p>
<p>Gui Lin has been on my list of must visit places for a long time. Based on my dad&#8217;s accounts, I think I&#8217;m going to wait a little longer for that wish.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/2122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/2122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/2122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/2122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/2122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/2122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/2122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/2122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/2122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/2122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/2122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/2122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/2122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/2122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=2122&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2011/07/24/my-fathers-gui-lin-experience/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
	</channel>
</rss>
