<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5160328531119397307</id><updated>2024-10-02T08:34:56.754-04:00</updated><category term="python"/><category term="Interview"/><category term="Ubuntu"/><category term="Javascript"/><category term="Algorithm"/><category term="Internationalization"/><category term="Linux"/><category term="Java"/><category term="Mod_Python"/><category term="PHP"/><category term="SQL"/><category term="mod_wsgi"/><category term="vim"/><category term="Apache"/><category term="C/C++"/><category term="Django"/><category term="Editor"/><category term="Latex"/><category term="Matlab"/><category term="Misc"/><category term="SVN"/><category term="blog"/><category term="Browser"/><category term="Database"/><category term="Eclipse"/><category term="Facebook Development"/><category term="HTTP"/><category term="IT"/><category term="JSON"/><category term="MySQL"/><category term="Ruby"/><category term="SQLAlchemy"/><category term="Shell"/><category term="VC++"/><category term="Web"/><category term="cookie"/><category term="css"/><category term="cygwin"/><category term="msgfmt"/><title type='text'>Keep Moving</title><subtitle type='html'>A Blog for programming &amp;amp; technical solutions</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>72</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-2922877571497708387</id><published>2012-10-10T17:50:00.000-04:00</published><updated>2012-10-10T17:50:09.083-04:00</updated><title type='text'>Include jQuery in the Browser JavaScript Console</title><content type='html'>To play around with jQuery in your browser&#39;s JavaScript Console, copy and paste the following lines!

