<?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>Amar Phadke&#039;s weblog</title>
	<atom:link href="http://amarphadke.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://amarphadke.com</link>
	<description>Not Just another WordPress weblog</description>
	<lastBuildDate>Wed, 17 Mar 2010 19:26:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Learnings from the Past: Hibernate related Best Practices</title>
		<link>http://amarphadke.com/2010/03/18/learnings-from-the-past-hibernate-related-best-practices/</link>
		<comments>http://amarphadke.com/2010/03/18/learnings-from-the-past-hibernate-related-best-practices/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 18:54:34 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=118</guid>
		<description><![CDATA[Back to blogging after a gap of 8 months. I have been working on some cool optimization stuff related to Hibernate. Here is a brief summary of the best practices i have come across on this and past assignments involving Hibernate.












#
Practice
What?
Why?
How?


1
Use Lazy Load
Don&#8217;t load objects until you need to use them.
Queries involve lesser joins, so [...]]]></description>
			<content:encoded><![CDATA[<p>Back to blogging after a gap of 8 months. I have been working on some cool optimization stuff related to Hibernate. Here is a brief summary of the best practices i have come across on this and past assignments involving Hibernate.</p>
<div style="overflow:auto;height:300px;">
<!--   		BODY,DIV,TABLE,THEAD,TBODY,TFOOT,TR,TH,TD,P { font-family:"Arial"; font-size:x-small } --></p>
<table border="0px" cellspacing="5px" frame="VOID" rules="NONE" width="800px">
<colgroup>
<col width="25"></col>
<col width="125"></col>
<col width="200"></col>
<col width="200"></col>
<col width="250"></col>
</colgroup>
<tbody>
<tr>
<td height="17" align="LEFT" valign="TOP" bgcolor="#c0c0c0"><strong>#</strong></td>
<td  align="LEFT" valign="TOP" bgcolor="#c0c0c0"><strong>Practice</strong></td>
<td  align="LEFT" valign="TOP" bgcolor="#c0c0c0"><strong>What?</strong></td>
<td  align="LEFT" valign="TOP" bgcolor="#c0c0c0"><strong>Why?</strong></td>
<td  align="LEFT" valign="TOP" bgcolor="#c0c0c0"><strong>How?</strong></td>
</tr>
<tr>
<td height="47" align="LEFT" valign="TOP">1</td>
<td align="LEFT" valign="TOP">Use Lazy Load</td>
<td align="LEFT" valign="TOP">Don&#8217;t load objects until you need to use them.</td>
<td align="LEFT" valign="TOP">Queries involve lesser joins, so become faster</td>
<td align="LEFT" valign="TOP">By Using @Lazy annotation for simple attributes and LazyCollection for Collections</td>
</tr>
<tr>
<td height="62" align="LEFT" valign="TOP">2</td>
<td align="LEFT" valign="TOP">Use allocationSize&gt;1 for Sequences</td>
<td align="LEFT" valign="TOP">Use an allocationSize value of 50 or 100 instead of the default allocationSize of 1</td>
<td align="LEFT" valign="TOP">Avoids frequent db access to fetch next sequence value</td>
<td align="LEFT" valign="TOP">By using @allocationSize=50, Hibernate will generate the next sequence values for 50 invocations before hitting the db again.</td>
</tr>
<tr>
<td height="77" align="LEFT" valign="TOP">3</td>
<td align="LEFT" valign="TOP">Keep big character/byte fields in a seperate entity</td>
<td align="LEFT" valign="TOP">Seperate big fields like blob, clob, varchar(500), etc., into a seperate entity called &lt;enityName&gt;Details</td>
<td align="LEFT" valign="TOP">Avoids time spent in fetching data for these fields on listing screens which do not typically display this information</td>
<td align="LEFT" valign="TOP">By using a one-to-one mapping with the details object and keeping the direction of association from main-&gt;detail</td>
</tr>
<tr>
<td height="47" align="LEFT" valign="TOP">4</td>
<td align="LEFT" valign="TOP">Use Hibernate Caching</td>
<td align="LEFT" valign="TOP">Using Hibernate Second Level cache and Query cache to store frequently used objects/results</td>
<td align="LEFT" valign="TOP">Avoids hitting the db for frequently used information</td>
<td align="LEFT" valign="TOP">Turn on Hibernate Second level cache and Quey cache</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2010/03/18/learnings-from-the-past-hibernate-related-best-practices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learnings from the past: Writing jMock Unit tests in 6 simple steps</title>
		<link>http://amarphadke.com/2009/07/17/learnings-from-the-past-writing-jmock-unit-tests-in-6-simple-steps/</link>
		<comments>http://amarphadke.com/2009/07/17/learnings-from-the-past-writing-jmock-unit-tests-in-6-simple-steps/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 20:43:29 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Jmock]]></category>
		<category><![CDATA[Unit Test]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=24</guid>
		<description><![CDATA[Do you ever come across a situation where your Unit test ends up testing more than what a unit is supposed to be?  Does your unit test end up looking more like an Integration test? Does it only run within a container? Does it depend on external things like records in a table, entries in [...]]]></description>
			<content:encoded><![CDATA[<p>Do you ever come across a situation where your Unit test ends up testing more than what a unit is supposed to be?  Does your unit test end up looking more like an Integration test? Does it only run within a container? Does it depend on external things like records in a table, entries in ldap or data in some files? If your answer to any of the above questions is yes, then jMock could be the solution to your unit testing problem.</p>
<p><a href="http://jmock.org" target="_blank">jMock</a> is a library for testing Java code with mock objects. It sits on top of your existing unit testing framework (eg.Junit). It allows you to mock out interactions between objects hence preventing external dependencies.</p>
<p>You can write a jMock unit test using 6 simple steps:</p>
<ol>
<li>Initialize input:-  This is where you initialize all static data that will be used for the current unit test.</li>
<li>Initialize mocks:- Mock out your external dependencies here.</li>
<li>Setup expectations:- After you create the mock objects, you need to specify what interactions you are expecting to have with them. If the interactions dont happen as you expected, the test fails.</li>
<li>Initialize subject:- Subject is the object that you are trying to unit test. You will create an instance of the object and initialize it here.</li>
<li>Invoke Subject:- Call the method to be tested with static input.</li>
<li>Assert:- Make sure output is as expected and all expectations set on the mocks have been satisfied.</li>
</ol>
<p>Here is an example of how to go about using jMock:-<br />
AccountService exposes a &#8220;getAccountInformation&#8221; method which we want to unti test. This method first validates the input, authenticates credentials with ldap and then fetches the account information from the database. It uses a DB accessor and ldap authenticator to do so. First lets look at the AccountService:</p>
<div style="overflow: auto; height: 500px;">

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.amarphadke.jmockdemo.service</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.accessor.Authenticator</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.accessor.DataAccessor</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.domain.Account</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.exception.DomainException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.exception.ValidationException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.transport.AccountInformation</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.transport.AccountInformationRequest</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AccountService <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> DataAccessor dataAccessor<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Authenticator</span> authenticator<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> AccountService<span style="color: #009900;">&#40;</span>DataAccessor dataAccessor, <span style="color: #003399;">Authenticator</span> authenticator<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">dataAccessor</span> <span style="color: #339933;">=</span> dataAccessor<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">authenticator</span> <span style="color: #339933;">=</span> authenticator<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> AccountInformation getAccountInformation<span style="color: #009900;">&#40;</span>
			AccountInformationRequest request<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ValidationException, DomainException <span style="color: #009900;">&#123;</span>
		validateInput<span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Account account <span style="color: #339933;">=</span> dataAccessor.<span style="color: #006633;">fetchAccount</span><span style="color: #009900;">&#40;</span>request.<span style="color: #006633;">getAccountId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		AccountInformation accountInformation <span style="color: #339933;">=</span> convertDomainObjectToTransportObject<span style="color: #009900;">&#40;</span>account<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> accountInformation<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> AccountInformation convertDomainObjectToTransportObject<span style="color: #009900;">&#40;</span>Account account<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		AccountInformation accountInformation <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AccountInformation<span style="color: #009900;">&#40;</span>account
				.<span style="color: #006633;">getAccountId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, account.<span style="color: #006633;">getAccountType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, account
				.<span style="color: #006633;">getLastAccessedDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, account.<span style="color: #006633;">getFirstName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, account
				.<span style="color: #006633;">getLastName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, account.<span style="color: #006633;">getBalance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> accountInformation<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> validateInput<span style="color: #009900;">&#40;</span>AccountInformationRequest request<span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">throws</span> ValidationException <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>request.<span style="color: #006633;">getAccountId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> ValidationException<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #0000ff;">&quot;Invalid Account Id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>request.<span style="color: #006633;">getUsername</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> ValidationException<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span>, <span style="color: #0000ff;">&quot;Invalid Username&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>request.<span style="color: #006633;">getPassword</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> ValidationException<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span>, <span style="color: #0000ff;">&quot;Invalid Password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>authenticator.<span style="color: #006633;">isValidCredential</span><span style="color: #009900;">&#40;</span>request.<span style="color: #006633;">getAccountId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, request
				.<span style="color: #006633;">getUsername</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, request.<span style="color: #006633;">getPassword</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> ValidationException<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span>, <span style="color: #0000ff;">&quot;Invalid Credentails for Account&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</div>
<p>Now, lets take a look at the unit test:</p>
<div style="overflow: auto; height: 500px;">

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.amarphadke.jmockdemo.service</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Calendar</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Date</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">junit.framework.TestCase</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jmock.Expectations</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jmock.Mockery</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.accessor.Authenticator</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.accessor.DataAccessor</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.domain.Account</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.exception.DomainException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.exception.ValidationException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.service.AccountService</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.transport.AccountInformation</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.amarphadke.jmockdemo.transport.AccountInformationRequest</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AccountServiceTest <span style="color: #000000; font-weight: bold;">extends</span> TestCase <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> Mockery context <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Mockery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/*
	 * Test for AccountService.getAccountInformation(AccountInformationRequest)
	 * with valid input.
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testGetAccountInformationWithValidInput<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">throws</span> ValidationException, DomainException <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Step 1: Initialize input</span>
		<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">long</span> accountId <span style="color: #339933;">=</span> <span style="color: #cc66cc;">123456789</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> username <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;jmockDemoUser&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> password <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;encryptedPassword&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> accountType <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Checking&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">Double</span> balance <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Double</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100000000.99</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> firstName <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Richie&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> lastName <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Rich&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">Date</span> lastAccessedDate <span style="color: #339933;">=</span> <span style="color: #003399;">Calendar</span>.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">final</span> AccountInformationRequest request <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AccountInformationRequest<span style="color: #009900;">&#40;</span>
				accountId, username, password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">final</span> Account account <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Account<span style="color: #009900;">&#40;</span>accountId, accountType,
				lastAccessedDate, firstName, lastName, balance, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">final</span> AccountInformation accountInformation <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AccountInformation<span style="color: #009900;">&#40;</span>
				accountId, accountType, lastAccessedDate, firstName, lastName, balance<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Step 2: Initialize mocks</span>
		<span style="color: #000000; font-weight: bold;">final</span> DataAccessor dataAccessor <span style="color: #339933;">=</span> context.<span style="color: #006633;">mock</span><span style="color: #009900;">&#40;</span>DataAccessor.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Authenticator</span> authenticator <span style="color: #339933;">=</span> context.<span style="color: #006633;">mock</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Authenticator</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Step 3: Setup Expectations</span>
		context.<span style="color: #006633;">checking</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Expectations<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #009900;">&#123;</span>
				oneOf<span style="color: #009900;">&#40;</span>authenticator<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isValidCredential</span><span style="color: #009900;">&#40;</span>accountId, username, password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				will<span style="color: #009900;">&#40;</span>returnValue<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				oneOf<span style="color: #009900;">&#40;</span>dataAccessor<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">fetchAccount</span><span style="color: #009900;">&#40;</span>accountId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				will<span style="color: #009900;">&#40;</span>returnValue<span style="color: #009900;">&#40;</span>account<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Step 4: Initialize Subject</span>
		AccountService accountService <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AccountService<span style="color: #009900;">&#40;</span>dataAccessor,
				authenticator<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Step 5: Invoke Subject</span>
		AccountInformation actualAccountInformation <span style="color: #339933;">=</span> accountService
				.<span style="color: #006633;">getAccountInformation</span><span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Step 6: Assert</span>
		assertEquals<span style="color: #009900;">&#40;</span>accountInformation, actualAccountInformation<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		context.<span style="color: #006633;">assertIsSatisfied</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2009/07/17/learnings-from-the-past-writing-jmock-unit-tests-in-6-simple-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Complex Programs with Simple code?</title>
		<link>http://amarphadke.com/2009/04/05/complex-programs-with-simple-code/</link>
		<comments>http://amarphadke.com/2009/04/05/complex-programs-with-simple-code/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 19:39:04 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Chess]]></category>
		<category><![CDATA[Complex Software Programs]]></category>
		<category><![CDATA[Simple code]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=103</guid>
		<description><![CDATA[
After my last post, i was wondering if really complex programs/systems/applications could be written using simple, easy-to-understand code. Code that does not span more than 10 lines a method.
The most complex program that i could think of to experiment with was a Chess server &#8211; an app that would evaluate a position and suggest the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="Chessboard" src="http://www.amarphadke.com/images/chess.png" alt="Chessboard" width="100" height="100" /></p>
<p>After my last post, i was wondering if really complex programs/systems/applications could be written using simple, easy-to-understand code. Code that does not span more than 10 lines a method.</p>
<p>The most complex program that i could think of to experiment with was a Chess server &#8211; an app that would evaluate a position and suggest the &#8220;next best&#8221; move. This app would have a set of rules which would determine how good a position is. All possible &#8220;next moves&#8221; will be stored in a tree and evaluated on the position they end up with after &#8216;n&#8217; moves. For more information-&gt;<a href="http://en.wikipedia.org/wiki/Computer_chess" target="_blank">http://en.wikipedia.org/wiki/Computer_chess</a></p>
<p>I have created an open-source project on sourceforge.net for this activity-&gt;<a href="http://sourceforge.net/projects/javachessserver" target="_blank">http://sourceforge.net/projects/javachessserver</a>. What i have in there so far are the Chess domain objects, Rule interface, several skeleton rules and one concrete rule-&gt;CheckmateRule</p>
<p>I would be interested in knowing what you think about this project. If you are interested in joining this project and wish to explore this idea, i would be happy to include you.</p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2009/04/05/complex-programs-with-simple-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Code quality and cyclomatic complexity</title>
		<link>http://amarphadke.com/2009/02/21/code-quality-and-cyclomatic-complexity/</link>
		<comments>http://amarphadke.com/2009/02/21/code-quality-and-cyclomatic-complexity/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 19:36:20 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Code Quality]]></category>
		<category><![CDATA[Cyclomatic complexity]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=99</guid>
		<description><![CDATA[I recently came across this article on code quality and cyclomatic complexity. Found it interesting and so thought of sharing.
Do the following phrases sound familiar to you?  They surely sounded familiar to me.
Sure, it&#8217;s a bit confusing (at first), but look how extensible it is!!
It&#8217;s confusing to you because you obviously don&#8217;t understand patterns.
]]></description>
			<content:encoded><![CDATA[<p>I recently came across this <a href="http://www.ibm.com/developerworks/java/library/j-cq03316/">article on code quality and cyclomatic complexity</a>. Found it interesting and so thought of sharing.<br />
Do the following phrases sound familiar to you?  They surely sounded familiar to me.</p>
<p><em>Sure, it&#8217;s a bit confusing (at first), but look how extensible it is!!</em></p>
<p><em>It&#8217;s confusing to you because you obviously don&#8217;t understand patterns.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2009/02/21/code-quality-and-cyclomatic-complexity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet Connection monitoring script for the GNOME panel</title>
		<link>http://amarphadke.com/2009/01/14/internet-connection-monitoring-script-for-the-gnome-panel/</link>
		<comments>http://amarphadke.com/2009/01/14/internet-connection-monitoring-script-for-the-gnome-panel/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 06:37:49 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[GTK]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Notification]]></category>
		<category><![CDATA[Panel]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=93</guid>
		<description><![CDATA[I was having issues with my Internet connection lately. My connection used to drop after using it for a while and the router used to lose the IP address. I decided to write a simple script that would sit on the GNOME panel and tell me the current state of my Internet connection.
I found a [...]]]></description>
			<content:encoded><![CDATA[<p>I was having issues with my Internet connection lately. My connection used to drop after using it for a while and the router used to lose the IP address. I decided to write a simple script that would sit on the GNOME panel and tell me the current state of my Internet connection.</p>
<p>I found a <a href="http://java-gnome.sourceforge.net" target="_blank">Java-GNOME library</a> that would allow me to program for the  GTK using Java. I wrote a simple Java program that would connect to www.google.com and check if it can get the content. It would do this periodically (every 10s) with a connection timeout of 5s. If the site is reachable, the program would show a green icon in the notification area. If not, it will show a red blinking icon.</p>
<p>To use it here is what you need to do:</p>
<ol>
<li>Extract this <a title="Network Monitoring script" href="http://amarphadke.com/scripts/network_monitor_script.tar.gz" target="_self">archive</a> to a scripts sub-directory in your home folder.</li>
<li>In your .profile, add the following lines at the end</li>
<p>#Invoking Internet connection monitoring script<br />
$HOME/scripts/networkmonitor.sh</ol>
<p><img title="Internet Connection is up" src="http://amarphadke.com/images/network_on.png" alt="Internet Connection is up" width="640" /><img title="Internet Connection is down" src="http://amarphadke.com/images/network_off.png" alt="Internet Connection is up" width="640" /></p>
<p>Just log in again and you should see a green/red icon in your GNOME panel notification area. In case you face any problems try running $HOME/scripts/network_monitor.sh from a terminal and also check the sh file executable permission.</p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2009/01/14/internet-connection-monitoring-script-for-the-gnome-panel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Server&#8217;s virtual directory and network drive</title>
		<link>http://amarphadke.com/2009/01/04/web-servers-virtual-directory-and-network-drive/</link>
		<comments>http://amarphadke.com/2009/01/04/web-servers-virtual-directory-and-network-drive/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 09:43:30 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Web Server]]></category>
		<category><![CDATA[logon scripts]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Network drive]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Virtual directory]]></category>

		<guid isPermaLink="false">http://amarphadke.com/2009/01/04/web-servers-virtual-directory-and-network-drive/</guid>
		<description><![CDATA[I encountered a problem today trying to create an Apache Tomcat virtual directory that pointed to a mapped network drive.
Found out that this was due to the fact that Tomcat was running as a Service with a local account. It was not able to see the network drive since that used to get mapped with [...]]]></description>
			<content:encoded><![CDATA[<p>I encountered a problem today trying to create an Apache Tomcat virtual directory that pointed to a mapped network drive.<br />
Found out that this was due to the fact that Tomcat was running as a Service with a local account. It was not able to see the network drive since that used to get mapped with the logon scripts.<br />
Solution was to either run Tomcat Service my account or run the startup script from the command line. Tried the command line option and it recognized the network drive.<br />
This is probably true for any web server that runs as a service.</p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2009/01/04/web-servers-virtual-directory-and-network-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update on the GreaseMonkey Custom homepage script</title>
		<link>http://amarphadke.com/2008/12/31/update-on-the-greasemonkey-custom-homepage-script/</link>
		<comments>http://amarphadke.com/2008/12/31/update-on-the-greasemonkey-custom-homepage-script/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 20:16:55 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web browsing]]></category>
		<category><![CDATA[Custom home page]]></category>
		<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[iGoogle]]></category>
		<category><![CDATA[user scripts]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=72</guid>
		<description><![CDATA[As mentioned at the end of my last post, i continued exploring the idea of having a custom homepage with content aggregated from different sites on the client side. I tried using the about:blank page of Firefox as the starting point on which to build content, but could not succeed. After googling on this issue [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned at the end of <a title="Playing around with GreaseMonkey" href="http://amarphadke.com/2008/12/26/playing-around-with-greasemonkey/" target="_blank">my last post</a>, i continued exploring the idea of having a custom homepage with content aggregated from different sites on the client side. I tried using the about:blank page of Firefox as the starting point on which to build content, but could not succeed. After googling on this issue i found that doing this is not a good idea, since many sites use the about:blank page to create an empty iframe and then set its source. I also read that doing this could make your site prone to XSS attacks. Maybe thats why Firefox blocked access to it (?)</p>
<p>Then i thought about using <a href="http://www.google.com">Google</a> as my start page. I decided to add a 10-day weather forecast at the top of the screen. Had to do some screenscraping to get this content. Next came news. I decided to use the RSS feeds for this purpose. I came across a site-&gt;<a title="WebRSS" href="http://www.webrss.com" target="_blank">www.webrss.com</a> that will parse the xml content of the RSS feed and provide it via a javascript call. It also gives you the option of converting the rss feed to html, php or asp call. I added feeds from Google News, Times of India, CNN and BBC. Here is how it looks now (click on the image to get a bigger view):</p>
<p><a href="http://amarphadke.com/images/Firefox_custom_GM_homepage_script.png" target="#blank"><img src="http://amarphadke.com/images/small_Firefox_custom_GM_homepage_script.png" alt="Custom homepage using GreaseMonkey scripts" /></a></p>
<p>I decided to hold off on adding mail since that requires authentication.</p>
<p>Here&#8217;s the code so far:</p>
<div style="overflow:auto;height :500px">

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// ==UserScript==</span>
<span style="color: #006600; font-style: italic;">// @name           Homepage</span>
<span style="color: #006600; font-style: italic;">// @namespace      http://amarphadke.com/userscripts/customhomepage</span>
<span style="color: #006600; font-style: italic;">// @include        http://www.google.co.in</span>
<span style="color: #006600; font-style: italic;">// @include        http://www.google.com</span>
<span style="color: #006600; font-style: italic;">// ==/UserScript==</span>
&nbsp;
GM_xmlhttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    method<span style="color: #339933;">:</span> <span style="color: #3366CC;">'GET'</span><span style="color: #339933;">,</span>
    url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://www.weather.com/outlook/travel/businesstraveler/tenday/44130?from=36hr_topnav_business'</span><span style="color: #339933;">,</span>
    headers<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #3366CC;">'User-agent'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'Mozilla/4.0 (compatible) Greasemonkey'</span><span style="color: #339933;">,</span>
        <span style="color: #3366CC;">'Accept'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'application/xml,text/xml'</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #000066;">onload</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>responseDetails<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> startIndex <span style="color: #339933;">=</span> responseDetails.<span style="color: #660066;">responseText</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div id=&quot;tenDayWrap&quot;&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> endIndex <span style="color: #339933;">=</span> responseDetails.<span style="color: #660066;">responseText</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div id=&quot;TFbuttonB&quot;&gt;'</span><span style="color: #339933;">,</span> startIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> reqdString <span style="color: #339933;">=</span> responseDetails.<span style="color: #660066;">responseText</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span>startIndex<span style="color: #339933;">,</span>endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        reqdString <span style="color: #339933;">=</span> reqdString.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/&amp;deg;/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;==deg==&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        reqdString <span style="color: #339933;">=</span> reqdString.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/&amp;nbsp;/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        reqdString <span style="color: #339933;">=</span> reqdString.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/&lt;br&gt;/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&lt;br/&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        reqdString <span style="color: #339933;">=</span> reqdString.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\&quot;\&quot; width/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> width&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        reqdString <span style="color: #339933;">=</span> closeImgTags<span style="color: #009900;">&#40;</span>reqdString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> parser <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> DOMParser<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> dom <span style="color: #339933;">=</span> parser.<span style="color: #660066;">parseFromString</span><span style="color: #009900;">&#40;</span>reqdString<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;application/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> tdWraps <span style="color: #339933;">=</span> getArrayOf<span style="color: #009900;">&#40;</span>dom<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;tdWrap&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> weatherTableHTML <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&lt;table border='0' cellspacing='0' cellpadding='0' width='100%' style='font-size:11px;background-image:url(http://i.imwx.com/web/common/backgrounds/tenday_bkgd.jpg)'&gt;&lt;tr&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>tdWraps.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> divs <span style="color: #339933;">=</span> tdWraps<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> dayOfWeek<span style="color: #339933;">,</span> date<span style="color: #339933;">,</span>imgSrc<span style="color: #339933;">,</span> imgText<span style="color: #339933;">,</span> high<span style="color: #339933;">,</span> low <span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>j<span style="color: #339933;">&lt;</span>divs.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;tdDate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				dayOfWeek <span style="color: #339933;">=</span> getDayOfWeek<span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				date <span style="color: #339933;">=</span> getDate<span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;tdForecast&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				imgSrc <span style="color: #339933;">=</span> getImageSrc<span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				imgText <span style="color: #339933;">=</span> getImageText<span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;tdTemps&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				high <span style="color: #339933;">=</span> getHighTemp<span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				low <span style="color: #339933;">=</span> getLowTemp<span style="color: #009900;">&#40;</span>divs<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		weatherTableHTML<span style="color: #339933;">+=</span>renderCol<span style="color: #009900;">&#40;</span>dayOfWeek<span style="color: #339933;">,</span> date<span style="color: #339933;">,</span>imgSrc<span style="color: #339933;">,</span> imgText<span style="color: #339933;">,</span> high<span style="color: #339933;">,</span> low<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	weatherTableHTML<span style="color: #339933;">+=</span><span style="color: #3366CC;">&quot;&lt;/tr&gt;&lt;/table&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	document.<span style="color: #660066;">body</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
	document.<span style="color: #660066;">title</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;It's my custom homepage&quot;</span><span style="color: #339933;">;</span>
	document.<span style="color: #660066;">body</span>.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;style&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;margin:0px;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> weatherDiv <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	weatherDiv.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&lt;div style='text-align:center;font-weight:bold;font-weight:14px;font-family:Verdana;background-image:url(http://i.imwx.com/web/common/backgrounds/tenday_bkgd.jpg);'&gt;Weather&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> newElement <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	newElement.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;style&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;text-align:center;vertical-align:center;font-weight:bold;font-family:Verdana;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	newElement.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> weatherTableHTML<span style="color: #339933;">;</span>
&nbsp;
	weatherDiv.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>newElement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>weatherDiv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> newsDiv <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	newsDiv.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&lt;div style='text-align:center;font-weight:bold;font-weight:14px;font-family:Verdana;background-image:url(http://i.imwx.com/web/common/backgrounds/tenday_bkgd.jpg);'&gt;News&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
	addWebRSSFeed<span style="color: #009900;">&#40;</span>newsDiv<span style="color: #339933;">,</span> <span style="color: #CC0000;">7885</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	addWebRSSFeed<span style="color: #009900;">&#40;</span>newsDiv<span style="color: #339933;">,</span> <span style="color: #CC0000;">7887</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	addWebRSSFeed<span style="color: #009900;">&#40;</span>newsDiv<span style="color: #339933;">,</span> <span style="color: #CC0000;">7888</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	addWebRSSFeed<span style="color: #009900;">&#40;</span>newsDiv<span style="color: #339933;">,</span> <span style="color: #CC0000;">7889</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>newsDiv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> addWebRSSFeed<span style="color: #009900;">&#40;</span>parentDiv<span style="color: #339933;">,</span> feedId<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> feed <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'iframe'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	feed.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;http://www.webrss.com/get_mysite.php?mysiteId=&quot;</span><span style="color: #339933;">+</span>feedId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	feed.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;300px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	feed.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;400px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	feed.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;frameborder&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	parentDiv.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>feed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getArrayOf<span style="color: #009900;">&#40;</span>parentNode<span style="color: #339933;">,</span> tdClassName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> tdWraps <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> divArrays <span style="color: #339933;">=</span> parentNode.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>divArrays.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>divArrays<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span>tdClassName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			tdWraps<span style="color: #009900;">&#91;</span>tdWraps.<span style="color: #660066;">length</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> divArrays<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">return</span> tdWraps<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> closeImgTags<span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> updatedString <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> lastIndexOfImg<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> endBracketIndex <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>lastIndexOfImg<span style="color: #339933;">=</span>string.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;img &quot;</span><span style="color: #339933;">,</span> lastIndexOfImg<span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		updatedString<span style="color: #339933;">+=</span> string.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span>endBracketIndex<span style="color: #339933;">,</span> lastIndexOfImg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> endBracketIndex <span style="color: #339933;">=</span> string.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&gt;&quot;</span><span style="color: #339933;">,</span> lastIndexOfImg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		updatedString<span style="color: #339933;">+=</span> string.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span>lastIndexOfImg<span style="color: #339933;">,</span> endBracketIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;/&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	updatedString<span style="color: #339933;">+=</span> string.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span>endBracketIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> updatedString<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getDayOfWeek<span style="color: #009900;">&#40;</span>tdDateDiv<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> tdDateDiv.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">firstChild</span>.<span style="color: #660066;">textContent</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getDate<span style="color: #009900;">&#40;</span>tdDateDiv<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> tdDateDiv.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;p&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">lastChild</span>.<span style="color: #660066;">textContent</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getImageSrc<span style="color: #009900;">&#40;</span>tdForecast<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> tdForecast.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;img&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getImageText<span style="color: #009900;">&#40;</span>tdForecast<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> tdForecast.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;p&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">lastChild</span>.<span style="color: #660066;">textContent</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getHighTemp<span style="color: #009900;">&#40;</span>tdTemps<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> tdTemps.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;strong&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">textContent</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/==deg==/g</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&amp;deg; F&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getLowTemp<span style="color: #009900;">&#40;</span>tdTemps<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> tdTemps.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;p&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">lastChild</span>.<span style="color: #660066;">textContent</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/==deg==/g</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&amp;deg; F&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> renderCol<span style="color: #009900;">&#40;</span>dayOfWeek<span style="color: #339933;">,</span> date<span style="color: #339933;">,</span>imgSrc<span style="color: #339933;">,</span> imgText<span style="color: #339933;">,</span> high<span style="color: #339933;">,</span> low<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;&lt;td width='10%' align='center'&gt;&quot;</span><span style="color: #339933;">+</span>dayOfWeek<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>date<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;div style='background-color:white;width:81px;height:75px; border: 1px solid #F0EBD5;'&gt;&lt;br/&gt;&lt;img src='&quot;</span><span style="color: #339933;">+</span>imgSrc<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;' border='0'/&gt;&lt;br/&gt;&lt;/div&gt;&quot;</span><span style="color: #339933;">+</span>imgText<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;br/&gt;&quot;</span><span style="color: #339933;">+</span>high<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #339933;">+</span>low<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</div>
<p>After reading this post, you may ask why build this when there are sites that offer this kind of feature for free (Eg., Google, Yahoo, BBC, etc.,). My answer to that would be -&gt;This customization is being done on the client side. You have more flexibility in terms of what content to display and from what source. Can you imagine iGoogle giving you a widget to read your Yahoo emails? or BBC presenting a news widget on its portal the content of which comes from Times of India? or how easily can you convince Google to build a 10-day weather forecast widget for you on iGoogle?</p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2008/12/31/update-on-the-greasemonkey-custom-homepage-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing around with Greasemonkey</title>
		<link>http://amarphadke.com/2008/12/26/playing-around-with-greasemonkey/</link>
		<comments>http://amarphadke.com/2008/12/26/playing-around-with-greasemonkey/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 14:45:19 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web browsing]]></category>
		<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[user scripts]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=48</guid>
		<description><![CDATA[Greasemonkey is an extension for firefox which allows users to write custom scripts that can change the UI and behavior of web-pages.
I tried writing a small script that would change the layout of an RSS-feed aggregator site-&#62;www.waywework.it. Here is a screen shot of how it looks after applying the custom Greasemonkey script.

And here is the [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Greasemonkey" href="http://en.wikipedia.org/wiki/Greasemonkey" target="_blank">Greasemonkey</a> is an extension for <a href="http://www.firefox.com" target="_blank">firefox </a>which allows users to write custom scripts that can change the UI and behavior of web-pages.<br/><br />
I tried writing a small script that would change the layout of an RSS-feed aggregator site-&gt;<a href="http://www.waywework.it" target="_blank">www.waywework.it</a>. Here is a screen shot of how it looks after applying the custom Greasemonkey script.<br />
<img class="alignnone size-medium wp-image-52" title="Modified layout of www.waywework.it" src="http://amarphadke.com/wp-content/uploads/2008/12/www_greasemonkeyfied2-300x225.jpg" alt="Modified layout of www.waywework.it" width="381" height="285" /><br />
<br/>And here is the script:</p>
<div style="overflow:auto;height :500px">

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
<span style="color: #006600; font-style: italic;">// ==UserScript==</span>
<span style="color: #006600; font-style: italic;">// @name           WayWeWork.it</span>
<span style="color: #006600; font-style: italic;">// @namespace      http://amarphadke.com/userscripts/waywework.it</span>
<span style="color: #006600; font-style: italic;">// @include        http://waywework.it/</span>
<span style="color: #006600; font-style: italic;">// ==/UserScript==</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> blogsAndPosts <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> contentDivCollection <span style="color: #339933;">=</span> document.<span style="color: #660066;">evaluate</span><span style="color: #009900;">&#40;</span>
    <span style="color: #3366CC;">&quot;//div[@class='left left_column']&quot;</span><span style="color: #339933;">,</span>
    document<span style="color: #339933;">,</span>
    <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
    XPathResult.<span style="color: #660066;">UNORDERED_NODE_SNAPSHOT_TYPE</span><span style="color: #339933;">,</span>
    <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>contentDivCollection.<span style="color: #660066;">snapshotLength</span><span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;html&gt;&lt;head&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;/head&gt;&lt;body bgcolor='#F1F4E2'&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div align=&quot;center&quot;&gt;&lt;img src=&quot;http://waywework.it/images/logo.png?1227062722&quot;/&gt;&lt;/div&gt;n'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> contentDiv <span style="color: #339933;">=</span> contentDivCollection.<span style="color: #660066;">snapshotItem</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> currentPost <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>contentDiv.<span style="color: #660066;">childNodes</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>contentDiv.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">nodeName</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;H1&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			currentPost <span style="color: #339933;">=</span> contentDiv.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>contentDiv.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">nodeName</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;H2&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>contentDiv.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span>.<span style="color: #660066;">length</span><span style="color: #339933;">==</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #003366; font-weight: bold;">var</span> currentBlog <span style="color: #339933;">=</span> contentDiv.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">;</span>
				<span style="color: #003366; font-weight: bold;">var</span> currentBlogURL <span style="color: #339933;">=</span> contentDiv.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">href</span><span style="color: #339933;">;</span>
				currentPost<span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot; (&quot;</span><span style="color: #339933;">+</span>stripLastChar<span style="color: #009900;">&#40;</span>contentDiv.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">textContent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #339933;">;</span>
&nbsp;
				currentBlog <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>currentBlog<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">/&gt;</span>s<span style="color: #339933;">*&lt;/</span>a<span style="color: #339933;">&gt;/</span>g<span style="color: #339933;">,</span><span style="color: #3366CC;">'&gt;Blank&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				currentPost <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>currentPost<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">/&gt;</span>s<span style="color: #339933;">*&lt;/</span>a<span style="color: #339933;">&gt;/</span>g<span style="color: #339933;">,</span><span style="color: #3366CC;">'&gt;Blank&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				addToArray<span style="color: #009900;">&#40;</span>currentBlog<span style="color: #339933;">,</span> currentBlogURL<span style="color: #339933;">,</span> currentPost<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				currentPost <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	blogsAndPosts <span style="color: #339933;">=</span> blogsAndPosts.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;div style='padding-left:150px;'&gt;&lt;ul&gt;n&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>blogsAndPosts.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> blogsToPost <span style="color: #339933;">=</span> blogsAndPosts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;br/&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;li&gt;&lt;a style='font-weight:bold;color:black;font-family:Verdana,Tahoma;text-decoration:none;font-size:14px' href='&quot;</span><span style="color: #339933;">+</span>blogsToPost<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;'&gt;&quot;</span><span style="color: #339933;">+</span>blogsToPost<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/a&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;ul&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j<span style="color: #339933;">=</span><span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>j<span style="color: #339933;">&lt;</span>blogsToPost.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;li&gt;&lt;div style='font-family:Tahoma,Verdana;font-size:12px;text-decoration:none;'&gt;&quot;</span><span style="color: #339933;">+</span>blogsToPost<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/div&gt;&lt;/li&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;/ul&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;/li&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;/ul&gt;&lt;/div&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;/body&gt;&lt;/html&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	document.<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> stripLastChar<span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> string.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> string.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> addToArray<span style="color: #009900;">&#40;</span>blog<span style="color: #339933;">,</span> blogURL<span style="color: #339933;">,</span>post<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>blogsAndPosts.<span style="color: #660066;">length</span><span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		addBlog<span style="color: #009900;">&#40;</span>blogsAndPosts<span style="color: #339933;">,</span> blog<span style="color: #339933;">,</span> blogURL<span style="color: #339933;">,</span> post<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> found <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>blogsAndPosts.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> blogsToPost <span style="color: #339933;">=</span> blogsAndPosts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>blogsToPost<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> blog<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				blogsToPost<span style="color: #009900;">&#91;</span>blogsToPost.<span style="color: #660066;">length</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> post<span style="color: #339933;">;</span>
				found <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>found<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			addBlog<span style="color: #009900;">&#40;</span>blogsAndPosts<span style="color: #339933;">,</span> blog<span style="color: #339933;">,</span> blogURL<span style="color: #339933;">,</span> post<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> addBlog<span style="color: #009900;">&#40;</span>blogsArray<span style="color: #339933;">,</span> blog<span style="color: #339933;">,</span> blogURL<span style="color: #339933;">,</span> post<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>blog <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span> <span style="color: #339933;">||</span> post <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #003366; font-weight: bold;">var</span> blogsToPost <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	blogsToPost<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> blog<span style="color: #339933;">;</span>
	blogsToPost<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> blogURL<span style="color: #339933;">;</span>
	blogsToPost<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> post<span style="color: #339933;">;</span>
	blogsArray<span style="color: #009900;">&#91;</span>blogsArray.<span style="color: #660066;">length</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> blogsToPost<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</div>
<p>Next step, try and see if we can build a custom browser homepage(about:blank) with a Google Searchbar, Yahoo mail and weather.com weather.</p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2008/12/26/playing-around-with-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Sony Erricson, Toshiba, Vodafone &amp; 11 others join Open Handset Alliance</title>
		<link>http://amarphadke.com/2008/12/11/sony-erricson-toshiba-vodafone-11-others-join-open-handset-alliance/</link>
		<comments>http://amarphadke.com/2008/12/11/sony-erricson-toshiba-vodafone-11-others-join-open-handset-alliance/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 18:43:41 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Mobile Computing]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Open Handset Alliance]]></category>

		<guid isPermaLink="false">http://amarphadke.com/?p=39</guid>
		<description><![CDATA[The Open Handset Alliance announced the joining of 14 additional companies yesterday. This includes the likes of Sony Erricson, Toshiba and Vodafone amongst others.
New members will either deploy compatible Android devices, contribute significant code to the Android Open Source Project, or support the ecosystem through products and services that will accelerate the availability of Android-based [...]]]></description>
			<content:encoded><![CDATA[<p>The Open Handset Alliance announced the joining of 14 additional companies yesterday. This includes the likes of Sony Erricson, Toshiba and Vodafone amongst others.</p>
<p>New members will either deploy compatible Android devices, contribute significant code to the Android Open Source Project, or support the ecosystem through products and services that will accelerate the availability of Android-based devices.</p>
<p>The new members will add to the momentum of Android device availability, providing developers with an even greater opportunity to deploy compelling applications that will reach a global audience. As a result, consumers around the world benefit from a superior mobile experience that features less expensive devices, more compelling services, rich Internet applications, and easier-to-use interfaces.</p>
<p>The complete list reads: AKM Semiconductor Inc., ARM, ASUSTek Computer Inc., Atheros Communications, Borqs, Ericsson, Garmin International Inc., Huawei Technologies, Omron Software Co. Ltd, Softbank Mobile Corporation, Sony Ericsson, Teleca AB, Toshiba Corporation and Vodafone.</p>
<p>For more information visit the press release <a href="http://www.openhandsetalliance.com/press_120908.html" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2008/12/11/sony-erricson-toshiba-vodafone-11-others-join-open-handset-alliance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learnings from the Past: Rules Engine</title>
		<link>http://amarphadke.com/2008/12/04/learnings-from-the-past-rules-engine/</link>
		<comments>http://amarphadke.com/2008/12/04/learnings-from-the-past-rules-engine/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 19:03:47 +0000</pubDate>
		<dc:creator>amar647</dc:creator>
				<category><![CDATA[Rules engine]]></category>
		<category><![CDATA[Business Rules Engine]]></category>

		<guid isPermaLink="false">http://amarphadke.com/2008/12/04/learnings-from-the-past-rules-engine/</guid>
		<description><![CDATA[I was working with a bank in the mid-west US a few years back. They were building an on-line mortgage application that would allow brokers to submit loan applications and get real time product and pricing information. After some initial discussions it was decided to build a product and pricing engine in-house using an of-the-shelf [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" style="float: left;" src="http://amarphadke.com/images/ruleengine.jpg" alt="" width="46" height="45" />I was working with a bank in the mid-west US a few years back. They were building an on-line mortgage application that would allow brokers to submit loan applications and get real time product and pricing information. After some initial discussions it was decided to build a product and pricing engine in-house using an of-the-shelf Rules engine. I will try and summarize my learning&#8217;s about choosing the right Rules Engine below:</p>
<p>1) Choose a small vendor with a robust product but few clients. This would ensure a fast and accurate response to your queries and issues.</p>
<p>2) Expect Customizations, so get an early commitment from the vendor in terms of resources. Get somebody from the vendor side who knows the product inside-out and willing to adjust the product api&#8217;s as per your need.</p>
<p>3) Find out how easy it is for a layman to define rules. After all its the business who is going to manage the rules in the long term..not IT.</p>
<p>4) Find out how easily the product can scale. How many tps can it support. You don&#8217;t want your application to choke up due to the product that you&#8217;ve bought.</p>
<p>5) Find out how easily you can plug-in custom code/ui with the engine. Does it allow itself to be wrapped inside another front-end application for providing a consistent look and feel? Does it support external authentication/authorization?</p>
<p>6) Find out how easy it is to debug the rules. In our case, the rule engine used to generate java code which was easy to debug.</p>
<p>7) Find out how easy it is to simulate conditions. Having something to visualize a &#8220;what if&#8221; scenario always helps the business.</p>
]]></content:encoded>
			<wfw:commentRss>http://amarphadke.com/2008/12/04/learnings-from-the-past-rules-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

