<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4556017295143623721</id><updated>2024-09-02T13:06:59.998+05:30</updated><category term="java"/><category term="performance"/><category term="fun"/><category term="terracotta"/><category term="linux"/><category term="youtube"/><category term="performance monitoring"/><category term="ubuntu"/><category term="clustering"/><category term="links"/><category term="tech"/><category term="administration"/><category term="google"/><category term="ajax"/><category term="android"/><category term="dilbert"/><category term="erlang"/><category term="flex"/><category term="hibernate"/><category term="jamon"/><category term="josql"/><category term="jxpath"/><category term="multicore"/><category term="nagios"/><category term="office space"/><category term="online TV"/><category term="oracle"/><category term="quaere"/><category term="samples"/><category term="sniper twins"/><category term="student"/><title type='text'>Tushar Khairnar&#39;s Tech Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default?start-index=26&amp;max-results=25'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>44</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-145022029216475091</id><published>2010-10-19T23:16:00.003+05:30</published><updated>2010-10-19T23:24:22.105+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><title type='text'>lucene-bytebuffer</title><content type='html'>&lt;span style=&quot;font-weight:bold;&quot;&gt;What is lucene-bytebuffer.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://code.google.com/p/lucene-bytebuffer/&quot;&gt;lucene-bytebuffer&lt;/a&gt; is Lucene Directory implementation using Direct ByteBuffer. Directory in lucene is backing storage for index. Lucene uses directory for storing index contents. So there is RAMDirectory, FileDirectory, MemoryMappedFileDirectory, NIODirectory each presenting various different options. lucene-bytebuffer will allow in-memory index to grow upto several gigabytes without incurring garbage collection cost.&lt;br /&gt;&lt;br /&gt;Mostly indexes are 90 to 95% read and 2-5% write ie. index hardly changes. If index is huge it will cost a lot in terms Garbage Collection CPU cycles. RAMDirectory holds arrays of size 1024 so for 1GB index its 1 million array objects. So as size gets increased in-memory index performance degrades due to garbage collection. &lt;br /&gt;&lt;br /&gt;What if you want to index say 5GB data? Use off-heap bytebuffer backed directory.&lt;br /&gt;&lt;br /&gt;Another question is why would you want to use lucene in-memory indexing. May be as Cache which can be queried on more than one property of object indexed?</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/145022029216475091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/145022029216475091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/145022029216475091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/145022029216475091'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/10/lucene-bytebuffer.html' title='lucene-bytebuffer'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8519463759289615901</id><published>2010-10-19T22:56:00.005+05:30</published><updated>2010-10-21T21:51:34.612+05:30</updated><title type='text'>jmalloc : Manual Memory Management in java</title><content type='html'>One of the definitive advantage of Java over C++ is automatic memory management. Automatic memory management also has its cost tough. This cost was high in earlier versions of JDK(Serial stop the world garbage collection)  but now it has been much improved : parallel and concurrent collections. In some cases this cost is so high that manual memory management is the answer. &lt;a href=&quot;http://code.google.com/p/jmalloc/&quot;&gt;jmalloc&lt;/a&gt; is one such simple effort.&lt;br /&gt; &lt;br /&gt;GC pain point in java, a limiting factor in many cases. Garbage collection tuning in java is considered as black art and very difficult to tune.&lt;br /&gt;&lt;br /&gt;Caching provides performance boost for lot of application. Caching of large data is restrictive because caching mostly is very small part of application logic but it costs relatively more in terms GC impact. JVM don&#39;t perform well predictively beyond size of 4GB. Cache is typical - it holds objects with predictable life cycle. Some objects infact live through-out the application life such as &lt;span style=&quot;font-style:italic;&quot;&gt;&quot;reference data&quot;&lt;/span&gt; which does not change and remain cached. Such objects are also problematic for GC, they get promoted to old generation and scanned in every Full garbage collection wasting CPU. Terracotta has addressed similar problem using direct ByteBuffer. jmalloc also does the same thing for ehcache.&lt;br /&gt;&lt;br /&gt;BigMemory benchmark claims to have been scaled upto 350 GB of cache on beefy server. BigMemory has shown that garbage collection that java offers is not sufficient for some use-cases like Caching. Caching modifies object only two times : Put on Cache and Eviction from Cache. This is typical case of &lt;span style=&quot;font-weight:bold;&quot;&gt;manual memory management&lt;/span&gt;. jmalloc is manual memory management of direct buffers with two simple routines : malloc and free. Direct buffers are not visible to java garbage collection. Thus object stored in directbyte buffer lives as long as its ByteBuffer reference is not collected. jmalloc allocates a single ByteBuffer and divides it into many variable size chunks where objects are serialized and stored.&lt;br /&gt;&lt;br /&gt;This is just start. Apart from generic malloc/free metods, I am planning to write a helper class for ehcache which will wrap ehcache so that all benefits like eviction, disk based overflow are available but the object is stored in&lt;br /&gt;&lt;br /&gt;If you like the idea let me know.&lt;br /&gt;..&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8519463759289615901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/8519463759289615901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8519463759289615901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8519463759289615901'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/10/jmalloc-manual-memory-management-in.html' title='jmalloc : Manual Memory Management in java'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-92429034737419770</id><published>2010-09-16T23:40:00.006+05:30</published><updated>2010-10-01T14:02:32.771+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="terracotta"/><title type='text'>BigMemory - Memory with no garbage collection overhead How?</title><content type='html'>I just came to know about BigMemory. After reading description and Terracotta CTO Ari&#39;s &lt;a href=&quot;http://blog.terracottatech.com/2010/09/bigmemory_explained_a_bit.html&lt;br /&gt;&quot;&gt;blog&lt;/a&gt; I wondered how does it work? BigMemory stores object in memoey without any garbage collection tax and stores it in native memory. It means you are no longer bound by JVM heap limit and you can use all memory (which is dirt cheap) available. And all this in Plain Java. No JNI. &lt;br /&gt;&lt;br /&gt;I mean how did it happened that If there was technique available why cant any available cache framework used it? By implementing the this technique along with complete memory manager, Terracotta thus showed that its indeed leader in distributed cache. Why spent effort in optimizing garbage collection times which is a black art.&lt;br /&gt;&lt;br /&gt;Lets assume that We have such mechanism which allows us to store java objects in native memory. So how do we implement BigMemory like system. Let&#39;s focus just on Cache usecase . You need to track objects in cache. But Object tracking is quite easy in cache usecase.  They are removed directly by cache eviction threads or user so ultimately its map.remove(key).&lt;br /&gt;&lt;br /&gt;So how does BigMemory work?. This is just my guess. It may be using Direct ByteBuffers. I did some googling around allocating native memory in JVM and found this &lt;a href=&quot;http://www.ibm.com/developerworks/java/library/j-nativememory-linux/&quot;&gt;article&lt;/a&gt;. and Yes Direct ByteBuffers are stored in Native memory. So below is my little shot at mimicking BigMemory. Basically each object is converted in ByteBuffer and stored in ByteBuffer. Some time and  memory can further be saved by using faster and more smart serialization techniques.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public Object put(K key, V value){&lt;br /&gt;  try {&lt;br /&gt;   ByteArrayOutputStream baos = new ByteArrayOutputStream();&lt;br /&gt;   ObjectOutputStream stream  = new ObjectOutputStream(baos);&lt;br /&gt;   stream.writeObject(value);&lt;br /&gt;   stream.close();&lt;br /&gt;   byte b[] = baos.toByteArray();&lt;br /&gt;   ByteBuffer buffer = ByteBuffer.allocateDirect(b.length);&lt;br /&gt;   ByteBuffer buffer2 = map.put(key, buffer);&lt;br /&gt;   if(buffer2!=null){&lt;br /&gt;    ByteArrayInputStream bais = new ByteArrayInputStream(buffer2.array());  &lt;br /&gt;    ObjectInputStream oois = new ObjectInputStream(bais);&lt;br /&gt;    V object = (V)oois.readObject();&lt;br /&gt;    oois.close();&lt;br /&gt;    return object;&lt;br /&gt;   }&lt;br /&gt;   else return null;   &lt;br /&gt;  } catch (IOException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  } catch (ClassNotFoundException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public V get(Object key){&lt;br /&gt;  try{&lt;br /&gt;   ByteBuffer buffer2 = map.get(key);&lt;br /&gt;   if(buffer2!=null){&lt;br /&gt;    ByteArrayInputStream bais = new ByteArrayInputStream(buffer2.array());  &lt;br /&gt;    ObjectInputStream oois = new ObjectInputStream(bais);&lt;br /&gt;    V object = (V)oois.readObject();&lt;br /&gt;    oois.close();&lt;br /&gt;    return object;&lt;br /&gt;   }&lt;br /&gt;   else return null;&lt;br /&gt;  }catch (IOException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  } catch (ClassNotFoundException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  } &lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The solution above stores keys in JVM heap and objects on non-heap memory. So If number of objects are 2M, JVM only has overhead of 2M objects while doing GC and not 4M ( in case of Map and 4-5M in case of EHCACHE where object is serialized and wrapped in ehcache Element object). This can be even further reduced by implementing some sort of hashing. Key is hashed into one of the buckets which are serialized and stored in buffers. You de-serialise bucket metadata and then iterate though it to find out actual buffer and then locate element. But BigMemory &lt;span style=&quot;font-weight:bold;&quot;&gt;is just not cache&lt;/span&gt; its entire object graph storage.&lt;br /&gt;&lt;br /&gt;Thus version presented here is poor man&#39;s BigMemory compared to what BigMemory will have but it still can save hugh GC tuning efforts in cases where there is hugh memory requirement in the application and thus heavy garbage collection. But Terracotta&#39;s BigMemory would be with much more smart strategies and data structures, integrated with distributed garbage collector and implementing all cluster semantics as all other terracotta clustered data structure do. Waiting for integration of BigMemory into Terracotta server. Memory has been one of the biggest paint points in Terracotta. That would give Terracotta unlimited-scalability in terms of number of distributed objects stored.</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/92429034737419770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/92429034737419770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/92429034737419770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/92429034737419770'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/09/bigmemory-memory-with-no-garbage.html' title='BigMemory - Memory with no garbage collection overhead How?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-37151578507078102</id><published>2010-04-01T22:43:00.007+05:30</published><updated>2010-04-03T13:55:44.104+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="flex"/><title type='text'>More than MVC framework for Flex : Mate</title><content type='html'>Recently at work place I was working on complex GUI screen which was to be designed in Flex. Flex has quite nice capabilities : Making beautiful GUI containing charts, widgets with minimal efforts and getting data from java-based-server-side with RemoteObject. But I guess as application will get complex(Do check &lt;a href=&quot;http://listen.grooveshark.com/&quot;&gt;grooveshark.com&lt;/a&gt; to see how rich and complex but beautiful GUI can be created with Flex) I needed some way of structuring and designing application so anybody can understand and extend application without reading thousands of lines of action script code. Being java programmer (framework based eco-system) naturally I thought on the lines of Struts, MVC framework. But then I felt need of spring like container too where I can write/design each component separately, test them and inject and wire them in main application. There are lots of framework in flex : Cairngorm, pureMVC and Mate. Naturally first pick was Cairngorm since its official adobe framework. While browsing through HelloWorld program, I thought why I am needed to to make so many framework specific classes. Last update date on download site was very old : 30th May 2007. Then I learned about Mate  : a wonderful framework which allows structuring of application in very unobtrusive way with very small learning curve. It was quite easy for me to help other team members understand new design with this framework.&lt;br /&gt;&lt;br /&gt;Mate uses flex eventing. So with Model-View-Controller, View generates events like Submit-Form which then you can &quot;map&quot; to one or more Controllers. The best feature of this framework is &quot;Injection&quot;. It injects model into controller and view so once you change model in Controller methods View updates it self. With Flex data binding and Mate injection this becomes quite powerful and very simple design for complex GUI. Mate EventMap tag allows declarative coding thus allows rapid testing and prototyping. When you look at Mate EventMap you will come to know what Application is doing, its high-level components. - your design - exactly what framework should do. Mate allowed me structure my application and set discipline. &lt;br /&gt;&lt;br /&gt;Say for example on clicking on &quot;submit&quot; button, you want to show make remote call, get data, update couple of labels on screen and put data into Grid also calculate Total Amount from all records and based on some &quot;Value&quot; you want to show some Signal like Yellow, Amber or Green indicating current status. Such screen can be described by simple EventMap declaration as follows. View can be implemented with its own Panels : SearchPanel and DisplayPanel. SearchController will host all activity specific code like calculating Totals or Summary etc.&lt;br /&gt;&lt;br /&gt; EventMap&lt;br /&gt; &lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;!--&lt;br /&gt;/**&lt;br /&gt; * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann&lt;br /&gt; * (http://qbnz.com/highlighter/ and http://geshi.org/)&lt;br /&gt; */&lt;br /&gt;.mxml .de1, .mxml .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.mxml  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.mxml a:link {color: #000060;}&lt;br /&gt;.mxml a:hover {background-color: #f0f000;}&lt;br /&gt;.mxml .imp {font-weight: bold; color: red;}&lt;br /&gt;.mxml li, .mxml .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% &#39;Courier New&#39;, Courier, monospace; color: #003030;}&lt;br /&gt;.mxml .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.mxml .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.mxml .coMULTI {color: #808080; font-style: italic;}&lt;br /&gt;.mxml .es0 {color: #000099; font-weight: bold;}&lt;br /&gt;.mxml .br0 {color: #66cc66;}&lt;br /&gt;.mxml .sy0 {color: #66cc66;}&lt;br /&gt;.mxml .st0 {color: #ff0000;}&lt;br /&gt;.mxml .nu0 {color: #cc66cc;}&lt;br /&gt;.mxml .sc0 {color: #00bbdd;}&lt;br /&gt;.mxml .sc1 {color: #ddbb00;}&lt;br /&gt;.mxml .sc2 {color: #339933;}&lt;br /&gt;.mxml .sc3 {color: #000000;}&lt;br /&gt;.mxml .re0 {font-weight: bold; color: black;}&lt;br /&gt;.mxml .re1 {color: #7400FF;}&lt;br /&gt;.mxml .re2 {color: #7400FF;}&lt;br /&gt;.mxml span.xtra { display:block; }&lt;br /&gt;&lt;br /&gt;--!&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;mxml&quot;&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;span class=&quot;sc3&quot;&gt;&amp;lt;EventHandlers type=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{SearchEvent.SEARCH}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;&amp;lt;!-- call the remoting service --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;RemoteObjectInvoker instance=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{services.productService}&amp;quot;&lt;/span&gt; method=&lt;span class=&quot;st0&quot;&gt;&amp;quot;search&amp;quot;&lt;/span&gt; arguments=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{event.searchCriteria1,event.searchCriteria1}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;&amp;lt;!-- result sequence gets executed when service returns with a result --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;resultHandlers&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;MethodInvoker generator=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{SearchController}&amp;quot;&lt;/span&gt; method=&lt;span class=&quot;st0&quot;&gt;&amp;quot;setGridData&amp;quot;&lt;/span&gt; arguments=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{resultObject}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;MethodInvoker generator=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{SummaryCalculator}&amp;quot;&lt;/span&gt; method=&lt;span class=&quot;st0&quot;&gt;&amp;quot;calculateSummary&amp;quot;&lt;/span&gt; arguments=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{resultObject}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;MethodInvoker generator=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{SignalIndicator}&amp;quot;&lt;/span&gt; method=&lt;span class=&quot;st0&quot;&gt;&amp;quot;calculateAndIndicateState&amp;quot;&lt;/span&gt; arguments=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{resultObject}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;/resultHandlers&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;faultHandlers&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;CallBack method=&lt;span class=&quot;st0&quot;&gt;&amp;quot;handleFault&amp;quot;&lt;/span&gt; arguments=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{fault.faultDetail}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;/faultHandlers&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;/RemoteObjectInvoker&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc3&quot;&gt;&amp;lt;/EventHandlers&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;View code can be refactored into two panels : SearchPanel and DisplayPanel SearchPanel looks like as follows :&lt;br /&gt;&lt;br /&gt;SearchPanel&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;div class=&quot;mxml&quot;&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;lt;mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;import mate.events.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;import mx.controls.Alert;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;import mx.collections.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private function fireSearch():void &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var event:MessageEvent = new SearchEvent(SearchEvent.SEARCH, true);&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;event.searchCriteria1 = textInput1.text;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; event.searchCriteria2 = textInput2.text;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dispatchEvent(event);&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;mx:Button&lt;/span&gt; id=&lt;span class=&quot;st0&quot;&gt;&amp;quot;searchBtn&amp;quot;&lt;/span&gt; label=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Search&amp;quot;&lt;/span&gt; width=&lt;span class=&quot;st0&quot;&gt;&amp;quot;100&amp;quot;&lt;/span&gt; click=&lt;span class=&quot;st0&quot;&gt;&amp;quot;fireSearch()&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Where as DisplayPanel looks like as follows :&lt;br /&gt;&lt;br /&gt;DisplayPanel&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;div class=&quot;mxml&quot;&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;mx:Panel&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc2&quot;&gt;&amp;lt;mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mate.events.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mx.controls.Alert;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mx.collections.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mate.model.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Bindable]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public var searchResult:SearchResultVO;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;mx:VBox&lt;/span&gt; label=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Search Result&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;mx:DataGrid&lt;/span&gt; id=&lt;span class=&quot;st0&quot;&gt;&amp;quot;dataGrid&amp;quot;&lt;/span&gt; width=&lt;span class=&quot;st0&quot;&gt;&amp;quot;350&amp;quot;&lt;/span&gt; height=&lt;span class=&quot;st0&quot;&gt;&amp;quot;200&amp;quot;&lt;/span&gt; dataProvider=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{searchResult.Data}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/mx:VBox&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/mx:Panel&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and code below injects model into controller and DisplayPanel. The way it works like Spring context&#39;s singlton bean so same instance is shared and below tag says :  DisplayPanel.searchResult =  SearchController.currentResultSet&lt;br /&gt;&lt;br /&gt;EventMap - Injector&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;div class=&quot;mxml&quot;&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sc3&quot;&gt;&amp;lt;Injectors target=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{DisplayPanel}&amp;quot;&lt;/span&gt; &lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;sc3&quot;&gt;&amp;lt;PropertyInjector targetKey=&lt;span class=&quot;st0&quot;&gt;&amp;quot;searchResult&amp;quot;&lt;/span&gt; source=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{SearchController}&amp;quot;&lt;/span&gt; sourceKey=&lt;span class=&quot;st0&quot;&gt;&amp;quot;currentResultSet&amp;quot;&lt;/span&gt; &lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;span class=&quot;sc3&quot;&gt;&amp;lt;/Injectors&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Below is code for Controller which requires its own Binding when currentResultSet changes :&lt;br /&gt;&lt;br /&gt;SearchController&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;mxml&quot;&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;package mate.controller&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;{ &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; import flash.events.Event;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; import flash.events.EventDispatcher;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; import mx.controls.Alert;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; import mx.collections.ArrayCollection;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; import mate.model.*;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; public class SearchController extends EventDispatcher&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; { &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private var _currentResultSet:SearchResultVO;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Bindable (event=&amp;quot;currentSetChange&amp;quot;)]&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public function get currentResultSet():SearchResultVO&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return _currentResultSet;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public function setGridData(result:SearchResultVO):void&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Do other processing if required....&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _currentSet = result;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dispatchEvent( new Event(&#39;currentSetChange&#39;))&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;} &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;One more good feature if Mate is that it has MockService interface where you can write dummy remote service as part of Flex application itself. This allows developers to work independently when server-side services are not ready or avaialable.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;mxml&quot;&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;span class=&quot;sc3&quot;&gt;&amp;lt;MockRemoteObject id=&lt;span class=&quot;st0&quot;&gt;&amp;quot;helloService&amp;quot;&lt;/span&gt; showBusyCursor=&lt;span class=&quot;st0&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt; delay=&lt;span class=&quot;st0&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; mockGenerator=&lt;span class=&quot;st0&quot;&gt;&amp;quot;{MockHelloService}&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Welcome to awesomeness of Mate.&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/37151578507078102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/37151578507078102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/37151578507078102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/37151578507078102'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/04/more-than-mvc-framework-for-flex-mate.html' title='More than MVC framework for Flex : Mate'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3473210685041495356</id><published>2010-03-14T14:32:00.004+05:30</published><updated>2010-03-14T14:57:53.714+05:30</updated><title type='text'>Uploading and Sharing Photos</title><content type='html'>We all want to share pictures all our Kodak moments with our friends. This is one kind of existence in Web 2.0 virtual world. This normally involves following pattern :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Take a lot of pictures by using point-and-shoot digital cameras. &lt;/li&gt;&lt;li&gt;Download them from Camera/Memory card to computer&lt;/li&gt;&lt;li&gt;Edit them in Picture editor&lt;/li&gt;&lt;li&gt;Upload them to web-album sites like flickr or picasa&lt;/li&gt;&lt;li&gt;Share photos from Picasa or Filkr&lt;/li&gt;&lt;li&gt;Upload and share on social networking sites like Orkut or Facebook.&lt;/li&gt;&lt;/ol&gt;Step 4,5 and 6 are normally mutually exclusive but then if you have friends which are on one social network and few others are on other or worse, some friends don&#39;t live in Web 2.0 so you have to send them email invitation. Now uploading photos at all these places is really pain esp. if you have hundreds of photos of your latest trip to some exotic location. I don&#39;t understand why cant somebody come-up with simple application where it allows me to do basic things like chatting, adding photos, sharing and viewing updates from all social networking sites from one single window. If you find one working application with such functionality let me know.&lt;br /&gt;&lt;br /&gt;Picasa makes sharing photos really easy. I use Picasa Desktop Application for all my photos. Picasa has concept of gadgets where you can add button, clicking on which it will post your album to sites like Orkut or Facebook. So here is my way.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download photos from Camera or Phone using Picasa.&lt;/li&gt;&lt;li&gt;Edit them using picasa&lt;/li&gt;&lt;li&gt;Use picasa tool bar buttons to upload them to Picasa Web album, orkut and facebook.&lt;/li&gt;&lt;/ol&gt;You can add Facebook button from this url : &lt;a href=&quot;http://apps.facebook.com/picasauploader/&quot;&gt;Facebook Picasa uploader plugin&lt;/a&gt;. Details you can find &lt;a href=&quot;http://picasa.google.com/support/bin/answer.py?hl=en&amp;amp;answer=150419.&quot;&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And orkut has inbuilt support for Picasa Web Albums See screen shot below&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuo2CWMaBmZ3u86PrEjav-ejyLXHtDG0yaQDqLm4WUdogSADGdJSoJK-NvpgPCXTrbzF4YIwe24oxLpiVHBxxcnOwcaxuAd1s9D9kKGHqoJHp5QlQMD7iGUNHfaDHvy94xtFULMallISRb/s1600-h/orkut_picasa.JPG&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 46px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuo2CWMaBmZ3u86PrEjav-ejyLXHtDG0yaQDqLm4WUdogSADGdJSoJK-NvpgPCXTrbzF4YIwe24oxLpiVHBxxcnOwcaxuAd1s9D9kKGHqoJHp5QlQMD7iGUNHfaDHvy94xtFULMallISRb/s320/orkut_picasa.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5448416736759140162&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61jGpEgMvPMFxhvPcvXjj2SrCW_X6IunS0POWkJSor_vsYfIniWvAt9WV4q7MkRtVyu2ZGkqM2t4KKpJvZb1lc5KGCzXmpodj_8g7yT1asET8HDV4gMzqzroiYvsz6w_cTrPni6MkU-0X/s1600-h/picasabar.JPG&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 31px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61jGpEgMvPMFxhvPcvXjj2SrCW_X6IunS0POWkJSor_vsYfIniWvAt9WV4q7MkRtVyu2ZGkqM2t4KKpJvZb1lc5KGCzXmpodj_8g7yT1asET8HDV4gMzqzroiYvsz6w_cTrPni6MkU-0X/s320/picasabar.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5448416917164748082&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope this simple tip makes your life with Photos and Social Networks easier.&lt;br /&gt;&lt;br /&gt;Tushar.</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3473210685041495356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/3473210685041495356' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3473210685041495356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3473210685041495356'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/03/uploading-and-sharing-photos.html' title='Uploading and Sharing Photos'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuo2CWMaBmZ3u86PrEjav-ejyLXHtDG0yaQDqLm4WUdogSADGdJSoJK-NvpgPCXTrbzF4YIwe24oxLpiVHBxxcnOwcaxuAd1s9D9kKGHqoJHp5QlQMD7iGUNHfaDHvy94xtFULMallISRb/s72-c/orkut_picasa.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-609793377831798609</id><published>2010-02-10T21:07:00.004+05:30</published><updated>2010-02-11T12:36:45.545+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="google"/><title type='text'>Google Buzz</title><content type='html'>My first impression - I like the idea of adding connected sites : twitter, picasa, blogger, reader and all status messages. I am still searching for good social network desktop client which will connect to all my accounts : gmail, orkut, facebook, yahoo, linked-in, twitter but there is not such application existing yet. The once which was closer is Digsby, but digsby&#39;s UI is really clumsy to use.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0aZqGDxv-eun8l6WaCDb1p4vuH5E_-RMgNXk0R4k7ggsTRCvnorid1YSpJ4MnACJml0YKlkly2f1IV9Gi5MfNQnr4ghzWwOsqNFkqSIlcQFnu4bvrXZfkmXRc-sWPKS2rdrvD9JIv9V1x/s1600-h/buzz.JPG&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 285px; height: 320px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0aZqGDxv-eun8l6WaCDb1p4vuH5E_-RMgNXk0R4k7ggsTRCvnorid1YSpJ4MnACJml0YKlkly2f1IV9Gi5MfNQnr4ghzWwOsqNFkqSIlcQFnu4bvrXZfkmXRc-sWPKS2rdrvD9JIv9V1x/s320/buzz.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5436642702243938866&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Buzz is single window solution. You want to share picasa album or your recent tweet it works. Lets hope that it does not fail as Google Wave failed due to absence of freinds. I hope google this time sends invitations to clusters of users such that when I use buzz I will find at least some friends to share buzz. Buzz is suppose to compete with Facebook and Twitter, it surely has plus points against both&lt;br /&gt;&lt;ul&gt;&lt;li&gt;it works right inside the most popular Google application - gmail &lt;/li&gt;&lt;li&gt;no 140 character limit&lt;/li&gt;&lt;li&gt;auto publish feature : when I tweet, same twit will be &quot;buzzed&quot; too&lt;/li&gt;&lt;/ul&gt;I hope Buzz comes with lot of &quot;twitter&quot; applications by default or provides options to add applications written with help of Buzz API like Gmail Labs application. One thing I would have liked to see is that Buzz should have implemented hashtags that are popular in twitter. Hashtags are like &quot;user metadata&quot; which helps to follow/search tweets that you are interested thus allowing to connect/discover like minded people.&lt;br /&gt;&lt;br /&gt;On other side, I don&#39;t know what google is thinking of having two different products : Wave and Buzz. I think since Wave has failed Google was in serious need to restrict facebook&#39;s advance so google added social networking aspects to its most loyal user base - Gmail. I am not sure about Buzz success, its surely going to tank as like google&#39;s other recent products. Facebooks strong point is that all sharing links, photos, activities, thoughts is at the central of page but in gmail is just another view so am not sure it should be part of gmail. Gmail view is OK but there should be separate page also where I can just spend time on Buzz. Hope google adds new features slowly.</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/609793377831798609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/609793377831798609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/609793377831798609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/609793377831798609'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/02/google-buzz.html' title='Google Buzz'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0aZqGDxv-eun8l6WaCDb1p4vuH5E_-RMgNXk0R4k7ggsTRCvnorid1YSpJ4MnACJml0YKlkly2f1IV9Gi5MfNQnr4ghzWwOsqNFkqSIlcQFnu4bvrXZfkmXRc-sWPKS2rdrvD9JIv9V1x/s72-c/buzz.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5122151741958657649</id><published>2010-01-09T12:47:00.004+05:30</published><updated>2010-01-09T13:10:16.738+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="fun"/><title type='text'>Google Nexus One</title><content type='html'>Two days back I bought my android phone in US. Cant wait to get hands on it. Here are few pics of it.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG1zm9_E7VL8TlCziYLtl0rqwKYTE5UaCkOLlBesHpSwyirctHK0RLZku-8yERD5kdFigXypwGzU2rzBeodqvx1pAOBKPEei-h-z1FjH3tNEwsh64UM_bgrJGZRV2rCffRqeBkhIO7YahT/s1600-h/IMG_2503.JPG&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 213px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG1zm9_E7VL8TlCziYLtl0rqwKYTE5UaCkOLlBesHpSwyirctHK0RLZku-8yERD5kdFigXypwGzU2rzBeodqvx1pAOBKPEei-h-z1FjH3tNEwsh64UM_bgrJGZRV2rCffRqeBkhIO7YahT/s320/IMG_2503.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5424640466231626546&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOhKG5-j_eYSgok4gxdDx3M-HDRvamRPQPXFG6nYAqUvvGaS2F_w9YF8TAxbjD9q4UxUqS1NearU6uyzjotPUGUB_5p2lOpTKG15JFqsAvwdjhKjMWoeP8vYgGS_7zkCQD2Tfu0OxElRsi/s1600-h/IMG_2504.JPG&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 213px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOhKG5-j_eYSgok4gxdDx3M-HDRvamRPQPXFG6nYAqUvvGaS2F_w9YF8TAxbjD9q4UxUqS1NearU6uyzjotPUGUB_5p2lOpTKG15JFqsAvwdjhKjMWoeP8vYgGS_7zkCQD2Tfu0OxElRsi/s320/IMG_2504.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5424639947200187730&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The most astonishing thing is that it got 1 GHz CPU while most of the smart phones in current generation are around 528 MHz thats big advantage and its got bigger screen. For screen bigger the better. It also has Flash Player, significant factor over IPHONE 3GS.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Tech Specifications. For details spec see : &lt;/span&gt;&lt;a style=&quot;font-weight: bold;&quot; href=&quot;http://www.google.com/phone/static/en_US-nexusone_tech_specs.html&quot;&gt;Google Site&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Processor Qualcomm QSD 8250 1 GHz&lt;/li&gt;&lt;li&gt;Android Mobile Technology Platform 2.1 (Eclair)&lt;/li&gt;&lt;li&gt;512MB Flash 512MB RAM 4GB Micro SD Card (Expandable to 32 GB)&lt;/li&gt;&lt;li&gt;Display 3.7-inch (diagonal) widescreen WVGA AMOLED touchscreen 800 x 480 pixels&lt;/li&gt;&lt;li&gt;Camera 5 megapixels Autofocus LED flash with Video captured at 720x480 pixels at 20 fps&lt;/li&gt;&lt;li&gt;3G : UMTS Band 1/4/8 (2100/AWS/900)&lt;/li&gt;&lt;lilgsm edge=&quot;&quot; 1900=&quot;&quot;&gt;&lt;li&gt;Wi-Fi (802.11b/g)&lt;/li&gt;&lt;li&gt;Bluetooth 2.1 + EDR&lt;/li&gt;&lt;/lilgsm&gt;&lt;/ul&gt;There have been lot of speculation about google&#39;s entry in Mobile Phone market. Everybody is speculating &quot;how still google not able to deliver a Iphone-killer&quot; since Nexus One still will be be at par with iphone when it comes to user experience especially applications but for Giant google the achievement is launch of url : google.com/phone. Here is detailed blog about it : &lt;a href=&quot;http://arstechnica.com/gadgets/news/2010/01/googles-big-news-today-was-not-a-phone-but-a-url.ars?utm_source=rss&amp;amp;utm_medium=rss&amp;amp;utm_campaign=rss&quot;&gt;Google&#39;s URL&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5122151741958657649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/5122151741958657649' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5122151741958657649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5122151741958657649'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/01/google-nexus-one.html' title='Google Nexus One'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG1zm9_E7VL8TlCziYLtl0rqwKYTE5UaCkOLlBesHpSwyirctHK0RLZku-8yERD5kdFigXypwGzU2rzBeodqvx1pAOBKPEei-h-z1FjH3tNEwsh64UM_bgrJGZRV2rCffRqeBkhIO7YahT/s72-c/IMG_2503.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-1784570607294549729</id><published>2009-08-22T16:11:00.015+05:30</published><updated>2009-09-09T16:27:21.296+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="clustering"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="terracotta"/><title type='text'>Querying Java Objects stored in Terracotta&#39;s NAM Part 3</title><content type='html'>&lt;a href=&quot;http://tusharkhairnar.blogspot.com/2009/04/querying-java-objects-stored-in.html&quot;&gt;First&lt;/a&gt; and &lt;a href=&quot;http://tusharkhairnar.blogspot.com/2009/05/querying-java-objects-stored-in.html&quot;&gt;Second part&lt;/a&gt; of this series I talked about Querying data structures available in Java. First part specifically talked about existing ones like JoSQL, JxPath and Quaere and discussed indexing problem. Second part specifically talked about lucene and jofti as indexing frameworks and wrote small framework to test and get some performance numbers. This test showed that B-tree index (memory and possibly disk based) is suitable and not lucene index. Third part of this series now I am discussing my own small framework- &lt;a href=&quot;http://code.google.com/p/tc-querymap/&quot;&gt;tcquerymap&lt;/a&gt; which is rewrite of Jofti. Jofti is old and not maintained and uses jdk14 libraries. Now even documentation link does not work : http://prism-index.com/guide.html.&lt;br /&gt;&lt;br /&gt;querymap documentation link : &lt;a href=&quot;http://code.google.com/p/tc-querymap/wiki/GettingStartedWithQuerymap&quot;&gt;Getting Started With Querymap&lt;/a&gt;&lt;br /&gt;querymap source download : &lt;a href=&quot;http://tc-querymap.googlecode.com/files/querymap-eclipse.tar.gz&quot;&gt;Complete Source Code with Eclipse Project&lt;/a&gt;&lt;br /&gt;querymap TIM : Copy &lt;a href=&quot;http://tc-querymap.googlecode.com/files/querymap-1.0-1.0.0-SNAPSHOT.jar&quot;&gt;this&lt;/a&gt; TIM to terracotta modules directory to use it&lt;br /&gt;querymap terracotta sample app : &lt;a href=&quot;http://tc-querymap.googlecode.com/files/querymap-sample-eclipse.tar.gz&quot;&gt;Download sample eclipse App.&lt;/a&gt; You can use Terracotta eclipse plugin to launch it within eclipse&lt;br /&gt;&lt;br /&gt;So the basic idea is maintaining in-memory indexes which index String Ids with &quot;Comparable&quot; as Keys. All primitive wrappers in Java implement this interface so no special conversion is needed.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;br /&gt;How it works&lt;/span&gt;&lt;br /&gt;It scans java objects and makes comparable objects for each of the property mentioned to be indexed. It inserts these comparable objects in its own tree against String Ids assigned to the java object. So in-effect its nothing more than maintaining many in-memory Maps. In fact the implementation that I wrote uses JDK TreeMap and not b-tree map. But in-future it will be replaced by more performant B-tree.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Querying&lt;/span&gt;&lt;br /&gt;One needs to understand that with in-memory object indexes its only possible to implement subset of SQL query and no join queries. To start with, small framework only implements following operations : arithmetic operands : &lt;,&gt;,&lt;=,&gt;=,==. Logical operands :  AND , OR. Range : BETWEEN, Set : IN&lt;br /&gt;&lt;br /&gt;To implement querying SQL parser needs to be implemented. I choose to avoid writing parser and implemented direct API kind of querying similar to Quaere. I find Domain specific languages more intuitive since when developer writes code for it he know what querying he writes. So interface looks like below. It is not as good as quaere. Quaere is DSL, below API is just few interfaces implemented. Here execute returns List of IDs put into index against the properties.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt; import static com.google.code.querymap.ObjectQuery.*;&lt;br /&gt;&lt;br /&gt; Collection&lt;string&gt; col = from(Domain.class).where(&lt;br /&gt;     gt(&quot;inner.property2&quot;, 60),&lt;br /&gt;     lt(&quot;inner.property2&quot;,89)&lt;br /&gt;     eq(&quot;inner.property3&quot;,random.nextInt(NUM_OBJECTs))&lt;br /&gt;     ).execute();&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;So basically it is equivalent of follwing SQL&lt;br /&gt;&lt;code&gt;&lt;br /&gt; select from Domain&lt;br /&gt;  where inner.property2 &gt; 60&lt;br /&gt;  and inner.property2 &lt; property3=rand(NUM_OBJECTS)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;How it performs&lt;/span&gt;&lt;br /&gt;Naturally is not as performant as Jofti since it used JDK tree map which uses red-black tree. In future when I complete writing my own b-tree implementation I expect to perform as good as Jofti. Jofti further implemented node level locking so multiple concurrent insert opertations can work parellel. This can also be implemented too. But query performance is not bad and I expect it to improve with b-tree implementation.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;br /&gt;Integration with Terracotta&lt;/span&gt;&lt;br /&gt;Since it uses TreeMap it is cluster-able easily. Attached tc-config.xml has all correct declarations for it. One more advantage is with Terracotta is that object identifier are readily generated by Terracotta. See implementation TerracottaQueryMap. Please dont compare performance of TerracottaQueryMap against HashMap, CHM or Terracotta Distributed Map(Concurrent String Map old name) since all these are just single index maps so easy to stripe or employ mulitple locks.&lt;br /&gt;&lt;br /&gt;For using it as TIM you need to add following lines to tc-config.xml&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    &amp;lt;modules&amp;gt;&lt;br /&gt;       &amp;lt;module id=&quot;com.google.code&quot; name=&quot;querymap-1.0&quot; version=&quot;1.0.0&quot;&amp;gt;&lt;br /&gt;    &amp;lt;/module&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In code you can use it as queryable map as follows. Here propList is list of properties to be indexed.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; TerracottaQueryMap&lt;string, domain=&quot;&quot;&gt; map =  new TerracottaQueryMap(Domain.class,proplist));&lt;br /&gt; &lt;br /&gt; map.put(key,domain1);&lt;br /&gt; map.put(key,domain2);&lt;br /&gt; map.put(key,domain3);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;To Query.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; Collection&lt;domain&gt; col =map.entrySet(&lt;br /&gt;        from(Domain.class).&lt;br /&gt;        where(&lt;br /&gt;         eq(&quot;inner.property2&quot;,random.nextInt(NUM_OBJECTs))&lt;br /&gt;         )&lt;br /&gt;        );&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Future directions planned&lt;/span&gt;&lt;br /&gt;Java has hugh limitation for memory intensive application. So achieve scale two approaches : partition index and merge results or use disk to overflow index pages. Other thing I see can be implemented is that when query selects random elements these random elements need to be faulted from Terracotta server thus degrading performance, same elements can be read from local store too like EHCACHE. Later on this topic separately.&lt;br /&gt;&lt;br /&gt;If you think this framework is useful please let me know. You can download its source as Eclipse project(sole dependency on tc.jar) and as Terracotta Integration Module here.&lt;br /&gt;&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/1784570607294549729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/1784570607294549729' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1784570607294549729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1784570607294549729'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/08/querying-java-objects-stored-in.html' title='Querying Java Objects stored in Terracotta&#39;s NAM Part 3'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8983118437734270228</id><published>2009-07-10T22:21:00.008+05:30</published><updated>2009-07-10T22:38:01.603+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="erlang"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><title type='text'>Erlang and Concurrency</title><content type='html'>Here I write a lot about my experiments with Terracotta which is shared durable memory for Java applications which are multi-threaded. But some days before I came across erlang, language which is created at Erricsson for running fault-tolerant telecom applications. Whats so special about it?. If you google or rather &quot;Bing&quot; it you will find plenty of things about it. How cool and scalable it is?. If you read &lt;a href=&quot;http://zerohedge.blogspot.com/2009/07/is-case-of-quant-trading-industrial.html&quot;&gt;this&lt;/a&gt; you will even come to know How Goldman Sachs was using it to gain significant advantage in program trading over other competitors and how others are trying to steal leaked source code.&lt;br /&gt;&lt;br /&gt;So erlang is not procedural programming language its functional programming language. Frankly I also need to understand whats so different about it. But I saw &lt;a href=&quot;ttp://www.infoq.com/presentations/Erlang-Concurrency-Francesco-Cesarini&quot;&gt;this&lt;/a&gt; presentation of infoQ site about erlang concurrency and was amazed. Right from starting I always thought about following graph - throughput increases as a function of in-coming request rate till some point but after it stabilizes and then it drops. It drops because of system overload. In a perfectly cpu-intensive lock-contention free application this will happen because of cpu context switching. &lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYwefBuhszH07RhajH29wW32z5vD2oonqWv9l_l_l6dbda5fS8hyphenhypheneZ_08JxcqIxcids_bJzlMld7XubqjvRIxlm9nGFrLjF0WdBEjT0LqkW4Go_GSe6zWQhUShA6P-0J53-wAXoqnVPXXt/s1600-h/erlang.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 229px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYwefBuhszH07RhajH29wW32z5vD2oonqWv9l_l_l6dbda5fS8hyphenhypheneZ_08JxcqIxcids_bJzlMld7XubqjvRIxlm9nGFrLjF0WdBEjT0LqkW4Go_GSe6zWQhUShA6P-0J53-wAXoqnVPXXt/s320/erlang.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5356875664514526690&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;But in erlang it stays constant instead your latency (response time) increases. This is according to &lt;a href=&quot;http://tusharkhairnar.blogspot.com/2009/07/erlang-and-concurrency.html&quot;&gt;Little&#39;s Law&lt;/a&gt;. Little law says relation between throughput and latency is number of users in system. N = RX.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://www.sics.se/~joe/images/apachevsyaws.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 640px; height: 450px;&quot; src=&quot;http://www.sics.se/~joe/images/apachevsyaws.jpg&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Above is famous graph of benchmark of YAWS (Http server written in erlang) against Apache and you can see how early apache gets saturated and dies. You can read details &lt;a href=&quot;http://www.sics.se/~joe/apachevsyaws.html&quot;&gt;here&lt;/a&gt;  but explanation is given here is :&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;&quot;The problem with Apache is not related to the Apache code per se but is due to the manner in which the underlying operating system (Linux) implements concurrency. We believe that any system implemented using operating system threads and processes would exhibit similar performance. Erlang does not make use of the underlying OS&#39;s threads and processes for managing its own process pool and thus does not suffer from these limitations.&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So basically all magic is erlang&#39;s concurrency model : No Shared State, Only message passing between light-weight processes. Erlang processes are way lighter than Java Threads since they are logical entities and not tied to user-level or kernel-threads. Thus erlang shows &quot;No Shared State&quot; concurrency model scales well. Since now JVM is touted as platform, I am looking forward to see erlang implementation on JVM and see how it does against other concurrent interpreted languages - scala. This is great &lt;a href=&quot;http://weblog.hypotheticalabs.com/?p=452&quot;&gt;post&lt;/a&gt; why JVM is unfit for such porting. May be Java 8 ( I think closures are not part of Java 7). This is also interesting read about Erlang on Java : &lt;a href=&quot;http://debasishg.blogspot.com/2008/07/erlangs-concurrency-model-on-jvm-can-we.html&quot;&gt;Erlang Concurrency model on JVM&lt;/a&gt; . Some of work on writing OTP(erlang&#39;s sdk for writing applications)  for scala http://github.com/jboner/scala-otp/tree/master/.&lt;br /&gt;&lt;br /&gt;I have already got Programming Erlang book now looking forward to write first program in OTP.&lt;br /&gt;&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8983118437734270228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/8983118437734270228' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8983118437734270228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8983118437734270228'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/07/erlang-and-concurrency.html' title='Erlang and Concurrency'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYwefBuhszH07RhajH29wW32z5vD2oonqWv9l_l_l6dbda5fS8hyphenhypheneZ_08JxcqIxcids_bJzlMld7XubqjvRIxlm9nGFrLjF0WdBEjT0LqkW4Go_GSe6zWQhUShA6P-0J53-wAXoqnVPXXt/s72-c/erlang.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3562420025338051758</id><published>2009-07-09T12:01:00.003+05:30</published><updated>2009-07-09T12:13:45.927+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="links"/><category scheme="http://www.blogger.com/atom/ns#" term="samples"/><category scheme="http://www.blogger.com/atom/ns#" term="terracotta"/><title type='text'>Links : Java Sample Apps</title><content type='html'>Many times you hear or read something cool about some framework or tool and you are interested in Sample application written for it just to play with it, browse and go through source-code to find out how to code it.&lt;br /&gt;&lt;br /&gt;Here is list of great sample Apps that I just stumbled upon while reading this great blog about &lt;a href=&quot;http://jee-bpel-soa.blogspot.com/2009/07/apache-tomcat-clustering-load-balancing.html&quot;&gt;Tomcat Clustering&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Link : &lt;a href=&quot;http://www.mediafire.com/jbs-blog-examples&quot;&gt;http://www.mediafire.com/jbs-blog-examples&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;List is &lt;br /&gt;    * IBM-DB2-JDBC-XML.zip&lt;br /&gt;    * IBM-DB2-JDBC-Relational.zip&lt;br /&gt;    * Google-App-Engine.zip&lt;br /&gt;    * WebServices-JAX-WS-Java-SE.zip&lt;br /&gt;    * RESTful-WebServices-Apache-CXF.zip&lt;br /&gt;    * WebServices-Apache-CXF-Spring-2.5.zip&lt;br /&gt;    * WebServices-Apache-CXF.zip&lt;br /&gt;    * WebServices-WSIT-Reliable-Messaging.zip&lt;br /&gt;    * WebServices-JAX-WS-Web-App-Client-Basic-Security.zip&lt;br /&gt;    * WebServices-JAX-WS-Web-App-Client.zip&lt;br /&gt;    * WebServices-JAX-WS-Web-App.zip&lt;br /&gt;    * PMD-Clover2-Cobertura-Maven2-Test.zip&lt;br /&gt;    * WebServices-JAX-WS.zip&lt;br /&gt;    * WebServices-Axis2-with-Eclipse-client.zip&lt;br /&gt;    * Spring-Maven2-annotations-example.zip&lt;br /&gt;    * Spring-Maven2-basic-example.zip&lt;br /&gt;&lt;br /&gt;I will add following to above lists which I know about&lt;br /&gt;&lt;br /&gt;Terracotta Samples Application written by Team &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Terracotta Reference Application : &lt;a href=&quot;http://terracotta.org/web/display/orgsite/Web+App+Reference+Implementation&quot;&gt;Examinator&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt; &lt;a href=&quot;http://svn.terracotta.org/svn/forge/projects/samples/trunk/samples/sample-spring-ehcache&quot;&gt;Terracotta with Spring and EHCACHE&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;a href=&quot;http://svn.terracotta.org/svn/forge/projects/samples/trunk/samples/sample-spring-hibernate&quot;&gt;Terracotta, Hibernate, Spring&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;a href=&quot;http://svn.terracotta.org/svn/forge/projects/samples/trunk/samples/sample-spring-quartz&quot;&gt;Terracotta, Spring, Hibernate &lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/sample-tc-webapp/&quot;&gt;Sample Web App with Maven, Terracotta&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3562420025338051758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/3562420025338051758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3562420025338051758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3562420025338051758'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/07/links-java-sample-apps.html' title='Links : Java Sample Apps'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-1544890311310766657</id><published>2009-06-29T23:53:00.006+05:30</published><updated>2009-07-08T12:58:39.937+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="terracotta"/><title type='text'>Terracotta&#39;s Hibernate Integration</title><content type='html'>This post is re-post of my earlier write-behind &lt;a href=&quot;http://tusharkhairnar.blogspot.com/2008/12/links-kill-your-database-with.html&quot;&gt;post&lt;/a&gt; but in different perspective : Terracotta&#39;s Hibernate integration 3.1&lt;br /&gt;&lt;br /&gt;With version 3.1 Terracotta has implemented its own Caching for Hibernate Second Level Caching Provider. Earlier Terracotta&#39;s hibernate integration approach was : clustering EHCACHE. Terracotta with its JVM clustering ability, it was easily possible to cluster any POJO structure. So before 3.1, you might have used EHCACHE as hibernate second level cahce provider and tim-hibernate and tim-ehcache for clustering second level cache. With version 3.1 onwards terracotta will have its own cache backed by map-evictor and concurrent string map. Apart from this new hibernate integration has lots of new additions like cache admin console and read-write cache. Cache is always up-to-date and coherent.&lt;br /&gt;&lt;br /&gt;But what I feel is that Terracotta platform is way more capable and following additional features &lt;span style=&quot;font-weight:bold;&quot;&gt;can&lt;/span&gt; be added to make applications more scalable. These are just cool ideas.&lt;br /&gt;&lt;br /&gt;Cache Warm-up feature&lt;br /&gt;It would be nice feature to refresh or load cache whenever application or application cluster is starting up. This can easily be implemented with some sort of CacheLoader interface where Terracotta can callback this interface when faulting cache objects from terracotta server during first access. But such warm-up is only required on full cluster restart otherwise lot of meaningful cache entrites will get overwritten.&lt;br /&gt;&lt;br /&gt;Write-Behind Caching &lt;br /&gt;When you think of cache you will arrive at these cache strategies : Read-Through Caching, Write-Through Caching, Write-Behind Caching. Hibernate Second Level cache is Read-Write-Through Cache where if cache miss occurs, entity is read from database and then handed over to cache for susequent access. But H2LC is not Write-Behind caching. With Terracotta&#39;s disk persistence and asynchronsous module it would be really efficient for certain use-cases to implement write-behind. Currently hibernate just directly writes to database. Instead if its modified to write to second level cache and persistent async-database-queue, this would decrease latency and increase throughput dramatically. Imagine if you can schedule all your database writes in non-business hours using &lt;a href=&quot;http://forge.terracotta.org/releases/projects/tim-async/&quot;&gt;tim-async&lt;/a&gt;. I find write-behind is certainly the best way to reduce pressure on database. And with Terracotta&#39;s clusterwide coherent persistent datastore its practicaly possible. Terracotta would be your database guard taking all your querying as well as database inserts on its shoulders.&lt;br /&gt;But this model would require certain changes in the way hibernate works. especially query cache. Since now Terracotta will have latest snapshot of yor System of Record, queries have to be executed against cache and not database. Thus it can not be generic solution. You can implemented write-behind only in certain cases where your business use case permits it. On the other hand to solve query problem &lt;a href=&quot;http://tusharkhairnar.blogspot.com/2009/05/querying-java-objects-stored-in.html&quot;&gt;Querymap&lt;/a&gt; that i disucssed in my previous posts can be used to query certain type of data. So if your business use case permits write-behind and query-map can give you very fast database accelerator. In one of my previous jobs I was working on financial application where certain set of objects were modified at very high rate and same were queried against. For such application classic replicated H2LC does not bring any value, instead it will degrade the performance due to overhead during frequent-cluster-wide updates. But Terracotta will make it scalable, forwarding updates only to Node on which cache entry exists, updating the object clusterwide so when AsyncProcessor picks it up it will contain all the changes made. Its Terracotta&#39;s DSO Magic.&lt;br /&gt;&lt;br /&gt;Advantage here is that you dont have to do religious shift of &lt;a href=&quot;http://willcode4beer.com/design.jsp?set=kill_your_db&quot;&gt;Killing Your Database&lt;/a&gt; Totally. Database is your System of Record. With Terracotta Hibernate Accerlerator you are only delaying updates to SOR and not replacing it.&lt;br /&gt;&lt;br /&gt;Currently I am going through Hibernate source code and learning how hiberante event mechanism works. My guess is that write-behind can be implemented with hibernate events. If not I may try to modify the source code to add write-behind and h2lc-cache querying capability. Hibernate search is similar where instead of classic session you get Indexing-aware session.&lt;br /&gt;&lt;br /&gt;With &lt;a href=&quot;http://www.terracotta.org/web/display/orgsite/Whats+New+Terracotta+3.0&quot;&gt;Terracotta FX&lt;/a&gt; (assuming your application requires more than 4000 write operations per second - avg throughput of one un-tuned Terracotta server) your write throughput will increase linearly which is not possible with any RDBMS on any type of hardware.&lt;br /&gt;&lt;br /&gt;I hope Terracotta will add these features in coming versions. Terracotta 3.1 Hibernate Integration is just start.</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/1544890311310766657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/1544890311310766657' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1544890311310766657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1544890311310766657'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/06/terracottas-hibernate-integration.html' title='Terracotta&#39;s Hibernate Integration'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-2829888855797900905</id><published>2009-05-25T20:18:00.011+05:30</published><updated>2009-05-26T20:14:49.769+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="clustering"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="terracotta"/><title type='text'>Querying Java Objects stored in Terracotta&#39;s NAM Part 2</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;a href=&quot;http://tusharkhairnar.blogspot.com/2009/04/querying-java-objects-stored-in.html&quot;&gt;First part&lt;/a&gt; of this series, I talked about existing frameworks and  what I found out is that they lack indexing hence rarely useful for large data-sets. So I tried finding out how to do indexing. My idea was simple : index objects and store reference to object in index then with Terracotta you can cluster objects and index as well. So it becomes &quot;queryable&quot; datastore. My first attempt was to find out how indexing is done. By book it says b-tree index. I found out this(jdbm) framework which is trying to do the persistent DB in Java by implementing B-tree indexes on disk.I took only b tree and implemented simple query parser. What it does is that it traverses b-tree and finds out tuples and then returns them.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;After this first attempt, then I experimented with Lucene. Lucene is not tree-index, its inverted index but it has lot of capability and its fast, supports in-memory and disk-based indexes.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;So here is my little framework for queryable datastore :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt; public interface TCQueryMap&lt;T&gt; extends Map&lt;String,T&gt;{&lt;br /&gt;  void init();&lt;br /&gt;  Map&lt;String,T&gt; query(String query);&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Naturally its extension of Map which is single index. My implementation wraps a HashMap with ReadWrite locks and Lucene RAMDirectory index. So all get/puts hit index within lock boundaries and then you can query index. This is very simple, I have not gone into complexities like spill-over of index onto disk etc.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; LuceneIndexingConfig config = new LuceneIndexingConfig();&lt;br /&gt; List&lt;String&gt; propList = new ArrayList&lt;String&gt;();&lt;br /&gt; // index three properties only&lt;br /&gt; propList.add(&quot;accountName&quot;);&lt;br /&gt; propList.add(&quot;person.age&quot;);&lt;br /&gt; propList.add(&quot;person.name.firstName&quot;);&lt;br /&gt; &lt;br /&gt; config.setIndexPropertyList(propList);&lt;br /&gt; &lt;br /&gt; TCQueryMap indexer = new LuceneQueryStore(config);&lt;br /&gt; &lt;br /&gt; // add object&lt;br /&gt; Acccount account .....&lt;br /&gt; indexer.put(&quot;user99&quot;,account);&lt;br /&gt;  &lt;br /&gt; // query object &lt;br /&gt; Map col = indexer.query(&quot;person.age:21&quot;);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I also came to know about Jofti from one of comments. Jotfi is what I would eventually like to write. I don&#39;t know why its not used by many people. One reason could be its not maintained. I found it pretty useful so I plugged in Jofti as well in my framework.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Now lets compare it with simple Hibernate-JDBC based solution. Obviously its not perfect. SQL is way more complex and expressive language. But here we are talking about cached data and I am sure once data is cached ( it means objectified from join query on relational DB)  very few times you will require join, its mostly &quot;where clause&quot; of one or more conditions. Lucene does that very well.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So lets see numbers. I have not done any tuning apart from standard lucene stuff. One of main parameters is how many properties you want to index. This determines index size, memory and speed.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Below is small benchmark showing 60K objects inserts with three properties indexed and then random queries on three properties&lt;br /&gt;&lt;br /&gt;Lucene Inserts/Sec = 1000&lt;br /&gt;Jofti Inserts/Sec = 8793.78&lt;br /&gt;Lucene Queries/Sec = 5172 &lt;br /&gt;Jofti Queries/Sec  =13636.36&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Results for 14 properties indexed :&lt;br /&gt;&lt;br /&gt;Lucene Inserts/Sec = 740&lt;br /&gt;Jofti Inserts/Sec = 4866.96&lt;br /&gt;Lucene Queries/Sec = 3750 &lt;br /&gt;Jofti Queries/Sec  = 12500&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Since Jofti is Tree index it outperforms Lucene Index. The problem with Lucene is that once index gets bigger insert performance slows down. Also these numbers are taken with one commit on one put operation. If you index lot of objects together and then commit, lucene is also fast, that&#39;s how it is to be used - Batch API. On the other hand Jotfi is fast, I could not find any details about being thread-safe and other concurrency issues so I wrapped it around Lock. I don&#39;t know why Jofti is not used by many people.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Also what if you can run Hibernate/JPA queries on Map? that would be great. Its already done by hibernate team. They run query against Second level cache but it would big task to find out and extract idea out of it. Just a thought. Second Level Query cache gets invalidated when you modify single entity, imagine if we update the same object in QueryMap cache you dont need Query cache of course querying capability is not great.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Another thought that comes in my mind is clustering in-memory databases like H2 or HSQLDB. Imagine the benefits of it. But then its &lt;span style=&quot;font-weight:bold;&quot;&gt;anti-terracotta&lt;/span&gt;. Why? it would be Relational DB with baggage of ORM mismatch.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Entire source code you can download it from here : &lt;a href=&quot;http://code.google.com/tc-querymap/&quot;&gt;http://code.google.com/tc-querymap/&lt;/a&gt;. Tar file is just bunch of java files and its very early&lt;br /&gt;prototype. Stay tuned to project, I will update it once I finish with proper integration with Terracotta. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;So if you find it useful please leave comments, I would love to hear from you.</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/2829888855797900905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/2829888855797900905' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/2829888855797900905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/2829888855797900905'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/05/querying-java-objects-stored-in.html' title='Querying Java Objects stored in Terracotta&#39;s NAM Part 2'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4137551665403662605</id><published>2009-05-04T21:15:00.002+05:30</published><updated>2009-05-04T21:36:48.503+05:30</updated><title type='text'>Got one!!</title><content type='html'>Finally I got my own &lt;a href=&quot;http://www.pringoo.com/designdetail/did-5189/1337-1337%20loves%20linux&quot;&gt;I Love Linux T-shirt&lt;/a&gt;, here is snap.&lt;br /&gt;You too can create your own T-shirt with Geeky quotes or any other quotes or picture. I am planning to make another with Ubuntu but waiting/searching for good image apart from standard &quot;Linux for Human Beings&quot;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbpS5VmBdV3jS2rMWLYLFbKuxfhwM9uh4ujLJprxdrms8WNcS5CLuT8re1q7fSRkjs-M8B79krT1UeCPVOPzwCpU3daFFVBiL3SyTSLu420nZ02sPFvpTe7baUmLlregdvXnvUc0bggJ-S/s1600-h/DSC00461.JPG&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 256px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbpS5VmBdV3jS2rMWLYLFbKuxfhwM9uh4ujLJprxdrms8WNcS5CLuT8re1q7fSRkjs-M8B79krT1UeCPVOPzwCpU3daFFVBiL3SyTSLu420nZ02sPFvpTe7baUmLlregdvXnvUc0bggJ-S/s320/DSC00461.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5331999188504166066&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0uxZqQFXISrnc9uG8Jnk4DuEnn4z_c2EJFAbrxL5dEx37AdQfN_dA32dUOao2X3FFy5r_St7qiwsgHVXytAQS3xmdhKQvxMDR5dh7eJaiWbsNyEPK5r-g1a96E0KbknaNuUxgLHA99aVU/s1600-h/DSC00465.JPG&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 256px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0uxZqQFXISrnc9uG8Jnk4DuEnn4z_c2EJFAbrxL5dEx37AdQfN_dA32dUOao2X3FFy5r_St7qiwsgHVXytAQS3xmdhKQvxMDR5dh7eJaiWbsNyEPK5r-g1a96E0KbknaNuUxgLHA99aVU/s320/DSC00465.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5331999196812542002&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4137551665403662605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/4137551665403662605' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4137551665403662605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4137551665403662605'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/05/got-one.html' title='Got one!!'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbpS5VmBdV3jS2rMWLYLFbKuxfhwM9uh4ujLJprxdrms8WNcS5CLuT8re1q7fSRkjs-M8B79krT1UeCPVOPzwCpU3daFFVBiL3SyTSLu420nZ02sPFvpTe7baUmLlregdvXnvUc0bggJ-S/s72-c/DSC00461.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8145869420168997607</id><published>2009-04-15T19:43:00.003+05:30</published><updated>2009-04-15T19:55:48.302+05:30</updated><title type='text'>Portable Ubuntu Rocks</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEoLXLkidl7Jq2D1TrHFRgKJp4937nHFekeWG6tkSqqd2QrAf9eTu_duyrElkCJmQkcgleZpjsa8UDTAIj2T6etrVlaGyp6diX_nCf8AEjUjsCsvF9l5n-A4ZLSuiM_h42thz2jzKPPIKD/s1600-h/portable-ubuntu.JPG&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 200px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEoLXLkidl7Jq2D1TrHFRgKJp4937nHFekeWG6tkSqqd2QrAf9eTu_duyrElkCJmQkcgleZpjsa8UDTAIj2T6etrVlaGyp6diX_nCf8AEjUjsCsvF9l5n-A4ZLSuiM_h42thz2jzKPPIKD/s320/portable-ubuntu.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5324924170435909682&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Years ago (literally 2.5 years ago) I had tried co-linux. At that time it was in  initial stages but was working perfectly in text mode. If you don&#39;t know whats co-linux, its linux distribution which works like Windows Binary. No need to setup Virtaul Machine Emualator and install or add virtual images. This was when I had never heard of Virtualization and I was really amazed of the idea. At that time co-linux had managed some elementary GUI drawing mainly KDE applications (at least i had seen screeshots), it did not work though on my machine. Just minutes before I downloaded portable ubuntu after reading this &lt;a href=&quot;http://lifehacker.com/5195999/&quot;&gt;Post&lt;/a&gt; from LifeHacker. And it works!! just like described. Who needs VMWare and stuff like that if you can work on linux shell as well as Firefox just Alt-Tab apart. Here is screenshot of Portable Ubuntu in action.</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8145869420168997607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/8145869420168997607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8145869420168997607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8145869420168997607'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/portable-ubuntu-rocks.html' title='Portable Ubuntu Rocks'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEoLXLkidl7Jq2D1TrHFRgKJp4937nHFekeWG6tkSqqd2QrAf9eTu_duyrElkCJmQkcgleZpjsa8UDTAIj2T6etrVlaGyp6diX_nCf8AEjUjsCsvF9l5n-A4ZLSuiM_h42thz2jzKPPIKD/s72-c/portable-ubuntu.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5904729625005887624</id><published>2009-04-11T00:28:00.002+05:30</published><updated>2009-04-11T00:29:17.657+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="fun"/><category scheme="http://www.blogger.com/atom/ns#" term="links"/><title type='text'>Links : List of Geeky Quotes</title><content type='html'>Here : http://rafaeltrindade.com.br/2008/09/21/best-geek-quotes/&lt;br /&gt;My Fav is I would love to change the world, but they won’t give me the source code</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5904729625005887624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/5904729625005887624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5904729625005887624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5904729625005887624'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/links-list-of-geeky-quotes.html' title='Links : List of Geeky Quotes'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7635987754314106214</id><published>2009-04-08T20:14:00.001+05:30</published><updated>2009-04-08T20:18:55.641+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><title type='text'>Links : Distributed Hash Tables</title><content type='html'>Nice List of Distributed Key-Value Stores : http://www.metabrew.com/article/anti-rdbms-a-list-of-distributed-key-value-stores/</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7635987754314106214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/7635987754314106214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7635987754314106214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7635987754314106214'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/links-distributed-hash-tables.html' title='Links : Distributed Hash Tables'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7718097340819748968</id><published>2009-04-08T17:11:00.005+05:30</published><updated>2009-04-08T23:45:56.439+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="josql"/><category scheme="http://www.blogger.com/atom/ns#" term="jxpath"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="quaere"/><category scheme="http://www.blogger.com/atom/ns#" term="terracotta"/><title type='text'>Querying Java Objects stored in Terracotta&#39;s NAM</title><content type='html'>This post is inspired from : http://forums.terracotta.org/forums/posts/list/1965.page . Nothing new .. just another word in blogosphere.&lt;br /&gt;&lt;br /&gt;Terracotta is gr8 clustering solution in-fact its platform-level service hence has large number of uses. One of the use is using it as database. Terracotta can never replace database but it can play role of data storage media very well. One of major disadvantage is lack of querying data. Only way you can query data is Map. Map is like single index so if you want to get list of object satisfying some criteria you are required to integrate through entire collection. There are already APIs written for querying java collections. So you can use them with Terracotta NAM.&lt;br /&gt;&lt;br /&gt;When you think about querying there are lot of factors : Query Language, Its Performance - Optimizers, Operations Supported : Select, Update, Delete, Joins&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;JoSQL&lt;/h2&gt;&lt;br /&gt;JoSQL is good API for querying java collections with good documentation. I did small test with 1 million objects and random query took around 800ms which is way too much. Again its simple iteration through collection due to lack of indexes and query execution plan. Problem with Indexes is that Object graphs can change and at every change you are required to recompute the index which would be difficult to do : as complex as Terracotta&#39;s bytecode instrumentation. You can find test code &lt;a href=&quot;http://tushar.khairnar.googlepages.com/josql.zip&quot;&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Query Language : Moderately good, Performance : Not good for large collections, No update or delete only select projection queries. No joins&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Quaere&lt;/h2&gt;&lt;br /&gt;Quaere is a very flexible DSL that lets you perform a wide range of queries against any data structure that is an array, or implements the java.lang.Iterable. Its sort of port of LINQ of .Net world. I think linq is next generation data quering tool -cleaner. Quaere is not query language but query API just like Hiberate Criteria query but more elegant. I really liked quaere - its really powerful its support join operation. You can read this post for details : &lt;a href=&quot;http://andersnoras.com/blogs/anoras/archive/2007/09/14/solving-puzzles-with-quaere.aspx&quot;&gt;Solving Puzzles with Quaere&lt;/a&gt; Its still beta level and not released. One of Queare&#39;s another sister project is its JPA integration. Imagine you could write standard JPA application with Quaere as query language and Terracotta as persistent store. No need of database. But as with JoSQL Quaere is also slow. I mean slower than RDBMS. I did small test with 1 million object similar to JoSQL test and response time was similar to JoSQL. You can download test code &lt;a href=&quot;http://tushar.khairnar.googlepages.com/quaere.zip&quot;&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This &lt;a href=&quot;http://idcmp.linuxstuff.org/2007/12/using-sql-on-java-collections.html&quot;&gt;post&lt;/a&gt; also discusses jmap&#39;s OQL implementation. It uses rhino javascript engine behind with hashtables.I did consider it to port for Terracotta but its custom written for Object Heap Dumps. JxPath is another tool with which you can query java collections using XPath expressions. I did not evaluate JxPath since i felt it will be on similar lines of JoSQL and Quaere, only different flavor. If you have used XPath earlier then this is much easier to use. &lt;br /&gt;&lt;br /&gt;GlazedList is event driven list API specially designed for Swing Applications displaying table and list data. But if you consider List of Objects as table (each object is row and its properties as columns) a proper in-memory index can be maintained for querying. But this applies to only root object level. What if inner object in object graph store in your container changes?. You may then need to update the container whenever object changes. So i guess maintaining in-memory index for java objects is pretty difficult thing to do.&lt;br /&gt;&lt;br /&gt;With such tools i think you can easily query moderate size java collections stored in Terracotta&#39;s durable memory with acceptable response time.&lt;br /&gt;&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7718097340819748968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/7718097340819748968' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7718097340819748968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7718097340819748968'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/querying-java-objects-stored-in.html' title='Querying Java Objects stored in Terracotta&#39;s NAM'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5836327321924331622</id><published>2009-04-07T23:41:00.003+05:30</published><updated>2009-04-08T00:10:36.039+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><title type='text'>Maven : Java Profiling</title><content type='html'>At workplace I use maven extensively. In fact I like maven so much that I am slowly moving lot of java eclipse project into maven project. Maven has very good eclipse plugin which makes integration with Eclipse very easy. You can run maven from eclipse. Maven is really good tool. If you have any specific needs you can write your own plugin. At my previous workplace, senior engineer in my project automated everything (starting jboss servers on remote machine in various environments : testing, perf-testing, integration testing etc. database population, database schema drop/rebuild etc). &lt;br /&gt;&lt;br /&gt;But now I wanted to profile java application which I used to run from maven. One of the best part of maven is dependency management and repository - it builds classpath automatically for you, but then its pain too. If you want to run java application you have to do through Maven. There is exec plugin with which you can run any Application or shell script and there is exec:java with which you can run java Main class. The problem is that exec:java is in same JVM. So you cant run any java agent(-agent) or other things : Specifically Java Profiling. You should make sure you run the application within the same environment/settings.&lt;br /&gt;&lt;br /&gt;So my first task was to get the complete classpath and then launch java with profiler java options. I am using jprofiler which uses JVMTI agent hence you need to append &quot;-agentlib:jprofilerti=port=31757 -Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar&quot; to java command line.&lt;br /&gt;&lt;br /&gt;Here is little shell script through which I managed to do java profiling for maven Project. This will work only for J2SE applications tough!. Frustrating part was variable DYLD_LIBRARY_PATH. I was new to MacOS and was trying with usual LD_LIBRARY_PATH and -agentpath jvm option. Surprisingly -agentpath option should work on MacOS but it didnt work i guess some problem with Jprofiler binary. But lastly i managed to profile my application properly. &lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;mvn dependency:build-classpath -Dmdep.outputFile=mycp.txt&lt;br /&gt;export CLASSP=`cat ./mycp.txt`&lt;br /&gt;export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/jprofiler5/bin/macos&lt;br /&gt;$JAVA_HOME/bin/java -cp $CLASSP:./target/classes -agentlib:jprofilerti=port=31757 -Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar $*&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;This is the first time I had to do away with maven command. I wished somebody had written maven plugin for lauching jprofiler enabled apps. There is maven plugin for Yourkit Java Profiler : http://code.google.com/p/maven-yourkit-plugin/ but it did now work.</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5836327321924331622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/5836327321924331622' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5836327321924331622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5836327321924331622'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/maven-java-profiling.html' title='Maven : Java Profiling'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5802125633345673383</id><published>2009-03-09T15:10:00.002+05:30</published><updated>2009-03-09T15:18:16.661+05:30</updated><title type='text'>Links : What is REST?</title><content type='html'>I needed to learn about REST interface and wanted some good article for learning basics of REST : REpresentational State Transfer. This article : &lt;a href=&quot;http://www.infoq.com/articles/rest-introduction&quot;&gt;A Brief Introduction to REST&lt;/a&gt; is really the best one I found so thought of sharing it with you. REST is really nice idea of further simplifying the modeling of web-applications. I implemented by REST program with JSON and my client is in Javascript which is really cool (People are writing entire web based OS and here i am playing with simple java script stuff :-) ) With help of java-script libraries you can easily achieve data binding : like FLEX and other RIA. I really enjoyed working with this totally different stuff. I will add snippets in coming days.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5802125633345673383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/5802125633345673383' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5802125633345673383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5802125633345673383'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/03/links-what-is-rest.html' title='Links : What is REST?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5785192661007799922</id><published>2009-02-26T15:10:00.002+05:30</published><updated>2009-02-26T15:18:04.107+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="links"/><category scheme="http://www.blogger.com/atom/ns#" term="student"/><title type='text'>Links : Things I Wish I’d Been Told</title><content type='html'>When I look back in my engineering days and now, I certainly figured out one thing : Whatever they teach in class hardly matters - the syllabus is totally outdated. What matters is that how you learn new things quickly, be updated in this fast moving world of technology. &lt;br /&gt;&lt;br /&gt;Here I am sharing a link I Wish I’d Been Told, when I graduated with computer science engineering degree. &lt;a href=&quot;http://www.ir.bbn.com/~craig/things-i-wish.html&quot;&gt;Tips For Students with a Bachelors in Computer Science&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5785192661007799922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/5785192661007799922' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5785192661007799922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5785192661007799922'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/02/links-things-i-wish-id-been-told.html' title='Links : Things I Wish I’d Been Told'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8844106946874748114</id><published>2009-02-14T21:15:00.003+05:30</published><updated>2009-02-14T21:26:40.345+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="fun"/><category scheme="http://www.blogger.com/atom/ns#" term="youtube"/><title type='text'>Funny Tech Videos : Part 5</title><content type='html'>Geeky Valentine .. for bloggers and twiters.&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/XbfXUrtnynE&amp;hl=en&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/XbfXUrtnynE&amp;hl=en&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Happy Valentine Days May all you get linklove that you deserve.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8844106946874748114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/8844106946874748114' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8844106946874748114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8844106946874748114'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/02/funny-tech-videos-part-5.html' title='Funny Tech Videos : Part 5'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3590341883850828425</id><published>2009-02-14T20:22:00.004+05:30</published><updated>2009-02-14T21:27:07.623+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="youtube"/><title type='text'>Download Your Favorite Youtube Videos in Batch</title><content type='html'>Last week &lt;a href=&quot;http://www.zeemarathi.com/SRGMPLittleChamps2008/default.htm&quot;&gt;SRGMAP - LC&lt;/a&gt; ( Sa-Re-Ga-Ma-Pa Marathi Little Champs) singing contest for children finished. These children are really are talented and boy, crowd loved every performance from them. From long time this was the only show that I wanted to watch every episode of it and did not miss much initially. But when I moved out for my job I was missing it but then this guy &lt;a href=&quot;http://www.youtube.com/profile?gl=IN&amp;hl=en-GB&amp;user=ahonkan&amp;view=videos&quot;&gt;&quot;ahonkan&quot;&lt;/a&gt; made sure i at least get to see performance of these god gifted children. Thanks a million ahonkan .. there will countless others like me.  Now competition is over I thought of downloading all videos and keeping copy of it for as my personal collection. Initially I thought I will write my small program in java where I will download the user specific feeds, playlists, Chanel and the via youtube API i will download all FLV files. But then I did came across this  great program. : 1-Click Youtube Downloaded. It allows you download and match bunch of videos It allows you donwload and match bunch of videos from youtube.&lt;br /&gt;&lt;br /&gt;Below is the video from 1-Click which shows you how to download videos using this program.&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/pPUjRNllId4&amp;hl=en&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/pPUjRNllId4&amp;hl=en&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;great stuff. may be older but still good enough for another word in blogo-sphere.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note : Videos uploaded on youtube could be subject to copyright and may be illegal. Here I am only writing about the useful computer program. Make sure you know what you are downloading. Thanks&lt;br /&gt;&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3590341883850828425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/3590341883850828425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3590341883850828425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3590341883850828425'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/02/download-your-favorite-youtube-videos.html' title='Download Your Favorite Youtube Videos in Batch'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-6709306930145012542</id><published>2009-01-26T17:35:00.002+05:30</published><updated>2009-01-26T17:37:55.159+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="fun"/><category scheme="http://www.blogger.com/atom/ns#" term="tech"/><category scheme="http://www.blogger.com/atom/ns#" term="youtube"/><title type='text'>Funny Videos Part 4</title><content type='html'>Here is another tech video : She&#39;s An Engineer, soft song&lt;br /&gt;&lt;br /&gt;Could not grasp entire lyrics but here is some part of first para.&lt;br /&gt;&lt;br /&gt;Ah the way I&#39;m feeling now we could lick the world&lt;br /&gt;cause you know I&#39;m always dreaming about you girl&lt;br /&gt;I&#39;ve been testing out your structure and found it sound&lt;br /&gt;Been installing all our circuits on solid ground&lt;br /&gt;Ah the way I&#39;m feeling now we could take it on&lt;br /&gt;Turn it in our favor and get it on&lt;br /&gt;Generating answers and getting speed&lt;br /&gt;You&#39;ve got to run it with the fun of it and take it cause&lt;br /&gt;She&#39;s an engineer&lt;br /&gt;We don&#39;t have much to fear&lt;br /&gt;Ghost in the computer&lt;br /&gt;Ghost goes in sie puter&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/0znwavPhRc8&amp;hl=en&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/0znwavPhRc8&amp;hl=en&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/embed&gt;&lt;/object&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/6709306930145012542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/6709306930145012542' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/6709306930145012542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/6709306930145012542'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/01/funny-videos-part-4.html' title='Funny Videos Part 4'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-354280099299236418</id><published>2009-01-23T11:23:00.002+05:30</published><updated>2009-01-23T11:36:18.946+05:30</updated><title type='text'>Free Collaboration Software : Mikogo</title><content type='html'>I just used free collaboration software &lt;a href=&quot;http://www.mikogo.com/Welcome.aspx&quot;&gt;Mikogo&lt;/a&gt;. At work place I used WebEX : the default choice but at home I needed to collaborate : basically share screen, show some demos, slides. With content sharing you also need to speak : i used skype for that. For screen sharing I searched google and Mikogo was the first result. It the on of the nest free software I have encountered : No hidden features, nearly all of features : like giving control to other participants, see other participants screen are present.&lt;br /&gt;It also has &lt;a href=&quot;https://extras.skype.com/1672/view&quot;&gt;integration with skype&lt;/a&gt; which i did not used but will use for my next meeting. I initially assumed there will be some cap on either on duration on participants but our meeting well last 2 and half hours. In fact we spent 10 minutes in finding and testing out features of Mikogo.&lt;br /&gt;&lt;br /&gt;Who needs WebEX? certainly for personal Mikogo is the best.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/354280099299236418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/354280099299236418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/354280099299236418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/354280099299236418'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/01/free-collaboration-software-mikogo.html' title='Free Collaboration Software : Mikogo'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7416413854901268733</id><published>2009-01-04T22:47:00.005+05:30</published><updated>2009-01-05T00:33:36.228+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="terracotta"/><title type='text'>CountDownLatch for Terracotta</title><content type='html'>With Java 5, java has inbuilt concurrency library in java.concurrent with classes like CountDownLatch, CylcicBarrier, FutureTask, ExecutorService, LinkedBlockingQueue, ConcurrentHashMap, ReentrantReadWriteLock, which greatly simplifies writing multi-threaded applications. With increasing number of cores you need to write applications which are  multi-threaded. With Terracotta this further makes really simple to run such application across more than one JVM effectively giving you more number of threads with slight degradation of performance but near-linear scalability. Terracotta supports some important data structures of &quot;java.utl.concurrent&quot; out of the box these are mainly : LinkedBlockingQueue, ExecutorService, CycliBarrier., FutureTask and of course Locks.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Below I am presenting one more addition to this library : CountDownLatch. CountDownLatch is used to co-ordinate between threads. You pass number of threads in constructor and each  thread then calls countDown() method. When you want to get notified that all threads have finished their work you call await() method. This method will wait till all parties have finished and called countDown() method. If you want to write such code in Terracotta enabled applicaiton you have to use CyclicBarrier where each thread calls await() method. But this will cause finished threads to unnecessarily block on barrier. By using CountDownLatch you can &quot;countdown&quot; and exit the thread thus only master or co-ordinator thread needs to block.&lt;br /&gt;&lt;br /&gt;Logic implemented is very simple - initiate with number of parties. decrease the counter in countDown method, when reached to zero notify all waiting threads and in await() method &quot;wait()&quot; on object till count is reached to zero.&lt;br /&gt;&lt;br /&gt;Below is the source code for it. You need to put class MyCountDownLatch in instrumented classes section as well as define write-lock for the await() and countDown() method. You can download the source-code for the same &lt;a href=&quot;http://tushar.khairnar.googlepages.com/tc-countDownLatch.jar&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Main Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;br /&gt;&lt;br /&gt;public class MyCountdownLatch {&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	int count = -1;&lt;br /&gt;	public MyCountdownLatch(int count)&lt;br /&gt;	{&lt;br /&gt;		this.count = count;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	public synchronized void countDown()&lt;br /&gt;	{&lt;br /&gt;		count--;&lt;br /&gt;		if (count == 0) { notifyAll();  }&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	public synchronized void reset(int count)&lt;br /&gt;	{&lt;br /&gt;		this.count = count;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	public synchronized void await() throws InterruptedException &lt;br /&gt;	{&lt;br /&gt;        if (count == 0) { notifyAll(); return; }&lt;br /&gt;        else { &lt;br /&gt;        	while(count &gt; 0)&lt;br /&gt;        		{&lt;br /&gt;        			wait(); &lt;br /&gt;        		}&lt;br /&gt;        }&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Test Class TestCountDownLatch&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;br /&gt;import java.util.Random;&lt;br /&gt;&lt;br /&gt;public class TestCountDownLatch {&lt;br /&gt;	&lt;br /&gt;	public static int N=10;&lt;br /&gt;	&lt;br /&gt;	public static MyCountdownLatch startSignal = null;;&lt;br /&gt;	 public static MyCountdownLatch doneSignal = null;	&lt;br /&gt;	&lt;br /&gt;	 private static Object lock = new Object();&lt;br /&gt;	 &lt;br /&gt;	public static void main(String[] args) {&lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		Runnable runs[] = new Runnable[N];&lt;br /&gt;		&lt;br /&gt;		if(startSignal==null)&lt;br /&gt;		{&lt;br /&gt;			synchronized (lock) {&lt;br /&gt;				startSignal = new MyCountdownLatch(1);&lt;br /&gt;				doneSignal = new MyCountdownLatch(N);	&lt;br /&gt;			}&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		 for(int i=0;i&lt;N;i++)&lt;br /&gt;		 {&lt;br /&gt;			runs[i] = new Worker(startSignal,doneSignal);&lt;br /&gt;			new Thread(runs[i]).start();&lt;br /&gt;		 }&lt;br /&gt;		 &lt;br /&gt;		 startSignal.countDown();&lt;br /&gt;		 try {&lt;br /&gt;			doneSignal.await();&lt;br /&gt;		} catch (InterruptedException e) {&lt;br /&gt;			&lt;br /&gt;			e.printStackTrace();&lt;br /&gt;		} &lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		System.out.println(&quot;All thread finished ...&quot;);&lt;br /&gt;		&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	public static class Worker implements Runnable&lt;br /&gt;	{&lt;br /&gt;		MyCountdownLatch startSignal = null;&lt;br /&gt;		MyCountdownLatch doneSignal = null;&lt;br /&gt;	&lt;br /&gt;		public Worker(MyCountdownLatch startSignal, MyCountdownLatch doneSignal)&lt;br /&gt;		{&lt;br /&gt;			this.startSignal = startSignal;&lt;br /&gt;			this.doneSignal = doneSignal;&lt;br /&gt;			&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		public void run()&lt;br /&gt;		{&lt;br /&gt;			System.out.println(&quot;Waiting for start signal...&quot;);&lt;br /&gt;			try {&lt;br /&gt;				startSignal.await();&lt;br /&gt;			} catch (InterruptedException e) {&lt;br /&gt;				&lt;br /&gt;				e.printStackTrace();&lt;br /&gt;			}&lt;br /&gt;	        doWork();&lt;br /&gt;	        doneSignal.countDown();&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		public void doWork()&lt;br /&gt;		{&lt;br /&gt;			System.out.println(&quot;Starting to work now&quot;);&lt;br /&gt;			Random random = new Random();&lt;br /&gt;			try {&lt;br /&gt;				Thread.sleep(random.nextInt(2000));&lt;br /&gt;			} catch (InterruptedException e) {&lt;br /&gt;				// TODO Auto-generated catch block&lt;br /&gt;				e.printStackTrace();&lt;br /&gt;			}&lt;br /&gt;			System.out.println(&quot;Completd work&quot;);&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Config file tc-config.xml&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;xml&quot; name=&quot;code&quot;&gt;&lt;br /&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;&amp;lt;tc:tc-config xsi:schemaLocation=&quot;http://www.terracotta.org/schema/terracotta-4.xsd&quot; xmlns:tc=&quot;http://www.terracotta.org/config&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&amp;gt;&lt;br /&gt;  &amp;lt;servers&amp;gt;&lt;br /&gt;    &amp;lt;server host=&quot;localhost&quot; name=&quot;tc-srv01&quot; bind=&quot;0.0.0.0&quot;&amp;gt;&lt;br /&gt;      &amp;lt;data&amp;gt;%(user.home)/terracotta/server-data1&amp;lt;/data&amp;gt;&lt;br /&gt;      &amp;lt;logs&amp;gt;%(user.home)/terracotta/server-logs1&amp;lt;/logs&amp;gt;&lt;br /&gt;      &amp;lt;dso-port&amp;gt;9510&amp;lt;/dso-port&amp;gt;&lt;br /&gt;      &amp;lt;jmx-port&amp;gt;9520&amp;lt;/jmx-port&amp;gt;&lt;br /&gt;      &amp;lt;l2-group-port&amp;gt;9530&amp;lt;/l2-group-port&amp;gt;&lt;br /&gt;      &amp;lt;dso&amp;gt;&lt;br /&gt;        &amp;lt;garbage-collection&amp;gt;&lt;br /&gt;          &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br /&gt;          &amp;lt;interval&amp;gt;300&amp;lt;/interval&amp;gt;&lt;br /&gt;          &amp;lt;verbose&amp;gt;true&amp;lt;/verbose&amp;gt;&lt;br /&gt;        &amp;lt;/garbage-collection&amp;gt;&lt;br /&gt;      &amp;lt;/dso&amp;gt;&lt;br /&gt;    &amp;lt;/server&amp;gt;&lt;br /&gt;  &amp;lt;/servers&amp;gt;&lt;br /&gt;  &amp;lt;clients&amp;gt;&lt;br /&gt;    &amp;lt;logs&amp;gt;%(user.home)/terracotta/client-logs1/&amp;lt;/logs&amp;gt;&lt;br /&gt;    &amp;lt;statistics&amp;gt;%(user.home)/terracotta/server-statistics-%D&amp;lt;/statistics&amp;gt;&lt;br /&gt;  &amp;lt;/clients&amp;gt;&lt;br /&gt;  &amp;lt;application&amp;gt;&lt;br /&gt;    &amp;lt;dso&amp;gt;&lt;br /&gt;    &amp;lt;instrumented-classes&amp;gt;&lt;br /&gt;        &amp;lt;include&amp;gt;&lt;br /&gt;          &amp;lt;class-expression&amp;gt;*..*&amp;lt;/class-expression&amp;gt;&lt;br /&gt;        &amp;lt;/include&amp;gt;&lt;br /&gt;      &amp;lt;/instrumented-classes&amp;gt;&lt;br /&gt;      &amp;lt;roots&amp;gt;&lt;br /&gt;        &amp;lt;root&amp;gt;&lt;br /&gt;          &amp;lt;field-name&amp;gt;TestCountDownLatch.startSignal&amp;lt;/field-name&amp;gt;&lt;br /&gt;        &amp;lt;/root&amp;gt;&lt;br /&gt;        &amp;lt;root&amp;gt;&lt;br /&gt;          &amp;lt;field-name&amp;gt;TestCountDownLatch.doneSignal&amp;lt;/field-name&amp;gt;&lt;br /&gt;        &amp;lt;/root&amp;gt;&lt;br /&gt;      &amp;lt;/roots&amp;gt;&lt;br /&gt;      &amp;lt;locks&amp;gt;&lt;br /&gt;        &amp;lt;autolock&amp;gt;&lt;br /&gt;          &amp;lt;method-expression&amp;gt;* MyCountdownLatch.countDown(..)&amp;lt;/method-expression&amp;gt;&lt;br /&gt;          &amp;lt;lock-level&amp;gt;write&amp;lt;/lock-level&amp;gt;&lt;br /&gt;        &amp;lt;/autolock&amp;gt;&lt;br /&gt;        &amp;lt;autolock&amp;gt;&lt;br /&gt;          &amp;lt;method-expression&amp;gt;* MyCountdownLatch.await(..)&amp;lt;/method-expression&amp;gt;&lt;br /&gt;          &amp;lt;lock-level&amp;gt;write&amp;lt;/lock-level&amp;gt;&lt;br /&gt;        &amp;lt;/autolock&amp;gt;&lt;br /&gt;      &amp;lt;/locks&amp;gt;&lt;br /&gt;    &amp;lt;/dso&amp;gt;&lt;br /&gt;  &amp;lt;/application&amp;gt;&lt;br /&gt;&amp;lt;/tc:tc-config&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7416413854901268733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4556017295143623721/7416413854901268733' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7416413854901268733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7416413854901268733'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/01/countdownlatch-for-terracotta.html' title='CountDownLatch for Terracotta'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>