&lt;pre class=&#39;prettyprint&#39;&gt;
var jq = document.createElement(&#39;script&#39;);
jq.src = &quot;http://code.jquery.com/jquery-latest.min.js&quot;;
document.getElementsByTagName(&#39;head&#39;)[0].appendChild(jq);
jQuery.noConflict();
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/2922877571497708387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/10/include-jquery-in-browser-javascript.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/2922877571497708387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/2922877571497708387'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/10/include-jquery-in-browser-javascript.html' title='Include jQuery in the Browser JavaScript Console'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-3796645861497287837</id><published>2012-07-12T14:33:00.001-04:00</published><updated>2012-07-12T14:35:27.525-04:00</updated><title type='text'>Using changelist for SVN</title><content type='html'>Changelist is useful for organizing your code changes when you&#39;re working on more than one projects. You can mark files with different changelist flags to keep them organized.&lt;br /&gt;
&lt;br /&gt;
For example, we changed three files for ticket 66, and then commit them all together later:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ svn changelist ticket66 a.py b.py c.py
Path &#39;a.py&#39; is now a member of changelist &#39;ticket66&#39;.
Path &#39;b.py&#39; is now a member of changelist &#39;ticket66&#39;.
Path &#39;c.py&#39; is now a member of changelist &#39;ticket66&#39;.
&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ svn status
A       someotherfile.py
A       test/sometest.py

--- Changelist &#39;ticket 66&#39;:
A       a.py
A       b.py
A       c.py
&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ svn commit --changelist ticket66 -m &quot;Fixing ticket 66.&quot;
Adding         a.py
Adding         b.py
Adding         c.py
Transmitting file data ...
Committed revision 2.
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/3796645861497287837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/07/using-changelist-for-svn.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3796645861497287837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3796645861497287837'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/07/using-changelist-for-svn.html' title='Using changelist for SVN'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-4001468282090079798</id><published>2012-05-09T15:29:00.003-04:00</published><updated>2012-05-09T15:29:53.532-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>Integer validation in JavaScript</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;
function isInteger(val) {
    var intRegEx = /\D/g;
    return (!intRegEx.test(val));
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/4001468282090079798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/05/integer-validation-in-javascript.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4001468282090079798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4001468282090079798'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/05/integer-validation-in-javascript.html' title='Integer validation in JavaScript'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-5680167494474923850</id><published>2012-03-20T10:03:00.000-04:00</published><updated>2012-03-20T10:03:31.098-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>Request the parent window to open a URL from an iframe with different domains</title><content type='html'>Sometime we are developing something within an iframe, but we want the parent window to refresh or open a URL. The code to use is:&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;top.location.href = URL;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/5680167494474923850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/03/request-parent-window-to-open-url-from.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/5680167494474923850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/5680167494474923850'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/03/request-parent-window-to-open-url-from.html' title='Request the parent window to open a URL from an iframe with different domains'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-3277571504683218698</id><published>2012-03-08T10:30:00.000-05:00</published><updated>2012-03-08T10:30:17.603-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SVN"/><title type='text'>SVN commands</title><content type='html'>&lt;b&gt;Create a patch&lt;/b&gt;&lt;br /&gt;
svn diff &gt; ~/fix_ugly_bug.diff&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Apply a patch&lt;/b&gt;&lt;br /&gt;
patch -p0 -i ~/fix_ugly_bug.diff</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/3277571504683218698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/03/svn-commands.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3277571504683218698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3277571504683218698'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/03/svn-commands.html' title='SVN commands'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-8992547402631940763</id><published>2012-03-05T16:01:00.000-05:00</published><updated>2012-03-05T16:01:29.571-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="css"/><title type='text'>Text lineup using html span tag</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt;
span {
&amp;nbsp; display: inline-block;
&amp;nbsp; width: 50px;
}
&amp;lt;/style&amp;gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/8992547402631940763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/03/text-lineup-using-html-span-tag.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/8992547402631940763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/8992547402631940763'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/03/text-lineup-using-html-span-tag.html' title='Text lineup using html span tag'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-1000372607040248962</id><published>2012-01-31T12:52:00.003-05:00</published><updated>2012-01-31T12:54:53.261-05:00</updated><title type='text'>Intersection of lists in Python</title><content type='html'>&lt;pre class=&#39;prettyprint&#39;&gt;def intersect(a, b):&lt;br /&gt;    return list(set(a) &amp; set(b))&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/1000372607040248962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/01/intersection-of-lists-in-python.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/1000372607040248962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/1000372607040248962'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2012/01/intersection-of-lists-in-python.html' title='Intersection of lists in Python'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-6275668803221748136</id><published>2011-12-17T17:35:00.000-05:00</published><updated>2011-12-17T17:35:01.403-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>Install software from source on a shared Linux server</title><content type='html'>It&#39;s a very common task that installing a software from source on a shared Linux server. If you have root privilege, it suffice to install the package by &quot;sudo apt-get install package_name&quot; on Ubuntu or Fedora, or &quot;yum install package_name&quot; on redhat or centOS. However, the common case is that we do not have root privilege and do not have write access to folders other than $HOME. To install a software or package in this situation, we have to build it from source as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;$ mkdir -p ~/tmp      # create a temp folder for installation process
$ export TEMP=~/tmp   # set it to be the sys tmp folder
$ wget url            # get the package source from URL, or you can upload it to the server by sftp
$ unzip file          # if the package is .zip
$ tar xf file         # if the package is a tar ball
$ cd source           # source should be replaced by the folder you just unpacked from .zip or .tar
$ ./configure --prefix=$HOME
$ make
$ make install
$ make clean
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/6275668803221748136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/install-software-from-source-on-shared.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/6275668803221748136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/6275668803221748136'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/install-software-from-source-on-shared.html' title='Install software from source on a shared Linux server'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-1666135066705988896</id><published>2011-12-15T14:42:00.005-05:00</published><updated>2011-12-15T17:58:14.471-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Algorithm"/><category scheme="http://www.blogger.com/atom/ns#" term="Interview"/><title type='text'>Fibonacci calculation algorithm</title><content type='html'>&lt;b&gt;Iterative version:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;int fibonacci(int n) {
    if (n &lt; 2)
        return n;
    int prev = 0;
    int last = 1;
    for (int i=2; i&lt;=n; ++i) {
        prev = last;
        last = prev + last;
    }
    return last;
}
&lt;/pre&gt;
The time complexity is O(n) while the space complexity is O(3) or constant.&lt;br/&gt;&lt;br/&gt;

&lt;b&gt;Recursive version:&lt;/b&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;int fib(int n) {
    if (n &lt; 2)
      return n;
    return fib(n - 1) + fib(n - 2);
}
&lt;/pre&gt;
However, this straightforward solution for Fibonacci is extremely inefficient. Since the computation complexity would be exponential as many text books indicated. An intelligent solution is given below, which is O(n). The origin of this solution is &lt;a href=&quot;http://www.cs.northwestern.edu/academics/courses/110/html/fib_rec.html&quot; target=&#39;_blank&#39;&gt;here&lt;/a&gt;.
&lt;pre class=&#39;prettyprint&#39;&gt;int fib(int n, int p0=0, int p1=1) {
    if (n==0)
        return 0;
    else if (n==1)
        return p1;
    else
        return fib(n - 1, p1, p0 + p1);
}
&lt;/pre&gt;There are recursive solutions are doing even better than O(n). See this &lt;a href=&quot;http://knol.google.com/k/efficient-recursive-computation-of-fibonacci-numbers&quot;&gt;link&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/1666135066705988896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/fibonacci-calculation-algorithm.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/1666135066705988896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/1666135066705988896'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/fibonacci-calculation-algorithm.html' title='Fibonacci calculation algorithm'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-7676218687048748711</id><published>2011-12-12T21:35:00.000-05:00</published><updated>2011-12-12T21:35:29.175-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Algorithm"/><title type='text'>Find the ith smallest element of the array in O(n)</title><content type='html'>How to find the ith smallest element of the array in O(n) time is a frequently asked question. The straightforward solution is sorting the array and return the ith element. However, for general cases, it&#39;s proven that sorting algorithms like merge sorting, is lower bound to O(nlogn). Thus finding the ith smallest element is unfeasible by a merge sorting. Although for some special cases, such as, the possible values or data range of the array is relatively small, counting sorting can give a O(n) solution, it doesn&#39;t work for general cases. The solution below works generally and the expected running time is O(n).&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;int find_ith_smallest_elem(int* A, int left, int right, int i) {
&amp;nbsp; &amp;nbsp; if (left==right) &amp;nbsp;//only one element left, then it&#39;s the answer
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return A[left];
&amp;nbsp; &amp;nbsp; pivot = random_partition(A,left,right);
&amp;nbsp; &amp;nbsp; left_partition_length = pivot - left + 1; //1 counts for the pivot itself
&amp;nbsp; &amp;nbsp; if (i==left_partition_length)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return A[pivot]; &amp;nbsp;//pivot is the answer
&amp;nbsp; &amp;nbsp; else if (i&amp;lt;left_partition_length)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return find_ith_smallest_elem(A,left,pivot-1,i);
&amp;nbsp; &amp;nbsp; else
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return find_ith_smallest_elem(A,pivot+1,right,i-left_partition_length);
}

