<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6835740</id><updated>2011-12-06T10:07:50.983-05:00</updated><category term='apache'/><category term='linux'/><category term='zmd'/><category term='javascript'/><category term='opensuse'/><category term='mysql'/><category term='java'/><category term='ajax'/><category term='security'/><category term='hindi'/><category term='howto'/><category term='sftp'/><category term='programming'/><category term='latex'/><category term='livejournal'/><category term='webcam'/><category term='lucene'/><category term='ssh'/><category term='skype'/><category term='word'/><category term='tooltip'/><category term='bash'/><category term='networking'/><category term='suse'/><category term='encryption'/><category term='dojo'/><category term='open office'/><category term='shell'/><category term='software'/><category term='optimization'/><category term='internet'/><category term='blogscope'/><category term='video'/><category term='performance'/><category term='bsnl'/><category term='raid'/><category term='acer'/><category term='widget'/><category term='password'/><category term='blogs'/><category term='laptop'/><category term='google'/><title type='text'>Mostly Harmless</title><subtitle type='html'>Welcome to my geeky world!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>40</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6835740.post-4777772085105079097</id><published>2009-05-22T01:03:00.016-04:00</published><updated>2009-05-31T23:30:44.950-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java - memory, x64, performance</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://java.sun.com/"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://photos1.blogger.com/blogger/5042/390/200/java-logo.png" alt="" border="0"&gt;&lt;/a&gt;

&lt;p&gt;A long time ago, I wrote &lt;a href="http://nileshbansal.blogspot.com/2006/07/amd64-javalangoutofmemoryerror.html"&gt;how bad x64 Java is&lt;/a&gt;. Well the good news is -- no more. With &lt;a href="http://blogs.sun.com/vita/entry/6u14_is_on_its_way"&gt;6u14 just around the corner&lt;/a&gt;, sanity will be back. Starting update 14, the 64-bit version with Heap sizes below 32GB will use almost the same amount of memory as the 32-bit JVM. All this because of the use &lt;a href="http://wikis.sun.com/display/HotSpotInternals/CompressedOops"&gt;compressed pointers&lt;/a&gt; to &lt;a href="http://www.1060.org/blogxter/entry?publicid=1F0377DE37DD6705BE96CC2BC27FEA19"&gt;save memory&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It gets even better, the compressed pointers are already available with the &lt;a href="http://java.sun.com/javase/technologies/performance.jsp"&gt;Java SE Performance Release&lt;/a&gt; since July 2008 (someone should have told me earlier). All that needs to be done is, &lt;a href="http://ch.sun.com/sunnews/events/2009/apr/adworkshop/pdf/5-1-Java-Performance.pdf"&gt;use &lt;tt&gt;-XX:+UseCompressedOops&lt;/tt&gt;&lt;/a&gt;. So I finally decided to give it a try and compare memory usages.&lt;/p&gt;

&lt;p&gt;To compare, I used the following test program with &lt;tt&gt;1.6.0_11i686&lt;/tt&gt; (32-bit), &lt;tt&gt;1.6.0_11x64&lt;/tt&gt; (64-bit), and &lt;tt&gt;1.6.0_06performace with -XX:+UseCompressedOops&lt;/tt&gt; (64-bit performance) on my desktop with 8GB memory and Intel quad core processor. The minimum amount of memory required to run the program are reported below.&lt;/p&gt;
&lt;pre&gt;#File: JavaMemoryProblems.java
import java.util.HashMap;
import java.util.Map;
public class JavaMemoryProblems {
   public static void main(String[] args) {
       Map&amp;lt;String, Integer&amp;gt; map = new HashMap&amp;lt;String, Integer&amp;gt;();
       int max = 1000000;
       for (int i=0; i&amp;lt;max; i++) {
           map.put("key"+i, new Integer(i));
       }
       System.out.println("Finished with a map of size "+map.size());
   }
}

&lt;/pre&gt;

&lt;table style="border: thin sold black;"&gt;
 &lt;tr&gt;&lt;td&gt;
 &lt;/td&gt;&lt;td&gt;
  with -XX:+UseSerialGC
 &lt;/td&gt;&lt;td&gt;
  with -XX:+UseParallelGC
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;
  32-bit
 &lt;/td&gt;&lt;td&gt;
  110 MB
 &lt;/td&gt;&lt;td&gt;
   110 MB
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;
  64-bit
 &lt;/td&gt;&lt;td&gt;
  180 MB
 &lt;/td&gt;&lt;td&gt;
  220 MB
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;
  performance
 &lt;/td&gt;&lt;td&gt;
  130 MB
 &lt;/td&gt;&lt;td&gt;
  160 MB
 &lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;The test program is the same as &lt;a href="http://nileshbansal.blogspot.com/2006/07/amd64-javalangoutofmemoryerror.html"&gt;my previous post&lt;/a&gt;, and the decrease in the memory is quite amazing. Time to throw the 32-bit JVM out of the window. I haven't done any tests around increase in CPU time, but I do not expect any penalty in run time based on few of my google searches&lt;/p&gt;.

&lt;p style="color: #ff0000;"&gt;Update on 31st May 2009: After using the &lt;i&gt;performance release&lt;/i&gt; in production for a few days I realize it is broken. The application is performing weirdly, giving incorrect output and throwing exceptions. I have now switched back to the regular release 6u13 release, and everything is fine again. I am not sure if it is really a Java bug or something else, but I am not taking any chances.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-4777772085105079097?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/4777772085105079097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=4777772085105079097' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/4777772085105079097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/4777772085105079097'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2009/05/java-memory-x64-performance.html' title='Java - memory, x64, performance'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-718715147972037142</id><published>2009-04-10T20:48:00.011-04:00</published><updated>2009-04-10T21:13:10.571-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Initializing Java Maps Inline</title><content type='html'>&lt;p&gt;Java is by no means a succinct language. For simple operations, the programmer is expected to punch in a hundred keys; but there are a few little shortcuts that can help (and of course Eclipse is always there to help). One such trick is inline initialization of Map which I stumbled across recently and found to be very interesting.&lt;/p&gt;
&lt;p&gt;
We are all used to using the following code to initialize a map - 
&lt;/p&gt;
&lt;pre&gt;
&lt;code class="java"&gt;
Map&amp;lt;String, String&gt; map = new HashMap&amp;lt;String, String&amp;gt;();
map.put("Harry", "Potter");
map.put("Ron", "Weasley");
map.put("Hermione", "Granger");
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
The problem with this code is it is four different statements. Using a small static initialization trick, you can make it to be a single statement as follows:
&lt;/p&gt;
&lt;pre&gt;
&lt;code class="java"&gt;
Map&amp;lt;String, String&amp;gt; map = new HashMap&amp;lt;String, String&amp;gt;() {{
   put("Harry", "Potter");
   put("Ron", "Weasley");
   put("Hermione", "Granger");
}};
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
All we are doing here is sub-classing the HashMap class to an anonymous class, and then using the &lt;a href="http://www.java2s.com/Tutorial/Java/0100__Class-Definition/UsingInitializationBlocksAnonstaticinitializationblock.htm"&gt;non-static&lt;/a&gt; &lt;a href="http://jpz-log.info/archives/2009/03/25/initialization-blocks-in-java/"&gt;initialization block&lt;/a&gt; to call the put() method three times.
&lt;/p&gt;
&lt;p&gt;PS - I have not updated this blog in a while, as I have been rather busy lately. From now on I will try to find some time, to at least write one post per month.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-718715147972037142?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/718715147972037142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=718715147972037142' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/718715147972037142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/718715147972037142'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2009/04/initializing-java-maps-inline.html' title='Initializing Java Maps Inline'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-490248811073512271</id><published>2008-11-17T16:17:00.004-05:00</published><updated>2008-11-17T18:14:06.909-05:00</updated><title type='text'>Ugrading GTK - Firefox 3 on SuSE 10.1</title><content type='html'>&lt;p&gt;I finally switched to Firefox 3 on my work PC. It runs opensuse 10.1, which runs an old version of GTK unsupported by Firefox. I did not want to upgrade SuSE just for Firefox, so decided to upgrade just gtk+. The problem is, gtk depends on thousand other packages. And the worst part is no one has documented how to upgrade them, what environment variables to set, and which packages to download. Here is what I did to install all of them, and it was not that bad.&lt;/p&gt;

&lt;p&gt;I installed the following packages (in same order):&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;glib-2.18.2.tar.bz2
 &lt;li&gt;pixman-0.12.0.tar.gz
 &lt;li&gt;cairo-1.8.4.tar.gz
 &lt;li&gt;pango-1.20.5.tar.bz2
 &lt;li&gt;atk-1.24.0.tar.gz 
 &lt;li&gt;gtk+-2.14.2.tar.bz2
&lt;/ul&gt;

&lt;p&gt;I decided to install everything under &lt;tt&gt;/opt/gtknew/&lt;/tt&gt; in order to keep my already working copy of gtk intact. Below are the environment variables I had to set before compiling all the packages above. For installation, I used &lt;tt&gt;./configure --prefix=/opt/gtknew/; make; make install&lt;/tt&gt; for all of the packages.&lt;/p&gt;

&lt;pre&gt;
export PKG_CONFIG_PATH=/opt/gtknew/lib/pkgconfig/:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/gtknew/lib/:$LD_LIBRARY_PATH
export PATH=/opt/gtknew/bin/:$PATH
&lt;/pre&gt;

&lt;p&gt;Once all gtk libraries were installed, all I had to do was to download firefox 3 and set the correct &lt;tt&gt;LD_LIBRARY_PATH&lt;/tt&gt;.&lt;/p&gt;
&lt;pre&gt;
tar jxvf firefox-3.0.4.tar.bz2
cd firefox
export LD_LIBRARY_PATH=/opt/gtknew/lib/:$LD_LIBRARY_PATH
./firefox
&lt;/pre&gt;

&lt;p&gt;I finally edited the &lt;tt&gt;firefox&lt;/tt&gt; executable script, and added the export command for LD_LIBRARY_PATH on the top of that file. Now Firefox uses the new GTK, while rest of the desktop is using the good old version of gtk.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-490248811073512271?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/490248811073512271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=490248811073512271' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/490248811073512271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/490248811073512271'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2008/11/ugrading-gtk-firefox-3-on-suse-101.html' title='Ugrading GTK - Firefox 3 on SuSE 10.1'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-2993754375438691729</id><published>2008-06-16T00:53:00.013-04:00</published><updated>2008-06-23T16:32:55.021-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='password'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Password Encryption: MySQL, Apache, and Standards</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.mysql.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_bsJ8N084DzI/Rq2W1BMs0uI/AAAAAAAAAB8/1k0cr3q_50o/s200/mysql.jpg" border="0" alt="" /&gt;&lt;/a&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://httpd.apache.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_bsJ8N084DzI/SFX33aGqHFI/AAAAAAAAAIU/904P-Oxd2LE/s200/apache.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5212344675023330386" /&gt;&lt;/a&gt;

&lt;p&gt;Recently while playing with user passwords and encryption schemes I realized standards MD5 or SHA are not really standards. At least not for &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html"&gt;MySQL&lt;/a&gt; and &lt;a href="http://httpd.apache.org/docs/2.2/misc/password_encryptions.html"&gt;Apache&lt;/a&gt;. Both claim to implements MD5 and SHA. The only problem is MD5 hash and SHA of same string is different on MySQL and Apache. Both, despite being components of the legendary &lt;a href="http://en.wikipedia.org/wiki/LAMP_(software_bundle)"&gt;LAMP&lt;/a&gt; stack make no effort of compatibility.&lt;/p&gt;

&lt;p&gt;To prove this lets experiment by encoding the string &lt;tt&gt;test&lt;/tt&gt;. Here is what MySQL outputs when using MD5 or SHA1&lt;/p&gt;
&lt;pre&gt;
mysql&gt; select md5("test");
+----------------------------------+
| md5("test")                      |
+----------------------------------+
| 098f6bcd4621d373cade4e832627b4f6 |
+----------------------------------+

mysql&gt; select sha1("test");
+------------------------------------------+
| sha1("test")                             |
+------------------------------------------+
| a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 |
+------------------------------------------+
&lt;/pre&gt;
&lt;p&gt;But here is what Apache expects&lt;/p&gt;
&lt;pre&gt;
[nilesh@krakow ~]$ htpasswd -nbm test test
test:$apr1$EzKMy...$yHUugfRt.9lc.Jc4Z4KzJ/
[nilesh@krakow ~]$ htpasswd -nbs test test
test:{SHA}qUqP5cyxm6YcTAhz05Hph5gvu9M=
&lt;/pre&gt;
&lt;p&gt;Obviously Apache expects different strings than what MySQL produces. Turns out we need to encode MySQL's output in base64 encoding. Here is the code snippet for encoding in Base64 in Java.&lt;/p&gt;
&lt;pre&gt;
System.out.println(new String(
       new org.apache.commons.codec.binary.Base64()
            .encode("098f6bcd4621d373cade4e832627b4f6"
                    .getBytes())));
System.out.println(new String(
       new org.apache.commons.codec.binary.Base64()
            .encode("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
                    .getBytes())));
&lt;/pre&gt;
&lt;p&gt;This outputs &lt;tt&gt;MDk4ZjZiY2Q0NjIxZDM3M2NhZGU0ZTgzMjYyN2I0ZjY=&lt;/tt&gt; and 
&lt;tt&gt;YTk0YThmZTVjY2IxOWJhNjFjNGMwODczZDM5MWU5ODc5ODJmYmJkMw==&lt;/tt&gt;. Even this does not match the Apache's required strings &lt;tt&gt;qUqP5cyxm6YcTAhz05Hph5gvu9M=&lt;/tt&gt; or &lt;tt&gt;qUqP5cyxm6YcTAhz05Hph5gvu9M=&lt;/tt&gt;. To conclude, MySQL and Apache are not compatible, at least not when it comes to encrypting passwords.&lt;/p&gt;

&lt;p&gt;I don't know why both projects chose not to implement exactly same algorithm. Anyway, after a few hours of debugging, I decided not to use MySQL's SHA implementation so that the encryption is now taken care by Java on application level using the code snippet in &lt;a href="http://httpd.apache.org/docs/2.2/misc/password_encryptions.html"&gt;apache's documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;UPDATE: Apache adds a &lt;a href="http://en.wikipedia.org/wiki/Salt_(cryptography)"&gt;random salt&lt;/a&gt; to protect the passwords against dictionary attacks. But the value of the salt used is &lt;a href="http://www.apachelounge.com/forum/viewtopic.php?p=8561"&gt;stored with the encrypted string&lt;/a&gt; (it is the one between &lt;tt&gt;$apr1$&lt;/tt&gt; and the following &lt;tt&gt;$&lt;/tt&gt; sign, i.e., &lt;tt&gt;EzKMy&lt;/tt&gt; in the above example), so I am now confused how would that protect against any kind of attack?&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-2993754375438691729?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/2993754375438691729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=2993754375438691729' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/2993754375438691729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/2993754375438691729'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2008/06/password-encryption-mysql-apache-and.html' title='Password Encryption: MySQL, Apache, and Standards'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bsJ8N084DzI/Rq2W1BMs0uI/AAAAAAAAAB8/1k0cr3q_50o/s72-c/mysql.jpg' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-7154843055894140794</id><published>2008-03-11T18:48:00.021-04:00</published><updated>2008-06-16T01:24:29.555-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='dojo'/><title type='text'>Creating Custom Dojo Widget using Cross-Domain Build</title><content type='html'>&lt;div style="width: 700px;"&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dojotoolkit.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_bsJ8N084DzI/R9cXcuk7mLI/AAAAAAAAAHY/LB452pa4XJc/s200/dojo-toolkit-logo.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5176632078992382130" /&gt;&lt;/a&gt;

&lt;p&gt;&lt;a href="http://www.dojotoolkit.org/"&gt;Dojo&lt;/a&gt; comes with a great set of widgets, but is it often necessary to create &lt;a href="http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/manipulating-widgets-through-code/writing-your"&gt;custom widgets&lt;/a&gt; for application specific needs. In this tutorial, I will walk through an example of such a custom widget. The custom widget resides on &lt;a href="http://www.blogscope.net/"&gt;my own server&lt;/a&gt;, while rest of the Dojo (and dijit) is used from &lt;a href="http://dev.aol.com/dojo"&gt;AOL CDN&lt;/a&gt; hosted xdomain build. &lt;a href="http://www.blogscope.net/external/dojo/customWidgetXD/test.html"&gt;Live demo of the widget&lt;/a&gt; is also available. This custom widget is built on &lt;a href="http://build.dojotoolkit.org/1.0.2/"&gt;Dojo 1.0.2&lt;/a&gt; and works great on Firefox 2, Konqueror 3.5.1, IE 6 and IE 7.&lt;/p&gt;

&lt;p&gt;We will create a new widget named &lt;tt&gt;blogscope.TestWidget&lt;/tt&gt; which extends the &lt;a href="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/layout/title-pane"&gt;dijit.TitlePane&lt;/a&gt;. Looking at the TitlePane &lt;a href="http://download.dojotoolkit.org/release-1.0.2/dojo-release-1.0.2/dijit/TitlePane.js"&gt;code&lt;/a&gt;, one can see the empty function &lt;tt&gt;onDownloadEnd&lt;/tt&gt; which is called when the widget finishes downloading content from an external url. For the custom widget, we will extend the &lt;tt&gt;TitlePane&lt;/tt&gt; by filling in this function with a simple &lt;tt&gt;alert()&lt;/tt&gt; statement.
&lt;/p&gt;

