<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-818850914311213273</atom:id><lastBuildDate>Fri, 19 Aug 2011 09:17:05 +0000</lastBuildDate><category>data integration</category><category>web</category><category>gadgets</category><category>soa</category><category>pramati</category><category>storage</category><category>ilm</category><category>algorithms</category><category>open source</category><category>distributed systems</category><category>opensocial</category><category>hadoop</category><category>oAuth</category><category>iphone</category><category>osgi</category><category>intelligence</category><category>map reduce</category><category>web 2.0</category><category>spring</category><category>.net</category><category>eclipse</category><category>web 3.0</category><category>closures</category><category>information graphics</category><category>eii</category><category>business</category><category>semantic</category><category>java</category><category>security</category><category>information</category><category>aop</category><category>jBPM</category><category>experiments</category><category>XML</category><category>sling</category><category>ux</category><category>open solaris</category><category>OpenID</category><category>webservice</category><category>ui</category><category>RCP</category><category>groovy</category><category>ria</category><category>ASP.Net</category><category>architecture</category><category>widget</category><category>designpatterns</category><category>extjs</category><category>hbase</category><category>json</category><category>google</category><category>ruby</category><category>invisible</category><category>technology</category><category>GWT</category><category>javascript</category><category>ambient</category><category>github</category><category>social</category><category>RPC</category><category>event processing</category><category>adobe air</category><category>technical document</category><category>codes</category><category>griffon</category><category>rdf</category><category>guice</category><category>JCR</category><category>internet</category><category>avro</category><category>database</category><category>linux</category><category>apache</category><category>hibernate</category><category>JVM</category><category>cloud computing</category><category>REST</category><category>silverlight</category><category>ajax</category><category>patterns</category><category>future computing</category><category>programming</category><category>protocol buffers</category><category>lucene</category><category>BPM</category><category>indexing</category><category>API</category><category>networks</category><category>bloomfilter</category><category>comet</category><category>jquery</category><category>objectiveC</category><category>WCF</category><category>twitter</category><category>data access</category><category>geo-spatial</category><category>orm</category><category>jibx</category><category>standards</category><title>#BYTESCROLLS</title><description /><link>http://bytescrolls.blogspot.com/</link><managingEditor>noreply@blogger.com (Haris)</managingEditor><generator>Blogger</generator><openSearch:totalResults>71</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/bytescrolls" /><feedburner:info uri="bytescrolls" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-3294630419062203864</guid><pubDate>Fri, 15 Jul 2011 17:42:00 +0000</pubDate><atom:updated>2011-07-15T23:12:16.677+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algorithms</category><title>Boyer and Moore's Linear Time Voting Algorithm</title><description>This is a simple linear time voting algorithm designed by Robert S Boyer and J Stother Moore in 1980 which is discussed in their paper &lt;i&gt;&lt;a href="http://www.cs.utexas.edu/users/boyer/mjrty.ps.Z"&gt;MJRTY - A Fast Majority Vote Algorithm&lt;/a&gt;&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;This algorithm decides which element of a sequence is in the majority, provided there is such an element.&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Suppose there are n characters (objects/candidates). When the ith element&amp;nbsp;is visited, the set can be divided into two groups,ca group of k elements in favor of current selected candidate and&amp;nbsp;a group of elements that disagree.After processing all, we can conclude&amp;nbsp;that candidate selected can be considered majority if there's any !&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
When the pointer forward over an element e:&lt;br /&gt;
&lt;br /&gt;
If the counter is 0, we set the current candidate to e and we set the counter to 1.&lt;br /&gt;
If the counter is not 0, we increment or decrement the counter according to whether e is the current candidate.&lt;br /&gt;
When we are done, the current candidate is the majority element, if there is a majority.&lt;br /&gt;
&lt;br /&gt;
I have written a simple java implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1085114.js"&gt; &lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometime ties may occur. But this algorithm doesn't fit as the solution.For an assurance, if the vote is greater than n/2, the candidate which is returned&amp;nbsp;as majority it is announced to be the selected one. This counting&amp;nbsp;phase can be done when the increment for the candidate happens.This algorithm is really effective when the data is read from a tape.The algorithm only works when at least half of the elements constitute&amp;nbsp;the majority.&lt;br /&gt;
&lt;br /&gt;
Reference&lt;br /&gt;
&lt;a href="http://www.cs.utexas.edu/users/moore/best-ideas/mjrty/example.html"&gt;http://www.cs.utexas.edu/users/moore/best-ideas/mjrty/example.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-3294630419062203864?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/qXYtbU8znms/boyer-and-moores-linear-time-voting.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2011/07/boyer-and-moores-linear-time-voting.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-7021673409515476499</guid><pubDate>Thu, 14 Jul 2011 15:38:00 +0000</pubDate><atom:updated>2011-07-14T21:09:54.242+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Descending iterator</title><description>There is a descending iterator in linked list implementation in Java SDK. A humble private class in LinkedList. A good example of adapter.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-vjCrJo-4LG0/Th8McyiCXiI/AAAAAAAAATQ/r6K88fxniGo/s1600/300px-ClassAdapter.png" /&gt;&lt;/div&gt;&lt;br /&gt;
&lt;script src="https://gist.github.com/1082669.js?file=link-1.java"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
calls up &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public Iterator&amp;lt;E&amp;gt; descendingIterator() {&lt;br /&gt;
return new DescendingIterator();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1082671.js?file=desc.java"&gt;
&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-7021673409515476499?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/Mw49igrOgLw/descending-iterator.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-vjCrJo-4LG0/Th8McyiCXiI/AAAAAAAAATQ/r6K88fxniGo/s72-c/300px-ClassAdapter.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2011/07/descending-iterator.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-5952776264752145965</guid><pubDate>Mon, 30 May 2011 12:42:00 +0000</pubDate><atom:updated>2011-05-30T20:14:31.212+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">avro</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">hadoop</category><title>Using Avro to serialize logs in log4j</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-OjpqApa4dIc/TeORhvKaErI/AAAAAAAAAS4/_yk9rjObStM/s1600/logos.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="89" src="http://3.bp.blogspot.com/-OjpqApa4dIc/TeORhvKaErI/AAAAAAAAAS4/_yk9rjObStM/s320/logos.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;I have written about serialization mechanism of Protocol Buffers previously.&amp;nbsp;Similarly,&amp;nbsp;&lt;a href="http://avro.apache.org/"&gt;Apache Avro &lt;/a&gt;provides a better serialization framework.&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
It provide features like:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- Independent Schema - &amp;nbsp;use different schemas for serialization and de-serialization&lt;br /&gt;
&amp;nbsp;- Binary serialization - compact data encoding, and faster data processing&lt;br /&gt;
&amp;nbsp;- Dynamic typing - serialization and deserialization without code generation&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&amp;nbsp;We can encode data when serializing with Avro: binary or JSON. In the binary file schema is&amp;nbsp;&amp;nbsp;included at the beginning of file. In JSON, the type is defined along with the data.&amp;nbsp;Switching JSON protocol to a binary format in order to achieve better performance is&amp;nbsp;pretty straightforward with Avro. This means less type information needs to be sent with the data and&amp;nbsp;it stores data with its schema means any program can de-serialize the encoded data, which&amp;nbsp;makes a good candidate for &lt;a href="http://en.wikipedia.org/wiki/Remote_procedure_call"&gt;RPC&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;In Avro 1.5 we have to use (this is different from previous versions which had no factory for encoders)&lt;br /&gt;
&amp;nbsp;- &lt;i&gt;&lt;a href="http://avro.apache.org/docs/current/api/java/org/apache/avro/io/EncoderFactory.html#binaryEncoder(java.io.OutputStream, org.apache.avro.io.BinaryEncoder)"&gt;org.apache.avro.io.EncoderFactory.binaryEncoder(OutputStream out, BinaryEncoder reuse)&lt;/a&gt;&lt;/i&gt; for binary&lt;br /&gt;
&amp;nbsp;- &lt;i&gt;&lt;a href="http://avro.apache.org/docs/1.5.1/api/java/org/apache/avro/io/EncoderFactory.html#jsonEncoder(org.apache.avro.Schema, org.codehaus.jackson.JsonGenerator)"&gt;org.apache.avro.io.EncoderFactory.jsonEncoder(Schema schema, OutputStream out)&lt;/a&gt;&lt;/i&gt; for JSON&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The values (Avro supported value types) are put for the schema field name as the key&lt;br /&gt;
&amp;nbsp;in a set of name-value pairs called &lt;a href="http://avro.apache.org/docs/1.5.1/api/java/org/apache/avro/generic/GenericData.Record.html"&gt;&amp;nbsp;&lt;i&gt;GenericData.Record&lt;/i&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Avro supported value types are&lt;br /&gt;
&amp;nbsp; &lt;i&gt;Primitive Types&lt;/i&gt; -&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;null, boolean, int,&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;long, float, double, bytes,&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;string&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;i&gt;Complex Types&lt;/i&gt; - Records, Enums, Arrays, Maps, Unions, Fixed&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; you can read more about them &amp;nbsp;&lt;a href="http://avro.apache.org/docs/current/spec.html#schemas"&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; An encoded schema definition to be provided for the record instance. To read/write data,&amp;nbsp;just use put/get methods&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&amp;nbsp; &amp;nbsp;I have used this serialization mechanism to provide a layout for log4j. The logs will&amp;nbsp;be serialized to avro mechanism.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;github &lt;/b&gt;project is here -&amp;nbsp;&lt;a href="https://github.com/harisgx/avro-log4j"&gt;https://github.com/harisgx/avro-log4j&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;Add the libraries to your project and add new properties to log4j.properties&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp;log4j.appender.logger_name.layout=&lt;b&gt;com.avrolog.log4j.layout.AvroLogLayout&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp;log4j.appender.logger_name.layout.Type=&lt;b&gt;json&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp;log4j.appender.logger_name.layout.MDCKeys=mdcKey&lt;/i&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp;Provide the MDC keys as comma seperated values &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;This is the schema&lt;br /&gt;
&lt;script src="https://gist.github.com/998835.js"&gt;
 
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-5952776264752145965?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/kIqKMeI9l6Y/using-avro-to-serialize-logs-in-log4j.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-OjpqApa4dIc/TeORhvKaErI/AAAAAAAAAS4/_yk9rjObStM/s72-c/logos.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2011/05/using-avro-to-serialize-logs-in-log4j.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-7995675645290100262</guid><pubDate>Sun, 22 May 2011 19:28:00 +0000</pubDate><atom:updated>2011-07-14T20:42:11.579+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algorithms</category><category domain="http://www.blogger.com/atom/ns#">bloomfilter</category><category domain="http://www.blogger.com/atom/ns#">distributed systems</category><category domain="http://www.blogger.com/atom/ns#">hbase</category><category domain="http://www.blogger.com/atom/ns#">hadoop</category><title>Bloom Filters</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-cijE63FddDI/TdliipCpKaI/AAAAAAAAASw/ILGJVAAEgaQ/s1600/gbf.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;A Bloom filter is a probabilistic data-structure. This can be used to store a set of data in a space-efficient manner. For eg; a distributed cache called &lt;i&gt;Cache Digests&lt;/i&gt; shared as summaries between the nodes to have a global image.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The data-structure can be used to provide membership queries ie. &lt;i&gt;checkIfDataPresentInStore()&lt;/i&gt; If it is to check an element is already inserted in the filter then it will return true, there are no false negatives. But there can be chance if the element not inserted may return true. But the check for that element can be done in the original store ie. the overhead is associated with the rate of false positives. This is different from dictionary in which the hit/miss is deterministic.&lt;br /&gt;
&lt;br /&gt;
For a set of n elements, a bloom filter can be a vector of size m.Initially, all bits are set to 0. For each element e, k hash functions will set k bits in the bit vector to 1. When a query for membership executed, it will check for the bit positions for the set value. If matches all, the queried element is possibly present in the store else, it is sure not present.Each hash function returns the index to set. This means we have to store these m bits per key. So a total of m * N bits of space required. The use of different hash functions results less collision.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-IVHVNfGWL4Y/TdljngoqoOI/AAAAAAAAAS0/SVCTXnYRDrc/s1600/gbf.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="213" src="http://2.bp.blogspot.com/-IVHVNfGWL4Y/TdljngoqoOI/AAAAAAAAAS0/SVCTXnYRDrc/s320/gbf.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Uses&lt;/b&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;Design a &lt;a href="http://ipowerinfinity.wordpress.com/2008/03/02/bloom-filters-designing-a-spellchecker/"&gt;spell checker&lt;/a&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Database join implementation (&lt;a href="http://www.dba-oracle.com/t_bloom_filter_hashing.htm"&gt;Oracle&lt;/a&gt;) &amp;nbsp;&lt;/li&gt;
&lt;li&gt;Peer to peer (P2P) &lt;a href="http://www-math.mit.edu/~steng/18.996/MIT_Talk.ppt"&gt;communication and routing &lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;In &lt;a href="http://hbase.apache.org/"&gt;HBase&lt;/a&gt;, the Bloom filter is stored as meta block in the &lt;a href="http://hbase.apache.org/docs/r0.20.4/api/org/apache/hadoop/hbase/io/hfile/HFile.html"&gt;HFile&lt;/a&gt;. When a HFile is opened, the bloom filter is loaded into memory and used to determine if a given key is in that store file. This can avoid the scanning region for the key.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;and &lt;a href="http://cs.unc.edu/~fabian/courses/CS600.624/slides/bloomslides.pdf"&gt;more &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
I found a java implementation &lt;a href="http://wwwse.inf.tu-dresden.de/xsiena/bloom_filter"&gt;here&lt;/a&gt;&lt;br /&gt;
Cassandra's java implementation &lt;a href="https://github.com/jbellis/cassandra-dev/tree/e284df7536ef32869b87d903a5f92f6a96c84801/src/com/facebook/infrastructure/utils"&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Reference&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/Bloom_filter"&gt;http://en.wikipedia.org/wiki/Bloom_filter&lt;/a&gt;&lt;br /&gt;
&lt;a href="https://issues.apache.org/jira/browse/HBASE-1200"&gt;https://issues.apache.org/jira/browse/HBASE-1200&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://wiki.squid-cache.org/SquidFaq/CacheDigests"&gt;http://wiki.squid-cache.org/SquidFaq/CacheDigests&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://gsd.di.uminho.pt/members/cbm/ps/dbloom.pdf"&gt;http://gsd.di.uminho.pt/members/cbm/ps/dbloom.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-7995675645290100262?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/0Jm-D7xLe4M/til-bloom-filters.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-IVHVNfGWL4Y/TdljngoqoOI/AAAAAAAAAS0/SVCTXnYRDrc/s72-c/gbf.gif" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2011/05/til-bloom-filters.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-7594619397377834317</guid><pubDate>Mon, 09 May 2011 18:23:00 +0000</pubDate><atom:updated>2011-08-19T14:47:05.570+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">comet</category><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">github</category><category domain="http://www.blogger.com/atom/ns#">twitter</category><category domain="http://www.blogger.com/atom/ns#">groovy</category><category domain="http://www.blogger.com/atom/ns#">codes</category><category domain="http://www.blogger.com/atom/ns#">experiments</category><title>Labs</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="line-height: 16px;"&gt;&lt;a href="https://github.com/harisgx/avro-log4j"&gt;avro-log4j &lt;/a&gt;&amp;nbsp; -&amp;nbsp; &lt;/span&gt;serialization mechanism to provide a layout for log4j&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 16px;"&gt;&lt;a href="http://code.google.com/p/firetester/"&gt;&lt;span style="background-color: white;"&gt;firetester&lt;/span&gt;&amp;nbsp;&lt;/a&gt;&amp;nbsp; - &amp;nbsp;A simple RESTful services testing tool written in&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Groovy_%28programming_language%29"&gt;Groovy&lt;/a&gt;&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Griffon_%28framework%29"&gt;Griffon&lt;/a&gt;&amp;nbsp;framework&lt;/span&gt;&lt;br /&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit; line-height: 16px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;a href="https://github.com/harisgx/gitter"&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;gitter&lt;/span&gt;&amp;nbsp;&lt;/a&gt;-&amp;nbsp;Publishes github activities to Twitter&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;a href="https://github.com/harisgx/jfilemagic" style="background-color: white;"&gt;jfilemagic&lt;/a&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;(jfm) is an utility for identifying files using&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Magic_number_%28programming%29"&gt;magic numbers&lt;/a&gt;&amp;nbsp;or signatures&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;a href="http://bytescrolls-samples.googlecode.com/files/comet_sample.war" style="background-color: white;"&gt;cometd-chat&lt;/a&gt;&amp;nbsp;- a&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Comet_%28programming%29"&gt;comet&lt;/a&gt;&amp;nbsp;based chatter for fun&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-7594619397377834317?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/xMzeIyS1-ys/labs.html</link><author>noreply@blogger.com (Haris)</author><feedburner:origLink>http://bytescrolls.blogspot.com/2011/05/labs.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-2362892539164626091</guid><pubDate>Wed, 13 Apr 2011 17:54:00 +0000</pubDate><atom:updated>2011-04-13T23:54:50.450+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">JVM</category><title>Interesting uses of sun.misc.Unsafe</title><description>Inspired from the &lt;a href="http://stackoverflow.com/questions/5574241/interesting-uses-of-sun-misc-unsafe"&gt;question&lt;/a&gt; that found in stackoverflow, I started looking up for the uses. I found some pretty interesting ones...&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;VM "intrinsification." ie CAS (Compare-And-Swap) used in &lt;a href="http://www.azulsystems.com/events/javaone_2007/2007_LockFreeHash.pdf"&gt;Lock-Free Hash Table&lt;/a&gt;s eg:&lt;a href="http://www.j7a.ru/classsun_1_1misc_1_1_unsafe.html#a9463edc21c5fb733b7f43bb02697fd8a"&gt;sun.misc.Unsafe.compareAndSwapInt&lt;/a&gt; it can make real &lt;a href="http://en.wikipedia.org/wiki/Java_Native_Interface"&gt;JNI&lt;/a&gt; calls into native code that contains special instructions for CAS&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;What is intrinsification?&lt;/div&gt;&lt;div&gt;They are optimization done like compiler generating code directly for called method or JVM native optimizations. We know that there are VM downcalls from JDK like wait method etc. Its about low level programming. For eg:- the &lt;a href="http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/atomic/package-summary.html"&gt;Atomic&lt;/a&gt; classes for numbers, they are pure numbers represented by objects but atomically modified in which the operations are managed natively.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;read more about CAS here &lt;a href="http://en.wikipedia.org/wiki/Compare-and-swap"&gt;http://en.wikipedia.org/wiki/Compare-and-swap&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The &lt;a href="http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/dl/sun/misc/Unsafe.java?view=markup"&gt;sun.misc.Unsafe&lt;/a&gt; functionality of the host VM can be used to allocate uninitialized objects and then interpret the constructor invocation as any other method call.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One can track the data from the native address.It is possible to retrieve an object’s memory address using the sun.misc.Unsafe class, and operate on its fields directly via unsafe get/put methods!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Compile time optimizations for JVM. HIgh performance VM using "magic", requiring low-level operations. eg: &lt;a href="http://en.wikipedia.org/wiki/Jikes_RVM"&gt;http://en.wikipedia.org/wiki/Jikes_RVM&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Allocating memory, &lt;a href="http://www.j7a.ru/classsun_1_1misc_1_1_unsafe.html#a9463edc21c5fb733b7f43bb02697fd8a"&gt;sun.misc.Unsafe.allocateMemory&lt;/a&gt; eg:- DirectByteBuffer constructor internally calls it when &lt;a href="http://download.oracle.com/javase/1.5.0/docs/api/java/nio/ByteBuffer.html"&gt;ByteBuffer.allocateDirect&lt;/a&gt; is invoked&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Tracing the call stack and replaying with values instantiated by sun.misc.Unsafe, useful for instrumentation&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.j7a.ru/classsun_1_1misc_1_1_unsafe.html#a779b0fead7abb6b98b17f1dfa3f77352"&gt;sun.misc.Unsafe.arrayBaseOffset&lt;/a&gt; and &lt;a href="http://www.j7a.ru/classsun_1_1misc_1_1_unsafe.html#ac1d7700aabc2e524a8e5286ed8605e25"&gt;arrayIndexScale&lt;/a&gt; can be used to develop &lt;a href="http://domino.watson.ibm.com/comm/research.nsf/pages/r.plansoft.innovation.html"&gt;arraylets&lt;/a&gt;, a technique for efficiently breaking up large arrays into smaller objects to limit the real-time cost of scan, update or move operations on large objects&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;References&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://domino.watson.ibm.com/comm/research_people.nsf/pages/bacon.refereed-pubs.html/$FILE/Auerbach07DesignTR.pdf"&gt;Design and implementation of a comprehensive real time java virtual machine&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;a href="http://cs.anu.edu.au/~Robin.Garner/vee25-frampton.pdf"&gt;Demystifying Magic: High-level Low-level Programming&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://codespeak.net/svn/user/cfbolz/jitpl/doc/gal_papers/BebenitaGalFranz_JavainJava.pdf"&gt;Implementing Fast JVM Interpreters Using Java Itself&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://plrg.kaist.ac.kr/_media/activities/labseminars/taintdroid.pdf"&gt;TaintDroid: An Information-Flow Tracking System for Realtime Privacy Monitoring on Smartphones&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.cse.ohio-state.edu/~rountev/presto/pubs/fse07.pdf"&gt;Efficient Checkpointing of Java Software Using Context-Sensitive Capture and Replay&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://robaustin.wikidot.com/how-to-write-to-direct-memory-locations-in-java"&gt;How To Write Directly to a Memory Locations In Java&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-2362892539164626091?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/9n7ijKvr_Fo/interesting-uses-of-sunmiscunsafe.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2011/04/interesting-uses-of-sunmiscunsafe.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-3771293512454907449</guid><pubDate>Tue, 12 Apr 2011 17:00:00 +0000</pubDate><atom:updated>2011-04-23T01:36:24.205+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ilm</category><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">standards</category><category domain="http://www.blogger.com/atom/ns#">distributed systems</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">information</category><category domain="http://www.blogger.com/atom/ns#">architecture</category><category domain="http://www.blogger.com/atom/ns#">storage</category><category domain="http://www.blogger.com/atom/ns#">data access</category><title>Accessing data from storage system using XAM API</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-UlCeM7FLGIM/TaSJf08tn_I/AAAAAAAAASA/qk4f09D9210/s1600/xam-pic1.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;If you are familiar with &lt;a href="http://en.wikipedia.org/wiki/POSIX"&gt;POSIX&lt;/a&gt; which is a collection of standards which enables portability of applications across OS platforms. It provide a standardized API for an OS, eg:- functions like 'open' to open a file, 'fdopen'&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; to &lt;/span&gt;open stream for a file descriptor, fork to create a process etc. It defines &lt;i&gt;file descriptor&lt;/i&gt; as a per-process, unique, nonnegative integer used to identify an open file for the purpose of file access. The &lt;a href="http://kaharris.org/teaching/51081/index.html"&gt;Unix systems programming API&lt;/a&gt;&amp;nbsp;is standardized by a large number of POSIX standards. Most operating system APIs share common functionalities like listing directories, renaming file etc.&lt;br /&gt;
&lt;br /&gt;
XAM stands for "eXtensible Access Method". The &lt;a href="http://www.snia.org/forums/xam/technology/specs/"&gt;XAM API&lt;/a&gt; will allow application developers to store content on a class of storage systems known as “&lt;a href="http://en.wikipedia.org/wiki/Content-addressable_storage"&gt;fixed-content” storage systems&lt;/a&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The data centers have evolved into a complex ecosystem of &lt;a href="http://en.wikipedia.org/wiki/Storage_area_network"&gt;SANs&lt;/a&gt;, fiber channels, &lt;a href="http://en.wikipedia.org/wiki/ISCSI"&gt;iSCSI&lt;/a&gt;, caching technologies etc. Certain storage systems are efficiently designed to store the documents that donot change, &amp;nbsp;which is useful for preservation or archival. Digital imaging storage systems which us used to archive XRAY &lt;a href="http://en.wikipedia.org/wiki/DICOM"&gt;DICOM&lt;/a&gt;&amp;nbsp;images, ie. documents that are not edited and to be kept for a long time need can use fixed storage. The applications accessing these solutions need to be written using only those vendor-specific interfaces. What if one changes their infrastructure? The application has to be rewritten. This scenario is an analogy to the need for JDBC/ODBC driver specifications as a standard API to interact with different vendors. XAM API specified by SNIA is the storage industry's proposed solution to the multi-vendor interoperability problem.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Consider &lt;a href="http://www.emc.com/products/family/emc-centera-family.htm"&gt;EMC Centera&lt;/a&gt;, the data written to it is fixed in nature. Most common systems uses a file location (address) based approach to store and retrieve content. Centera has a flat address scheme called &lt;i&gt;content address&lt;/i&gt;. When the &lt;a href="http://en.wikipedia.org/wiki/BLOB"&gt;BLOB&lt;/a&gt; object is stored, it is given &lt;i&gt;"claim" check&lt;/i&gt; derived from its content which is a hash value (128-bit) known as Content Address (CA). The application needn't know the physical location of the data stored. The associated metadata like filename etc is added into an XML called &lt;a href="http://developer.emc.com/developer/obt/CenteraSDK.htm"&gt;C-Clip Descriptor File&lt;/a&gt; (CDF) with the file's content address. This makes the system capable of&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Write_Once_Read_Many"&gt;WORM&lt;/a&gt;.&amp;nbsp;When one tries to modify/update a file, the new file will be kept&amp;nbsp;separately, enabling versioning and unique access through its fingerprint checksum. Also, there is an essential attribute for &lt;i&gt;retention&lt;/i&gt; that tracks the expiry of the file. The file can't be deleted until time surpasses the defined value.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
This is a basic vendor specific architecture. They provides the SDK/API to acces the data. So the industry came up with standard in which XAM API provides the capability to access these systems independently.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;XAM has concepts like SYSTEMS, XSETS, properties and streams ("blobs"), and XUIDs.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;SYSTEM/XSYSTEM - is the repository&lt;/div&gt;&lt;div&gt;XSET - the content&lt;/div&gt;&lt;div&gt;XUID - identifier for the XSET&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;All these elements include metadata as key value pairs. There are &lt;i&gt;participating &lt;/i&gt;and &lt;i&gt;non-participating&lt;/i&gt; fields. &lt;i&gt;Participating &lt;/i&gt;fields contribute to the naming of the XSET known as XUID. If XSET is retrieved from a SYSTEM and a participating field is modified, it will receive a different XUID. XUID created must be formed by using the content of the property or stream (e.g. run an MD5 hash over the value).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;So a vendor specific library implements the XAM Application Programming Interface (API) which is known as XAMLibrary connecting to the &lt;i&gt;Vendor Interface Module&lt;/i&gt; (VIM),  which internally communicates to the storage system. Usually, VIMs are the native interfaces. Once the application load XAMLibrary and connect to the source, it needs to open the XSET by providing the XUID which will open up the content as a stream, called XStream. The XStream object is used to read the transported data which can be a query result or a file.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; color: #0000ee;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5594747816983240690" src="http://3.bp.blogspot.com/-UlCeM7FLGIM/TaSJf08tn_I/AAAAAAAAASA/qk4f09D9210/s320/xam-pic1.png" style="cursor: pointer; display: block; height: 320px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: center; width: 297px;" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; color: #0000ee;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;A sample code to read the data,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;// connect&lt;/div&gt;&lt;div&gt;String xri = “snia-xam://&lt;uri&gt;"&lt;/uri&gt;&lt;/div&gt;&lt;div&gt;XSystem sys = s_xam.connect(xri);&lt;/div&gt;&lt;div&gt;//open the XSet&lt;/div&gt;&lt;div&gt;XSet xset = sys.openXSet( xuid, XSet.MODE_READ_ONLY);&lt;/div&gt;&lt;div&gt;//getting metdata value for the key&lt;/div&gt;&lt;div&gt;String value = xset.getString( “com.example.key” );&lt;/div&gt;&lt;div&gt;XStream stream = xset.openStream( “com.example.data”, &lt;/div&gt;&lt;div&gt;XStream.MODE_READ_ONLY);&lt;/div&gt;&lt;div&gt;stream.close();&lt;/div&gt;&lt;div&gt;xset.close();&lt;/div&gt;&lt;div&gt;sys.close()&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;XAM fields have type information described using MIME types.&lt;br /&gt;
eg:-&lt;i&gt;“application/vnd.snia.xam.xuid"&lt;/i&gt; for the an 80-element byte array, &lt;i&gt;xam_xuid&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
The XAM URI (XRI) is the XAM resource identifier specification associated to a vendor identifying the storage.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;As XAM generates a globally unique name (address), the objects may move around freely in time, changing their physical or technological location so as to enable a transparent &lt;a href="http://en.wikipedia.org/wiki/Information_lifecycle_management"&gt;information lifecycle management&lt;/a&gt; (ILM). So the metadata information and &lt;a href="http://en.wikipedia.org/wiki/Data_retention"&gt;retention&lt;/a&gt; can be externalized ie, even if the application is gone ie. retired, the information management can be handled through an API. This makes the data center more adaptive to organizational information management.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;And, unlike the file systems, XAM tags the information with metadata and provides a technology independent namespace, allowing software to interpret the content independent of the application.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;Architecture specification&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.snia.org/tech_activities/standards/curr_standards/xam/XAM_Arch_v1.01.pdf"&gt;http://www.snia.org/tech_activities/standards/curr_standards/xam/XAM_Arch_v1.01.pdf&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-3771293512454907449?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/77H0oGitkmI/accessing-data-from-storage-system.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-UlCeM7FLGIM/TaSJf08tn_I/AAAAAAAAASA/qk4f09D9210/s72-c/xam-pic1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2011/04/accessing-data-from-storage-system.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-2765296259455523503</guid><pubDate>Sun, 10 Apr 2011 18:41:00 +0000</pubDate><atom:updated>2011-04-11T01:01:15.616+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">eii</category><category domain="http://www.blogger.com/atom/ns#">information</category><category domain="http://www.blogger.com/atom/ns#">data integration</category><category domain="http://www.blogger.com/atom/ns#">data access</category><title>Enterprise Information Integration</title><description>&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"&gt;&lt;a href="http://1.bp.blogspot.com/-sOHerX8RPDM/TaIB_XCLw0I/AAAAAAAAAR4/3_dl4fZOOd0/s1600/EII.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;/a&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:20px"&gt;&lt;span class="Apple-style-span"&gt;&lt;span style="color: black; "&gt;The relational model given by &lt;a href="http://en.wikipedia.org/wiki/Edgar_F._Codd"&gt;Codd&lt;/a&gt; enable a simple logical model, in mathematical foundation based on set-oriented queries. The relational database evolved in decades. The use cases for accessing information changed. Data marts, reporting, dashboards, security, governance and so on… &lt;a href="http://en.wikipedia.org/wiki/Relational_database_management_system"&gt;RDBMS&lt;/a&gt; provided an efficient transaction semantics and support. But, world has changed, global economics became complex and data semantics became unmanageable. The corporations grown bigger, swallowing the tiny prawns around the globe. Many database vendors like Oracle, DB2, SQL Server. Many packaged apps SAP, Siebel, homegrown. Structured, unstructured, semi-structured and so many exotic data sources… Federated databases provided a centralized schema mapping logically the schemas from different databases. It faced challenges of schema integration, query translations etc. Virtual Databases, some called &lt;a href="http://docs.openlinksw.com/virtuoso/thevdb.html"&gt;them&lt;/a&gt;. &lt;/span&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:20px"&gt;&lt;span class="Apple-style-span"&gt;&lt;span style="color: black; "&gt;Use of XML as standard for data exchange became a boon for all. It provided standards &lt;/span&gt;for schema, &lt;span&gt; &lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/XML_Schema_(W3C)"&gt;XSD&lt;/a&gt;, querying, &lt;a href="http://en.wikipedia.org/wiki/XQuery"&gt;XQuery&lt;/a&gt; etc. It is not a holy-grail though. The paradigm &lt;a href="http://en.wikipedia.org/wiki/Service-oriented_architecture"&gt;SOA&lt;/a&gt;, integrate systems, applications, processes and businesses. As the enterprise information ecosystem has grown like a behemoth, multiple producers/consumers forced to share data across its domain. Proliferation of data models results data chaos.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:20px"&gt;&lt;span style="color: black; "&gt;&lt;a href="http://en.wikipedia.org/wiki/Enterprise_Information_Integration"&gt;EII&lt;/a&gt; decouples data sources from data consumers without moving data. It provides universal data access facilitating dynamic dashboards or reports. By decouple application logic from integration; one can easily add/change sources with customization of the content delivery. It acts like a mediation engine for the source and client. Standardized data access APIs like &lt;a href="http://en.wikipedia.org/wiki/ODBC"&gt;ODBC&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/JDBC"&gt;JDBC&lt;/a&gt; offer a specific set of commands to retrieve and modify data from a generic data source or one can use Web Services.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:20px"&gt;&lt;span class="Apple-style-span"&gt;Then there are SDOs, &lt;a href="http://en.wikipedia.org/wiki/Service_Data_Objects"&gt;SDO&lt;/a&gt; is an object-based programming specification for uniform access to various forms of data. It is designed to complement existing &lt;a href="http://en.wikipedia.org/wiki/J2EE"&gt;J2EE&lt;/a&gt; data access mechanisms, including &lt;a href="http://en.wikipedia.org/wiki/EJB"&gt;EJB&lt;/a&gt;s, JDBC, and a number of popular frameworks for persistence. It is also intended to support service-oriented architectures (SOA), including Web services. SDO programmers work with data graphs (collections of tree-structured data) that consist of one or more data objects. The data graph structure is well suited to certain types of Web applications, such as those that display master-detail information and is easily understood by most object-oriented application programmers. It is based on &lt;a href="http://en.wikipedia.org/wiki/Model_Driven_Architecture"&gt;Model Driven Architecture&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:20px"&gt;&lt;span class="Apple-style-span"&gt;&lt;span style="color: black; "&gt; A&lt;/span&gt;n EII system provides a single interface and extensible metadata that can encompass all data sources, speeding the development of applications such as enterprise portals. Development is faster as programmer’s code for access to a single virtual data source regardless of data storage. It is like a metadata-based view of sources. Virtual views optimize execution of distributed queries. So modeled with metadata, makes many data sources look like one single entity. Information modelers like &lt;a href="http://en.wikipedia.org/wiki/XBRL"&gt;XBRL&lt;/a&gt; could be used to publish data for reporting purposes. The EII server creates the query for each data source. It is intelligent to understand multiple data sources. The data sources are mapped to create the view i.e. data to xml binding to metadata. The metadata is stored in a repository. These reusable integrated logical entities or data objects can be exposed as a data service or as jdbc/odbc.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:20px"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://1.bp.blogspot.com/-sOHerX8RPDM/TaIB_XCLw0I/AAAAAAAAAR4/3_dl4fZOOd0/s320/EII.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5594035875174138690" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 202px; " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;One of the key issues faced in data integration projects is locating and understanding the data to be integrated. Often, one would find that the data needed for a particular integration, application is not even captured in any source in the enterprise . ie the developer has to once again model the domain from different sources. Mapping from multiple systems and schema is really a cumbersome process and a human intervention becomes essential with more headaches. As an EII system do provide writing data, the transaction management across the system to be managed and information retrieval become complex when mapping data from structured and unstructured data. EII is not a perfect solution as it needs to have the performance and scalability similar to the ones expected from RDBMS. Even when it matures and succeeds, EII will not replace the data warehouse. Depending on the problem to be solved, integrated data will be persisted into a warehouse, or virtualized through EII.&lt;/span&gt;&lt;/div&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:normal"&gt;&lt;span style="color: black; "&gt;&lt;b&gt; Refrences&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:normal"&gt;&lt;span style="color: black; "&gt; &lt;a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0407saracco/"&gt;http://www.ibm.com/developerworks/data/library/techarticle/dm-0407saracco/&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:normal"&gt;&lt;span style="color: black; "&gt;&lt;a href="http://www.cs.washington.edu/homes/alon/files/eiisigmod05.pdf"&gt; http://www.cs.washington.edu/homes/alon/files/eiisigmod05.pdf&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:normal"&gt;&lt;a href="http://www.jboss.com/products/platforms/dataservices/"&gt;&lt;span class="Apple-style-span"&gt;http://www.jboss.com/products/platforms/dataservices/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;text-align: justify;line-height:normal"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-2765296259455523503?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/-GPlRpKRc44/enterprise-information-integration.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-sOHerX8RPDM/TaIB_XCLw0I/AAAAAAAAAR4/3_dl4fZOOd0/s72-c/EII.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2011/04/enterprise-information-integration.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-9016818930908840087</guid><pubDate>Tue, 31 Aug 2010 16:31:00 +0000</pubDate><atom:updated>2010-08-31T22:31:08.825+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">architecture</category><category domain="http://www.blogger.com/atom/ns#">protocol buffers</category><category domain="http://www.blogger.com/atom/ns#">google</category><title>Dissecting Protocol Buffers</title><description>There are many ways to serialize data to formats like XML, JSON etc. Google's &lt;a href="http://code.google.com/p/protobuf/"&gt;ProtoBuf &lt;/a&gt;is a way of encoding structured data. It is the de facto standard at Google for any server-to-server calls.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;The choice of using the method of object serialization depends on speed,size,compatibility, metadata integrity, platform independent etc which make Protocol  Buffers a good candidate especially if it is used for Java (the code can also be generated for languages like C,Python etc).XML has been a standard as data interchange and serialization format for most of the applications. Java do have a native serialization mechanism for objects.PB is like &lt;a href="http://en.wikipedia.org/wiki/Interface_description_language"&gt;IDL &lt;/a&gt;describing the entity or data structure. PB can be considered as a high-level language describing the input and output types. Then the compiler-generated code is used to hide the details of encoding/decoding from application code.Isn't this similar to CORBA or EJB? Hoi, its from Google. They have been using this binary encoded structured data as input,output,writable formats for map reduce.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/TH0zComWkZI/AAAAAAAAAQ0/avtcSghiwFs/s1600/sketch.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 127px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/TH0zComWkZI/AAAAAAAAAQ0/avtcSghiwFs/s320/sketch.png" alt="" id="BLOGGER_PHOTO_ID_5511617639322390930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Protocol buffers are advantageous because they support multiple languages (i.e., Python, Java, C++ and others), are cross-platform, flexible, and extensible. They are forward and backward compatible. It uses descriptive message (ie entity or object) definition files (.proto files). The proto files are parsed by the compiler provided (eg:protoc.exe) to generate the java files based on the message definition.This java code will have the "builders" for creating the object.Good thing is that the message definitions can be modified without affecting the parsers derived from an older legacy version of the .proto definition.If we consider XML for persistence, it will need a metadata associated with entity.But, the protocol buffers are self descriptive and deprived of such unecessary details making it smaller in size.&lt;br /&gt;&lt;br /&gt;The entity will be defined as a message.The message can refer other messages, but need to be defined or imported.Several data types and repeated data are supported.&lt;br /&gt;The available wire types are as follows:&lt;br /&gt;&lt;table style="border: 1px solid rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;WireType&lt;/th&gt;&lt;th&gt;Meaning&lt;/th&gt;&lt;th&gt;Used For&lt;/th&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;Varint&lt;/td&gt;&lt;td&gt;int32, int64, uint32, uint64, sint32, sint64, bool, enum&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;br /&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;64-bit&lt;/td&gt;&lt;td&gt;fixed64, sfixed64, double&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;br /&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Length-delimited&lt;/td&gt;&lt;td&gt;string, bytes, embedded messages, packed repeated fields&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;br /&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;32-bit&lt;/td&gt;&lt;td&gt;fixed32, sfixed32, float&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It include the concept of optional elements: fields that aren’t currently needed are not included in the binary representation. This is similar to an XML shema for an element with minOccurs=0. XSD/DTDs provide data integrity. But I think portocol buffer can also provide data type definitions and values within itself without compromising integrity.&lt;br /&gt;&lt;br /&gt;A key is associated with each data value.For the first 15 values/members in the structure this key is stored in 1 byte; 2 bytes is required for&lt;br /&gt;each key representing the 16th through the 2047th member.&lt;br /&gt;&lt;br /&gt;Take an example.Define a proto file,&lt;br /&gt;&lt;blockquote&gt;message student{&lt;br /&gt;         optional int32 id = 1;&lt;br /&gt;         optional string  name  = 2;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Generate java file. Then save the data.&lt;br /&gt;&lt;br /&gt;   &lt;blockquote&gt;Student.student.Builder builder = Student.student.newBuilder();&lt;br /&gt;   builder.setId(100);&lt;br /&gt;   builder.setName("Hary");&lt;br /&gt;   builder.build().writeTo(output);&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;   Then view the binary file.If you have an hex editor one can see the hex dump.Use vim, it has xxd.exe. Use it to generate the binary dump.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/TH0znxpxvnI/AAAAAAAAAQ8/PADiOhwEyIU/s1600/hex_dump.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 179px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/TH0znxpxvnI/AAAAAAAAAQ8/PADiOhwEyIU/s320/hex_dump.png" alt="" id="BLOGGER_PHOTO_ID_5511618277407833714" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;   &lt;blockquote&gt;Byte 1:  The key 00001000 give info like :&lt;br /&gt;                             bits  2-5 ie. 0001 says the field number ie 1&lt;br /&gt;                             bits  6-8 ie. 000 says the wiretype is 0 ie int32 (see the  table)      &lt;br /&gt;   Byte 2:&lt;br /&gt;                           The value 01100100 is 100&lt;br /&gt;     &lt;br /&gt;   Byte 3: The key 00010010&lt;br /&gt;                                  bits  2-5 ie. 0010 says the field number ie 2&lt;br /&gt;               bits  6-8 ie. 010 says the wiretype is 2 ie string (see the  table)&lt;br /&gt;         &lt;br /&gt;   Byte 4: The 00000100 says next 4 bytes for UT-8 character string&lt;br /&gt;&lt;br /&gt;   ....&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This is how the binary is file is structured. As protocol buffers include data binding library, it makes easy for encoding/decoding. It is faster (7x) than JSON serialization.Even &lt;a href="http://code.google.com/apis/protocolbuffers/docs/reference/java/com/google/protobuf/UnknownFieldSet.html"&gt;unknown fields&lt;/a&gt; can be set to the object.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;References&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;ProtoBuf HomePage&lt;/span&gt;&lt;br /&gt;&lt;a href="http://code.google.com/apis/protocolbuffers/docs/overview.html"&gt;http://code.google.com/apis/protocolbuffers/docs/overview.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;NetBeans IDE Plugin for code generation&lt;/span&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/protobuf-netbeans-plugin/"&gt;http://code.google.com/p/protobuf-netbeans-plugin/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Performance Using Internet data in Android applications&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.ibm.com/developerworks/opensource/library/x-dataAndroid/index.html?ca=dgr-twtrAndroidPArcedth-OS"&gt;http://www.ibm.com/developerworks/opensource/library/x-dataAndroid/index.html?ca=dgr-twtrAndroidPArcedth-OS&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Google Protocol Buffers - the Good, the Bad and the Ugly&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.freshblurbs.com/google-protocol-buffers-good-bad-and-ugly"&gt;http://www.freshblurbs.com/google-protocol-buffers-good-bad-and-ugly&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;MapReduce: A Flexible Data Processing Tool&lt;/span&gt;&lt;br /&gt;&lt;a href="http://cacm.acm.org/magazines/2010/1/55744-mapreduce-a-flexible-data-processing-tool/fulltext"&gt;http://cacm.acm.org/magazines/2010/1/55744-mapreduce-a-flexible-data-processing-tool/fulltext&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Encoding&lt;/span&gt;&lt;br /&gt;http://code.google.com/apis/protocolbuffers/docs/encoding.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-9016818930908840087?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/YpFyGA5MXkw/dissecting-protocol-buffers.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_jKChESAVzhw/TH0zComWkZI/AAAAAAAAAQ0/avtcSghiwFs/s72-c/sketch.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2010/08/dissecting-protocol-buffers.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-6851123612981541028</guid><pubDate>Tue, 09 Mar 2010 03:25:00 +0000</pubDate><atom:updated>2011-04-23T00:47:38.174+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">map reduce</category><category domain="http://www.blogger.com/atom/ns#">database</category><category domain="http://www.blogger.com/atom/ns#">hadoop</category><title>Parallel Databases and Map Reduce</title><description>n 2007 Google handled &lt;a href="http://www.niallkennedy.com/blog/2008/01/google-mapreduce-stats.html"&gt;400 petabytes&lt;/a&gt; of data per month.&lt;br /&gt;&lt;br /&gt;It was Map Reduce. And the competitors were &lt;a href="http://research.microsoft.com/en-us/projects/dryad/"&gt;Dyrad &lt;/a&gt;and &lt;a href="http://hadoop.apache.org/"&gt;Hadoop &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Architects were reinventing &lt;a href="http://en.wikipedia.org/wiki/Parallel_database"&gt;parallel databases&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Data is partitioned across multiple disks. The parallel I/O enables relational operations like join executed in parallel. &lt;a href="http://www.teradata.com/t/"&gt;Teradata&lt;/a&gt;, is one of  the highly parallel database machines uses&lt;a href="http://db.cs.berkeley.edu/papers/hpts85-nothing.pdf"&gt; shared-nothing architecture&lt;/a&gt;  Google called it &lt;a href="http://www.codefutures.com/database-sharding/"&gt;sharding&lt;/a&gt;, infinitely scalable almost  simply by adding nodes.&lt;br /&gt;&lt;br /&gt;In parallel databases the horizontal partitioning is done so that the tuples of a relation are divided among many disks such that each tuple resides on one disk.&lt;br /&gt;&lt;br /&gt;The strategies can be  :&lt;br /&gt;&lt;br /&gt;a. round robin, the ith tuple inserted in the relation to disk i mod n.&lt;br /&gt;b. hashing - send to the result (ie i [1.. n-1]th disk) of hash function h applied to the partitioning attribute value of a tuple.&lt;br /&gt;c. Range partitioning - for a partitioning vector [range] say [3,9], a tuple with partitioning attribute value of 1 will go to disk 0, a tuple with value 6 will go to disk 1, while a  tuple with value 12 will go to disk2 etc.&lt;br /&gt;&lt;br /&gt;In these databases, the queries/transactions execute in parallel with one another.Relational queries by SQL is good for parallel execution.&lt;br /&gt;&lt;br /&gt;In a normal relational db, the execution plan for a query like this,&lt;br /&gt;SELECT YEAR(date) AS year, AVG(fund)&lt;br /&gt;FROM student&lt;br /&gt;GROUP BY year&lt;br /&gt;&lt;br /&gt;The execution plan is:&lt;br /&gt;projection(year,fund) -&amp;gt; hash aggregation(year,fund).&lt;br /&gt;&lt;br /&gt;In parallel dbs it will be,&lt;br /&gt;&lt;br /&gt;projection(year,fund) -&amp;gt; partial hash aggregation(year,fund)&lt;br /&gt;-&amp;gt; partitioning(year) -&amp;gt; final aggregation(year,fund).&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;blockquote&gt;Each operator produces a new relation, so the operators can be composed into highly parallel dataflow graphs. By streaming the output of one operator into the input of another operator, the two operators can work in series giving pipelined parallelism. By partitioning the input data among multiple processors and memories, an operator can often be split into many independent operators each working on a part of the data. This partitioned data and execution gives partitioned parallelism&lt;/blockquote&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_jKChESAVzhw/S5XBIXs0sYI/AAAAAAAAAQA/YhTlRMuk6v8/s1600-h/parallel_data_flow.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 110px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/S5XBIXs0sYI/AAAAAAAAAQA/YhTlRMuk6v8/s320/parallel_data_flow.JPG" alt="" id="BLOGGER_PHOTO_ID_5446471673919615362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;image source and reference:&lt;/span&gt; &lt;a href="http://eprints.kfupm.edu.sa/56817/1/56817.pdf"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Parallel databases uses the parallel data flow model makes programming easy as data is not shared.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://labs.google.com/papers/mapreduce.html"&gt;MapReduce &lt;/a&gt;can be programmed in languages like C, Java, Python and Perl and process flat files in a filesystem, ie no need to have database schema definitions.This is an advantage when documents are processed.It uses a set of input key/value pairs, and produces a set of output key/value pairs. Programmer two functions: map and reduce. Map an input pair and produces a set of intermediate key/value pairs. Then intermediate values  are grouped together based on the same intermediate key and passes them to the reduce function. The reduce function accepts the intermediate key and a set of values for that key and merges these values together to result smaller set of values, zero or one output value is produced in the process, thus helps in reducing memory and handles a lot of values making the job scalable. &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1632&amp;amp;categoryID=55"&gt;link&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://sourceforge.net/projects/hadoopdb/"&gt;HadoopDB &lt;/a&gt;is a hybrid of DBMS and MapReduce technologies that targets analytical workload designed to run on a shared-nothing cluster.It uses Hadoop to push the data to  existing databases engine to process the SQL queries.In order to push more query logic into databases (e.g. joins), hash-partitioning of data needs to be performed. The  data is loaded into &lt;a href="http://hadoop.apache.org/common/docs/current/hdfs_design.html"&gt;HDFS&lt;/a&gt;. for processing. HadoopDB's API provide the implementation of Map and Reduce functions.This makes hadoopdb to process huge analytical database with scalability using map reduce framework and performance with exisiting db engines.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;refer:&lt;a href="http://db.cs.yale.edu/hadoopdb/hadoopdb.pdf"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://hadoopdb.sourceforge.net/guide/hadoopDB-arch.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 640px; height: 554px;" src="http://hadoopdb.sourceforge.net/guide/hadoopDB-arch.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;span style="font-style: italic;"&gt;image source&lt;/span&gt; &lt;a href="http://hadoopdb.sourceforge.net/guide/quick_start_guide.html"&gt;link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-6851123612981541028?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/8Y1ztRJxHOQ/parallel-databases-and-map-reduce.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_jKChESAVzhw/S5XBIXs0sYI/AAAAAAAAAQA/YhTlRMuk6v8/s72-c/parallel_data_flow.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2010/03/parallel-databases-and-map-reduce.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-4119450948769456164</guid><pubDate>Thu, 10 Dec 2009 21:20:00 +0000</pubDate><atom:updated>2011-04-23T00:49:22.102+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">spring</category><title>How Stuff Works: Spring Component Scanning</title><description>Spring has an interesting feature of scanning its components defined and load it.So the configuration is tied to application ie the code, using annotations.Spring javaconfig also provides the capability to do convention over configuration.There are a lot of documents,references etc explaining how to do the spring configuration. I was looking into the under the hood flow of how the stuff works...&lt;br /&gt;&lt;br /&gt;A minimal config to application context xml&lt;br /&gt;&lt;br /&gt;&amp;lt;context:component-scan base-package="packageName"/&amp;gt;&lt;br /&gt;&lt;br /&gt;will scan all the component classes in the package.The  component classes in the classpath are detected and bean definitions are auto-registered  for them.&lt;br /&gt;&lt;br /&gt;As per the &lt;a href="http://www.springframework.org/schema/context%20"&gt;Schema URI&lt;/a&gt; and &lt;a href="http://www.blogger.com/www.springframework.org/schema/context/spring-context-2.5.xsd"&gt;Schema XSD&lt;/a&gt;, the context namespace will be like this - &lt;a href="http://knol.google.com/k/j2ee-approaching-to-mvc-spring#"&gt;Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There are stereotype annotations which are markers for any class that fulfills a role within an application.This is well showcased in SpringMVC.More about the &lt;a href="http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/stereotype/package-tree.html"&gt;annotations &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For efficient configuration, we can have multiple context xmls  for maintaining resources. The application can have one for DAOs, one for services and so on.The layers can be effectively scanned by the context loader with this usage. So MVC applications will have seperate xmls for @Repository (data access tier),@Service (service),@Controller (web tier) components.&lt;br /&gt;So for the example in a simple java app, I used them in a single xml. But this is mot an mvc app.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;A UserDAO Interface&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;package com.sample.data;&lt;br /&gt;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;public interface UserDAO {&lt;br /&gt;&lt;br /&gt;List&amp;lt;String&amp;gt; getUsers();&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Its Implementation&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;package com.sample.data;&lt;br /&gt;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;import org.springframework.stereotype.Repository;&lt;br /&gt;&lt;br /&gt;@Repository("userDAO")&lt;br /&gt;public class UserDAOImpl implements UserDAO {&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public List&amp;lt;String&amp;gt; getUsers() {&lt;br /&gt;&lt;br /&gt; List&amp;lt;String&amp;gt; l = new ArrayList&amp;lt;String&amp;gt;();&lt;br /&gt; l.add("Roger Moore");&lt;br /&gt; l.add("Pierce Brosnan");&lt;br /&gt;&lt;br /&gt; return l;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Service Layer&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;package com.sample.service;&lt;br /&gt;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;public interface UserService {&lt;br /&gt;List&amp;lt;String&amp;gt; getUsers();&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;And its implementation&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;package com.sample.service;&lt;br /&gt;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;import org.springframework.beans.factory.annotation.Autowired;&lt;br /&gt;import org.springframework.stereotype.Service;&lt;br /&gt;&lt;br /&gt;import com.sample.data.UserDAO;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@Service("userService")&lt;br /&gt;public class UserServiceImpl implements UserService{&lt;br /&gt;&lt;br /&gt;@Autowired&lt;br /&gt;private UserDAO userDAO;&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public List&amp;lt;String&amp;gt; getUsers() {&lt;br /&gt;&lt;br /&gt; return userDAO.getUsers();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;the client&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;package com.sample.client;&lt;br /&gt;&lt;br /&gt;import org.springframework.context.ApplicationContext;&lt;br /&gt;import org.springframework.context.support.ClassPathXmlApplicationContext;&lt;br /&gt;&lt;br /&gt;import com.sample.service.UserService;&lt;br /&gt;&lt;br /&gt;public class SpringClient {&lt;br /&gt;&lt;br /&gt;private UserService service;&lt;br /&gt;&lt;br /&gt;public SpringClient(){&lt;br /&gt; ApplicationContext appContext = new ClassPathXmlApplicationContext("resource/applicationContext.xml");&lt;br /&gt; service= (UserService) appContext.getBean("userService");&lt;br /&gt; ((ClassPathXmlApplicationContext)appContext).close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public void showUsers() {&lt;br /&gt; for (String s : service.getUsers()) {&lt;br /&gt;  System.out.println(s);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt; SpringClient spc = new SpringClient();&lt;br /&gt; spc.showUsers();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;applicationContext&lt;/u&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;beans xmlns="http://www.springframework.org/schema/beans"&lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;xmlns:context="http://www.springframework.org/schema/context"&lt;br /&gt;xmlns:aop="http://www.springframework.org/schema/aop"&lt;br /&gt;xmlns:tx="http://www.springframework.org/schema/tx"&lt;br /&gt;xsi:schemaLocation="http://www.springframework.org/schema/beans&lt;br /&gt;  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd&lt;br /&gt;  http://www.springframework.org/schema/context&lt;br /&gt;  http://www.springframework.org/schema/context/spring-context-2.5.xsd&lt;br /&gt;  http://www.springframework.org/schema/aop&lt;br /&gt;  http://www.springframework.org/schema/aop/spring-aop-2.5.xsd&lt;br /&gt;  http://www.springframework.org/schema/tx&lt;br /&gt;  http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&lt;br /&gt;default-autowire="byName"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- Enable autowiring via @Autowire annotations --&amp;gt;&lt;br /&gt;&amp;lt;context:annotation-config/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;context:component-scan base-package="com.sample.data"&amp;gt;&lt;br /&gt;  &amp;lt;context:include-filter type="annotation"&lt;br /&gt;      expression="org.springframework.stereotype.Repository"/&amp;gt;&lt;br /&gt;&amp;lt;/context:component-scan&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;context:component-scan base-package="com.sample.service"&amp;gt;&lt;br /&gt;  &amp;lt;context:include-filter type="annotation"&lt;br /&gt;      expression="org.springframework.stereotype.Service"/&amp;gt;&lt;br /&gt;&amp;lt;/context:component-scan&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;After bootstrapping, the set of application components and service that need to be created are identified. &lt;a href="http://static.springsource.org/spring/docs/2.0.8/api/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.html"&gt;AbstractbeanDefinitionReader &lt;/a&gt;will read resource definitions. &lt;a href="http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/factory/support/DefaultListableBeanFactory.html"&gt;DefaultListableBeanFactory &lt;/a&gt;will be used as default bean factory based on bean definition objects. &lt;a href="http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.html"&gt;XmlBeanDefinitionReader&lt;/a&gt;.loadBeanDefinitions() load bean definitions from the specified XML file in which the &lt;a href="http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/beans/factory/xml/BeanDefinitionParser.html"&gt;BeanDefinitionParser &lt;/a&gt;will identify the context namespaces and parses the applicationContext xml. The resources are identified by the implementation of ResourcePatternResolver:, ie &lt;a href="http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html"&gt; PathMatchingResourcePatternResolver &lt;/a&gt;in which the location patterns are found like an &lt;a href="http://ant.apache.org/manual/"&gt;ant-style&lt;/a&gt;. Internally it uses ClassLoader.getResources(String name) method which returns an Enumeration containing URLs representing classpath resources. Then the &lt;a href="http://static.springsource.org/spring/docs/3.0.0.RC2/javadoc-api/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.html"&gt;ComponentScanBeanDefinitionParser &lt;/a&gt;will parse through the context defintion nodes. If annotation configuration is enabled, autowiring of components takes place as these "candidate patterns" can be  set as autowired. A default &lt;a href="http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.html"&gt;AutowiredAnnotationBeanPostProcessor &lt;/a&gt;will be registered by the "context:annotation-config" and "context:component-scan" XML tags.If filters are added, then it will parse the type filters. In the example I have provided annotation is the type filter. So it will use  &lt;a href="http://static.springsource.org/spring/docs/3.0.0.RC2/javadoc-api/org/springframework/core/type/filter/AnnotationTypeFilter.html"&gt;AnnotationTypeFilter &lt;/a&gt;to load the annotation Repository which is provided as the DAO's annotation resolver.&lt;br /&gt;&lt;br /&gt;And we know that spring classes are designed to be extended.I was going through the API docs and found that we can  add and exclude filters programmatically too.&lt;br /&gt;&lt;br /&gt;So I added showComponents to client code using a selected base package&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;public void showComponents(){&lt;br /&gt;&lt;br /&gt; ClassPathScanningCandidateComponentProvider provider =&lt;br /&gt;     new ClassPathScanningCandidateComponentProvider(true);&lt;br /&gt; String basePackage = "com/sample/data";&lt;br /&gt; provider.addExcludeFilter(new AnnotationTypeFilter(Repository.class, true));&lt;br /&gt; Set&amp;lt;BeanDefinition&amp;gt; filteredComponents = provider.findCandidateComponents(basePackage);&lt;br /&gt; System.out.println("No of components :"+filteredComponents.size());&lt;br /&gt;&lt;br /&gt; for (BeanDefinition component : filteredComponents) {&lt;br /&gt;     System.out.println("Component:"+ component.getBeanClassName());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; provider.resetFilters(true);&lt;br /&gt; provider.addIncludeFilter(new AnnotationTypeFilter(Repository.class, true));&lt;br /&gt; filteredComponents = provider.findCandidateComponents(basePackage);&lt;br /&gt; System.out.println("No of components :"+filteredComponents.size());&lt;br /&gt;&lt;br /&gt; for (BeanDefinition component : filteredComponents) {&lt;br /&gt;     System.out.println("Component:"+ component.getBeanClassName());&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;So the output will be&lt;br /&gt;&lt;br /&gt;No of components :0&lt;br /&gt;No of components :1&lt;br /&gt;Component: com.sample.data.UserDAOImpl&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If code and configuration are static like beans, the scanner annotations are useful. For accessing resources, jndi or jdbc or anything dynamic like that better go for xml as it is easy to modify it without code change.Its widely used for request mappings and controllers in Spring MVC.The xml overrides the config.When classes are more scanning will be difficult, so we have to filter them based on the type required.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;More Reading&lt;br /&gt;&lt;a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ch03s10.html"&gt;&lt;br /&gt;Classpath scanning and managed components&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-4119450948769456164?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/Kkp7wFyhcmQ/how-stuff-works-spring-component.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/12/how-stuff-works-spring-component.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-6770501138022160232</guid><pubDate>Thu, 03 Dec 2009 18:34:00 +0000</pubDate><atom:updated>2009-12-04T00:43:05.218+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">ria</category><category domain="http://www.blogger.com/atom/ns#">RCP</category><category domain="http://www.blogger.com/atom/ns#">eclipse</category><category domain="http://www.blogger.com/atom/ns#">adobe air</category><title>Model Driven Development in Adobe RIA and Eclipse RCP new thoughts</title><description>I had a chance to attend &lt;a href="http://endtoend.in/apps/forms/adobe/DevSummitNovDec09/home.html"&gt;Adobe Dev Summit 09 Hyderabad&lt;/a&gt;. Among the plethora of Adobe "hoo-hah"  products for the new age developers, a very good demo caught my attention. Model driven development in Adobe. Adobe is investing a lot in rooting themselves in the enterprise arena by their &lt;a href="http://en.wikipedia.org/wiki/Adobe_LiveCycle"&gt;Adobe Livecycle&lt;/a&gt; stack.&lt;br /&gt;&lt;br /&gt;The product has a &lt;a href="http://www.adobe.com/products/livecycle/applicationmodeling/"&gt;LiveCycle Workbench ES &lt;/a&gt;to integrate with Flex studio which is an Eclipse based development environment. RIA has find its way to enterprise as Web 2.0 has moved from a hype to a standard development use case.But for me, the attention grabber is the powerful Eclipse development environment.More than an IDE, it is a wonderful platform for developing powerful applications with its handy plug-in architecture and widgets.From simple RSS readers to &lt;a href="http://en.wikipedia.org/wiki/IBM_Rational_Software_Architect"&gt;Rational platform&lt;/a&gt;, eclipse has its magic hand.&lt;br /&gt;&lt;br /&gt;RIA for desktop is AIR.If one develops app in AIR we wont be able to use native widgets, as the runtime provides them.But we can access &lt;a href="http://livedocs.adobe.com/flex/3/html/help.html?content=WorkingWithWindows_1.html"&gt;native windows&lt;/a&gt; . Also from the AIR2 next api release it is possible to run &lt;a href="http://www.adobe.com/devnet/air/flex/quickstart/interacting_with_native_process.html"&gt;native applications from AIR&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What about RCP ? It has SWT runtime component uses native widgets..We may think most of the RCP apps will look like the dry eclipse IDE look and feel... Nope !&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/SxgI0DtJLuI/AAAAAAAAAGs/9kCC8b8meek/s1600-h/Domino.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 234px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/SxgI0DtJLuI/AAAAAAAAAGs/9kCC8b8meek/s320/Domino.JPG" alt="" id="BLOGGER_PHOTO_ID_5411084642726522594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;See the look of &lt;a href="http://symphony.lotus.com/software/lotus/symphony/home.nsf/home"&gt;Lotus Domino&lt;/a&gt; with the power of custom skinning. Lotus Software has been purchased by IBM  and has put a lot of resources to continue the development of different Lotus components (such as Domino and Notes). The UX feel of applications based on Eclipse 4 would be amazing.The upcoming e4 architecture of Eclipse is a promising space for next generation eclipse based applications.User experience guidelines for IBM Lotus rich client applications and plug-ins is &lt;a href="http://download.boulder.ibm.com/ibmdl/pub/software/dw/lotus/ueguidelines.pdf"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There has always been a rivalry between desktop and web applications. Both of these genre of applications fight to conquer the business space farmed across the computing world.Web apps want to be in desktop and desktop apps want be in we.Its a fame race. RCP has got a wide enterprise users.The choice of RIA or RCP depends on use case.GWT and Flex in web are good in data visualizations. But 2D and 3D will require the power of native processors. The RCP could make use of Java 2D.There are a lot of solutions in market. More choice more pain ! So I may write about them later.&lt;br /&gt;&lt;br /&gt;In the demo (Adobe Max)&lt;br /&gt;&lt;br /&gt;&lt;object height="256" width="425"&gt;&lt;param name="movie" value="http://images.tv.adobe.com//swf/player.swf"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="FlashVars" value="fileID=2516&amp;amp;context=162&amp;amp;embeded=true&amp;amp;environment=production"&gt;&lt;embed src="http://images.tv.adobe.com//swf/player.swf" flashvars="fileID=2516&amp;amp;context=162&amp;amp;embeded=true&amp;amp;environment=production" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="256" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rich data model can be modelled and exposed as a crud application with a rich UI&lt;br /&gt;Similar presentation was done by Sujith Reddy where the &lt;a href="http://sujitreddyg.wordpress.com/2009/12/03/slides-and-source-files-from-data-centric-development-session-at-devsummit/"&gt;presentation slides he shared&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In Eclipse the model driven development is accomplished using EMF - Eclipse Modelling Framework.It provides an API to access the models. Access models by reflection and dynamic creation are possible.As it goes with RCP,it is like an UI for domain objects.The MVC architecture is done through EMF.It can make use of &lt;a href="https://www.hibernate.org/"&gt;hibernate&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Java_Persistence_API"&gt;JPA &lt;/a&gt;or &lt;a href="http://www.eclipse.org/eclipselink/"&gt;eclipse link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As seen in the demo, Flex became the UI of the model.&lt;br /&gt;&lt;br /&gt;But there are developments going on in eclipse RCP framework. As Flex SDK is &lt;a href="http://opensource.adobe.com/"&gt;open source&lt;/a&gt; these eclipse guys wrote programs to create java for flash !&lt;br /&gt;&lt;br /&gt;&lt;a style="font-weight: bold;" href="http://www.eclipse.org/e4/resources/e4-whitepaper.php"&gt;E4&lt;/a&gt; ?&lt;br /&gt;&lt;br /&gt;e4 is the incubator for &lt;a href="http://www.eclipse.org/projects/project_summary.php?projectid=eclipse.e4"&gt;Eclipse 4.0&lt;/a&gt;, to be released 2010 built on current Eclipse and &lt;a href="http://bytescrolls.blogspot.com/2009/06/java-modularity-and-metadata.html"&gt;OSGi &lt;/a&gt;technology as a solid foundation.&lt;br /&gt;&lt;br /&gt;Use of web styling technology (CSS), allows the presentation of user interface elements to be infinitely tweaked and reconfigured without any modification of application code.&lt;br /&gt;&lt;br /&gt;This is bringing Eclipse runtime technology into the JavaScript world, and enabling&lt;br /&gt;software written in JavaScript to be executed in the Eclipse runtime.&lt;br /&gt;&lt;br /&gt;E4 comes with a framework for defining the design and structure of Standard Widget Toolkit (SWT) applications declarative.This eliminates writing of repetitive boilerplate SWT code, thus reducing development cost, improving UI consistency, and enabling customized application rendering. Plug-ins are coded in Java. A typical plug-in consists of Java code in a JAR library, some read-only files, and other resources such as images, web templates, message catalogs, native code libraries, etc&lt;br /&gt;&lt;a href="http://wiki.eclipse.org/e4/Eclipse_Application_Services"&gt;&lt;br /&gt;E4/Eclipse Application Services&lt;/a&gt; -Eclipse APIs are refactored to services which should be offered as separate, independent APIs, so that clients can make use of them without having to buy into all of them. Structuring them as individual services also makes it easier to use them from other languages / environments such as e.g. JavaScript. In service programming models the consumers receive dependencies via dependency injection. This theoretically allows application code to completely eliminate its dependency on a particular container technology, thus enabling greater reuse.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.eclipse.org/E4/UI/Modeled_UI"&gt;Modeled UI &lt;/a&gt;- The E4 user interface is model based; everything that appears in the presentation is backed by a representation in the UI Model.&lt;br /&gt;&lt;br /&gt;To that end, e4 is investigating bringing both the benefits of Eclipse to the JavaScript world (&lt;a href="http://bytescrolls.blogspot.com/2009/06/java-modularity-and-metadata.html"&gt;modularity&lt;/a&gt;, extensibility, and tooling), and JavaScript components into the Eclipse desktop environment.&lt;a href="http://bytescrolls.blogspot.com/2009/06/java-modularity-and-metadata.html"&gt;OSGi modularity&lt;/a&gt; makes integration of JavaScript Bundles easier.&lt;br /&gt;&lt;br /&gt;Use of CSS and &lt;a href="http://wiki.eclipse.org/E4/DeclarativeUI/Styling_Roundup"&gt;declarative styling&lt;/a&gt; a pluggable styling engine is used to customize the fonts, colors, and other aspects of widget presentation.&lt;br /&gt;&lt;br /&gt;SWT Browser Edition- zero install widgets like RAP in which a JavaScript library (qooxdoo) is running on the client, rendering widgets that are manipulated from Java running on the server or Java is cross-compiled to Flex (ActionScript), Dojo (JavaScript) and Silverlight (.NET) technologies which is a "GWT-like" (Google Web Toolkit) approach.&lt;br /&gt;&lt;br /&gt;This shows E4 SWT Java for Flash&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jKChESAVzhw/SxgJEKvaUhI/AAAAAAAAAG0/XTps3CwGcyQ/s1600-h/controlexample.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 171px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/SxgJEKvaUhI/AAAAAAAAAG0/XTps3CwGcyQ/s320/controlexample.png" alt="" id="BLOGGER_PHOTO_ID_5411084919492989458" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.eclipse.org/E4/SWT/Running_the_demos"&gt;More demos&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.eclipse.org/E4/Workbench_Model"&gt;Workbench&lt;/a&gt; - perspectives, toolbars, menus, parts. The e4 workbench greatly increases flexibility for application designers by providing a formal model of the elements that comprise an instance of the workbench.&lt;br /&gt;&lt;br /&gt;XML UI for SWT (XWT), is a framework for writing SWT widgets declaratively in XML. In XWT, the complete structure of an application or widget hierarchy is expressed declaratively, along with bindings of the widgets to some underlying application model or to Java-based call-backs implementing the widget behavior.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.eclipse.org/community/rcp.php"&gt;More RCP  apps&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-6770501138022160232?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/HPwXIoKBCRE/model-driven-development-in-adobe-ria.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_jKChESAVzhw/SxgI0DtJLuI/AAAAAAAAAGs/9kCC8b8meek/s72-c/Domino.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/12/model-driven-development-in-adobe-ria.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-6440902678568717588</guid><pubDate>Wed, 11 Nov 2009 20:30:00 +0000</pubDate><atom:updated>2009-11-12T02:36:58.081+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">algorithms</category><title>Some IdentityHashMap gotchas</title><description>Most of java guys are familiar with &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/IdentityHashMap.html"&gt;IdentityHashMap&lt;/a&gt;, which is mainly used when there is a need of maintaining keys based on reference equality. Lot of people, have written about a lot of collections hashing and so on.. But I thought whats so interesting about this map. Even the algorithm behind it is about 45 years old !&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Every object is having an "Identity", i.e., the internal "address" is unique for the lifetime of that object. So map will contain unique objects as the keys. Consider HashMap, HashSet, TreeMap, TreeSet, PriorityQueue  etc, they are "equality-dependent". One can override the equals() method in the object stored to keep the object as the keys in these collections.But IdentityHashMap is "equality-independent". Even if the objects residing it changes its comparability or equality, the map will stride fine. But it violates the symmetry property of the equals contract. Symmetry means that for any two references a and b, a.equals(b) must return true if and only if b.equals(a) returns true. That sets the contract for IdentityHashMap at odds with the contract for Map, the interface it implements, which specifies that equality  should be used for key comparison.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;According to the spec in bold says so... "This class is not a general-purpose Map implementation! While this class implements the Map interface, it intentionally violates Map’s general contract, which mandates the use of the equals() method when comparing objects. This class is designed for use only in the rare cases wherein reference-equality semantics are required."&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;IdenityHashMap data structure is based on open addressing, which is a method in which when a collision occurs, alternative locations are tried until an empty cell is found. All the items are stored in an array. This map uses linear probing, wherein the next position is found out sequentially.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;ie newlocation = (startingValue + stepSize) % arraySize  (here the stepsize be 1)&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This is basically storing all keys in a single array. The occupied addresses will form clusters (primary clusters). These clusters are distributed and the keys in them are localized to some are. So the collision will occur when the hash function returns the index of insertion wherein the keys are occupied, consuming time for insertion. Basically this is a form  file/memory management.We can say that map behaves like of addressing of arrays. It puts the keys and values alternating in a single array (supposedly good for large data sets) and doesn't need to create or reuse entry objects. Even when the map size be large as it grows the insertions are not affected, while other map implementations(which uses chaining) gets slower. However, lookup is much cheaper than insertion, as we be looking items up much more often than you insert them.  Using probing is somewhat faster than following a linked list, when a reference to the value can be placed directly in the array,For other hash-based collections, this is not the case because they store the hash code. This will be efficient when a get operation must check whether it has found the right key by reference (equality is an expensive operation, as it checks for the right hash code). So this takes less memory and its faster.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I read that linear probing was first analyzed by &lt;a href="http://www-cs-faculty.stanford.edu/%7Euno/"&gt;Knuth &lt;/a&gt;in a 1963 (at the age of 24 !) memorandum now considered to be the birth of the area of analysis of algorithms. Knuth’s analysis, as well as most of the work that has since gone into understanding the properties of linear probing, is based on the assumption that hash function is a truly random function, mapping all keys independently.&lt;br /&gt;&lt;br /&gt;The keys are stored in an array Tab. The hash function h will be mapping keys.When a key x is inserted, index = h(x). If Tab[index] is occupied, then we scan sequentially until x is found. If an empty slot found, x is inserted. The next insertion location will be nearest next empty slot from h(x).In IdentityHasMap h(x) is basically System.identityHashCode (as per source some more calculations are done). As this algorithm uses modulo arithmetic it goes around until the size is filled up. So in the implementation MAXIMUM_SIZE is doubled up untill allowed space for object is filled in the permspace.&lt;br /&gt;&lt;br /&gt;According to Knuth, it is possible to estimate the average number of probes for a successful search, where l is the load factor as 1/2(1+ 1/(1-l))&lt;br /&gt;&lt;br /&gt;The put(k,v) method looks for the position for insertion. As the he index is found out based on calculations involve System.identityHashCode(returning 32-bit integer value), identity hash codes are well distributed, almost like random numbers. Using System.identityHashCode means that for objects that have overridden hashCode and equals, even if two objects are equal() they will be put in a different hash buckets ie it treats them as two distinct objects.&lt;br /&gt;&lt;br /&gt;Some popular anomalies:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;IdentityHashMap&amp;lt;long,&amp;gt; orderMap1 = new IdentityHashMap&amp;lt;Long,Order&amp;gt;();&lt;br /&gt;orderMap1.put(1L,null);&lt;br /&gt;orderMap1.put(1L,null);&lt;br /&gt;&lt;br /&gt;System.out.println(orderMap1.keySet().size());&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Prints 1. As the 1L will be autoboxed in Java 1.5. But as the values less than 127 could be pointing to same object there will be a single reference. When use 1000L for the keys, the size will be 2 as it creates distinct objects. Long has a private class for caching these values in consideration to performance as those values are commonly used. This is applicable to Integer,Character etc.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;private static class LongCache {&lt;br /&gt;private LongCache(){}&lt;br /&gt;&lt;br /&gt;static final Long cache[] = new Long[-(-128) + 127 + 1];&lt;br /&gt;&lt;br /&gt;static {&lt;br /&gt;   for(int i = 0; i &amp;lt; cache.length; i++)&lt;br /&gt;cache[i] = new Long(i - 128);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Take another example&lt;br /&gt;&lt;code&gt;&lt;br /&gt;IdentityHashMap&amp;lt;String,OrderI&amp;gt; orderMap6 = new IdentityHashMap&amp;lt;String,OrderI&amp;gt;();&lt;br /&gt;OrderI oI2 = new OrderI(1); &lt;br /&gt;OrderI oI3 = new OrderI(2);&lt;br /&gt;&lt;br /&gt;orderMap6.put("order1",oI3);&lt;br /&gt;orderMap6.put("order1",oI2);&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here the key size will be one. As the string literals are referred from the String heap itself they point to same location.So the second insertion overrides the previous value.&lt;br /&gt;&lt;br /&gt;Where can this map be used.Some says , for caches, as they perform very well. Only need to store references though. For cyclic graphs, we must use identity rather than equality to check whether nodes are the same. Calculating equality between two graph node objects requires calculating the equality of their fields, which in turn means computing all their successors and we are back to the original problem. A IdentityHashMap,  by contrast, will report a node as being present only if that same node has previously been put into the map. Thus by saving the size and node traversals.&lt;br /&gt;&lt;br /&gt;I just wanted to know about this map thats it...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;References&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ece.uwaterloo.ca/%7Eece250/Lectures/Slides/6.07.LinearProbing.ppt"&gt;http://www.ece.uwaterloo.ca/~ece250/Lectures/Slides/6.07.LinearProbing.ppt&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.owasp.org/index.php/Java_gotchas#Immutable_Objects_.2F_Wrapper_Class_Caching"&gt;http://www.owasp.org/index.php/Java_gotchas#Immutable_Objects_.2F_Wrapper_Class_Caching&lt;br /&gt;&lt;/a&gt;&lt;a href="http://www.siam.org/proceedings/soda/2009/SODA09_072_thorupm.pdf"&gt;http://www.siam.org/proceedings/soda/2009/SODA09_072_thorupm.pdf&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cs.unm.edu/%7Emoret/graz01.pdf"&gt;http://www.cs.unm.edu/~moret/graz01.pdf&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.it-c.dk/people/pagh/papers/linear-jour.pdf"&gt;http://www.it-c.dk/people/pagh/papers/linear-jour.pdf&lt;/a&gt;&lt;br /&gt;&lt;a href="http://reference.kfupm.edu.sa/content/l/i/linear_probing_and_graphs_122432.pdf"&gt;http://reference.kfupm.edu.sa/content/l/i/linear_probing_and_graphs_122432.pdf&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-6440902678568717588?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/ZyBCdksuRqo/some-identityhashmap-gotchas.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/11/some-identityhashmap-gotchas.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-3732388420844563645</guid><pubDate>Tue, 03 Nov 2009 21:05:00 +0000</pubDate><atom:updated>2009-11-04T02:43:44.073+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">REST</category><category domain="http://www.blogger.com/atom/ns#">spring</category><category domain="http://www.blogger.com/atom/ns#">cloud computing</category><category domain="http://www.blogger.com/atom/ns#">web</category><title>ETags - Roles in Web Application to Cloud Computing</title><description>A web server returns a value in the response header known as ETag (entity tag) helps the client to know if there is any change in content at a given URL which requested.When a page is loaded in the browser, it is cached.It knows the ETag of that page.The browser uses the value of ETag as the value of the header key "If-None-Match".The server reads this http header value and compares with the ETag of the page.If the value are same ie the content is not changed, a status&lt;br /&gt;code 304 is returned ie. 304:Not Modified. These HTTP meta data can be very well used for predicting the page downloads thereby optimizing the bandwidth used.But a combination of a checksum (MD5) of the data as the ETag value and a correct time-stamp of modification could possible give quality result in predicting the re-download. An analysis of the effectiveness of chosing the value of ETag is described in this &lt;a href="http://iwaw.europarchive.org/04/Clausen.pdf"&gt;paper&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;According to &lt;a href="http://www.mnot.net/cache_docs/"&gt;http://www.mnot.net/cache_docs/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A resource is eligible for caching if:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;There is caching info in HTTP response headers &lt;/li&gt;&lt;li&gt;Non secure response (HTTPS wont be cached)&lt;/li&gt;&lt;li&gt;ETag or LastModified header is present&lt;/li&gt;&lt;li&gt;Fresh cache representation &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Entity tags can be strong or weak validators.The strong validator provide the uniqueness of representation.If we use MD5 or SHA1, entity value changes when one bit of data is changed, while a weak value changes whenever the meaning of an entity(which can be a set of semantically related) changes.&lt;br /&gt;&lt;br /&gt;More info on conditional requests explaining strong and weak ETags in &lt;a href="http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-08"&gt;here &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In Spring MVC, Support for ETags is provided by the servlet filter ShallowEtagHeaderFilter. If you see the source &lt;a href="http://www.docjar.com/html/api/org/springframework/web/filter/ShallowEtagHeaderFilter.java.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;String responseETag = generateETagHeaderValue(body);&lt;br /&gt;....    ......&lt;br /&gt;&lt;br /&gt;protected String generateETagHeaderValue(byte[] bytes) {&lt;br /&gt;              StringBuilder builder = new StringBuilder("\"0");&lt;br /&gt;             Md5HashUtils.appendHashString(bytes, builder);&lt;br /&gt;              builder.append('"');&lt;br /&gt;            return builder.toString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The default implementation generates an MD5 hash for the JSP body it generated.So whenever the same page is requested, this checks for If-None-Match, a 304 is send back.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;String requestETag = request.getHeader(HEADER_IF_NONE_MATCH);&lt;br /&gt;            if (responseETag.equals(requestETag)) {&lt;br /&gt;               if (logger.isTraceEnabled()) {&lt;br /&gt;                     logger.trace("ETag [" + responseETag + "] equal to If-None-Match, sending 304");&lt;br /&gt;                  }&lt;br /&gt;                 response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);&lt;br /&gt;             }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This reduces the processing and bandwidth usage.Since it is a plain Servlet Filter, and thus can be used in combination any web framework.A &lt;a href="http://en.wikipedia.org/wiki/MD5"&gt;MD5  &lt;/a&gt;hash assures that the actual etag is only 32 characters long, while ensuring that they are highly unlikely to collide.A deeper level of ETag implementation penetrating to the model layer for the uniqueness is also possible.It could be realted to the revisions of row data. Matching them for higher predicatability of lesser downloads of data will be an effective solution.&lt;br /&gt;&lt;br /&gt;As per &lt;a href="http://www.jcp.org/en/jsr/detail?id=286"&gt;JSR 286 portlet specification&lt;/a&gt; Portlet should set Etag property (validationtoken) and expiration-time when rendering. New render/resource requests will only be called after expiration-time is reached.New request will be sent the Etag. Portlet should examine it and determine if cache is still good if so, set a new expiration-time and do not render.This specification is implemented in Spring MVC.(see &lt;a href="http://jira.springframework.org/browse/SPR-4259"&gt;JIRA  &lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;A hypothetical model for REST responses using deeper Etags could be effective while an API is exposed or two applications are integrated.I have seen such an implementation using Python &lt;a href="http://bitworking.org/news/150/REST-Tip-Deep-etags-give-you-more-benefits"&gt;here  &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When cloud computing is considered, for Amazon S3 receives a PUT request with the Content-MD5 header, Amazon S3 computes the MD5 of the object received and returns a 400 error if it doesn't match the MD5 sent in the header.Here Amazon or &lt;a href="http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/4faaa757-871f-48f0-8bac-8bfb91c65a11"&gt;Azure &lt;/a&gt;uses &lt;a href="http://www.faqs.org/rfcs/rfc1864.html"&gt;Content-MD5&lt;/a&gt; which is of 7 bytes.&lt;br /&gt;&lt;br /&gt;According to the article &lt;a href="http://www.ibm.com/developerworks/wikis/display/pmuellr/Amazon+S3+vs+RESTful+Collections"&gt;here  &lt;/a&gt;in S3 for some reason the entity was updated with the exact same bits that it previously had, the ETag will not have changed, but then, that's probably ok anyway.&lt;br /&gt;&lt;br /&gt;According to &lt;a href="http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTObjectGET.html"&gt;S3 REST API&lt;/a&gt;,&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Amazon S3 returns the first ten megabytes of the file, the Etag of the file, and the total size of the file (20232760 bytes) in the Content-Length field.&lt;br /&gt;&lt;br /&gt;To ensure the file did not change since the previous portion was downloaded, specify the if-match request header. Although the if-match request header is not required, it is recommended for content that is likely to change. &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The ETag directive in the HTTP specification makes available to developers to implement caching, which could be very effective at the transport level for REST services as well as web applications.The trade-off would be, there may be security implications to having data reside on the transport level.&lt;br /&gt;&lt;br /&gt;But in the case of static files which is having a large "Expires" value and clustered files, Etag will not be effective because of the unique checksum for files that are distributed will be transported to client for each GET requests.By removing the ETag header, you disable caches and browsers from being able to validate files, so they are forced to rely on your Cache-Control and Expires header.Thus by reducing the header size which was having the checksum value.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-3732388420844563645?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/-xvPYRd9MpU/etags-roles-in-web-application-to-cloud.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/11/etags-roles-in-web-application-to-cloud.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-1687220973732961690</guid><pubDate>Fri, 14 Aug 2009 04:31:00 +0000</pubDate><atom:updated>2009-08-15T15:10:44.791+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">groovy</category><title>A peek into metaprogramming</title><description>&lt;div style="text-align: justify;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Metaprogramming"&gt;Metaprogramming&lt;/a&gt; is about programming acting on other programs. Modifying the programs on the fly. Consider a compiler which is a program written to act,parse,execute the code written, analyzed on grammatical domain of its own lexical structure. It interacts and compose programs of small code components like importing required classes, #define macros, message passing etc. when we are to discuss about compilers, they  are translating the source to it machine representation. In meta programming, its about source to source and machine independent. In C++, there are templates which is a data object for a set of programs,generates the code that is executed. The compilers use the program analysis method of type system, a check for the type correctness.an oracle, that is,some method for checking whether the system under test has behaved correctly on a particular execution. It is the assertions embedded in the code.Many programs  read an input sequence and produce an output sequence, maintaining a logical correspondence between the input and output structures. When the type come into picture in a dynamic way,the system needs to be intact. This is being handled by the compiler itself as it asserts the type. Usually a program will have a structure ; a syntax tree,like  an &lt;a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree"&gt;AST&lt;/a&gt;.The meta programs can manipulate these representations. The abstract syntax can then be used as an intermediate language, such that multiple languages can be expressed in it, and meta-programs can be reused for several source languages. Functional languages can have polymorphic higher-order functions take other functions as arguments and returns functions, treating functions as values. Java uses AOP, which introduces pointcuts to a program that can then be modified at runtime (using bytecode manipulation etc).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Take, Javascript, we can attach additional properties to an object ("expando").&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var testObject = {};&lt;br /&gt;testObject.variable1 = 'string';&lt;br /&gt;testObject.variable2 = 3;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The type system is dynamic.&lt;br /&gt;&lt;br /&gt;It has functions as first class objects.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;testObject.functionA = function(){};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Function can return other functions as well as passed in as parameters.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;testObject.functionC = function(functionA){ return functionB(){};};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Closure occurs when a function is defined within another function,and the inner function refers to local variables of the outer function. Currying a function is modified with each call so that the arguments passed into it become part of the function which will be helpful in partially evaluating functions. It is implemented using closures.&lt;br /&gt;&lt;br /&gt;for the simple stupid code ,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function show(){&lt;br /&gt;&lt;br /&gt;alert(testAB('A','B'));//AB&lt;br /&gt;var testB = testAB('A');&lt;br /&gt;alert(testB);&lt;br /&gt;alert(testB('B'));//AB&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function testAB(a,b){&lt;br /&gt;   if (arguments.length &amp;lt; 1) {&lt;br /&gt;         return add;&lt;br /&gt;     } else if (arguments.length &amp;lt; 2) {&lt;br /&gt;         return function(c) { return a + c }&lt;br /&gt;     } else {&lt;br /&gt;         return a + b;&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;In Groovy,&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def testAB = { a, b -&amp;lt; a + b }&lt;br /&gt;assert testAB('A', 'B') == 'AB'// or testAB.call('A','B')&lt;br /&gt;&lt;br /&gt;def testB = testAB.curry('A')&lt;br /&gt;assert testB('B', 'World') == 'AB'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In Groovy,each object has it is own meta class defines the behavior of any given Groovy or Java class.Alter the metaclass  (getMetaClass()) and change the object's behavior at runtime. A special MetaClass called an &lt;a href="http://groovy.codehaus.org/ExpandoMetaClass"&gt;ExpandoMetaClass &lt;/a&gt;that allows  dynamically adding methods  or properties.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String.metaClass.echo = {-&amp;gt;&lt;br /&gt;return "This is an echo"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;println "Test".echo() //will print This is an echo.&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;String is final, even methods can be added !&lt;br /&gt;&lt;br /&gt;The behavior of program changes with a concise code.Instead of test driven development,the methodology of behavior-driven development do follow test-first code-writing. In this case tests are considered specs, or "expectations" about how code will behave. Its is checking what code should do, than what it had done. To understand the concepts and practical uses, need to explore more&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-1687220973732961690?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/UhTXkT_ebWU/peek-into-meta-programming.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/08/peek-into-meta-programming.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-3997808385079060011</guid><pubDate>Thu, 06 Aug 2009 21:46:00 +0000</pubDate><atom:updated>2009-08-15T15:03:00.134+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">closures</category><category domain="http://www.blogger.com/atom/ns#">groovy</category><category domain="http://www.blogger.com/atom/ns#">griffon</category><title>Groovy and some Griffon experiments</title><description>Groovy is dynamic with its  superset java syntax to have fun with and be productive.It can be compiled to bytecode in .class and interpreted at runtime as a script.Adds closures,dynamic typing (&lt;a href="http://en.wikipedia.org/wiki/Duck_typing"&gt;duck&lt;/a&gt;), auto imports,no semicolon,no return... like a ruby-fied java.There can came railing Grails.Griffon for desktop, is very similar to developing web applications with Grails, basically the MVC + "convention over configuration".In Griffon, the Model is a POGO,the view is SwingBuilder and the controller (injected to) manage the Model and View together ().We know the applet coding and managing is cumbursome, for eg an applet form populated by an OrderDO etc.The coupling of model logic along with the applet controllers is mostly seen in web applications.So I decided to have some fun on this cute creature,Griffon.&lt;br /&gt;&lt;br /&gt;A quick work around to display a bindable xml to the text area.I tried with tables, but some issues with events, so I will try later.Developing is easy and with less code.Scripting makes a flexible (agile) application layers like views and  controller.Groovy can act as a super glue for different layers.It could combine XML parsing,widgets,networking...Each widget node written in the view classes is syntactically a method call.All of these method calls are dynamically dispatched.Most don’t actually exist in bytecode.Child closures create hierarchical relations.Closures are first class objects.This hierarchy of components would normally be created through a  series of repetitive instantiations, setters, and finally attaching child to its respective parent.Child widgets are added to parent containers.&lt;br /&gt;Like a ScrollPane having a text area etc.An event listener method is equivalent to adding a listener with that method; actionPerformed : { ... } ;in Groovy.&lt;br /&gt;&lt;br /&gt;For this same  Java does as&lt;br /&gt;&lt;br /&gt;button.addActionListener(new ActionListener() {&lt;br /&gt;void actionPerformed(ActionEvent evt) { ...}&lt;br /&gt;})&lt;br /&gt;&lt;br /&gt;Samples&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/SntQW7SvTUI/AAAAAAAAAGk/4TF9SMSepY4/s1600-h/data_tester_screen.jpeg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 246px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/SntQW7SvTUI/AAAAAAAAAGk/4TF9SMSepY4/s320/data_tester_screen.jpeg" alt="" id="BLOGGER_PHOTO_ID_5366971735745711426" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://bytescrolls-samples.googlecode.com/files/griffon-test.zip"&gt;source&lt;/a&gt;&lt;br /&gt;Download source&lt;br /&gt;Follow the quickstart guide and run the app from griffon-test directory&lt;br /&gt;&lt;br /&gt;Groovy rocks!! says &lt;a href="http://onestepback.org/articles/groovy/index.html"&gt;http://onestepback.org/articles/groovy/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;More here&lt;br /&gt;&lt;a href="http://groovy.codehaus.org/Griffon+Quick+Start"&gt;http://groovy.codehaus.org/Griffon+Quick+Start&lt;/a&gt;&lt;br /&gt;&lt;a href="http://groovy.codehaus.org/Swing+Builder"&gt;http://groovy.codehaus.org/Swing+Builder&lt;/a&gt;&lt;br /&gt;&lt;a href="http://griffon.codehaus.org/"&gt;http://griffon.codehaus.org/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-3997808385079060011?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/ETK5OBd9Fgw/groovy-and-some-griffon-experiments.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_jKChESAVzhw/SntQW7SvTUI/AAAAAAAAAGk/4TF9SMSepY4/s72-c/data_tester_screen.jpeg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/08/groovy-and-some-griffon-experiments.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-6377633832428676268</guid><pubDate>Mon, 03 Aug 2009 20:10:00 +0000</pubDate><atom:updated>2009-08-04T02:02:02.226+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">webservice</category><category domain="http://www.blogger.com/atom/ns#">XML</category><category domain="http://www.blogger.com/atom/ns#">jibx</category><category domain="http://www.blogger.com/atom/ns#">soa</category><title>JiBX - Part 1</title><description>&lt;div style="text-align: justify;"&gt;When we consider XML as a data model while programming, focus is mostly given on strings/tags/elements in parsing data.The ETL operations are done on this ubiquitous document interchange model when  communication is made between applications.To make things simple in the internet; which  is fond of documents ; XML became the foundation of services through web.The object, which is accessed from object graphs in the memory have features such as inheritance / polymorphism and attributes / object-based relationships while XML does not have any of these features as objects have.It is merely a grammatical (hierarchical) representation of data with all its branches mangled to itself .But they have similarity in the sense of representation of real world data.Therefore they can exists as the representation of each other which eases in programming.They are effective in defining business uses cases.But there is an impedance mismatch between objects and xmls.An application written in Java, will have it data types defined within the scope while XML Schema which defines the data is richer than Java.Complex objects find difficulty in serializing.Have a look on this &lt;a href="http://homepages.cwi.nl/%7Eralf/xo-impedance-mismatch/paper.pdf"&gt;paper&lt;/a&gt; which explains the X/O impedance mismatch.&lt;br /&gt;&lt;br /&gt;We can generate Java classes from XML or vice versa.In this case, it is a "Schema-Centric" approach.We define an XML schema.Then one or more XML documents.Then generate java classes based on them.In this case you need a stable schema which can be used to validate data.Essential for a "reliable" web service.But application code is forced to use an interface that reflects the XML structure which makes them tightly coupled to contracts defined.Any change in schema make a need to regenerate the object model and change application code to match.&lt;br /&gt;&lt;br /&gt;If we map the classes using bindings, then its "Java technology-centric " approach.This can be adopted when you don't want object model tied to schema.When there is a need to support different versions of the schema with the same object model or a common data exchange format for existing objects is needed.Binding definitions are themselves XML documents, with a schema defined for it.&lt;br /&gt;&lt;br /&gt;JiBX is fundamentally a Java technology-centric (mapped binding) approach uses binding definitions.You define how XML relates to Java objects.Start from schema, code, or both.Binding code is compiled (or wired ?) into  files (which uses BCEL byte code enhancements ). It can be done at build time, or on-the-fly at runtime.This makes JiBX compact and fast.JiBX achieves its performance by using post-compilation bytecode manipulation rather than the reflection.The advantage is that there is no need for getters, setters and no-arg constructors.One can write the class without considering mapping issues and then map it without modifications. XML schema describe domain objects.JiBX really maps well to XSD. JiBX is based on a XML pull parser architecture (&lt;a href="http://www.extreme.indiana.edu/xgws/xsoap/xpp/"&gt;XPP3&lt;/a&gt;) . Rather than generating code from a DTD or Schema, JiBX works with a binding definition that associates user-supplied classes with XML structure. The binding compiler is executed after code is compiled and the marshalling/unmarshalling code is added on to the class files.There are tools along with it, like Bindgen that can generate schema from existing classes.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Tutorials&lt;br /&gt;&lt;br /&gt;&lt;a href="http://jibx.sourceforge.net/binding/tutorial/binding-start.html"&gt;http://jibx.sourceforge.net/binding/tutorial/binding-start.html&lt;/a&gt;&lt;br /&gt;Pdfs - &lt;a href="http://www.ibm.com/developerworks/java/tutorials/j-jibx1/j-jibx1-pdf.pdf"&gt;JiBX -Part1&lt;/a&gt; &lt;a href="http://www.ibm.com/developerworks/java/tutorials/j-jibx2/j-jibx2-pdf.pdf"&gt; JiBX-Part2&lt;/a&gt;  &lt;a href="http://www.cjug.org/presentations/2005/Aug05West/IntroJibx.pdf"&gt;Intro&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Previous articles&lt;br /&gt;&lt;a href="http://bytescrolls.blogspot.com/2008/05/web-has-become-more-ubiquitous-than-it.html"&gt;Creating a Java WebService using Axis 2&lt;/a&gt; (a lazy approach)&lt;br /&gt;&lt;a href="http://bytescrolls.blogspot.com/2008/05/simple-rss-parser.html"&gt;A simple RSS parser&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-6377633832428676268?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/TwVaNZ4x-II/jibx-part-1.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/08/jibx-part-1.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-1244516815844182727</guid><pubDate>Sun, 28 Jun 2009 18:30:00 +0000</pubDate><atom:updated>2009-08-15T15:01:51.673+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">web 2.0</category><category domain="http://www.blogger.com/atom/ns#">BPM</category><category domain="http://www.blogger.com/atom/ns#">jBPM</category><title>A slothy ride through "Work Flows"... a primer</title><description>&lt;div style="text-align: justify;"&gt;IT has become integral part of every organization.Business people need to be empowered with the tools that would keep an up hand on the competitive market.The execution of business processes in an organization can be done through work flow management systems.It is basically  the flow of data that is associated with a work.Distribution of work is needed for efficient management.So the non technical people find it very easy if the applications they work on to control the process, is graphically manageable.In the deep level, the process models are based on graph theories and algorithms.As a programmer you are familiar with activity diagrams/ data flow diagrams,so we can observe these work flow patterns described by them.The distribution of work and its monitoring  from the inception to the end can be effectively managed by work flow systems.Work flow systems helps to model the services for Business process management (BPM) (which is a management discipline that focuses on the designing them).Anyway the software used to model them did become role players of the industry.&lt;br /&gt;&lt;br /&gt;I recently, read some articles on evolution of work flow tools.In 70's the work flow domain focused on office information systems.They were not successful  in earlier days due to the limitations of computing, graphical user interfaces etc.But in these latest times, we could see the massive change in the concept of computing... semantic web,web 2.0,advanced networking etc that helped work flow systems to spread from managing a single organization to social networks(in the sense of social marketing tools, &lt;a href="http://eprints.ecs.soton.ac.uk/15095/1/Works112v-goble2.pdf"&gt;collaborative work &lt;/a&gt;etc ).There are a mindful of software like IBM MQseries WorkFlow, &lt;a href="http://www.tibco.com/"&gt;Tibco Staffware  &lt;/a&gt;&lt;a href="http://www.oracle.com/technology/bpel"&gt;Oracle BPEL PM &lt;/a&gt;, &lt;a href="http://www.jboss.com/products/jbpm"&gt;jBPM &lt;/a&gt;,&lt;a href="http://www.openwfe.org/"&gt;OpenWFE &lt;/a&gt;(Ruby) used for work flow development.There is a consortium, formed to define standards for the interoperability of workflow management systems known as Workflow Management Coalition (&lt;a href="http://www.wfmc.org/"&gt;WfMC&lt;/a&gt;) . According to their reference model&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_jKChESAVzhw/Ske5lSm_GzI/AAAAAAAAAGU/wC4xsm8O4dI/s1600-h/ref+model.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 225px;" src="http://2.bp.blogspot.com/_jKChESAVzhw/Ske5lSm_GzI/AAAAAAAAAGU/wC4xsm8O4dI/s400/ref+model.JPG" alt="" id="BLOGGER_PHOTO_ID_5352450732454779698" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;- workflow engine  the instantiation and execution of process instances based on a predefined process model&lt;br /&gt;- this model is specified using a process definition tool and is subsequently passed to the engine for execution&lt;br /&gt;- workflow client interaction and managing work items on the worklist&lt;br /&gt;- toools for adminstration and monitoring of processes and their instances&lt;br /&gt;- external workflow engines can be communicated while processing done&lt;br /&gt;&lt;br /&gt;take the case of jBPM&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_jKChESAVzhw/Ske8k7mFzUI/AAAAAAAAAGc/RJGDqOQijmE/s1600-h/image2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 361px; height: 400px;" src="http://2.bp.blogspot.com/_jKChESAVzhw/Ske8k7mFzUI/AAAAAAAAAGc/RJGDqOQijmE/s400/image2.png" alt="" id="BLOGGER_PHOTO_ID_5352454024811892034" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;JBoss JBPM core component is the workflow engine  (also referred to as core process engine) which takes care of the execution of process instances.&lt;/li&gt;&lt;li&gt;JBoss jBPM Graphical Process Designer (GPD), an  plugin to Eclipse is the process definition tool which provides support for defining processes in jPDL both in a graphical format and in XML format. (processes can also be defined as Java objects or as records in the jBPM database)&lt;/li&gt;&lt;li&gt;jPDL (jBPM Process Definition Language) is the process language &lt;/li&gt;&lt;li&gt;JBoss jBPM console web application is the web based workflow client as well as an administration and monitoring tool&lt;/li&gt;&lt;/ul&gt;more &lt;a href="http://docs.jboss.org/jbpm/v3/userguide/introduction.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;At the programming side it uses &lt;a href="http://docs.jboss.org/jbpm/v3/userguide/graphorientedprogramming.html"&gt;Graph Oriented Programming.&lt;/a&gt;Graph Oriented Programming is a very simple technique that describes how graphs can be        defined and executed on a plain OO programming language. Domain specific languages has a pivotal role in the development of work flows.Graph Oriented Programming is the foundation for all domain specific languages       that are based on executing a graph.    If you compare the system, it can be similar to any process model involving state changes,transitions etc.&lt;br /&gt;&lt;br /&gt;Some cool stuffs i read&lt;br /&gt;&lt;br /&gt;Making Web 2.0 Meaningful and Achievable by &lt;a href="http://www.jackbe.com/downloads/JackBe%20-%20Making%20Web%2020%20Meaningful%20and%20Achievable%20-%20April%202007.pdf"&gt;Jackbe&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.boulder.ibm.com/ibmdl/pub/software/dw/webservices/ws-web2bpm2/ws-web2bpm2-pdf.pdf"&gt;Take advantage of Web 2.0 for next-generation BPM 2.0&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.visp-project.org/docs/publications/ICEST06_12.pdf"&gt;Evolution of the workflow management systems&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;More to know about the meta languages used in these systems.....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-1244516815844182727?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/L3KtX_sJuBk/slothy-ride-through-work-flows-primer.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_jKChESAVzhw/Ske5lSm_GzI/AAAAAAAAAGU/wC4xsm8O4dI/s72-c/ref+model.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/06/slothy-ride-through-work-flows-primer.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-5955683674491685343</guid><pubDate>Sun, 21 Jun 2009 16:41:00 +0000</pubDate><atom:updated>2009-06-21T22:53:17.057+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">osgi</category><title>Java modularity and metadata</title><description>&lt;div style="text-align: justify;"&gt;As a java developer one will encounter the spaghetti world of class path hell.Loads of libraries,jars,dependencies etc are used in large projects.Manageability is the major part of any application that is evolving through continued engineering process.When we access a class in a library we have to add the library class (which can be in jar file) to class path.This helps the compiler to use the class when its get compiled and the JVM to load the class when used at runtime. Just the basic stuff.java.lang.ClassLoader plays the main role in the life of class objects.we have jars/plugin mechanisms to do all the required functionality of so called modular.A jar can have &lt;a href="http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.wbit.help.ui.doc/topics/cdepend.html"&gt;dependencies  &lt;/a&gt;to other jar files.We use lot of jar files usually the Apache commons library and all.Some time we wont be needing all the classes for the required functionality.Intelligent packaging is one of the main concern of any project while deployment.Less dependencies could overcome performance bottlenecks.Better versioning could help a better way of continued engineering and maintenance.The default class loader in java runtime is immutable.Any class that is loaded by the class loader is added to a name space which cannot be changed i.e you can add any class to this namespace but unable to unload them.That's what happening when the object is instantiated with new operator.So when we create a new ClassLoader instance it creates a new namespace.One of the solutions provided by the tech commumity is the modularization of JDK itself.This would allow applications to be installed with just those components of the JDK that they actually require.A specification &lt;a href="http://jcp.org/en/jsr/detail?id=277"&gt;JSR 277  &lt;/a&gt;was targeted to be delivered as a component of Java SE 7.0.The specification defines an architecture with first-class modularity, packaging and deployment support in the Java platform, including a distribution format, a versioning scheme, a repository infrastructure, and runtime support.They introduced the Java module format called JAM.But later on they decided to halt its development because of difficulty in integrating with JVM.They started a project Jigsaw under open jdk.The modular system can be independent or be implemented based on the language or compiler changes.Anyway, the concept of modules is interesting.According to JSR-277 spec&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;&lt;blockquote&gt;A Java module is a unit of encapsulation. It is generally written as a development module in a programming language in the Java platform, and is ultimately compiled into metadata and packaged together with classes and other resources as a deployment module.&lt;/blockquote&gt;These modules provides the metadata related to itself, like name,version,imported classes,dependencies etc.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jKChESAVzhw/Sj5lqBwGDlI/AAAAAAAAAGE/rrwo2ww8nU8/s1600-h/modules.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 190px;" src="http://3.bp.blogspot.com/_jKChESAVzhw/Sj5lqBwGDlI/AAAAAAAAAGE/rrwo2ww8nU8/s320/modules.JPG" alt="" id="BLOGGER_PHOTO_ID_5349825180061797970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;But there is already an evolving system known as &lt;a href="http://en.wikipedia.org/wiki/OSGi"&gt;OSGI &lt;/a&gt;that intends to do the modular concept.In this bundles will be the modular jar files.You can install, uninstall, start and stop these bundles(without restarting the VM ).Also, it does offer services that can be dynamically discovered in JAR files at runtime.You can package OSGi with your application, or list it as a prerequisite, and then run on a wide range of Java platforms( &lt;a href="http://www.osgi.org/About/Technology#Framework"&gt;design point &lt;/a&gt;of OSGi has always been to support a broad set of Java ME). .The concept of bundles is powered by custom class loaders which will provide encapsulation as well as runtime dynamics.&lt;br /&gt;&lt;blockquote&gt;A bundle is a group of Java classes and additional resources equipped with a detailed manifest on all its contents, as well as additional services needed to give the included group of Java classes more sophisticated behaviors, to the extent of deeming the entire aggregate a component.&lt;br /&gt;&lt;/blockquote&gt;We know that a jar will have  MANIFEST.MF file attached to its structure inside the META-INF directorythat contains information about its contents.By adding OSGi headers to the MANIFEST.MF we can make the jar a bundle.These headers can be&lt;br /&gt;&lt;br /&gt; Bundle-Name: a name for this bundle&lt;br /&gt; Bundle-SymbolicName: a unique identifier for a bundle (naming like java packages).&lt;br /&gt; Bundle-Description: description of functionality.&lt;br /&gt; Bundle-ManifestVersion: which OSGi specification to use for reading this bundle.&lt;br /&gt; Bundle-Version: version number of the bundle.&lt;br /&gt; Bundle-Activator: the class name to be invoked once a bundle is activated.&lt;br /&gt; Export-Package:  packages contained in a bundle available to the outside world.&lt;br /&gt; Import-Package:  packages required from the outside world&lt;br /&gt;&lt;br /&gt;These standardized metadata is used by the framework to provide  robust  modularity while integrating to most of the existing applications.This metadata can act as a semantic definition to integrate pluggable modules to be integrated in large applications.I think modern enterprise application need this type of modularity to provide an easy integration with low cost of maintanence and development.The ISVs can provide an efficient solution by the light weight applications instead of heavy application suites having complex integration structure.It can be an asset to the low budget IT solutions.Also the standardization helps to coexist  (and interoperable) with different solutions provided by o&lt;a href="http://openjdk.java.net/"&gt;pen jdk community&lt;/a&gt; or &lt;a href="http://www.springsource.org/osgi"&gt;spring community&lt;/a&gt; or &lt;a href="http://www.oracle.com/products/middleware/hot-pluggable.html"&gt;any other vendors&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;More header information in this &lt;a href="http://www.osgi.org/download/r4v41/r4.core.pdf"&gt;OSGi core specification&lt;/a&gt;&lt;br /&gt;Some osgi implementations &lt;a href="http://www.eclipse.org/equinox/"&gt;equinox&lt;/a&gt;,&lt;a href="http://felix.apache.org/site/index.html"&gt;apache felix&lt;/a&gt;&lt;br /&gt;About &lt;a href="http://blogs.sun.com/mr/entry/jigsaw"&gt;jigsaw&lt;/a&gt;&lt;br /&gt;&lt;a href="http://publib.boulder.ibm.com/infocenter/ieduasst/rtnv1r0/index.jsp?topic=/com.ibm.iea.rdte/rdte/1.0/rdte/RDTE_Module2/player.html"&gt;OSGi elearning&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-5955683674491685343?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/3nMRg5Mu5gk/java-modularity-and-metadata.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_jKChESAVzhw/Sj5lqBwGDlI/AAAAAAAAAGE/rrwo2ww8nU8/s72-c/modules.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/06/java-modularity-and-metadata.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-9134423727438645371</guid><pubDate>Mon, 18 May 2009 20:08:00 +0000</pubDate><atom:updated>2009-05-19T01:52:18.350+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">sling</category><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">web 2.0</category><category domain="http://www.blogger.com/atom/ns#">JCR</category><category domain="http://www.blogger.com/atom/ns#">apache</category><title>A snippet on Apache Sling</title><description>&lt;div style="text-align: justify;"&gt;We know everything is content.Content(Knowledge) management systems are widely used in various fields and is really an old concept.Usually data is stored in databases or file system as it is very easy to manage unless data is huge..When we consider filesystem, it is unstructured and hierarchical.Database is structured with a well defined schema but restricted by constraints and transactional behavior.Web 2.0 caused such an insurge of highly dynamic data into web.It became inevitable for collaboration and integration.If we have to access information of different&lt;br /&gt;formats, then we can use content repositories; for its inherent nature of file system and database (with some extra features).Its a best of both worlds.Here is the definition of a content repository from from &lt;a href="http://cds-esd.sun.com/ESD23/JSCDL/content_repository/1.0.1-mr/content_repository-1_0_1-mr-spec.zip?AuthParam=1242675486_4c6eb406ac384c72f5a32f1332af5bce&amp;amp;TicketId=B%2Fw9kxuBSVhOSBZHM1VZkgfq&amp;amp;GroupName=CDS&amp;amp;FilePath=/ESD23/JSCDL/content_repository/1.0.1-mr/content_repository-1_0_1-mr-spec.zip&amp;amp;File=content_repository-1_0_1-mr-spec.zip"&gt;JSR-170 spec&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;A content repository is a hierarchical(tree like) content store with support for structured and unstructured content, full text search, versioning, transactions, observation, and more(they can be considered as content services).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It is like a high level information management system.It can have both text files as well as binary files like pdfs,docs,images etc&lt;br /&gt;&lt;br /&gt;&lt;a href="http://incubator.apache.org/sling/site/index.html"&gt;Apache Sling&lt;/a&gt; (with a new release of version 5) is an open source Web framework for the Java platform designed to create content-centric applications on top of a JSR-170-compliant (aka JCR) content repository like &lt;a href="http://jackrabbit.apache.org/"&gt;Apache Jackrabbit&lt;/a&gt;.If you use Sling, it will be easy to develop large websites with thousands of pages.It works on top of JCR.If we are familiar with configuration management systems like changeman,VSS or subversion we know how it is easy to manage content.It avoids spreading of files in webserver Sling process the HTTP request in a RESTful way.Sling uses scripts or servlets to render and process content.Modularization by OSGi (using &lt;a href="http://felix.apache.org/"&gt;Apache Felix&lt;/a&gt; ) concept which loads modules to memory dynamically.Sling uses JSP,ESP (server side ECMA script),Groovy etc.We can directly map URL to a content.I think I have to know more about OSGi to dig whats happening inside Sling.I believe Sling could be used in large websites like social networks.DevDay says &lt;a href="http://dev.day.com/microsling/content/blogs/main/opensocialjcr.html"&gt;how Open Social and Apache Sling fit together&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;more on Sling later...&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-9134423727438645371?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/6JIzoz7LAGg/snippet-on-apache-sling.html</link><author>noreply@blogger.com (Haris)</author><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/05/snippet-on-apache-sling.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-2904232661080687633</guid><pubDate>Thu, 02 Apr 2009 20:10:00 +0000</pubDate><atom:updated>2009-04-03T01:59:13.649+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">lucene</category><category domain="http://www.blogger.com/atom/ns#">apache</category><title>Apache Lucene - Indexing Part2</title><description>I was going through some interesting sections of Apache Lucene these days.I found it really interesting because, the project is a very popular one and it made most of the web applications to integrate  complex search modules in them.Some might be knowing JIRA tracker by Atlassian uses lucene which traverses huge buglists,comments,codes,documents etc.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_jKChESAVzhw/SdUdxA3azyI/AAAAAAAAAF0/XkMrZCPoxH8/s1600-h/im.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 202px;" src="http://2.bp.blogspot.com/_jKChESAVzhw/SdUdxA3azyI/AAAAAAAAAF0/XkMrZCPoxH8/s320/im.JPG" alt="" id="BLOGGER_PHOTO_ID_5320191262691348258" border="0" /&gt;&lt;/a&gt;For a vanilla search tool, comparing the search key with strings in the file is very slow.So the indexing like inverted index comes in handy.When indexing is done by lucene, it will create document ids for each document.It will collect all the words and associate them with each docId in which the word belongs. Therefore, each docId will be having alist of positions of words in the document.The index datastructure, the store of documents, with its associated fields is constructed to provide a random access data retrieval.The Lucene inverted index can be either opened to add more documents or delete existing documents at a time.&lt;br /&gt;To update a document you must delete it first, close the index and add it again.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/SdUd9tAq2bI/AAAAAAAAAF8/mqOHq25vYA8/s1600-h/Invertedindex.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 243px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/SdUd9tAq2bI/AAAAAAAAAF8/mqOHq25vYA8/s320/Invertedindex.jpg" alt="" id="BLOGGER_PHOTO_ID_5320191480699738546" border="0" /&gt;&lt;/a&gt;The Analyzer , specfied in the Indexwriter, will extracts the tokens to be indexed.There is a default analyzer for english texts(for multilingual one custom analyzers are needed).Before analyzing is done, the documents like pdf,doc etc are to be parsed.A Term is the basic unit for searching. Similar to the Field object, it consists of a pair of string elements: the name of the field and the value of that field.A term is defined as a pair of &amp;lt;fieldname,text&amp;gt;A term vector is a collection of terms.The inverted index map terms to documents.For each term T , it should store the set of all documents containing that term.So the duty of analyzer is to look for the terms in documents and create a token stream so that they can be mapped.Terms are stored in segments and they are sorted.The term frequency will tell how well that term describes the document contents.But term which appear in many documents are not very useful for filtering.The Kth most frequent term  has frequency approx 1/K ie for 100 tokens, the index will contain 50% text.For the indexing strategies : - they can be chosen from&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt; Batch based - like a simple file parsing and sorting-&lt;br /&gt;&lt;/li&gt;&lt;li&gt; BTree - indexing - similar to indexing by file systems and databases - as it is a tree the         update can be done in place&lt;/li&gt;&lt;li&gt; Segment based which is common, created by lots of small indexes&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;The algorithm used for lucene indexing  can be&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt; indexing a single document and merging a set of indexes&lt;/li&gt;&lt;li&gt; incremental algorithm in which there will be a stack of segments and new indexes are pushed to stack (segment based)&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;References&lt;br /&gt;&lt;br /&gt;Doug Cutting (the creator) &lt;a href="http://lucene.sourceforge.net/talks/pisa/"&gt;Lecture &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.huihoo.com/apache/apachecon/us2007/AdvancedIndexingLucene.ppt"&gt;http://docs.huihoo.com/apache/apachecon/us2007/AdvancedIndexingLucene.ppt&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.im.ntu.edu.tw/%7Eb90003/Lucene.ppt."&gt;http://www.im.ntu.edu.tw/~b90003/Lucene.ppt.&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Lucene-Action-Otis-Gospodnetic/dp/1932394281"&gt;Lucene In Action &lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-2904232661080687633?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/Nv1mPh-uVbo/apache-lucene-indexing-part2.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_jKChESAVzhw/SdUdxA3azyI/AAAAAAAAAF0/XkMrZCPoxH8/s72-c/im.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/04/apache-lucene-indexing-part2.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-1983097727941520902</guid><pubDate>Tue, 31 Mar 2009 19:42:00 +0000</pubDate><atom:updated>2009-04-01T01:27:58.752+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">indexing</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">lucene</category><category domain="http://www.blogger.com/atom/ns#">apache</category><title>Apache Lucene - Indexing - Part 1</title><description>&lt;div style="text-align: justify;"&gt;"Information retrieval (IR) is the science of searching for documents, for information within documents and for metadata about documents, as well as that of searching relational databases and the World Wide Web."&lt;br /&gt;&lt;br /&gt;Most of the application uses search features.If you are looking to add a powerful text search engine feature to  your application then use &lt;a href="http://lucene.apache.org/"&gt;Lucene&lt;/a&gt;, which can add advanced Search Engine capabilities to an application.This is a really powerful Java API which gave birth to powerful tools such as &lt;a href="http://en.wikipedia.org/wiki/Nutch"&gt;Nutch&lt;/a&gt;,&lt;a href="http://en.wikipedia.org/wiki/Hadoop"&gt;Hadoop&lt;/a&gt;,&lt;a href="http://en.wikipedia.org/wiki/Hibernate_search"&gt;Hibernate search&lt;/a&gt; and so on.Lucene was started in 1997  and adopted by Apache in 2001.The main functionality Lucene does is the powerful full text indexing of data.&lt;br /&gt;Indexing with Lucene breaks down into three main operations: converting data to text, analyzing it, and saving it to the index.Lucene looks for strings only , so the documents has to be parsed and indexed.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jKChESAVzhw/SdJ00te229I/AAAAAAAAAFs/RYc7-17tsHo/s1600-h/doc2.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 243px; height: 320px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/SdJ00te229I/AAAAAAAAAFs/RYc7-17tsHo/s320/doc2.gif" alt="" id="BLOGGER_PHOTO_ID_5319442558789016530" border="0" /&gt;&lt;/a&gt;To search large amounts of text quickly, you must first index that text and convert it into a format that will let you search it rapidly, eliminating the slow sequential scanning process. This conversion process is called indexing, and its output is called an index. So the searching is done on this index to find the data related with a cost of space &lt;span style="font-style: italic;"&gt;'storing indexes'&lt;/span&gt;.&lt;br /&gt;These index files can be stored in a directory .A lucene index is divided into segments madeup of several index files(&lt;a style="font-style: italic;" href="http://lucene.apache.org/java/2_3_2/api/org/apache/lucene/document/Document.html"&gt;Lucene Documents&lt;/a&gt;).An index can be related to mutiple documents.So if new documents are indexed , it is added to segments than modifying the existing index file.Lucene uses a feature called &lt;span style="font-style: italic;"&gt;incremental indexing&lt;/span&gt; ie there will be a global indexing and index those incremental documents  so that it is searchable.Regarding the structure of a lucene index, it is an &lt;a href="http://en.wikipedia.org/wiki/Inverted_index"&gt;inverted index&lt;/a&gt; .While searching, lucene loads the index to memory .It uses a high performance indexing which has an index size roughly 20-30% of the size of text indexed which uses less memory. The documents in an index is a collection of fields which is a named  collection of terms like &amp;lt;field,term&amp;gt;.These fields are independent search space defined at run-time.The segments or sub-indexes are independently searchable and the results of these segments are merged.Suppose a wiki article is indexed , we can set the field properties, so that the field objects contain actual indexed article data or stored one.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/SdJ0qstNBqI/AAAAAAAAAFk/8Km55SDSST8/s1600-h/doc.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 252px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/SdJ0qstNBqI/AAAAAAAAAFk/8Km55SDSST8/s320/doc.gif" alt="" id="BLOGGER_PHOTO_ID_5319442386782062242" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;More about lucene index file formats - &lt;a href="http://lucene.apache.org/java/2_0_0/fileformats.html"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-1983097727941520902?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/dpu6jLJ0oO0/apache-lucene-indexing-part-1.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_jKChESAVzhw/SdJ00te229I/AAAAAAAAAFs/RYc7-17tsHo/s72-c/doc2.gif" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/04/apache-lucene-indexing-part-1.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-2123594757705219054</guid><pubDate>Mon, 30 Mar 2009 17:50:00 +0000</pubDate><atom:updated>2009-03-31T00:07:01.517+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ria</category><category domain="http://www.blogger.com/atom/ns#">patterns</category><category domain="http://www.blogger.com/atom/ns#">silverlight</category><category domain="http://www.blogger.com/atom/ns#">REST</category><category domain="http://www.blogger.com/atom/ns#">.net</category><category domain="http://www.blogger.com/atom/ns#">ajax</category><category domain="http://www.blogger.com/atom/ns#">ux</category><category domain="http://www.blogger.com/atom/ns#">WCF</category><title>Few videos i liked from Mix 09</title><description>I have worked on some .NET RIA projects before.I saw some videos from &lt;a href="http://live.visitmix.com/"&gt;Mix09&lt;/a&gt;, and sharing some I liked.&lt;br /&gt;&lt;a href="http://videos.visitmix.com/MIX09/T35F"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Building a Rich Social Network Application&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Learn how to build a social networking site using Microsoft Silverlight.Also explains how to mash up existing services, how to tag and store data in back-end services,and how to build a rich and engaging experience.&lt;br /&gt;&lt;br /&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="480" height="270"&gt;&lt;br /&gt;&lt;param name="source" value="http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap"&gt;&lt;br /&gt;&lt;param name="initParams" value="m=http://mschannel9.vo.msecnd.net/o9/mix/09/wmv-hq/t35f.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap, postid=0"&gt;&lt;br /&gt;&lt;param name="background" value="#00FFFFFF"&gt;&lt;br /&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;&lt;br /&gt;&lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none;" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://videos.visitmix.com/MIX09/T30F"&gt;Advance Your Design with UX Design Patterns&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="480" height="270"&gt;&lt;br /&gt;&lt;param name="source" value="http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap"&gt;&lt;br /&gt;&lt;param name="initParams" value="m=http://mschannel9.vo.msecnd.net/o9/mix/09/wmv-hq/t30f.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap, postid=0"&gt;&lt;br /&gt;&lt;param name="background" value="#00FFFFFF"&gt;&lt;br /&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;&lt;br /&gt;&lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none;" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/object&gt;&lt;br /&gt;Visit this website for different ux patterns&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://quince.infragistics.com/"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 186px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/SdENrQ03QYI/AAAAAAAAAFc/AdT71ml6tQI/s320/ux.JPG" alt="" id="BLOGGER_PHOTO_ID_5319047671803494786" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://quince.infragistics.com/"&gt;http://quince.infragistics.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://videos.visitmix.com/MIX09/T63M"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://videos.visitmix.com/MIX09/T63M"&gt;Building Data-Driven Scalable AJAX Web Pages&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;There are different patterns for designing an application .See this video for how to enable rich communication patterns between your AJAX Web pages and Web server using existing and new features in WCF, Windows Communication Foundation.&lt;br /&gt;&lt;br /&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="480" height="270"&gt;&lt;br /&gt;&lt;param name="source" value="http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap"&gt;&lt;br /&gt;&lt;param name="initParams" value="m=http://mschannel9.vo.msecnd.net/o9/mix/09/wmv-hq/t36f.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap, postid=0"&gt;&lt;br /&gt;&lt;param name="background" value="#00FFFFFF"&gt;&lt;br /&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;&lt;br /&gt;&lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none;" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://videos.visitmix.com/MIX09/T36F"&gt;Modeling RESTful Data Services: Present and Future&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I have written about RESTful services before.In this video, look for ADO.NET Data Services matching REST.&lt;br /&gt;&lt;br /&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="480" height="270"&gt;&lt;br /&gt;&lt;param name="source" value="http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap"&gt;&lt;br /&gt;&lt;param name="initParams" value="m=http://mschannel9.vo.msecnd.net/o9/mix/09/wmv-hq/t36f.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://videos.visitmix.com/Skins/mixvideos/Styles/players/VideoPlayer2009_03_27.xap, postid=0"&gt;&lt;br /&gt;&lt;param name="background" value="#00FFFFFF"&gt;&lt;br /&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;&lt;br /&gt;&lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none;" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/object&gt;&lt;br /&gt;For &lt;a href="http://www.codeplex.com/AppArch/Wiki/View.aspx?title=App%20Pattern%20-%20Three-Tier%20RIA%20Application%20Scenario&amp;amp;referringTitle=Application%20Patterns"&gt;Three Tier  RIA Pattern &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-2123594757705219054?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/0S2yvtuYEzc/few-videos-i-liked-from-mix-09.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_jKChESAVzhw/SdENrQ03QYI/AAAAAAAAAFc/AdT71ml6tQI/s72-c/ux.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/03/few-videos-i-liked-from-mix-09.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-7002657892756895908</guid><pubDate>Sun, 29 Mar 2009 18:21:00 +0000</pubDate><atom:updated>2009-03-29T23:59:49.317+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">jquery</category><title>markItUp! a  jQuery plugin</title><description>I saw a very cool html editor plugin called markItUp!, which is a JavaScript plugin built on the jQuery library. It allows us to turn any textarea into a markup editor.Even our own Markup system can be easily implemented.It enables us to quickly modify any standard TEXTAREA within our page into a powerful markup editor, It’s so simple that instantiating the editor is as easy as:&lt;br /&gt;&lt;br /&gt;$('#html').markItUp(Settings);&lt;br /&gt;&lt;br /&gt;settings is a json defining the html settings for parsing text area - like shortcut key mappings,markup sets etc&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jKChESAVzhw/Sc-97KEHvhI/AAAAAAAAAFU/XgUVqbAlUAM/s1600-h/mark.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 186px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/Sc-97KEHvhI/AAAAAAAAAFU/XgUVqbAlUAM/s200/mark.JPG" alt="" id="BLOGGER_PHOTO_ID_5318678508959415826" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;For more features&lt;br /&gt;&lt;a href="http://markitup.jaysalvat.com/"&gt;http://markitup.jaysalvat.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-7002657892756895908?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/pfvtBNNj-jM/markitup-jquery-plugin.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_jKChESAVzhw/Sc-97KEHvhI/AAAAAAAAAFU/XgUVqbAlUAM/s72-c/mark.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/03/markitup-jquery-plugin.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-818850914311213273.post-4771219588082447055</guid><pubDate>Sun, 29 Mar 2009 13:11:00 +0000</pubDate><atom:updated>2009-03-29T19:23:21.091+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">eclipse</category><category domain="http://www.blogger.com/atom/ns#">gadgets</category><category domain="http://www.blogger.com/atom/ns#">opensocial</category><title>Develop an Open social application in 60 seconds</title><description>&lt;div style="text-align: justify;"&gt;Open social application development made a giant leap.An eclipse plugin that eases the development of opensocial apps.I have written about open social applications before and I had a chance to work on it.Apache shindig is the initiative to develop a SNS container for application development and testing.I would say &lt;a href="http://code.google.com/p/opensocial-development-environment/"&gt;OSDE &lt;/a&gt;plugin developed by  &lt;a href="http://www.opensocial.org/profile/YoichiroTanaka"&gt;Yoichiro Tanaka  &lt;/a&gt;rocks!! It uses apache shindig and hibernate for a dynamic development, so the developer can create a single application for different data models.As apache shindig provides java REST support, the application development will become more extensible.The database packaged with the plugin is &lt;a href="http://www.h2database.com/html/main.html"&gt;H2&lt;/a&gt;(a Java SQL database).Before this plugin came, we had to develop and run the applications iniside a sandbox which was really tiring.This plugin has features of wizard like  development for both javascript widgets and Java REST client applications.We can have our own custom social data which can be easily persisted due to the excellent plugin architecture.So I tried to develop a simple application ...&lt;br /&gt;&lt;br /&gt;After the plugin is installed create a new OSDE project&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jKChESAVzhw/Sc94P-AGq6I/AAAAAAAAAEM/cXMiuRuOUwc/s1600-h/osde_1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 366px; height: 400px;" src="http://3.bp.blogspot.com/_jKChESAVzhw/Sc94P-AGq6I/AAAAAAAAAEM/cXMiuRuOUwc/s400/osde_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5318601900684651426" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Specify the gadget.xml and the API specs etc&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jKChESAVzhw/Sc94eZlI5YI/AAAAAAAAAEU/IVTq8NTYorA/s1600-h/osde_2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 365px; height: 400px;" src="http://3.bp.blogspot.com/_jKChESAVzhw/Sc94eZlI5YI/AAAAAAAAAEU/IVTq8NTYorA/s400/osde_2.JPG" alt="" id="BLOGGER_PHOTO_ID_5318602148605912450" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;For the development we need to run the apache shindig in the background.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jKChESAVzhw/Sc945vgJqnI/AAAAAAAAAEc/G4mlUvJZdiI/s1600-h/osde_4.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 214px; height: 178px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/Sc945vgJqnI/AAAAAAAAAEc/G4mlUvJZdiI/s400/osde_4.JPG" alt="" id="BLOGGER_PHOTO_ID_5318602618347039346" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;To have a custom social data create people and add relationships between them.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/Sc95OA-umoI/AAAAAAAAAEk/xn-Y7EHHqOg/s1600-h/osde_6.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 397px; height: 202px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/Sc95OA-umoI/AAAAAAAAAEk/xn-Y7EHHqOg/s400/osde_6.JPG" alt="" id="BLOGGER_PHOTO_ID_5318602966636075650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jKChESAVzhw/Sc95ZCAPFHI/AAAAAAAAAEs/oO17hliJCuI/s1600-h/osde_5.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 218px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/Sc95ZCAPFHI/AAAAAAAAAEs/oO17hliJCuI/s400/osde_5.JPG" alt="" id="BLOGGER_PHOTO_ID_5318603155889394802" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jKChESAVzhw/Sc95hOIGueI/AAAAAAAAAE0/q5fPO38fQZI/s1600-h/osde_7.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 99px;" src="http://4.bp.blogspot.com/_jKChESAVzhw/Sc95hOIGueI/AAAAAAAAAE0/q5fPO38fQZI/s400/osde_7.JPG" alt="" id="BLOGGER_PHOTO_ID_5318603296582580706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jKChESAVzhw/Sc95zdiuC7I/AAAAAAAAAE8/QYkC-hFRg3I/s1600-h/osde_9.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 399px; height: 300px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/Sc95zdiuC7I/AAAAAAAAAE8/QYkC-hFRg3I/s400/osde_9.JPG" alt="" id="BLOGGER_PHOTO_ID_5318603609958386610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Write a simple gadget ... (templates can be generated by the plugin if needed)&lt;br /&gt;----src-------&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&amp;gt;&amp;lt;module&amp;gt;&amp;lt;moduleprefs author_email="harisa@pramati.com" description="A friendly os app" title="Friends"&amp;gt;&amp;lt;require feature="opensocial-0.8"&amp;gt;&amp;lt;require feature="dynamic-height"&amp;gt;&amp;lt;/moduleprefs&amp;gt;&amp;lt;content view="canvas" type="html"&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;!-- Fetching People and Friends --&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;button onclick='fetchPeople();'&amp;gt;Fetch&amp;lt;/button&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;div style="margin-left:20px;"&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;I am ... &amp;lt;span id='viewer' style="background-"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;My friends are ...&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;ul id='friends' style="margin-top:5px;list-style:none;margin-left:75px;"&amp;gt;&amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;script type='text/javascript'&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;function fetchPeople() {&lt;/code&gt;&lt;br /&gt;&lt;code&gt;var req = opensocial.newDataRequest();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer');&lt;/code&gt;&lt;br /&gt;&lt;code&gt;var params = {};&lt;/code&gt;&lt;br /&gt;&lt;code&gt;params[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.VIEWER;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;params[opensocial.IdSpec.Field.GROUP_ID] = 'FRIENDS';&lt;/code&gt;&lt;br /&gt;&lt;code&gt;var idSpec = opensocial.newIdSpec(params);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;req.add(req.newFetchPeopleRequest(idSpec), 'friends');&lt;/code&gt;&lt;br /&gt;&lt;code&gt;req.send(function(data) {&lt;/code&gt;&lt;br /&gt;&lt;code&gt;var viewer = data.get('viewer').getData();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;document.getElementById('viewer').innerHTML = viewer.getId();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;var friends = data.get('friends').getData();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;document.getElementById('friends').innerHTML = '';&lt;/code&gt;&lt;br /&gt;&lt;code&gt;friends.each(function(friend) {&lt;/code&gt;&lt;br /&gt;&lt;code&gt;document.getElementById('friends').innerHTML += '&amp;lt;li&amp;gt;&amp;amp;#187;' + friend.getId() + '&amp;lt;/li&amp;gt;';&lt;/code&gt;&lt;br /&gt;&lt;code&gt;});&lt;/code&gt;&lt;br /&gt;&lt;code&gt;gadgets.window.adjustHeight();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;});&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;----src ends---------&lt;br /&gt;&lt;br /&gt;Run the application&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jKChESAVzhw/Sc97Qd5E-iI/AAAAAAAAAFE/wcM9qEb6bMs/s1600-h/osde_8.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 56px;" src="http://3.bp.blogspot.com/_jKChESAVzhw/Sc97Qd5E-iI/AAAAAAAAAFE/wcM9qEb6bMs/s400/osde_8.JPG" alt="" id="BLOGGER_PHOTO_ID_5318605207779998242" border="0" /&gt;&lt;/a&gt;Gadget ---&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_jKChESAVzhw/Sc97bsAdgJI/AAAAAAAAAFM/RixpE6YoBIk/s1600-h/osde_10.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 394px; height: 144px;" src="http://1.bp.blogspot.com/_jKChESAVzhw/Sc97bsAdgJI/AAAAAAAAAFM/RixpE6YoBIk/s400/osde_10.JPG" alt="" id="BLOGGER_PHOTO_ID_5318605400547623058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Cool... Its simple. But this plugin will be really useful when we develop the complex applications and aiming for multiple containers supporting open social api.&lt;br /&gt;&lt;br /&gt;More ....&lt;br /&gt;&lt;a href="http://code.google.com/p/opensocial-development-environment/"&gt;opensocial-development-environment&lt;/a&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/opensocial-development-environment/wiki/ScreenCast"&gt;screencasts&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=Hh8r7A3o42g"&gt;youtube&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/818850914311213273-4771219588082447055?l=bytescrolls.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/bytescrolls/~3/W2QvAtiPU_s/develop-open-social-application-in-60.html</link><author>noreply@blogger.com (Haris)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_jKChESAVzhw/Sc94P-AGq6I/AAAAAAAAAEM/cXMiuRuOUwc/s72-c/osde_1.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bytescrolls.blogspot.com/2009/03/develop-open-social-application-in-60.html</feedburner:origLink></item></channel></rss>