//randomly choose a pivot and partition the array into two parts, where the left part only
//contains elements smaller than the pivot while the right part only contains larger ones
int random_partition(int* A, int left, int right) {
    int pivot = rand(left,right);
    swap(A,pivot,right); // swap the pivot and the right-most element
    int pivot_value = A[right];
    int i = left - 1;
    for(int j=left; j&amp;lt;right; ++j) {
        if (A[j]&amp;lt;=pivot_value) {
            i++;
            swap(A,i,j); 
        }
    }
    swap(A,i+1,right);
    return i+1;
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/7676218687048748711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/find-ith-smallest-element-of-array-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7676218687048748711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7676218687048748711'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/find-ith-smallest-element-of-array-in.html' title='Find the ith smallest element of the array in O(n)'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-7857900938798393148</id><published>2011-12-08T11:00:00.017-05:00</published><updated>2011-12-08T23:44:05.577-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><title type='text'>JSON Parsing in java with Jackson</title><content type='html'>When it comes to API data and results (like google APIs), json is of great favor to java developers. There are more than 50 libraries for json processing in different languages. To get an overview of json structure and access the libraries, please refer to &lt;a href=&quot;http://www.json.org/&quot;&gt;http://www.json.org/&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Jackson offers three alternative methods for processing JSON:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;Streaming API&lt;/span&gt; reads and writes JSON content as discrete events.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;Tree Model&lt;/span&gt; provides a mutable in-memory tree representation of a JSON document.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;Data Binding&lt;/span&gt; converts JSON to and from POJOs based either on property accessor conventions or annotations.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
For a known structure of API return and the requirement to reconstruct similar data skeleton, it would be effortless if &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;Tree Model&lt;/span&gt; is used for the recovery.&lt;br /&gt;
&lt;br /&gt;
To download the latest version of Jackson, please refer to:&lt;a href=&quot;http://wiki.fasterxml.com/JacksonDownload&quot;&gt;http://wiki.fasterxml.com/JacksonDownload&lt;/a&gt;. Both jackson.core and jackson.mapper will be needed for &lt;span class=&quot;font&quot;&gt;Tree Model&lt;/span&gt; processing.&lt;br /&gt;
&lt;br /&gt;
To add the dependencies from internal jars in Eclipse, refer to:&lt;a href=&quot;http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)&quot;&gt;How to Add JARs to Project Build Paths in Eclipse&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://wiki.fasterxml.com/JacksonTreeModel&quot;&gt;Tree Model Processing Step by Step&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/7857900938798393148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/json-parsing-in-java-with-jackson.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7857900938798393148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7857900938798393148'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/json-parsing-in-java-with-jackson.html' title='JSON Parsing in java with Jackson'/><author><name>Josie</name><uri>http://www.blogger.com/profile/01837005103915645854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH8FS8voYqdyAT0Jnrp7vmX5XQdCWmFYsX4KV0fM8RdyJh81o8lDhs3Shi-5weaCtvW-ypZrhw-sbEMyuniOjBfF-AAA5nBXZTYt_2urth-jPKraYoZsIR6yhSLGbg_jg/s220/e86d8d27378da343cb9f27f2b32a9c8e.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-4465254575134359315</id><published>2011-12-07T15:46:00.000-05:00</published><updated>2011-12-07T15:46:51.471-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Facebook Development"/><title type='text'>Facebook JavaScript SDK Call after FB.init()</title><content type='html'>When developing Facebook Apps, the JavaScript SDK is usually loaded asynchronously to not block loading other elements of your page. However, it leaves us a problem: every JavaScript SDK call must be made after the SDK loading. Otherwise, a &quot;FB not defined&quot; error will be thrown. There are two common ways to handle this situation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Put the codes inside the callback function of fbAsyncInit process&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;div id=&quot;fb-root&quot;&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script&amp;gt;
&amp;nbsp; window.fbAsyncInit = function() {
&amp;nbsp; &amp;nbsp; FB.init({
&amp;nbsp; &amp;nbsp; &amp;nbsp; appId &amp;nbsp; &amp;nbsp; &amp;nbsp;: &#39;YOUR_APP_ID&#39;,
&amp;nbsp; &amp;nbsp; &amp;nbsp; channelUrl : &#39;//WWW.YOUR_DOMAIN.COM/channel.html&#39;,
&amp;nbsp; &amp;nbsp; &amp;nbsp; status &amp;nbsp; &amp;nbsp; : true,
&amp;nbsp; &amp;nbsp; &amp;nbsp; cookie &amp;nbsp; &amp;nbsp; : true,
&amp;nbsp; &amp;nbsp; &amp;nbsp; oauth &amp;nbsp; &amp;nbsp; &amp;nbsp;: true,
&amp;nbsp; &amp;nbsp; &amp;nbsp; xfbml &amp;nbsp; &amp;nbsp; &amp;nbsp;: true
&amp;nbsp; &amp;nbsp; });
&amp;nbsp; &amp;nbsp; // Put Your Codes Here
&amp;nbsp; };