&lt;p&gt;First, we will use &lt;a href="http://redesign.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.declare"&gt;dojo.declare&lt;/a&gt; to extend the dijit widget to create the new custom widget. I will omit the details of this part, but you can &lt;a href="http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/writing-your-own-widget-class/direct-extension"&gt;find&lt;/a&gt;   &lt;a href="http://www.sitepen.com/blog/2007/11/13/dissecting-dijit/"&gt;examples&lt;/a&gt; &lt;a href="http://nileshbansal.blogspot.com/2007/09/enhanced-ajaxified-tooltips-using-dojo.html"&gt;elsewhere&lt;/a&gt;.
&lt;/p&gt;


&lt;pre style="width: 600px; overflow: auto;"&gt;
&lt;code class="javascript"&gt;
dojo.provide("blogscope.TestWidget");
dojo.require("dijit.TitlePane");
dojo.declare(
"blogscope.TestWidget",
[dijit.TitlePane],
{
 onDownloadEnd: function(currentConent){
  // summary:
  //  called when download is finished
  alert('Contents Loaded from '+this.href);
 }
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
If you are not using AOL CDN, then simply put the code above in file &lt;tt&gt;TestWidget.js&lt;/tt&gt;. Place this file in directory &lt;tt&gt;blogscope&lt;/tt&gt; such that the dojo path is &lt;tt&gt;/js/dojo/&lt;/tt&gt; and this widget file is in &lt;tt&gt;/js/blogscope/TestWidget.js&lt;/tt&gt;. Then you can &lt;a href="http://redesign.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.registerModulePath"&gt;register the widget&lt;/a&gt; as &lt;tt&gt;dojo.registerModulePath("blogscope", "../blogscope")&lt;/tt&gt; (the directory name containing the custom widget is relative to the Dojo directory) and use &lt;tt&gt;dojo.require("blogscope.TestWidget")&lt;/tt&gt; in your code. The name of the widget has to be the same as the name of the file containing the code.
&lt;/p&gt;

&lt;p&gt;Since we wish the xdomain build of Dojo, we need to do some more work. First, the custom widget source code has to be in file &lt;tt&gt;TestWidget.xd.js&lt;/tt&gt; and not &lt;tt&gt;TestWidget.js&lt;/tt&gt;. For the cross-domain build we need to add some more information as to what this module is providing and what all modules it depends on so that Dojo loading system can make sure that the dependencies are met. The contents of this file are as shown below.&lt;/p&gt;

&lt;pre style="width: 600px; overflow: auto;"&gt;
&lt;code class="javascript"&gt;
dojo._xdResourceLoaded({
depends: [["provide", "blogscope.TestWidget"],
["require", "dijit.TitlePane"]],
defineResource: function(dojo){
 if(!dojo._hasResource["blogscope.TestWidget"]){ 
  dojo._hasResource["blogscope.TestWidget"] = true;
  dojo.provide("blogscope.TestWidget");
  dojo.require("dijit.TitlePane");
  dojo.declare(
  "blogscope.TestWidget",
  [dijit.TitlePane],
  {
   onDownloadEnd: function(currentConent){
    // summary:
    //  called when download is finished
    alert('Contents Loaded from '+this.href);
   }
  }
 );
 }
}});
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;Note: Ideally, one should use &lt;a href="http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo/package-system-and-custom-builds"&gt;the dojo build system&lt;/a&gt; to generate &lt;tt&gt;.xd.js&lt;/tt&gt; files from &lt;tt&gt;.js&lt;/tt&gt; code. But I don't know how to use the build system, so I created the file manually. The main drawback of manual authoring is that the format of &lt;tt&gt;.xd.js&lt;/tt&gt; files may change with version (it is already different for Dojo version 1.1).&lt;/p&gt;

&lt;p&gt;Copy the file &lt;tt&gt;TestWidget.xd.js&lt;/tt&gt; on the server such that it is available at say &lt;tt&gt;http://www.blogscope.net/js/dojo/blogscope/TestWidget.xd.js&lt;/tt&gt;. Modify the &lt;tt&gt;djConfig&lt;/tt&gt; variable to set module path as shown below.&lt;/p&gt;

&lt;pre style="width: 600px; overflow: auto;"&gt;
&lt;code class="html"&gt;
&amp;lt;script type="text/javascript"
  djConfig="isDebug: true, parseOnLoad: true, useXDomain: true, modulePaths: {'blogscope': 'http://www.blogscope.net/js/dojo/blogscope'}"
  src="http://o.aolcdn.com/dojo/1.0.2/dojo/dojo.xd.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;script type='text/javascript'&amp;gt;
 dojo.require("blogscope.TestWidget");
 dojo.require("dojo.parser");
 &amp;lt;/script&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;Since, the module name &lt;tt&gt;blogscope&lt;/tt&gt; is registered to path &lt;tt&gt;http://www.blogscope.net/js/dojo/blogscope&lt;/tt&gt;, &lt;tt&gt;dojo.require()&lt;/tt&gt; adds the a link to &lt;tt&gt;http://www.blogscope.net/js/dojo/blogscope/TestWidget.xd.js&lt;/tt&gt; which can be seen using Firebug.&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bsJ8N084DzI/R9cW--k7mKI/AAAAAAAAAHQ/WiBN8hj4Yy8/s1600-h/firebug-custom1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_bsJ8N084DzI/R9cW--k7mKI/AAAAAAAAAHQ/WiBN8hj4Yy8/s400/firebug-custom1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5176631567891273890" /&gt;&lt;/a&gt;

&lt;p&gt;
The widget is now &lt;a href="http://www.blogscope.net/external/dojo/customWidgetXD/test.html"&gt;ready to use&lt;/a&gt; using the following HTML.
&lt;/p&gt;

&lt;pre style="width: 600px; overflow: auto;"&gt;
&lt;code class="html"&gt;
&amp;lt;div dojoType="blogscope.TestWidget" open="false" title="Click to Expand the Widget" href="ajaxContents.html"&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;Also See&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://dojotoolkit.org/node/17"&gt;Cross Domain Resource Loading in Dojo 0.4.2+ and 0.9&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://www.dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/cdn-timing-issue"&gt;Timing Issue when loading from CDN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-7154843055894140794?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/7154843055894140794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=7154843055894140794' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7154843055894140794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7154843055894140794'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2008/03/creating-custom-dojo-widget-using-cross.html' title='Creating Custom Dojo Widget using Cross-Domain Build'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bsJ8N084DzI/R9cXcuk7mLI/AAAAAAAAAHY/LB452pa4XJc/s72-c/dojo-toolkit-logo.png' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-6271362192024397864</id><published>2008-02-05T23:30:00.000-05:00</published><updated>2008-02-06T00:05:07.107-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webcam'/><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='skype'/><category scheme='http://www.blogger.com/atom/ns#' term='opensuse'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Webcam, Video Chat, and Linux</title><content type='html'>&lt;p&gt;I have been delaying purchasing a webcam for past one and a half years. Reason, I don't have windows. And webcams don't work on Linux. And even if they do, MSN is the only IM service you can use (via kopete) for video chat. Well no longer.&lt;/p&gt;

&lt;p&gt;Today I purchased a Logitech QuickCam Communicate STX after installing windows on my home desktop. Surprisingly, it works without any pain on my SuSE 10.3 desktop. All I did was to &lt;a href="http://en.opensuse.org/Webcam"&gt;install the driver rpm&lt;/a&gt; by adding the repository &lt;tt&gt;http://download.opensuse.org/repositories/drivers:/webcam/openSUSE_10.3&lt;/tt&gt; followed by &lt;a href="http://en.opensuse.org/YaST_Software_Management"&gt;installation&lt;/a&gt; of RPMs containing string &lt;tt&gt;spca&lt;/tt&gt;. The installed rpms were, &lt;tt&gt;gspcav-kmp-default&lt;/tt&gt;, &lt;tt&gt;gspcav1-kmp-default&lt;/tt&gt;, and &lt;tt&gt;spaca5xx-kmp-default&lt;/tt&gt;. Reboot after installation of the driver made Linux recognize the camera.&lt;/p&gt;

&lt;p&gt;Now to use the webcam for video chat, there were two options: MSN via Kopete or Skype via their &lt;a href="http://share.skype.com/sites/linux/2007/11/skype_20_beta_for_linux_with_video.html"&gt;recently released&lt;/a&gt; &lt;a href="http://www.skype.com/intl/en/download/skype/linux/beta/choose/"&gt;beta 2.0 client&lt;/a&gt;. I prefer skype.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-6271362192024397864?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/6271362192024397864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=6271362192024397864' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/6271362192024397864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/6271362192024397864'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2008/02/webcam-video-chat-and-linux.html' title='Webcam, Video Chat, and Linux'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-4659792487384520936</id><published>2007-12-13T22:32:00.000-05:00</published><updated>2007-12-13T23:27:21.077-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogs'/><category scheme='http://www.blogger.com/atom/ns#' term='livejournal'/><category scheme='http://www.blogger.com/atom/ns#' term='blogscope'/><title type='text'>Welcome Livejournal</title><content type='html'>&lt;p&gt;&lt;a href="http://www.blogscope.net/"&gt;BlogScope&lt;/a&gt; is now indexing blogs from &lt;a href="http://www.livejournal.com/"&gt;Livejournal&lt;/a&gt;. This means, BlogScope users will now be able to &lt;a href="http://www.blogscope.net/about/demo/"&gt;search and analyze&lt;/a&gt; over 300 posts created by LJ users every minute. &lt;a href="http://www.livejournal.com/site/goat.bml"&gt;Frank the Goat&lt;/a&gt; is happy.&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.blogscope.net/?q=livejournal.com&amp;startid=0&amp;sco=date"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_bsJ8N084DzI/R2ICQcCVuYI/AAAAAAAAAFc/QCh1ZV_VTPY/s400/l.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5143676205837695362" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-4659792487384520936?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/4659792487384520936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=4659792487384520936' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/4659792487384520936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/4659792487384520936'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/12/welcome-livejournal.html' title='Welcome Livejournal'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bsJ8N084DzI/R2ICQcCVuYI/AAAAAAAAAFc/QCh1ZV_VTPY/s72-c/l.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-7957809186818903239</id><published>2007-12-08T13:05:00.000-05:00</published><updated>2007-12-12T21:46:54.385-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='word'/><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='open office'/><title type='text'>Latex to OpenOffice/Word</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.latex-project.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_bsJ8N084DzI/R2CbjzIqrlI/AAAAAAAAAFU/Iz03FPodass/s200/180px-LaTeX_logo.svg.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5143281813781392978" /&gt;&lt;/a&gt;

&lt;p&gt;Recently I had to convert a big Latex document full of maths to Office format. Copy-paste with all the formulas is not an option (more so, given the terrible state of equation editing features in Microsoft Office 2007). After a lot of searching around, I was able to find ways to automate a large chunk of the process by using &lt;a href="http://www.lyx.org/"&gt;LyX&lt;/a&gt; and &lt;a href="http://www.openoffice.org/"&gt;Open Office&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Import Latex document in Lyx.
&lt;li&gt;Export the document in Lyx to HTML. All the math formulas will be converted to images.
&lt;li&gt;Open the HTML document in Firefox.
&lt;li&gt;Start OpenOffice writer, and copy paste all HTML in a new document. Save the document (I used the doc format as I wanted MS Word compatibility). The office document should look similar to the Latex one with all the math equations and symbols as images. The images are referenced as hyperlinks, which means the images will no longer be displayed if you remove the HTML files or copy the file to some other machine. The images should therefore be embedded in the office document.
&lt;li&gt;To embed images in OpenOffice writer, open Edit Menu-&gt;Links. Select all images and click on Break Links. This will remove reference to all externally linked images.
&lt;li&gt;The document is now ready. Some manual editing will be required as
&lt;ul&gt;
&lt;li&gt;Tables and footnotes were missing
&lt;li&gt;Images were missing (may be because I was using eps files)
&lt;li&gt;References to sections, figures, and equations were not always present
&lt;li&gt;Citations were hyperlinks to some random document
&lt;/ul&gt;
&lt;/ul&gt;

&lt;p&gt;I was able to convert a 10 page latex document to a word document in an hour. The formatting was not very good, as all math equations were slightly vertically displaced and were underlined. But at least it was readable.&lt;/p&gt;

&lt;p&gt;Just for reference, I am using Lyx version 1.5.2 with Open Office 2.3 on openSUSE 10.3.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-7957809186818903239?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/7957809186818903239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=7957809186818903239' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7957809186818903239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7957809186818903239'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/12/latex-to-openofficeword.html' title='Latex to OpenOffice/Word'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bsJ8N084DzI/R2CbjzIqrlI/AAAAAAAAAFU/Iz03FPodass/s72-c/180px-LaTeX_logo.svg.png' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-375231317326708170</id><published>2007-09-15T20:49:00.001-04:00</published><updated>2008-06-16T01:25:35.823-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='tooltip'/><category scheme='http://www.blogger.com/atom/ns#' term='dojo'/><title type='text'>Enhanced AJAXified Tooltips (using Dojo 0.9)</title><content type='html'>&lt;div style="width: 700px;"&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dojotoolkit.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;"  src="http://4.bp.blogspot.com/_bsJ8N084DzI/RuyTJoI_fMI/AAAAAAAAADg/jDnUkn9n2y8/s200/html.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5110621470761909442" /&gt;&lt;/a&gt;
&lt;p&gt;Tooltips can be very useful widgets for displaying some information quickly. Dojo 0.3 had a nice tooltip widget, which I was able to &lt;a href="http://queens.db.toronto.edu/~nilesh/linux/dojo-extend-tooltip/"&gt;extend further&lt;/a&gt; to use in &lt;a href="http://www.blogscope.net/"&gt;BlogScope&lt;/a&gt;. But in Dojo 0.9, &lt;a href="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/user-assistance-and-feedback/tooltip"&gt;the tooltip widget&lt;/a&gt; was re-written with lot of functionality removed. I have managed to create a custom tooltip widget that can be used for displaying large amounts text (that can include images and videos too) and that can fetch the contents by performing an asynchronous HTTP request.&lt;/p&gt;

&lt;p&gt;A &lt;a href="http://queens.db.toronto.edu/~nilesh/linux/dojo0.9-extend-tooltip/"&gt;demo for the new widget&lt;/a&gt; is available. The new &lt;a href="http://queens.db.toronto.edu/~nilesh/linux/dojo0.9-extend-tooltip/application.js"&gt;javascript&lt;/a&gt; and &lt;a href="http://queens.db.toronto.edu/~nilesh/linux/dojo0.9-extend-tooltip/blogscope.css"&gt;CSS&lt;/a&gt; files can be downloaded. Explanation for how to use the code and how it works is below.&lt;/p&gt;

&lt;p&gt;The file &lt;tt&gt;application.js&lt;/tt&gt; defines two new widgets, &lt;tt&gt;blogscope.MasterTooltip&lt;/tt&gt; and &lt;tt&gt;blogscope.Tooltip&lt;/tt&gt; based on &lt;tt&gt;dijit.Tooltip&lt;/tt&gt; and &lt;tt&gt;dijit._MasterTooltip&lt;/tt&gt;. As an end user you only need to create a blogscope.Tooltip object. Each &lt;tt&gt;Tooltip&lt;/tt&gt; contains a &lt;tt&gt;MatserTooltip&lt;/tt&gt; which stores the actual contents. When the tooltip is opened for the first time, an asynchronous I/O request is dispatched to fetch the contents, and in the meantime a loading icon is displayed. When the contents of the tooltip are displayed, the height and width is clipped to a maximum, which makes the tooltip suitable for displaying large amounts of contents. The tooltip is created right next to the mouse cursor, and the user can move/select/copy from the tooltip. When the mouse moves out of the tooltip area, the MasterTooltip is hidden.&lt;/p&gt;

&lt;p&gt;To create the tooltip, following HTML code is required&lt;/p&gt;
&lt;pre&gt;
&lt;code class="html"&gt;
&amp;lt;span style="color: red" id="tooltipConnection1"&amp;gt; your mouse here (tooltip1)&amp;lt;/span&amp;gt;
&amp;lt;div id="tooltipContent1" style="display: none;"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;This HTML creates a connection target with id &lt;tt&gt;tooltipConnection1&lt;/tt&gt;, mouse over which will show the tooltip. The DIV &lt;tt&gt;tooltipContent1&lt;/tt&gt;, although never really visible, is required as a placeholder for the actual widget. Following Javascript creates the actual tooltip&lt;/p&gt;
&lt;pre style="width: 600px; overflow: auto;"&gt;
&lt;code class="javascript"&gt;
blogscopeAddOnLoad( function() {
   var tooltip1 = new blogscope.Tooltip({connectId: "tooltipConnection1", 
       href: "./tooltip.php"}, dojo.byId("tooltipContent1"));
    }
    );
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Above code is creating a new object of type &lt;tt&gt;blogscope.Tooltip&lt;/tt&gt;. 
Note that the javascript is wrapped in &lt;tt&gt;blogscopeAddOnLoad&lt;/tt&gt;, which is a function similar to &lt;tt&gt;dojo.addOnLoad&lt;/tt&gt;, to ensure that the tooltip widget declaration is loaded in advance.
When the tooltip widget is created, the node with id &lt;tt&gt;tooltipContent1&lt;/tt&gt; is replaced by the widget. Two parameters, &lt;tt&gt;href&lt;/tt&gt; and &lt;tt&gt;connectId&lt;/tt&gt; are required for every tooltip. Additional parameters that can be specified include &lt;tt&gt;maxWidth, maxHeight&lt;/tt&gt; and &lt;tt&gt;label&lt;/tt&gt;.&lt;/p&gt;
&lt;/p&gt; 

&lt;p&gt;Those who simply wish to use the new Tooltip widget can copy the js and css file, and include it in the HTML (along with dojo 0.9). For those interested in details,
the javascript code for the two new widgets is as follows (see &lt;a href="http://queens.db.toronto.edu/~nilesh/linux/dojo0.9-extend-tooltip/application.js"&gt;application.js&lt;/a&gt; for complete code). Note that we want this code to be executed after the Dojo libs finish loading, and therefore everything is inside &lt;tt&gt;dojo.addOnLoad&lt;/tt&gt;.
&lt;div style="width: 95%; height: 600px; overflow: auto;"&gt;
&lt;pre&gt;
&lt;code class="javascript"&gt;
dojo.addOnLoad( function() {
    dojo.provide("blogscope.Tooltip");
    dojo.provide("blogscope.MasterTooltip");
    // A lot of code here was originaly copied from Tooltip.js in dojo source code, and then modified.
    // Refer to dijit/Tooltip.js for more documentation and explanation
    dojo.declare(
        // Each tooltip has a master tooltip which contains the actual content
        "blogscope.MasterTooltip",
        dijit._MasterTooltip,
        {
            // the fade in fade out duration
            duration: 50,
            parentTooltip: null,
            templateString: "&amp;lt;div id=\"dijitTooltip\" class=\"dijitTooltip dijitTooltipBelow\"&amp;gt;\n\t&amp;lt;div class=\"dijitTooltipContainer dijitTooltipContents blogscopeTooltipContainer\" id=\"dijitTooltipContainer\" dojoAttachPoint=\"containerNode\" waiRole='alert'&amp;gt;&amp;lt;/div&amp;gt;\n\t&amp;lt;div class=\"dijitTooltipConnector blogscopeTooltipConnector\"&amp;gt;&amp;lt;/div&amp;gt;\n&amp;lt;/div&amp;gt;\n",
            show: function(/*DomNode*/ aroundNode){
                if(this.fadeOut.status() == "playing"){
                    // previous tooltip is being hidden; 
                    // wait until the hide completes then show new one
                    this._onDeck=arguments;
                    return;
                }
                this.containerNode.innerHTML=this.parentTooltip.label;
                // Firefox bug. when innerHTML changes to be shorter than previous
                // one, the node size will not be updated until it moves.
                this.domNode.style.top = (this.domNode.offsetTop + 1) + "px";
    
                var align = {'BL' : 'TL'};
                var pos = dijit.placeOnScreen(this.domNode, {x: this.parentTooltip.mouseX, y: this.parentTooltip.mouseY}, ["TL"]);
                this.domNode.className="dijitTooltip dijitTooltipBelow";
    
                // show it
                dojo.style(this.domNode, "opacity", 0);
                this.fadeIn.play();
                this.isShowingNow = true;
                // In our template string, we have 3 div nodes nested in one another
                // for asthetic reasons, we chose to adjust dimension of the innermost DIV
                var adjustNode = getFirstDivChild(getFirstDivChild(this.domNode));
                adjustDimensions(adjustNode, this.parentTooltip.maxWidth, this.parentTooltip.maxHeight);
            },
            // refresh the contents of the tooltip
            refresh: function() {
                this.containerNode.innerHTML=this.parentTooltip.label;
                if (this.isShowingNow == true) {
                    var adjustNode = getFirstDivChild(getFirstDivChild(this.domNode));
                    adjustDimensions(adjustNode, this.parentTooltip.maxWidth, this.parentTooltip.maxHeight);
                }
            },
            // called once after creation of the widget
            postCreate: function(){
                dojo.body().appendChild(this.domNode);
                this.bgIframe = new dijit.BackgroundIframe(this.domNode);
                // I wanted to set a unique id for the domNode, but getUniqueId does not work with IE6
                // If the line below is uncommented, it prints error in IE6
                // this.domNode.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
                // Setup fade-in and fade-out functions.
                this.fadeIn = dojo.fadeIn({ node: this.domNode, duration: this.duration, onEnd: dojo.hitch(this, "_onShow") });
                this.fadeOut = dojo.fadeOut({ node: this.domNode, duration: this.duration, onEnd: dojo.hitch(this, "_onHide") });
                // connect the event of mouse moving out
                this.connect(this.domNode, "onmouseout", "_onMouseOut");
            },
            // when mouse moves out
            _onMouseOut: function(/*Event*/ e){
                this.parentTooltip._onMouseOut(e);
            }
        }
    );
    // blogscope.Tooltip is the main widget that we will use
    dojo.declare(
        "blogscope.Tooltip",
        dijit.Tooltip,
        {
            // false if the contents are yet to be loaded from the HTTP request
            hasLoaded: false,
            // location from where to fetch the contents
            href: "",
            // max height and width of the tooltip
            maxWidth: 400,
            maxHeight: 100,
            // the position of mouse when the tooltip is created
            mouseX: 0,
            mouseY: 0,
            // contents to diplay in the tooltip. Initialized to a loading icon.
            label: "&amp;lt;div&amp;gt;&amp;lt;img src=\"loading.gif\"&amp;gt; Loading...&amp;lt;/div&amp;gt;",
            masterTooltip: null,
            loadContent: function() { 
                if (this.hasLoaded == false) {
                    this.hasLoaded = true;
                    dojo.xhrGet({
                        url: this.href,
                        parentTooltip: this,
                        load: function(response, ioArgs){
                            console.log("data received from ", this.url);
                            console.log("parent is "+this.parentTooltip);
                            this.parentTooltip.label = response;
                            if(this.parentTooltip.isShowingNow){
                                this.parentTooltip.masterTooltip.refresh();
                            }
                        },
                        handleAs: "text"
                    }); 
                }
            },
            open: function(){
                if (this.masterTooltip == null) {
                    // initialized the master tooltip
                    this.masterTooltip = new blogscope.MasterTooltip({parentTooltip: this});
                }
                this.loadContent();
                if(this.isShowingNow){ return; }
                if(this._showTimer){
                    clearTimeout(this._showTimer);
                    delete this._showTimer;
                }
                this.masterTooltip.show(this._connectNode);
                this.isShowingNow = true;
            },
            close: function(){
                if(!this.isShowingNow){ return; }
                if (this.masterTooltip != null) {
                    this.masterTooltip.hide();
                }
                this.isShowingNow = false;
            },
            _onMouseOut: function(/*Event*/ e){
                // currXD and Y are current position of the mouse
                var currX = e.pageX;
                var currY = e.pageY;
                // this.mouseX and this.mouseY are the top-left corners of the tooltip
                var posOffset = Math.abs(this.mouseX - e.pageX) + Math.abs(this.mouseY - e.pageY);
                // console.log("Mouse out called with ",e);
                // we allow mouse movement of 6px
                if (posOffset &amp;lt; 6) {
                    return;
                }
                if(dojo.isDescendant(e.relatedTarget, this._connectNode)){
                     // false event; just moved from target to target child; ignore.
                    return;
                }
                if (this.masterTooltip != null) {
                    // get coordinates and dimensions of the actual tooltip contents
                    var c = dojo.coords(this.masterTooltip.domNode);
                    console.log("Tooltip coordinates", c, "Curr", currX, currY, "MouseXY", this.mouseX, this.mouseY);
                    if (this.mouseX &amp;lt; currX &amp;&amp; this.mouseX + c.w &amp;gt; currX &amp;&amp; this.mouseY &amp;lt; currY &amp;&amp; this.mouseY + c.h &amp;gt; currY) {
                        // the mouse is still on the tooltip contents, no need to close it
                        return;
                    }
                }
                // close the tooltip
                this._onUnHover(e);
            },
            _onHover: function(/*Event*/ e){
                if(this._hover){ return; }
                this._hover=true;
                // find the current mouse postion, the top-left corner of the tooltip will be here
                this.mouseX = e.pageX;
                this.mouseY = e.pageY;
                console.log("Mouse X,Y is "+this.mouseX+", "+this.mouseY);
                // If tooltip not showing yet then set a timer to show it shortly
                if(!this.isShowingNow &amp;&amp; !this._showTimer){
                    this._showTimer = setTimeout(dojo.hitch(this, "open"), this.showDelay);
                }
            },
            _onMouseOver: function(/*Event*/ e){
                this._onHover(e);
            }
        }
    );
    // we have finished declaration of the widget
    // now exectute all functions that were waiting for the custom widget to load
    blogscopeTooltipLoaded = true;
    dojo.forEach(blogscopeLoaders,
        function(f) {
            f();
        }
    )
}
);
&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Code for &lt;tt&gt;blogscopeAddOnLoad&lt;/tt&gt;, which ensures that the declaration of the new widget is loaded before executing more javascript is&lt;/p&gt;
&lt;pre&gt;
&lt;code class="javascript"&gt;
// This is a list of functions that need to be executed once the custom widget
// blogscope.Tooltip loads
var blogscopeLoaders = [];
// This variable is set to true after blogscope.Tooltip declaration finishes loading
var blogscopeTooltipLoaded = false;
// This function is similar to dojo.addOnLoad, but it ensures that the
// custom blogscope.Tooltip widget declaration is loaded before the function call is made
blogscopeAddOnLoad = function (/*Function*/ f) {
    if (blogscopeTooltipLoaded) {
        console.log("Calling the function", f);
        f();
    } else {
        console.log("Pushing the function to queue", f);
        blogscopeLoaders.push(f);
    }
}
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;The code to clip the tooltip to a max width and height is&lt;/p&gt;
&lt;div style="width: 700px; overflow: auto;"&gt;
&lt;pre&gt;
&lt;code class="javascript"&gt;
// Adjusts the dimension of the supplied node so that it does not exceeds
// the max width and height
function adjustDimensions(/*DomNode*/node, /*int*/maxWidth, /*int*/maxHeight) {
    var sHeight = node.scrollHeight;
    var sWidth = node.scrollWidth;
    console.log("height and width are "+sHeight+" and "+sWidth+" for "+node+" with id "+node.id);
    // console.log("max height and width are "+maxHeight+" and "+maxWidth);
    if (sHeight &gt; maxHeight) {
            console.log("resizing to max height "+maxHeight);
            node.style.height = maxHeight + "px";
            node.style.overflow = "auto";
    }
    if (sWidth &gt; maxWidth) {
            console.log("resizing to max width "+maxWidth);
            node.style.width = maxWidth + "px";
            node.style.overflow = "auto";
    }
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-375231317326708170?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/375231317326708170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=375231317326708170' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/375231317326708170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/375231317326708170'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/09/enhanced-ajaxified-tooltips-using-dojo.html' title='Enhanced AJAXified Tooltips (using Dojo 0.9)'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bsJ8N084DzI/RuyTJoI_fMI/AAAAAAAAADg/jDnUkn9n2y8/s72-c/html.png' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-4862179751622326913</id><published>2007-08-22T15:10:00.000-04:00</published><updated>2007-08-23T03:37:13.548-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hindi'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Hindi Transliteration</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.google.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_bsJ8N084DzI/Rs05GGjbU0I/AAAAAAAAADA/5U54ADlfj0s/s200/google-logo.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5101796729881842498" /&gt;&lt;/a&gt;


&lt;p&gt;Google has developed a &lt;a href="http://www.google.com/transliterate/indic/"&gt;hindi transliteration tool&lt;/a&gt;. While this functionality was available for blogger for some time, they have &lt;a href="http://googleblog.blogspot.com/2007/08/google-labs-india.html"&gt;now released it&lt;/a&gt; as an independent application that can be used as an iGoogle gadget. This tool converts text typed using roman characters to unicode hindi characters. An &lt;a href="http://en.wikipedia.org/wiki/ITRANS"&gt;ITRANS&lt;/a&gt; like &lt;a href="http://www.google.com/transliterate/indic/about_mappings.html"&gt;scheme&lt;/a&gt; is used. Use of roman characters for typing devanagiri is often criticized by the purists, but it for sure is convenient.&lt;/p&gt;

&lt;p&gt;The best part is that its written in Javascript. This means that it runs in the browser, and no you don't need Java applets. Also, it is very easy to steal &lt;a href="http://www.google.com/transliterate/indic/labs001.js"&gt;this code&lt;/a&gt; for use with your own application (I know the code is unreadable because of the compression).
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-4862179751622326913?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/4862179751622326913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=4862179751622326913' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/4862179751622326913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/4862179751622326913'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/08/hindi-transliteration.html' title='Hindi Transliteration'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bsJ8N084DzI/Rs05GGjbU0I/AAAAAAAAADA/5U54ADlfj0s/s72-c/google-logo.gif' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-5902340629999014935</id><published>2007-08-07T18:42:00.000-04:00</published><updated>2007-08-07T18:55:18.769-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Shell Command History Size</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.gnu.org/software/bash/"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://1.bp.blogspot.com/_bsJ8N084DzI/Rrj3whMs0vI/AAAAAAAAACE/2hd4DJRXKG4/s200/gnu.gif" alt="" id="BLOGGER_PHOTO_ID_5096095391287137010" border="0" /&gt;&lt;/a&gt;
&lt;p&gt;A small tip for those who use the command line a lot - add the following to your &lt;tt&gt;~/.bashrc&lt;/tt&gt;:&lt;/p&gt;
&lt;pre&gt;
export HISTSIZE=9999
export HISTFILESIZE=999999
&lt;/pre&gt;
&lt;blockquote&gt;
The value of the HISTSIZE variable determines the number of events preserved in the history list during a session. When you exit from the shell, the most recently executed commands are saved in the file given by the HISTFILE variable (the default is ~/.bash_history). The next time you start the shell, this file initializes the history list. The value of the HISTFILESIZE variable determines the number of lines of history saved in HISTFILE (not necessarily the same as HISTSIZE). HISTSIZE holds the number of events remembered during a session, HISTFILESIZE holds the number remembered between sessions, and the file designated by HISTFILE holds the history list.
&lt;/blockquote&gt;
&lt;p&gt;
Even modern linux distributions set the values for these commands to a low value like 1000. In current world, storing a few 100 kB of history file on disk is nothing. All linux distributions should therefore change the defaults. Till then, add the above mentioned code to your &lt;tt&gt;~/.bashrc&lt;/tt&gt; and never type the same command twice (instead &lt;a href="http://articles.techrepublic.com.com/5100-10877-5827311.html"&gt;search using Ctrl + R&lt;/a&gt;).
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-5902340629999014935?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/5902340629999014935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=5902340629999014935' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/5902340629999014935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/5902340629999014935'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/08/shell-command-history-size.html' title='Shell Command History Size'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bsJ8N084DzI/Rrj3whMs0vI/AAAAAAAAACE/2hd4DJRXKG4/s72-c/gnu.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-7340496671158752551</id><published>2007-07-30T03:21:00.000-04:00</published><updated>2007-07-30T03:52:31.360-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>MySQL Lock Contention</title><content type='html'>&lt;a href="http://www.mysql.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_bsJ8N084DzI/Rq2W1BMs0uI/AAAAAAAAAB8/1k0cr3q_50o/s200/mysql.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5092892591224836834" /&gt;&lt;/a&gt;
&lt;p&gt;Lock contention can be a serious performance issue with MySQL if both read and write happen concurrently on the same table. &lt;a href="http://www.blogscope.net/"&gt;BlogScope&lt;/a&gt; has tables with around 100 million rows, stored in the &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/myisam-storage-engine.html"&gt;MyISAM storage engine&lt;/a&gt;. 
Usual workload consists of 2-3 updates (mainly INSERT) per second and several SELECT operations. Since MyISAM provides only table-level locking, every operation locks the complete table. Although SELECT operations can take place in parallel, it turns out that a long running SELECT can block the complete application. After investigating a bit in why a SELECT was blocking other SELECT operations, I found an explanation in &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/table-locking.html"&gt;MySQL docs&lt;/a&gt;.
&lt;/p&gt;
&lt;blockquote&gt;A client issues a SELECT that takes a long time to run. Another client then issues an UPDATE on the same table. This client waits until the SELECT is finished.Another client issues another SELECT statement on the same table. Because UPDATE has higher priority than SELECT, this SELECT waits for the UPDATE to finish, and for the first SELECT to finish.
&lt;/blockquote&gt;
&lt;p&gt;
This basically means that if there is any long running SELECT query (e.g., sequential scan), the whole application will just PAUSE for hours. This also means that you can not take backups (using mysqldump), as not only the process willing to write, but even those just reading will be blocked. Fortunately, a fix is available: set the priority of SELECT higher than UPDATE. In this case, the second SELECT statement in the preceding scenario would execute before the UPDATE  statement, and would not need to wait for the first SELECT to finish. To set low priority for UPDATES, add the following to &lt;tt&gt;/etc/my.cnf&lt;/tt&gt;
&lt;/p&gt;
&lt;pre&gt;
low_priority_updates=1
&lt;/pre&gt;
&lt;p&gt;
and &lt;a href="http://lists.mysql.com/mysql/207928"&gt;execute&lt;/a&gt; the following
&lt;/p&gt;
&lt;pre&gt;
set global LOW_PRIORITY_UPDATES=1;
&lt;/pre&gt;
&lt;p&gt;
While setting updates to be of low priority fixes the locking issue, I don't really like it. In this case, the UPDATE may never actually get a chance to execute if the load is too high. In my opinion, the best solution is to have a &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/replication.html"&gt;replica server&lt;/a&gt;. A master MySQL server where all the updates take place, and a slave for all the reads. Once we install our new hardware, I will setup a replica server for BlogScope as well.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-7340496671158752551?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/7340496671158752551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=7340496671158752551' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7340496671158752551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7340496671158752551'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/07/mysql-lock-contention.html' title='MySQL Lock Contention'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bsJ8N084DzI/Rq2W1BMs0uI/AAAAAAAAAB8/1k0cr3q_50o/s72-c/mysql.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-1784505389119487962</id><published>2007-07-23T23:48:00.000-04:00</published><updated>2007-09-15T23:00:51.245-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='sftp'/><title type='text'>Accessing files over SFTP in Java</title><content type='html'>&lt;a href="http://java.sun.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_bsJ8N084DzI/RqV4vxMs0tI/AAAAAAAAAB0/Z29IBmuCs3w/s200/java.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5090607715868005074" /&gt;&lt;/a&gt;
&lt;p&gt;We have a lot of data files that needs to be copied to each of the machine we want to run our code on. Further when these data files are updated, they need to be updated on all the machines. This means that the developer has to spend a lot of time just copying these data files around. I wrote a simple solution to this where latest versions of all the data files are maintained at a central server accessible via ssh. These remote date files are copied to the local machine when required in an on-demand fashion transparently by the Java program (after comparing last modification times of the local and remote file).&lt;/p&gt;
&lt;p&gt;For accessing files over SFTP, we are using Apache &lt;a href="http://jakarta.apache.org/commons/vfs/"&gt;Commons VFS&lt;/a&gt; along with &lt;a href="http://www.jcraft.com/jsch/"&gt;Jsch&lt;/a&gt;. These libraries (especially commons VFS) is not well documented. I am therefore posting some code snippets from our code documenting the API&lt;/p&gt;
&lt;p&gt;The first code snippet demonstrates the API for copying a file from remote location to the local machine:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="java"&gt;
/**
 * Copies a remote file to local filesystem.
 */
public static void copyRemoteFile(String host, String user,
    String password, String remotePath, String localPath) throws IOException {
    // we first set strict key checking off
    FileSystemOptions fsOptions = new FileSystemOptions();
    SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(
            fsOptions, "no");
    // now we create a new filesystem manager
    DefaultFileSystemManager fsManager = (DefaultFileSystemManager) VFS
            .getManager();
    // the url is of form sftp://user:pass@host/remotepath/
    String uri = "sftp://" + user + ":" + password + "@" + host
            + "/" + remotePath;
    // get file object representing the local file
    FileObject fo = fsManager.resolveFile(uri, fsOptions);
    // open input stream from the remote file
    BufferedInputStream is = new BufferedInputStream(fo.getContent()
            .getInputStream());
    // open output stream to local file
    OutputStream os = new BufferedOutputStream(new FileOutputStream(
            localPath));
    int c;
    // do copying
    while ((c = is.read()) != -1) {
        os.write(c);
    }
    os.close();
    is.close();
    // close the file object
    fo.close();
    // NOTE: if you close the file system manager, you won't be able to 
    // use VFS again in the same VM. If you wish to copy multiple files,
    // make the fsManager static, initialize it once, and close just
    // before exiting the process.
    fsManager.close();
    System.out.println("Finished copying the file");
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Unfortunately the Commons VFS api does not provide a way to check last modification time of a remote file. I had to write that code using the Jsch API. Below is a code snippet that returns last modification time in seconds:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="java"&gt;
/**
 * Returns a Sftp session conncted using the Jsch library.
 */
public static Session connectSFTP(final String host, final String user,
        final String pass) throws JSchException {
    JSch jsch = new JSch();
    Session session = jsch.getSession(user, host, 22);
    session.setUserInfo(new UserInfo() {
        public String getPassphrase() {
            return null;
        }
        public String getPassword() {
            return null;
        }
        public boolean promptPassphrase(String string) {
            return false;
        }
        public boolean promptPassword(String string) {
            return false;
        }
        public boolean promptYesNo(String string) {
            return true;
        }
        public void showMessage(String string) {
        }
    });
    session.setPassword(pass);
    session.connect();
    return session;
}

/**
 * Returns last modification time of a remote file in seconds.
 */
public static int getLastModificationTime(String host, String user,
        String password, String remotePath) throws IOException,
        JSchException, SftpException {
    Session session = connectSFTP(host, user, password);
    ChannelSftp chan = (ChannelSftp) session.openChannel("sftp");
    chan.connect();
    SftpATTRS attrs = chan.lstat(remotePath);
    int time = attrs.getMTime();
    chan.disconnect();
    session.disconnect();
    return time;
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;
I hope that this code is useful to others. Please leave a comment if you see any error of have a suggestion.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-1784505389119487962?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/1784505389119487962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=1784505389119487962' title='26 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/1784505389119487962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/1784505389119487962'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/07/accessing-files-over-sftp-in-java.html' title='Accessing files over SFTP in Java'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bsJ8N084DzI/RqV4vxMs0tI/AAAAAAAAAB0/Z29IBmuCs3w/s72-c/java.gif' height='72' width='72'/><thr:total>26</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-5840620553102921925</id><published>2007-06-02T13:07:00.000-04:00</published><updated>2007-06-02T13:25:54.243-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='zmd'/><category scheme='http://www.blogger.com/atom/ns#' term='suse'/><title type='text'>Finally uninstalled ZMD</title><content type='html'>&lt;a href="http://en.opensuse.org"&gt;&lt;img src="http://3.bp.blogspot.com/_bsJ8N084DzI/Rb2BxddaR0I/AAAAAAAAAAk/6KRWJxOV9C4/s200/suse.png" style="float:right;" border="0"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://en.opensuse.org/Zmd"&gt;ZMD&lt;/a&gt; is the worst thing that happened to SuSE. It often starts eating 100% of CPU for no reason, crashes every now and then, and returns "unresolvable id" error most of the time when trying to install updates. Good that they will &lt;a href="http://lists.opensuse.org/opensuse-factory/2007-04/msg00137.html"&gt;remove ZMD from 10.3&lt;/a&gt; completely. ZMD can be uninstalled from 10.2 as well (although it is installed by default). For some reason I was reluctant to uninstall it from my laptop, despite it (and some md5sum, gzip and parse-metadata processes) eating 100% CPU all the time. But yesterday, I finally uninstalled it and it feels so much better.&lt;/p&gt;
&lt;p&gt;Uninstallation was simpler than I thought. Just two commands&lt;/p&gt;
&lt;pre&gt;
rczmd stop
rpm -e zmd libzypp-zmd-backend sqlite-zmd rug zen-updater
&lt;/pre&gt;
&lt;p&gt;After removing ZMD, selecting Install Software starts YaST. To check for updates, I started openSUSE Update Applet from System -&gt; Desktop Applets. This applet is not as beautiful as the previous ZMD one, but it works better (no "unresolvable id" errors).
&lt;p&gt;Those interested in configuring SuSE for package management should read the following &lt;a href="http://opensuse-community.org/Package_Sources/10.2"&gt;openSUSE community article&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-5840620553102921925?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/5840620553102921925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=5840620553102921925' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/5840620553102921925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/5840620553102921925'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/06/finally-uninstalled-zmd.html' title='Finally uninstalled ZMD'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bsJ8N084DzI/Rb2BxddaR0I/AAAAAAAAAAk/6KRWJxOV9C4/s72-c/suse.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-3063549014359780656</id><published>2007-04-24T00:12:00.000-04:00</published><updated>2007-04-24T00:14:06.956-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Wireless Disabled After Resume from Suspend</title><content type='html'>&lt;p&gt; After I resume my laptop (OpenSUSE 10.2, Dell 640m, Intel 3945ABG wireless
card) from stand by (suspend to ram), the wireless usually stops working. The
KNetworkManager applet stops showing the wireless device. After investigating
further, it seems that the problem is with the HAL daemon, and restarting it
fixes the problem.&lt;/p&gt;

&lt;pre&gt; /etc/init.d/haldaemon restart &lt;/pre&gt;

&lt;p&gt;However restarting HAL daemon manually every time after resume was not a good
option. So I decided to use my time while waiting at the SF airport better by
finding a solution to the problem. It seems that SuSE uses &lt;tt&gt;pm-utils&lt;/tt&gt;
for managing suspend and other power related options stating version 10.2. Some
of the configurations are present in &lt;tt&gt;/etc/pm/config&lt;/tt&gt;. It turns out that
all the scripts present in &lt;tt&gt;/etc/pm/hooks/&lt;/tt&gt; are executed after every
suspend or resume event. One of the following four option is passed as a
command line argument to each of the script: hibernate, suspend, thaw, or
resume. Since I wanted to restart haldaemon at every resume, all I had to do
was to create a new executable file in &lt;tt&gt;/etc/pm/hooks/&lt;/tt&gt; with the
following contents:&lt;/p&gt;

&lt;pre&gt;
#!/bin/sh
# File: /etc/pm/hooks/99haldaemon

case "$1" in
        resume)
                /etc/init.d/haldaemon restart
                ;;
        *)
                ;;
esac
&lt;/pre&gt;

&lt;p&gt;And now the haldaemon is restarted at every resume, and the wireless works
fine after I open the laptop lid. This is a hack, and I hope a proper fix will
be included in future versions of SuSE.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-3063549014359780656?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/3063549014359780656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=3063549014359780656' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/3063549014359780656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/3063549014359780656'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/04/wireless-disabled-after-resume-from.html' title='Wireless Disabled After Resume from Suspend'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-8843571379647486136</id><published>2007-04-11T15:42:00.000-04:00</published><updated>2007-04-11T16:28:13.057-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lucene'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='optimization'/><title type='text'>Lucene Optimization Tip: Reuse Searcher</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lucene.apache.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_bsJ8N084DzI/Rh1EiU5xiEI/AAAAAAAAABs/8-I7U485DK8/s320/160px-Lucene_logo_green_300.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5052269713496836162" /&gt;&lt;/a&gt;


&lt;p&gt;&lt;a href="http://lucene.apache.org/"&gt;Lucene&lt;/a&gt; is a great text search engine, but some aspects of it are not clearly documented. For example, if you have multiple simultaneous requests (e.g., in a web application) searching for different queries, should there be a separate &lt;tt&gt;IndexSearcher&lt;/tt&gt; for each thread or one shared &lt;tt&gt;IndexSearcher&lt;/tt&gt; will do.&lt;/p&gt;

&lt;p&gt;Initially we were using different &lt;tt&gt;IndexSearcher&lt;/tt&gt; for different requests, creating a new instance at the start of the request and destroying soon after searching. After a lot of experimentation and exchange of a few mails over the lucene mailing list, I discovered that the efficient way is to use a single shared &lt;tt&gt;IndexSearcher&lt;/tt&gt; across all requests. Multiple concurrent threads can easily invoke the &lt;tt&gt;search&lt;/tt&gt; method on a single &lt;tt&gt;IndexSearcher&lt;/tt&gt; object. Reusing cached data makes the single searcher approach very efficient both in terms of response time and memory usages. In our case, response times decreased by a factor of 2-3 after this change.&lt;/p&gt;

&lt;p&gt;Remember that &lt;tt&gt;IndexSearcher&lt;/tt&gt; object however needs to be destroyed and recreated after the index is modified or updated. Unless the searcher is recreated, it will not reflect the changes made to the index. A good strategy is to periodically destroy and recreate the shared index using a separate &lt;tt&gt;Timer&lt;/tt&gt; thread.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-8843571379647486136?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/8843571379647486136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=8843571379647486136' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/8843571379647486136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/8843571379647486136'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/04/lucene-optimization-tip-reuse-searcher.html' title='Lucene Optimization Tip: Reuse Searcher'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bsJ8N084DzI/Rh1EiU5xiEI/AAAAAAAAABs/8-I7U485DK8/s72-c/160px-Lucene_logo_green_300.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-7667684425544004868</id><published>2007-02-23T18:55:00.000-05:00</published><updated>2007-02-23T19:19:46.354-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='networking'/><title type='text'>Prevent Timeouts in SSH</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.openssh.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_bsJ8N084DzI/Rd-EaLz3cwI/AAAAAAAAABI/puBCL4IhiiU/s200/openssh.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5034888493805302530" /&gt;&lt;/a&gt;

&lt;p&gt;Many routers timeout the connection after some period of inactivity. For users of ssh, this can a big nuisance. In presence of such routers a ssh connection with no activity (for a few minutes) will disconnect automatically. The workaround is that the server and client keep talking to each other even when the user is not typing (or viewing) anything. This can be achived using one of the two ways:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Server Side&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Add the following two lines to &lt;tt&gt;/etc/ssh/sshd_config&lt;/tt&gt;. This will make the server poll for client every 30 seconds. If the client fails to respond for 4 times (i.e., 2 mins), the server will close the connection. Note that this applies to version 2 of OpenSSH only.
&lt;/p&gt;
&lt;pre&gt;
ClientAliveInterval 30
ClientAliveCountMax 4
&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Client Side&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Add the following two lines to &lt;tt&gt;/etc/ssh/ssh_config&lt;/tt&gt; (or &lt;tt&gt;$HOME/.ssh/config&lt;/tt&gt; if you don't have root access). his will make the client poll for server every 30 seconds. If the servers fails to respond for 4 times (i.e., 2 mins), the client will close the connection. Note that this also applies to version 2 of OpenSSH only.
&lt;/p&gt;
&lt;pre&gt;
ServerAliveInterval 30
ServerAliveCountMax 4
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-7667684425544004868?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/7667684425544004868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=7667684425544004868' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7667684425544004868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/7667684425544004868'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/02/prevent-timeouts-in-ssh.html' title='Prevent Timeouts in SSH'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bsJ8N084DzI/Rd-EaLz3cwI/AAAAAAAAABI/puBCL4IhiiU/s72-c/openssh.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-3125221544314074780</id><published>2007-02-23T15:41:00.000-05:00</published><updated>2007-03-03T19:39:23.190-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='raid'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Simple Software RAID in Linux</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://en.wikipedia.org/wiki/Linux"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_bsJ8N084DzI/Rd9YX7z3cuI/AAAAAAAAAA0/07d3vAM_12Y/s200/linux.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5034840076638974690" /&gt;&lt;/a&gt;

&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/RAID"&gt;RAID&lt;/a&gt; is commonly used in production environments to spread the data among multiple disks for higher performance, reliability or capacity. This is a small tutorial for quick setup of RAID 0 or 1 under Linux using &lt;tt&gt;mdadm&lt;/tt&gt;. Fore more advanced configuration and options &lt;a href="http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html"&gt;look&lt;/a&gt; &lt;a href="http://tldp.org/HOWTO/Software-RAID-HOWTO.html"&gt;elsewhere&lt;/a&gt;. Just for records, I have tested this on RHEL 4 update 4.&lt;/p&gt;
&lt;p&gt;
This document outlines creation of a RAID 0 drive consisting of three partitions &lt;tt&gt;/dev/sdb1&lt;/tt&gt;, &lt;tt&gt;/dev/sdc1&lt;/tt&gt;, and &lt;tt&gt;/dev/sdd1&lt;/tt&gt;. Procedure for RAID 1 should be similar. First we need to prepare the three partitions for RAID. Use &lt;tt&gt;fdisk&lt;/tt&gt; and set partition's system id of &lt;b&gt;all three&lt;/b&gt; partitions to &lt;tt&gt;fd&lt;/tt&gt; (Linux raid auto). You may need to reboot after this.
&lt;/p&gt;
&lt;pre&gt;
[root@trinity]# fdisk /dev/sdb1
&amp;lt;press t to change partition id&amp;gt;
&amp;lt;type fd as partition id&amp;gt;
&amp;lt;press w to write changes to disk&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
Use &lt;tt&gt;mdadm&lt;/tt&gt; to create the array.
&lt;/p&gt;
&lt;pre&gt;
mdadm --create /dev/md0 --level=0 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 --chunk=512
&lt;/pre&gt;
&lt;p&gt;This will create a new drive &lt;tt&gt;/dev/md0&lt;/tt&gt; with chunk size 512KB. Choice of chunk size depends on application. Default chunk size is 64K. This new drive now ready for use. There is no need to sotre these configurations in any file as &lt;tt&gt;mdadm&lt;/tt&gt; remembers everything for you even after reboot. For example, to create a new ext3 filesystem here use &lt;tt&gt;mkfs.ext3 /dev/md0&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;Information about the active RAID arrays is displayed in &lt;tt&gt;/proc/mdstat&lt;/tt&gt;. &lt;tt&gt;mdadm --detail --scan&lt;/tt&gt; can also be used.&lt;/p&gt;
&lt;pre&gt;
[root@matrix]# cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sdd1[2] sdc1[1] sdb1[0]
      215043072 blocks 1024k chunks

unused devices: &lt;none&gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-3125221544314074780?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/3125221544314074780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=3125221544314074780' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/3125221544314074780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/3125221544314074780'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/02/simple-software-raid-in-linux.html' title='Simple Software RAID in Linux'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bsJ8N084DzI/Rd9YX7z3cuI/AAAAAAAAAA0/07d3vAM_12Y/s72-c/linux.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-8682620660684725583</id><published>2007-01-28T23:50:00.000-05:00</published><updated>2007-01-29T00:14:25.753-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='acer'/><title type='text'>SuSE, Acer aspire 5580 and non-standard resolution 1280x800</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://en.opensuse.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_bsJ8N084DzI/Rb2BxddaR0I/AAAAAAAAAAk/6KRWJxOV9C4/s200/suse.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5025315445936899906" /&gt;&lt;/a&gt;
&lt;p&gt;My roommate recently purchased an Acer Aspire 5580 laptop and handed it to me for installing Linux. It is a pretty good laptop, well supported under Linux. It features Intel Core 2 Duo processor with Intel 945 GMA and 3945ABG wireless. I installed openSUSE 10.2 and everything went fine except for the screen resolution.&lt;/p&gt;

&lt;p&gt;This laptop uses 1280x800 as native resolution, but my X refused to work with anything greater than 1024x768. Initially I thought that the problem is with SuSE not recognizing HSync and VSync frequencies of the LCD screen. I tried every possible refresh rate in display settings. After a lot of googling around, I found &lt;a href="http://www.suseforums.net/index.php?s=16fdf0fc59bf654e702f855c45ad6533&amp;showtopic=27873&amp;pid=159206&amp;st=0&amp;#entry159206"&gt;945gm and 1280x800 laptop monitor problem suse 10.2&lt;/a&gt; and &lt;a href="http://en.opensuse.org/Patch_the_Video_BIOS"&gt;patch the video BIOS&lt;/a&gt;. For some reason, the hardware vendor did not include the native resolution of the LCD display in the list of supported resolutions. The solution however is simple, as there exists a hack for fooling X. On SuSE, simply edit &lt;tt&gt;/etc/sysconfig/videobios&lt;/tt&gt; and reboot. Also make sure that &lt;tt&gt;/etc/init.d/boot.videobios&lt;/tt&gt; is executed on boot time by running the following command.
&lt;/p&gt;
&lt;pre&gt;
insserv boot.videobios
&lt;/pre&gt;
&lt;p&gt;After editing, my &lt;tt&gt;/etc/sysconfig/videobios&lt;/tt&gt; looks as follows:&lt;/p&gt;
&lt;pre&gt;
VIDEOBIOS_PATCH="yes"
VIDEOBIOS_PARAMETERS="5c 1280 800"
&lt;/pre&gt;
&lt;p&gt;
I don't understand why hardware vendors can not follow standards! Anyway, the laptop is functioning fine now.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-8682620660684725583?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/8682620660684725583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=8682620660684725583' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/8682620660684725583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/8682620660684725583'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2007/01/suse-acer-aspire-5580-and-non-standard.html' title='SuSE, Acer aspire 5580 and non-standard resolution 1280x800'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bsJ8N084DzI/Rb2BxddaR0I/AAAAAAAAAAk/6KRWJxOV9C4/s72-c/suse.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-6571508383388822423</id><published>2006-12-05T23:08:00.000-05:00</published><updated>2006-12-05T23:44:31.927-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='internet'/><category scheme='http://www.blogger.com/atom/ns#' term='bsnl'/><title type='text'>BSNL broadband using Linux</title><content type='html'>&lt;p&gt;BSNL DataOne provides broadband services using ADSL. They provided me with a Sterlite modem that can be used for pppoe (since it is configured to operate in pure bridged mode). While only windows is supported officially, it is easy to use this modem with Linux. I am using OpenSUSE 10.1 on my laptop. The details for configuration are as follows:&lt;/p&gt;
&lt;p&gt;
You first need to install rp-pppoe. RPM for SuSE 10.1 is available. To configure, &lt;tt&gt;pppoe-setup&lt;/tt&gt; can be used, which will ask for many simple questions. I had the modem connected to my lan card (which was configured as eth0). My answers were as follows.
&lt;/p&gt;
&lt;pre&gt;
Welcome to the Roaring Penguin PPPoE client setup.  First, I will run
some checks on your system to make sure the PPPoE client is installed
properly...

Looks good!  Now, please enter some information:
USER NAME
&gt;&gt;&gt; Enter your PPPoE user name:dsaXYZXYZ

INTERFACE
&gt;&gt;&gt; Enter the Ethernet interface connected to the DSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethn, where 'n' is a number.
(default eth0):eth0

MODEM TYPE
We will try to detect if your modem is compliant with RFC 2516
or not. 3COM's 3CP4130 is *NOT* compliant, for instance.

Searching for a modem at interface eth0...
Found a RFC 2516 compliant modem, congratulations! :)
Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped.  If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses.  You may have some problems with demand-activated links.
&gt;&gt;&gt; Enter the demand value (default no):

DNS
Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
&gt;&gt;&gt; Enter the DNS information here: server

PASSWORD
&gt;&gt;&gt; Please enter your PPPoE password:
&gt;&gt;&gt; Please re-enter your PPPoE password:

FIREWALLING
Please choose the firewall rules to use.  Note that these rules are
very basic.  You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security.  If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself.  Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc.  If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.

The firewall choices are:
0 - NONE: This script will not set any firewall rules.  You are responsible
          for ensuring the security of your machine.  You are STRONGLY
          recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
                for a LAN
&gt;&gt;&gt; Choose a type of firewall (0-2): 0

** Summary of what you entered **
Ethernet Interface: eth0
User name:          dsa220513
Activate-on-demand: No
DNS addresses:      Supplied by ISP's server
Firewalling:        NONE
&lt;/pre&gt;
&lt;p&gt;
To start, stop and to view the status, &lt;tt&gt;pppoe-start&lt;/tt&gt;, &lt;tt&gt;pppoe-stop&lt;/tt&gt; and &lt;tt&gt;pppoe-status&lt;/tt&gt; can be used. I expected the internet to work, since after running &lt;tt&gt;pppoe-start&lt;/tt&gt;, status showed that I am connected. Messages in &lt;tt&gt;/var/log/messages&lt;/tt&gt; also didn't contain any error. LAN card had acquired IP address 192.168.1.2 from the DHCP of the modem. Modem's web configuration interface was accessible at http://192.168.1.1/.
&lt;/p&gt;
&lt;pre&gt;
pppoe-status: Link is up and running on interface ppp0
ppp0      Link encap:Point-to-Point Protocol
          inet addr:59.95.164.21  P-t-P:59.95.160.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:6727 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5687 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:6424287 (6.1 Mb)  TX bytes:826896 (807.5 Kb)
&lt;/pre&gt;
&lt;p&gt;
After some investigation I found that if I set my ethernet card (using YaST) to have static IP 192.168.0.3, and configure its default gateway as 192.168.1.1 everything works fine. I am not sure what is the reason for this, as I have no experience with pppoe; but it works. I will try to dig in this and find out the reason.
&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bsJ8N084DzI/RXZJ_LzXabI/AAAAAAAAAAM/J-YIWrSTNMA/s1600-h/bsnl-eth0-1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_bsJ8N084DzI/RXZJ_LzXabI/AAAAAAAAAAM/J-YIWrSTNMA/s320/bsnl-eth0-1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5005269385717705138" /&gt;&lt;/a&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bsJ8N084DzI/RXZKXbzXacI/AAAAAAAAAAY/m8IlLwZnVHs/s1600-h/bsnl-eth1-1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_bsJ8N084DzI/RXZKXbzXacI/AAAAAAAAAAY/m8IlLwZnVHs/s320/bsnl-eth1-1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5005269802329532866" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-6571508383388822423?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/6571508383388822423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=6571508383388822423' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/6571508383388822423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/6571508383388822423'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/12/bsnl-broadband-using-linux.html' title='BSNL broadband using Linux'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bsJ8N084DzI/RXZJ_LzXabI/AAAAAAAAAAM/J-YIWrSTNMA/s72-c/bsnl-eth0-1.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-116263561629162130</id><published>2006-11-04T04:59:00.000-05:00</published><updated>2006-11-28T19:22:14.535-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>My new Dell 640m and Linux</title><content type='html'>&lt;p&gt;Few days back I treated myself with purchase of a &lt;a href="http://www.dell.com/content/products/productdetails.aspx/inspn_640m?c=us&amp;cs=555&amp;amp;l=en&amp;s=biz"&gt;Dell Inspiron 640m&lt;/a&gt;. Its a Core 2 Duo (T5500/2MB Cache/1.66GHz/667MHz FSB) machine with Intel chipset and Intel 3945 internal wireless. I &lt;a href="http://queens.db.toronto.edu/%7Enilesh/linux/suse-10.1-install/"&gt;installed openSUSE 10.1&lt;/a&gt;, and &lt;a href="http://tuxmobil.org/howto_remove_microsoft_label.html"&gt;removed designed for windows sticker&lt;/a&gt; to stick it on my trash can. Everything worked fine with out-of-the-box install. Here is a detailed account:
&lt;/p&gt;
&lt;a href="http://www.dell.com/content/products/productdetails.aspx/inspn_640m?c=us&amp;amp;cs=04&amp;l=en&amp;amp;s=bsd"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/5042/390/400/laptop.png" alt="" border="0" /&gt;&lt;/a&gt;
&lt;p&gt;
Wireless: works fine in out-of-the-box install. Keyboard key to enable/disable wireless also works. The only way however to find out if the wireless is disabled by checking &lt;tt&gt;dmesg&lt;/tt&gt;, which contains the following message when wireless is disabled.
&lt;/p&gt;
&lt;pre&gt;
ipw3945: Radio Frequency Kill Switch is On:
Kill switch must be turned off for wireless networking to work.
&lt;/pre&gt;
&lt;p&gt;Onboard Video Card: Works fine. Intel's open source driver for 945GM support 3D accelration. I was able to play supertux without any problems. Even &lt;a href="http://en.opensuse.org/Xgl"&gt;Xgl&lt;/a&gt; worked flawlessly. But, I was not able to play Warcraft III using &lt;a href="http://www.transgaming.org/"&gt;Cedega&lt;/a&gt; as the framerate was too bad. Native version of &lt;a href="http://www.unrealtournament.com/"&gt;UT2004&lt;/a&gt; also didn't work. Probably this card is not meant for gaming.&lt;/p&gt;
&lt;p&gt;Dual head mode was not very smooth as resolution sometimes messed up after switching the output device. But it seems like a problem with SuSE and YaST, and not with the drivers.&lt;/p&gt;
&lt;p&gt;Sound: Works fine most of the time. But sometimes I need to delete and re-add the sound card using yast for audio to work. This is some bug in the driver as my &lt;tt&gt;dmesg&lt;/tt&gt; is full of error messages.&lt;/p&gt;
&lt;pre&gt;
ALSA sound/core/control.c:635: BUG? (info-&gt;access == 0)
[&lt;f8ff6757&gt;] snd_ctl_ioctl+0x463/0x9ea [snd]
[&lt;f8ff62f4&gt;] snd_ctl_ioctl+0x0/0x9ea [snd]
[&lt;c016accc&gt;] do_ioctl+0x1c/0x5e
[&lt;c016af5a&gt;] vfs_ioctl+0x24c/0x25e
[&lt;c016a9c6&gt;] do_fcntl+0x1c9/0x249
[&lt;c016afbd&gt;] sys_ioctl+0x51/0x68
[&lt;c0103bdb&gt;] sysenter_past_esp+0x54/0x79
&lt;/c0103bdb&gt;&lt;/c016afbd&gt;&lt;/c016a9c6&gt;&lt;/c016af5a&gt;&lt;/c016accc&gt;&lt;/f8ff62f4&gt;&lt;/f8ff6757&gt;&lt;/pre&gt;
&lt;p&gt;SD card reader: Doesn't work! But I can use my digital camera to transfer using usb. It seems that &lt;a href="http://gentoo-wiki.com/HOWTO_SD_and_MMC_card_readers"&gt;Gentoo wiki&lt;/a&gt; has instructions to enable this support.&lt;/p&gt;
&lt;p&gt;Additional keyboard keys: All useful keys like changing LCD brightness, switching video output etc.., work fine. Other additional keys work after setup in GNOME (but not in KDE).&lt;/p&gt;
&lt;p&gt;TV out and Express card: not tested&lt;/p&gt;
&lt;p&gt;Overall, I am happy with my choice and its Linux compatibility.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-116263561629162130?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/116263561629162130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=116263561629162130' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/116263561629162130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/116263561629162130'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/11/my-new-dell-640m-and-linux.html' title='My new Dell 640m and Linux'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-116105891543237283</id><published>2006-10-17T00:07:00.000-04:00</published><updated>2006-10-17T00:48:18.766-04:00</updated><title type='text'>Extending dojo.widget.Tooltip</title><content type='html'>&lt;p&gt;I have been playing with &lt;a href="http://www.dojotoolkit.org/"&gt;Dojo&lt;/a&gt; for past few weeks (since we are using it for AJAX stuff at &lt;a href="http://www.blogscope.net"&gt;BlogScope&lt;/a&gt;). While it is a nice library, many parts are not well documented. One such area is extending widgets to add to their functionality. Tooltip is a good example of widget that requires improvement, since it does not provide an option to have some custom text displayed while the contents of tooltip are being fetched. For &lt;a href="http://www.blogscope.net/"&gt;BlogScope&lt;/a&gt;, I wanted to have an loading icon displayed while the tooltip is being fetched in background. This article explains the code that I am using for this purpose. Note: &lt;i&gt;I am no Dojo guru. This code may not be the best way to do this, but it works&lt;/i&gt;.
&lt;/p&gt;
&lt;p&gt;
Demo: We have a &lt;a href="http://queens.db.toronto.edu/~nilesh/linux/dojo-extend-tooltip/"&gt;demo page&lt;/a&gt; displaying the extended tooltip. This demo page also has javascript to resize the tooltip to specified max-height and max-width. While CSS can be used for max-height and max-width, to make it work in IE, javascript is required. View source of the demo page to get the complete javascript code.
&lt;/p&gt;
&lt;p&gt;
Below is the HTML code for the tooltip. There are three main components. One is the link (with id=&lt;tt&gt;one&lt;/tt&gt;), mouseover on which displays the tooltip. Second is the div element with &lt;tt&gt;dojoType="PostTooltip"&lt;/tt&gt;, which specifies the url from where contents of tooltip are to be fetched. Third component is the div block (id=&lt;tt&gt;two&lt;/tt&gt;) that is the tooltip itself. After the contents are being fetched, innerHTML of this div block is updated.
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;a href="some-page" id="one"&amp;gt;bring your mouse here&amp;lt;/a&amp;gt;
&amp;lt;div dojoType="PostTooltip" style="display:none;"
    dojo:connectId="one"
    dojo:uniqId="two"
    dojo:contentUrl="tooltip.php?id=two"
    dojo:executeScripts="true"
    &amp;gt;
    &amp;lt;div id="two" style="background-color: white; border: 1px dashed #aaaaaa;"&amp;gt;
            this is a custom loading message.
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
Below is the code for fetching the contents of tooltip and adjusting its dimensions. &lt;tt&gt;uniqId&lt;/tt&gt; is the id of div block for the tooltip. Since the mimetype is text/javascript, the fetched contents must be a javascript source which when executed updates the innerHTML of tooltip's div block (something like &lt;tt&gt;document.getElementById(uniqId).innerHTML = 'This is the new content';&lt;/tt&gt;).
&lt;/p&gt;
&lt;pre&gt;
function updatePostTooltip(postUrl, uniqId) {
        dojo.io.bind({
            url: postUrl,
            load: function(type, evalObject){
                dojo.debug("data received from "+postUrl);
                adjustPostTooltipDimensions(uniqId);
            },
            mimetype: "text/javascript"
        });
}

function adjustPostTooltipDimensions(uniqId) {
        var sHeight = document.getElementById(uniqId).scrollHeight;
        var sWidth = document.getElementById(uniqId).scrollWidth;
        var maxHeight = 450;
        var maxWidth = 480;
        dojo.debug("height and width are "+sHeight+" and "+sWidth+" for "+uniqId);
        if (sHeight &gt; maxHeight) {
                dojo.debug("resizing to max height "+maxHeight);
                document.getElementById(uniqId).style.height = maxHeight + "px";
                document.getElementById(uniqId).style.overflow = "auto";
        }
        if (sWidth &gt; maxWidth) {
                dojo.debug("resizing to max width "+maxWidth);
                document.getElementById(uniqId).style.width = maxWidth + "px";
                document.getElementById(uniqId).style.overflow = "auto";
        }
    }
&lt;/pre&gt;
&lt;p&gt;
And finally below is the code for extended Tooltip widget.
&lt;/p&gt;
&lt;pre&gt;
dojo.provide("my.widget.PostTooltip");
    dojo.widget.manager.registerWidgetPackage("my.widget");

    dojo.widget.defineWidget(
        "my.widget.PostTooltip",
        dojo.widget.html.Tooltip,
        {
                //we have added three new variables, uniqId, contentUrl and hasContents
                uniqId: "",
                contentUrl: "",
                hasContents: 0,
                //We modify this function from the original in dojo.widget.html.Tooltip
                onShow: function() {
                        // copied as is from dojo/src/widget/html/Tooltip.js
                        dojo.widget.html.Tooltip.superclass.onShow.call(this);
                        this.state="displayed";
                        if(this.eraseScheduled){
                                this.hide();
                                this.eraseScheduled=false;
                        }
                        //end of copied code
                        //this is our code
                        if (this.hasContents == 0) {
                                updatePostTooltip(this.contentUrl, this.uniqId);
                                this.hasContents = 1;
                        }
                }
        }
    );
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-116105891543237283?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/116105891543237283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=116105891543237283' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/116105891543237283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/116105891543237283'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/10/extending-dojowidgettooltip.html' title='Extending dojo.widget.Tooltip'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-115831423460348074</id><published>2006-09-15T05:50:00.000-04:00</published><updated>2006-09-21T05:23:30.586-04:00</updated><title type='text'>Firefox, Linux and Audio</title><content type='html'>&lt;p&gt;Popularity of flash based video distribution sites like &lt;a href="http://www.youtube.com"&gt;YouTube&lt;/a&gt; has made Firefox with its flash player an important component of today's desktop. But it is often the case with not-so-new (SuSE 10.0 and earlier) Linux desktops that audio refuses to work. Most common reason for audio not working is when some other process or program has taken control of the sound device, and Flash player can not access it. Fortunately, fixing this problem is easy, provided your system is not too old.&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Fix&lt;/b&gt;: Firefox is started by a shell script named &lt;tt&gt;firefox&lt;/tt&gt;, usually located in &lt;tt&gt;/usr/bin/&lt;/tt&gt;. This script executes the mozilla firefox binary with appropriate options. To fix the sound problem, you need to start this binary with &lt;tt&gt;aoss&lt;/tt&gt;. This translates to editing &lt;tt&gt;/usr/bin/firefox&lt;/tt&gt; as root, and modifying the line containing&lt;/p&gt;
&lt;tt&gt;$MOZ_PROGRAM $@&lt;/tt&gt;
&lt;p&gt; to &lt;/p&gt;
&lt;tt&gt;aoss $MOZ_PROGRAM $@&lt;/tt&gt;
&lt;p&gt;
Note that these instructions are tested with SuSE 9.3 and 10.0, and some things may vary depending on the distro in use.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Some history&lt;/b&gt;: Old linux used &lt;a href="http://en.wikipedia.org/wiki/Open_Sound_System"&gt;oss&lt;/a&gt; as its sound interface. OSS is not capable of sound mixing that enables multiple programs to use the sound device simultaneously. KDE's &lt;a href="http://en.wikipedia.org/wiki/ARts"&gt;aRts&lt;/a&gt; was used on top of OSS for a long time as a temporary solution as aRts provided software mixing. But aRts is buggy, and is not well supported by many non-KDE applications. Finally, OSS was replaced by a new advanced sound interface, &lt;a href="http://en.wikipedia.org/wiki/ALSA_%28Linux%29"&gt;ALSA&lt;/a&gt; in 2002. ALSA can use hardware capabilities of audio device to mix sound coming from multiple sources, and in case hardware does not support sound mixing, ALSA provides a software implementation of mixer named &lt;a href="http://alsa.opensrc.org/index.php?page=DmixPlugin"&gt;dmix&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Flash player&lt;/b&gt;: Flash is a proprietary software, owned by a commercial organization with sole purpose of making money. It still uses OSS, as porting it to use ALSA would not have created any extra money for Macromedia/Adobe. &lt;tt&gt;aoss&lt;/tt&gt; is a script that can provide OSS emulation to applications requiring OSS, while actually using ALSA. So when Firefox is run with &lt;tt&gt;aoss&lt;/tt&gt;, Flash player uses ALSA in place of OSS. On newer linux distributions (openSUSE 10.1 and later), Firefox is configured by default to use &lt;tt&gt;aoss&lt;/tt&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-115831423460348074?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/115831423460348074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=115831423460348074' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115831423460348074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115831423460348074'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/09/firefox-linux-and-audio.html' title='Firefox, Linux and Audio'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-115666147218893428</id><published>2006-08-27T02:28:00.000-04:00</published><updated>2006-10-18T01:02:17.943-04:00</updated><title type='text'>Launching BlogScope</title><content type='html'>&lt;p&gt;Internet has provided a platform using which everyone can express his or her opinion to a wider audience. Millions of people from all around the world are using blogs for documenting their life; people write their experiences about everything, from movies to restaurants, and politics to personal life. This phenomenal popularity of blogs as media form has made blogosphere an invaluable source of information. But, it is not an easy task to find relevant and interesting content, as there are millions of blogs and a lot of content is repetitive and noisy. For past seven months, we have been working on how can we assist the user in his or her journey of exploration through blogosphere. As a result, we have developed &lt;a href="http://www.blogscope.net/"&gt;BlogScope&lt;/a&gt;.
&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.blogscope.net/"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" onload="setupSeekBar();" src="http://photos1.blogger.com/blogger/5042/390/320/blogscope-interface.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;
BlogScope is a knowledge discovery and analysis tool for &lt;a href="http://en.wikipedia.org/wiki/Blogosphere"&gt;blogosphere&lt;/a&gt;. To assist user find interesting information from large amount of text is blogosphere, BlogScope analysis engine offers tools like popularity curves, correlated terms, popularity bursts, and comparison curves. These tools can be used to track trends and temporal evolution of topics, investigate the relationship between keywords, or even for comparing &lt;a href="http://www.blogscope.net/comparecurve.jsp?q1=apples&amp;q2=oranges&amp;len=180"&gt;apples with oranges&lt;/a&gt;. For bloggers, BlogScope offers some interesting tools like &lt;a href="http://www.blogscope.net/summary/"&gt;Summary Cloud&lt;/a&gt;. To know more &lt;a href="http://www.blogscope.net/about/"&gt;read the about page&lt;/a&gt;. We also have a small 90 second &lt;a href="http://www.blogscope.net/about/demo/"&gt;flash movie&lt;/a&gt; demonstrating the system.
&lt;/p&gt;
&lt;p&gt;We are currently tracking over 4 million blogs with 25 million blog posts in our database. Number of posts is growing at a fast rate of hundred thousand per day. Codebase of BlogScope is also growing at an equivalently fast rate, and we plan to add many more cool features in future, so keep checking. We hope that you like it. And do send your feedback.&lt;/p&gt;
&lt;div class="flashdemo" style="margin-left: 20px;"&gt;
&lt;script type="text/javascript" src="http://www.blogscope.net/about/demo/flashobject.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt;
      &lt;!-- To load a movie other then the first one listed in the xml file you can specify a movie=# arguement. --&gt;
      &lt;!-- For example, to load the third movie you would do the following: MyProjectName.html?movie=3 --&gt;
      // &lt;![CDATA[
      var args = new Object();
      var query = location.search.substring(1);
      // Get query string
      var pairs = query.split( "," );
      // Break at comma
      for ( var i = 0; i &lt; pairs.length; i++ )
      {
         var pos = pairs[i].indexOf('=');
         if( pos == -1 )
         {
            continue; // Look for "name=value"
         }
         var argname = pairs[i].substring( 0, pos ); // If not found, skip
         var value = pairs[i].substring( pos + 1 ); // Extract the name
         args[argname] = unescape( value ); // Extract the value
      }
      // ]]&gt;
   &lt;/script&gt;
&lt;div id="flashcontent" style="margin-left: 20px;"&gt;
            &lt;div id="noexpressUpdate" style=""&gt;
              &lt;p&gt;This is a &lt;a href="http://www.blogscope.net/about/demo/"&gt;flash demo of BlogScope&lt;/a&gt; and requires availability of flash player.&lt;/p&gt;
            &lt;/div&gt;
       &lt;/div&gt;
      &lt;script type="text/javascript"&gt;
          // &lt;![CDATA[
         var fo = new FlashObject( "http://www.blogscope.net/about/demo/blogscope-demo_controller.swf", "http://www.blogscope.net/about/demo/blogscope-demo_controller.swf", "606", "540", "7", "#FFFFFF", false, "best" );
         fo.addVariable( "csConfigFile", "http://www.blogscope.net/about/demo/blogscope-demo_config-absolute.xml"  );
         fo.addVariable( "csColor"     , "FFFFFF"           );
         fo.addVariable( "csPreloader" , 'http://www.blogscope.net/about/demo/blogscope-demo_preload.swf' );
         if( args.movie )
         {
            fo.addVariable( "csFilesetBookmark", args.movie );
         }
         fo.write("flashcontent");
         // ]]&gt;

       &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;
Our promotional logos: &lt;a href="http://photos1.blogger.com/blogger/5042/390/1600/blogscope-logo-simple.jpg"&gt;&lt;img src="http://photos1.blogger.com/blogger/5042/390/200/blogscope-logo-simple.jpg" border="0" alt="" /&gt;&lt;/a&gt;
&lt;a href="http://photos1.blogger.com/blogger/5042/390/1600/blogscope-logo-round.jpg"&gt;&lt;img src="http://photos1.blogger.com/blogger/5042/390/200/blogscope-logo-round.jpg" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;Last updated: 11th Sept, 2006.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-115666147218893428?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/115666147218893428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=115666147218893428' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115666147218893428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115666147218893428'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/08/launching-blogscope.html' title='Launching BlogScope'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-115501801914785244</id><published>2006-08-08T01:54:00.000-04:00</published><updated>2006-08-08T02:42:44.160-04:00</updated><title type='text'>java Exception - Unknown Source</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://ant.apache.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5042/390/200/ant-logo.0.gif" border="0" alt="" /&gt;&lt;/a&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://java.sun.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5042/390/200/java-logo.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;When debugging my Java programs, reading through the exception stack trace I realized that many a times the line number in was not reported. Just the method name and file name with unknown source was reported. For example consider the following simple program compiled with build file as shown&lt;/p&gt;
&lt;pre&gt;
//File: TestDebug.java
public class TestDebug {
    public static void main(String[] args) {
        ((String)null).length();
    }
}
&lt;/pre&gt;
&lt;pre&gt;
&amp;lt;!-- build.xml --&amp;gt;
&amp;lt;project name="TestProject" default="build" basedir="."&amp;gt;
 &amp;lt;target name="build"&amp;gt;
  &amp;lt;javac srcdir="." destdir="."/&amp;gt;
 &amp;lt;/target&amp;gt;
&amp;lt;/project&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
[nilesh^trinity]$ ant build
...
[nilesh^trinity]$ java TestDebug
Exception in thread "main" java.lang.NullPointerException
        at TestDebug.main(Unknown Source)
&lt;/pre&gt;
&lt;p&gt;
After some investigation I found that &lt;a href="http://ant.apache.org/"&gt;ant&lt;/a&gt; omits debug information from compiled class by default. Hence producing exact line number in case of an error is not possible. The solution however is simple. I just modified my build file to turn debug on and to set debuglevel="lines,vars,source" under javac target in ant, and everything worked fine. Modified build file for above example will be:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;!-- build.xml --&amp;gt;
&amp;lt;project name="TestProject" default="build" basedir="."&amp;gt;
 &amp;lt;target name="build"&amp;gt;
  &amp;lt;javac srcdir="." destdir="." debug="on" debuglevel="lines,vars,source" /&amp;gt;
 &amp;lt;/target&amp;gt;
&amp;lt;/project&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Line numbers are now reported with the stack trace:&lt;/p&gt;
&lt;pre&gt;
[nilesh^trinity]$ ant build
...
[nilesh^trinity]$ java TestDebug
Exception in thread "main" java.lang.NullPointerException
        at TestDebug.main(TestDebug.java:4)
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-115501801914785244?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/115501801914785244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=115501801914785244' title='38 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115501801914785244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115501801914785244'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/08/java-exception-unknown-source.html' title='java Exception - Unknown Source'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>38</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-115300777989750420</id><published>2006-07-15T19:17:00.000-04:00</published><updated>2006-08-20T20:27:07.200-04:00</updated><title type='text'>AMD64: java.lang.OutOfMemoryError</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://java.sun.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5042/390/200/java-logo.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;Today I discovered that AMD64 version of Sun Java VM 1.5.0 has some memory problems.&lt;/p&gt;

&lt;p&gt;I spent last couple of weeks profiling a Java web application (running with Tomcat). The application crashed after running for 2-3 days with java.lang.OutOfMemoryError (even with heap size 4GB). My development machine is 32-bit and production machine 64-bit which confused me more as profiling was not able to find anything suspicious. Finally I tried using i586 JRE on our 64-bit production machines and things worked fine. Probably amd64 garbage collector has some bug. &lt;b&gt;Lesson: Java HotSpot amd64 VM 1.5 has memory management problems! use 32-bit VM instead.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;To reproduce this effect, I have following simple program:&lt;/p&gt;
&lt;pre&gt;
#File: JavaMemoryProblems.java
import java.util.HashMap;
import java.util.Map;
public class JavaMemoryProblems {
   public static void main(String[] args) {
       Map&amp;lt;String, Integer&amp;gt; map = new HashMap&amp;lt;String, Integer&amp;gt;();
       int max = 1000000;
       for (int i=0; i&amp;lt;max; i++) {
           map.put("key"+i, new Integer(i));
       }
       System.out.println("Finished with a map of size "+map.size());
   }
}
&lt;/pre&gt;
&lt;p&gt;When I run this program with i586 and amd64 versions of Java VM 1.5.0_07, I get the following results:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;32-bit: &lt;tt&gt;java -Xmx120m  JavaMemoryProblems&lt;/tt&gt;. With 120MB memory it works fine.&lt;/li&gt;
&lt;li&gt;64-bit: &lt;tt&gt;java -Xmx170m -XX:+UseSerialGC JavaMemoryProblems&lt;/tt&gt;. Anything less than 180MB throws OutOfMemory (requires 50% more than i586 version).&lt;/li&gt;
&lt;li&gt;64-bit: &lt;tt&gt;java -Xmx200m -XX:+UseParallelGC JavaMemoryProblems&lt;/tt&gt;. With 200MB but with ParallelGC (default on server class machines) hangs and needs to be killed with &lt;tt&gt;kill -9&lt;/tt&gt;.  In this case the parallel GC thread keeps calling garbage collector repeatedly. &lt;b&gt;Lesson: Use -XX:+UseSerialGC if running low on memory, ParallelGC takes too much time and CPU (and even hangs) before it figures out it can not continue.&lt;/b&gt;
&lt;/ul&gt;
&lt;p&gt;After switching to i586 VM I am saving a lot of memory (30-40%). Earlier a simple search program required 250MB heap size to search a &lt;a href="http://lucene.apache.org/"&gt;Lucene&lt;/a&gt; index with around 15 million docs (10GB index size), now it needs just 150MB. Maintaining statistics consisting of around 100 &lt;a href="http://en.wikipedia.org/wiki/Trie"&gt;Tries&lt;/a&gt; each with roughly 1 million entries required over 1050MB with amd64 VM, now I can do the same with 650MB. Memory required for parsing a simple 55MB XML from weblogs using &lt;a href="http://www.jdom.org/"&gt;JDOM&lt;/a&gt; with &lt;a href="http://www.jdom.org/docs/apidocs/org/jdom/input/SAXBuilder.html"&gt;SAXBuilder&lt;/a&gt; with i586 VM is 290MB memory compared to 440MB for amd64. Similiar things are also mentioned by sotua in &lt;a href="http://ubuntuforums.org/archive/index.php/t-88717.html"&gt;Ubuntu forums&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Anyway I have learned many interesting things about Java VM and garbage collection in last 2 weeks:&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://profiler.netbeans.org/"&gt;Netbeans Profiler&lt;/a&gt; is better than &lt;a href="http://www.eclipse.org/tptp/"&gt;Eclipse TPTP&lt;/a&gt;.
 &lt;li&gt;Java debugging options &lt;tt&gt;-verbose:gc&lt;/tt&gt;, &lt;tt&gt;-XX:+PrintGCDetails&lt;/tt&gt; and &lt;tt&gt;-XX:+PrintGCTimestamps&lt;/tt&gt; are really useful.&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html"&gt;Tuning GC with Java 5.0&lt;/a&gt; is an interesting read.&lt;/li&gt;
 &lt;li&gt;Difference between &lt;a href="http://www.sumoc.com/blog/index.cfm?mode=entry&amp;entry=CDCDBF8B-5004-2066-B7460CDEAB79328F"&gt;
PermSize and HeapSize&lt;/a&gt;.
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-115300777989750420?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/115300777989750420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=115300777989750420' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115300777989750420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115300777989750420'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/07/amd64-javalangoutofmemoryerror.html' title='AMD64: java.lang.OutOfMemoryError'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-115260269129893785</id><published>2006-07-11T03:18:00.000-04:00</published><updated>2006-07-16T04:22:44.690-04:00</updated><title type='text'>Profiling with Eclipse</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.eclipse.org/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5042/390/200/eclipse-logo.0.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;
This article explains setup required for profiling Java application (including tomcat) with eclipse using &lt;a href="http://www.eclipse.org/tptp/"&gt;TPTP platform&lt;/a&gt;. I am using Linux with i386 Sun JDK 1.5.0 (it seems that 64-bit version of agent controller is not available). In order to use TPTP, one must install two things: agent controller and eclipse tptp plugin.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Agent Controller:&lt;/b&gt; Agent controller needs to be installed on machine where the java process will run.
&lt;/p&gt;
&lt;p&gt;1. &lt;a href="http://www.eclipse.org/tptp/home/downloads/downloads.php"&gt;Download&lt;/a&gt; the agent controller and unzip it.&lt;/p&gt;
&lt;pre&gt;
mkdir $HOME/usr/tptp-agent
cd $HOME/usr/tptp-agent/
unzip tptpdc.linux_ia32-TPTP-4.2.0.zip
&lt;/pre&gt;
&lt;p&gt;2. Set up the environment variables by adding the following in your &lt;tt&gt;.bashrc&lt;/tt&gt; after adjusting the JAVA_HOME&lt;/p&gt;
&lt;pre&gt;
export JAVA_HOME=/opt/java/jdk1.5.0_06/
export RASERVER_HOME=$HOME/usr/tptp-agent/
export LD_LIBRARY_PATH=$RASERVER_HOME/lib/:$LD_LIBRARY_PATH:$JAVA_HOME/jre/lib/i386/server/
export PATH=$JAVA_HOME/bin/:$PATH:$RASERVER_HOME/bin/
&lt;/pre&gt;
&lt;p&gt;3. Configure the agent controller by running the setup script from bin directory. When asked for network configuration, provide a list of allowed hosts or allow everyone.&lt;/p&gt;
&lt;pre&gt;
cd $HOME/usr/tptp-agent/bin/
./SetConfig.sh
&lt;/pre&gt;
&lt;p&gt;4. Edit &lt;tt&gt;RAStart.sh&lt;/tt&gt; script in bin directory to point to correct &lt;tt&gt;RASERVER_HOME&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;5. Start agent controller using the command &lt;tt&gt;RAStart.sh&lt;/tt&gt;. To stop use &lt;tt&gt;RAStop.sh&lt;/tt&gt;.&lt;/p&gt;
&lt;div&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5042/390/1600/tptp1.0.png"&gt;&lt;img style="float: right;" src="http://photos1.blogger.com/blogger/5042/390/320/tptp1.0.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;&lt;b&gt;TPTP Eclipse Plugin:&lt;/b&gt; First check &lt;a href="http://www.eclipse.org/tptp/home/downloads/drops/TPTP-4.2.0.html"&gt;requirements&lt;/a&gt; for installing TPTP. Atleast JDK 1.4, Eclipse 3.2 and &lt;a href="http://www.eclipse.org/emf/"&gt;EMF&lt;/a&gt; are required. Update manager can be used to install TPTP using remote URL &lt;tt&gt;http://eclipse.org/tptp/updates/site.xml&lt;/tt&gt;. If you don't have &lt;a href="http://www.eclipse.org/birt/phoenix/"&gt;BIRT&lt;/a&gt; installed (which is an optional requirement), unselect features needing BIRT. On successful completion of installation, Profiling and Logging will show up in list of available perspectives.&lt;/p&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5042/390/1600/tptp2.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5042/390/200/tptp2.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;&lt;b&gt;Start Profiling:&lt;/b&gt; After starting the agent controller, start the long running Java process to profile with extra argument &lt;tt&gt;-XrunpiAgent:server=enabled&lt;/tt&gt;. &lt;/p&gt;
&lt;pre&gt;
java -XrunpiAgent:server=enabled MyJavaProgram
&lt;/pre&gt;
&lt;p&gt;For profiling Tomcat, add this in &lt;tt&gt;catalina.sh&lt;/tt&gt; under &lt;tt&gt;JAVA_OPTS&lt;/tt&gt;. Start eclipse, select profile from toolbar -&gt; Attach to Java process. Specify the host in the Host tab and select the process to profile in the Agents tab. From the Profiling tab select profiling type and click on Profile to start.&lt;/p&gt;

&lt;table border="0" width="100%" align="center"&gt;
&lt;tr&gt;&lt;td&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5042/390/1600/tptp5.0.png"&gt;&lt;img src="http://photos1.blogger.com/blogger/5042/390/320/tptp5.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/td&gt;&lt;td&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5042/390/1600/tptp4.0.png"&gt;&lt;img src="http://photos1.blogger.com/blogger/5042/390/320/tptp4.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5042/390/1600/tptp3.0.png"&gt;&lt;img style="float: right;" src="http://photos1.blogger.com/blogger/5042/390/320/tptp3.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;There are a bunch of profiling views available. Refer to &lt;a href="http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.tptp.platform.doc.user/tasks/tecretrc.htm"&gt;eclipse tptp documentation&lt;/a&gt; for more help.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-115260269129893785?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/115260269129893785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=115260269129893785' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115260269129893785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115260269129893785'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/07/profiling-with-eclipse.html' title='Profiling with Eclipse'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-115104564777027496</id><published>2006-06-23T02:36:00.000-04:00</published><updated>2006-09-07T20:21:20.563-04:00</updated><title type='text'>SSH brute attack</title><content type='html'>&lt;p&gt;
Today I discovered that one of our lab machines has been compromised. It faced heavy &lt;a href="http://en.wikipedia.org/wiki/Dictionary_attack"&gt;dictionary attack&lt;/a&gt; via ssh from matheron.scv.math.unb.ca. One of the users had a simple password and the attacker was able to get access to his account. Attackers after getting the access, copied a &lt;a href="http://www.gatago.com/linux/redhat/misc/17206495.html"&gt;brute force cracking program for ssh&lt;/a&gt; to &lt;tt&gt;/tmp/. /brute&lt;/tt&gt; and started using our machine to break in other machines.
&lt;/p&gt;
&lt;p&gt;
I had noticed such &lt;a href="http://it.slashdot.org/article.pl?sid=05/07/16/1615233"&gt;brute force attacks&lt;/a&gt; &lt;a href="http://nileshbansal.blogspot.com/2005/12/security-is-important.html"&gt;earlier&lt;/a&gt;, but ignored them. I never realized that such attacks actually work. In last one month, there were over 20 thousand such attempts from over 100 different hosts. Scary!
&lt;/p&gt;
&lt;p&gt;
An  excerpt from &lt;tt&gt;/var/log/messages/&lt;/tt&gt;
&lt;/p&gt;
&lt;pre&gt;
Jun 18 05:20:17 soho sshd(pam_unix)[29250]: check pass; user unknown
Jun 18 05:20:17 soho sshd(pam_unix)[29250]: authentication failure; logname= uid=0
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173
Jun 18 05:20:21 soho sshd(pam_unix)[29252]: authentication failure; logname= uid=0 
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173  user=root
Jun 18 05:20:26 soho sshd(pam_unix)[29254]: authentication failure; logname= uid=0 
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173  user=root
Jun 18 05:20:33 soho sshd(pam_unix)[29256]: check pass; user unknown
Jun 18 05:20:33 soho sshd(pam_unix)[29256]: authentication failure; logname= uid=0 
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173
Jun 18 05:20:38 soho sshd(pam_unix)[29258]: check pass; user unknown
Jun 18 05:20:38 soho sshd(pam_unix)[29258]: authentication failure; logname= uid=0 
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173
Jun 18 05:20:45 soho sshd(pam_unix)[29260]: authentication failure; logname= uid=0 
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173  user=root
Jun 18 05:20:50 soho sshd(pam_unix)[29262]: authentication failure; logname= uid=0 
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173  user=root
Jun 18 05:20:55 soho sshd(pam_unix)[29264]: check pass; user unknown
Jun 18 05:20:55 soho sshd(pam_unix)[29264]: authentication failure; logname= uid=0 
                                   euid=0 tty=ssh ruser= rhost=202.96.216.173
&lt;/pre&gt;
&lt;p&gt;
The reason I was able to detect that our machine is compromised is that &lt;tt&gt;brute&lt;/tt&gt; program crashed frequently and had entries in &lt;tt&gt;/var/log/messages/&lt;/tt&gt;
&lt;/p&gt;
&lt;pre&gt;Jun 20 21:51:33 soho kernel: brute[15536]: segfault at 0000000000000000 
                                                rip 0000000008048e33 rsp 00000000ffffd280 error 4
Jun 20 21:51:33 soho kernel: brute[15537]: segfault at 0000000000000000 
                                                rip 0000000008048e33 rsp 00000000ffffd280 error 4
Jun 20 21:51:33 soho kernel: brute[15538]: segfault at 0000000000000000 
                                                rip 0000000008048e33 rsp 00000000ffffd280 error 4
Jun 20 21:51:33 soho kernel: brute[15540]: segfault at 0000000000000000 
                                                rip 0000000008048e33 rsp 00000000ffffd280 error 4
&lt;/pre&gt;
&lt;p&gt;
The bottom line is: &lt;b&gt;Its a dangerous world out there!&lt;/b&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-115104564777027496?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/115104564777027496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=115104564777027496' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115104564777027496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/115104564777027496'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/06/ssh-brute-attack.html' title='SSH brute attack'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-114833555714195778</id><published>2006-05-22T18:04:00.000-04:00</published><updated>2006-05-22T18:17:09.230-04:00</updated><title type='text'>SuSE 10.1 Installation Guide</title><content type='html'>&lt;p&gt;
I recently installed SUSE Linux 10.1 on my workstation. While installing, I saved 
screenshot for each step and prepared a &lt;a href="http://queens.db.toronto.edu/~nilesh/linux/suse-10.1-install/"&gt;
step by step guide to installing SUSE 10.1&lt;/a&gt; for newbies.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-114833555714195778?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/114833555714195778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=114833555714195778' title='45 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114833555714195778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114833555714195778'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/05/suse-101-installation-guide.html' title='SuSE 10.1 Installation Guide'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>45</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-114790411493338274</id><published>2006-05-17T18:08:00.000-04:00</published><updated>2006-07-11T15:04:29.453-04:00</updated><title type='text'>VMWare Workstation on SuSE Linux 10.1</title><content type='html'>&lt;p&gt;
&lt;a href="http://www.vmware.com/products/ws/"&gt;VMWare workstation&lt;/a&gt; allows user to run multiple operating systems on one machine. I decided to try the eval version on my newly installed SUSE 10.1 box. The installation however was not as smooth as I would have liked. Installation fails while compiling &lt;tt&gt;vmmon&lt;/tt&gt; module for my kernel version (2.6.16.13-4-bigsmp, SuSE 10.1). Fortunately, there is a workaround as mentioned &lt;a href="http://www.vmware.com/community/thread.jspa?threadID=30187&amp;tstart=60"&gt;in this forum&lt;/a&gt;, but it took me considerable time to figure out what to do in order to make vmmon compile. Hence, I am posting what exactly needs to be done.
&lt;/p&gt;
&lt;p&gt;
I downloaded the tarball for evaluation version of VMWare workstation from their website and tried to install it using the provided installation script.
&lt;/p&gt;
&lt;pre&gt;
tar zxvf VMware-workstation-5.5.1-19175.tar.gz
cd /vmware-distrib/
./vmware-install.pl
&lt;/pre&gt;
&lt;p&gt;
I answered all the questions with their default answers. The script after installation executed &lt;tt&gt;vmware-config.pl&lt;/tt&gt;, which exited with the following error while compiling &lt;tt&gt;vmmon&lt;/tt&gt;.
&lt;/p&gt;
&lt;pre&gt;
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config3/vmmon-only'
make -C /lib/modules/2.6.16.13-4-bigsmp/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-2.6.16.13-4-obj/i386/bigsmp'
make -C ../../../linux-2.6.16.13-4 O=../linux-2.6.16.13-4-obj/i386/bigsmp modules
  CC [M]  /tmp/vmware-config3/vmmon-only/linux/driver.o
In file included from /tmp/vmware-config3/vmmon-only/linux/driver.h:20,
                 from /tmp/vmware-config3/vmmon-only/linux/driver.c:49:
/tmp/vmware-config3/vmmon-only/./include/compat_wait.h:37:5: warning: "VMW_HAVE_EPOLL" is not defined
/tmp/vmware-config3/vmmon-only/./include/compat_wait.h:43:5: warning: "VMW_HAVE_EPOLL" is not defined
In file included from /tmp/vmware-config3/vmmon-only/linux/driver.h:20,
                 from /tmp/vmware-config3/vmmon-only/linux/driver.c:49:
/tmp/vmware-config3/vmmon-only/./include/compat_wait.h:60: error: conflicting types for ‘poll_initwait’
/usr/src/linux-2.6.16.13-4/include/linux/poll.h:45: error: previous declaration of ‘poll_initwait’ was here
/tmp/vmware-config3/vmmon-only/linux/driver.c:145: warning: initialization from incompatible pointer type
/tmp/vmware-config3/vmmon-only/linux/driver.c:149: warning: initialization from incompatible pointer type
make[4]: *** [/tmp/vmware-config3/vmmon-only/linux/driver.o] Error 1
make[3]: *** [_module_/tmp/vmware-config3/vmmon-only] Error 2
make[2]: *** [modules] Error 2
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.16.13-4-obj/i386/bigsmp'
make: *** [vmmon.ko] Error 2
make: Leaving directory `/tmp/vmware-config3/vmmon-only'
Unable to build the vmmon module.

For more information on how to troubleshoot module-related problems, please
visit our Web site at "http://www.vmware.com/download/modules/modules.html" and
"http://www.vmware.com/support/reference/linux/prebuilt_modules_linux.html".
&lt;/pre&gt;
&lt;p&gt;
The workaround is to modify the &lt;tt&gt;Makefile.kernel&lt;/tt&gt;, by adding &lt;tt&gt;-DKBUILD_BASENAME=\"$(DRIVER)\"&lt;/tt&gt; just after &lt;tt&gt;-Iinclude2/asm/mach-default&lt;/tt&gt; 
(on the same line). Do the following step by step.
&lt;/p&gt;
&lt;pre&gt;
cd /usr/lib/vmware/modules/source
tar xf vmmon.tar
tar xf vmnet.tar
vim vmmon-only/Makefile.kernel #EDIT as mentioned above
vim vmnet-only/Makefile.kernel #EDIT as mentioned above
mv vmmon.tar vmmon.tar.save
mv vmnet.tar vmnet.tar.save
tar cf vmmon.tar vmmon-only
tar cf vmnet.tar vmnet-only
&lt;/pre&gt;
&lt;p&gt;
After modification, first few lines of &lt;tt&gt;vmnet-only/Makefile.kernel&lt;/tt&gt; looks like
&lt;/p&gt;
&lt;div class="pre"&gt;
vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-DKBUILD_BASENAME=\"$(DRIVER)\" \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-Werror -S -o /dev/null -xc $(1) \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&gt; /dev/null 2&gt;&amp;1; then echo "$(2)"; else echo "$(3)"; fi)
&lt;/div&gt;
&lt;p&gt;and that of &lt;tt&gt;vmmon-only/Makefile.kernel&lt;/tt&gt; looks like&lt;/p&gt;
&lt;div class="pre"&gt;
vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-DKBUILD_BASENAME=\"$(DRIVER)\" \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-Werror -S -o /dev/null -xc $(1) \&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&gt; /dev/null 2&gt;&amp;1; then echo "$(2)"; else echo "$(3)"; fi)
&lt;/div&gt;
&lt;p&gt;
After modifying both the Makefile.kernel files, execute &lt;tt&gt;/usr/bin/vmware-config.pl&lt;/tt&gt; again. The compilation should go fine this time.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-114790411493338274?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/114790411493338274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=114790411493338274' title='33 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114790411493338274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114790411493338274'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/05/vmware-workstation-on-suse-linux-101.html' title='VMWare Workstation on SuSE Linux 10.1'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>33</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-114703284640303019</id><published>2006-05-07T15:51:00.000-04:00</published><updated>2006-05-07T16:16:47.806-04:00</updated><title type='text'>Apache on RHEL 3 (undefined symbol: gdbm_errno)</title><content type='html'>&lt;p&gt;
While trying to enable web based admin gui for our sun ray server, I discovered that, httpd on RHEL  3 has some problems with libraries.
&lt;/p&gt;
&lt;pre&gt;
[root@manhattan root]# httpd
httpd: relocation error: /usr/lib/libaprutil-0.so.0: undefined symbol: gdbm_errno
&lt;/pre&gt;
&lt;p&gt;
Since I had not installed or changed anything after installing RedHat Enterprise Linux AS 3, I believe, this bug comes packaged with the distribution. And I expect Red Hat to test their software more carefully, at least httpd.
&lt;/p&gt;
&lt;p&gt;
To debug, I checked dependencies for &lt;tt&gt;libaprutil-0.so.0&lt;/tt&gt; and symbols in &lt;tt&gt;libgdbm.so&lt;/tt&gt;. To my surprise, &lt;tt&gt;gdbm_errno&lt;/tt&gt; was in the &lt;tt&gt;libgdbm.so&lt;/tt&gt;, and &lt;tt&gt;httpd&lt;/tt&gt; should not have reported error. Everything (&lt;tt&gt;LD_LIBRARY_PATH&lt;/tt&gt; and &lt;tt&gt;ld.so.cache&lt;/tt&gt;) was fine.
&lt;/p&gt;
&lt;pre&gt;
[root@manhattan root]# rpm -aq | grep httpd
httpd-2.0.46-54.ent
redhat-config-httpd-1.1.0-4.30.2

[root@manhattan root]# rpm -aq | grep gdbm
gdbm-devel-1.8.0-20
gdbm-1.8.0-20

[root@manhattan root]# ldd -d /usr/lib/libaprutil-0.so.0
        libpthread.so.0 =&gt; /lib/tls/libpthread.so.0 (0x00cc8000)
        libc.so.6 =&gt; /lib/tls/libc.so.6 (0x008c2000)
        /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x00216000)
undefined symbol: gdbm_errno    (/usr/lib/libaprutil-0.so.0)
undefined symbol: apr_pool_cleanup_null (/usr/lib/libaprutil-0.so.0)

[root@manhattan root]# nm --dynamic /usr/lib/libgdbm.so | grep gdbm_errno
000061c4 D gdbm_errno
&lt;/pre&gt;
&lt;p&gt;
After trying out many things and googling, I was able to fix the problem. Before starting httpd, I had to run
&lt;/p&gt;
&lt;pre&gt;
[root@manhattan root]# export LD_PRELOAD=/usr/lib/libgdbm.so.2
&lt;/pre&gt;
&lt;p&gt;
I am not sure why and how it worked and why exactly was their a problem in the first place. This will probably remain a mystery for me.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-114703284640303019?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/114703284640303019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=114703284640303019' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114703284640303019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114703284640303019'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/05/apache-on-rhel-3-undefined-symbol.html' title='Apache on RHEL 3 (undefined symbol: gdbm_errno)'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-114654392630460934</id><published>2006-05-02T00:21:00.000-04:00</published><updated>2006-05-02T04:12:07.590-04:00</updated><title type='text'>Democracy Player on SuSE 10.0</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5042/390/1600/Democracy2.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5042/390/320/Democracy2.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;
When I read news about &lt;a href="http://linux.slashdot.org/article.pl?sid=06/04/27/2224208&amp;from=rss"&gt; availability of linux version of democracy player&lt;/a&gt;, I decided to try it. But unfortunately no SuSE packages or build instructions were available. But, after hours of hard work, I managed to install it on my x86_64 machine running SuSE linux 10.0. Here is what I did.
&lt;/p&gt;
&lt;p&gt;First I installed &lt;a href="http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/"&gt;Pyrex&lt;/a&gt;. Since version 0.9.3 of Pyrex is buggy, I installed v0.9.4.1 by compiling from sources. I also installed &lt;tt&gt;mozilla-config&lt;/tt&gt; from rpm using YaST. Then I installed &lt;a  href="http://www.boost.org/"&gt;boost&lt;/a&gt; from source (rpm I had, had some problems). To install boost, &lt;tt&gt;bjam&lt;/tt&gt; is required, which fortunately was available as rpm, and I used YaST to install it. After installing bjam, I used the following procedure to install boost.
&lt;/p&gt;
&lt;pre&gt;
tar zxvf boost_1_33_0.tar.gz
cd boost_1_33_0
export PYTHON_VERSION=2.4
export PYTHON_LIB_PATH=/usr/lib64/python2.4/
export PYTHON_INCLUDE_PATH=/usr/include/python2.4/
sudo bjam "-sTOOLS=gcc" install
&lt;/pre&gt;
&lt;p&gt;
I then proceeded to install Democracy player from source. Democracy source must reside in directory named &lt;tt&gt;tv&lt;/tt&gt;. Also &lt;tt&gt;libboost_python-gcc-mt-1_33.so.1.33.0&lt;/tt&gt; had to be manually linked to &lt;tt&gt;libboost_python.so&lt;/tt&gt;. Since boost was installed in &lt;tt&gt;/usr/local/&lt;/tt&gt;, I also had to set appropriate CPPFLAGS and LD_LIBRARY_PATH.
&lt;/p&gt;
&lt;pre&gt;
tar zxvf Democracy-0.8.2-Source.tar.gz
mv Democracy-Player-0.8.2/ tv
cd tv/platform/gtk-x11/
export DEMOCRACY_RESOURCE_ROOT=/usr/share/democracy/resources/
export CPPFLAGS="-I/usr/local/include/boost-1_33/"
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
export PATH=/opt/mozilla/bin/:$PATH
sudo ln -s /usr/local/lib/libboost_python-gcc-mt-1_33.so.1.33.0 /usr/local/lib/libboost_python.so
python setup.py install --root=/
&lt;/pre&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5042/390/1600/Democracy1.0.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5042/390/320/Democracy1.0.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;This installed Democracy player, but I still wasn't able to start it, because &lt;tt&gt;gtkmozembed&lt;/tt&gt; was not available. I then had to compile gnome-python-extras-2.12.1 from source.&lt;/p&gt;
&lt;pre&gt;
tar zxvf gnome-python-extras-2.12.1.tar.gz; cd gnome-python-extras-2.12.1
./configure --prefix=/usr/
make
sudo make install
&lt;/pre&gt;
&lt;p&gt;Now to start Democracy Player, I need to&lt;/p&gt;
&lt;pre&gt;
cd tv/platform/gtk-x11/
export DEMOCRACY_RESOURCE_ROOT=/usr/share/democracy/resources/
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
export PATH=/opt/mozilla/bin/:$PATH
python democracyplayer
&lt;/pre&gt;
&lt;p&gt;
After installation, I started Democracy and downloaded a few videos (which were saved to &lt;tt&gt;~/Movies/Democracy/&lt;/tt&gt;). While videos played fine, there was no sound. I tried playing videos with mplayer they worked fine. The problem was with xine, and I had to install xine from source again. After all this, Democracy is now working fine (except that it has loads of bugs and is very unstable).
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-114654392630460934?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/114654392630460934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=114654392630460934' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114654392630460934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114654392630460934'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/05/democracy-player-on-suse-100.html' title='Democracy Player on SuSE 10.0'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-114149675591328704</id><published>2006-03-04T13:05:00.000-05:00</published><updated>2006-09-07T20:11:56.276-04:00</updated><title type='text'>Moving a Folder Across SVN Repositories</title><content type='html'>&lt;p&gt;
Sometimes we may want to transfer a directory from one subversion repository to another without losing any revision history. This can be dones using &lt;tt&gt;svnadmin&lt;/tt&gt; dump and load with &lt;tt&gt;svndumpfilter&lt;/tt&gt;. The following commands will create the directory /folder/to/move/ in the target repository.
&lt;pre&gt;
svnadmin dump /path/to/sourcerepo/ | svndumpfilter include /folder/to/move/ &amp;gt; dumpfile
svnadmin load /path/to/targetrepo/ &amp;lt; dumpfile
&lt;/pre&gt;
&lt;p&gt;
This creates the folder /folder/to/move/ in targetrepo, and there is no simple way (except probably by editing the dumpfile manually) to instruct it to create only the folder /move/.
&lt;/p&gt;
&lt;p&gt;
svndumpfilter does not filter out empty revisions. Hence, one may like to add options &lt;tt&gt;--drop-empty-revs --renumber-revs&lt;/tt&gt; to &lt;tt&gt;svnadmin load&lt;/tt&gt; to drop empty revisions and adjust revision numbers when an empty revision is dropped. More information about administration utilities in svn can be found at &lt;a href="http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html"&gt;the red book&lt;/a&gt;.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-114149675591328704?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/114149675591328704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=114149675591328704' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114149675591328704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/114149675591328704'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/03/moving-folder-across-svn-repositories.html' title='Moving a Folder Across SVN Repositories'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-113788990739295864</id><published>2006-01-21T19:18:00.000-05:00</published><updated>2006-01-24T00:06:38.533-05:00</updated><title type='text'>Google Talk voice chat on SuSE</title><content type='html'>One of the things that I sometimes miss on Linux is the ability of voice chat. Skype is the only IM network that supports voice call to and from Linux machines. However, with recent release of &lt;a href="http://code.google.com/apis/talk/about.html"&gt;libjingle&lt;/a&gt; by Google, it is now possible to call my friends using Google Talk from Linux. &lt;a href="http://psi-im.org/wiki/Jingle_branch"&gt; psi-jingle&lt;/a&gt; branch of psi has implemented the support of libjingle. I recently installed it on my desktop running SuSE 9.3 and it works great. Here is the procedure for installation. 
&lt;br&gt;&lt;br&gt;
1. Get the sources either directly from the darcs repository
&lt;pre&gt;
darcs get --partial --set-scripts-executable http://dev.psi-im.org/darcs/psi-jingle
&lt;/pre&gt;
or download this &lt;a href="http://www.db.toronto.edu/~nilesh/files/blog/psi-jingle.20060122.tar.bz2"&gt;tarball&lt;/a&gt;.
&lt;br&gt;&lt;br&gt;
2. Install all required packages (use &lt;a href="http://www.cse.iitb.ac.in/nilesh//linux/beginners/howto?what=apt/apt-suse.php"&gt;apt&lt;/a&gt;)
&lt;pre&gt;
apt install speex-devel
apt install qca-devel
&lt;/pre&gt;
3. Compile ORTP from source because the version of package in repository was not compatible.
&lt;pre&gt;
wget http://www.linphone.org/ortp/sources/ortp-0.7.1.tar.gz
tar zxvf ortp-0.7.1.tar.gz; cd ortp-0.7.1
./configure --prefix=/usr/
make &amp;&amp; make install
&lt;/pre&gt;
4. Install psi-jingle
&lt;pre&gt;
cd psi-jingle
./configure --enable-jingle --with-qca-inc=/usr/lib/qt3/include/ --with-qca-lib=/usr/lib/qt3/lib/   
           --with-ortp-lib=/usr/lib/ --with-ortp-inc=/usr/include/  
           --with-glib-inc=/opt/gnome/include/glib-2.0/ --with-glib-lib=/opt/gnome/lib/ 
           --with-glibconfig-inc=/opt/gnome/lib/glib-2.0/include/
make
&lt;/pre&gt;
5. Fire up &lt;tt&gt;psi&lt;/tt&gt; and &lt;a href="http://www.google.com/support/talk/bin/answer.py?answer=24074"&gt;login to Google Talk&lt;/a&gt; network and start voice chatting.
&lt;br&gt;&lt;br&gt;
It is important to note that psi-jingle is an under development code and there may be bugs (although it works fine for me). If there are problems, check artsd is not running and mic is functioning fine.
&lt;br&gt;&lt;br&gt;
Note: these instructions will work only with 32-bit OS. While I was able to successfully compile it on amd64, the procedure was non-trivial and required me to edit many Makefiles and source files manually.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-113788990739295864?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/113788990739295864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=113788990739295864' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113788990739295864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113788990739295864'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/01/google-talk-voice-chat-on-suse.html' title='Google Talk voice chat on SuSE'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-113770229465984153</id><published>2006-01-19T15:20:00.000-05:00</published><updated>2006-01-22T17:21:08.046-05:00</updated><title type='text'>FreeNX on RHEL 3</title><content type='html'>RPMs referred here are available at &lt;a href="http://www.db.toronto.edu/~nilesh/linux/rpms/RHEL3/"&gt; http://www.db.toronto.edu/~nilesh/linux/rpms/RHEL3/&lt;/a&gt;.
&lt;br&gt;&lt;br&gt;
1. Install NX and FreeNX rpms
&lt;pre&gt;
rpm -ivh --nodeps nx-1.5.0-12.el3.at.i386.rpm
rpm -ivh --nodeps freenx-0.4.4-6.el3.at.noarch.rpm
&lt;/pre&gt;

2. Setup everything
&lt;pre&gt;
nxsetup --install --setup-nomachine-key --clean --purge
&lt;/pre&gt;

3. To start/stop use
&lt;pre&gt;
nxserver --start
nxserver --stop
nxserver --status
&lt;/pre&gt;
Optionally create &lt;tt&gt;/etc/init.d/nxserver&lt;/tt&gt; with following content
&lt;pre&gt;
# File /etc/init.d/nxserver
# RHEL startup script
[ -f /usr/bin/nxserver ] || { echo "ERROR: /usr/bin/nxserver doesn't exist" ; exit 1; }

function start()
{
  /usr/bin/nxserver --start
  /usr/bin/nxserver --statistics start
}
function stop()
{
  /usr/bin/nxserver --stop
  /usr/bin/nxserver --statistics stop
}
function restart()
{
  /usr/bin/nxserver --restart
  /usr/bin/nxserver --statistics restart
}
case $1 in
start)
      start
   ;;
stop)
    stop
  ;;
restart)
    restart
  ;;
*)
  echo "Usage: $0 {start|stop|restart}"
  exit 1
  ;;
esac
&lt;/pre&gt;
and run the commands
&lt;pre&gt;
/etc/init.d/nxserver restart
chkconfig nxserver on
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-113770229465984153?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/113770229465984153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=113770229465984153' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113770229465984153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113770229465984153'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/01/freenx-on-rhel-3.html' title='FreeNX on RHEL 3'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-113770127116795701</id><published>2006-01-19T14:49:00.000-05:00</published><updated>2006-01-22T17:19:01.866-05:00</updated><title type='text'>Media Wiki on RHEL4</title><content type='html'>To install MediaWiki on RedHat Linux Enterprise Edition, follow thw following instructions:
&lt;br&gt;&lt;br&gt;
1. Download MediaWiki from http://www.mediawiki.org/wiki/Download and untar it
&lt;pre&gt;
tar zxvf mediawiki-1.5.5.tar.gz
mv mediawiki-1.5.5/ /var/www/wiki
&lt;/pre&gt;
2. Check that httpd and php are installed (from the default installation). I have the following rpms installed.
&lt;pre&gt;
httpd-2.0.52-19.ent
php-4.3.9-3.9
&lt;/pre&gt;
3. Install MySQL and php-mysql. I had following RPMs.
&lt;pre&gt;
MySQL-shared-standard-4.1.16-1.rhel4
MySQL-server-standard-4.1.16-1.rhel4
MySQL-devel-standard-4.1.16-1.rhel4
MySQL-client-standard-4.1.16-1.rhel4
php-mysql-4.3.9-3.9
&lt;/pre&gt;
4. Create account on MySQL for media wiki. Either use mysql-administrator or phpMyAdmin or the following commands
&lt;pre&gt;
[root@queens]# mysql -uroot -hlocalhost -p mysql
mysql&gt; create database wikidb;
mysql&gt; GRANT ALL PRIVILEGES ON wikidb.* to 'wikiuser'@'%' identified 
       by 'wikipasswd' WITH GRANT OPTION;
mysql&gt; FLUSH PRIVILEGES;
&lt;/pre&gt;
5. Change the permissions of MediaWiki config directory.
&lt;pre&gt;
chmod a+w /var/www/wiki/config/
&lt;/pre&gt;
6. Visit the wiki URl (http://yourhost/wiki/) and enter all configuration details. When finished move LocalSettings.php to parent directory and change permissions of config directory.
&lt;pre&gt;
mv /var/www/wiki/config/LocalSettings.php /var/www/wiki/
chmod -R og-w /var/www/wiki/config/
&lt;/pre&gt;


All RPMS are available at &lt;a href="http://www.db.toronto.edu/~nilesh/linux/rpms/RHEL4/"&gt;http://www.db.toronto.edu/~nilesh/linux/rpms/RHEL4/&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-113770127116795701?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/113770127116795701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=113770127116795701' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113770127116795701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113770127116795701'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/01/media-wiki-on-rhel4.html' title='Media Wiki on RHEL4'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-113774500583295057</id><published>2006-01-05T03:12:00.000-05:00</published><updated>2006-07-28T01:31:39.823-04:00</updated><title type='text'>Subversion HOWTO</title><content type='html'>&lt;p&gt;
Recently I installed subversion with trac by compiling Apache and everything. I have written a &lt;a href="http://www.cs.toronto.edu/~nilesh/linux/subversion-howto/"&gt;howto&lt;/a&gt; explaining the process in detail.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.cs.toronto.edu/~nilesh/linux/subversion-howto/"&gt;http://www.cs.toronto.edu/~nilesh/linux/subversion-howto/&lt;/a&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-113774500583295057?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/113774500583295057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=113774500583295057' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113774500583295057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113774500583295057'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2006/01/subversion-howto.html' title='Subversion HOWTO'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-113575856533952812</id><published>2005-12-28T03:03:00.000-05:00</published><updated>2005-12-28T03:30:05.090-05:00</updated><title type='text'>Security is Important</title><content type='html'>&lt;p&gt;A few days back I configured apache on one of the machines and made it visible to outside world. No content was uploaded and I expected no one to visit the page. Today, when I was checking the access_log for apache (just out of curiosity), I noticed repeated requests for xmlrpc.php (although there was no such file on my machine). There were atleast 12 different machines (in just 3 days) scanning the host for xmlrpc.php. A quick google search revealed &lt;a href="http://isc.sans.org/diary.php?storyid=823"&gt;the vulnerability in xmlrpc&lt;/a&gt; which these machines were trying to exploit.&lt;/p&gt;

&lt;p&gt;I always ignored security advisories, and considered them only for paranoids. But similar incidents in last few days have made me realize that security is a real problem. There are so many "bad" machines out there, scanning every other machine for some vulnerability. There is a whole economy behind these viruses and spam. It is therefore important to be cautious.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-113575856533952812?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/113575856533952812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=113575856533952812' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113575856533952812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113575856533952812'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2005/12/security-is-important.html' title='Security is Important'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-113289642540464106</id><published>2005-11-25T00:17:00.000-05:00</published><updated>2006-02-19T23:42:58.406-05:00</updated><title type='text'>Plotting in Matlab without X-window</title><content type='html'>Matlab can be operated in non-GUI mode. To start matlab:
&lt;pre&gt;
matlab -nodesktop -nojvm -nosplash
&lt;/pre&gt;
If you wish to plot graphs without using X or GUI, open a figure with visibility hidden, plot the graph and then print the figure to a file.
&lt;pre&gt;
&gt;&gt; h = figure('Visible', 'off')
h =

     1
&lt;/pre&gt;
&lt;tt&gt;figure&lt;/tt&gt; returns a handle to figure. Now issue the plot command.
&lt;pre&gt;
plot(1:4,5:8)
&lt;/pre&gt;
The figure can now be saved using the &lt;tt&gt;print&lt;/tt&gt; command.
&lt;pre&gt;
print -f1 -dps 'filename.ps'
&lt;/pre&gt;
The syntax for the print command is &lt;br&gt;
&lt;tt&gt;print -f&lt;i&gt;handle&lt;/i&gt; -d&lt;i&gt;device&lt;/i&gt;&lt;/tt&gt;. &lt;br&gt;
In our case, the handle is 1 and device is post script file.
&lt;br&gt;&lt;br&gt;
Update: As posted by anonymous, another option is to use
&lt;pre&gt;
saveas(h,'file.png');
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-113289642540464106?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/113289642540464106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=113289642540464106' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113289642540464106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113289642540464106'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2005/11/plotting-in-matlab-without-x-window.html' title='Plotting in Matlab without X-window'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6835740.post-113142094792289358</id><published>2005-11-07T22:34:00.000-05:00</published><updated>2005-11-07T22:35:47.923-05:00</updated><title type='text'>New Blog</title><content type='html'>I now have this space where, hopefully, I will be writing something.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6835740-113142094792289358?l=nileshbansal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nileshbansal.blogspot.com/feeds/113142094792289358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6835740&amp;postID=113142094792289358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113142094792289358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6835740/posts/default/113142094792289358'/><link rel='alternate' type='text/html' href='http://nileshbansal.blogspot.com/2005/11/new-blog.html' title='New Blog'/><author><name>nileshbansal</name><uri>http://www.blogger.com/profile/17117463439531040685</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
