<?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: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-3584889867142519041</id><updated>2012-01-17T21:46:59.440-08:00</updated><category term='encrypting'/><category term='Mobile software'/><category term='crystal v 1.0'/><category term='Desktop'/><category term='Software Engineering'/><category term='engineer'/><category term='bug'/><category term='splay tree'/><category term='data structure'/><category term='free'/><category term='profiler'/><category term='singleton'/><category term='crystal'/><category term='hash'/><category term='spell suggestions'/><category term='disk'/><category term='Windows'/><category term='algorithms'/><category term='good coding'/><category term='Google spell suggestions'/><category term='MDA'/><category term='Code'/><category term='encryption'/><category term='android programming'/><category term='charles petzold'/><category term='spell corrector'/><category term='spell checker'/><category term='pkcs12'/><category term='allspark'/><category term='PDA'/><category term='doodle'/><category term='server 2008'/><category term='performance'/><category term='development environment'/><category term='hashing'/><category term='spell correction'/><category term='scatter'/><category term='xml'/><category term='agile practices'/><category term='lego'/><category term='java'/><category term='controls'/><category term='security'/><category term='longest common subsequence'/><category term='store'/><category term='inflate'/><category term='Six Sigma'/><category term='huffmann tree'/><category term='algorithm'/><category term='cloud'/><category term='concurrency'/><category term='brick'/><category term='HTC Software'/><category term='java security on android'/><category term='encrypting text editor'/><category term='Netbeans'/><category term='crystal v1.0'/><category term='editor'/><category term='android'/><category term='text'/><category term='Agile'/><category term='string representation'/><category term='view'/><category term='Nxt2.0'/><category term='Software development'/><category term='coding'/><category term='android user interface'/><category term='fun'/><category term='Xming'/><category term='run times'/><category term='bit vector'/><category term='McIlroy'/><category term='tree'/><category term='Hidden language'/><category term='prototype'/><category term='Shopping Software'/><category term='computing'/><category term='solution design'/><category term='horner'/><category term='OS'/><category term='lejos'/><category term='Unix'/><category term='spell suggester signature'/><category term='activity'/><category term='cryptography'/><category term='Shop Easy'/><category term='java security'/><category term='java concurrency'/><category term='passwords'/><category term='krishna swamy'/><category term='search engine'/><category term='serialization'/><category term='dynamic programming'/><category term='splay tree vs binary search tree'/><category term='walking mechanism'/><category term='advanced data structures'/><category term='complexity'/><category term='encrypted text editor linux'/><category term='voice search'/><category term='compression'/><category term='design pattern'/><category term='computer Software'/><category term='VM'/><category term='layout resources'/><category term='IT project management'/><category term='analysis'/><category term='Microsoft Windows Mobile'/><category term='explanation cloud computing'/><category term='user interface'/><category term='tuning'/><category term='Software'/><category term='layout'/><category term='spell'/><category term='mindstorms'/><category term='harisankar krishna swamy'/><category term='android activity'/><category term='string encoding'/><category term='huffman'/><category term='adjusting width tablelayout'/><category term='visual programming language'/><category term='cloud computing'/><category term='krishna'/><category term='implement search engine'/><category term='robotics'/><category term='programming'/><category term='text editor with encryption'/><category term='engine'/><category term='knuth'/><category term='Shopping list'/><category term='table layout'/><category term='swamy'/><category term='jvm'/><category term='Google'/><category term='harisankar'/><category term='bks'/><category term='computer hardware'/><category term='compound controls'/><category term='lazy initialization'/><category term='MFC'/><category term='data structures'/><category term='Windows Mobile software'/><category term='alpha rex'/><category term='soundex'/><category term='Tries'/><category term='Linux'/><category term='runtime'/><category term='hash function'/><category term='dictionary'/><category term='search'/><category term='scatter algorithm'/><category term='inflator service'/><category term='Process management'/><category term='splay'/><category term='profiling'/><category term='keystore'/><category term='Bentley'/><title type='text'>Programming: Allspark</title><subtitle type='html'>A collection of interesting notes from my experiments, various literature in the field.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-2518629665141793480</id><published>2012-01-17T06:24:00.000-08:00</published><updated>2012-01-17T06:25:44.677-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='data structures'/><category scheme='http://www.blogger.com/atom/ns#' term='advanced data structures'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='profiler'/><category scheme='http://www.blogger.com/atom/ns#' term='splay tree vs binary search tree'/><category scheme='http://www.blogger.com/atom/ns#' term='splay'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='splay tree'/><title type='text'>Splay tree (Super Search Tree) Vs Binary Search Tree</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;In one of the earlier posts I had called for the use of binary search trees for set representation and general search operations. I take it back. Now it is splay trees !.&amp;nbsp;These are very similar to binary search trees but, these ones are balanced binary search trees. A binary search tree gives you log(n) of search and insertion theoretically.&amp;nbsp;This is true only of the keys that are going into the tree are totally random. So if the set of keys { 10, 2, 38, 63, 21, 9, 1} go into a binary search tree then, the tree looks&amp;nbsp;like&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://3.bp.blogspot.com/-QbhdRNEluHY/TxWBiacnYpI/AAAAAAAAFNw/itAGlgrMGfQ/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-QbhdRNEluHY/TxWBiacnYpI/AAAAAAAAFNw/itAGlgrMGfQ/s1600/untitled.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This tree gives you log(n) time on its search. It is balanced too. But, if the application was putting in data in not-so random way then the tree can easily become unbalanced. This&amp;nbsp;can lead to n time search. so if keys were to go in like { 1, 2, 9, 10, 21, 38, 63 }. Then the tree looks like&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://3.bp.blogspot.com/-Na9kdPZXuUE/TxWB-rDSkfI/AAAAAAAAFN4/2pH3-9VZPOc/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-Na9kdPZXuUE/TxWB-rDSkfI/AAAAAAAAFN4/2pH3-9VZPOc/s1600/untitled.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This seems ok with the defenition of the search tree but, if you were searching for 63 then, you need to do 7 comparisons compared to 3 in the previous tree. Also, recently accessed&amp;nbsp;data may be frequently needed. Effectively this will turn into a list. In a splay tree, all operations are similar to a binary search tree but, you bubble up the recently accessed&amp;nbsp;node up to the root or the first level from root. So next time you access it, the node will be available real fast. The bubble up will cost some time but, will compensate over a&amp;nbsp;number of operations with the efficiency of balancing the tree. For splay tree the average of a collection of operations is always of the order of log(n) although some of these&amp;nbsp;operations may be of n time complexity. Accessing a node means searching / inserting / deleting. In all these cases we bubble up the node / the node that replaced it in the case of&amp;nbsp;deletion.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The process of bubbling up the node consists of left rotations and right rotations. The algorithms to bubble up the node / balance the tree has three conditions.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;1) If the node is a right child of a left child then you rotate the node left once and then rotate it right. (vice versa also for this case)&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;2) If the node is the right child of a right child then, you rotate the parent left once and then the node also once to left. (vice versa also for this case)&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;3) This has to be done until the node reaches the root or the first level from root.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;So for a set of keys { 18, 12, 25, 4, 15, 26, 1, 13, 17, 30, 3, 14, 28, 29} &amp;nbsp;suppose the tree looks like this before any splay. We access 3 in 4 operations.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://4.bp.blogspot.com/-ovYA90CAoDA/TxV_wgBdEzI/AAAAAAAAFNY/NVJMMLW42ro/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-ovYA90CAoDA/TxV_wgBdEzI/AAAAAAAAFNY/NVJMMLW42ro/s1600/untitled.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;For splaying, 3 is the right child of a left child so we rotate it left once and then right again. The left rotation gives a tree like this&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://3.bp.blogspot.com/-0eb4UKK4mMY/TxWCSbFVcfI/AAAAAAAAFOA/P1cWTEJkFpU/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-0eb4UKK4mMY/TxWCSbFVcfI/AAAAAAAAFOA/P1cWTEJkFpU/s1600/untitled.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Then a right rotation again gives&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://3.bp.blogspot.com/-Qdsh6tgTM0g/TxWCh8v4Z1I/AAAAAAAAFOI/WIDlNFgENp0/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-Qdsh6tgTM0g/TxWCh8v4Z1I/AAAAAAAAFOI/WIDlNFgENp0/s1600/untitled.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Again since 3 is the left child of a left child we do right rotations. one at 12 then at 3. This brings 3 to the root.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://3.bp.blogspot.com/-IlA4H_T9Vbk/TxWCxG47syI/AAAAAAAAFOQ/lQvwmXSwqFk/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-IlA4H_T9Vbk/TxWCxG47syI/AAAAAAAAFOQ/lQvwmXSwqFk/s1600/untitled.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Next time we do a search for 3 we get a faster response. Also, the tree is better balanced so, we get a better time for any node than before.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;A run time profiling example&lt;/span&gt;&lt;/b&gt;: Tree is created with values from 0 - 99999 in order. Then 99999 is searched before and after splaying. The cpu runtime profiling results are shown below.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://4.bp.blogspot.com/-L7cdyQwKFZM/TxV_xmXe-vI/AAAAAAAAFNg/zcedga5ZKtM/s1600/splay2.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" height="148" src="http://4.bp.blogspot.com/-L7cdyQwKFZM/TxV_xmXe-vI/AAAAAAAAFNg/zcedga5ZKtM/s640/splay2.jpeg" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Another profiling result, to get a feel of the advantage, (constructing the same tree as before) 4 values near leaf and 1 value near mid section are searched together. Both before and after splaying. The run time results are shown below.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://2.bp.blogspot.com/-bjPRLKEU_fQ/TxV_y2qcc5I/AAAAAAAAFNo/4skNXSMEKzI/s1600/splay3.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" height="364" src="http://2.bp.blogspot.com/-bjPRLKEU_fQ/TxV_y2qcc5I/AAAAAAAAFNo/4skNXSMEKzI/s640/splay3.jpeg" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Obviously, splay operation has an advantage on an average since, the tree is now balanced and we can find any value in less than &amp;nbsp;half time than before.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-2518629665141793480?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/2518629665141793480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=2518629665141793480' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2518629665141793480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2518629665141793480'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2012/01/splay-tree-super-search-tree-vs-binary.html' title='Splay tree (Super Search Tree) Vs Binary Search Tree'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-QbhdRNEluHY/TxWBiacnYpI/AAAAAAAAFNw/itAGlgrMGfQ/s72-c/untitled.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-7810716995724663089</id><published>2012-01-14T09:53:00.000-08:00</published><updated>2012-01-14T09:53:01.143-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='lazy initialization'/><category scheme='http://www.blogger.com/atom/ns#' term='design pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='bug'/><category scheme='http://www.blogger.com/atom/ns#' term='android programming'/><category scheme='http://www.blogger.com/atom/ns#' term='singleton'/><category scheme='http://www.blogger.com/atom/ns#' term='java concurrency'/><category scheme='http://www.blogger.com/atom/ns#' term='good coding'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><category scheme='http://www.blogger.com/atom/ns#' term='concurrency'/><title type='text'>Code Design for Singleton / Lazy initialization Concurrency</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;This post is an experiment on the concurrency of the common Singleton design pattern and it memory profiling results. Singleton pattern is commonly used in coding and the objective of Singleton is to make sure that, only a single instance of the class is created. The common design with lazy initialization is present in most code. This is shown below (read with out the synchronized keyword).&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://3.bp.blogspot.com/-UbTMLJu7pQc/TxG9wxejkNI/AAAAAAAAFM0/jVvg-LlveyQ/s1600/thread5wrong.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="218" src="http://3.bp.blogspot.com/-UbTMLJu7pQc/TxG9wxejkNI/AAAAAAAAFM0/jVvg-LlveyQ/s400/thread5wrong.jpeg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;This is fine as long as the code is executed by a single thread. If ever the code is executed by multiple threads, the 'check for null then act' part can result in multiple instances of the singleton class. If one thread A is checking the instance for null, returns true and it is moved out of processor for another thread B, B checks for null creates an instance. A comes back and creates another instance. So there will be 2 instances now as shown &amp;nbsp;in the run below. The class IamSingle has two instances without the synchronized keyword.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://2.bp.blogspot.com/-jTI1ONBAPsA/TxG-Y9sl_4I/AAAAAAAAFM8/CSnBBLouWUY/s1600/thread1wrong.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="259" src="http://2.bp.blogspot.com/-jTI1ONBAPsA/TxG-Y9sl_4I/AAAAAAAAFM8/CSnBBLouWUY/s640/thread1wrong.jpeg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;With the Synchronized keyword, the run profile is as follows. There is only one instance.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://1.bp.blogspot.com/-lyvl3GWoQwM/TxG-whcbJzI/AAAAAAAAFNE/tsj9fiDQ4hk/s1600/thread3wrong.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="259" src="http://1.bp.blogspot.com/-lyvl3GWoQwM/TxG-whcbJzI/AAAAAAAAFNE/tsj9fiDQ4hk/s640/thread3wrong.jpeg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;This kind of bug can be difficult to reproduce as even getting the wrong scenario depends on the timing of the threads.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-7810716995724663089?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/7810716995724663089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=7810716995724663089' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7810716995724663089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7810716995724663089'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2012/01/code-design-for-singleton-lazy.html' title='Code Design for Singleton / Lazy initialization Concurrency'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-UbTMLJu7pQc/TxG9wxejkNI/AAAAAAAAFM0/jVvg-LlveyQ/s72-c/thread5wrong.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3461424488543529106</id><published>2011-12-13T09:02:00.000-08:00</published><updated>2012-01-02T23:11:18.840-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='dynamic programming'/><category scheme='http://www.blogger.com/atom/ns#' term='computer Software'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='engineer'/><category scheme='http://www.blogger.com/atom/ns#' term='longest common subsequence'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>Classic Longest common subsequence via Dynamic programming</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Run time Profiling results of classic longest common subsequence algorithm.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;An example application of this algorithm is finding the difference of two text files.&amp;nbsp;We need to find the longest common subsequence of two sequences. i.e for "bdca" and "bcbda" the longest common&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;subsequence is of length 3 and is &amp;nbsp;"bda"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;The core algorithm&lt;/span&gt;&lt;/b&gt; using dynamic programming for this is as follows&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Lcs(i,j) = { &amp;nbsp; &amp;nbsp; &amp;nbsp;Lcs(i-1, j-1) + 1 ; if match at i &amp;amp; j.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Max( Lcs(i-1, j), Lcs(i, j-1) ); if mismatch at i &amp;amp; j&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;This can be implemented recursively using a two dimensional array m x n where m, n are sequence lengths. F&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;or example, two sequences "bdca" and "bcbda" we have the matrix for the algorithm above&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;2&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;3&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;b&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;c &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;b&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;d&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;a&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;--------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;0 b &amp;nbsp;|&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;1 d &amp;nbsp;|&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1 &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; 2 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;2 c &amp;nbsp;|&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;2 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;2 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; 2 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1 &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;3 a &amp;nbsp;|&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1 &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;-1 &amp;nbsp; &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; 3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;-------------------------------------- &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;So here 3 is the length of the longest common subsequence. base on the core algorithm above.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Runtime complexity is about O(mn). This particular basic program yeilds a time as show here&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-hyZ-V5nYnEQ/TueD4MRPn4I/AAAAAAAAFMY/AKcmV0jSyr0/s1600/lcs1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="265" src="http://2.bp.blogspot.com/-hyZ-V5nYnEQ/TueD4MRPn4I/AAAAAAAAFMY/AKcmV0jSyr0/s640/lcs1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Improvement&lt;/span&gt;&lt;/b&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;By analysing the recurssion tree of this particular problem there is an improvement that can be made to the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;runtime. The addition to the core algorithm is as follows&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;If Lcs(i, j) has not been calculated so far ?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; Lcs(i,j) = {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Lcs(i-1, j-1) + 1 ; if match at i &amp;amp; j.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Max( Lcs(i-1, j), Lcs(i, j-1) ); if mismatch at i &amp;amp; j&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;else&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;return the calculated Lcs(i, j);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;This small addition saves the code from going to calculate duplicate recursion trees. The time saved (~ 30 ms) is evident here&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-QghxNFjlMW0/TueEM1r9foI/AAAAAAAAFMg/9FgSaMQeUsA/s1600/lcs2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="272" src="http://2.bp.blogspot.com/-QghxNFjlMW0/TueEM1r9foI/AAAAAAAAFMg/9FgSaMQeUsA/s640/lcs2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;The sample recurssion tree is shown below. There are a lot of repeated duplicate tasks.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;       &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;4, 4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt; &amp;nbsp; &amp;nbsp;3,4&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;4, 3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt; &amp;nbsp; &amp;nbsp;2, 4,&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;4,3&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3, 3&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; 4, 2 &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;1, 4&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;2, 3&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;....&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;2, 3 &amp;nbsp; 3,2 .... 3, 2&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;4,1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Reconstruction is based again on the algorithm. We backtrack based on the two steps of the algorithm. ie if match occurred or the Max of sub-problems.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;1. We start at the right end of the tree&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;2. if there was a match at i &amp;amp; j then we take sequence[i] (= sequence[j] as in step 1 of algorithm) and go to (i-1, j-1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;3. else we can go either to (i-1, j) or (i, j-1) in the matrix. The logical thing to do is to go where there is maximum value.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;4. if matrix values at &amp;nbsp;(i-1, j) or (i, j-1) are same we may have to investigate both.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;The disadvantage of this approach is that, as the length of the sequences go up the memory for the matrix also goes up as m x n. One way to improve the memory is to&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;use only two rows since we look at only those every time. But, we may need to keep track of which way we step to reconstruct the lcs sequence.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3461424488543529106?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3461424488543529106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3461424488543529106' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3461424488543529106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3461424488543529106'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/12/classic-longest-common-subsequence-via.html' title='Classic Longest common subsequence via Dynamic programming'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-hyZ-V5nYnEQ/TueD4MRPn4I/AAAAAAAAFMY/AKcmV0jSyr0/s72-c/lcs1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-8525378166593652051</id><published>2011-12-07T08:45:00.000-08:00</published><updated>2011-12-07T08:45:36.396-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='string representation'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='huffman'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='huffmann tree'/><category scheme='http://www.blogger.com/atom/ns#' term='string encoding'/><category scheme='http://www.blogger.com/atom/ns#' term='compression'/><category scheme='http://www.blogger.com/atom/ns#' term='coding'/><title type='text'>A take on Huffman coding algorithm. How to squeeze data. 133 bytes to 69 bytes.</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Problem&lt;/span&gt;&lt;/b&gt;: Compress data in a text file using huffman encoding algorithm.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Basic approach&lt;/span&gt;&lt;/b&gt;: &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;1 Read the file and build a Huffman encoding tree.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;2 Get encoded bit string.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;3 Decode and get the original data by walking the Huffman encoding tree.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This method of compression is based on an inefficiency in normal representation of data strings. The inefficiency is that, we use 8 bits to encode a character that appears&amp;nbsp;1000 times and 8 bits again for a character that appears only once in the input data. So, if we use less number of bits to represent a high frequency character and comparatively&amp;nbsp;more for low frequency character, then we can compress the data. This gives rise to two new issues.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;a) The issue then becomes one of knowing the character set or the alphabet of your data in advance inorder to go&amp;nbsp;ahead with this type of encoding.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;b) Encoding the characters as bit sequences can lead to one character being the prefix of another. This can lead decoding program astray. i.e if m is 01101 and e is 011, then&amp;nbsp;we have problem decoding 01101 in out stream since the m might be decoded as an e.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;For the time being lets take the ascii character set to address issue a. To deal with issue b we can use a binary tree to represent the encoding. To make sure that, no bit sequnce is &amp;nbsp;a prefix of another character we use the huffmann algorithm to build the tree. This tree is the huff encoding tree.&amp;nbsp;For example an encoding tree is shown here.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-Mfx9CIN8gLk/Tt-UxZI3ZlI/AAAAAAAAFL4/B0TQ5n3aFiE/s1600/tree.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-Mfx9CIN8gLk/Tt-UxZI3ZlI/AAAAAAAAFL4/B0TQ5n3aFiE/s1600/tree.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Input&lt;/span&gt;&lt;/b&gt;: is a file with the content &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;"this is a test file input to huffman encoding algorithm. This will be compressed to a huffmann code. Huffmann encoding tree is used."&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The frequency of the characters is calculated as shown here.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-lVjmQbdMs8w/Tt-U8DeuLnI/AAAAAAAAFMA/V98wmoW1u5g/s1600/frequency+count.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" height="318" src="http://3.bp.blogspot.com/-lVjmQbdMs8w/Tt-U8DeuLnI/AAAAAAAAFMA/V98wmoW1u5g/s320/frequency+count.png" width="320" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Notice that, e occurs 11 times and is encoded with only 3 bits where as b occurs only once and is encoded by 7 bits!.&amp;nbsp;The huffman encodings for the characters are shown here.&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-tj68739uczc/Tt-VEFMX5wI/AAAAAAAAFMI/oOtNY7d-pvc/s1600/Huffmann+encoding+vaues.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" height="561" src="http://3.bp.blogspot.com/-tj68739uczc/Tt-VEFMX5wI/AAAAAAAAFMI/oOtNY7d-pvc/s640/Huffmann+encoding+vaues.png" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Result&lt;/span&gt;&lt;/b&gt;: The huffman encoding tree has 45 nodes and the encoded bit stream of the input above is 551 bits ie 68.8 bytes as opposed to the 133 bytes in the input. Bit vector and heap help the encoding tree generation algorithm. But, the tree itself seems to be better of as a pointer based tree as opposed to a array based tree (may not be a balanced tree). This can be pretty handy when sending considerable amounts of data over the network in a software environment.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-Cktt9b8JJCQ/Tt-VTfuBJhI/AAAAAAAAFMQ/7xVV5DS7KOo/s1600/result+bv.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;img border="0" height="608" src="http://1.bp.blogspot.com/-Cktt9b8JJCQ/Tt-VTfuBJhI/AAAAAAAAFMQ/7xVV5DS7KOo/s640/result+bv.png" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Tree building algorithm&lt;/span&gt;&lt;/b&gt;:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;1 Read the data from the file.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;2 Build a table with the count for each character in your alphabet.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;3 Build a huffmann encoding tree based on the frequency of your alphabet.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp; a) create leaf nodes with all the characters occuring in the file along with their &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; frequencies.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp; b) take two nodes which have the smallest frequencies.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp; c) combine these two nodes as the left and right children of a new node.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp; d) push the new node into the list with frequency set to the sum of the two child nodes.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;4 repeat step three until you end up with one node in the list i.e your root node for the encoding tree.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;To encode&lt;/span&gt;&lt;/b&gt;:&lt;/div&gt;&lt;div&gt;1. Replace each character with the bits encountered while getting to the character form the root of the tree.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;b&gt;To decode&lt;/b&gt;&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;1 input your stream of encoded bits&lt;/div&gt;&lt;div&gt;2 Until your input is not over&lt;/div&gt;&lt;div&gt;3 for each of the bit encountered&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; a move to the left of the tree if it is a bit 0&lt;/div&gt;&lt;div&gt;&amp;nbsp; b move to the right of the tree if 1 bit&lt;/div&gt;&lt;div&gt;4 if you have reached the leaf node of the encoding tree, go to the root.&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-8525378166593652051?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/8525378166593652051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=8525378166593652051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/8525378166593652051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/8525378166593652051'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/12/take-on-huffman-coding-algorithm-how-to.html' title='A take on Huffman coding algorithm. How to squeeze data. 133 bytes to 69 bytes.'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-Mfx9CIN8gLk/Tt-UxZI3ZlI/AAAAAAAAFL4/B0TQ5n3aFiE/s72-c/tree.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-2733627275789160483</id><published>2011-10-28T06:47:00.000-07:00</published><updated>2011-10-29T02:50:44.697-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='engine'/><category scheme='http://www.blogger.com/atom/ns#' term='search'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='implement search engine'/><category scheme='http://www.blogger.com/atom/ns#' term='search engine'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>How to Code your own Search Engine Like Google, Bing or Yahoo</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;b&gt;Problem:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;How to code your own search engine like Google or Bing? How to design the search engine? The search engine should give results in run time Order of (length of search key words)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;b&gt;Input:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;100 html files which have a lot of english words in it. Here we focus on the words only. Parsing out the html tags can be done too.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;b&gt;Solution:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;Here I use Trie and Binary Tree data structures to design the core search engine. Data can be extracted from pages and the data structures can be built by another program called crawler. This can be combined with the spell suggestion program in the previous post to make it close to real life.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;b&gt;Design considerations here:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;The design for the search engine is shown below. The tries as explained in the previous post gives search results in the Order of length of key words. Here we have two words "search " and "engine". The trie has paths for each of these search terms and end in a list of HTML files that have these search terms in them.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;This list is maintained as a binary search tree. This makes it to find the set intersection of the files which have both the search terms! Any data structure that efficiently finds set intersection can be used.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-C6cSw5W7qsk/TqqtFKM4DyI/AAAAAAAAFJM/P9mxSiE_9yo/s1600/Design.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-C6cSw5W7qsk/TqqtFKM4DyI/AAAAAAAAFJM/P9mxSiE_9yo/s1600/Design.JPG" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;b&gt;Working:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;1) Crawl the files. Take the words from the files and add them to the trie. At the trie leaf node set the list of files in a binary tree.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;2) Input the search terms.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;3) For each term retrieve the set of files. Here it is available as binary search trees at the leaf nodes. Since we use a trie, for any number of files, I get the set of files for any given word proportional to the length of the search key word.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;4) Find the set intersection of these and display to the user. Here a binary search tree is used to represent sets. Any set representation can be as long as the process of finding set intersection is done efficiently.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;The following screen shot shows the search engine in action for the key words, "search", "engine" and "search engine"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-CDVgRI2otYE/TqqvQwWLgHI/AAAAAAAAFJU/uGuc88b6hj0/s1600/Search+Results.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;img border="0" height="465" src="http://4.bp.blogspot.com/-CDVgRI2otYE/TqqvQwWLgHI/AAAAAAAAFJU/uGuc88b6hj0/s640/Search+Results.JPG" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;b&gt;The run-time:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;To find a single word is around 39 microseconds on my computer using the netbeans profiler (as the trie in the previous blog post). The run time for my search engine is shown below. The search took only 62 microseconds. Now that is how Google is fast. As long as your search data structure and set data structure is chosen correct, you can have it as fast as Google or Bing. Plus you can add additional meta data such for paid pages, relevance to terms, page rank etc and make it better. As for memory you can use a better trie as mentioned in the previous post.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Mq8jbdzSqiU/TqqvsXJtd3I/AAAAAAAAFJc/Gdokf-JD1eE/s1600/TimeforSearch.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS',sans-serif;"&gt;&lt;img border="0" height="332" src="http://2.bp.blogspot.com/-Mq8jbdzSqiU/TqqvsXJtd3I/AAAAAAAAFJc/Gdokf-JD1eE/s640/TimeforSearch.JPG" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-2733627275789160483?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/2733627275789160483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=2733627275789160483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2733627275789160483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2733627275789160483'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/10/how-to-code-your-own-search-engine-like.html' title='How to Code your own Search Engine Like Google, Bing or Yahoo'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-C6cSw5W7qsk/TqqtFKM4DyI/AAAAAAAAFJM/P9mxSiE_9yo/s72-c/Design.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-1500264539330729944</id><published>2011-10-25T11:35:00.000-07:00</published><updated>2011-10-25T11:42:04.838-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='spell'/><category scheme='http://www.blogger.com/atom/ns#' term='analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='spell suggestions'/><category scheme='http://www.blogger.com/atom/ns#' term='spell correction'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='search'/><category scheme='http://www.blogger.com/atom/ns#' term='Tries'/><category scheme='http://www.blogger.com/atom/ns#' term='advanced data structures'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><category scheme='http://www.blogger.com/atom/ns#' term='tree'/><category scheme='http://www.blogger.com/atom/ns#' term='Google spell suggestions'/><category scheme='http://www.blogger.com/atom/ns#' term='data structure'/><title type='text'>Spell Suggestion Like Google / Microsoft Word</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;Problem:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;To implement a spell suggestion program similar to the one you see on Google search box, Microsoft Word and the like. English Language dictionary is used.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;b&gt;Solution / Approach&lt;/b&gt;&lt;/span&gt;:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Algorithm uses a trie to store your keys. Walk through the trie with the user to find the suggestions. An alternative approach is use word edits and employ the spell checker in a previous post.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Input: A english dictionary of 59000 words.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Advantages&lt;/span&gt;&lt;/b&gt;: Search for a Key is very fast. Suggestions can be found in good time too.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Disadvantages&lt;/span&gt;&lt;/b&gt;:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;The size of the trie can be a limiting factor. But, more than one trie compression technique is available especially for English. But, for this experiment I was focussing on run-time with the first implementation only.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;b&gt;Theory&lt;/b&gt;&lt;/span&gt;:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Trie is a M-ary tree. An indexing operation is done at each node of the tree. The indices are the characters of the search Key. Suppose there are k possible character values for key. In English a-z &amp;nbsp;+ unique marker gives 27. Then each node of the trie has k+1 pointers one for each characters possible at that node. This is similar to the way we search for a word in the dictionary. For example, the word "alpha" is looked up by &amp;nbsp;looking up character "a" then within that, lookup "l" and so on. You can have the pages of all words beginning with "al". In a trie lookup the first character of the key at the root. Then, follow the pointer in the table corresponding to that character. For the word list the number of nodes in the Trie is 143699 ! The word list is by no means compact / processed for that matter.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Searching an item simply follows characters in the key through the tree and if you have exhausted the key, you have a hit or a miss. Inserting Keys is simple as in searching, you add nodes when you have a miss for the key values.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;In a trie, you search in O(length of the Key). The snapshots speak for themselves on this. &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;On the other hand the memory requirement for the basic trie is high. If there are n nodes, then there are n * (k + 1) pointers. The two variations that can be used are&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;1) Linked list for Pointers in nodes as most of the table is empty in a Trie for English. The trie using the linked list is a de la Briandais Trie.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;2) Then there is Practical Algorithm To Retrieve Information Coded In Alphanumeric. Patricia Tries! Here, the algorithms for building and maintaining the tree will change since we have to store the keys too.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;3) Tries can also be represented as two dimensional arrays without the key values being stored in the table. This can save quite a bit compared to basic trie.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Experiment&lt;/span&gt;&lt;/b&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;The run of the java program in NetBeans profiler is here. This is for a small word.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://1.bp.blogspot.com/-CST11MbQwsM/Tqb-qjjgJRI/AAAAAAAAFIw/-gbhTTcC2Fw/s1600/Search+Short+Words.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;img border="0" height="289" src="http://1.bp.blogspot.com/-CST11MbQwsM/Tqb-qjjgJRI/AAAAAAAAFIw/-gbhTTcC2Fw/s640/Search+Short+Words.JPG" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;For a really long word the time is bit more as shown in profiler.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://3.bp.blogspot.com/-s630lCNFXOQ/Tqb_AwUYTcI/AAAAAAAAFI4/bGmanyHVPso/s1600/ReallyLongword.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;img border="0" height="380" src="http://3.bp.blogspot.com/-s630lCNFXOQ/Tqb_AwUYTcI/AAAAAAAAFI4/bGmanyHVPso/s640/ReallyLongword.JPG" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Suggestions example runs. The algorithm follows from where the user strayed. Although this throws up more suggestions, it works.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="http://2.bp.blogspot.com/-ajtQR0998rc/Tqb_SvVvB6I/AAAAAAAAFJA/tjcvjTzBuN4/s1600/spellcheckerSuggester.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;img border="0" height="515" src="http://2.bp.blogspot.com/-ajtQR0998rc/Tqb_SvVvB6I/AAAAAAAAFJA/tjcvjTzBuN4/s640/spellcheckerSuggester.JPG" width="640" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-1500264539330729944?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/1500264539330729944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=1500264539330729944' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/1500264539330729944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/1500264539330729944'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/10/spell-suggestion-like-google-microsoft.html' title='Spell Suggestion Like Google / Microsoft Word'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-CST11MbQwsM/Tqb-qjjgJRI/AAAAAAAAFIw/-gbhTTcC2Fw/s72-c/Search+Short+Words.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-7210138467418263593</id><published>2011-08-02T22:37:00.000-07:00</published><updated>2011-08-02T22:37:42.990-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java security on android'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='cryptography'/><category scheme='http://www.blogger.com/atom/ns#' term='bks'/><category scheme='http://www.blogger.com/atom/ns#' term='java security'/><category scheme='http://www.blogger.com/atom/ns#' term='pkcs12'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='keystore'/><title type='text'>Beginning Java Security on Android</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Android provides all of the java security libraries in Java. Android provides cipher engine classes, Keystore, algorithms, public key cryptography, key generators and the like. The list of algorithms that are supported seems as in the java language updates. Some searching and trials may be needed on this. This is true for the simulator that comes with the android devices too.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;One difference is that, while the default security provider for java on desktops is SunJCE the one on android is bouncycastle. So the default keystore type is BKS rather than JKS. This was not so obvious at first but, a few trials showed that, the keystore was BKS and you can also have PKCS12 keystore. The rest is all the same except that, if you create a PKCS12 keystore you need to store an entry as a PKCS12 type/stream otherwise you get an exception asking for a PKCS12 type.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Also, If the keystore path has a '.' anywhere in the path, storing the keystore throws exception. So if you stor your keystore at a location with your 'package folder' name for example 'com.myapp' it may result in exception. Removing the '.' character from the path name avoided this.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-7210138467418263593?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/7210138467418263593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=7210138467418263593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7210138467418263593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7210138467418263593'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/08/beginning-java-security-on-android.html' title='Beginning Java Security on Android'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-6560837271311781623</id><published>2011-08-01T03:53:00.000-07:00</published><updated>2011-08-01T04:02:00.464-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='crystal v 1.0'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='editor'/><category scheme='http://www.blogger.com/atom/ns#' term='encrypting text editor'/><category scheme='http://www.blogger.com/atom/ns#' term='encrypting'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='java security'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Encrypting Text Editor Crystal v 1.0 for Android</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;About the application&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;In the past few weeks I put together an android application which is similar to Crystal in my old blog post. This application allows the user to store text data on an android device by encrypting it. Crystal v 1.0 for android uses java security libraries available on android sdk. Crystal allows you to create a master password for your data files. Once you set your master password, you can write files using crystal and save them in encrypted form and read them later with your master password.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Crystal v 1.0 for android apk file is &lt;a href="http://www.filefactory.com/file/cdbc3b8/n/crystal.apk"&gt;here&lt;/a&gt;&amp;nbsp;. You will need a third party application to install it on your android phone. (Until I get my android market account set properly !)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp; &amp;nbsp; Welcome Screen&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;a href="http://4.bp.blogspot.com/-OERaXA0Q1H4/TjaCFNOhZTI/AAAAAAAAFEo/RIwn0zJFQxI/s1600/s1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-OERaXA0Q1H4/TjaCFNOhZTI/AAAAAAAAFEo/RIwn0zJFQxI/s320/s1.JPG" width="211" /&gt;&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&amp;nbsp;More screen shots and how to use crystal is &lt;a href="http://www.filefactory.com/file/cdbc38f/n/crystal.pdf"&gt;here&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;Current limitations&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;1) Your master password is immutable.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;2) Crystal Selects the location for files on your device automatically.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;3) AES is the only algorithm supported in the current version.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: 'Trebuchet MS', sans-serif;"&gt;How it works&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;Crystal uses java security on android to create a master keystore on your device. This key store holds your key which is used to encrypt/decrypt your data files. The keystore has a password which is the master password. You set this password while using the application and it automatically generates a symmetric key and stores it in your keystore. &amp;nbsp;The master password is never stored anywhere on your device. Your key is also safe as long as you keep your master password.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-6560837271311781623?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/6560837271311781623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=6560837271311781623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6560837271311781623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6560837271311781623'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/08/encrypting-text-editor-crystal-v-10-for.html' title='Encrypting Text Editor Crystal v 1.0 for Android'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-OERaXA0Q1H4/TjaCFNOhZTI/AAAAAAAAFEo/RIwn0zJFQxI/s72-c/s1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-2205179753876001771</id><published>2011-07-16T03:00:00.000-07:00</published><updated>2011-07-16T03:04:56.376-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='table layout'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='android programming'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='compound controls'/><category scheme='http://www.blogger.com/atom/ns#' term='user interface'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='controls'/><category scheme='http://www.blogger.com/atom/ns#' term='android user interface'/><category scheme='http://www.blogger.com/atom/ns#' term='adjusting width tablelayout'/><title type='text'>Android User Interface Part 2</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;To build a compound control as shown below.&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-v9gwDT7xDNI/TiFfvy6-woI/AAAAAAAAFEY/I6tDS734OsU/s1600/final.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="304" src="http://1.bp.blogspot.com/-v9gwDT7xDNI/TiFfvy6-woI/AAAAAAAAFEY/I6tDS734OsU/s320/final.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;As in the previous post the steps are to&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;1) Define the layout in xml.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;2) Define a class to represent the layout in code.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;3) Inflate the layout in code.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;4) Set it to an activity.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;The xml layout.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;-------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The difference is in the attributes that are specified on the xml layout that allows the buttons or any other view to&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;take up enough space as we need it to.&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-c70lRBsB94M/TiFf7pZ3vQI/AAAAAAAAFEc/YAdSNGAlyTs/s1600/xml.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://3.bp.blogspot.com/-c70lRBsB94M/TiFf7pZ3vQI/AAAAAAAAFEc/YAdSNGAlyTs/s640/xml.JPG" width="611" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The layout specifies a editview, a list view and two buttons. The two buttons have their width set to 0 dip. The table row&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;which has the button has a collective weight sum of 2. Each of the buttons has a weight of 1. So they occupy half the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;width each.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;The layout class&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;-------------------&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-siTxpAg_M2w/TiFgP3Nsr8I/AAAAAAAAFEg/XYHnSbxBVKQ/s1600/layout+class.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="483" src="http://4.bp.blogspot.com/-siTxpAg_M2w/TiFgP3Nsr8I/AAAAAAAAFEg/XYHnSbxBVKQ/s640/layout+class.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This is similar to the class in the previous blog but, here it is sub-classed from tablelayout. The rest is same.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;&lt;b&gt;Using this in an activity&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;----------------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;This is also the same as in previous post. Insatntiate a class of the layout just created with the activity as the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;context. Set it to the activity using 'setContentView' method. The method also shows how to use the arrayadapter to&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;set values to a listview.&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-M0lxN4TcLvc/TiFgYMO72MI/AAAAAAAAFEk/zVkD_HG38Pk/s1600/activity.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="280" src="http://2.bp.blogspot.com/-M0lxN4TcLvc/TiFgYMO72MI/AAAAAAAAFEk/zVkD_HG38Pk/s640/activity.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;The advantage of using the xml layout is that, once it is defined and represented in a layout sub-class it can be used at multiple application activities on the run.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-2205179753876001771?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/2205179753876001771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=2205179753876001771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2205179753876001771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2205179753876001771'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/07/android-user-interface-part-2.html' title='Android User Interface Part 2'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-v9gwDT7xDNI/TiFfvy6-woI/AAAAAAAAFEY/I6tDS734OsU/s72-c/final.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-2663655446278000168</id><published>2011-07-16T00:43:00.000-07:00</published><updated>2011-07-16T00:43:13.342-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='inflate'/><category scheme='http://www.blogger.com/atom/ns#' term='layout'/><category scheme='http://www.blogger.com/atom/ns#' term='android activity'/><category scheme='http://www.blogger.com/atom/ns#' term='activity'/><category scheme='http://www.blogger.com/atom/ns#' term='inflator service'/><category scheme='http://www.blogger.com/atom/ns#' term='layout resources'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='user interface'/><category scheme='http://www.blogger.com/atom/ns#' term='view'/><category scheme='http://www.blogger.com/atom/ns#' term='android user interface'/><title type='text'>Android User Interface: Using Xml layout resources Part 1</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Problem:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt; Getting a layout in xml, to bring it up on an activity.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In android&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Views are widgets or controls like textviews, buttons, lists and the like.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Activity is what you see on the screen i.e your window or frame that is to be displayed.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Layout is how you arrange / position your views on the screen. This is similar to java layouts.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #3d85c6; font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The first thing to do is to get your layout defined in an xml layout resource. This can easily be done by using the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;tools in eclispe for android development. Either you define the xml as shown below in hand or you can use the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;graphical editor.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In the xml file below, there is a textview that acts as a banner and a listview. The attributes of the views are mostly straight&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;forward. We can get more control over the views using these attributes. For the time being we focus on getting this xml&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;layout on the screen.&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-i1rYhYiHg3E/TiE_Wb7pY9I/AAAAAAAAFEM/jhwdCTB3aEI/s1600/xml+1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="361" src="http://3.bp.blogspot.com/-i1rYhYiHg3E/TiE_Wb7pY9I/AAAAAAAAFEM/jhwdCTB3aEI/s640/xml+1.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The second step is to represent layout in code using a class which is subclassed from android.widget.LinearLayout. We&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;will use this class in code to build the layout and the views in it (inflate) at runtime.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;(i) Define a class that extends from android.widget.LinearLayout&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;(ii) Define fields in the class for the textview and listview. For an instance of &amp;nbsp; &amp;nbsp;this layout class we will get the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;corresponding view objects into these.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;(iii) Override the Constructor for the view, place a call to the super class constructor. Now we add the code to inflate&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;the xml layout.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;(iv) Inflating the layout is done using a system service in android called layout inflator service. Once we inflate&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;the layout we get a reference to the textview and the listview of this layout by calling the findViewById method.&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-DpFdK0C1StY/TiE_eyXBCZI/AAAAAAAAFEQ/VbVzLYmj-tM/s1600/inflate.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="392" src="http://3.bp.blogspot.com/-DpFdK0C1StY/TiE_eyXBCZI/AAAAAAAAFEQ/VbVzLYmj-tM/s640/inflate.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;So far the layout is there to be used on an activity. To use this layout class in an activity,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;(i) Declare this layout object in your activity.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;(ii) In the onCreate method of this activity create the layout object using the current activity as context.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;(iii) Set the layout using the 'setContentView' method.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;You can set some values for the text view and the list view after this or in the layout class itself. Here an&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;arrayadapter is used to set values to the listview.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-5yfTeiuzBOw/TiE_n_issOI/AAAAAAAAFEU/FIAQDvMEWX8/s1600/activity.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="385" src="http://2.bp.blogspot.com/-5yfTeiuzBOw/TiE_n_issOI/AAAAAAAAFEU/FIAQDvMEWX8/s640/activity.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The advantage of using the xml layout is that, you dont build the layout in code and keep you user interface decoupled&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;from the code. When the layout inflator inflates the layout, it can determine the best by using the xml attributes.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;** Note: &amp;nbsp;Never forget to list your own new activities into the android manifest.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-2663655446278000168?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/2663655446278000168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=2663655446278000168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2663655446278000168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2663655446278000168'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/07/android-user-interface-using-xml-layout.html' title='Android User Interface: Using Xml layout resources Part 1'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-i1rYhYiHg3E/TiE_Wb7pY9I/AAAAAAAAFEM/jhwdCTB3aEI/s72-c/xml+1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-5229761696708388956</id><published>2011-06-12T12:13:00.000-07:00</published><updated>2011-06-12T12:15:24.350-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='lego'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='brick'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='mindstorms'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='jvm'/><category scheme='http://www.blogger.com/atom/ns#' term='Bentley'/><title type='text'>Lejos</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;Lejos&lt;/span&gt;&lt;/b&gt; is a firmware jvm that can live in the mindstorms nxt brick. I installed it a couple of days ago after some hiccups. I was following some documents on the web to install this on the brick. After a bit of frustration I was able to get it right. Thanks to&amp;nbsp;&lt;a href="http://www.youtube.com/user/Mindstormscreator?email=comment_reply_received"&gt;mindstormscreator&lt;/a&gt;&amp;nbsp;and his installation&amp;nbsp;&lt;a href="http://www.youtube.com/watch?v=HFbWrLP9vFU&amp;amp;feature=email&amp;amp;email=comment_reply_received"&gt;videos&lt;/a&gt;&amp;nbsp;on youtube. This also shows how to get everything up and running even with eclispe IDE. The test run of a java program that plays a tune on the mindstorms brick was successful. At one time after failed flashes my brick was showing the lejos version like a counter 0.7 -0.8, also showing a java exception on the lego brick, finally settling in 0.8. But, it is all sorted out now. A particular book on robotics studio was very tiring even after a number of reads. So, I decided to go the Java way. More information on how to on Lejos is here&amp;nbsp;&lt;a href="http://lejos.sourceforge.net/index.php"&gt;Lejos&lt;/a&gt;. Can't wait to program in java for the mindstorms brick. Hoping for challenges as in Bentley!&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-5229761696708388956?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/5229761696708388956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=5229761696708388956' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/5229761696708388956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/5229761696708388956'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/06/lejos.html' title='Lejos'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-136028154239067155</id><published>2011-06-09T00:40:00.000-07:00</published><updated>2011-06-10T09:58:04.006-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='allspark'/><category scheme='http://www.blogger.com/atom/ns#' term='doodle'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='voice search'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><title type='text'>Google.com Doodle Guitar 9 June 2011</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Check out the new doodle from Google. If you have not seen it go to Google.com. Not your regional google search page but, the US or .com level page. The doodle is a playable guitar. This is my favourite doodle and also the shortest post on this blog ! Also, Google voice search is available on this google.com domain. in case you did not notice. A picture of the doodle&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-NnoS_yp6C5E/TfB4wDTjqDI/AAAAAAAAFDE/5VCHNvd2Wq8/s1600/Picture-1_1916359c.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="199" src="http://3.bp.blogspot.com/-NnoS_yp6C5E/TfB4wDTjqDI/AAAAAAAAFDE/5VCHNvd2Wq8/s320/Picture-1_1916359c.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-136028154239067155?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/136028154239067155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=136028154239067155' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/136028154239067155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/136028154239067155'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/06/googlecom-doodle-guitar-9-june-2010.html' title='Google.com Doodle Guitar 9 June 2011'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-NnoS_yp6C5E/TfB4wDTjqDI/AAAAAAAAFDE/5VCHNvd2Wq8/s72-c/Picture-1_1916359c.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-5273195408027864646</id><published>2011-06-02T10:39:00.000-07:00</published><updated>2011-06-03T08:05:17.328-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spell'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='hashing'/><category scheme='http://www.blogger.com/atom/ns#' term='profiler'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='hash function'/><category scheme='http://www.blogger.com/atom/ns#' term='scatter algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='hash'/><category scheme='http://www.blogger.com/atom/ns#' term='Unix'/><category scheme='http://www.blogger.com/atom/ns#' term='scatter'/><category scheme='http://www.blogger.com/atom/ns#' term='spell checker'/><category scheme='http://www.blogger.com/atom/ns#' term='dictionary'/><category scheme='http://www.blogger.com/atom/ns#' term='krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='Netbeans'/><title type='text'>Spell checker design using scatter hash algorithm</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;This is the design of a spell checker that, I finally coded up. The principle is same as that of McIlroy but, the hash and the bit vector distribution is based on trial and error. I used a list of words that, I stumbled upon in the web. It is by no means optimized for spell corrections. It has 58112 words which I assume as almighty. I take each word and subsequently hash it 32 times to get 32 values which are mapped into a bit vector. The bit vector from the previous post was reused. So, if a word not in the dictionary is entered and checked, atleast one of the hashes would fail. If it failed, the word is not in the dictionary. Happy. Since this uses scattered hash/sort of :), an invalid word can match the hashes accidentally. The fun part was, how this is affected by the hash table size and the hash function. You can literally see the error increase/decrease as you alter these.&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;b&gt;&lt;span style="color: #3d85c6;"&gt;The input&lt;/span&gt;&lt;/b&gt;: a list of 58112 word.&lt;br /&gt;&lt;b style="color: #3d85c6;"&gt;The output behaviour&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Bit vector size &amp;nbsp;&amp;nbsp;&amp;nbsp; invalid word accepted?&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;--------------------------------------------------------------&lt;br /&gt;case a&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 500KB&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; No.&lt;br /&gt;case b&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 375KB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No.&lt;br /&gt;case c&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 250KB&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; No.&lt;br /&gt;case d&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 125KB&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Yes.&lt;br /&gt;Final case: &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;93.75 KB&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Yes.&lt;br /&gt;&lt;br /&gt;The first numbers on the bit vector memory feel not so good for a 58K word list. The mathematics that, describes the relation between the hash bit length (32 here), word list length and the probablity of an invalid word hashing correctly is described by McIlroy. This comes into play in the last two cases above. I did not prove it but, runs of the program point to that clearly. It can still be downsized but, the point was to try the scatter technique for the spell checker.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #3d85c6;"&gt;Observation&lt;/b&gt;:&amp;nbsp; I did change the 32 values used in the hash functions which gave me a good reduction in bit vector size and lower error rate. The&lt;br /&gt;final run used 32 consecutive values from the farther end of the proposed hash table size. Previously, I was using differences of 100 ie N - 100, N - 200, N -300, N -400 ...... N - (32 * 100). All that left me was with even values in the hash functions. This affected the accuracy of the hash I can say from the run of the program (i.e invalid words matched seeminlgy easy). But, when I used the consecutive values i.e N - 1, N -2....N - 32 I have introduced primes not purposefully. But, the urge to change the hash values was there. McIlroy says that, the use of n primes for the n hash functions is very good and he used it. A lot of reading on the web claimed that, the use of primes in hash function and their advantage was not that great. But, this small program with only a couple of primes seems to be faring better than with out them. Why 32? McIlroy used 27 I picked 32!. :)). This choice is to be based on the mathematical relation I pointed to above (refer McIlRoy paper).&lt;br /&gt;&lt;br /&gt;The program when profiled in Netbeans takes 0.169ms to find if a word in the dictionary. A run of the program on this 573 word post gave optimized, Netbeans, McIlroy, atleast, probablity, seeminlgy as invalid. True. None of these were in the word list. "seeminlgy" is misspelt in this post! The checking code took 20.4 ms. &lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-qzCCYHDteYg/TefJohtsQKI/AAAAAAAAFCk/PqY2vsdtOGs/s1600/spell.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="281" src="http://1.bp.blogspot.com/-qzCCYHDteYg/TefJohtsQKI/AAAAAAAAFCk/PqY2vsdtOGs/s640/spell.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-5273195408027864646?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/5273195408027864646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=5273195408027864646' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/5273195408027864646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/5273195408027864646'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/06/spell-checker-design-using-scatter-hash.html' title='Spell checker design using scatter hash algorithm'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-qzCCYHDteYg/TefJohtsQKI/AAAAAAAAFCk/PqY2vsdtOGs/s72-c/spell.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-7952626426361846172</id><published>2011-05-20T02:30:00.000-07:00</published><updated>2011-05-20T02:32:43.182-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='McIlroy'/><category scheme='http://www.blogger.com/atom/ns#' term='hashing'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='knuth'/><category scheme='http://www.blogger.com/atom/ns#' term='spell suggester signature'/><category scheme='http://www.blogger.com/atom/ns#' term='data structures'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='soundex'/><category scheme='http://www.blogger.com/atom/ns#' term='spell corrector'/><category scheme='http://www.blogger.com/atom/ns#' term='hash'/><category scheme='http://www.blogger.com/atom/ns#' term='spell checker'/><category scheme='http://www.blogger.com/atom/ns#' term='dictionary'/><title type='text'>Designing a spell check or corrector. Round 1</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;b style="color: #3d85c6;"&gt;Problem&lt;/b&gt;: How to implement a simple dictionary. Given a list of words 60000 words in my case. The tough part is not with checking if a word is in the dictionary or not. It is the correction part that is challenging.&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;I was aware of how McIlroy used a hash to convert strings and subsequently used the hash as an index into a table. The space compression using bits is also there. So, how to go about the correcting a word. For example, type in the words 'intelligence', 'indelligence', 'itelligance', 'indelligance' into Google search. The search engine asks if you meant the word intelligence. The similarities with all these is how they sound. Even 'entelligant' will get you intelligent. Some reading gave two methods to approach this problem one was to play with the word and making slight changes to see if the new word is in the dictionary. The second is known as the Soundex method that, identifies words that sound alike. The concept of a signature seems to be crucial in this business but the better the signature is in representing all the letter, their sequence in the final signature the more successful the checker will be.&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;Could the signature itself be used to find the locality of the word if not the word itself?&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;A simple not so effective solution: I used the most common signature for strings. Given a word 'cabbage' the signature is a2b2c1e1g1. Kind of beats the purpose to store a signature larger than the word. So another common knowledge to use a2b2ceg. This could tell me some relations between the existing word in the dictionary only. But, when it comes to a wrongly spelt word for example 'cabage' the signature becomes 'a2bceg'. Binary search through the signature list will not help because the signature can lead you astray. A modification with a look ahead logic to see if the direction of binary search will yeild a result or close, was also not up to the mark. The real question is whether I need to store the correct words' list. Data structures like tries, suffix arrays all come to mind. But, search engine uses tries to go to the list of pages with that word. Here I just want to correct the word.&amp;nbsp; My instinct says no if I was to go with the first method mentioned above.&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;I am curious to look at Knuth's description of the soundex algorithm and went through some documents of english words. But, for the time being I feel like abandoning both, although not completely, in favour of a simple approach to do a simple spell correction in a given list of words. More on this as I near a good to disclose method.&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-7952626426361846172?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/7952626426361846172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=7952626426361846172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7952626426361846172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7952626426361846172'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/05/designing-spell-check-or-corrector.html' title='Designing a spell check or corrector. Round 1'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-4418056079758376019</id><published>2011-05-14T23:21:00.000-07:00</published><updated>2011-05-14T23:23:26.131-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='solution design'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft Windows Mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='MDA'/><category scheme='http://www.blogger.com/atom/ns#' term='MFC'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Mobile software'/><category scheme='http://www.blogger.com/atom/ns#' term='PDA'/><title type='text'>Serialization to the rescue</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;I wanted to post this ever since I had been through Bentley's articles. This happened when I was working on mobile devices and subject is about exploring alternate solutions for a given software problem, each with its own plus, minus points. The lesson I learned is that, there is always a scope and environment to the code that you write and making the right tradeoffs can get you a solution faster.&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;b style="color: #3d85c6;"&gt;The Problem&lt;/b&gt;: To display visual warning to users on a PDA (MDA Compact 3 &amp;amp; HTC Qtek S9100) when they cross the speed limit. Simple enough. But, there are strings attached. You have to build the feature on an existing solution which displays a map on the screen and provides navigation, traffic info to the users. The exisitng solution is keeping track of the location via gps &amp;lt;= every second and you have to use that data. Now, the display should be like the speed signs on the streets. You need to provide audio alerts too. Things are not simplified by the fact that, a version of TomTom will also be running on the PDA. PDA has 200MHz processor, 64MB RAM. There is the previous version with still limited features that, the software is to work. How do we show the sign/live feed on the screen ?&amp;nbsp; A sample sign&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-x1q99LKNBhg/Tc9v5sPXZ9I/AAAAAAAAFBU/SkHaZJk5J4g/s1600/41_08_71---20-mph-Road-Speed-Sign_web.jpg+%2526k%253D20%252Bmph%252BRoad%252BSpeed%252BSign.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="195" src="http://3.bp.blogspot.com/-x1q99LKNBhg/Tc9v5sPXZ9I/AAAAAAAAFBU/SkHaZJk5J4g/s200/41_08_71---20-mph-Road-Speed-Sign_web.jpg+%2526k%253D20%252Bmph%252BRoad%252BSpeed%252BSign.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;span style="color: #3d85c6;"&gt;&lt;/span&gt; &lt;b&gt;&lt;span style="color: #3d85c6;"&gt;Solution 1&lt;/span&gt;&lt;/b&gt;: Since we had the speed info from the existing components, we could simply draw our way through. A good drawing algorithms to put the street symbol with the speed data on the screen. After a couple of runs and stress tests (remember the existing load too), it was not very responsive plus the screen was left in an inconsistent state. Also, the platform was Microsoft Windows mobile, programming was done using embedded VC++&amp;nbsp; and Microsoft foundation classes.&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;b style="color: #3d85c6;"&gt;Solution 2&lt;/b&gt;: Show the sign on a seperate window and use MFC window region classes. What about the Sign itself ? Store it in the memory. The device could spare some. So why not? The bottle neck was with the MFC classes in the device sdk. It was stripped down and did not have the full region functionalities. You can set the region but, how to define the circular region? Again a dead end.&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;At this time I was pretty much finished with Jeff Prosise's Programming windows with MFC. It and other old Wintellect books have been my favourite while on Microsoft platform. Not to mention Charles Petzold. At this time I remembered about Serialization. Yes, that can let you save the state of an object. Aha. So, I can define the region on my desktop and serialise the region classes. Read the region classes in the PDA and use them as I like. I ran back to my workstation to try this out and see the effects of the stress tests. And it worked. Next my test representative and myself took a version with the modification on a field test. It performed better than the other option. &lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;Although there were a number of tradeoffs in terms of memory, response time etc, solution worked. I discussed it with my lead, tech consultant, project colleagues and we had a good laugh. &lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-4418056079758376019?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/4418056079758376019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=4418056079758376019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/4418056079758376019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/4418056079758376019'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/05/serialization-to-rescue.html' title='Serialization to the rescue'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-x1q99LKNBhg/Tc9v5sPXZ9I/AAAAAAAAFBU/SkHaZJk5J4g/s72-c/41_08_71---20-mph-Road-Speed-Sign_web.jpg+%2526k%253D20%252Bmph%252BRoad%252BSpeed%252BSign.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3723887220371256658</id><published>2011-05-12T12:07:00.000-07:00</published><updated>2011-05-13T13:20:38.401-07:00</updated><title type='text'>Oho! algorithms</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Again I have been coding some stuff and analysing the runtimes. This time was the two algorithms for rotating a vector left by N locations. This, a reverser algorithm, is used by Brian Kerningham and Plaugher&lt;/span&gt; &lt;span style="font-family: Verdana,sans-serif;"&gt;in their text editor and also by Ken Thomson in the editor for Unix and by Bentley too. So, if ABCD is a vector you want to rotate it by 2 locations to the left, we get CDAB.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;The first algorithm is a Juggler algorithm which juggles the values at indices similar to a shift. This is something that, I arrived at and so I will describe the other 'Reverser' algorithm. It goes like this. AB be the string. A is N units length and we want to rotate by N so the result is BA. First do a Ar B where Ar stands for the reverse of A. Then Ar Br. Then ( Ar Br )r. This should give you BA. Brian reported that, this worked first time. I also am glad to report that, it worked first time ;) :)). This is ofcourse if you have a reverse function to do the Ar and Br etc. In my case it is just a switch of array locations starting from the extremities and moving to the center of the array.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;The general analysis of the two algorithms is not much a do to share on a blog. The reverser is always better than the Juggler algorithm. They did exhibit some&lt;/span&gt; &lt;span style="font-family: Verdana,sans-serif;"&gt;minor changes in their runtimes of the order of 1 or 2 ms.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Well that said, *There is a general question of how the GCD of N and the length of the string figure in the analysis. So, this is what I did (open to questioning).&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Input a 1248000 long string.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;N is such that, N is the GCD. &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;At lower values of N (the GCD), both algorithms are the closest in terms of runtimes. Here is N = 4. Almost same. 10 ms and 10.7 ms.&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-hMAJbCfoXGw/TcwzTw_xBaI/AAAAAAAAFBM/reikXIy0mbs/s1600/SmallN.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="70" src="http://2.bp.blogspot.com/-hMAJbCfoXGw/TcwzTw_xBaI/AAAAAAAAFBM/reikXIy0mbs/s640/SmallN.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;At huge N for N = 1248, the Juggler takes almost twice the time of the Reverser. 6.99 and 13.1. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ye-epkuHCHA/Tcwzx5BCtGI/AAAAAAAAFBQ/pGXjAd0JrHU/s1600/HugeN.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="94" src="http://3.bp.blogspot.com/-ye-epkuHCHA/Tcwzx5BCtGI/AAAAAAAAFBQ/pGXjAd0JrHU/s640/HugeN.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;This seems to be consistent. Anyways, I think I will use the Reverser in my encrypting text editor Crystal. :)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3723887220371256658?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3723887220371256658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3723887220371256658' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3723887220371256658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3723887220371256658'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/05/oho-algorithms.html' title='Oho! algorithms'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-hMAJbCfoXGw/TcwzTw_xBaI/AAAAAAAAFBM/reikXIy0mbs/s72-c/SmallN.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3224468119376194885</id><published>2011-05-10T02:50:00.000-07:00</published><updated>2011-05-10T10:59:11.450-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='run times'/><category scheme='http://www.blogger.com/atom/ns#' term='runtime'/><category scheme='http://www.blogger.com/atom/ns#' term='hashing'/><category scheme='http://www.blogger.com/atom/ns#' term='horner'/><category scheme='http://www.blogger.com/atom/ns#' term='complexity'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>Getting runtime from ~ 15 seconds to 4 seconds</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;This is a bit of information on how I got a ~ 15 second program to work in less than 4 seconds. Although the insights are obvious, using the profiler defenitely gave more info than raw intuition. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="background-color: white; color: #3d85c6;"&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;b&gt;&lt;span style="color: #3d85c6;"&gt;The Problem&lt;/span&gt;&lt;/b&gt;: The anagram problem as discussed by Bentley. For a quick example 'rickets', 'sticker' and 'tickers' are anagrams. Using a permutations approach is defenitely unacceptable because of the time complexity. This brings us to the signature approach where we identify anagrams based on signatures. My program uses quick sort to build a signature. The partition code for the quick sort is that discussed by Bentley as I know from my college days the bugs and the confusion involved in coding the partition using the regular method. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;span style="color: #3d85c6;"&gt;The input to the code is a 58111 long list of english words&lt;/span&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;span style="color: #3d85c6;"&gt;Case 1&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;: Using a swap function, quick sort and signature function. Output was dumped to the screen using 'System.out'.&amp;nbsp; The total run time of the program was around 15 seconds. The quick sort took close to under 5 seconds. The screen dump took around 7-8 seconds !. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;* I replaced the screen dump code with a write to a text file. So, I wrote all the anagrams (the hash map contents) to a text file. But, this was done using Buffered Writer. This saved 8 seconds leaving the whole code to around 6-7seconds. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;This is a general approach I always used.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-aizdpDWYc3o/TckHJDIQbbI/AAAAAAAAFBA/MiPZ8RDoDlw/s1600/Case+2+HotSpots.GIF" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-aizdpDWYc3o/TckHJDIQbbI/AAAAAAAAFBA/MiPZ8RDoDlw/s640/Case+2+HotSpots.GIF" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b style="color: #3d85c6; font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;Case 2&lt;/b&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;: I had a look at the time taken by the functions and noted the following. Notice the quicksort, partition, swap methods in the hot spots window. The invocation frquency for the simple swap is a place to tune. I replaced the 3 line swap code at 3 invocation points in the quick sort. So swap as a seperate function is gone.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;Before the substitution was made partition code took colse to 2 seconds. After eliminating the method invocation, it takes 414 ms ! Quick sort now takes 2.3 seconds. But, overall time saved is 2 seconds! Now the runtime is 3.6 seconds compared to 5.5 before.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-9MNtKaqKYYU/TckHavK54SI/AAAAAAAAFBE/bimGHJ1ocME/s1600/Case+2+HotSpotsb.GIF" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="331" src="http://1.bp.blogspot.com/-9MNtKaqKYYU/TckHavK54SI/AAAAAAAAFBE/bimGHJ1ocME/s640/Case+2+HotSpotsb.GIF" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #3d85c6; font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;Case 3&lt;/b&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;: Something I have taken for granted is Horners method in hashing a string. This is explained by Robert Lafore in his book. Hasing the strings took 120 ms. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #3d85c6; font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;Case 4&lt;/b&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;: Since we can save time on method invocations, I believed that a non-recursive version of quick sort can have a serious effect on the running time. This was not the case. The self time of the quick sort function was more by 1 second.&amp;nbsp; The program itself was a bit slow by 3-4 seconds. There are more instructions in the quicksort function so, the increase is 'explainable'. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;The stack which was used to bypass the recurssion was being called, for pop and push a huge number of times. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;The point is that, the non recursive version of quick sort did not yield anything better. On the contrary it is performing a bit worse (7-9 seconds for the whole program ! looking for the missing 3-4 seconds ).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3224468119376194885?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3224468119376194885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3224468119376194885' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3224468119376194885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3224468119376194885'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/05/getting-runtime-from-15-seconds-to-4.html' title='Getting runtime from ~ 15 seconds to 4 seconds'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-aizdpDWYc3o/TckHJDIQbbI/AAAAAAAAFBA/MiPZ8RDoDlw/s72-c/Case+2+HotSpots.GIF' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3362717131864502</id><published>2011-01-27T11:21:00.000-08:00</published><updated>2011-02-02T03:13:00.311-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='text editor with encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='crystal'/><category scheme='http://www.blogger.com/atom/ns#' term='encrypted text editor linux'/><category scheme='http://www.blogger.com/atom/ns#' term='encrypting text editor'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='crystal v1.0'/><title type='text'>Crystal v1.0 An encryting text editor.</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: inherit;"&gt;I have been coding and developing an encrypting text editor recently after I felt the need for such an editor myself.&amp;nbsp; It protects your text file by encrypting it. It is not complicated to use and has familiar menu actions. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;Some technical details.&lt;br /&gt;&lt;br /&gt;1. It uses TripleDES key to encrypt your data onto the disk.&lt;br /&gt;&lt;br /&gt;2. The data on the disk i.e. the encrypted binary is in base64 encoding.&lt;br /&gt;&lt;br /&gt;3. Built out of SUN JAVA.&lt;br /&gt;&lt;br /&gt;Features:&lt;br /&gt;&lt;br /&gt;1. It performs the actions of a simple text editor well.&lt;br /&gt;&lt;br /&gt;2. Provides encryption for the data. TripleDES with a strong key is good enough and is supported by SUN Java.&lt;br /&gt;&lt;br /&gt;3. User provides password from which the encryption key is generated.&lt;br /&gt;&lt;br /&gt;4. Since it is purely Java it can run on multiple platforms.&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;5.&amp;nbsp; The data from the file can be copied on to an email text and then you can use it at the other end with Crystal and the password. &lt;br /&gt;&lt;br /&gt;Limitations and Future features:&lt;br /&gt;&lt;br /&gt;1. Handles only one file at version 1.0.&lt;br /&gt;&lt;br /&gt;2. AES encryption on next version.&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;3. Another thought that came to my mind is that, the encryption module can be used in application to protect configuration files. &lt;br /&gt;&lt;br /&gt;Installation:&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;1. &lt;a href="http://www.filefactory.com/file/b52f2h0/n/Crystal.jar%20"&gt;Crystal is here&amp;nbsp; &lt;/a&gt;OR http://www.filefactory.com/file/b52f2h0/n/Crystal.jar &lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;2. You will need SUN Java 1.6.x for this to work.&lt;br /&gt;&lt;br /&gt;3. Since it used TripleDES you will also need unlimited encryption strength policy files from SUN website &lt;a href="https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jce_policy-6-oth-JPR@CDS-CDS_Developer"&gt;here&amp;nbsp; &lt;/a&gt;OR https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jce_policy-6-oth-JPR@CDS-CDS_Developer&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;4. Copy the policy files to your JRE/lib/security folder. Thats it.&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;Hope you find this useful. &lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;Screen shots&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: inherit; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_HcGM2lDunaM/TUHDpVjRLdI/AAAAAAAAE-4/QTHFuyqvmig/s1600/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/_HcGM2lDunaM/TUHDpVjRLdI/AAAAAAAAE-4/QTHFuyqvmig/s320/1.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: inherit; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_HcGM2lDunaM/TUHDrmglLXI/AAAAAAAAE-8/sv3c0v0gcA8/s1600/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/_HcGM2lDunaM/TUHDrmglLXI/AAAAAAAAE-8/sv3c0v0gcA8/s320/3.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: inherit; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_HcGM2lDunaM/TUHDs7plVeI/AAAAAAAAE_A/HfOWNvotT_8/s1600/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/_HcGM2lDunaM/TUHDs7plVeI/AAAAAAAAE_A/HfOWNvotT_8/s320/2.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3362717131864502?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3362717131864502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3362717131864502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3362717131864502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3362717131864502'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/01/crystal-v10-encryted-text-editor.html' title='Crystal v1.0 An encryting text editor.'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_HcGM2lDunaM/TUHDpVjRLdI/AAAAAAAAE-4/QTHFuyqvmig/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3788102404819967032</id><published>2011-01-16T08:34:00.000-08:00</published><updated>2011-11-06T20:40:13.590-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='bit vector'/><title type='text'>Bit Vector approach in Java</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;This is my implementation of the bit vector mentioned in programming pearls. As mentioned in the book the bit vector has execution time and space&amp;nbsp;advantage.1/4th execution time to order a list of 1 million integers in my experiments compared to a quick sort. The execution time was less than a second.  The code is self explanatory. May be some more optimization is possible but, this seems ok. The limitation is that, none of the integers repeat in the list plus and integer type is expected for the array index.&lt;br /&gt;&lt;br /&gt;An example bit vector representing the numbers 8, 10, 2, 4, 7 is 0010100110100000 with the corresponding bit location set. (0 is inclusive in the list)&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;&amp;nbsp;*&lt;br /&gt;&amp;nbsp;* @author Hari&lt;br /&gt;&amp;nbsp;*/&lt;br /&gt;public class BitVector&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//the array of bytes.&lt;br /&gt;&amp;nbsp;&amp;nbsp; byte[] bitvector;&lt;br /&gt;&amp;nbsp;&amp;nbsp; //this is the maximum number we expect in the range.&lt;br /&gt;&amp;nbsp;&amp;nbsp; int nMaxLimit;&lt;br /&gt;&amp;nbsp;&amp;nbsp; //byte count needed.&lt;br /&gt;&amp;nbsp;&amp;nbsp; int nByteCount;&lt;br /&gt;&amp;nbsp;&amp;nbsp; // the zero mask.&lt;br /&gt;&amp;nbsp;&amp;nbsp; byte byZero = 0x00;&lt;br /&gt;&amp;nbsp;&amp;nbsp; //byte values used to set and retireve individual bits.&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; // Generate the bytes used to set - reset bits in the sequence&lt;br /&gt;&amp;nbsp;&amp;nbsp; private void genSet()&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; bySets[0] = 0x01;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; for(int nIndex = 1; nIndex &amp;lt; 8; nIndex++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bySets[nIndex] = (byte) (bySets[nIndex - 1] &amp;lt;&amp;lt; 1);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; }//for&lt;br /&gt;&amp;nbsp;&amp;nbsp; }//&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; // Initialize all the bits to zero.&lt;br /&gt;&amp;nbsp;&amp;nbsp; private void setAllToZero()&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; for(int nIndex = 0; nIndex&amp;lt; nByteCount; nIndex++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bitvector[nIndex] &amp;amp;= byZero;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; }//for&lt;br /&gt;&amp;nbsp;&amp;nbsp; }//&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; //set the nth bit in the array.&lt;br /&gt;&amp;nbsp;&amp;nbsp; public void setAt(int n) throws Exception&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;...................&lt;br /&gt;&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; locInVector = qt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; bitvector[locInVector] |= bySets[7 - rem];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; }//&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; // check if n is in the vector. i.e by checking the nth bit in the byte array.&lt;br /&gt;&amp;nbsp;&amp;nbsp; public boolean isPresent(int n) throws Exception&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; if(n &amp;gt; nMaxLimit || n &amp;lt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new Exception("Argument outside range of bit vector.");&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; int locInVector;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; int qt = n / 8;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; int rem = n % 8;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; locInVector = qt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; if((bitvector[locInVector] &amp;amp; bySets[7 - rem])==0)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return false;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; return true;&lt;br /&gt;&amp;nbsp;&amp;nbsp; }//&lt;br /&gt;&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;...................&lt;br /&gt;&lt;br /&gt;}//class&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3788102404819967032?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3788102404819967032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3788102404819967032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3788102404819967032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3788102404819967032'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/01/bit-vector-approach-from-programming.html' title='Bit Vector approach in Java'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-5231798371025271993</id><published>2011-01-12T13:25:00.000-08:00</published><updated>2011-01-12T13:25:48.883-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='alpha rex'/><category scheme='http://www.blogger.com/atom/ns#' term='lego'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='mindstorms'/><category scheme='http://www.blogger.com/atom/ns#' term='robotics'/><title type='text'>Alpha Rex Complete</title><content type='html'>I finally finished the Alpha rex robot. The head and hands were remaining from where I left it last time. The hands are operated using a single motor using lever, gears like lego blocks which is pretty amazing. The hands do not do much apart from being able to move as in the video. &lt;br /&gt;&lt;br /&gt;Overall pretty impressed with what lego mindstorms came up with. Now remains using regular code rather than vpl.&lt;br /&gt;&lt;br /&gt;The video is here &lt;br /&gt;http://www.youtube.com/watch?v=9WuMRkO8lSk&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-5231798371025271993?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/5231798371025271993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=5231798371025271993' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/5231798371025271993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/5231798371025271993'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2011/01/alpha-rex-complete.html' title='Alpha Rex Complete'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-6691305910750648604</id><published>2010-12-15T06:50:00.000-08:00</published><updated>2010-12-15T06:54:47.482-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='cloud'/><category scheme='http://www.blogger.com/atom/ns#' term='cloud computing'/><title type='text'>Cloud Computing  2. Ground level</title><content type='html'>‘Cloud computing is a type of computing that provides simple, on-demand access to pools of highly elastic computing resources. These resources are provided as a service over a network (often the Internet), and are now possible due to a series of innovations across computing technologies, operations, and business models. Cloud enables the consumers of the technology to think of computing as effectively limitless, of minimal cost, and reliable, as well as not be concerned about how it is constructed, how it works, who operates it, or where it is located’.&lt;br /&gt;&lt;br /&gt;This did not help much though when it came to a complete non-tech person. So, I again use an example that was used in the seminar I attended. Consider your work place in an IT company, you may be availing a lot of services such as email and intranet sitting at your computer. If you are accessing a leave management system like I did some time ago, you could look at the back of your computer and see a network cable. Following the cable you end up on the socket on the wall and then you plough out the lines and still follow them to a switch then to a router and you finally find yourself in the server room of your company. Then, you follow the cables to the server that, was hosting the leave application software for everyone in that location. So you have pin pointed the fixed server/hardware, the room, the air conditioning, the people who maintain that (by this time you should have met them), saw the power supply, back-up  and the like.  Now you get the general idea. You, the user, located it feeling.&lt;br /&gt;Now, if you ended up in huge warehouse with containers upon containers (holding the cable of course), and you see that, there is a lot of hardware with thousands of network connections going to as many stacks and you simply cannot pin point which one is your application server by yourself then, you are dealing with a cloud.  Basically, you may have ended up with something like this.&lt;br /&gt;&lt;br /&gt;http://www.youtube.com/watch?v=K3b5Ca6lzqE&lt;br /&gt;&lt;br /&gt;There is a video of the Google Datacenter too.&lt;br /&gt;&lt;br /&gt;Notice/see the mentioning of network, storage, cooling, power supply etc which you might have located in your server room too but, in a minute scale compared to this.  So your data, application are on some server that is in this huge software + hardware infrastructure. There might be someone else’s data, application residing there too.&lt;br /&gt;So did this explain the concept? It does not seem to be so very new outright but, the approach as we will see to utilizing such hardware software infrastructure and deriving advantages from it is new.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-6691305910750648604?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/6691305910750648604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=6691305910750648604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6691305910750648604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6691305910750648604'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/12/cloud-computing-2-ground-level.html' title='Cloud Computing  2. Ground level'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3590815312166624250</id><published>2010-12-15T06:45:00.000-08:00</published><updated>2010-12-15T06:49:41.573-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar krishna swamy'/><category scheme='http://www.blogger.com/atom/ns#' term='harisankar'/><category scheme='http://www.blogger.com/atom/ns#' term='cloud'/><category scheme='http://www.blogger.com/atom/ns#' term='krishna'/><category scheme='http://www.blogger.com/atom/ns#' term='explanation cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='computing'/><title type='text'>Cloud Computing - 1 The beginning</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Chj%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="themeData" href="file:///C:%5CDOCUME%7E1%5Chj%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5Chj%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="--"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:roman; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt; 	mso-ascii-font-family:Calibri; 	mso-hansi-font-family:Calibri;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;I have been reading up on a number of stuff the past couple of months and have consolidated stuff to put on my blog. One of the topics is cloud computing. &lt;span style=""&gt; &lt;/span&gt;This was rather vague in the sense that, if, I referred to any material couple of years back I used to get different ideas. But, a seminar I attended recently helped me to get some basic ideas to build upon.&lt;span style=""&gt;  &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;What is there so much to understand about cloud computing? You may ask. Rather than being able to work with it in all its glory, you would be better off if, you can explain simply and clearly to an executive, preferably from a non-IT background, about the what is, how,&lt;span style=""&gt;  &lt;/span&gt;why&lt;span style=""&gt;  &lt;/span&gt;of cloud computing.  &lt;span style=""&gt;&lt;/span&gt;Not agreeing to this? A lot of literatures just do this and only this. Why? Because as long as the execs don’t see the up-side, no computing is going to take off. &lt;span style=""&gt; &lt;/span&gt;So explaining the whole idea, selling cloud seems to be challenge I am facing now.&lt;span style=""&gt;  &lt;/span&gt;So who started all this? A colleague some time ago asked how I would explain cloud computing to my grandma and expect her to figure out some advantage on her own. I am never going be able to explain to my grandma because, she is not around. But, the idea was still hanging around. After this, I just continued with my reading to understand cloud more and pursue some development too. &lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;The rest of the stuff such as developing something to run on the cloud for an example, using the Google App Engine etc is left to books and technology literature directed at the tech people.&lt;span style=""&gt;  &lt;/span&gt;I am going through these too and will put on some stuff as I progress. These will be totally technical and nothing in the direction of the para above. &lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;The next few blogs would focus on specific aspects/points that, I got from my literature review which I did not come across in general.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3590815312166624250?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3590815312166624250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3590815312166624250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3590815312166624250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3590815312166624250'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/12/cloud-computing-1-beginning.html' title='Cloud Computing - 1 The beginning'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3629358180287849030</id><published>2010-10-27T09:24:00.000-07:00</published><updated>2010-10-27T09:34:48.104-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='alpha rex'/><category scheme='http://www.blogger.com/atom/ns#' term='walking mechanism'/><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='robotics'/><title type='text'>Fun Fun Fun with Robotics</title><content type='html'>This is yet another part of a new interest I developed. Its Robotics Again. I was building the walking mechanism for the alpha rex on Mindstorms.&lt;br /&gt;&lt;br /&gt;It took me a while to build it manually, and the VPL program was larger than most other examples.&lt;br /&gt;It was all worth the effort. Why? There are a lot of reasons for a software engineer to be happy with this.&lt;br /&gt;&lt;br /&gt;- First, not a single line of code has been written!! All the instructions are using the VPL that comes with the mindstorms studio. Yes, it does compile and all that stuff but, hey I did not have to type in the code. I was dragging 'logic blocks' to get the job done.&lt;br /&gt;&lt;br /&gt;- Second, with this a software engineer can imagine something and he has to imagine not only the logic but, also dream something that is mechanically feasible.&lt;br /&gt;&lt;br /&gt;- Third, you have to build it mechanically!!. Finally, something tangible compared to the programs and processes.&lt;br /&gt;&lt;br /&gt;The walking mechanism is here in this video&lt;br /&gt;&lt;br /&gt;&lt;a target="_new" href="http://www.youtube.com/watch?v=s9h9i2o8YnU"&gt;http://www.youtube.com/watch?v=s9h9i2o8YnU&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The touch sensors usage is very very impressive so is the technique used to walk. Stuff written on the package is true. 'Only three motors, 2 touch sensors, ultra sonic sensor, color sensor but a lot of possibilities'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3629358180287849030?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3629358180287849030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3629358180287849030' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3629358180287849030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3629358180287849030'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/10/fun-fun-fun-with-robotics.html' title='Fun Fun Fun with Robotics'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-6178808653379111531</id><published>2010-10-25T03:28:00.001-07:00</published><updated>2010-10-25T04:03:04.679-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lego'/><category scheme='http://www.blogger.com/atom/ns#' term='visual programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='Nxt2.0'/><title type='text'>Visual Programming Language - Lego Nxt2.0 Robotics Kit</title><content type='html'>In 2008 I attended a career exhibition at Cardiff City Hall. There were a lot of companies who had put up a booth to guide to-be-grads in the room .  One particular company Texas Instruments got my attention with their equipments (looked more circuit like) on the desk.  I gave them a visit and the guy there eagerly explained to me how their equipment measures my temperature, heartbeat ... while I was holding a metal wire!! Then, we struck a techie cord and he started talking about other stuff like Visual Programming Language and then about Lego Mindstorms Robotics kit. After listening to all that, I thought that, I should get to know this VPL thing and Mindstorms Nxt.&lt;br /&gt;&lt;br /&gt;I had a copy of MS Robotics Studio and played around with the studio. Missing was the sensors and motors i.e a robot kit.&lt;br /&gt;&lt;br /&gt;Recently, I got a Nxt2.0 Kit and started doing some VPL programs and running it on the servo motors, sensors in the kit.&lt;br /&gt;&lt;br /&gt;1) It is really nice to see and use the VPL studio that comes with the kit.&lt;br /&gt;2) Even though there are only a limited number of sensors and motors, there is a lot of things that can be imagined and programmed.&lt;br /&gt;3) Not to mention that, MSRS is compatible with this kit and we can code specifics in addition to the VPL capabilities.&lt;br /&gt;&lt;br /&gt;When you read a books on Robotics, you see terms like actuators, sensors, services, concurrent execution etc and it was upto imagination to piece them together. But, with a kit like this it makes understanding things  a lot more easier.&lt;br /&gt;&lt;br /&gt;I tried out a few of the vehicles and really enjoyed building and programming with VPL. One of the sensors I really like is the Ultrasonic sensor that can be used to measure distance.  The shooter robot was really interesting. The technique to shoot the colored balls is really impressive.  (old pool game idea). My bot was ready and I gave it a try.&lt;br /&gt;&lt;br /&gt;The video is here ---&gt; http://www.youtube.com/watch?v=bhB_lYPPCto&lt;br /&gt;&lt;br /&gt;It senses when some thing comes closer than one foot and fires.  Simple. The villain was the only thing I can get my hands on before the batteries ran dry, a rolled up carpet.&lt;br /&gt;&lt;br /&gt;Next would be Finishing the alpha rex humanoid and then moving to using custom code with this.&lt;br /&gt;&lt;br /&gt;And yes, there are a lot of other robots and kits you can get your hands on these days. But, this is definitely a good place to start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-6178808653379111531?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/6178808653379111531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=6178808653379111531' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6178808653379111531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6178808653379111531'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/10/visual-programming-language-lego-nxt20.html' title='Visual Programming Language - Lego Nxt2.0 Robotics Kit'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-362634788749268845</id><published>2010-09-22T21:59:00.001-07:00</published><updated>2010-09-23T07:00:53.742-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hidden language'/><category scheme='http://www.blogger.com/atom/ns#' term='computer Software'/><category scheme='http://www.blogger.com/atom/ns#' term='Software'/><category scheme='http://www.blogger.com/atom/ns#' term='Agile'/><category scheme='http://www.blogger.com/atom/ns#' term='agile practices'/><category scheme='http://www.blogger.com/atom/ns#' term='computer hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><category scheme='http://www.blogger.com/atom/ns#' term='charles petzold'/><title type='text'>Comments on Two books.</title><content type='html'>Here are my thoughts on two books that, I have been through. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1) Code: The Hidden Language of Computer Hardware and Software. From Charles Petzold.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After hearing a lot of praise for this book, I decided to give it a go myself. During my bachelors, I had gone through books in basic computer science, operating systems, computer networks etc. As an eager-to-learn reader, I felt, this book from Charles Petzold is different in the following ways&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; - It does not start with a chapter 1 scare about computers, digital world taking over your life.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; - Enjoyed the progress from Chapter 1 - 15. Things like Braille, Morse code, Telegraph, relays&lt;/div&gt;&lt;div&gt;    are described from a different perspective. Without having the end result/objective defined,&lt;/div&gt;&lt;div&gt;    the chapters build on what is simple and available to expand concepts. This is absent in all&lt;/div&gt;&lt;div&gt;    other books I have been through. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- Earlier attempts at code / represent data are interesting. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- The book is a progressive sequence of thoughts  leading to understanding computers, from oh! to ah!. If you already had taken subjects like digital logic/electronics during study, you might find this a replay. Only that, in semester study you get air-dropped right in the middle of details and learn from there.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Only downside is, I felt that,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- the fine-grained description of what each company / corporate / individual did could have been avoided. It was enough for me to know that, XYZ inc came up with yet another approach/processor.  If I wanted to dig into that, I would read another specific book. Just that, such descriptions are out of the scope of this book. Not to mention that, it is enough to kill the spirit of reading the rest of the book and put you to sleep.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- This book should have come out 10yrs ago as the author says. I wish it had.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;This is must have for High-schools', colleges' libraries or anyone who is interested in understanding how computers work and see through the layers of abstraction.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2) Practices of an Agile Developer by Venkat and Andy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What can I say? At least, the authors don't guarantee success with agile.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- This book is for people who don't understand that, software engineering involves great people/teams empowered by good enough process/methodology. Even agile can't help if this is not understood.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- If you are a developer with discipline, skip this book. You are already way ahead. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- A plus side, you can finish it in hours!!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-362634788749268845?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/362634788749268845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=362634788749268845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/362634788749268845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/362634788749268845'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/09/comments-on-two-books.html' title='Comments on Two books.'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-6860324258551611641</id><published>2010-08-25T02:42:00.000-07:00</published><updated>2010-08-25T02:55:55.213-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='passwords'/><category scheme='http://www.blogger.com/atom/ns#' term='disk'/><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='Software'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='store'/><title type='text'>Protect Shred Throw away</title><content type='html'>2 softwares that are useful if you are protecting information on your machine.&lt;div&gt;1 Software for storing passwords for users. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1) True Crypt. &lt;/div&gt;&lt;div&gt;This software allows you to protect information with encrypted container files, hidden volumes and hidden operating systems. Simply you follow the instructions to protect your data files with encryption. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2) PGP&lt;/div&gt;&lt;div&gt;I was under the impression that, the software turns features off after 30 days. But, the pgp author mentions that, it would simply continue to work. So, I am trying this especially the shredding part.  This software can shred empty spaces in the disk or files. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Both these softwares can be used when you a throwing away your hard disk. Cryptographically erase data. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3) Password Safe from Bruce Schneier&lt;/div&gt;&lt;div&gt;This is an extremely useful piece of software for people who have loads of ids and passwords. &lt;/div&gt;&lt;div&gt;Instead of using a commercial application that drags your system down, this can be easily used with little or no performance hit. It allows you to create a username, password, tag to describe where this is used, credential groups. Simply drag the name / password to the corresponding edit boxes in other windows. The password data base is itself encrypted and just remember the master password. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Extremely useful software. &lt;/div&gt;&lt;div&gt;Google it. Download it. Try it&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-6860324258551611641?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/6860324258551611641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=6860324258551611641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6860324258551611641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/6860324258551611641'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/08/protect-shred-throw-away.html' title='Protect Shred Throw away'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-819806223912783135</id><published>2010-07-21T05:33:00.000-07:00</published><updated>2010-07-21T06:11:19.169-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Xming'/><category scheme='http://www.blogger.com/atom/ns#' term='VM'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='development environment'/><title type='text'>Development environment</title><content type='html'>&lt;div&gt;If you are embarking on  software development or programming seriously then you need a environment, as George Carlin would say, to "put your stuff". &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My requirements for a development environment are.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1) It must be reasonably fast. Windows Xp? not a chance. Have tried.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2) As I progressed over the years, doing coding projects as learning and now after 4 months tops, the file system is confusing to even myself. tons of versions of jre, shell scripts add to the confusion. On a short notice I want a clean system. i.e  No installation of any sorts allowed. I don't want to worry if my previous pet project is gnawing at the current one.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3) Backup ! If something goes wrong on a monday morning, I want to just revert back and continue breaking things.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4) I should be able to make things tick with scripts when ever necessary. I hate windows scripting.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;5) Need a strong, flexible shell. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;6) Make private networks without the physical machines.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have used linux in the past and found it to be the best. I was not going to install a development environment on my Xp laptop. Definitely not for Java development. If it was for visual studio then, ok. But then, linux as a VM seems to be my choice for quite a long time now. The reason is that,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I found a number of ways to make this OS fast from other blogs. Search for it on the web!. Some things to do are &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    - change swappiness&lt;/div&gt;&lt;div&gt;    - services.  Used Yast to disable unwanted ones.&lt;/div&gt;&lt;div&gt;    - Look and feel for best performance&lt;/div&gt;&lt;div&gt;    - on Vmware server settings make sure that the entire vm memory is on physical memory.&lt;/div&gt;&lt;div&gt;    - visit inittab and strike off unwanted stuff.&lt;/div&gt;&lt;div&gt;    - Allocate all the disk space. Some blogs say this is unnecessary but, I found it to be otherwise.&lt;/div&gt;&lt;div&gt;    - list all processes and continue filtering.&lt;/div&gt;&lt;div&gt;    - Disable CD drive.&lt;/div&gt;&lt;div&gt;    - Disable USB. &lt;/div&gt;&lt;div&gt;       &lt;/div&gt;&lt;div&gt;One way to see the changes is to list the number of processes running on your vm. Mine has 56 processes and without X windows 38. The vm is more responsive with heavy IDEs like RAD. Well, faster than my friend's Ubuntu on physical machine!. (My VM has only 1.3 GB RAM)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So to be precise&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1) Use a Virtual Machine.&lt;/div&gt;&lt;div&gt;2) Use Linux. &lt;/div&gt;&lt;div&gt;3) Use Xming or Similar tool and avoid UI on your VM. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-819806223912783135?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/819806223912783135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=819806223912783135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/819806223912783135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/819806223912783135'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/07/development-environment.html' title='Development environment'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-2133706351898013454</id><published>2010-06-06T09:04:00.000-07:00</published><updated>2010-07-21T05:32:08.540-07:00</updated><title type='text'>Elevate thinking on Software Development Models.</title><content type='html'>If you have been to presentations on Software development models then, you have been exposed to this.&lt;br /&gt;&lt;br /&gt;a) Someone is talking about a new model.&lt;br /&gt;b) The benefits list is longer than your shopping list.&lt;br /&gt;c) There are also convincing Wow! Wow! examples.&lt;br /&gt;d) It is some thing very different from all the models you have ever seen, heard or used.&lt;br /&gt;  especially that mean Waterfall model.&lt;br /&gt;&lt;br /&gt;Then, the  all time champion false claim&lt;br /&gt;&lt;br /&gt;e) The model is promised to deliver you success at all times !!.&lt;br /&gt;&lt;br /&gt;Here is what I think.&lt;br /&gt;&lt;br /&gt;1) The Waterfall model gave us the basic stages of software development. That's the truth. Face it. It is NOT a guaranteed to fail. It might fail.&lt;br /&gt;&lt;br /&gt;2)  Every Software model has all the stages laid out by the waterfall model.  Rarely do you see a new phase in the new models.&lt;br /&gt;&lt;br /&gt;3) It is how you string these phases together, how much effort you spend in these stages,  that makes the difference and the different models.&lt;br /&gt;&lt;br /&gt;The questions to answer before adopting a new model.&lt;br /&gt;&lt;br /&gt;1) What is the process you are following now?&lt;br /&gt;&lt;br /&gt;2) What precisely is wrong with that process?&lt;br /&gt;  - Look for answers in Cost, Effort, Schedule.&lt;br /&gt;  - Get the numbers straight for the above three.&lt;br /&gt;&lt;br /&gt;3)  How much is the new process profitable in the above three?&lt;br /&gt;4) Is this worth the shift?&lt;br /&gt;5) Above all, Is your business process, team process compatible with the new model??&lt;br /&gt;  i.e can you map it to your processes?&lt;br /&gt;&lt;br /&gt;These basic questions can set things really straight.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-2133706351898013454?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/2133706351898013454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=2133706351898013454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2133706351898013454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/2133706351898013454'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2010/06/elevate-thinking-on-software.html' title='Elevate thinking on Software Development Models.'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-8015441231476510902</id><published>2009-08-17T22:13:00.000-07:00</published><updated>2011-11-02T00:36:59.727-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS'/><category scheme='http://www.blogger.com/atom/ns#' term='Desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Windows Server 2008</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;b&gt;http://blogs.msdn.com/vijaysk/archive/2008/02/11/using-windows-server-2008-as-a-super-desktop-os.aspx&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; http://h0bbel.p0ggel.org/windows-server-2008-as-desktop-laptop-os&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-8015441231476510902?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/8015441231476510902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=8015441231476510902' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/8015441231476510902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/8015441231476510902'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2009/08/finally-os-that-looks-good-feels-good.html' title='Windows Server 2008'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-3437495621913865501</id><published>2009-07-07T04:48:00.000-07:00</published><updated>2009-07-07T05:15:34.650-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTC Software'/><category scheme='http://www.blogger.com/atom/ns#' term='Shop Easy'/><category scheme='http://www.blogger.com/atom/ns#' term='Mobile software'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Mobile software'/><category scheme='http://www.blogger.com/atom/ns#' term='Shopping list'/><category scheme='http://www.blogger.com/atom/ns#' term='Shopping Software'/><title type='text'>ShopEasy v1.1</title><content type='html'>&lt;div&gt;I am happy to release this software for Windows mobile devices.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;About ShopEasy v1.1:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ever been to a super store, walked through all the isles and been back home just to find that you forgot to buy something? or simply don't have the memory to remember the long list of shopping items. Then this is for you.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;ShopEasy is a software designed for Windows Mobile 6.1 devices and helps you to shop!&lt;/div&gt;&lt;div&gt;It helps you to maintain your shopping list in a simple and easy to use manner. Before you go shopping, just run the software, select them items you want to shop and away you go, never to forget an item. You can keep track of items as you buy using the software so that, you are never in doubt if you have bought it or not. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Features:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1) Easy and Simple way to maintain your shopping list.&lt;/div&gt;&lt;div&gt;2) Help Facility for software.&lt;/div&gt;&lt;div&gt;3) Fast and efficient.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Specifications and Requirements:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Devices: Windows Mobile 6.1 devices. Screen shots from HTC Touch Diamond.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You will need: 1) Microsoft .Net Compact Frame work 3.5 to run the software. You can download this from Microsoft Website.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Your experience and suggestions in using ShopEasy are welcome. Enhancements will added and new versions will be uploaded soon.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Download:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;v 1.1&lt;/div&gt;&lt;div&gt;-----&lt;/div&gt;&lt;div&gt;Link: http://www.filefactory.com/file/ahb4046/n/ShopEasyInstaller_CAB&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HcGM2lDunaM/SlM6FnX6oqI/AAAAAAAADys/GkU-6LCJbHQ/s1600-h/ScreenShot8.Jpeg"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_HcGM2lDunaM/SlM6E7esqjI/AAAAAAAADyM/VwYpEVMKrew/s1600-h/ScreenShot1.Jpeg"&gt;&lt;img src="http://1.bp.blogspot.com/_HcGM2lDunaM/SlM6E7esqjI/AAAAAAAADyM/VwYpEVMKrew/s320/ScreenShot1.Jpeg" border="0" alt="" id="BLOGGER_PHOTO_ID_5355688238233987634" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 240px; height: 320px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HcGM2lDunaM/SlM6FW99_AI/AAAAAAAADyk/FQSioSRMO-U/s1600-h/ScreenShot7.Jpeg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 240px; height: 320px;" src="http://4.bp.blogspot.com/_HcGM2lDunaM/SlM6FW99_AI/AAAAAAAADyk/FQSioSRMO-U/s320/ScreenShot7.Jpeg" border="0" alt="" id="BLOGGER_PHOTO_ID_5355688245612903426" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_HcGM2lDunaM/SlM6FYJEvKI/AAAAAAAADyc/tJYMtm1AkG0/s1600-h/ScreenShot5.Jpeg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 240px; height: 320px;" src="http://3.bp.blogspot.com/_HcGM2lDunaM/SlM6FYJEvKI/AAAAAAAADyc/tJYMtm1AkG0/s320/ScreenShot5.Jpeg" border="0" alt="" id="BLOGGER_PHOTO_ID_5355688245927918754" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HcGM2lDunaM/SlM6FGi2gfI/AAAAAAAADyU/7BNQeVwbBHM/s1600-h/ScreenShot3.Jpeg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 240px; height: 320px;" src="http://4.bp.blogspot.com/_HcGM2lDunaM/SlM6FGi2gfI/AAAAAAAADyU/7BNQeVwbBHM/s320/ScreenShot3.Jpeg" border="0" alt="" id="BLOGGER_PHOTO_ID_5355688241204199922" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HcGM2lDunaM/SlM6FnX6oqI/AAAAAAAADys/GkU-6LCJbHQ/s1600-h/ScreenShot8.Jpeg"&gt;&lt;img src="http://2.bp.blogspot.com/_HcGM2lDunaM/SlM6FnX6oqI/AAAAAAAADys/GkU-6LCJbHQ/s320/ScreenShot8.Jpeg" border="0" alt="" id="BLOGGER_PHOTO_ID_5355688250016703138" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 240px; height: 320px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-3437495621913865501?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/3437495621913865501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=3437495621913865501' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3437495621913865501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/3437495621913865501'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2009/07/shopeasy-v11.html' title='ShopEasy v1.1'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_HcGM2lDunaM/SlM6E7esqjI/AAAAAAAADyM/VwYpEVMKrew/s72-c/ScreenShot1.Jpeg' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-1658692883602418734</id><published>2009-04-24T12:12:00.000-07:00</published><updated>2009-04-28T22:05:51.995-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Software development'/><category scheme='http://www.blogger.com/atom/ns#' term='prototype'/><title type='text'>To prototype or not to prototype</title><content type='html'>&lt;p class="MsoNormal"&gt;All engineering disciplines frequently use scaled down models to prove a concept before actually building something real or the real thing. This is the case, be it related to building architecture, bridges or aircraft manufacturing. So what about software? As an answer comes up the word, prototyping. The question is whether to or not to prototype? The question deserves special attention in software domain. This is due to the following reasons. First, software is created by developers who are unfortunately not the end-users of the product. Second, the end-user is not usually involved in specifying what they want, be it to see, type in or interact. In addition to that, the so called requirements get passed through quite a lot of hands and is perused and interpreted by the lot too. The funny thing is that, each will have an idea of what needs to be done, let alone how and with what. When this comes to the developer again there will be an interpretation of what is to be done. Finally, what the user wants is in his/her head and cannot be elicited in one go or so. The end result of this can be an unhappy user who thinks the software is useless or an irritated client who thinks the real objective was not met. For the developer this result can manifest as anything from, burning down new screens the user wants, dealing with the so called ‘changes’ to re-doing the whole thing.&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; If you have been in any of the above situation then you need to think of prototyping. First about what benefits it brings. Prototyping can help in the following ways &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;          &lt;/span&gt;&lt;/span&gt;If your team has thought of a concept which is core to building the solution. Prototyping can help in proving this concept. If the prototype proves your concept wrong, then you are in a position to plan accordingly rather than having to re-trace in the middle of development. It can also uncover any mistakes in your concept.&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;          &lt;/span&gt;&lt;/span&gt;You might have designed the solution with application layers and so on. Prototyping would be helpful in making sure things will get along as they were planned in the first place. If things do get along, you have something to look at when you build the real thing, a distinct advantage. &lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;          &lt;/span&gt;&lt;/span&gt;It can help in comparing technologies that can be utilized to deliver a solution. &lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;          &lt;/span&gt;&lt;/span&gt;You can identify bottle necks earlier which otherwise unnoticed will surface as impediments. i.e you make things as risk free as possible at an early stage.&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;          &lt;/span&gt;&lt;/span&gt;Above all, the user/client when presented with the prototype will start talking more than you expected. You will get a clear idea of ‘&lt;i style=""&gt;what they want to see&lt;/i&gt;’ and how they want to interact with the solution. I.e your interface will be change-proof as much as possible. There will be a better understanding between the two.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; As for the downside of prototyping, besides the fact that it takes time, there is nothing horribly wrong with the idea at all. The problem stems from the fact that, not many people in the field understand the need to prototype and if they do, they lack the knowledge of how to prototype. The followers of the perfect world of waterfall model where things go in order or anything similar fall into this category. &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;In short, prototyping does help a software development team to move in the right direction based on facts and deliver what the user wants in the first go itself. i.e if you have not been able to deliver the right product in the first pass, you should think about prototyping. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-1658692883602418734?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/1658692883602418734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=1658692883602418734' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/1658692883602418734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/1658692883602418734'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2009/04/to-prototype-or-not-to-prototype.html' title='To prototype or not to prototype'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3584889867142519041.post-7241296003427484917</id><published>2009-03-15T05:41:00.000-07:00</published><updated>2009-03-15T06:31:18.604-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Software development'/><category scheme='http://www.blogger.com/atom/ns#' term='IT project management'/><category scheme='http://www.blogger.com/atom/ns#' term='Software Engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Process management'/><category scheme='http://www.blogger.com/atom/ns#' term='Six Sigma'/><title type='text'>Six Sigma and Software Development</title><content type='html'>The software domain has its own set of tools, concepts and management processes, techniques to ensure quality and the success of a project.  Some of these are development methodologies like Agile development and others are process management techniques like CMM and its process areas. But, Six Sigma, its ideas and concepts did not evoke an interest in Software engineering domain as it did to the manufacturing doamin. In fact, software engineers and IT project managers are still confused as to how and where to apply this concept and related tools in software 'product' development. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At the end of its life cycle software is a product that, is used by a user/client to realise their goal. Quality, reduced variation from user requirements, reducing cost, well informed decisions, increased customer satisfaction are all important to the IT software industry as it to the manufacturing industry. These are things that Six Sigma aims for and the way to do this is even better in Six Sigma. If so, then software engineering and management can adopt quite a lot if not all, from this strategy. The initial skepticism can be removed by replacing the terms client/user (in Software domain) with customer (Six Sigma), issues (Software) with defects/variations (Six Sigma) and Software/System with product.  The only hurdle in the case of softwares is tangibility.  Again, 'Changes' are common to software development processes. Also, it is most unwelcome and software engineering processes tend to be brittle when it comes to managing changes. This is because most of the process models such as CMM tend to keep processes prognosticative. So they are uncomfortable with Changes. This 'Change' is also core to Six Sigma and But, is addressed very effectively.  In short, Six Sigma should not be alien to Software Engineering companies which in turn can definitely reap great benefits by applying this strategy. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3584889867142519041-7241296003427484917?l=harisankar-krishnaswamy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harisankar-krishnaswamy.blogspot.com/feeds/7241296003427484917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3584889867142519041&amp;postID=7241296003427484917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7241296003427484917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3584889867142519041/posts/default/7241296003427484917'/><link rel='alternate' type='text/html' href='http://harisankar-krishnaswamy.blogspot.com/2009/03/six-sigma-and-software-development.html' title='Six Sigma and Software Development'/><author><name>Harisankar</name><uri>http://www.blogger.com/profile/02901449893682131812</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/-utSa-OSLZag/TxZcyi2s9eI/AAAAAAAAFOc/q04xVfasKfM/s220/pro.JPG'/></author><thr:total>0</thr:total></entry></feed>