&amp;nbsp; (function(d){
&amp;nbsp; &amp;nbsp; &amp;nbsp;var js, id = &#39;facebook-jssdk&#39;; if (d.getElementById(id)) {return;}
&amp;nbsp; &amp;nbsp; &amp;nbsp;js = d.createElement(&#39;script&#39;); js.id = id; js.async = true;
&amp;nbsp; &amp;nbsp; &amp;nbsp;js.src = &quot;//connect.facebook.net/en_US/all.js&quot;;
&amp;nbsp; &amp;nbsp; &amp;nbsp;d.getElementsByTagName(&#39;head&#39;)[0].appendChild(js);
&amp;nbsp; &amp;nbsp;}(document));
&amp;lt;/script&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Add delay to your SDK call&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;/**
&amp;nbsp;* do something when user leaves a new comment
&amp;nbsp;*/
function fb_event_subscribe() {
&amp;nbsp; &amp;nbsp; try {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FB.Event.subscribe(&#39;comment.create&#39;, function(response) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // do something here
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; catch(err) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setTimeout(&quot;fb_event_subscribe()&quot;,1000); // try again later
&amp;nbsp; &amp;nbsp; }
};

/**
&amp;nbsp;* subscribe the Facebook event &quot;comment.create&quot; after a one second delay, which
&amp;nbsp;* makes sure FB JavaScript SDK asynchronous initialization FB.init() is finished.
&amp;nbsp;*/
setTimeout(&quot;fb_event_subscribe()&quot;,1000);
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/4465254575134359315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/facebook-javascript-sdk-call-after.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4465254575134359315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4465254575134359315'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/12/facebook-javascript-sdk-call-after.html' title='Facebook JavaScript SDK Call after FB.init()'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-2585567441810937788</id><published>2011-11-29T16:58:00.008-05:00</published><updated>2011-12-01T13:14:49.035-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Iterate over a Map(HashMap) in Java</title><content type='html'>Here are three methods of iterating through a Map(HashMap) in Java and their pros and cons. They all works for any map implementation in Java, e.g. HashMap, TreeMap, HashTable,LinkedHashMap.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Method #1&lt;/b&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;Iterating over Entries&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; &quot;&gt;&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(187, 187, 187); border-right-color: rgb(187, 187, 187); border-bottom-color: rgb(187, 187, 187); border-left-color: rgb(187, 187, 187); padding-top: 10px; padding-right: 0px; padding-bottom: 10px; padding-left: 15px; max-height: 600px; overflow-x: auto; overflow-y: auto; background-color: rgb(253, 253, 253); width: 645px; margin-top: 5px; margin-right: auto; margin-bottom: 10px; margin-left: auto; &quot;&gt;&lt;code style=&quot;font-size: 14px; color: rgb(0, 0, 192); &quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;HashMap&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entry &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;entrySet&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;())&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;Key = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;, Value = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;getValue&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;());&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/b&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;pros : You can get both keys and values via entrySet().&lt;br /&gt;cons: NullPointerException will be thrown if you try to iterate over a null map. You should always check for null references before iterating.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Method #2&lt;/b&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;Iterating over either Key or Value Sets&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(187, 187, 187); border-right-color: rgb(187, 187, 187); border-bottom-color: rgb(187, 187, 187); border-left-color: rgb(187, 187, 187); padding-top: 10px; padding-right: 0px; padding-bottom: 10px; padding-left: 15px; max-height: 600px; overflow-x: auto; overflow-y: auto; background-color: rgb(253, 253, 253); width: 645px; margin-top: 5px; margin-right: auto; margin-bottom: 10px; margin-left: auto; &quot;&gt;&lt;code style=&quot;font-size: 14px; color: rgb(0, 0, 192); &quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;color: rgb(63, 127, 95); &quot;&gt;//iterating over keys only&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; key &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;keySet&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;())&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;Key = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; key&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;color: rgb(63, 127, 95); &quot;&gt;//iterating over values only&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; value &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;values&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;())&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;Value = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; value&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;pros: If all you need is either key sets or value sets, this method is about 10% faster than iteration over entrySet(), and also cleaner.&lt;/integer,&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/div&gt;&lt;div&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;cons: The same as above&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Method #3&lt;/b&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;Iterating using Iterator&lt;br /&gt;&lt;/span&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;--With Generics&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(51, 51, 51); &quot;&gt;&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(187, 187, 187); border-right-color: rgb(187, 187, 187); border-bottom-color: rgb(187, 187, 187); border-left-color: rgb(187, 187, 187); padding-top: 10px; padding-right: 0px; padding-bottom: 10px; padding-left: 15px; max-height: 600px; overflow-x: auto; overflow-y: auto; background-color: rgb(253, 253, 253); width: 645px; margin-top: 5px; margin-right: auto; margin-bottom: 10px; margin-left: auto; &quot;&gt;&lt;code style=&quot;font-size: 14px; color: rgb(0, 0, 192); &quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Iterator&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entries &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;entrySet&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;().&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;iterator&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;hasNext&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;())&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entry &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entries&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;next&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;Key = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;, Value = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;getValue&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;());&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/div&gt;&lt;div&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;--Without Generics&lt;/span&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/div&gt;&lt;div&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;integer, integer=&quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(51, 51, 51); font-family: georgia; &quot;&gt;&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(187, 187, 187); border-right-color: rgb(187, 187, 187); border-bottom-color: rgb(187, 187, 187); border-left-color: rgb(187, 187, 187); padding-top: 10px; padding-right: 0px; padding-bottom: 10px; padding-left: 15px; max-height: 600px; overflow-x: auto; overflow-y: auto; background-color: rgb(253, 253, 253); width: 645px; margin-top: 5px; margin-right: auto; margin-bottom: 10px; margin-left: auto; &quot;&gt;&lt;code style=&quot;font-size: 14px; color: rgb(0, 0, 192); &quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Iterator&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entries &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;entrySet&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;().&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;iterator&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;hasNext&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;())&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entry &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; entries&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;next&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; key &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; value &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;getValue&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;Key = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; key &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;, Value = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; value&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/div&gt;&lt;div&gt;The same method can be used for obtaining the key and value sets respectively. Its performance is equal to for-each loop.&lt;/div&gt;&lt;div&gt;pros: It is the only way if you want to remove entries during iteration by implementing iterator.remove(). If you do this in for-each loop, you will get unpredictable results.&lt;/div&gt;&lt;div&gt;cons: Look a little redundant than other methods.&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;b&gt;Method #4&lt;/b&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(51, 102, 255); font-family: arial; &quot;&gt;Iterating over key sets and search values &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial; &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial; &quot;&gt;inefficient&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial; &quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(51, 51, 51); font-family: georgia; &quot;&gt;&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(187, 187, 187); border-right-color: rgb(187, 187, 187); border-bottom-color: rgb(187, 187, 187); border-left-color: rgb(187, 187, 187); padding-top: 10px; padding-right: 0px; padding-bottom: 10px; padding-left: 15px; max-height: 600px; overflow-x: auto; overflow-y: auto; background-color: rgb(253, 253, 253); width: 645px; margin-top: 5px; margin-right: auto; margin-bottom: 10px; margin-left: auto; &quot;&gt;&lt;code style=&quot;font-size: 14px; color: rgb(0, 0, 192); &quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&amp;gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: rgb(127, 0, 85); font-weight: bold; &quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; key &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;keySet&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;())&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; value &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; map&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;get&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;key&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;Key = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; key &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: rgb(42, 0, 255); &quot;&gt;&quot;, Value = &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt; value&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;Getting values by keys is inefficient and time-consuming, in different Maps it can be 20% to 200% slower than &lt;b&gt;Method #1&lt;/b&gt;.</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/2585567441810937788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/iterate-over-maphashmap-in-java.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/2585567441810937788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/2585567441810937788'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/iterate-over-maphashmap-in-java.html' title='Iterate over a Map(HashMap) in Java'/><author><name>Josie</name><uri>http://www.blogger.com/profile/01837005103915645854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH8FS8voYqdyAT0Jnrp7vmX5XQdCWmFYsX4KV0fM8RdyJh81o8lDhs3Shi-5weaCtvW-ypZrhw-sbEMyuniOjBfF-AAA5nBXZTYt_2urth-jPKraYoZsIR6yhSLGbg_jg/s220/e86d8d27378da343cb9f27f2b32a9c8e.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-7906754079022504429</id><published>2011-11-29T14:02:00.000-05:00</published><updated>2011-11-29T14:02:46.843-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cygwin"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>Arrow keys not working in Vim on Cygwin</title><content type='html'>Installed Cygwin today on my machine (ThinkPad, XP SP3). The arrow keys in Vim always bring me out from insert mode. And there is no syntax highlight at all.&lt;br /&gt;
&lt;br /&gt;
The quick fix is copy /usr/share/vim/vim73/vimrc_example.vim to ~/.vimrc. Then everything works perfectly now.</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/7906754079022504429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/arrow-keys-not-working-in-vim-on-cygwin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7906754079022504429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7906754079022504429'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/arrow-keys-not-working-in-vim-on-cygwin.html' title='Arrow keys not working in Vim on Cygwin'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-2833975301942339040</id><published>2011-11-27T14:01:00.000-05:00</published><updated>2011-11-27T14:01:35.790-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cookie"/><category scheme="http://www.blogger.com/atom/ns#" term="mod_wsgi"/><title type='text'>Read and write cookies in mod_wsgi application</title><content type='html'>&lt;b&gt;Read a cookie from HTTP header:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;def application(environ, start_response):
    import Cookie
    cookie = Cookie.SimpleCookie()
    cookie.load(environ[&#39;HTTP_COOKIE&#39;])
    access_token = cookie[&#39;access_token&#39;].value
&lt;/pre&gt;&lt;b&gt;Write a cookie to HTTP header:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;def application(environ, start_response):
    import Cookie
    cookie = Cookie.SimpleCookie()
    cookie[&#39;access_token&#39;] = &#39;1xRD3WXsdfsw23rjfsj9L&#39;
    access_token = cookie[&#39;access_token&#39;].value
    start_response(&#39;200 OK&#39;, (&#39;Set-Cookie&#39;,cookie[&quot;access_token&quot;].OutputString())])
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/2833975301942339040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/read-and-write-cookies-in-modwsgi.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/2833975301942339040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/2833975301942339040'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/read-and-write-cookies-in-modwsgi.html' title='Read and write cookies in mod_wsgi application'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-3756063342865067241</id><published>2011-11-23T01:12:00.000-05:00</published><updated>2011-11-23T01:12:17.830-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mod_wsgi"/><title type='text'>The envrion dictionary in mod_wsgi applications</title><content type='html'>The following codes will show the content of the environ dictionary for quick debugging.&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;def application(environ, start_response):
    output = [&#39;%s: %s&#39; % (key, value) for key, value in sorted(environ.items())]
    output = &#39;\n&#39;.join(output)

    response_headers = [
        (&#39;Content-Length&#39;, str(len(output))),
        (&#39;Content-Type&#39;, &#39;text/plain&#39;),
    ]
    start_response(&#39;200 OK&#39;, response_headers)
    return [output]
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/3756063342865067241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/envrion-dictionary-in-modwsgi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3756063342865067241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3756063342865067241'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/envrion-dictionary-in-modwsgi.html' title='The envrion dictionary in mod_wsgi applications'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-5159594267340341939</id><published>2011-11-23T00:50:00.001-05:00</published><updated>2011-11-23T00:56:26.818-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="mod_wsgi"/><title type='text'>URI redirection in mod_wsgi scripts</title><content type='html'>See this simple example:&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;def application(environ, start_response):
    if environ[&#39;REQUEST_METHOD&#39;]!=&#39;GET&#39;:
        start_response(&#39;301 Redirect&#39;, [(&#39;Location&#39;,  http://example.com&#39;),])
        return []

    response_headers = [
        (&#39;Content-Length&#39;, str(len(output))),
        (&#39;Content-Type&#39;, &#39;text/plain&#39;),
    ]

    start_response(&#39;200 OK&#39;, response_headers)

    return [&quot;Hello World&quot;]
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/5159594267340341939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/uri-redirection-in-modwsgi-scripts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/5159594267340341939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/5159594267340341939'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/uri-redirection-in-modwsgi-scripts.html' title='URI redirection in mod_wsgi scripts'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-3808638518925004016</id><published>2011-11-23T00:09:00.000-05:00</published><updated>2011-11-23T00:09:54.230-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>VIM highlight file with certain extensions</title><content type='html'>For example, to force VIM highlight *.wsgi files with Python syntax, add folllowing lines to your .vimrc file.&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;syntax on
filetype on
au BufNewFile,BufRead *.wsgi set filetype=python
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/3808638518925004016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/vim-highlight-file-with-certain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3808638518925004016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3808638518925004016'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/vim-highlight-file-with-certain.html' title='VIM highlight file with certain extensions'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-757790371014458338</id><published>2011-11-22T14:42:00.000-05:00</published><updated>2011-11-22T14:43:31.710-05:00</updated><title type='text'>Start-Up Spirit</title><content type='html'>AngelList&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://angel.co/about_angellist&quot;&gt;http://angel.co/about_angellist&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/757790371014458338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/start-up-spirit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/757790371014458338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/757790371014458338'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/start-up-spirit.html' title='Start-Up Spirit'/><author><name>Josie</name><uri>http://www.blogger.com/profile/01837005103915645854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH8FS8voYqdyAT0Jnrp7vmX5XQdCWmFYsX4KV0fM8RdyJh81o8lDhs3Shi-5weaCtvW-ypZrhw-sbEMyuniOjBfF-AAA5nBXZTYt_2urth-jPKraYoZsIR6yhSLGbg_jg/s220/e86d8d27378da343cb9f27f2b32a9c8e.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-4521793280256029730</id><published>2011-11-21T18:23:00.002-05:00</published><updated>2011-11-21T18:23:45.104-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SVN"/><title type='text'>Add all unversioned files to SVN</title><content type='html'>&lt;pre class=&#39;prettyprint&#39;&gt;svn st | grep &quot;^\?&quot; | awk &quot;{print \$2}&quot; | xargs svn add $1&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/4521793280256029730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/add-all-unversioned-files-to-svn.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4521793280256029730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4521793280256029730'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/add-all-unversioned-files-to-svn.html' title='Add all unversioned files to SVN'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-4511615284544503702</id><published>2011-11-15T19:11:00.000-05:00</published><updated>2011-11-15T19:11:25.783-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTTP"/><category scheme="http://www.blogger.com/atom/ns#" term="Web"/><title type='text'>Difference between GET and POST</title><content type='html'>&lt;ul&gt;&lt;li&gt;Use GET for safe actions and POST for unsafe actions.&lt;/li&gt;
&lt;li&gt;Use POST when dealing with sensitive data.&lt;/li&gt;
&lt;li&gt;Use POST when dealing with long requests.&lt;/li&gt;
&lt;li&gt;Use GET in AJAX environments.&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/4511615284544503702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/difference-between-get-and-post.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4511615284544503702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/4511615284544503702'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/difference-between-get-and-post.html' title='Difference between GET and POST'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-3191329654965291295</id><published>2011-11-15T17:54:00.000-05:00</published><updated>2011-11-15T17:54:39.770-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>SQL subquery examples</title><content type='html'>&lt;b&gt;Join a subquery&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;SELECT DISTINCT Email FROM Accounts JOIN 
(
    SELECT CouponId, UserId, AccountId 
    FROM Coupons JOIN Users USING(UserId) 
    WHERE CouponType=123
) AS tbl
USING(AccountId);
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/3191329654965291295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/sql-subquery-examples.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3191329654965291295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/3191329654965291295'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/sql-subquery-examples.html' title='SQL subquery examples'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-5479414956656825581</id><published>2011-11-13T15:59:00.002-05:00</published><updated>2011-11-14T09:52:36.089-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Latex"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Quick start on latex beamer [Ubuntu]</title><content type='html'>Beamer is a Tex class to make slide presentations. The advantages of Beamer over PowerPoint or OpenOffice:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;If you are creating slides from a larger document, you can simply re-use your LaTeX source material from that document.&lt;/li&gt;
&lt;li&gt;If you need mathematical content in your slides, you have the wealth of mathematical constructs in LaTeX to draw upon.&lt;/li&gt;
&lt;li&gt;The slides you create are multi-platform.&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;Installation on Ubuntu&lt;/b&gt;&lt;br /&gt;
$ sudo apt-get install latex-beamer&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Create your own slides from a template&lt;/b&gt;&lt;br /&gt;
A good template can be found &lt;a href=&quot;http://www.math.zju.edu.cn/ligangliu/LaTeXForum/Tools/slides/dsecbeamer.tar.gz&quot;&gt;here&lt;/a&gt;. Note: compile it by PdfLatex, or press F6 in TexMaker.</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/5479414956656825581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/quick-example-of-beamer-on-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/5479414956656825581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/5479414956656825581'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/quick-example-of-beamer-on-ubuntu.html' title='Quick start on latex beamer [Ubuntu]'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-7507457832139749859</id><published>2011-11-08T17:32:00.000-05:00</published><updated>2011-11-08T17:32:02.647-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>The order of Python dictionary</title><content type='html'>Dictionary is one of the most useful datatype in Python. It provides quick access to the value stored with the key. For example, &lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;&gt;&gt;&gt;author={&#39;Harry Potter&#39;:&#39;JK Rowling&#39;}
&gt;&gt;&gt;print author[&#39;Harry Potter&#39;]
JK Rowling
&lt;/pre&gt;The advantage of dictionary is quick access to the value associated with the key. The time complexity of searching and insertion are both O(1), which is much faster than array (i.e., list in Python). However, the disadvantage is that dictionary is implemented by hash table, which doesn&#39;t keep the original order in which the keys and values are inserted. For example,&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;&gt;&gt;&gt;author={&#39;A Tale of Two Cities&#39;:&#39;Charles Dickens&#39;,&#39;Harry Potter&#39;:&#39;JK Rowling&#39;}
&gt;&gt;&gt;author.items()
[(&#39;Harry Potter&#39;, &#39;JK Rowling&#39;), (&#39;A Tale of Two Cities&#39;, &#39;Charles Dickens&#39;)]
&lt;/pre&gt;Where the order of the printed out results is not same as the original order in the initialization. To solve this problem, use following codes to display the dictionary contents by the order of keys.&lt;br /&gt;
&lt;pre class=&#39;prettyprint&#39;&gt;keys = author.keys()
keys.sort()
for key in keys:
    print &quot;key=%s, value=%s&quot; % (key,author[key])
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/7507457832139749859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/order-of-python-dictionary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7507457832139749859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/7507457832139749859'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/order-of-python-dictionary.html' title='The order of Python dictionary'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5160328531119397307.post-9017058746257043995</id><published>2011-11-07T00:14:00.005-05:00</published><updated>2011-11-21T03:19:27.532-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>JavaScript: waiting 5 seconds and auto redirects</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;div&amp;gt;Redirect to the home page in &amp;lt;span id=&quot;countdown&quot;&amp;gt;5&amp;lt;/span&amp;gt; secondes...&amp;lt;/div&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
function countDown(){
 var count = document.getElementById(&#39;countdown&#39;).innerHTML-1;
 document.getElementById(&#39;countdown&#39;).innerHTML = count;
 if (count&amp;lt;=0) {
  location.href = &quot;http://networkplot.tk&quot;;
 }
 else {
  t=setTimeout(&quot;countDown()&quot;,1000);
 }
}
countDown();
&amp;lt;/script&amp;gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://achilles-keep-moving.blogspot.com/feeds/9017058746257043995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/javascript-waiting-5-seconds-and-auto.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/9017058746257043995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5160328531119397307/posts/default/9017058746257043995'/><link rel='alternate' type='text/html' href='http://achilles-keep-moving.blogspot.com/2011/11/javascript-waiting-5-seconds-and-auto.html' title='JavaScript: waiting 5 seconds and auto redirects'/><author><name>Achilles</name><uri>http://www.blogger.com/profile/06941725483326536858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIfNtco8VbRYYZ09EUx4B2elOb92QWowxVQNsf2JZgT3sjU6_5Q4_INNyDj-Ry__gaAvWGpIzV4A4ccnarlKHEl7oNicpOWq7DtHJQfhTjVheHg6rr82X8YISo1I5iPnU/s220/polar_bear.jpg'/></author><thr:total>1</thr:total></entry></feed>