<?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-33560925</id><updated>2012-01-28T20:09:42.196-07:00</updated><category term='gconsync popup'/><category term='runtime log4j loggers'/><category term='how lvm snapshots work'/><category term='migratedb postgres'/><category term='tomcat debugger issue'/><category term='apache commons net ftpclient socket timeout'/><category term='veoh full screen freeze'/><category term='TwinView option disabled in Nvidia-Settings'/><category term='flash full screen freeze'/><category term='mysql duplicate key sequence issue'/><category term='mysql timeout'/><category term='postgres migratedb'/><category term='Wicd won&apos;t automatically connect to wireless network'/><category term='apache commons net ftpclient default timeout'/><category term='home server'/><category term='mysql duplicate key value exists'/><category term='production logs'/><category term='manage database changes'/><category term='latin utf-8 conversion'/><category term='apache commons net ftpclient buffer'/><category term='java.sql.BatchUpdateException: Duplicate entry for key'/><category term='Enable Mysql general query log in Mac OSX'/><category term='MI_MAX_POSSIBLE_KEY_BUFF'/><category term='database timeout'/><category term='jpda connection refused'/><category term='apache commons net ftpclient timeout'/><category term='apache commons net ftpclient default buffer'/><category term='production log management'/><category term='mysql duplicate key error due to sequence issue'/><category term='gconsync disable'/><category term='migratedb tutorial'/><category term='change log4j loggers production'/><category term='home server ping won&apos;t respond'/><category term='monitoring gearman'/><category term='JUnit outofmemory'/><category term='database maintenance'/><category term='mysql stale connection issue'/><category term='MI_MAX_KEY_LENGTH'/><category term='gearman monitoring'/><category term='megavideo full screen freeze'/><category term='connection refused'/><category term='fun beginner programming problems'/><category term='apache commons net ftpclient data timeout'/><category term='agile database changes'/><category term='hibernate duplicate key'/><title type='text'>My Tech Blogs!!!</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>70</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-33560925.post-7992279046156768630</id><published>2011-10-18T16:28:00.002-07:00</published><updated>2011-10-18T16:31:48.694-07:00</updated><title type='text'>JSPC Maven Plugin Package Name</title><content type='html'>Specifying package name when using the JSPC Maven plugin to pre-compile jsps&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&amp;lt;plugin&gt;&lt;br /&gt;    &amp;lt;groupId&gt;org.codehaus.mojo&amp;lt;/groupId&gt;&lt;br /&gt;    &amp;lt;artifactId&gt;jspc-maven-plugin&amp;lt;/artifactId&gt;&lt;br /&gt;    &amp;lt;configuration&gt;&lt;br /&gt;     &amp;lt;packageName&gt;com.company.package.name&amp;lt;/packageName&gt;&lt;br /&gt;    &amp;lt;/configuration&gt;&lt;br /&gt;    &amp;lt;executions&gt;&lt;br /&gt;     &amp;lt;execution&gt;&lt;br /&gt;      &amp;lt;id&gt;jspc&amp;lt;/id&gt;&lt;br /&gt;      &amp;lt;goals&gt;&lt;br /&gt;       &amp;lt;goal&gt;compile&amp;lt;/goal&gt;&lt;br /&gt;      &amp;lt;/goals&gt;&lt;br /&gt;     &amp;lt;/execution&gt;&lt;br /&gt;    &amp;lt;/executions&gt;&lt;br /&gt;   &amp;lt;/plugin&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7992279046156768630?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7992279046156768630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/10/jspc-maven-plugin-package-name.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7992279046156768630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7992279046156768630'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/10/jspc-maven-plugin-package-name.html' title='JSPC Maven Plugin Package Name'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-2702039248223173552</id><published>2011-10-04T07:24:00.007-07:00</published><updated>2011-10-04T07:50:49.814-07:00</updated><title type='text'>Amazon AWS Service Status</title><content type='html'>AWS currently does not provide an API to query service status. They only provide a health dashboard webpage. Although the page has RSS feed capability, I couldn't detect any specific pattern to watch for. This simple solution below works for now. We have created nagios monitoring out of these one liners&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;status0 = OK&lt;br /&gt;status2 = Performance Issues&lt;br /&gt;status3 = ERROR&lt;br /&gt;&lt;br /&gt;The service and region name below is literally as is from the web page. &lt;br /&gt;&lt;br /&gt;wget -qO- "http://status.aws.amazon.com/" | grep -B 1 "Amazon Elastic Compute Cloud (N. California)" | head -n 1 | &lt;br /&gt;perl -n -e 'm/images\/([\s\S]+?)\.gif/ &amp;&amp; {print "$1\n"}'&lt;br /&gt;&lt;br /&gt;status0&lt;br /&gt;&lt;br /&gt;wget -qO- "http://status.aws.amazon.com/" | grep -B 1 "Amazon Elastic Compute Cloud (N. Virginia)" | head -n 1 | &lt;br /&gt;perl -n -e 'm/images\/([\s\S]+?)\.gif/ &amp;&amp; {print "$1\n"}'&lt;br /&gt;&lt;br /&gt;status0&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2702039248223173552?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2702039248223173552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/10/amazon-aws-service-status.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2702039248223173552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2702039248223173552'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/10/amazon-aws-service-status.html' title='Amazon AWS Service Status'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-4565614097263156885</id><published>2011-08-13T10:24:00.002-07:00</published><updated>2011-08-13T10:27:55.805-07:00</updated><title type='text'>Rooted my Motorola Atrix</title><content type='html'>System version: 4.5.91&lt;br /&gt;Android Version: 2.3.4&lt;br /&gt;&lt;br /&gt;Instructions found below:&lt;br /&gt;&lt;br /&gt;http://www.digitaltweaker.com/android/phones/2011/07/root-motorola-atrix-4-5-91-on-gingerbread-2-3-4/&lt;br /&gt;&lt;br /&gt;If you get the "device not found" error when running "adb shell" then make sure you have sync drivers installed. When you connect Atrix to your computer the first time it installs a bunch of drivers and also gives an option to install "synch drivers". Make sure to install the "sync drivers".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4565614097263156885?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4565614097263156885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/08/rooted-my-motorola-atrix.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4565614097263156885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4565614097263156885'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/08/rooted-my-motorola-atrix.html' title='Rooted my Motorola Atrix'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-260292334763462848</id><published>2011-07-07T10:41:00.002-07:00</published><updated>2011-07-07T10:44:11.615-07:00</updated><title type='text'>Repository for JBoss RestEasy Releases</title><content type='html'>We have been using JBoss RestEasy for developing restful services. The framework is new and we have had to change the repo many times with various version releases and often times the repos fail with permission denied error or dependencies resolution error. A more stable repo for RestEasy is being maintained by the Atlassian folks. We use the below repo and its been working consistently and updates with new releases fairly quickly&lt;br /&gt;&lt;br /&gt;https://maven.atlassian.com/content/repositories/jboss-releases&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-260292334763462848?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/260292334763462848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/07/repository-for-jboss-resteasy-releases.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/260292334763462848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/260292334763462848'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/07/repository-for-jboss-resteasy-releases.html' title='Repository for JBoss RestEasy Releases'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-2211678192945376126</id><published>2011-06-01T12:25:00.005-07:00</published><updated>2011-06-01T12:41:26.116-07:00</updated><title type='text'>Check Logged Person In Campfire Room</title><content type='html'>We use campfire as a sole medium for team communication so its essential every team member is logged in so they are accessible. All team members use Mac and we use the Fluid app to run Campfire as a app. The app logs out automatically sometimes when in not use and we needed a way to get alerted when member was not logged into campfire. &lt;br /&gt;&lt;br /&gt;Campfire has a pretty nifty API that allows to query many room attributes. Below script can be used to detect if a person is not logged in. Each of our team member has the below script cronned in their machines to run every 10mins or so to get alerted when they have been logged out. below are the attributes you need to substitute&lt;br /&gt;&lt;br /&gt; {authcode here} - To get your auth code in Campfire go to "Edit my Campfire account" or "My Info" at the top screen in Campfire and there you will see your auth code. This is a secret code and should not be shared with others so be watchful and ensure the below script only has read/execute perms for the member user on the box. &lt;br /&gt;&lt;br /&gt;"#{id}" - To get the room ID simply login to Campfire and click on the room. The browser url should show the room ID. &lt;br /&gt;&lt;br /&gt;{member name} - Should be the same as the name specified when creating campfire account&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;curl -s -u {authcode here}:X "https://{your specific domain}.campfirenow.com/room/#{id}.xml" &gt; /tmp/campfire-room.xml&lt;br /&gt;present=`grep "&lt;name&gt;{member name}&lt;/name&gt;" /tmp/campfire-room.xml | wc -l`&lt;br /&gt;if [ $present -eq 0 ]&lt;br /&gt;  then&lt;br /&gt;   `/usr/local/bin/growlnotify --name "Not Logged In Campfire" -s --message "You are not logged into campfire. &lt;br /&gt;This might reflect in your performance review next year so you better login now :)"`&lt;br /&gt;fi&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2211678192945376126?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2211678192945376126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/06/check-logged-person-in-campfire-room.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2211678192945376126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2211678192945376126'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/06/check-logged-person-in-campfire-room.html' title='Check Logged Person In Campfire Room'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-2205353145651203261</id><published>2011-05-08T22:41:00.001-07:00</published><updated>2011-05-08T22:43:29.759-07:00</updated><title type='text'>Transitioning Traditional Data Support Folks To New Breed ETL Systems</title><content type='html'>Like many other folks out there who are discovering the power of data compute grids, we recently transitioned a part of our traditional database based ETL system to Hadoop based processing system. Being in the digital advertising field, we get a whole lot of impression data both from our tracking systems and external. Our existing ETL system is mainly comprised of four components: cleansing, standardization, dimensioning, aggregation. &lt;br /&gt;&lt;br /&gt;The cleansing and standardization components that involve a whole lot of text parsing and mapping take the major brunt as they deal with the raw volume of incoming data. As part of the transition we moved these two components to the new system. We have a dedicated product support team that handles most of the daily user data queries. Issues like missing/incorrect data, re-running jobs due to changed dimensions or external data outages, configuring and testing new data fields/sources, generating ad-hoc reports, configuring new clients etc. These folks have a thorough domain knowledge and are well versed with this data. They also fully understand the current ETL data flow and the various business rules thats gets applied as part of the data processing. Technology wise they are comfortable with databases, SQL, basic scripting, Excel and are usually enthusiastic about learning new technologies as need be.  &lt;br /&gt;&lt;br /&gt;To be able to perform the above mentioned issues, they essentially need a way to slice and dice raw/stage level data and with the data residing in HDFS this becomes an issue. We have been brainstorming ways on how to expose the new system to support folks and below are some options.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://hive.apache.org"&gt;&lt;span style="font-weight:bold;"&gt;Apache Hive&lt;/span&gt;&lt;/a&gt;: Facebook was the first company to encounter this problem wherein they transitioned their analysts folks from a RDBMS based warehouse to a more scalable hadoop system. They developed &lt;a href="http://hive.apache.org"&gt;Hive&lt;/a&gt; which is essentially a data warehouse system for Hadoop that facilitates easy data summarization, ad-hoc queries, and the analysis of large datasets stored in Hadoop compatible file systems. Hive provides a mechanism to project structure onto this data and query the data using a SQL-like language called HiveQL. HiveQL is very similar to SQL although it does not support the full SQL-92 specification. As per my reading it more closely resembles MySql's SQL dialect and that makes sense because Facebook is a mysql shop and a similarity would make the transition easy for its folks. This option stands top in our list of possibilities given its similarity to SQL. &lt;br /&gt;&lt;br /&gt;Apache Pig:  &lt;a href="http://pig.apache.org"&gt;Apache Pig&lt;/a&gt; is also a higher level abstraction for map/reduce. Pig uses Pig Latin language to express data flows. Although this is a powerful tool, it would require the support folks to learn a entirely new language.&lt;br /&gt;&lt;br /&gt;Commercial tools like &lt;a href="http://www.datameer.com"&gt;Datameer&lt;/a&gt;, &lt;a href="http://www-01.ibm.com/software/ebusiness/jstart/bigsheets/index.html"&gt;IBM Big Sheets&lt;/a&gt;: It is a well know fact that Microsoft Excel is most versatile analytic tool. Analysts love the ease of use and the tools it provides to slice and dice/graph datasets. Imagine an Excel like tool with the power of Hadoop. Its essentially what these commercial tools are. We recently received a great demo from the Datameer folks and were impressed by its ease of use and especially its pluggable architecture. Easy and familiar spreadsheet-like interface for business users with complete set of data integration, transformation/analytic and visualization tools. It also has a neat scheduler for cron based job scheduling. This option is also a strong contender in our option set given its ease of use and spreadsheet like usability and feel.&lt;br /&gt;&lt;br /&gt;We haven't decided on an option yet. The next couple of weeks will involve closely working with support folks to evaluate these options and ensuring a smooth transition.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2205353145651203261?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2205353145651203261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/05/transitioning-traditional-data-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2205353145651203261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2205353145651203261'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/05/transitioning-traditional-data-support.html' title='Transitioning Traditional Data Support Folks To New Breed ETL Systems'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-7281615586006374258</id><published>2011-03-18T17:13:00.003-07:00</published><updated>2011-06-01T12:42:48.173-07:00</updated><title type='text'>Maven3 error "Could not find artifact"</title><content type='html'>We recently switched our artifactory repo to a new server and things were fine with build running fine. One of the team dev deployed a new artifact version to the repo and that caused the build to fail. We kept getting the below error on our continuous integration server while the build was working fine on all dev boxes&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;"Failed to execute goal on project... Could not resolve dependencies for project....SNAPSHOT: The following artifacts could not be resolved: {new artifact}. Failure to find ... in  http://localhost/artifactory/repo was cached in the local repository,  resolution will not be reattempted until the update interval of  artifactory has elapsed or updates are forced"&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;We debugged this issue for a while and made sure the artifact was deployed correctly to the repo and all that but the main issue was that in the error message the artifact location was wrong. It was looking in the localhost. We checked the POM and ensured the repositories link specified were correct. After quite a bit of head banging we leaned towards a issue with local cache of repo and decided to purge the local repository. We deleted the .m2/repository/artifact directory and that resolved the above error but gave the below error&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;"Failed to execute goal on project... Could not resolve dependencies for project....SNAPSHOT: The following artifacts could not be resolved: {new artifact} Could not find artifact in artifactory (http://localhost/artifactory/repo) "&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;We were still looking to find as to why it was not pointing to the correct repo location. The fact that it was working fine on all all places made us believe that there was a specific issue with the continuous integration box so we decided to specify a override on the local repo location so it downloads fresh  a copy of all dependencies and thats when we saw a default mirror repo location specified in the local m2 settings.xml file. The file had the below properties set&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&amp;lt;mirrors&gt;&lt;br /&gt;    &amp;lt;mirror&gt;&lt;br /&gt;        &amp;lt;id&gt;artifactory&amp;lt;/id&gt;&lt;br /&gt;        &amp;lt;mirrorOf&gt;*&amp;lt;/mirrorOf&gt;&lt;br /&gt;        &amp;lt;name&gt;Artifactory&amp;lt;/name&gt;&lt;br /&gt;        &amp;lt;url&gt;http://localhost/artifactory/repo&amp;lt;/url&gt;&lt;br /&gt;    &amp;lt;/mirror&gt;&lt;br /&gt;&amp;lt;/mirrors&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;That was causing the issue. We modified this to point to the new repo location and boom the error was gone&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7281615586006374258?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7281615586006374258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/03/maven3-error-could-not-find-artifact.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7281615586006374258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7281615586006374258'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/03/maven3-error-could-not-find-artifact.html' title='Maven3 error &quot;Could not find artifact&quot;'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-8196431972850211849</id><published>2011-03-10T23:46:00.002-07:00</published><updated>2011-03-10T23:52:24.246-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gconsync disable'/><category scheme='http://www.blogger.com/atom/ns#' term='gconsync popup'/><title type='text'>Mac OSX Disable gconsync</title><content type='html'>I recently enabled synching with google contacts in ITunes while synching my IPhone. Ever since then I have been getting this nagging pop up where a program called "gconsync" keeps asking me password to access keychain. On my iphone I have now setup google account as exchange account and that automatically synchs my contacts with google so I no longer need to enable the google account synching with itunes but even after disabling that I still kept getting the gconsync popup for keychain access. Here's the way to disable this&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Open the Address book app on Mac: /Applications/Address Book.app&lt;/div&gt;&lt;div&gt;Go to Preferences -&gt; Account -&gt; uncheck the "synchronize with Google" option&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That should get rid of the popup. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8196431972850211849?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8196431972850211849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/03/mac-osx-disable-gconsync.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8196431972850211849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8196431972850211849'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/03/mac-osx-disable-gconsync.html' title='Mac OSX Disable gconsync'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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-33560925.post-4442549658907176118</id><published>2011-03-04T20:38:00.002-07:00</published><updated>2011-03-04T20:49:57.122-07:00</updated><title type='text'>JIRA Current Iteration Filter</title><content type='html'>The current version of JIRA we use does not provide a option to query by current iteration. Although the JQL querying option allows to do fairly fine grain searching it fails to provide a current iteration option. One way they could add is by looking at the Iteration start and end date and compare that to current date. I set up various filters for current iteration that search for issue without story points, subtasks with missing hours etc. It was a pain to modify the filters every new iteration to specify the iteration number. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We installed a free JQL query extension that allows a versionList function&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Calibri, Verdana, Helvetica, Arial; font-size: 15px; color: rgb(0, 0, 255); "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Calibri, Verdana, Helvetica, Arial; font-size: 15px; color: rgb(0, 0, 255); "&gt;&lt;u&gt;&lt;a href="https://studio.plugins.atlassian.com/wiki/display/IJQL/VersionList+Function"&gt;https://studio.plugins.atlassian.com/wiki/display/IJQL/VersionList+Function&lt;/a&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Calibri, Verdana, Helvetica, Arial; font-size: 15px; color: rgb(0, 0, 255); "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;Once installed you can query the current iteration using the below JQL&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"    style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;color:#0000FF;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"    style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;color:#0000FF;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt; &lt;!--StartFragment--&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;project = COLL and fixVersion in unreleasedVersions() and fixVersion in VersionList("Iteration ??")&lt;/span&gt;&lt;/span&gt; &lt;!--EndFragment--&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"    style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;color:#0000FF;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;To make the above work, I had to rename all future iterations to some thing line 'Pre Iteration....". That wasn't a big deal as we only wanted to make sure all historic and current iteration are named correctly. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;To query all issues that don't have a story point one can use the below query and subscribe to daily email to get alerts&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt; &lt;!--StartFragment--&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;&lt;span class="Apple-style-span"  style="color:#3366FF;"&gt;project = COLL and fixVersion in unreleasedVersions() and fixVersion in VersionList("Iteration ??") and type not in (Bug,Sub-task, "Support Ticket") and storyPoint = empty and (resolution in (Fixed,Completed) or status = Open)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;!--EndFragment--&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; "&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span style="font-size:11pt"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4442549658907176118?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4442549658907176118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2011/03/jira-current-iteration-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4442549658907176118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4442549658907176118'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2011/03/jira-current-iteration-filter.html' title='JIRA Current Iteration Filter'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-8150713063366363147</id><published>2010-11-17T21:03:00.003-07:00</published><updated>2010-11-17T23:16:19.751-07:00</updated><title type='text'>Upgrading Cloudera Hadoop VM From Intrepid (8.10) to Jaunty (9.04) and Configuring Shard Folders with Host OS</title><content type='html'>Notes gathered from trying to upgrade Ubuntu version on Cloudera Hadoop VM. The VM comes with version Ubuntu 8.10 Intrepid. Most of the source repo for this Ubuntu version is not supported and any apt-get install errors out with below error&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;Err http://us.archive.ubuntu.com intrepid-updates/main Packages&lt;br /&gt;  404 Not Found [IP: 91.189.88.46 80]&lt;br /&gt;Err http://us.archive.ubuntu.com intrepid-updates/multiverse Packages&lt;br /&gt;  404 Not Found [IP: 91.189.88.46 80]&lt;br /&gt;Err http://security.ubuntu.com intrepid-security/multiverse Packages&lt;br /&gt;  404 Not Found [IP: 91.189.88.37 80]&lt;br /&gt;Err http://security.ubuntu.com intrepid-security/main Sources&lt;br /&gt;  404 Not Found [IP: 91.189.88.37 80]&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This also causes an issue when installing the VMware tools as the tools install needs certain build packages installed however the apt-get won't work. Here's the step by step instruction from upgrading OS to installing VMWare tools to configuring shared folders from Host OS to cloudera vm&lt;br /&gt;&lt;br /&gt;The upgrade from 8.10 to 9.04 is seamless and did not break anything on my end. I didn't change the VM  a lot so if things would have broken I would have either fixed or downloaded the VM fresh form the Cloudera site :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-------------- Upgrade O/S --------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;- launch terminal&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;- sudo do-release-upgrade&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This will take close to 15-20mins with decent internet connection. Need to baby sit to confirm various choices. Once complete it will ask for a reboot. After reboot bring up terminal and do&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;- cat /etc/lsb-release&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;above should show 9.04 version now.&lt;br /&gt;&lt;br /&gt;----------- Install VMWare Tools  -----------------&lt;br /&gt;&lt;br /&gt;Before doing that we need to install certain libraries. Run these commands&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;- sudo apt-get update&lt;br /&gt;&lt;br /&gt;- sudo apt-get install gcc&lt;br /&gt;&lt;br /&gt;- sudo apt-get install linux-headers-{sub from uname command}-server (run uname -a to get the server details and replace server number there)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;- Follow instruction in below on how to install VMWare tools in Ubuntu&lt;br /&gt;&lt;br /&gt;http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1014522&lt;br /&gt;&lt;br /&gt;------------ Configuring Shared Folders ------------&lt;br /&gt;&lt;br /&gt;Here's a video instuction on how to configure the shared folder for VMware Fusion 3&lt;br /&gt;&lt;br /&gt;http://www.youtube.com/watch?v=fxNqdE7IanQ&lt;br /&gt;&lt;br /&gt;For VMWare Fusion versions 2 or Older its a little complex&lt;br /&gt;&lt;br /&gt;http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1013633&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8150713063366363147?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8150713063366363147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/11/upgrading-cloudera-hadoop-vm-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8150713063366363147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8150713063366363147'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/11/upgrading-cloudera-hadoop-vm-from.html' title='Upgrading Cloudera Hadoop VM From Intrepid (8.10) to Jaunty (9.04) and Configuring Shard Folders with Host OS'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-3960467861235488672</id><published>2010-10-07T21:56:00.002-07:00</published><updated>2010-10-07T22:00:06.120-07:00</updated><title type='text'>Download link for last free version for iStat Menu</title><content type='html'>&lt;a href="http://bjango.com/apps/istatmenus/"&gt;iStat Menus&lt;/a&gt; used to be a free download. Its now a paid app. See below link to download the last free version.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dl2.macupdate.com/istat2.zip"&gt;Download&lt;/a&gt; iStat Menus 2.0 (Last free version; Mac OS X 10.5/10.6 compatible)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3960467861235488672?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3960467861235488672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/10/download-link-for-last-free-version-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3960467861235488672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3960467861235488672'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/10/download-link-for-last-free-version-for.html' title='Download link for last free version for iStat Menu'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-7405671269395018075</id><published>2010-08-24T22:55:00.002-07:00</published><updated>2010-08-24T23:19:48.519-07:00</updated><title type='text'>Namenode editlog (dfs.name.dir) multiple storage directories</title><content type='html'>Recently there was a question posted on the Apache Hadoop User mailing list regarding the behavior of specifying multiple storage directories fir property "dfs.name.dir". The documentation on the official site is not clear on what happens if one of the specified storage directories become inaccessible. While the documentation for other properties such as "dfs.data.dir" and "mapred.local.dir" clearly states that the system will ignore any directory that is inaccessible in case some of the specified directories are unavailable. See link below for reference&lt;br /&gt;&lt;br /&gt;http://hadoop.apache.org/common/docs/current/hdfs-default.html&lt;br /&gt;&lt;br /&gt;There were many comments on the post. See below the link for the complete post&lt;br /&gt;&lt;br /&gt;http://lucene.472066.n3.nabble.com/what-will-happen-if-a-backup-name-node-folder-becomes-unaccessible-td1253293.html#a1253293&lt;br /&gt;&lt;br /&gt;In this post I am basically going to summarize my tests to prove that it works in the cloudera distribution. So the behavior is that it ignores any directories that are inaccessible and the namenode only bails out when it can't access any of the specified directories. The below series of tests are pretty much self explanatory&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop version&lt;br /&gt;Hadoop 0.20.1+152&lt;br /&gt;Subversion  -r c15291d10caa19c2355f437936c7678d537adf94&lt;br /&gt;Compiled by root on Mon Nov  2 05:15:37 UTC 2009&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ jps&lt;br /&gt;8923 Jps&lt;br /&gt;8548 JobTracker&lt;br /&gt;8467 SecondaryNameNode&lt;br /&gt;8250 NameNode&lt;br /&gt;8357 DataNode&lt;br /&gt;8642 TaskTracker&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ /usr/lib/hadoop/bin/stop-all.sh&lt;br /&gt;stopping jobtracker&lt;br /&gt;localhost: stopping tasktracker&lt;br /&gt;stopping namenode&lt;br /&gt;localhost: stopping datanode&lt;br /&gt;localhost: stopping secondarynamenode&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ mkdir edit_log_dir1&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ mkdir edit_log_dir2&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ ls&lt;br /&gt;edit_log_dir1  edit_log_dir2&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ ls -ltr /var/lib/hadoop-0.20/cache/hadoop/dfs/name&lt;br /&gt;total 8&lt;br /&gt;drwxr-xr-x 2 hadoop hadoop 4096 2009-10-15 16:17 image&lt;br /&gt;drwxr-xr-x 2 hadoop hadoop 4096 2010-08-24 15:56 current&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ cp -r /var/lib/hadoop-0.20/cache/hadoop/dfs/name edit_log_dir1&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ cp -r /var/lib/hadoop-0.20/cache/hadoop/dfs/name edit_log_dir2&lt;br /&gt;&lt;br /&gt;------ hdfs-site.xml added new dirs&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version="1.0"?&gt;&lt;br /&gt;&amp;lt;?xml-stylesheet type="text/xsl" href="configuration.xsl"?&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;configuration&gt;&lt;br /&gt;  &amp;lt;property&gt;&lt;br /&gt;    &amp;lt;name&gt;dfs.replication&amp;lt;/name&gt;&lt;br /&gt;    &amp;lt;value&gt;1&amp;lt;/value&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;  &amp;lt;property&gt;&lt;br /&gt;     &amp;lt;name&gt;dfs.permissions&amp;lt;/name&gt;&lt;br /&gt;     &amp;lt;value&gt;false&amp;lt;/value&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;  &amp;lt;property&gt;&lt;br /&gt;     &amp;lt;!-- specify this so that running 'hadoop namenode -format' formats the right dir --&gt;&lt;br /&gt;     &amp;lt;name&gt;dfs.name.dir&amp;lt;/name&gt;    &lt;br /&gt;    &amp;lt;value&gt;/var/lib/hadoop-  0.20/cache/hadoop/dfs/name,/home/hadoop/edit_log_dir1,&lt;br /&gt;/home/hadoop/edit_log_dir2&amp;lt;/value&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;   &amp;lt;property&gt;&lt;br /&gt;     &amp;lt;name&gt;fs.checkpoint.period&amp;lt;/name&gt;&lt;br /&gt;     &amp;lt;value&gt;600&amp;lt;/value&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;  &amp;lt;property&gt;&lt;br /&gt;    &amp;lt;name&gt;dfs.namenode.plugins&amp;lt;/name&gt;&lt;br /&gt;    &amp;lt;value&gt;org.apache.hadoop.thriftfs.NamenodePlugin&amp;lt;/value&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;  &amp;lt;property&gt;&lt;br /&gt;    &amp;lt;name&gt;dfs.datanode.plugins&amp;lt;/name&gt;&lt;br /&gt;    &amp;lt;value&gt;org.apache.hadoop.thriftfs.DatanodePlugin&amp;lt;/value&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;  &amp;lt;property&gt;&lt;br /&gt;    &amp;lt;name&gt;dfs.thrift.address&amp;lt;/name&gt;&lt;br /&gt;    &amp;lt;value&gt;0.0.0.0:9090&amp;lt;/value&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;&amp;lt;/configuration&gt;&lt;br /&gt;&lt;br /&gt;---- start all daemons&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ /usr/lib/hadoop/bin/start-all.sh&lt;br /&gt;starting namenode, logging to &lt;br /&gt;/usr/lib/hadoop/bin/../logs/hadoop-hadoop-namenode-training-vm.out&lt;br /&gt;localhost: starting datanode, logging to &lt;br /&gt;/usr/lib/hadoop/bin/../logs/hadoop-hadoop-datanode-training-vm.out&lt;br /&gt;localhost: starting secondarynamenode, logging to &lt;br /&gt;/usr/lib/hadoop/bin/../logs/hadoop-hadoop-secondarynamenode-training-vm.out&lt;br /&gt;starting jobtracker, logging to &lt;br /&gt;/usr/lib/hadoop/bin/../logs/hadoop-hadoop-jobtracker-training-vm.out&lt;br /&gt;localhost: starting tasktracker, logging to &lt;br /&gt;/usr/lib/hadoop/bin/../logs/hadoop-hadoop-tasktracker-training-vm.out&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-------- namenode log confirms all dirs taken&lt;br /&gt;&lt;br /&gt;2010-08-24 16:20:48,718 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: STARTUP_MSG: &lt;br /&gt;/************************************************************&lt;br /&gt;STARTUP_MSG: Starting NameNode&lt;br /&gt;STARTUP_MSG:   host = training-vm/127.0.0.1&lt;br /&gt;STARTUP_MSG:   args = []&lt;br /&gt;STARTUP_MSG:   version = 0.20.1+152&lt;br /&gt;STARTUP_MSG:   build =  -r c15291d10caa19c2355f437936c7678d537adf94; &lt;br /&gt;compiled by 'root' on Mon Nov  2 05:15:37 UTC 2009&lt;br /&gt;************************************************************/&lt;br /&gt;2010-08-24 16:20:48,815 INFO org.apache.hadoop.ipc.metrics.RpcMetrics: &lt;br /&gt;Initializing RPC Metrics with hostName=NameNode, port=8022&lt;br /&gt;2010-08-24 16:20:48,819 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: &lt;br /&gt;Namenode up at: localhost/127.0.0.1:8022&lt;br /&gt;2010-08-24 16:20:48,821 INFO org.apache.hadoop.metrics.jvm.JvmMetrics:&lt;br /&gt; Initializing JVM Metrics with processName=NameNode, sessionId=null&lt;br /&gt;2010-08-24 16:20:48,822 INFO &lt;br /&gt;org.apache.hadoop.hdfs.server.namenode.metrics.NameNodeMetrics: &lt;br /&gt;Initializing NameNodeMeterics using context object:org.apache.hadoop.metrics.spi.NoEmitMetricsContext&lt;br /&gt;2010-08-24 16:20:48,894 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: &lt;br /&gt;fsOwner=hadoop,hadoop&lt;br /&gt;2010-08-24 16:20:48,894 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: &lt;br /&gt;supergroup=supergroup&lt;br /&gt;2010-08-24 16:20:48,894 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem:&lt;br /&gt; isPermissionEnabled=false&lt;br /&gt;2010-08-24 16:20:48,903 INFO org.apache.hadoop.hdfs.server.namenode.metrics.FSNamesystemMetrics: &lt;br /&gt;Initializing&lt;br /&gt; FSNamesystemMetrics using context object:org.apache.hadoop.metrics.spi.NoEmitMetricsContext&lt;br /&gt;2010-08-24 16:20:48,905 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Registered &lt;br /&gt;FSNamesystemStatusMBean&lt;br /&gt;2010-08-24 16:20:48,937 INFO org.apache.hadoop.hdfs.server.common.Storage: Storage directory&lt;br /&gt; /home/hadoop/edit_log_dir1 is not formatted.&lt;br /&gt;2010-08-24 16:20:48,937 INFO org.apache.hadoop.hdfs.server.common.Storage: Formatting ...&lt;br /&gt;2010-08-24 16:20:48,937 INFO org.apache.hadoop.hdfs.server.common.Storage: Storage directory&lt;br /&gt; /home/hadoop/edit_log_dir2 is not formatted.&lt;br /&gt;2010-08-24 16:20:48,937 INFO org.apache.hadoop.hdfs.server.common.Storage: Formatting ...&lt;br /&gt;2010-08-24 16:20:48,938 INFO org.apache.hadoop.hdfs.server.common.Storage: Number of files = 41&lt;br /&gt;2010-08-24 16:20:48,947 INFO org.apache.hadoop.hdfs.server.common.Storage: &lt;br /&gt;Number of files under construction = 0&lt;br /&gt;2010-08-24 16:20:48,947 INFO org.apache.hadoop.hdfs.server.common.Storage: &lt;br /&gt;Image file of size 4357 loaded in 0 seconds.&lt;br /&gt;&lt;br /&gt;---- directories confirm in use&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ ls -ltr edit_log_dir1&lt;br /&gt;total 12&lt;br /&gt;drwxr-xr-x 4 hadoop hadoop 4096 2010-08-24 16:01 name&lt;br /&gt;-rw-r--r-- 1 hadoop hadoop    0 2010-08-24 16:20 in_use.lock&lt;br /&gt;drwxr-xr-x 2 hadoop hadoop 4096 2010-08-24 16:20 image&lt;br /&gt;drwxr-xr-x 2 hadoop hadoop 4096 2010-08-24 16:20 current&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ ls -ltr edit_log_dir2&lt;br /&gt;total 12&lt;br /&gt;drwxr-xr-x 4 hadoop hadoop 4096 2010-08-24 16:01 name&lt;br /&gt;-rw-r--r-- 1 hadoop hadoop    0 2010-08-24 16:20 in_use.lock&lt;br /&gt;drwxr-xr-x 2 hadoop hadoop 4096 2010-08-24 16:20 image&lt;br /&gt;drwxr-xr-x 2 hadoop hadoop 4096 2010-08-24 16:20 current&lt;br /&gt;&lt;br /&gt;----- secondary name node checkpoint worked fine&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;2010-08-24 16:27:10,756 INFO org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Posted URL &lt;br /&gt;localhost:50070putimage=1&amp;port=50090&amp;machine=127.0.0.1&amp;token=-&lt;br /&gt;18:1431678956:1255648991179:1282692430000:1282692049090&lt;br /&gt;2010-08-24 16:27:11,008 WARN org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode:&lt;br /&gt;&lt;br /&gt;Checkpoint done. New Image Size: 4461&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;--- dirctory put works fine&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop fs -ls /user/training&lt;br /&gt;Found 3 items&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:18 /user/training/grep_output&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:14 /user/training/input&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 15:30 /user/training/output&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop fs -put /etc/hadoop/conf.with-desktop/hdfs-site.xml /user/training&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop fs -ls /user/training&lt;br /&gt;Found 4 items&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:18 /user/training/grep_output&lt;br /&gt;-rw-r--r--   1 hadoop   supergroup        987 2010-08-24 16:25 /user/training/hdfs-site.xml&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:14 /user/training/input&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 15:30 /user/training/output&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;------ delete one of the directories&lt;br /&gt;hadoop@training-vm:~$ rm -rf edit_log_dir2&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ ls -ltr&lt;br /&gt;total 4&lt;br /&gt;drwxr-xr-x 5 hadoop hadoop 4096 2010-08-24 16:20 edit_log_dir1&lt;br /&gt;&lt;br /&gt;-- namenode logs&lt;br /&gt;&lt;br /&gt;No errors/warns in logs&lt;br /&gt;&lt;br /&gt;-------- namenode still running&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ jps&lt;br /&gt;12426 NameNode&lt;br /&gt;12647 SecondaryNameNode&lt;br /&gt;12730 JobTracker&lt;br /&gt;14090 Jps&lt;br /&gt;12535 DataNode&lt;br /&gt;12826 TaskTracker&lt;br /&gt;&lt;br /&gt;----  puts and ls work fine&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop fs -ls /user/training&lt;br /&gt;Found 4 items&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:18 /user/training/grep_output&lt;br /&gt;-rw-r--r--   1 hadoop   supergroup        987 2010-08-24 16:25 /user/training/hdfs-site.xml&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:14 /user/training/input&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 15:30 /user/training/output&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop fs -put /etc/hadoop/conf.with-desktop/core-site.xml /user/training&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop fs -put /etc/hadoop/conf.with-desktop/mapred-site.xml /user/training&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ hadoop fs -ls /user/training&lt;br /&gt;Found 6 items&lt;br /&gt;-rw-r--r--   1 hadoop   supergroup        338 2010-08-24 16:28 /user/training/core-site.xml&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:18 /user/training/grep_output&lt;br /&gt;-rw-r--r--   1 hadoop   supergroup        987 2010-08-24 16:25 /user/training/hdfs-site.xml&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 13:14 /user/training/input&lt;br /&gt;-rw-r--r--   1 hadoop   supergroup        454 2010-08-24 16:29 /user/training/mapred-site.xml&lt;br /&gt;drwxr-xr-x   - training supergroup          0 2010-06-30 15:30 /user/training/output&lt;br /&gt;&lt;br /&gt;------- secondary namenode checkpoint is successdul&lt;br /&gt;&lt;br /&gt;2010-08-24 16:37:11,455 WARN org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: &lt;br /&gt;Checkpoint done. New Image Size: 4671&lt;br /&gt;....&lt;br /&gt;2010-08-24 16:47:11,884 WARN org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode:&lt;br /&gt; Checkpoint done. New  Image Size: 4671&lt;br /&gt;...&lt;br /&gt;2010-08-24 16:57:12,264 WARN org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: &lt;br /&gt;Checkpoint done. New Image Size: 4671&lt;br /&gt;&lt;br /&gt;------- after 30 mins&lt;br /&gt;&lt;br /&gt;hadoop@training-vm:~$ jps&lt;br /&gt;12426 NameNode&lt;br /&gt;12647 SecondaryNameNode&lt;br /&gt;12730 JobTracker&lt;br /&gt;16256 Jps&lt;br /&gt;12535 DataNode&lt;br /&gt;12826 TaskTracker&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7405671269395018075?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7405671269395018075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/08/namenode-editlog-dfsnamedir-multiple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7405671269395018075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7405671269395018075'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/08/namenode-editlog-dfsnamedir-multiple.html' title='Namenode editlog (dfs.name.dir) multiple storage directories'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-8333986569129349477</id><published>2010-08-21T19:34:00.002-07:00</published><updated>2010-08-21T20:06:02.862-07:00</updated><title type='text'>Automated backups to Amazon S3</title><content type='html'>Just got around setting an automated backup to Amazon S3. Until now my backup was limited to Personal Computer -&gt; Home Server -&gt; External USB Drive all under one roof. Over the years I have gathered a lot of document clutter and have been lately scanning them and destroying the originals and that means that if the digital copy is gone then I am kaput. Having a copy on the S3 is good both backup wise and access from anywhere wise. Although I have setup my home server to be accessible from outside its still slow when downloading large files.  As of now i have limited S3 to important stuff (just documents), I would eventually like to offload all my digital content o S3 (songs, pictures, videos etc) which would mean shelling more moola to Amazon. I wouldn't be accessing these content frequently so the cost is pretty much the storage cost and off-course the weekly rsync seeks. I also choose the 99.99% (0.10c/gb monthly) reliability over the 99.9999999% (0.15c/gb monthly) reliability as I am conformable with that given that I have a copy on my end too. S3 also has a special offer till Nov 1 wherein they are waving all "Data transfer In" fees. Below are some links that I used to setup :&lt;br /&gt;&lt;br /&gt;AWS S3 pricing :  http://aws.amazon.com/s3/pricing/&lt;br /&gt;S3Sync and S3cmd tool : http://www.s3sync.net/wiki&lt;br /&gt;&lt;br /&gt;Installing S3sync script: http://www.linode.com/wiki/index.php/Backups_with_s3sync&lt;br /&gt;&lt;br /&gt;Setting up automated backup using S3sync on S3&lt;br /&gt;http://blog.eberly.org/2006/10/09/how-automate-your-backup-to-amazon-s3-using-s3sync/&lt;br /&gt;&lt;br /&gt;General article on home server vs S3 backup : http://jeremy.zawodny.com/blog/archives/007624.html&lt;br /&gt;S3 based backup tools: http://jeremy.zawodny.com/blog/archives/007641.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8333986569129349477?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8333986569129349477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/08/automated-backups-to-amazon-s3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8333986569129349477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8333986569129349477'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/08/automated-backups-to-amazon-s3.html' title='Automated backups to Amazon S3'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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><entry><id>tag:blogger.com,1999:blog-33560925.post-7435312407783992631</id><published>2010-08-03T17:05:00.003-07:00</published><updated>2010-08-03T17:24:40.658-07:00</updated><title type='text'>Hadoop LZO Installation : Errors and Resolution</title><content type='html'>A record of our errors and resolution with Hadoop LZO  Installation. We previously followed the code base and instructions on &lt;br /&gt;&lt;br /&gt;http://code.google.com/p/hadoop-gpl-compression/wiki/FAQ&lt;br /&gt;&lt;br /&gt;but later switched to&lt;br /&gt;&lt;br /&gt;http://github.com/kevinweil/hadoop-lzo&lt;br /&gt;&lt;br /&gt;as there were some improvements and bug fixes. &lt;br /&gt;&lt;br /&gt;Error: &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;java.lang.RuntimeException: native-lzo library not available&lt;br /&gt; at com.hadoop.compression.lzo.LzopCodec.createDecompressor(LzopCodec.java:91)&lt;br /&gt; at com.hadoop.mapreduce.LzoSplitRecordReader.initialize(LzoSplitRecordReader.java:52)&lt;br /&gt; at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.initialize(MapTask.java:418)&lt;br /&gt; at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:582)&lt;br /&gt; at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305)&lt;br /&gt; at org.apache.hadoop.mapred.Child.main(Child.java:170)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Resolution: Need to ensure that the lzo lib is in the classpath&lt;br /&gt;&lt;br /&gt;$~: ps auxw | grep tasktracker&lt;br /&gt;&lt;br /&gt;should show the lzo lib in the classpath list. If not then follow the "Building and configuring" instructions on Kevin's site (link above)&lt;br /&gt;&lt;br /&gt;Error:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;java.lang.ClassCastException: com.hadoop.compression.lzo.LzopCodec$LzopDecompressor&lt;br /&gt; cannot be cast to com.hadoop.compression.lzo.LzopDecompressor&lt;br /&gt; at com.hadoop.mapreduce.LzoSplitRecordReader.initialize(LzoSplitRecordReader.java:52)&lt;br /&gt; at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.initialize(MapTask.java:418)&lt;br /&gt; at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:582)&lt;br /&gt; at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305)&lt;br /&gt; at org.apache.hadoop.mapred.Child.main(Child.java:170)&lt;br /&gt; &lt;br /&gt;java.lang.IllegalAccessError com.hadoop.compression.lzo.LzopDecompressor cannot access&lt;br /&gt; superclass com.hadoop.compression.lzo.LzoDecompressor&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Resolution:&lt;br /&gt;&lt;br /&gt;The above two errors were mainly because of a mixup in the two code base installation. We resolved this by starting from scratch and deleting all old lzo libs and that resolved the error&lt;br /&gt;&lt;br /&gt;Testing to see lzo native libs works:&lt;br /&gt;&lt;br /&gt;- Create a sample lzo file&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;$~: echo "hello world" &gt; test.log&lt;br /&gt;$~: lzop test.log&lt;br /&gt;&lt;br /&gt;The above should create a test.log.lzo file&lt;br /&gt;&lt;br /&gt;$~: hadoop fs -copyFromLocal test.log.lzo /tmp&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Local installation test:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;$~: hadoop jar /usr/lib/hadoop-0.20/lib/hadoop-lzo-0.4.4.jar com.hadoop.compression.lzo.LzoIndexer /tmp/test.log.lzo&lt;br /&gt;10/08/03 16:40:01 INFO lzo.GPLNativeCodeLoader: Loaded native gpl library&lt;br /&gt;10/08/03 16:40:01 INFO lzo.LzoCodec: Successfully loaded &amp; initialized native-lzo library &lt;br /&gt;10/08/03 16:40:03 INFO lzo.LzoIndexer: [INDEX] LZO Indexing file /tmp/test.log.lzo, size 0.00 GB...&lt;br /&gt;10/08/03 16:40:03 INFO lzo.LzoIndexer: Completed LZO Indexing in 1.40 seconds (0.00 MB/s).  Index size is 0.01 KB.&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Distributed Test: &lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;$~: hadoop jar /usr/lib/hadoop-0.20/lib/hadoop-lzo-0.4.4.jar com.hadoop.compression.lzo.DistributedLzoIndexer /tmp/test.log.lzo&lt;br /&gt;10/08/03 16:42:53 INFO lzo.GPLNativeCodeLoader: Loaded native gpl library&lt;br /&gt;10/08/03 16:42:53 INFO lzo.LzoCodec: Successfully loaded &amp; initialized native-lzo library &lt;br /&gt;10/08/03 16:42:53 INFO lzo.DistributedLzoIndexer: Adding LZO file /tmp/test.log.lzo to indexing list (no index currently exists)&lt;br /&gt;10/08/03 16:42:53 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.&lt;br /&gt;10/08/03 16:44:24 INFO input.FileInputFormat: Total input paths to process : 1&lt;br /&gt;10/08/03 16:44:24 INFO mapred.JobClient: Running job: job_201007251750_0072&lt;br /&gt;10/08/03 16:44:25 INFO mapred.JobClient:  map 0% reduce 0%&lt;br /&gt;10/08/03 16:44:38 INFO mapred.JobClient:  map 100% reduce 0%&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient: Job complete: job_201007251750_0072&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient: Counters: 6&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:   Job Counters &lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:     Launched map tasks=1&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:     Data-local map tasks=1&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:   FileSystemCounters&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:     HDFS_BYTES_READ=60&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:     HDFS_BYTES_WRITTEN=8&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:   Map-Reduce Framework&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:     Map input records=1&lt;br /&gt;10/08/03 16:44:40 INFO mapred.JobClient:     Spilled Records=0&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7435312407783992631?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7435312407783992631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/08/hadoop-lzo-installation-errors-and.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7435312407783992631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7435312407783992631'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/08/hadoop-lzo-installation-errors-and.html' title='Hadoop LZO Installation : Errors and Resolution'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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-33560925.post-5286003460819890866</id><published>2010-07-21T17:24:00.007-07:00</published><updated>2010-07-22T13:23:36.958-07:00</updated><title type='text'>Installing Hadoop Native Libraries : JAVA_HOME not set correctly error</title><content type='html'>Followed the instructions here to install the hadoop native libraries for the Cloudera distribution. I got the JAVA_HOME not set error when running the ant compile-native target. Here's the step by step procedure to install the native libraries and resolve the error.&lt;br /&gt;&lt;br /&gt;Follow the instructions here first to ensure you have the native libraries installed in your OS&lt;br /&gt;&lt;br /&gt;http://hadoop.apache.org/common/docs/r0.20.2/native_libraries.html&lt;br /&gt;&lt;br /&gt;To configure the hadoop native libraries follow the steps below. Since all our cluster nodes were of the same configuration (architecture and OS wise), I built the native libraries on one and copied onto the other nodes. If you nodes are different then you will have to repeat the below steps on each hadoop node.&lt;br /&gt;&lt;br /&gt;Step 1: Install and configure Apache Ant on the hadoop cluster node&lt;br /&gt;&lt;br /&gt;Step 2: Download the source of you corresponding hadoop version.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;- find your hadoop version&lt;br /&gt;&lt;br /&gt;$ hadoop version&lt;br /&gt;Hadoop 0.20.1+169.88&lt;br /&gt;Subversion  -r ded54b29979a93e0f3ed773175cafd16b72511ba&lt;br /&gt;Compiled by root on Thu May 20 22:22:39 EDT 2010&lt;br /&gt;&lt;br /&gt;- download the corresponding SRPM for the above version. &lt;br /&gt;We use Cloudera distribution so I got mine from below link &lt;br /&gt;&lt;br /&gt;http://archive.cloudera.com/redhat/cdh/testing/SRPMS/&lt;br /&gt;&lt;br /&gt;- Install the SRPM to get source. This basically dumped the source in my &lt;br /&gt;/usr/src/redhat/SOURCES/hadoop-0.20.1+169.88 &lt;br /&gt;folder. If it dumped as a tar.gz file then go ahead and untar it.&lt;br /&gt;&lt;br /&gt;$rpm -i hadoop-0.20-0.20.1+169.88-1.src.rpm&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Step 3: Link the 'src' folder in source to the hadoop installation folder&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;cd /usr/lib/hadoop-0.20 -- this is basically the HADOOP_HOME&lt;br /&gt;sudo ln -s /usr/src/redhat/SOURCES/hadoop-0.20.1+169.88/hadoop-0.20.1+169.88/src src&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Step 4: Run the ant task&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;ant -Dcompile.native=true compile-native&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;If the above task fails with the 'jni.h' not found error then configure the JAVA_HOME PATH&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;[exec] checking jni.h usability... /usr/lib/hadoop-0.20/src/native/configure: line&lt;br /&gt; 19091: test: !=: unary operator expected&lt;br /&gt;[exec] no&lt;br /&gt;[exec] checking jni.h presence... no&lt;br /&gt;[exec] checking for jni.h... no&lt;br /&gt;[exec] configure: error: Native java headers not found. Is $JAVA_HOME set correctly?&lt;br /&gt;&lt;br /&gt;BUILD FAILED&lt;br /&gt;/usr/lib/hadoop-0.20/build.xml:466: &lt;br /&gt;The following error occurred while executing this line:&lt;br /&gt;/usr/lib/hadoop-0.20/build.xml:487: exec returned: 1&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To resolve the error open the build.xml file and the add env JAVA_HOME in compile-core-native target. After adding the change should look like below&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&amp;lt;exec dir="${build.native}" executable="sh" failonerror="true"&gt;&lt;br /&gt;     &amp;lt;env key="OS_NAME" value="${os.name}"/&gt;&lt;br /&gt;     &amp;lt;env key="JAVA_HOME" value="/usr/java"/&gt;&lt;br /&gt;     &amp;lt;env key="OS_ARCH" value="${os.arch}"/&gt;&lt;br /&gt;     &amp;lt;env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/&gt;&lt;br /&gt;     &amp;lt;env key="HADOOP_NATIVE_SRCDIR" value="${native.src.dir}"/&gt;&lt;br /&gt;     &amp;lt;arg line="${native.src.dir}/configure"/&gt;&lt;br /&gt;&amp;lt;/exec&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The above will resolve the issue.&lt;br /&gt;&lt;br /&gt;A successful installation should show something like this&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;$ ls -ltr /usr/lib/hadoop-0.20/build/native/Linux-amd64-64/lib&lt;br /&gt;total 212&lt;br /&gt;-rw-r--r-- 1 root root  12953 Jul 21 16:43 Makefile&lt;br /&gt;-rwxr-xr-x 1 root root  73327 Jul 21 16:43 libhadoop.so.1.0.0&lt;br /&gt;-rw-r--r-- 1 root root    850 Jul 21 16:43 libhadoop.la&lt;br /&gt;-rw-r--r-- 1 root root 114008 Jul 21 16:43 libhadoop.a&lt;br /&gt;lrwxrwxrwx 1 root root     18 Jul 21 17:04 libhadoop.so.1 -&gt; libhadoop.so.1.0.0&lt;br /&gt;lrwxrwxrwx 1 root root     18 Jul 21 17:04 libhadoop.so -&gt; libhadoop.so.1.0.0&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Run a test job to make sure native libs are being picked properly. Use the test jar based on your version of hadoop. In the below test ensure that the native libs are getting picked. Check for statement "Successfully loaded &amp; initialized native-zlib library". &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;$ hadoop jar /usr/lib/hadoop-0.20/hadoop-0.20.1+169.88-test.jar testsequencefile -seed&lt;br /&gt; 0 -count 1000 -compressType RECORD xxx -codec org.apache.hadoop.io.compress.GzipCodec -check&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: count = 1000&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: megabytes = 1&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: factor = 10&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: create = true&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: seed = 0&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: rwonly = false&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: check = true&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: fast = false&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: merge = false&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: compressType = RECORD&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: compressionCodec = org.apache.hadoop.io.compress.GzipCodec&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: file = xxx&lt;br /&gt; 10/07/22 11:46:27 INFO io.TestSequenceFile: creating 1000 records with RECORD compression&lt;br /&gt; 10/07/22 11:46:27 INFO util.NativeCodeLoader: Loaded the native-hadoop library&lt;br /&gt; 10/07/22 11:46:27 INFO zlib.ZlibFactory: Successfully loaded &amp; initialized native-zlib library&lt;br /&gt; 10/07/22 11:46:27 INFO compress.CodecPool: Got brand-new compressor&lt;br /&gt; 10/07/22 11:46:27 INFO compress.CodecPool: Got brand-new decompressor&lt;br /&gt; 10/07/22 11:46:28 INFO compress.CodecPool: Got brand-new decompressor&lt;br /&gt; 10/07/22 11:46:28 INFO io.TestSequenceFile: done sorting 1000 debug&lt;br /&gt; 10/07/22 11:46:28 INFO io.TestSequenceFile: sorting 1000 records in memory for debug&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Looking online some other folks have had issues with above test. They had to manually add the native libs to JAVA_LIBRARY_PATH. This issue was fixed in https://issues.apache.org/jira/browse/HADOOP-4839. If you are having that issue then here is a link on how to manually add it to path&lt;br /&gt;&lt;br /&gt;http://www.mail-archive.com/common-user@hadoop.apache.org/msg04761.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5286003460819890866?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5286003460819890866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/installing-hadoop-native-libraries.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5286003460819890866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5286003460819890866'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/installing-hadoop-native-libraries.html' title='Installing Hadoop Native Libraries : JAVA_HOME not set correctly error'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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-33560925.post-4961165887398929190</id><published>2010-07-16T17:00:00.005-07:00</published><updated>2010-07-16T17:22:11.445-07:00</updated><title type='text'>Ning : Use your own domain from HostMonster</title><content type='html'>Here are the instructions on how to set the DNS records to point your domain from HostMonster to Ning. Currently my Ning site is set at "example.ning.com" and I wanted to point it to "example.com". So I purchased the "example.com" on HostMonster. Under cPanel in HostMonster there is a link for "Advanced DNS Editor".  Here are the instructions on how to locate the DNS editor&lt;br /&gt;&lt;br /&gt;http://helpdesk.hostmonster.com/index.php/kb/article/000559&lt;br /&gt;&lt;br /&gt;click on the DNS editor link and choose the "example.com" from the "Select a Domain" dropdown list.&lt;br /&gt;&lt;br /&gt;Take a screenshot of the current settings (in case you screw up you can always restore it to what it was earlier using the screenshot)&lt;br /&gt;&lt;br /&gt;Step 1: Delete any current "A" type record with name "example.com."&lt;br /&gt;&lt;br /&gt;Step 2: Set up a new "A" type record like the below screen shot&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_ch4Sx6yl5DA/TED27qW5cRI/AAAAAAAAAAU/gcr9xhZJ0yk/s1600/example_cname.jpg"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 245px; height: 133px;" src="http://2.bp.blogspot.com/_ch4Sx6yl5DA/TED27qW5cRI/AAAAAAAAAAU/gcr9xhZJ0yk/s320/example_cname.jpg" alt="" id="BLOGGER_PHOTO_ID_5494663050235048210" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 3: Set up a new "CNAME" type record like the below screen shot&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_ch4Sx6yl5DA/TED1soC0P6I/AAAAAAAAAAM/Olo9GyvueQk/s1600/example_arecord.jpg"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 246px; height: 124px;" src="http://1.bp.blogspot.com/_ch4Sx6yl5DA/TED1soC0P6I/AAAAAAAAAAM/Olo9GyvueQk/s320/example_arecord.jpg" alt="" id="BLOGGER_PHOTO_ID_5494661692404285346" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now access the "www.example.com" site or "example.com" site and it should point to your ning page. Depending on the set TTL, it might take a while for the new mapping to refresh. You can try to flush your DNS cache using the steps from this site&lt;br /&gt;&lt;br /&gt;http://www.tech-faq.com/how-to-flush-dns.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4961165887398929190?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4961165887398929190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/ning-use-your-own-domain-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4961165887398929190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4961165887398929190'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/ning-use-your-own-domain-from.html' title='Ning : Use your own domain from HostMonster'/><author><name>sudhirv</name><uri>http://www.blogger.com/profile/06769970926667437319</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/_ch4Sx6yl5DA/TED27qW5cRI/AAAAAAAAAAU/gcr9xhZJ0yk/s72-c/example_cname.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-5994678983312130033</id><published>2010-07-15T16:57:00.002-07:00</published><updated>2010-07-15T17:31:50.940-07:00</updated><title type='text'>Hadoop HDFS Error: java.io.IOException: Could not complete write to file</title><content type='html'>We recently have been seeing this error in our hadoop name node logs quite a bit.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;2010-06-14 05:15:30,428 WARN org.apache.hadoop.hdfs.StateChange: DIR*&lt;br /&gt; NameSystem.completeFile: failed to complete {filename} because dir.getFileBlocks() is null and pendingFile is null&lt;br /&gt;java.io.IOException: Could not complete write to file {filename} by DFSClient_-44010819&lt;br /&gt;java.io.IOException: Could not complete write to file {filename} by DFSClient_-44010819&lt;br /&gt; at org.apache.hadoop.hdfs.server.namenode.NameNode.complete(NameNode.java:497)&lt;br /&gt; at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)&lt;br /&gt; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;br /&gt; at java.lang.reflect.Method.invoke(Method.java:597)&lt;br /&gt; at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:512)&lt;br /&gt; at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:966)&lt;br /&gt; at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:962)&lt;br /&gt; at java.security.AccessController.doPrivileged(Native Method)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt;Further researching, we found that a new map/reduce job was deployed recently that merges daily files. The errors pretty much started showing up after this job was deployed and is cron to run every day. This job takes a bunch of small files as input and merges them to create a merged compressed file. In the process of creating the merging compressed file, it creates a temp file with merged content, verifies the file and then compresses it to a final file after which it deletes the temp file. Errors were being thrown when the temp file was getting deleted. Certain times delete was happening (meta data on namenode) before the file was replicated to all nodes and that was throwing this error. Currently the HDFS API does not provide a way to synchronouos method to wait till file is replicated.&lt;br /&gt;&lt;br /&gt;To resolve this, we started using the HDFS trash functionality. HDFS best practices suggests "Enable HDFS trash, and avoid programmatic deletes - prefer the trash facility."If trash is enabled (and, it should be noted, by default it is not), files that are deleted using the Hadoop filesystem shell are moved into a special hidden trash directory, rather than being deleted immediately. The trash directory is deleted periodically by the system. Any files that are mistakenly deleted can be recovered manually by moving them out of the trash directory. The trash deletion period is configurable. The trash facility is a user level feature, it is not used when programmatically deleting files. As a best practice it is recommended considering moving data to be deleted to the trash directory (to be deleted by the system after the given time), rather than doing an immediate delete.&lt;br /&gt;&lt;br /&gt;We changed the code to move to trash instead of deleting the code and that resolved the errors in the logs. Below is a common utility method we use across our code base when moving files.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;import org.apache.hadoop.conf.Configuration;&lt;br /&gt;import org.apache.hadoop.fs.Path;&lt;br /&gt;import org.apache.hadoop.fs.Trash;&lt;br /&gt;&lt;br /&gt;public static void moveToTrash(Configuration conf,Path path) throws IOException&lt;br /&gt;{&lt;br /&gt;     Trash t=new Trash(conf);&lt;br /&gt;     boolean isMoved=t.moveToTrash(path);&lt;br /&gt;     if(!isMoved)&lt;br /&gt;     {&lt;br /&gt; logger.error("Trash is not enabled or file is already in the trash.");&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5994678983312130033?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5994678983312130033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/hadoop-hdfs-error-javaioioexception.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5994678983312130033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5994678983312130033'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/hadoop-hdfs-error-javaioioexception.html' title='Hadoop HDFS Error: java.io.IOException: Could not complete write to file'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-6503664669396563783</id><published>2010-07-06T10:22:00.003-07:00</published><updated>2010-07-06T10:25:26.202-07:00</updated><title type='text'>Hadoop error logs: org.apache.hadoop.hdfs.server.datanode.BlockAlreadyExistsException</title><content type='html'>&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;2010-06-06 23:28:04,195 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode:&lt;br /&gt; DatanodeRegistration(10.13.53.128:50010, storageID=DS-1219700830-127.0.0.1-50010-1266876153854, &lt;br /&gt;infoPort=50075, ipcPort=50020):DataXceiver&lt;br /&gt;org.apache.hadoop.hdfs.server.datanode.BlockAlreadyExistsException: Block&lt;br /&gt; blk_-7647836931304231161_18783 is valid, and cannot be written to.&lt;br /&gt;    at org.apache.hadoop.hdfs.server.datanode.FSDataset.writeToBlock(FSDataset.java:1069)&lt;br /&gt;    at org.apache.hadoop.hdfs.server.datanode.BlockReceiver.&lt;init&gt;(BlockReceiver.java:98)&lt;br /&gt;    at org.apache.hadoop.hdfs.server.datanode.DataXceiver.writeBlock(DataXceiver.java:259)&lt;br /&gt;    at org.apache.hadoop.hdfs.server.datanode.DataXceiver.run(DataXceiver.java:103)&lt;br /&gt;    at java.lang.Thread.run(Thread.java:619)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Most of the research online pointed to an issue with the open file limit on the cluster instances. Did some analysis and found below&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;-- current open files [sudhirv@hadoop-cluster-2 ~]$ sudo /usr/sbin/lsof | wc -l&lt;br /&gt;1662&lt;br /&gt; &lt;br /&gt;-- allowed open file limit cutoff&lt;br /&gt;[hadoop@hadoop-cluster-2 ~]$ ulimit -n&lt;br /&gt;1024&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;As per the Pro Hadoop book Pg 112 "Hadoop Core uses large numbers of file descriptors for MapReduce, and the DFSClient uses a large number of file descriptors for communicating with the HDFS NameNode and DataNode server processes. Looking at the below commands I see the current open file descriptors greater than set file limit. Most sites immediately bump up the number of file descriptors to 64,000, and large sites, or sites that have MapReduce jobs that open many files, might go higher."&lt;br /&gt;&lt;br /&gt;See reference links below to find more suggestions&lt;br /&gt;&lt;br /&gt;Decided to set the limit to 8192 and monitor the logs. Modified the open file limit on all hadoop cluster boxes to 8192. Monitored the logs for a few days and we don't see the error anymore.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;[root@hadoop-cluster-1 ~]# ulimit -Hn&lt;br /&gt;8192&lt;br /&gt;[root@hadoop-cluster-1 ~]# ulimit -Sn&lt;br /&gt;8192&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;br /&gt;http://webcache.googleusercontent.com/search?q=cache:sFLquGtEMNEJ:osg-test2.unl.edu/documentation/hadoop/hadoop-installation+hadoop+file+limits&amp;hl=en&amp;client=firefox-a&amp;gl=us&amp;strip=1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-6503664669396563783?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/6503664669396563783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/hadoop-error-logs-orgapachehadoophdfsse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6503664669396563783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6503664669396563783'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/07/hadoop-error-logs-orgapachehadoophdfsse.html' title='Hadoop error logs: org.apache.hadoop.hdfs.server.datanode.BlockAlreadyExistsException'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-5890895416148528957</id><published>2010-06-04T14:04:00.007-07:00</published><updated>2010-06-04T14:54:30.977-07:00</updated><title type='text'>simple script to monitor hadoop daemon logs for errors and warning</title><content type='html'>&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;check_daemons=$1&lt;br /&gt;log_dir=/var/log/hadoop&lt;br /&gt;warn_file=/tmp/warnings.txt&lt;br /&gt;emails="{email to send errors}"&lt;br /&gt;&lt;br /&gt;rm -f /tmp/warnings.txt&lt;br /&gt;&lt;br /&gt;for log_file in namenode jobtracker secondarynamenode datanode tasktracker&lt;br /&gt;  do&lt;br /&gt;     echo "$check_daemons" | grep -qw "$log_file"&lt;br /&gt;     if [[ $? -eq 0 ]] ; then            &lt;br /&gt;            echo -e "\n --------------------- $log_file errors and warning ------------------ \n" &gt;&gt; $warn_file&lt;br /&gt;            cat $log_dir/hadoop-hadoop-$log_file-`hostname`.log.`date -d "1 day ago" +%Y-%m-%d` &lt;br /&gt;| egrep -v 'Checkpoint done' | egrep -A 10 'WARN|ERROR' &gt;&gt; $warn_file&lt;br /&gt;     fi&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;error_line_count=`cat /tmp/warnings.txt | egrep -v "datanode errors and warning" |&lt;br /&gt; egrep -v "tasktracker errors and warning" | egrep -v "jobtracker errors and warning"&lt;br /&gt; | egrep -v "namenode errors and warning" | egrep -v "secondarynamenode errors and warning" | egrep -v "^$" | wc -l`&lt;br /&gt;&lt;br /&gt;if [ $error_line_count != 0 ] ; then&lt;br /&gt;   mail -s "`hostname` node errors and warnings" $emails &lt; $warn_file&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The script can be cronned and it checks the logs from yesterday. You can easily modify the script for standalone runs for any specific dates&lt;br /&gt;&lt;br /&gt;Usage:&lt;br /&gt;&lt;br /&gt;For a node running namenode, jobtracker run script as&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;sh get_errors.sh namenode,jobtracker&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For a node running datanode, tasktracker run script as&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;sh get_errors.sh datanode,tasktracker&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5890895416148528957?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5890895416148528957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/06/simple-script-to-monitor-hadoop-daemon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5890895416148528957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5890895416148528957'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/06/simple-script-to-monitor-hadoop-daemon.html' title='simple script to monitor hadoop daemon logs for errors and warning'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2284684129697480841</id><published>2010-05-27T16:20:00.004-07:00</published><updated>2010-05-27T16:30:25.444-07:00</updated><title type='text'>Updating Cloudera Hadoop To Latest Patch  On CentOS</title><content type='html'>Warning: Below steps should only be used when updating Hadoop within the same major version. For instance updates like 0.20.1+169.56 to 0.20.1+169.88. When upgrading (example going from 0.20 to 0.21) these steps should not be used.&lt;br /&gt;&lt;br /&gt;We have a small cluster in place so the below steps works for us. Bigger cluster nodes will need a more automated way.&lt;br /&gt;&lt;br /&gt;Here are the step by step instructions. Ensure no map/reduce jobs/HDFS data write jobs are running.&lt;br /&gt;&lt;br /&gt;Step 1: Create a screen session on all hadoop nodes&lt;br /&gt;&lt;br /&gt;Step 2: Prepare for any disaster that might happen&lt;br /&gt;&lt;br /&gt;On the master node where NameNode is current running, take a latest checkpoint in case things go wrong. This will serve as last image to recover from if things go wrong. To take a manual checkpoint, you need to enter safemode. See below for series of commands to do that.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;- check current mode&lt;br /&gt;[sudhirv@hadoop-cluster-3 bin]$ hadoop dfsadmin -safemode get&lt;br /&gt;Safe mode is OFF&lt;br /&gt; &lt;br /&gt;- enter safe mode&lt;br /&gt;[sudhirv@hadoop-cluster-3 bin]$ hadoop dfsadmin -safemode enter&lt;br /&gt;Safe mode is ON&lt;br /&gt; &lt;br /&gt;- check safe mode is ON&lt;br /&gt;[sudhirv@hadoop-cluster-3 bin]$ hadoop dfsadmin -safemode get&lt;br /&gt;Safe mode is ON&lt;br /&gt; &lt;br /&gt;- run manual checkpoint&lt;br /&gt;[sudhirv@hadoop-cluster-1 ~]$ hadoop dfsadmin -saveNamespace&lt;br /&gt; &lt;br /&gt;-- ensure a checkpoint was taken by looking at image timestamp&lt;br /&gt;[sudhirv@hadoop-cluster-1 ~]$ ls -ltr /var/lib/hadoop-0.20/cache/hadoop/dfs/name/image&lt;br /&gt;total 4&lt;br /&gt;-rw-rw-r-- 1 hadoop hadoop 157 May 26 16:49 fsimage&lt;br /&gt; &lt;br /&gt;- leave safe mode&lt;br /&gt;[sudhirv@hadoop-cluster-1 ~]$ hadoop dfsadmin -safemode leave&lt;br /&gt;Safe mode is OFF&lt;br /&gt; &lt;br /&gt;- confirm safe mode is off&lt;br /&gt;[sudhirv@hadoop-cluster-1 ~]$ hadoop dfsadmin -safemode get&lt;br /&gt;Safe mode is OFF&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Step 3: Log the current hadoop version and configurations versions. The hadoop version will change after update. The configurations version should still stay the same.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;sudo su -&lt;br /&gt; &lt;br /&gt;[root@hadoop-cluster-3 ~]$ hadoop version&lt;br /&gt;Hadoop 0.20.1+169.56&lt;br /&gt;Subversion  -r 8e662cb065be1c4bc61c55e6bff161e09c1d36f3&lt;br /&gt;Compiled by root on Tue Feb  9 13:40:08 EST 2010&lt;br /&gt; &lt;br /&gt;[root@hadoop-cluster-3 ~]# alternatives --display hadoop-0.20-conf&lt;br /&gt;hadoop-0.20-conf - status is auto.&lt;br /&gt; link currently points to /etc/hadoop-0.20/conf.cluster&lt;br /&gt;/etc/hadoop-0.20/conf.empty - priority 10&lt;br /&gt;/etc/hadoop-0.20/conf.pseudo - priority 30&lt;br /&gt;/etc/hadoop-0.20/conf.cluster - priority 50&lt;br /&gt;Current `best' version is /etc/hadoop-0.20/conf.cluster.&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Step 4: Shutdown hadoop services on the node. Check to ensure services are turned off. It is recommended to start with nodes that host the Name Node and Job Tracker first as mismatch in versions between NN,JT and DN,TT won't work in most cases.&lt;br /&gt;&lt;br /&gt;Step 5: Check to ensure the new hadoop update patch shows up in the yum update list. If not then you would need to configure the repo correctly&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;yum list updates&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Step 5: Run the update&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;sudo su -&lt;br /&gt;[root@hadoop-cluster-3 ~]# yum update hadoop-0.20&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Step 6: Check updated version to ensure update was performed and that config alternatives were not changed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;[root@hadoop-cluster-3 ~]# hadoop version&lt;br /&gt;Hadoop 0.20.1+169.88&lt;br /&gt;Subversion  -r ded54b29979a93e0f3ed773175cafd16b72511ba&lt;br /&gt;Compiled by root on Thu May 20 22:22:39 EDT 2010&lt;br /&gt; &lt;br /&gt;[root@hadoop-cluster-3 ~]# alternatives --display hadoop-0.20-conf&lt;br /&gt;hadoop-0.20-conf - status is auto.&lt;br /&gt; link currently points to /etc/hadoop-0.20/conf.cluster&lt;br /&gt;/etc/hadoop-0.20/conf.empty - priority 10&lt;br /&gt;/etc/hadoop-0.20/conf.pseudo - priority 30&lt;br /&gt;/etc/hadoop-0.20/conf.cluster - priority 50&lt;br /&gt;Current `best' version is /etc/hadoop-0.20/conf.cluster.&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Step 7: Start the hadoop services on the node and tail logs to ensure no errors are being reported.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2284684129697480841?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2284684129697480841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/05/updating-cloudera-hadoop-to-latest.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2284684129697480841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2284684129697480841'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/05/updating-cloudera-hadoop-to-latest.html' title='Updating Cloudera Hadoop To Latest Patch  On CentOS'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2278290326089701709</id><published>2010-05-19T18:04:00.005-07:00</published><updated>2010-05-19T18:10:51.141-07:00</updated><title type='text'>HDFS Relative path error when running map/reduce jobs</title><content type='html'>Recently while running a map reduce we encountered this error&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;java.io.IOException: Can not get the relative path: &lt;br /&gt;base = hdfs://hadoop-master:8020/5/_temporary/_attempt_201005150057_0006_r_000000_0&lt;br /&gt; child = hdfs://hadoop-master/5/_temporary/_attempt_201005150057_0006_r_000000_0/part-r-00000&lt;br /&gt;at org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter.getFinalPath(FileOutputCommitter.java:200)&lt;br /&gt;at org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter.moveTaskOutputs(FileOutputCommitter.java:146)&lt;br /&gt;at org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter.moveTaskOutputs(FileOutputCommitter.java:165)&lt;br /&gt;at org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter.commitTask(FileOutputCommitter.java:118)&lt;br /&gt;at org.apache.hadoop.mapred.Task.commit(Task.java:779)&lt;br /&gt;at org.apache.hadoop.mapred.Task.done(Task.java:691)&lt;br /&gt;at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:414)&lt;br /&gt;at org.apache.hadoop.mapred.Child.main(Child.java:170)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The job tracker and task tracker logs continuously kept failing across many retry attempts and continuously were dumping this error in the logs. Here's the &lt;a href="https://trac.declarativity.net/browser/hadoop-0.19.1-bfs/src/mapred/org/apache/hadoop/mapred/FileOutputCommitter.java"&gt;code&lt;/a&gt; part that throws the error.&lt;br /&gt;&lt;br /&gt;Researched this for quite a while and finally found this excerpt from the Pro Hadoop book "An example of an HDFS URI is hdfs://NamenodeHost[:8020]/. The file system protocol is hdfs, the host to contact for services is NamenodeHost, and the port to connect to is 8020, which is the default port for HDFS. If the default 8020 port is used, the URI may be simplified as hdfs://NamenodeHost/. This value may be altered by individual jobs. You can choose an arbitrary port for the hdfs NameNode."&lt;br /&gt;&lt;br /&gt;Currently our "fs.default.name" parameter in core-site.xml file is set to "hdfs://hadoop-master.ic:8020". Based on the above text I went ahead and removed the default port from the parameter and restarted the name node. Ran your job again and voila!!! works now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2278290326089701709?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2278290326089701709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/05/hdfs-relative-path-error-when-running.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2278290326089701709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2278290326089701709'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/05/hdfs-relative-path-error-when-running.html' title='HDFS Relative path error when running map/reduce jobs'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-4686133178104134076</id><published>2010-05-02T21:42:00.002-07:00</published><updated>2010-05-02T21:55:49.065-07:00</updated><title type='text'>Fluid app when signin opens default browser</title><content type='html'>I am big fan of Fluid and use it for creating apps for most of my email/social sites. I have also one created for Campfire which I use to communicate with my team. Recently my Campfire app stopped working (not sure if this happened after I upgraded to newer Fluid version or whether the Campfire dev started using a single signon servide ) in the sense then when I click on 'Signin' it was opening my default browser and forwarding me to "https://launchpad.37signals.com/signin". On further googling found that this was happening because the campfire fluid app did not have permission to allow other site domains meaning the signin process was forwarding to a different domain than the campfire specific domain. For instance my campfire domain is "https://icrossing.campfirenow.com" and signin would redirect to "https://launchpad.37signals.com/signin" for authentication. To make it work all it needed was to set the app permission to allow browsing to other domains and that made it work.&lt;br /&gt;&lt;br /&gt;Go to fluid app -&gt; preferences -&gt; Advanced and enable the below option&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Wx-8OjwLTqs/S95XLiXLpMI/AAAAAAAAAdo/JgYwoa-Qx0w/s1600/fluid_app_pref.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 229px;" src="http://2.bp.blogspot.com/_Wx-8OjwLTqs/S95XLiXLpMI/AAAAAAAAAdo/JgYwoa-Qx0w/s320/fluid_app_pref.jpg" alt="" id="BLOGGER_PHOTO_ID_5466902853388575938" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4686133178104134076?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4686133178104134076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/05/fluid-app-when-signin-opens-default.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4686133178104134076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4686133178104134076'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/05/fluid-app-when-signin-opens-default.html' title='Fluid app when signin opens default browser'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Wx-8OjwLTqs/S95XLiXLpMI/AAAAAAAAAdo/JgYwoa-Qx0w/s72-c/fluid_app_pref.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-3009172373681631042</id><published>2010-04-11T04:54:00.004-07:00</published><updated>2010-04-11T05:40:00.620-07:00</updated><title type='text'>Reliance Connect with Huawei EC325 Modem on Mac OSX</title><content type='html'>On a recent trip to India I purchased the Reliance Connect data plan and was given a Huawei EC325 USB modem with a Windows only install CD. Took me a few hours to figure out the setup with Mac OSX on a MacBook Pro and hence the blog.&lt;br /&gt;&lt;br /&gt;Download the Mac OSX drivers from &lt;a href="http://www.hutch.co.th/download/dl_device_en.htm"&gt;&lt;span style="font-weight: bold;"&gt;here&lt;/span&gt;&lt;/a&gt;. Under category "USB Modem Huawei USB" download the "Huawei EC325 Driver for McIntosh (both Power PC and Intel X86 Processor". Unzip the downloaded file and install the corresponding pkg file.&lt;br /&gt;&lt;br /&gt;After the install (You may need to restart your Mac) go to "System Preferences" -&gt; Network and you should now see the "Huawei Mobile" on the left pane. See below screenshot for configuring the setting (note: These settings are only valid for Reliance NetConnect).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Wx-8OjwLTqs/S8HBmM64AsI/AAAAAAAAAdg/31x71WPxnoM/s1600/huawei_mobile_setting.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 256px;" src="http://4.bp.blogspot.com/_Wx-8OjwLTqs/S8HBmM64AsI/AAAAAAAAAdg/31x71WPxnoM/s320/huawei_mobile_setting.jpg" alt="" id="BLOGGER_PHOTO_ID_5458857085397107394" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Download Thai version of configuring the modem from &lt;a style="font-weight: bold;" href="http://www.hutch.co.th/datadownload/downloads/device/huawei_usb/Connect_internet_Huawei_EC321_EC325forMac_OSX.pdf"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3009172373681631042?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3009172373681631042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/04/reliance-connect-with-huawei-ec325.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3009172373681631042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3009172373681631042'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/04/reliance-connect-with-huawei-ec325.html' title='Reliance Connect with Huawei EC325 Modem on Mac OSX'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Wx-8OjwLTqs/S8HBmM64AsI/AAAAAAAAAdg/31x71WPxnoM/s72-c/huawei_mobile_setting.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2905744479978409032</id><published>2010-02-19T12:10:00.002-07:00</published><updated>2010-02-19T12:22:32.245-07:00</updated><title type='text'>How to filter queries from Mysql Replication</title><content type='html'>So this morning we faced a slave issue (duplicate entry) due to bin log corruption (slave machine unexpectedly died and on reboot had a corrupt table that was causing the duplicate entry error on replicated insert statements). After trying everything to resolve the issue, we ended up with deciding to scrap the slave table and copy the table new from Master. In order to do that we still needed to solve this slave issue and get the slave going and some later time do the master to slave copy. We decided to empty the current slave table and let the slave run however the issue was that this Master - Slave setup is actually a Master &lt;-&gt; Master setup and delete statement wud be replicated to master and we didn't want that. Ideally we wanted the delete statement in this case to not replicate. We achieved this by setting the 'sql_log_bin' session variable to 0 before running the delete statement. Since this is a session based variable it only affects the current session (we tested to make sure. see below). So the steps were&lt;br /&gt;&lt;br /&gt;- open a new mysql session with a user that has SUPER privileges&lt;br /&gt;- confirm sql_log_bin is set to 1 using comment "select @@sql_log_bin;"&lt;br /&gt;- set the sql_log_bin  to 0 using command "set sql_log_bin=0;"&lt;br /&gt;- confirm variable is correctly set using command "select @@sql_log_bin;"&lt;br /&gt;- run the statements that you don't want replicated&lt;br /&gt;- Quit the mysql client session&lt;br /&gt;&lt;br /&gt;Testing to ensure its really session based :)&lt;br /&gt;&lt;br /&gt;  ############## Session 1 #############################&lt;br /&gt;&lt;br /&gt;mysql&gt; select @@sql_log_bin;&lt;br /&gt;+---------------+&lt;br /&gt;| @@sql_log_bin |&lt;br /&gt;+---------------+&lt;br /&gt;|             1 |&lt;br /&gt;+---------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&gt; set sql_log_bin=0;&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&gt; select @@sql_log_bin;&lt;br /&gt;+---------------+&lt;br /&gt;| @@sql_log_bin |&lt;br /&gt;+---------------+&lt;br /&gt;|             0 |&lt;br /&gt;+---------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;  ############## Session 2 #############################&lt;br /&gt;&lt;br /&gt;mysql&gt; select @@sql_log_bin;&lt;br /&gt;+---------------+&lt;br /&gt;| @@sql_log_bin |&lt;br /&gt;+---------------+&lt;br /&gt;|             1 |&lt;br /&gt;+---------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2905744479978409032?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2905744479978409032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/02/how-to-filter-queries-from-mysql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2905744479978409032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2905744479978409032'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/02/how-to-filter-queries-from-mysql.html' title='How to filter queries from Mysql Replication'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-8326167004653121402</id><published>2010-02-09T13:56:00.002-07:00</published><updated>2010-02-09T14:00:28.517-07:00</updated><title type='text'>Setting up passwordless access on CentOs 5</title><content type='html'>This has been detailed in various places however the part about setting the right permissions on the .ssh entries made it work for. Here's a step by step procedure&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;- Generate the keys&lt;br /&gt;ssh-keygen -t rsa -P ""&lt;br /&gt;&lt;br /&gt;- copy the key to authorized keys&lt;br /&gt;cat $HOME/.ssh/id_rsa.pub &gt;&gt; $HOME/.ssh/authorized_keys&lt;br /&gt;&lt;br /&gt;- ensure only the user has read/write/execute permission on the .ssh dir&lt;br /&gt;chmod 700 $HOME/.ssh&lt;br /&gt;&lt;br /&gt;- ensure only the user has read/write permission on authorized keys file&lt;br /&gt;chmod 600 $HOME/.ssh/authorized_keys&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8326167004653121402?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8326167004653121402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/02/setting-up-passwordless-access-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8326167004653121402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8326167004653121402'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/02/setting-up-passwordless-access-on.html' title='Setting up passwordless access on CentOs 5'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-6835696865554301251</id><published>2010-01-14T09:52:00.003-07:00</published><updated>2010-01-14T09:58:09.784-07:00</updated><title type='text'>Thoughtworks webinars on Distributed Agile Teams</title><content type='html'>Attended a pretty educational 2 part series from Thoughtworks on distributed agile teams focussing on communication and facilitating agile meetings. Must watch. designed to address the concerns and risks that come with communicating effectively on a distributed project. The goal of this series is to provide immediate support and detailed suggestions to project teams struggling to work in a distributed environment.&lt;br /&gt;&lt;br /&gt;Can you hear me now?  Good . . .&lt;br /&gt;&lt;br /&gt;Part 1: &lt;a href="http://securerespond.com/thoughtworks/offshorewebinar/"&gt;Remove Barriers to Communication&lt;/a&gt; : Mark Rickmeier reviews and rates the best-of-breed tools that address the key communication challenges faced with distributed development. We will evaluate a variety of tools and what they can do for your project, including:  Instant messenger/chat tools, desktop sharing, VOIP, Web conferencing, Wiki/collaboration, issue/task tracking, and application lifecycle management.&lt;br /&gt;&lt;br /&gt;Part 2: &lt;a href="http://securerespond.com/thoughtworks/canyou/"&gt;Facilitating Distributed Agile Meetings&lt;/a&gt; : This series builds on the tool recommendations from Part 1 to focus on process and innovations used by effective project teams to facilitate four typical Agile meetings between remote locations: Distributed release planning sessions, distributed iteration planning meetings, distributed stand ups, and distributed retrospectives.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-6835696865554301251?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/6835696865554301251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2010/01/thoughtworks-webinars-on-distributed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6835696865554301251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6835696865554301251'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2010/01/thoughtworks-webinars-on-distributed.html' title='Thoughtworks webinars on Distributed Agile Teams'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-7148312371205954798</id><published>2009-12-29T15:35:00.005-07:00</published><updated>2009-12-29T16:07:49.567-07:00</updated><title type='text'>Reverting a deleted file in Subversion</title><content type='html'>Last week I accidently a file from the SVN repo and had to revert the delete. Here's a procedure to &lt;br /&gt;&lt;br /&gt;1. Do a svn log on the directory where the file used to exist. That will show the deleted file commit action&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 650px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;bash&gt; svn log --verbose&lt;br /&gt;&lt;br /&gt;deleting MSN creative change&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;r1438 | sudhirv | 2009-12-28 15:13:46 -0800 (Mon, 28 Dec 2009) | 1 line&lt;br /&gt;Changed paths:&lt;br /&gt;   D /trunk/lib/ETL/Transform/MSNCreativeTransformByAdId.pm&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;2. So the above file needs to be reverted. Get the previous version of the file to working copy.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 800px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;bash&gt; svn copy --revision 1437 \&lt;br /&gt;http://somecompany.com/svn/trunk/lib/ETL/Transform/MSNCreativeTransformByAdId.pm MSNCreativeTransformByAdId.pm&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;3. Doing a SVN status will now show that there is a file waiting to be added to the rep with previous history. Quoted from the book "The plus sign in the status output indicates that the item isn't merely scheduled for addition, but scheduled for addition “with history”. Subversion remembers where it was copied from. In the future, running svn log on this file will traverse back through the file's resurrection and through all the history it had prior to revision 1438. In other words, this new MSNCreativeTransformByAdId.pm isn't really new; it's a direct descendant of the original, deleted file."&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 650px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;bash&gt; $ svn status&lt;br /&gt;A  +   MSNCreativeTransformByAdId.pm&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;4. Use the svn commit to commit the file.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 650px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;bash&gt; svn commit -m "reverting delete to revision 1437" MSNCreativeTransformByAdId.pm&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7148312371205954798?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7148312371205954798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/12/reverting-deleted-file-in-subversion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7148312371205954798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7148312371205954798'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/12/reverting-deleted-file-in-subversion.html' title='Reverting a deleted file in Subversion'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2751883252721204697</id><published>2009-12-16T23:26:00.001-07:00</published><updated>2009-12-16T23:27:43.509-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='how lvm snapshots work'/><title type='text'>Mysql backups using LVM snapshots</title><content type='html'>Logical Volume Manager (LVM) provides the ability to take a snapshot of any logical volume for the purpose of obtaining a backup of a partition in a consistent state. As applications may access files or databases on a partition during a backup some files may be backed up in one state, while later files are backed up after an update has been made, leading to an inconsistent backup. Traditionally the solution has been to mount the partition read-only, apply table-level write locks to databases or shut down the database engine etc.; all measures which adversely impact availability (but not as much as data loss without a backup will). With LVM snapshots it is possible to obtain a consistent backup without compromising availability. The LVM snapshot works by logging the changes to the filesystem to the snapshot partition, rather than mirroring the partition. Thus when you create a snapshot partition you do not need to use space equal to the size of the partition that you are taking a snapshot of, but rather the amount of changes that it will undergo during the lifetime of the snapshot. This is a function of both how much data is being written to the partition and also how long you intend keeping the LVM snapshot. The longer you leave it, the more changes there are likely to be on the file system and the more the snapshot partition will fill up with change information. The higher the rate of change on the partition the shorter the lifespan of the snapshot. If the amount of changes on the LVM partition exceed the size of the snapshot then the snapshot is released. Step by step procedure to backup using snapshot&lt;br /&gt;&lt;br /&gt;   1. Connect to MySQL and run FLUSH TABLES WITH READ LOCK&lt;br /&gt;   2. While holding connection open run: lvcreate -L16G -s -n dbbackup /dev/Main/Data – This will create snapshot named dbbackup for Logical Volume Main/Data . You should specify enough of undo space to hold modifications during backup process – I’ve specified 16GB in this case. If your undo size is not large enough snapshot will get invalidated and backup will be aborted.&lt;br /&gt;   3. Snapshot created, now you want to let MySQL Server to continue, which is done by running UNLOCK TABLES or simply closing connection.&lt;br /&gt;   4. Mount backup Filesystem: mount /dev/Main/dbbackup /mnt/backup&lt;br /&gt;   5. Copy the data from the above mount to tape or any other source&lt;br /&gt;   6. Unmount filesystem umount /mnt/backup&lt;br /&gt;   7. Remove snapshot: lvremove -f /dev/Main/dbbackup&lt;br /&gt;&lt;br /&gt;So how does the LVM snapshot work internally. LVM snapshots are an example of a copy-on-write snapshot solution. When you have an LVM volume with no snapshots, writes to the volume happen as you’d expect. A block is changed, and that’s it. So in the above case before the snapshot is created, any db inserts/updates that causes a write IO is normally written to the data directory. As soon as you create a snapshot, LVM creates a pool of blocks. I believe that this pool also contains a full copy of the metadata (only metadata not the full data) of the volume. When writes happen to the main volume (i.e. the directory off of which snapshot is created), the block being overwritten is copied to this new pool and the new block is written to the main volume. This is the ‘copy-on-write’. Because of this, the more data that gets changed between when a snapshot was taken and the current state of the main volume, the more space will get consumed by that snapshot pool. The normal way that LVM snapshots are used is not for long-term storage, but rather to get a consistent “picture” of the filesystem such that a backup can be taken. Once the backup is done, the snapshot is discarded. When you mount the snapshot, the meta-data written when the snapshot was taken allows the directory tree to be presented. Blocks that haven’t been changed since the snapshot was taken are read directly from the main volume. Blocks that have been changed are read from the snapshot pool. You don’t want to leave snapshots laying around because (a) they’ll fill up and become unusable, and (b) the system’s performance is impacted while a snapshot is active– things get slower.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2751883252721204697?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2751883252721204697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/12/mysql-backups-using-lvm-snapshots.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2751883252721204697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2751883252721204697'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/12/mysql-backups-using-lvm-snapshots.html' title='Mysql backups using LVM snapshots'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-7347074692386353881</id><published>2009-11-04T15:55:00.003-07:00</published><updated>2009-11-04T16:21:07.517-07:00</updated><title type='text'>Hibernate flush only specific object types</title><content type='html'>So we have this issue where in certain cases we would only like to flush a certain class of objects and discard the rest. This is sort of a common use case if you are following the one session per request paradigm wherein if a job/request fails and the job status logging is also done via the database/hibernate then you would still want to persist the job log status however the application job data changes can be discarded. Found an excellent post here:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://forum.hibernate.org/viewtopic.php?f=1&amp;t=983747&amp;sid=4988e082644059b66220836ef4c53806&amp;start=15"&gt;https://forum.hibernate.org/viewtopic.php?f=1&amp;t=983747&amp;sid=4988e082644059b66220836ef4c53806&amp;start=15&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So as it turns out there is no way to selectively flush objects. You can use the "evict non flushable objects" methodology (basically bu evicting the objects their changes are discarded) but often times you don't know what all objects were involved in the request. &lt;br /&gt;&lt;br /&gt;A better design is to probably open two sessions with each request/job. One for meta data and the other for application business data. That allows better handling of request failures.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7347074692386353881?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7347074692386353881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/11/hibernate-flush-only-specific-object.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7347074692386353881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7347074692386353881'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/11/hibernate-flush-only-specific-object.html' title='Hibernate flush only specific object types'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-3536289856754071773</id><published>2009-10-04T15:42:00.002-07:00</published><updated>2009-10-04T15:47:07.477-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Enable Mysql general query log in Mac OSX'/><title type='text'>Enable Mysql general query log in Mac OSX</title><content type='html'>To enable this for the current user follow the below steps&lt;br /&gt;&lt;br /&gt;-- create or edit the existing cnf file&lt;br /&gt;vim ~/.my.cnf &lt;br /&gt;&lt;br /&gt;-- add the below variable to the file&lt;br /&gt;[server]&lt;br /&gt;log=/tmp/mysql_query.log&lt;br /&gt;&lt;br /&gt;-- restart mysql&lt;br /&gt;sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop&lt;br /&gt;sudo /Library/StartupItems/MySQLCOM/MySQLCOM start&lt;br /&gt;&lt;br /&gt;To enable the general query log for all users add the "variable" to /etc/my.cnf instead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3536289856754071773?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3536289856754071773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/10/enable-mysql-general-query-log-in-mac.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3536289856754071773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3536289856754071773'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/10/enable-mysql-general-query-log-in-mac.html' title='Enable Mysql general query log in Mac OSX'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-5167606774563219075</id><published>2009-08-30T14:08:00.005-07:00</published><updated>2009-08-30T18:17:33.266-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flash full screen freeze'/><category scheme='http://www.blogger.com/atom/ns#' term='megavideo full screen freeze'/><category scheme='http://www.blogger.com/atom/ns#' term='veoh full screen freeze'/><title type='text'>Adobe Flash freezes on full screen</title><content type='html'>Have been having this problem recently wherein doing a full screen on a flash video freezes the screen. My wife watches movies online occasionally on MegaVideo/Veoh and the problem persists in both as both use flash internally. &lt;br /&gt;&lt;br /&gt;While the Flash player is in normal mode, right click on the player and choose "Settings" from the context menu.  Remove the checkmark in the box next to "Enable Hardware Acceleration".&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Wx-8OjwLTqs/Spskmoi1dLI/AAAAAAAAAFE/uDbbiEHs3uw/s1600-h/fpSettings1.PNG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 213px; height: 135px;" src="http://1.bp.blogspot.com/_Wx-8OjwLTqs/Spskmoi1dLI/AAAAAAAAAFE/uDbbiEHs3uw/s320/fpSettings1.PNG" border="0" alt=""id="BLOGGER_PHOTO_ID_5375930826333975730" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Reference links&lt;br /&gt;http://support.mozilla.com/si/kb/Cannot+view+full+screen+Flash+videos&lt;br /&gt;http://www.macromedia.com/support/documentation/en/flashplayer/help/help01.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5167606774563219075?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5167606774563219075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/adobe-flash-screen-freezes-on-full.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5167606774563219075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5167606774563219075'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/adobe-flash-screen-freezes-on-full.html' title='Adobe Flash freezes on full screen'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Wx-8OjwLTqs/Spskmoi1dLI/AAAAAAAAAFE/uDbbiEHs3uw/s72-c/fpSettings1.PNG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-7087811130971990908</id><published>2009-08-14T17:07:00.001-07:00</published><updated>2009-08-14T17:08:55.409-07:00</updated><title type='text'>Adcenter keyword: Setting match type</title><content type='html'>Adcenter is different from other networks as it does not have a special attribute called “match type” on a keyword. Instead each keyword has three bid fields “exact bid (EB)”, “phrase bid (PB)” and “broad bid (BB)”. The keyword match types are determined on whether a bid is specified for that match type. For instance if a keyword has EB=1.5,PB=0.75,BB=0.0 then this keyword is used in exact and phrase matches. This is different in other networks where a keyword has a single “bid” attribute and an attribute to specify match type.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7087811130971990908?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7087811130971990908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/adcenter-keyword-setting-match-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7087811130971990908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7087811130971990908'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/adcenter-keyword-setting-match-type.html' title='Adcenter keyword: Setting match type'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-3520259369135933644</id><published>2009-08-07T16:37:00.005-07:00</published><updated>2009-08-14T17:05:41.850-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='monitoring gearman'/><category scheme='http://www.blogger.com/atom/ns#' term='gearman monitoring'/><title type='text'>Monitoring Gearman over telnet port 4730</title><content type='html'>So the only way to monitor Gearman is via doing a telnet to port 4730. The current monitoring supported commands are fairly basic. I could not locate any documentation on the support commands so had to literally look at the code to figure out the supported commands (the below command documentation is copied from the comments in code). There are plans to include more set of commands in the next release.&lt;br /&gt;&lt;br /&gt;Command: STATUS&lt;br /&gt;&lt;br /&gt;The output format of this function is tab separated columns as follows, followed by a line consisting of a full stop and a newline (".\n") to indicate the end of output. below are the columns shown&lt;br /&gt;&lt;br /&gt;- Function name : A string denoting the name of the function of the job&lt;br /&gt;- Number in queue : A positive integer indicating the total number of jobs for this function in the queue. This includes currently running ones as well (next column)&lt;br /&gt;- Number of jobs running : A positive integer showing how many jobs of this function are currently running&lt;br /&gt;- Number of capable workers : A positive integer denoting the maximum possible count of workers that could be doing this job. Though they may not all be working on it due to other tasks holding them busy.&lt;br /&gt;&lt;br /&gt;Command : Workers&lt;br /&gt;&lt;br /&gt;This command show the details of various clients registered with the gearmand server. For each worker it shows the following info:&lt;br /&gt;&lt;br /&gt;- Peer IP: Client remote host&lt;br /&gt;- Client ID: Unique ID assigned to client&lt;br /&gt;- Functions: List of functions this client has registered for.&lt;br /&gt;&lt;br /&gt;Any other command text throws a error "ERR unknown_command Unknown+server+command"&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 650px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;sudhirv@sudhirv:~$ telnet localhost 4730&lt;br /&gt;Trying ::1...&lt;br /&gt;Trying 127.0.0.1...&lt;br /&gt;Connected to localhost.&lt;br /&gt;Escape character is '^]'.&lt;br /&gt;&lt;br /&gt;STATUS&lt;br /&gt;.&lt;br /&gt;WORKERS&lt;br /&gt;11 127.0.0.1 - :&lt;br /&gt;.&lt;br /&gt;status&lt;br /&gt;.&lt;br /&gt;workers&lt;br /&gt;11 127.0.0.1 - :&lt;br /&gt;.&lt;br /&gt;some crap&lt;br /&gt;ERR unknown_command Unknown+server+command&lt;br /&gt;&lt;br /&gt;#### will add more samples in action when I have this thing up and running ####&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3520259369135933644?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3520259369135933644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/monitoring-gearman-over-telnet-port.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3520259369135933644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3520259369135933644'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/monitoring-gearman-over-telnet-port.html' title='Monitoring Gearman over telnet port 4730'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-3230158913888828405</id><published>2009-08-07T16:01:00.002-07:00</published><updated>2009-08-07T16:37:12.363-07:00</updated><title type='text'>Installing Gearman on Ubuntu</title><content type='html'>Gearman is a open source job forking system. We have been evaluating its use in our project to share jobs across components. More info on the Gearman project can be found here: http://gearman.org/.&lt;br /&gt;&lt;br /&gt;Here are the instructions on installing Gearman on Ubuntu&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 650px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;wget http://launchpad.net/gearmand/trunk/0.9/+download/gearmand-0.9.tar.gz&lt;br /&gt;tar -xvzf gearmand-0.9.tar.gz&lt;br /&gt;&lt;br /&gt;# two missing libraries that found at configure time&lt;br /&gt;sudo apt-get install libevent-dev&lt;br /&gt;sudo apt-get install uuid-dev&lt;br /&gt;&lt;br /&gt;cd gearmand-0.9&lt;br /&gt;./configure&lt;br /&gt;make&lt;br /&gt;sudo make install&lt;br /&gt;sudo ldconfig&lt;br /&gt;&lt;br /&gt;# start gearman&lt;br /&gt;gearmand &amp;&lt;br /&gt;&lt;br /&gt;# check gearmand running &lt;br /&gt;ps auxw | grep [g]earmand&lt;br /&gt;&lt;br /&gt;# check germand listening for jobs on tcp port 4730&lt;br /&gt;sudo lsof -i tcp:4730&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# errors when starting gearman&lt;br /&gt;Error: gearman: error while loading shared libraries: libgearman.so.1&lt;br /&gt;&lt;br /&gt;Solution: `make install` may install libraries into `/usr/local/lib`.  It's possible&lt;br /&gt; that this directory isn't on your library search path, which will result in an error &lt;br /&gt;like: "gearman: error while loading shared libraries: libgearman.so.1."  To fix this, &lt;br /&gt;either add `/usr/local/lib` to `LD_LIBRARY_PATH`, or modify `/etc/ld.so.conf` or &lt;br /&gt;`/etc/ld.so.conf.d` to add `/usr/local/lib`, then run: sudo ldconfig&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3230158913888828405?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3230158913888828405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/installing-gearman-on-ubuntu.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3230158913888828405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3230158913888828405'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/installing-gearman-on-ubuntu.html' title='Installing Gearman on Ubuntu'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-9084657117156142129</id><published>2009-08-07T13:27:00.003-07:00</published><updated>2009-08-07T13:33:30.657-07:00</updated><title type='text'>Extract process attributes</title><content type='html'>Handy one liner scripts to extract various process attributes. You can add additional attributes to the 'ps' command to get other attributes. Below are some samples&lt;br /&gt;&lt;br /&gt;-- Process start hour&lt;br /&gt;ps -eo pgid,lstart,cmd | grep "[p]name" | awk '{print $5}' | cut -d\. -f1&lt;br /&gt;&lt;br /&gt;-- Process start minute&lt;br /&gt;ps -eo pgid,lstart,cmd | grep "[p]name" | awk '{print $5}' | cut -d\. -f2&lt;br /&gt;&lt;br /&gt;--process start day&lt;br /&gt;ps -eo pgid,lstart,cmd | grep "[p]name" | awk '{print $4}'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-9084657117156142129?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/9084657117156142129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/extract-process-attributes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/9084657117156142129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/9084657117156142129'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/extract-process-attributes.html' title='Extract process attributes'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-3076911022594715058</id><published>2009-08-07T12:48:00.001-07:00</published><updated>2009-08-07T12:49:07.819-07:00</updated><title type='text'>command to kill a process group</title><content type='html'>If pid is negative but not -1, the signal is sent to all processes whose process group ID is equal to the absolute value of pid. The negative pid is specified in this way:&lt;br /&gt;&lt;br /&gt;   kill -s KILL -- -nn&lt;br /&gt;&lt;br /&gt;where nn is the process group ID and may have a range of 2 to 7 digits (nn to nnnnnnn).&lt;br /&gt;&lt;br /&gt;   kill -s KILL -- -9812753&lt;br /&gt;&lt;br /&gt;The format must include the – – – before the nn in order to specify the process group ID&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3076911022594715058?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3076911022594715058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/command-to-kill-process-group.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3076911022594715058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3076911022594715058'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/08/command-to-kill-process-group.html' title='command to kill a process group'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-980374835827460893</id><published>2009-06-06T18:10:00.004-07:00</published><updated>2009-06-06T18:55:30.696-07:00</updated><title type='text'>Ubuntu 9.04 resets resolution @ restart</title><content type='html'>Spent quite some time today trying to make this work. Installed Ubuntu 9.04 this AM and as expected it was not able to correctly detect the monitor resolution. Installed the latest NVidia drivers (180.44) from Synaptic package and was able to set the right resolution using "nvidia-settings" app. Before saving the configuration made sure that preview of "/etc/X11/xorg.conf" was showing as to what I had set. Restarted the system and the resolution was getting set back to "800x600". Applying a resolution using 'nvidia-settings" was still working in the session however @ logout/restart it would revert back to "800x600". Here's what all I tried and the final step that worked for me:&lt;br /&gt;&lt;br /&gt;1) The first question I had was whether nvidia drivers were being loaded at restart or not. One of the Ubuntu knowledge base suggested adding "nvidia" to "/etc/modules" such that it gets loaded at boot time but that didn't work.&lt;br /&gt;&lt;br /&gt;.... After many failed google searches I shifted my focus to looking at system logs for any clues......&lt;br /&gt;&lt;br /&gt;2) checked this log file after system startup "/var/log/gdm/:0.log" and it was complaining about error loading "type2" and "freetype" modules. I wasn't sure if this was causing the "xorg.comf" to fail so I manually disabled the load of these modules in the "xorg.conf" file under the section module like below. Did a restart but still the same situation however the log "/var/log/gdm/:0.log" was not showing the error this time.&lt;br /&gt;&lt;br /&gt;Section "Module"&lt;br /&gt;    Load           "dbe"&lt;br /&gt;    Load           "extmod"&lt;br /&gt;#    Load           "type1"&lt;br /&gt;#    Load           "freetype"&lt;br /&gt;    Load           "glx"&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;2) Check log file "/var/log/Xorg.0.log". This log contains details on "xorg.conf" loading. Watchout for any errors in this log. In my case this log looked fine except the last line in the log file that said "[nvidia]: setting resolution 800x600". This baffled me. While the earlier lines in the log file correctly stated loading the correct resolution from 'xorg.conf', this last log line almost seemed like some another process was invoking at startup that was turning the resolution back to '800x600'. Googled around but no clue.&lt;br /&gt;&lt;br /&gt;... Took a walk at a park nearby as my brains was about to explode. &lt;br /&gt;&lt;br /&gt;3) Lot of sites/forums had samples of "xorg.conf" files from users whose system was working fine. Tried various of those but still no luck.&lt;br /&gt;&lt;br /&gt;4) &lt;span style="font-style:italic;"&gt;One of the forums post suggested this method. "System --&gt; Preferences --&gt; Display". Choosing that option prompts a question "It appears that your graphics driver does not support the necessary extensions to use this tool. Do you want to use your graphics driver vendor's tool instead?". if you click "yes" it takes you to the "nvidia-settings" tool. If you choose the "No" option, it allows choosing a resolution via the "Display Preferences" window. I select "No" and choose the desired resolution of "1280x1024" from the list and hit "Apply". As usual it worked in the session and voila!!!! it also worked after a restart. The resolution stayed @ "1280x1024".&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;Obviously there were a lot of other steps that I tried in vain but these seemed worth a note as they provide some clue as to what the issue might be. Hope this post helps.  &lt;br /&gt;&lt;br /&gt;my google searched keywords: Xorg.log nvidia 800x600, Ubuntu 9.04 resets resolution restart, ubuntu 9.04 stuck at 800x600, ubuntu 9.04 low graphics mode, ubuntu 9.04 loose settings on restart, ubuntu 9.04 lost screen resolution after restart&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-980374835827460893?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/980374835827460893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/06/ubuntu-904-resets-resolution-restart.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/980374835827460893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/980374835827460893'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/06/ubuntu-904-resets-resolution-restart.html' title='Ubuntu 9.04 resets resolution @ restart'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2558767731590516750</id><published>2009-06-06T12:35:00.003-07:00</published><updated>2009-06-06T12:54:38.613-07:00</updated><title type='text'>Mac OSX Burn ISO Image</title><content type='html'>Here are the steps. &lt;br /&gt;&lt;br /&gt;1) Open Finder&lt;br /&gt;2) Browse "Application/Utilities"&lt;br /&gt;3) Open/double click Disk utility&lt;br /&gt;4) Click "Burn" icon on top. This will ask you to choose a ISO image&lt;br /&gt;5) Once selected it will ask to insert a CD and voila.&lt;br /&gt;&lt;br /&gt;Off course its easy but when you've been using Linux and Windows utilities for years, these steps can be a little perplexing and hard to remember. &lt;br /&gt;&lt;br /&gt;******************* screenshots **********************&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Wx-8OjwLTqs/SirJJjdD4MI/AAAAAAAAAEs/KXKSR_2ApQ0/s1600-h/burn_iso_123.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 295px;" src="http://2.bp.blogspot.com/_Wx-8OjwLTqs/SirJJjdD4MI/AAAAAAAAAEs/KXKSR_2ApQ0/s320/burn_iso_123.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5344305073801650370" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Wx-8OjwLTqs/SirJJ77jjsI/AAAAAAAAAE0/1gKNO2tLJUk/s1600-h/burn_iso_4.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 198px;" src="http://3.bp.blogspot.com/_Wx-8OjwLTqs/SirJJ77jjsI/AAAAAAAAAE0/1gKNO2tLJUk/s320/burn_iso_4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5344305080372006594" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Wx-8OjwLTqs/SirJKNCeTEI/AAAAAAAAAE8/mgUytVQQrUQ/s1600-h/burn_iso_5.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 198px;" src="http://3.bp.blogspot.com/_Wx-8OjwLTqs/SirJKNCeTEI/AAAAAAAAAE8/mgUytVQQrUQ/s320/burn_iso_5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5344305084964424770" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2558767731590516750?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2558767731590516750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/06/mac-osx-burn-iso-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2558767731590516750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2558767731590516750'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/06/mac-osx-burn-iso-image.html' title='Mac OSX Burn ISO Image'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Wx-8OjwLTqs/SirJJjdD4MI/AAAAAAAAAEs/KXKSR_2ApQ0/s72-c/burn_iso_123.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-9129600553233628789</id><published>2009-01-28T10:52:00.007-07:00</published><updated>2009-01-28T11:05:30.434-07:00</updated><title type='text'>Perl Mysql DBI get deleted row count</title><content type='html'>Trying to capture the number of deleted rows when executing a delete statement was returning a "0E0". See below for the script details. What I found was that it was DBI's way of saying zero rows were deleted. The thing to know about DBI is that do() needs to return distinct values to distinguish the occurrence of an error from the case that no rows were affected, so it uses “undef” and “0E0”. The value “undef” indicates an error; it evaluates to false in a Boolean context. The string “0E0” indicates that no rows were affected; it evaluates to true in Boolean contexts but is treated as zero in numeric contexts. If do() returned 0 to indicate no rows were affected, that evaluates to false in a Booelan context and would be difficult from an error. You can do the following to display the row count correctly&lt;br /&gt;&lt;br /&gt;Error:&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 650px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;my $deleted = $conn-&gt;do("delete from employee where year between 1901 and 1910");&lt;br&gt;print "deleted $deleted rows.\n"; &lt;br&gt;&lt;br /&gt;The above would print "deleted 0E0 rows"&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 650px;"&gt;&lt;pre style="margin: 0;"&gt; &lt;br /&gt;my $deleted = $conn-&gt;do("delete from employee where year between 1901 and 1910");&lt;br&gt; printf "deleted %d rows.\n", $deleted; &lt;br /&gt;&lt;br /&gt;(OR)&lt;br /&gt;&lt;br /&gt;my $deleted += $conn-&gt;do("delete from employee where year between 1901 and 1910");&lt;br&gt;print "deleted $deleted rows.\n"; &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-9129600553233628789?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/9129600553233628789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/perl-mysql-dbi-get-deleted-row-count.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/9129600553233628789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/9129600553233628789'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/perl-mysql-dbi-get-deleted-row-count.html' title='Perl Mysql DBI get deleted row count'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-7233867550636536988</id><published>2009-01-26T11:33:00.006-07:00</published><updated>2009-01-26T12:20:42.933-07:00</updated><title type='text'>Adcenter Error Code 1514 : The Negative keywords requires partial match bid</title><content type='html'>Got this error when dealing with a keyword update through the Adcenter API. Its a shame that Microsoft has no documentation on this error and none the less anywhere on the internet, hence the drive to blog this. Here's a brief background on Adcenter Negative Keywords: &lt;br /&gt;&lt;br /&gt;http://msdn.microsoft.com/en-us/library/bb545038.aspx&lt;br /&gt;&lt;br /&gt;So what the error basically means is that "Negative keywords are only allowed on keywords that have a broad or phrase match bid specified". If you try to add/update a keyword with "Not Keywords" and only exact bid specified then you would get this error. In my case this was being caused by a different scenario. We use Apache Axis for our webservice calls and Axis treats a blank string as a valid content string when compared to a null string. So even if the "Not Keywords" was set to blank it was generating the "Negative Keyword" soap element. See below for SOAP source. In the soap below the broad and phrase bid is specified as 0's and the "NegativeKeywords" element is constructed making MSN think that there are negative keywords associated with this keyword and hence the error. I resolved this error by setting the string to NULL instead of a blank ("''").&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;soapenv:Envelope xmlns:soapenv=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot; xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;soapenv:Header&amp;gt;&amp;lt;ns1:ApplicationToken soapenv:actor=&amp;quot;http://schemas.xmlsoap.org/soap/actor/next&amp;quot; soapenv:mustUnderstand=&amp;quot;0&amp;quot; xmlns:ns1=&amp;quot;https://adcenter.microsoft.com/api/advertiser/v5&amp;quot;/&amp;gt;&amp;lt;ns2:DeveloperToken soapenv:actor=&amp;quot;http://schemas.xmlsoap.org/soap/actor/next&amp;quot; soapenv:mustUnderstand=&amp;quot;0&amp;quot; xmlns:ns2=&amp;quot;https://adcenter.microsoft.com/api/advertiser/v5&amp;quot;&amp;gt;&amp;lt;ns2:Value&amp;gt;xxxx&amp;lt;/ns2:Value&amp;gt;&amp;lt;/ns2:DeveloperToken&amp;gt;&amp;lt;ns3:UserCredentials soapenv:actor=&amp;quot;http://schemas.xmlsoap.org/soap/actor/next&amp;quot; soapenv:mustUnderstand=&amp;quot;0&amp;quot; xmlns:ns3=&amp;quot;https://adcenter.microsoft.com/api/advertiser/v5&amp;quot;&amp;gt;&amp;lt;ns3:Password&amp;gt;xxxxxx&amp;lt;/ns3:Password&amp;gt;&amp;lt;ns3:Username&amp;gt;xxxxx&amp;lt;/ns3:Username&amp;gt;&amp;lt;/ns3:UserCredentials&amp;gt;&amp;lt;/soapenv:Header&amp;gt;&lt;br /&gt;&amp;lt;soapenv:Body&amp;gt;&lt;br /&gt;&amp;lt;UpdateKeywordsRequest xmlns=&amp;quot;https://adcenter.microsoft.com/api/advertiser/v5&amp;quot;&amp;gt;&amp;lt;AdGroupId&amp;gt;xxxxx&amp;lt;/AdGroupId&amp;gt;&amp;lt;Keywords&amp;gt;&lt;br /&gt;&amp;lt;Keyword&amp;gt;&amp;lt;BroadMatchBid&amp;gt;0.0&amp;lt;/BroadMatchBid&amp;gt;&amp;lt;ExactMatchBid&amp;gt;0.5&amp;lt;/ExactMatchBid&amp;gt;&amp;lt;Id&amp;gt;xxxxx&amp;lt;/Id&amp;gt;&amp;lt;NegativeKeywords&amp;gt;&amp;lt;ns4:string xmlns:ns4=&amp;quot;http://schemas.microsoft.com/2003/10/Serialization/Arrays&amp;quot;&amp;gt;&amp;lt;/ns4:string&amp;gt;&amp;lt;/NegativeKeywords&amp;gt;&amp;lt;Param1&amp;gt;xxxx&amp;lt;/Param1&amp;gt;&amp;lt;Param2&amp;gt;&amp;lt;/Param2&amp;gt;&amp;lt;Param3&amp;gt;&amp;lt;/Param3&amp;gt;&amp;lt;PhraseMatchBid&amp;gt;0.0&amp;lt;/PhraseMatchBid&amp;gt;&amp;lt;/Keyword&amp;gt;&lt;br /&gt;&amp;lt;Keyword&amp;gt;&amp;lt;BroadMatchBid&amp;gt;0.0&amp;lt;/BroadMatchBid&amp;gt;&amp;lt;ExactMatchBid&amp;gt;0.5&amp;lt;/ExactMatchBid&amp;gt;&amp;lt;Id&amp;gt;xxxxxx&amp;lt;/Id&amp;gt;&amp;lt;NegativeKeywords&amp;gt;&amp;lt;ns5:string xmlns:ns5=&amp;quot;http://schemas.microsoft.com/2003/10/Serialization/Arrays&amp;quot;&amp;gt;&amp;lt;/ns5:string&amp;gt;&amp;lt;/NegativeKeywords&amp;gt;&amp;lt;Param1&amp;gt;xxxxxxx&amp;lt;/Param1&amp;gt;&amp;lt;Param2&amp;gt;&amp;lt;/Param2&amp;gt;&amp;lt;Param3&amp;gt;&amp;lt;/Param3&amp;gt;&amp;lt;PhraseMatchBid&amp;gt;0.0&amp;lt;/PhraseMatchBid&amp;gt;&amp;lt;/Keyword&amp;gt;&lt;br /&gt;&amp;lt;/Keywords&amp;gt;&lt;br /&gt;&amp;lt;/UpdateKeywordsRequest&amp;gt;&lt;br /&gt;&amp;lt;/soapenv:Body&amp;gt;&lt;br /&gt;&amp;lt;/soapenv:Envelope&amp;gt; &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&amp;lt;s:Envelope xmlns:s=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;s:Body&amp;gt;&amp;lt;s:Fault&amp;gt;&amp;lt;faultcode&amp;gt;s:Client&amp;lt;/faultcode&amp;gt;&amp;lt;faultstring xml:lang=&amp;quot;en-US&amp;quot;&amp;gt;Invalid client data. Check the SOAP fault details for more information&amp;lt;/faultstring&amp;gt;&lt;br /&gt;&amp;lt;detail&amp;gt;&lt;br /&gt;&amp;lt;EditorialApiFaultDetail xmlns=&amp;quot;https://adcenter.microsoft.com/api/advertiser/v5&amp;quot; xmlns:i=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;BatchErrors&amp;gt;&lt;br /&gt;&amp;lt;BatchError&amp;gt;&amp;lt;Code&amp;gt;1514&amp;lt;/Code&amp;gt;&amp;lt;Details i:nil=&amp;quot;true&amp;quot;/&amp;gt;&amp;lt;Index&amp;gt;0&amp;lt;/Index&amp;gt;&amp;lt;Message&amp;gt;The Negative keywords requires partial match bid.&amp;lt;/Message&amp;gt;&amp;lt;/BatchError&amp;gt;&lt;br /&gt;&amp;lt;BatchError&amp;gt;&amp;lt;Code&amp;gt;1514&amp;lt;/Code&amp;gt;&amp;lt;Details i:nil=&amp;quot;true&amp;quot;/&amp;gt;&amp;lt;Index&amp;gt;1&amp;lt;/Index&amp;gt;&amp;lt;Message&amp;gt;The Negative keywords requires partial match bid.&amp;lt;/Message&amp;gt;&amp;lt;/BatchError&amp;gt;&lt;br /&gt;&amp;lt;/BatchErrors&amp;gt;&lt;br /&gt;&amp;lt;OperationErrors/&amp;gt;&lt;br /&gt;&amp;lt;TrackingId&amp;gt;xxxxxxx&amp;lt;/TrackingId&amp;gt;&lt;br /&gt;&amp;lt;EditorialErrors/&amp;gt;&amp;lt;/EditorialApiFaultDetail&amp;gt;&lt;br /&gt;&amp;lt;/detail&amp;gt;&lt;br /&gt;&amp;lt;/s:Fault&amp;gt;&amp;lt;/s:Body&amp;gt;&lt;br /&gt;&amp;lt;/s:Envelope&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7233867550636536988?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7233867550636536988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/adcenter-error-code-1514-negative.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7233867550636536988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7233867550636536988'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/adcenter-error-code-1514-negative.html' title='Adcenter Error Code 1514 : The Negative keywords requires partial match bid'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2174695316064575813</id><published>2009-01-20T14:44:00.004-07:00</published><updated>2009-01-20T14:52:27.193-07:00</updated><title type='text'>Mysql (errno: 13) can't find file frm</title><content type='html'>Recently got this error when I was trying to copy a database on to another server. I basically copied the mysql data directory for the corresponding database on to the new server and logged into mysql client.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 400px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;mysql&gt; select count(*) from placement; &lt;br /&gt;Can't find file: './main/placement.frm (errno: 13)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Checked the mysql log and this was being reported for the all frm files for all tables in the db. Looks like this is a permission issue on the data directory. Changed to the following permissions and it seemed to work.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 300px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;server&gt; sudo chmod -R 660 main&lt;br /&gt;server&gt; sudo chmod 775 main&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2174695316064575813?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2174695316064575813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/mysql-errno-13-cant-find-file-frm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2174695316064575813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2174695316064575813'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/mysql-errno-13-cant-find-file-frm.html' title='Mysql (errno: 13) can&apos;t find file frm'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-6365793073106507173</id><published>2009-01-15T10:22:00.011-07:00</published><updated>2009-01-15T10:58:27.318-07:00</updated><title type='text'>DBD::mysql::db do failed: The used command is not allowed with this MySQL version</title><content type='html'>Our nightly etl process loads a whole lot of data from local files. The recent upgrade of mysql from 5.0.45 --&gt; 5.0.67 was throwing this error &lt;br /&gt;&lt;br /&gt;"DBD::mysql::db do failed: The used command is not allowed with this MySQL version" &lt;br /&gt;&lt;br /&gt;when using the mysql 'LOAD LOCAL FILE' command. We are not entirely sure if this is an issue caused by the mysql upgrade or an outdated perl DBD:Mysql module. MySQL server has the local_infile set to ON via a show variables command (see below) and user has the FILE permission to the local file. A reinstall of the DBD:Mysql module also did not resolve the issue.&lt;br&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 300px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;mysql&gt; show variables like 'local%';&lt;br /&gt;+---------------+-------+&lt;br /&gt;| Variable_name | Value |&lt;br /&gt;+---------------+-------+&lt;br /&gt;| local_infile  | ON    | &lt;br /&gt;+---------------+-------+&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Looking online we came through various links that suggested we needed to specify a option "mysql_local_infile" while connecting to mysql via the DBD:Mysql module. This seemed to resolve our issue.&lt;br&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;width: 500px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;use strict;&lt;br /&gt;use DBI;&lt;br /&gt;my $dsn = "DBI:mysql:mydb;mysql_local_infile=1"; &lt;br /&gt;my $user = "me";&lt;br /&gt;my $password = "secret";&lt;br /&gt;my $dbh = DBI-&gt;connect($dsn,$user,$password);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html&lt;br /&gt;http://www.perlmonks.org/?node_id=728472&lt;br /&gt;http://www.bigresource.com/MYSQL-LOAD-DATA-INFILE-command-to-import-a-text-f&lt;br /&gt;ile-rODHiNex.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-6365793073106507173?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/6365793073106507173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/dbdmysqldb-do-failed-used-command-is.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6365793073106507173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6365793073106507173'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/dbdmysqldb-do-failed-used-command-is.html' title='DBD::mysql::db do failed: The used command is not allowed with this MySQL version'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-7049011917592323629</id><published>2009-01-15T09:25:00.002-07:00</published><updated>2009-01-15T09:31:34.652-07:00</updated><title type='text'>DBD:Mysql warning statements "Use of uninitialized value in concatenation (.) or string"</title><content type='html'>We recently upgraded to the latest and greatest version of the DBD:Mysql perl module and have been seeing these warning statements in our logs a lot (believe me a whole lot to the point of annoyance for developers skimming through logs for debug help).&lt;br /&gt;&lt;br /&gt;Use of uninitialized value in concatenation (.) or string at /usr/local/perl/lib/site_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm line 929.&lt;br /&gt;&lt;br /&gt;For now we went ahead and commented the line no. 929 in the /usr/local/perl/lib/site_perl/5.8.8/x86_64-linux-thread-multi/DBI.pm file and have seen no side effects of that. A fairly weak solution but works for now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7049011917592323629?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7049011917592323629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/dbdmysql-warning-statements-use-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7049011917592323629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7049011917592323629'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/dbdmysql-warning-statements-use-of.html' title='DBD:Mysql warning statements &quot;Use of uninitialized value in concatenation (.) or string&quot;'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-8695062529412355080</id><published>2009-01-07T17:09:00.005-07:00</published><updated>2009-01-07T17:38:54.169-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='home server ping won&apos;t respond'/><category scheme='http://www.blogger.com/atom/ns#' term='home server'/><title type='text'>setting up a home server</title><content type='html'>I am a software guy by profession and have been lately delving into some system ops at work. Been playing around with a home server for the last month or so mostly for learning purposes. Lots of questions and searching on the internet. Came across this book that is quite useful to understand some of the basics around setting up a home network. "Home Wireless Networking in a Snap (Sams Teach Yourself) (Paperback)" (http://www.amazon.com/gp/product/0672327023). I am a linux guy and although this book is based on setting a windows server, still the router related stuff applies everywhere. Came across this book when I was trying to resolve as to why my home server won't respond to ping although ssh and ftp works. DUH!!! the router is the public interface for the home network and the settings on the router was configured to not respond to ping requests. The WAN setup page on my netgear router has a setting "Allow Pinging of Router Internet Interface" that needs to be enabled. There are some other cool stuff that can be set on the WAN setup page. See description and picture below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Enable/Disable Firewall&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Select the appropriate check box or option button to turn on your router's firewall. Some routers (such as my Netgear router) have the firewall enabled by default, and the configuration page does not provide an enable option; it only allows you to disable the firewall by selecting Disable SPI Firewall. Disabling the firewall opens up your network to the possibility of outside attack. There is actually no good reason to disable the firewall, even if access to gaming or other services is a problem, because all connectivity issues can be resolved with port triggering and port forwarding settings&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Specify DMZ Server IP Address&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want to operate a computer or a server (such as a computer that is acting as a web server or a gaming server) outside the firewall, you can have the router place that computer in the DMZ. This means that the network is still protected from attack but that the DMZ computer could potentially be attacked. To place a computer on your network in the DMZ using a Netgear router, select the Default DMZ Server check box and then enter the IP address of the computer that will be placed in the DMZ. The DMZ isn't really a place; it is a virtual location configured by your WiFi router's firewall. The DMZ is a virtual place that resides between your protected internal network and the public Internet. Placing a computer in the DMZ allows it to communicate with the Internet without the router's firewall inspecting the data flowing to and from the computer. It is not uncommon for computers offering certain services to be placed in the DMZ. Even large corporations sometimes place communication servers in the DMZ so that they do not have to open ports on the firewall to allow access to the server.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Allow Pinging of Router Internet Interface&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By default, most WiFi routers are configured so that the router's interface or connection to the Internet cannot be pinged. The Internet interface for you router is actually assigned its IP address by your Internet service provider. So the Internet interface on the router is really its public interface. Allowing the public interface to be pinged can open the router up to attack since it can be "pinged to death." A malicious individual on the Internet could send a barrage of ping packets or oversized ping packets that would actually bring down the router's public interface. This kind of attack is called the "Ping of Death." Enable the router's Internet interface for pinging only if your Internet service provider (or you) needs to ping that interface to determine whether there is a connectivity problem. For my Netgear router, I select the Respond to Ping on Internet Port option to turn on this feature. When you have determined that the interface can be reached by a ping (from you or the ISP technician), I suggest that you disable the feature.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Set MTU Size&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The Maximum Transmit Unit (MTU) value for Ethernet networks such as your WiFi network is 1500 bytes. Leave the MTU setting at the default unless your Internet service provider requires that a different setting be used. If you're unsure about the MTU value, contact your ISP. To change the MTU on my Netgear router, I click in the MTU text box and type a different value. Each router provides a slightly different configuration screen for setting the MTU. Your Internet service provider determines the optimal MTU for the network it services by trial and error. The only way you might perceive that you don't have the correct MTU setting for your ISP connection would be a slight slowing of the connection to the Internet—and this would only be in situations where your MTU is set higher than the ISP's and your data packets have to be broken into smaller chunks for transmission. So, bottom line, call your ISP and see whether it uses a special MTU setting.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Wx-8OjwLTqs/SWVJ_c7LuTI/AAAAAAAAABc/ryO6Yifjrlw/s1600-h/netger_router_wan_page.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 295px;" src="http://4.bp.blogspot.com/_Wx-8OjwLTqs/SWVJ_c7LuTI/AAAAAAAAABc/ryO6Yifjrlw/s400/netger_router_wan_page.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5288714691861526834"/&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8695062529412355080?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8695062529412355080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/setting-up-home-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8695062529412355080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8695062529412355080'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2009/01/setting-up-home-server.html' title='setting up a home server'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Wx-8OjwLTqs/SWVJ_c7LuTI/AAAAAAAAABc/ryO6Yifjrlw/s72-c/netger_router_wan_page.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-3151029828304124250</id><published>2008-12-29T08:58:00.003-07:00</published><updated>2008-12-29T09:08:26.132-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MI_MAX_POSSIBLE_KEY_BUFF'/><category scheme='http://www.blogger.com/atom/ns#' term='MI_MAX_KEY_LENGTH'/><category scheme='http://www.blogger.com/atom/ns#' term='latin utf-8 conversion'/><title type='text'>Mysql increase key length</title><content type='html'>We have recently been converting most of our databases from latin to UTF-8 and have encountered issues with smaller Mysql default keylength. Mysql by default allows a max key length of 1024 size. While it was quite a bit of work to change the current data to confirm to the key length, the easier way was to recompile the Mysql source with a custom key length. Here I will detail the steps to do that:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;wget http://www.percona.com/mysql/5.0.67-b7/source/mysql-5.0.67-percona-b7-src.tar.gz&lt;br /&gt;tar zxf mysql-5.0.67-percona-b7-src.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now you'll want to make the edits to the myisam.h file to use our longer key length instead of the default 1000 byte keylength. Below is a compare of the file before and after change:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;--- /tmp/myisam.h       2008-05-28 13:36:22.000000000 -0700&lt;br /&gt;+++ include/myisam.h    2007-03-15 14:15:41.000000000 -0700&lt;br /&gt;@@ -48,12 +49,12 @@&lt;br /&gt; #define MI_MAX_KEY                  MAX_INDEXES         /* Max allowed keys */&lt;br /&gt; #endif&lt;br /&gt; &lt;br /&gt;-#define MI_MAX_POSSIBLE_KEY_BUFF    (1024+6+6)      /* For myisam_chk */&lt;br /&gt;+#define MI_MAX_POSSIBLE_KEY_BUFF    (4096+6+6)      /* For myisam_chk */&lt;br /&gt; /*&lt;br /&gt;   The following defines can be increased if necessary.&lt;br /&gt;   But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH.&lt;br /&gt; */&lt;br /&gt;-#define MI_MAX_KEY_LENGTH           1000            /* Max length in bytes */&lt;br /&gt;+#define MI_MAX_KEY_LENGTH           4000            /* Max length in bytes */&lt;br /&gt; #define MI_MAX_KEY_SEG              16              /* Max segments for key */&lt;br /&gt; &lt;br /&gt; #define MI_MAX_KEY_BUFF  (MI_MAX_KEY_LENGTH+MI_MAX_KEY_SEG*6+8+8)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Next you'll need to run configure / make install&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;./configure --prefix={choose a name here like /tmp/mysql_mod}&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3151029828304124250?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3151029828304124250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/12/mysql-increase-key-length.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3151029828304124250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3151029828304124250'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/12/mysql-increase-key-length.html' title='Mysql increase key length'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2669980545408688254</id><published>2008-12-24T14:30:00.002-07:00</published><updated>2008-12-24T14:35:48.764-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='database timeout'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql stale connection issue'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql timeout'/><title type='text'>mysql timeout issue</title><content type='html'>The sys admins had recently changed the timeout on the firewalls to a fairly low value to deal with the excessive connections issue. This was causing an issue with the mysql servers as the nightly etl and scripts were failing with stale connection issue. Googled around to find a way to set the connection timeout in mysql settings but couldn't find any lead. One of our sys admins suggested we change the tcp timeout on the mysql boxes and that seems to have resolved the issue. here's the command:&lt;br /&gt;&lt;br /&gt;sudo /sbin/sysctl net.ipv4.tcp_keepalive_time=90&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2669980545408688254?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2669980545408688254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/12/mysql-timeout-issue.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2669980545408688254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2669980545408688254'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/12/mysql-timeout-issue.html' title='mysql timeout issue'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-5195348507209167513</id><published>2008-11-26T14:32:00.003-07:00</published><updated>2008-11-26T15:17:51.563-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun beginner programming problems'/><title type='text'>Fairly Beginner Programming Excercises</title><content type='html'>I have been trying to teach programming to one of my friend and occasionally I search online for fun projects which I can give it to him as programming exercises. I will try to document the ones I gave him  with notes on what I intended him to learn from the exercise:&lt;br /&gt;&lt;br /&gt;******* Loops and Constructs ********&lt;br /&gt;&lt;br /&gt;1) Project 1: Print a pyramid. Read (in a loop of course) a number, n, and print a pyramid that has that size. The example below shows what would be printed for n=4.&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;            *&lt;br /&gt;           * *&lt;br /&gt;          * * *&lt;br /&gt;         * * * *&lt;br /&gt;&lt;br /&gt;2) Project 2: Printing prime numbers: This is more sort of a classic programming problem and involves knowledge of basic programming constructs such as conditions, looping etc.&lt;br /&gt;&lt;br /&gt;3) Project 3: Printing the first n fibonacci numbers. This is again a classic programming problem and involves knowledge of basic programming constructs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;******* Arrays ***********&lt;br /&gt;&lt;br /&gt;1) Project 1: Finding missing elements in a array. So basically a array is provided that has certain missing elements like numbers between 1 - 99. The task here is to find those missing numbers from the array. This project basically requires knowledge of arrays and array traversal.&lt;br /&gt;&lt;br /&gt;2) Project 3: Sorting a number array: This is again a classic programming problem and can be done in various ways. Knowledge gained here is again arrays.&lt;br /&gt;&lt;br /&gt;******* Hash *********&lt;br /&gt;&lt;br /&gt;1) Project 1: Parse a file and display words that occur more than n times. Not a requirement that you use a hash here but ideally you would.&lt;br /&gt;&lt;br /&gt;2) Project 2:&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5195348507209167513?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5195348507209167513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/11/programming-excercises.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5195348507209167513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5195348507209167513'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/11/programming-excercises.html' title='Fairly Beginner Programming Excercises'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-8632112568727275914</id><published>2008-10-06T18:56:00.005-07:00</published><updated>2008-10-06T19:31:21.286-07:00</updated><title type='text'>C# Web Request Using Client Certificate</title><content type='html'>Recently worked on this project where a service was accessible over http via client certificate. This is no biggie however took me 4-5 hrs to figure it out as the issue was not with code associated with importing client certificate but with another portion of the code that I overlooked. You know how it goes, stupid mistakes here and there and boom there goes your day. Thinking that the error was with the client certificate code I searched through the anals of Google pages to figure it out and various attempts/learnings made a worth to blog out. BTW kudos to the Fiddler (http://www.fiddlertool.com/fiddler/) tool which allowed me to sniff the http outgoing traffic helping me debug the issue.&lt;br /&gt;&lt;br /&gt;So the http service I was trying to access is a secure one and my org was issued a client certificate. There are three ways that I tried to attach a client certificate with the request.&lt;br /&gt;&lt;br /&gt;1) Providing direct links to cert files: You can do this via this sample code. Pretty self explanatory. The additional cert you see below is the intermediate certificate agency cert that I had to additionally download.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;X509Certificate2Collection certCollect = new X509Certificate2Collection();&lt;br /&gt;&lt;br /&gt;X509Certificate2 cert = new X509Certificate2(@"C:\Users\...\x509_verisign-certificate.cer");&lt;br /&gt;&lt;br /&gt;X509Certificate2 cert1 = new X509Certificate2(@"C:\Users&lt;br /&gt;\..\Certificate_From_SErvice.cer.pfx", "{client certificate password}");&lt;br /&gt;&lt;br /&gt;certCollect.Add(cert);&lt;br /&gt;&lt;br /&gt;certCollect.Add(cert1);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;2) Exported combined cert file (.cer.p7b format): If you have imported the client/intermediate certificate onto your computer then you can export combined certificate (with all intermediariy certificate) + private key into a .cer.p7b file format. You can use this one file instead of the two used above. Here the code to make it work:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;X509Certificate2Collection certCollect = new X509Certificate2Collection();&lt;br /&gt;&lt;br /&gt;FileInfo file = new FileInfo(@"C:\Users\...\exported_certificate.cer.p7b");&lt;br /&gt;&lt;br /&gt;BinaryReader br = new BinaryReader(File.OpenRead(file.FullName));&lt;br /&gt;&lt;br /&gt;byte[] raw = br.ReadBytes((int)file.Length);&lt;br /&gt;&lt;br /&gt;SignedCms cms = new SignedCms();&lt;br /&gt;&lt;br /&gt;cms.Decode(raw);&lt;br /&gt;&lt;br /&gt;certCollect.AddRange(cms.Certificates);&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;   &lt;br /&gt;&lt;br /&gt;3) Referencing a imported certificate on the workstation: You can reference a imported certificate using the below code. There a various ways to uniquely identify a certificate using 'subject name' or 'serial id' etc. I have accessed it via the subject name. &lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;X509Store store = new X509Store("MY", StoreLocation.CurrentUser);&lt;br /&gt;&lt;br /&gt;store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);&lt;br /&gt;&lt;br /&gt;X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates;&lt;br /&gt;&lt;br /&gt;X509Certificate2Collection fcollection = &lt;br /&gt;(X509Certificate2Collection)collection.Find(X509FindType.FindBySubjectName, "{certificate name}", false);&lt;br /&gt;&lt;br /&gt;X509Certificate2Collection icollection = &lt;br /&gt;(X509Certificate2Collection)collection.Find(X509FindType.FindBySubjectName, "VeriSign&lt;br /&gt;Class 1 Individual Subscriber CA - G2", false);&lt;br /&gt;&lt;br /&gt;X509Certificate2Enumerator certEnum = fcollection.GetEnumerator();&lt;br /&gt;&lt;br /&gt;certEnum.MoveNext();&lt;br /&gt;&lt;br /&gt;X509Certificate2 primCertFromStore = certEnum.Current;&lt;br /&gt;&lt;br /&gt;certEnum = icollection.GetEnumerator();&lt;br /&gt;&lt;br /&gt;certEnum.MoveNext();&lt;br /&gt;&lt;br /&gt;X509Certificate2 issuerCertFromStore = certEnum.Current;&lt;br /&gt;&lt;br /&gt;certCollect.Add(primCertFromStore);&lt;br /&gt;&lt;br /&gt;certCollect.Add(issuerCertFromStore);&lt;br /&gt;            &lt;br /&gt;// use the below code to test if the retrieved certificate is the one you intend to.&lt;br /&gt;//X509Certificate2UI.DisplayCertificate(primCertFromStore);&lt;br /&gt;//X509Certificate2UI.DisplayCertificate(issuerCertFromStore);&lt;br /&gt;store.Close();&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can add the certificate to the request using the below code sample:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;.......&lt;br /&gt;// Handle any certificate errors on the certificate from the server.&lt;br /&gt;string uri = "request uri";&lt;br /&gt;&lt;br /&gt;HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);&lt;br /&gt;&lt;br /&gt;request.ProtocolVersion = HttpVersion.Version11;&lt;br /&gt;&lt;br /&gt;request.KeepAlive = true;    &lt;br /&gt;                              &lt;br /&gt;request.Method = "POST";&lt;br /&gt;            &lt;br /&gt;request.Accept = "*/*";      &lt;br /&gt;     &lt;br /&gt;request.ClientCertificates.AddRange(certCollect); &lt;br /&gt;                       &lt;br /&gt;string str = "POST DATA";&lt;br /&gt;&lt;br /&gt;byte[] postBytes = Encoding.UTF8.GetBytes(str);&lt;br /&gt;&lt;br /&gt;request.ContentType = "TEXT/XML";&lt;br /&gt;&lt;br /&gt;request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR &lt;br /&gt;2.0.50727; .NET CLR 1.1.4322; InfoPath.1)";&lt;br /&gt;            &lt;br /&gt;request.ContentLength = postBytes.Length;&lt;br /&gt;&lt;br /&gt;Stream requestStream = request.GetRequestStream();&lt;br /&gt;&lt;br /&gt;requestStream.Write(postBytes, 0, postBytes.Length);&lt;br /&gt;&lt;br /&gt;requestStream.Close();&lt;br /&gt;&lt;br /&gt;HttpWebResponse response = (HttpWebResponse)request.GetResponse();&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8632112568727275914?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8632112568727275914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/10/c-web-request-using-client-certificate.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8632112568727275914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8632112568727275914'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/10/c-web-request-using-client-certificate.html' title='C# Web Request Using Client Certificate'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2729864690936953898</id><published>2008-09-25T15:25:00.002-07:00</published><updated>2008-09-25T15:30:51.396-07:00</updated><title type='text'>MYSQL duplicate entry error with a non-unique index/key</title><content type='html'>This was a strange one. A insert was erroring out  due to duplicate entry error on a key that is non -unique. The error was: ERROR 1062 (23000): Duplicate entry '445982' for key 2. Did a check table to check if everything was alright and there it was: an error with the table. Repair quick did not work so had to do a full repair. See below log for query statements:&lt;br /&gt;&lt;br /&gt;Here's the log:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;mysql&gt; show create table tableA;&lt;br /&gt;&lt;br /&gt;......&lt;br /&gt;.....&lt;br /&gt;.....&lt;br /&gt; PRIMARY KEY  ("category_id"),&lt;br /&gt;  KEY "ix_campaign_category_unpacked_root" ("root_campaign_id"),&lt;br /&gt;  KEY "ix_campaign_category_client" ("client_id","site_id"),&lt;br /&gt;  KEY "ix_campaign_category_site" ("site_id","client_id")&lt;br /&gt;) ENGINE=MyISAM DEFAULT CHARSET=utf8 &lt;br /&gt;&lt;br /&gt;-- Error from insert&lt;br /&gt;&lt;br /&gt;mysql&gt; ERROR 1062 (23000): Duplicate entry '445982' for key 2&lt;br /&gt;&lt;br /&gt;-- check table result&lt;br /&gt;&lt;br /&gt;mysql&gt; check table tableA;&lt;br /&gt;+----------------------------------+-------+----------+--------------------------------------------------------------+&lt;br /&gt;| Table                            | Op    | Msg_type | Msg_text                                                     |&lt;br /&gt;+----------------------------------+-------+----------+--------------------------------------------------------------+&lt;br /&gt;| tableA | check | warning  | Table is marked as crashed                                   |&lt;br /&gt;| tableA | check | warning  | 2 clients are using or haven't closed the table properly     |&lt;br /&gt;| tableA | check | warning  | Size of datafile is: 34234576       Should be: 34234400      |&lt;br /&gt;| tableA | check | warning  | Found 0 deleted space in delete link chain. Should be 361132 |&lt;br /&gt;| tableA | check | error    | Found 0 deleted rows in delete link chain. Should be 2385    |&lt;br /&gt;| tableA | check | error    | record delete-link-chain corrupted                           |&lt;br /&gt;| tableA | check | error    | Corrupt                                                      |&lt;br /&gt;+----------------------------------+-------+----------+--------------------------------------------------------------+&lt;br /&gt;7 rows in set (0.00 sec)&lt;br /&gt; &lt;br /&gt;-- Repair table attempts&lt;br /&gt;&lt;br /&gt;mysql&gt; repair local table tableA quick;&lt;br /&gt;+----------------------------------+--------+----------+-------------------------------------------------------------------------------+&lt;br /&gt;| Table                            | Op     | Msg_type | Msg_text                                                                      |&lt;br /&gt;+----------------------------------+--------+----------+-------------------------------------------------------------------------------+&lt;br /&gt;| tableA | repair | error    | Couldn't fix table with quick recovery: Found wrong number of deleted records |&lt;br /&gt;| tableA | repair | error    | Run recovery again without -q                                                 |&lt;br /&gt;| tableA | repair | status   | OK                                                                            |&lt;br /&gt;+----------------------------------+--------+----------+-------------------------------------------------------------------------------+&lt;br /&gt;3 rows in set (9.64 sec)&lt;br /&gt;&lt;br /&gt;mysql&gt; repair local table tableA;&lt;br /&gt;+----------------------------------+--------+----------+----------+&lt;br /&gt;| Table                            | Op     | Msg_type | Msg_text |&lt;br /&gt;+----------------------------------+--------+----------+----------+&lt;br /&gt;| tableA | repair | status   | OK       |&lt;br /&gt;+----------------------------------+--------+----------+----------+&lt;br /&gt;1 row in set (2.43 sec)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2729864690936953898?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2729864690936953898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/09/mysql-duplicate-entry-error-with-non.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2729864690936953898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2729864690936953898'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/09/mysql-duplicate-entry-error-with-non.html' title='MYSQL duplicate entry error with a non-unique index/key'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-5484078181756208085</id><published>2008-09-16T11:45:00.003-07:00</published><updated>2008-09-16T12:05:41.292-07:00</updated><title type='text'>Mysql duplicate entry error with auto-increment column</title><content type='html'>I have been looking at this issue with one of our tables where we were getting a duplicate entry error on key 1 which is basically the primary key on the table. The primary key field is set to auto-increment and was puzzling me as to why it was causing the duplicate entry. Ran the checks to ensure the values were right (see checks below):&lt;br /&gt;&lt;br /&gt;Someone suggested to alter the auto-increment value to a higher value and that would reset the next value. So I did a alter statement which took a while as the table was huge. The query to check the next ID value came out correctly (see below for query)&lt;br /&gt;&lt;br /&gt;However this still did not resolve the issue. Finally looked in the direction of index and turns out that index might have been corrupted. Ran a repair table to check index and that fixed the value. (see below for query)&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*********** checks ********************&lt;br /&gt;&lt;br /&gt;--  &lt;sql&gt; select max(id) from tableA;&lt;br /&gt;returned: 70809185&lt;br /&gt;&lt;br /&gt;-- &lt;sql&gt; insert into tableA values (xxxxxx);&lt;br /&gt;Error:  Duplicate entry '70809186' for key 1&lt;br /&gt;&lt;br /&gt;-- &lt;sql&gt; select * from tableA where id=70809186;&lt;br /&gt;Returned 0 rows&lt;br /&gt;&lt;br /&gt;************** alter index **************&lt;br /&gt;&lt;br /&gt;-- query to change the next increment value&lt;br /&gt;&lt;sql&gt; ALTER TABLE tbl AUTO_INCREMENT = 70809190;&lt;br /&gt;&lt;br /&gt;-- find out whats the next increment value&lt;br /&gt;&lt;sql&gt; SELECT Auto_increment FROM information_schema.tables WHERE table_name='tableA';&lt;br /&gt;&lt;br /&gt;************* repair index *****************&lt;br /&gt;&lt;br /&gt;-- &lt;sql&gt; repair table tableA quick;&lt;br /&gt;quick option repairs the indexes&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;/&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5484078181756208085?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5484078181756208085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/09/mysql-duplicate-entry-error-with-auto.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5484078181756208085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5484078181756208085'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/09/mysql-duplicate-entry-error-with-auto.html' title='Mysql duplicate entry error with auto-increment column'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-4894903539163930949</id><published>2008-09-03T11:19:00.003-07:00</published><updated>2008-09-03T11:36:16.390-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql duplicate key sequence issue'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql duplicate key value exists'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql duplicate key error due to sequence issue'/><title type='text'>mysql duplicate key error due to sequence issue</title><content type='html'>I recently had to deal with this error so I am blogging it here so the rest can use. &lt;br /&gt;&lt;br /&gt;Error: On one of our tables we kept getting a duplicate key exception on insets. The puzzling thing was that the value actually did not exist in the table. Here's a low down:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;--- Table definition&lt;br /&gt;CREATE TABLE "job_message" (&lt;br /&gt;  "message_id" bigint(20) NOT NULL auto_increment,&lt;br /&gt;  "run_id" int(11) NOT NULL,&lt;br /&gt;  "object_id" bigint(20) default NULL,&lt;br /&gt;  "date" datetime NOT NULL,&lt;br /&gt;  "priority" tinyint(2) NOT NULL,&lt;br /&gt;  "type" varchar(32) default NULL,&lt;br /&gt;  "msg" varchar(255) NOT NULL,&lt;br /&gt;  "stack_trace" varchar(255) default NULL,&lt;br /&gt;  PRIMARY KEY  ("message_id"),&lt;br /&gt;  KEY "ix_job_message" ("run_id","object_id","date"),&lt;br /&gt;  KEY "ix_job_message_object_id" ("object_id"),&lt;br /&gt;  KEY "ix_job_message_dt" ("date")&lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- proof that row did not exist&lt;br /&gt;mysql&gt; select max(message_id) from job_message_200836;&lt;br /&gt;+-----------------+&lt;br /&gt;| max(message_id) |&lt;br /&gt;+-----------------+&lt;br /&gt;|       753222920 |&lt;br /&gt;+-----------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- error with insert statement&lt;br /&gt;mysql&gt; insert into job_message (run_id, object_id, date, priority, msg) values (1279408,&lt;br /&gt; 22231896, '2008-09-02 15:53:40', 4, 'test');&lt;br /&gt;&lt;br /&gt;ERROR 1062 (23000): Duplicate entry '753222922' for key 1&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Thats what was puzzling.&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;Did  a lot of googling around but got nothing. I did get some hint that the issue might be with the sequences and that the sequence is not updated but got no clue on how to resolve the issue. Out of desperation I tried to see if the table was healthy and voila there it was. The table was corrupted. The solution was to either repair the table or get a copy from the slave. I tried the repair and it worked fine. I used local in the repair command as I did not want the repair to propagate to slave as the slave copy was fine. See commands below to check and repair a table.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;-- check table&lt;br /&gt;mysql&gt; check table job_message_200836;&lt;br /&gt;+-------------------------+-------+----------+-----------------------------------------------------------+&lt;br /&gt;| Table                   | Op    | Msg_type | Msg_text                                                  |&lt;br /&gt;+-------------------------+-------+----------+-----------------------------------------------------------+&lt;br /&gt;| main.job_message_200836 | check | warning  | Size of datafile is: 352975060       Should be: 352974784 |&lt;br /&gt;| main.job_message_200836 | check | error    | Found 3189125 keys of 3189124                             |&lt;br /&gt;| main.job_message_200836 | check | error    | Corrupt                                                   |&lt;br /&gt;+-------------------------+-------+----------+-----------------------------------------------------------+&lt;br /&gt;3 rows in set (0.69 sec)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- repair table command&lt;br /&gt;mysql&gt; repair local table job_message_200836;&lt;br /&gt;+-------------------------+--------+----------+------------------------------------------------+&lt;br /&gt;| Table                   | Op     | Msg_type | Msg_text                                       |&lt;br /&gt;+-------------------------+--------+----------+------------------------------------------------+&lt;br /&gt;| main.job_message_200836 | repair | warning  | Number of rows changed from 3189124 to 3189125 |&lt;br /&gt;| main.job_message_200836 | repair | status   | OK                                             |&lt;br /&gt;+-------------------------+--------+----------+------------------------------------------------+&lt;br /&gt;2 rows in set (29.93 sec)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4894903539163930949?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4894903539163930949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/09/mysql-duplicate-key-error-due-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4894903539163930949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4894903539163930949'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/09/mysql-duplicate-key-error-due-to.html' title='mysql duplicate key error due to sequence issue'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-8920125656294224967</id><published>2008-07-27T18:26:00.002-07:00</published><updated>2008-07-27T18:39:48.535-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TwinView option disabled in Nvidia-Settings'/><title type='text'>TwinView option disabled in Nvidia-Settings</title><content type='html'>I am trying to configure dual monitors on my Ubuntu hardy however the 'Twinview' option is disabled in my settings. To enable this option you would have to tweak the 'xorg.conf' file. First of make a backup of the current '/etc/X11/xorg.conf' so you can always revert to this copy. Here are the instructions to modify the file to enable 'Twinview'&lt;br /&gt;&lt;br /&gt;- sudo gedit /etc/X11/xorg.conf&lt;br /&gt;- Search for line which says "Twinview" "0". Change the "0" to "1"&lt;br /&gt;- sudo nvidia-settings (now the nvidia driver should automatically detect the second connected screen)&lt;br /&gt;&lt;br /&gt;In looking online I also see this option however it did not work for me:&lt;br /&gt;&lt;br /&gt;- nvidia-xconfig --twinview&lt;br /&gt;and restarting your X server.&lt;br /&gt;&lt;br /&gt;There is a nice article on configuring twinview on the NVidia site: http://us.download.nvidia.com/XFree86/Linux-x86/1.0-9755/README/appendix-g.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8920125656294224967?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8920125656294224967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/twinview-option-disabled-in-nvidia.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8920125656294224967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8920125656294224967'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/twinview-option-disabled-in-nvidia.html' title='TwinView option disabled in Nvidia-Settings'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-6450962099112347779</id><published>2008-07-27T18:20:00.002-07:00</published><updated>2008-07-27T18:25:38.134-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Wicd won&apos;t automatically connect to wireless network'/><title type='text'>Wicd won't automatically connect to wireless network</title><content type='html'>I have been using Wicd on my Ubuntu for quite a while and never really bothered as to why it would not automatically connect to a specified network. Wicd provides an option to specify whether to automatically connect to a network. I finally figured out. You need to add Wicd to your system startup services for it to automatically connect. Here are the steps to do that:&lt;br /&gt;&lt;br /&gt;To get the tray icon to automatically appear at boot, go to System &gt; Preferences &gt; Sessions. In the "Startup Programs" tab, click the "New" button. Give it a name ("Wicd" works fine). For the command, enter "/opt/wicd/tray.py"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-6450962099112347779?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/6450962099112347779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/wicd-wont-automatically-connect-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6450962099112347779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/6450962099112347779'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/wicd-wont-automatically-connect-to.html' title='Wicd won&apos;t automatically connect to wireless network'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-8827664174550632477</id><published>2008-07-17T19:48:00.002-07:00</published><updated>2008-07-17T20:36:15.504-07:00</updated><title type='text'>Ubuntu: Installing NVidia video driver</title><content type='html'>I have a Dell Latitude D630 laptop with a NVidia Quadro NVS 135M video card. I recently struggled with installing the driver for this baby on Ubuntu 8.04. I will detail the various solutions I tried and finally the one that worked for me. I have always had issues with this driver however the desire to install the Awant window manager propelled me to deal with this issue. Awant requires that advanced desktop effects be enabled which in turn required a 3D compatible video card. I previously manually modified the xorg.conf to deal with the driver issues but it won't work when I enabled the restricted driver for this card. &lt;br /&gt;&lt;br /&gt;The first solution is to simply enable the restricted driver and check if it works for you. Basically under System --&gt; Administration --&gt; Hardware Drivers. My issue was that resolution detection just won't work. Even if I manually chose the card type and monitor type the resolution would default to 800x600. This pointed me to reinstall the packages involved &lt;br /&gt;&lt;br /&gt;sudo apt-get install --reinstall linux-restricted-modules-$uname -r} nvidia-glx-new&lt;br /&gt;&lt;br /&gt;Re-enable the driver after doing the above step and it still won't detect my resolution. One of the sites suggested using the 'nvidia-xconfig' to generate the 'xorg.conf' and tweak it further via the 'nvidia-settings' util&lt;br /&gt;&lt;br /&gt;sudo nvidia-xconfig --&gt; this creates a new xorg.conf file&lt;br /&gt;sudo nvidia-settings --&gt; this is used to tweak the settings&lt;br /&gt;&lt;br /&gt;The settings won't show my resolution options as the driver was not correctly installed. &lt;br /&gt;&lt;br /&gt;So I looked at some other options and came across this article around installing a proprietary driver downloaded from NVidia site. You can download the latest driver from here: &lt;br /&gt;&lt;br /&gt;http://www.nvidia.com/object/unix.html&lt;br /&gt;&lt;br /&gt;Here are the instructions to install this driver:&lt;br /&gt;&lt;br /&gt;For the driver to install the XServer must be stopped. &lt;br /&gt;&lt;br /&gt;cntrl + alt + backspace&lt;br /&gt;sudo /etc/init.d/gdm stop&lt;br /&gt;sudo sh {installed driver}&lt;br /&gt;sudo /etc/init.d/gdm start&lt;br /&gt;&lt;br /&gt;I did a restart and upon boot up fired the 'nvidia-settings' on terminal which gave me the options to set the resolution. Hope it helps!!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8827664174550632477?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8827664174550632477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/ubuntu-installing-nvidia-video-driver.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8827664174550632477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8827664174550632477'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/ubuntu-installing-nvidia-video-driver.html' title='Ubuntu: Installing NVidia video driver'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-908663615825452540</id><published>2008-07-12T09:30:00.002-07:00</published><updated>2008-07-12T09:44:01.611-07:00</updated><title type='text'>Error installing windows security updates on upgrade from Windows XP Home to Professional</title><content type='html'>So I recently upgraded my windows XP Home version to Professional in need of IIS web&lt;br /&gt;server. XP Home does now allow IIS installation (there are various hacks mentioned&lt;br /&gt;on websites but I could not make it to work). The issue was that my windows automatic updates which were working totally fine before the upgrade, started erroring out after the upgrade. The updates were getting downloaded however they won't install. I had a queue of over 90 updates to be installed. The error on the installation screen was unhelpful just saying "Updates were not installed". My further analysis pointed me to the "windows update log file". &lt;br /&gt;&lt;br /&gt;C:\WINDOWS\WindowsUpdate.log&lt;br /&gt;&lt;br /&gt;To access the log file easily do:&lt;br /&gt;Click Start &gt; Run... &lt;br /&gt;Type/paste %windir%\windowsupdate.log in the "Open:" field&lt;br /&gt;Click OK&lt;br /&gt;&lt;br /&gt;So in my logs I found this error (see below for stack trace). Re-Register the Windows Update dll files and that did the trick.&lt;br /&gt;&lt;br /&gt;Run the following on command prompt:&lt;br /&gt;&lt;br /&gt;regsvr32.exe c:\windows\system32\wuweb.dll&lt;br /&gt;regsvr32.exe c:\windows\system32\wups2.dll&lt;br /&gt;regsvr32.exe c:\windows\system32\wups.dll&lt;br /&gt;regsvr32.exe c:\windows\system32\wucltui.dll&lt;br /&gt;regsvr32.exe c:\windows\system32\wuaueng1.dll&lt;br /&gt;regsvr32.exe c:\windows\system32\wuaueng.dll&lt;br /&gt;regsvr32.exe c:\windows\system32\wuapi.dll&lt;br /&gt;&lt;br /&gt;The windows update will automatically restart after a while and shows up the queued updates in system tray. Works from there.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt; Stacktrace &lt;/strong&gt;&lt;br /&gt;2008-07-09 22:18:22:703 3812 a78 Misc ===========  Logging initialized (build: 7.0.6000.381, tz: -0700)  ===========&lt;br /&gt;2008-07-09 22:18:22:703 3812 a78 Misc   = Process: C:\WINDOWS\system32\wuauclt.exe&lt;br /&gt;&lt;strong&gt;2008-07-09 22:18:22:703 3812 a78 AUClnt FATAL: Error: 0x80004002. wuauclt handler: failed to spawn COM server&lt;/strong&gt;&lt;br /&gt;2008-07-09 22:18:22:718 1248 8c0 Handler FATAL: 0x80004002: ERROR: Remote update handler container process created (PID: 3812), but exited before signaling event&lt;br /&gt;2008-07-09 22:18:25:906 1248 8c0 Agent   * WARNING: Exit code = 0x80004002&lt;br /&gt;2008-07-09 22:18:25:906 1248 8c0 Agent *********&lt;br /&gt;2008-07-09 22:18:25:906 1248 8c0 Agent **  END  **  Agent: Installing updates [CallerId = AutomaticUpdates]&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU &gt;&gt;##  RESUMED  ## AU: Installing update [UpdateId = {707E6500-81C1-4165-8C43-631E09891716}]&lt;br /&gt;2008-07-09 22:18:25:906 1248 8c0 Agent *************&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU   # WARNING: Install skipped&lt;br /&gt;&lt;strong&gt;2008-07-09 22:18:25:906 1248 8c0 Agent WARNING: WU client failed installing updates with error 0x80004002&lt;/strong&gt;2008-07-09 22:18:25:906 1248 e5c AU &gt;&gt;##  RESUMED  ## AU: Installing update [UpdateId = {DD167F04-69E8-46A0-83DA-D4A5143EDBF1}]&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU   # WARNING: Install skipped&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU &gt;&gt;##  RESUMED  ## AU: Installing update [UpdateId = {7CB0B704-B2FF-4D5C-B202-B5BA340B7007}]&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU   # WARNING: Install skipped&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU &gt;&gt;##  RESUMED  ## AU: Installing update [UpdateId = {73F11106-7351-465D-9BA5-2881436C0D5A}]&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU   # WARNING: Install skipped&lt;br /&gt;2008-07-09 22:18:25:906 1248 e5c AU &gt;&gt;##  RESUMED  ## AU: Installing update [UpdateId = {383B0108-D3E2-4F2A-9E32-7B7B599BB0F7}]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-908663615825452540?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/908663615825452540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/error-installing-windows-security.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/908663615825452540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/908663615825452540'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/07/error-installing-windows-security.html' title='Error installing windows security updates on upgrade from Windows XP Home to Professional'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-2569404668912877329</id><published>2008-01-27T16:33:00.000-07:00</published><updated>2008-01-27T16:49:57.123-07:00</updated><title type='text'>converting inputstream to octetstream</title><content type='html'>The other day I was working with soap attachments and stumbled across OctetStream. Had no idea on this stream type which made me lookaround and came up with this info:&lt;br /&gt;&lt;br /&gt;org.apache.axis.attachments.OctetStream corresponds to mime type "application/octetstream"&lt;br /&gt;&lt;br /&gt;-- Converting Inputstream to OctetStream&lt;br /&gt;&lt;br /&gt;ByteArrayOutputStream baos = new ByteArrayOutputStream();&lt;br /&gt;int byte1 = -1;&lt;br /&gt;while ((byte1 = in.read()) != -1)&lt;br /&gt;baos.write(byte1);&lt;br /&gt;return new OctetStream(baos.toByteArray());&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-2569404668912877329?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/2569404668912877329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2008/01/converting-inputstream-to-octetstream.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2569404668912877329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/2569404668912877329'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2008/01/converting-inputstream-to-octetstream.html' title='converting inputstream to octetstream'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-4502440574727217391</id><published>2007-11-06T18:04:00.000-07:00</published><updated>2007-11-06T18:08:24.996-07:00</updated><title type='text'>HtmlParser: Parsing by tag attribute</title><content type='html'>HTML Parser is a Java library used to parse HTML in either a linear or nested fashion. I have tried various open source parsers like WebHarvest etc and found this one to be the most robust when handling bad and nasty html. My primary purpose in using a parser is to extract content from websites. Other people have other needs from the parser which this might not suffice. It has some pretty cool features like filters, visitors, custom tags and easy to use JavaBeans. It is a fast, robust and well tested package. One of the drawbacks is on the documentation front. There is minimal documentation around and most of the stuff I discovered is by playing around.&lt;br /&gt;&lt;br /&gt;So my need here was to be able to extract content from a given tag and the way to identify the tag is by using its ID field. For instance I want to extract the text "some text two" from the below page:&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;div id='one'&amp;gt; some text one &amp;lt;/div&amp;gt; &amp;lt;div id='two'&amp;gt; some text two &amp;lt;/div&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;Here's the code sample to accomplish this:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;import org.htmlparser.Parser;&lt;br /&gt;import org.htmlparser.beans.StringBean;&lt;br /&gt;import org.htmlparser.filters.AndFilter;&lt;br /&gt;import org.htmlparser.filters.HasAttributeFilter;&lt;br /&gt;import org.htmlparser.filters.NodeClassFilter;&lt;br /&gt;import org.htmlparser.tags.Div;&lt;br /&gt;import org.htmlparser.util.NodeList;&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;Parser parse = new Parser("[[url here]]");&lt;br /&gt;// if you have html you can alternativey use the parse.setInputHTML method&lt;br /&gt;NodeList lstNodes = parse.extractAllNodesThatMatch (&lt;br /&gt;     new AndFilter (new NodeClassFilter (Div.class), new HasAttributeFilter ("id")));&lt;br /&gt;if (lstNodes != null &amp;amp;&amp;amp; lstNodes.size() &amp;gt; 0)&lt;br /&gt;{&lt;br /&gt;   Div tag = null;&lt;br /&gt;   for (int itr=0; itr&amp;lt;lstNodes.size(); itr++)&lt;br /&gt;   {&lt;br /&gt;      tag = (Div)lstNodes.elementAt(itr);&lt;br /&gt;      String idAttribute = tag.getAttribute("id");&lt;br /&gt;      if (idAttribute != null &amp;amp;&amp;amp; idAttribute.equals("two"))&lt;br /&gt;      {&lt;br /&gt;          // this will print the div html &amp;lt;div id='two'&amp;gt; some text two &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;          System.out.println(tag.toPlainTextString());&lt;br /&gt;          // now I need to extract the text from this div tag&lt;br /&gt;          Parser tagParser = new Parser();&lt;br /&gt;          tagParser.setInputHTML(tag.toHtml());&lt;br /&gt;          StringBean sb = new StringBean ();&lt;br /&gt;          tagParser.visitAllNodesWith (sb);&lt;br /&gt;          System.out.println(sb.getStrings ()); // this will print the content "some text two"&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4502440574727217391?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4502440574727217391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/11/htmlparser-parsing-by-tag-attribute.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4502440574727217391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4502440574727217391'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/11/htmlparser-parsing-by-tag-attribute.html' title='HtmlParser: Parsing by tag attribute'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-8056356228166101283</id><published>2007-08-17T13:09:00.000-07:00</published><updated>2007-08-17T13:14:11.573-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java.sql.BatchUpdateException: Duplicate entry for key'/><category scheme='http://www.blogger.com/atom/ns#' term='hibernate duplicate key'/><title type='text'>Resolving hibernate Duplicate Entry Issue</title><content type='html'>So the other day I encountered this issue with hibernate duplicate entry. The error is usually of this sort (See exception stack trace below. We use Spring with hibernate in our project and that explains the DataIntegrityViolationException? being thrown here. Spring categorizes the black box SQLException to more granular level sql exceptions).&lt;br /&gt;&lt;br /&gt;I encountered this error when running my testcase. The situation looked fairly simple to resolve at first sight. The exception pointed me to the erroring model "save" call in the code and all I had to do was to ensure that the duplicated key being reported did not already exist in the corresponding model db table. However the model table actually did not contain the erroring key. Then I tried to flush my session in desperate aim to put the blame on hibernate. That did not resolve the issue.&lt;br /&gt;&lt;br /&gt;In looking at detail I noticed that there were several other model inserts happening before the erroring model "save" call and given the fact that these objects are related to each other, any of the previous/related inserts might be contributing to this problem. The erroring model was further tough to track becuase the testcase initially cleans all the test related tables in the test database so pretty much all tables were starting with a key 1. So it pretty much boiled down to identifying the erroring model.&lt;br /&gt;&lt;br /&gt;I enabled the hibernate logs to print the executing SQL statements (so basically in your log4j properties you can add this line (log4j.logger.net.sf.hibernate.SQL=DEBUG) and this will spit out the executing native sql queries to the root appender). By doing this I was able to find the exact insert statement that was causing the issue. In fact the table erroring out was not being cleaned before the test case got executed and that caused issue with existing data in that table.&lt;br /&gt;&lt;br /&gt;Exception stack trace from duplicate entry key issue: &lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;br /&gt;&lt;pre style="margin: 0;"&gt;12:37:30,969 WARN  [main] JDBCExceptionReporter.logExceptions(38) - SQL Error: 1062, SQLState: 23000&lt;br /&gt;    [junit] 12:37:30,970 ERROR [main] JDBCExceptionReporter.logExceptions(46) - Duplicate entry '1' for key 1&lt;br /&gt;    [junit] 12:37:30,971 WARN  [main] JDBCExceptionReporter.logExceptions(38) - SQL Error: 1062, SQLState: 23000&lt;br /&gt;    [junit] 12:37:30,971 ERROR [main] JDBCExceptionReporter.logExceptions(46) - Duplicate entry '1' for key 1&lt;br /&gt;    [junit] 12:37:30,973 ERROR [main] JDBCException.&amp;lt;init&amp;gt;(38) - Could not execute JDBC batch update&lt;br /&gt;    [junit] java.sql.BatchUpdateException: Duplicate entry '1' for key 1&lt;br /&gt;    [junit] at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)&lt;br /&gt;    [junit] at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:126)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2440)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.executeInserts(SessionImpl.java:2329)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:884)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:865)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:746)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1396)&lt;br /&gt;    [junit] at org.springframework.orm.hibernate.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:583)&lt;br /&gt;    [junit] at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:357)&lt;br /&gt;    [junit] at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:580)&lt;br /&gt;[junit] Hibernate operation: Could not execute JDBC batch update; SQL []; Duplicate entry '2' for key 1; nested exception is java.sql.BatchUpdateException: Duplicate entry '1' for key 1&lt;br /&gt;    [junit] org.springframework.dao.DataIntegrityViolationException: Hibernate operation: Could not execute JDBC batch update; SQL []; Duplicate entry '1' for key 1; nested exception is java.sql.BatchUpdateException: Duplicate entry '1' for key 1&lt;br /&gt;    [junit] java.sql.BatchUpdateException: Duplicate entry '1' for key 1&lt;br /&gt;    [junit] at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)&lt;br /&gt;    [junit] at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:126)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2440)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.executeInserts(SessionImpl.java:2329)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:884)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:865)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:746)&lt;br /&gt;    [junit] at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1396)&lt;br /&gt;    [junit] at org.springframework.orm.hibernate.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:583)&lt;br /&gt;    [junit] at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:357)&lt;br /&gt;    [junit] at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:580)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-8056356228166101283?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/8056356228166101283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/08/resolving-hibernate-duplicate-entry.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8056356228166101283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/8056356228166101283'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/08/resolving-hibernate-duplicate-entry.html' title='Resolving hibernate Duplicate Entry Issue'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-3796188394662632006</id><published>2007-08-11T02:21:00.000-07:00</published><updated>2007-08-11T02:32:48.166-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jpda connection refused'/><category scheme='http://www.blogger.com/atom/ns#' term='connection refused'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat debugger issue'/><title type='text'>eclipse debugging tomcat using jpda issues</title><content type='html'>So the other day I was getting this issue of "Connection refused" when trying to connect my eclipse debugger to the tomcat localhost with jpda enabled. Try these suggestions:&lt;br /&gt;&lt;br /&gt;1) some sites online suggest to add this line at the end of the startup.bat file&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;set JPDA_TRANSPORT=dt_socket&lt;br /&gt;set JPDA_ADDRESS=8000&lt;br /&gt;call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;The above setting may not work because the values are overidden in the catalina.bat file. So the best way would be to change the values in the catalina.bat file as following&lt;br /&gt;&lt;br /&gt;.....&lt;br /&gt;if not ""%1"" == ""jpda"" goto noJpda&lt;br /&gt;set JPDA=jpda&lt;br /&gt;if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport&lt;br /&gt;set JPDA_TRANSPORT=dt_socket&lt;br /&gt;:gotJpdaTransport&lt;br /&gt;if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress&lt;br /&gt;set JPDA_ADDRESS=8000&lt;br /&gt;:gotJpdaAddress&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;2) First ensure that the jpda is listening at the specified port. When tomcat starts with joda enabled it spits out a line of this sort "Listening for transport dt_socket at address: 8000". This line ensures that jpda is started. Make sure you are specifying the similar attributes to eclipse. My eclipse version only allows a connection type of socket so dt_socket was the only option for me.&lt;br /&gt;&lt;br /&gt;3) On Windows it may indicate that the Windows Firewall is blocking the connection (it may not notify you of the blockage, even if configured to do so). Go to Control Panel / Windows Firewall / Exceptions / Add Port, and set Name = remote&lt;br /&gt;debugging, Port = 8000, TCP.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-3796188394662632006?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/3796188394662632006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/08/eclipse-debugging-tomcat-using-jpda.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3796188394662632006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/3796188394662632006'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/08/eclipse-debugging-tomcat-using-jpda.html' title='eclipse debugging tomcat using jpda issues'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-4417860727304408382</id><published>2007-07-21T23:31:00.000-07:00</published><updated>2007-07-29T19:25:47.866-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='migratedb tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='database maintenance'/><category scheme='http://www.blogger.com/atom/ns#' term='manage database changes'/><category scheme='http://www.blogger.com/atom/ns#' term='postgres migratedb'/><category scheme='http://www.blogger.com/atom/ns#' term='migratedb postgres'/><category scheme='http://www.blogger.com/atom/ns#' term='agile database changes'/><title type='text'>Agile Management of Database Changes</title><content type='html'>The last couple of weeks I have been researching on a better way to manage our application database changes. We have a small size team (8-9 persons) working on the application and we have a hard time managing the database changes. The way we handle the changes currently is not the most elegant approach but is followed in many team environments. &lt;br /&gt;&lt;br /&gt;In the current system we store the database changes as sql statements in source control categorized by the changed component such as tables, sequences, indexes etc. So we basically have a "db" folder under source control containg separate folders for various DB components such as tables, sequences, indexes etc. For each new DB component a new sql file is created and is stored in the corresponding db component folder and changes to existing DB components are added to corresponding DB component creation script. &lt;br /&gt;&lt;br /&gt;Here are some of the issues with our current approach:&lt;br /&gt;&lt;br /&gt;1) Hard to compare db changes between build versions&lt;br /&gt;&lt;br /&gt;2) No elegant way to release db changes to production/staging/other team member dev boxes. In order to push the db changes to production system @ build time, a separate changes.sql file is created and run at release time. Sometimes for developers to catch up with current db state, they need to go through a maze of sql files and manually determine the changes that need to be synched.&lt;br /&gt;&lt;br /&gt;3) Hard to switch database to a previous release version. Database changes must be correctly segregated to accomplish the above scenario.&lt;br /&gt;&lt;br /&gt;Looking around in search of an elegant approach I stumbled across this concept of agile databases. Of many things that constitute the core principals of agile databases, incremental change and easy change management is one of them. So I found this tool called &lt;a href="http://migratedb.sourceforge.net/"&gt;migratDB&lt;/a&gt; that can be used to manage db changes.&lt;br /&gt;&lt;br /&gt;MigrateDB is a simple xml based solution that applies all the changes defined by you in the XML file. For each sql change, you provide a pre-condition or test condition for the execution of the sql and the SQL is executed when the condition is met. The tool provides command line support and also gives ANT integration.&lt;br /&gt;&lt;br /&gt;Here are some of the salient features (taken from &lt;a href="http://migratedb.sourceforge.net/"&gt;migratDB&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;1) Allows construction of a database at a particular version&lt;br /&gt;2) Allows migration from an existing database to a later version&lt;br /&gt;3) Human readable format for releases&lt;br /&gt;4) Release ‘action’ available on multiple environments (i.e., various operating systems) allowing development on a different platform than production&lt;br /&gt;5) Provides complete history of changes for each database object&lt;br /&gt;6) The source code can be branched and merged&lt;br /&gt;7) Allows multiple developers to work with/on the same database source code, at the same time&lt;br /&gt;8) Supports an ‘automated build’ / ‘continuous integration’ enviroment&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here's the setup I played around with:&lt;br /&gt;&lt;br /&gt;Database: Postgres&lt;br /&gt;&lt;br /&gt;Sample changes.xml file:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&amp;lt;project&amp;gt; &lt;br&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- test &amp;amp; action to create a new employee table --&amp;gt;&lt;br /&gt;  &amp;lt;change&amp;gt;&lt;br /&gt;    &amp;lt;sqltest exists="false"&amp;gt;&lt;br /&gt;       select * from information_schema.tables where table_name = 'employee';&lt;br /&gt;    &amp;lt;/sqltest&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      CREATE TABLE employee (&lt;br /&gt;      emp_id int4 NOT NULL DEFAULT nextval('employee_empId_seq'::text),&lt;br /&gt;      first_name VARCHAR(12) NOT NULL,&lt;br /&gt;      middle_initial CHAR(1) NOT NULL,&lt;br /&gt;      last_name VARCHAR(15) NOT NULL,&lt;br /&gt;      dept_id int4,&lt;br /&gt;      phone_number CHAR(4),&lt;br /&gt;      hire_date DATE,&lt;br /&gt;      job VARCHAR(50),&lt;br /&gt;      education_level int2 NOT NULL,&lt;br /&gt;      sex CHAR(1) ,&lt;br /&gt;      birth_date DATE ,&lt;br /&gt;      salary NUMERIC ,&lt;br /&gt;      bonus NUMERIC ,&lt;br /&gt;      commission NUMERIC ,&lt;br /&gt;      CONSTRAINT employee_emp_id_pk PRIMARY KEY (emp_id),&lt;br /&gt;      CONSTRAINT employee_phone_number_ck CHECK (phone_number &amp;gt;= '0000' AND phone_number &amp;lt;= '9999')&lt;br /&gt;      );&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      ALTER TABLE employee OWNER TO pgsql;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      GRANT ALL ON TABLE employee TO pgsql;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;  &amp;lt;/change&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &amp;lt;!-- test &amp;amp; action to create a new department table --&amp;gt;&lt;br /&gt;  &amp;lt;change&amp;gt;&lt;br /&gt;    &amp;lt;sqltest exists="false"&amp;gt;&lt;br /&gt;       select * from information_schema.tables where table_name = 'department';&lt;br /&gt;    &amp;lt;/sqltest&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      CREATE TABLE department (&lt;br /&gt;      dept_id int4 NOT NULL DEFAULT nextval('department_dept_id_seq'::text),&lt;br /&gt;      dept_name VARCHAR(36) NOT NULL,&lt;br /&gt;      manager_emp_id int4,&lt;br /&gt;      admin_dept_id int4,&lt;br /&gt;      location VARCHAR(50),&lt;br /&gt;      CONSTRAINT department_dept_id_pk PRIMARY KEY (dept_id)&lt;br /&gt;      );&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      ALTER TABLE department OWNER TO pgsql;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      GRANT ALL ON TABLE department TO pgsql;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt; &amp;lt;/change&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &amp;lt;!-- test &amp;amp; action to create a new referential integrity --&amp;gt;&lt;br /&gt;  &amp;lt;change&amp;gt;&lt;br /&gt;    &amp;lt;sqltest exists="false"&amp;gt;&lt;br /&gt;      SELECT * FROM information_schema.referential_constraints where&lt;br /&gt;      constraint_name = 'department_admin_dept_id_fk';&lt;br /&gt;    &amp;lt;/sqltest&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      alter table department add CONSTRAINT department_admin_dept_id_fk FOREIGN KEY&lt;br /&gt;      (admin_dept_id) REFERENCES department(dept_id)ON DELETE SET NULL;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;  &amp;lt;/change&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- test &amp;amp; action to create a new sequence --&amp;gt;&lt;br /&gt;  &amp;lt;change&amp;gt;&lt;br /&gt;    &amp;lt;sqltest exists="false"&amp;gt;&lt;br /&gt;      SELECT * FROM pg_catalog.pg_statio_user_sequences WHERE relname = 'department_dept_id_seq';&lt;br /&gt;    &amp;lt;/sqltest&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      CREATE SEQUENCE department_dept_id_seq&lt;br /&gt;      INCREMENT 1&lt;br /&gt;      MINVALUE 0&lt;br /&gt;      MAXVALUE 9223372036854775807&lt;br /&gt;      START 1&lt;br /&gt;      CACHE 1;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      ALTER TABLE department_dept_id_seq OWNER TO pgsql;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;  &amp;lt;/change&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- test &amp;amp; action to create a new index --&amp;gt;&lt;br /&gt;  &amp;lt;change&amp;gt;&lt;br /&gt;    &amp;lt;sqltest exists="false"&amp;gt;&lt;br /&gt;      SELECT * FROM pg_catalog.pg_statio_user_indexes WHERE indexrelname = 'department_admin_dept_id_n_idx';&lt;br /&gt;    &amp;lt;/sqltest&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      CREATE INDEX department_admin_dept_id_n_idx ON department (admin_dept_id);&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;    &amp;lt;sqlaction&amp;gt;&lt;br /&gt;      ALTER INDEX department_admin_dept_id_n_idx OWNER TO pgsql;&lt;br /&gt;    &amp;lt;/sqlaction&amp;gt;&lt;br /&gt;  &amp;lt;/change&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The above changes.xml file is stored in source control and can be used to detect database changes between versions. A custom XML parser can be built to track changes for a particular db object. &lt;br /&gt;&lt;br /&gt;For databases that do not support data dictionary, an alternative approach called &lt;a href="http://migratedb.sourceforge.net/#generic"&gt;Generic Migrations&lt;/a&gt; can be used:&lt;br /&gt;&lt;br /&gt;Sample ant target:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&amp;lt;project name="sample_migrateDB"&amp;gt;&lt;br /&gt;  &amp;lt;description&amp;gt;Ant build file for database synchronization&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;property file="${basedir}/buildMigrateDB.properties" /&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;target name="init"&amp;gt;&lt;br /&gt;    &amp;lt;property value="${db.user}" name="db.user" /&amp;gt;&lt;br /&gt;    &amp;lt;property value="${db.password}" name="db.password" /&amp;gt;&lt;br /&gt;    &amp;lt;property value="${db.drivername}" name="driver.name" /&amp;gt;&lt;br /&gt;    &amp;lt;property value="${db.url}" name="db.url" /&amp;gt;&lt;br /&gt;    &amp;lt;echo message="DB Name: ${db.url}" /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!--  Define the build path --&amp;gt;&lt;br /&gt;  &amp;lt;path id="buildMigrateDB.classpath.ref"&amp;gt;&lt;br /&gt;    &amp;lt;!-- ensure the following libs are present in the {lib.dir}: migratedb.jar and postgres jdbc jar --&amp;gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt;fileset dir="${lib.dir}"&amp;gt;&lt;br /&gt;      &amp;lt;include name="*.jar" /&amp;gt;&lt;br /&gt;      &amp;lt;include name="*.zip" /&amp;gt;&lt;br /&gt;    &amp;lt;/fileset&amp;gt;&lt;br /&gt;  &amp;lt;/path&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;property name="buildMigrateDB.classpath" refid="buildMigrateDB.classpath.ref" /&amp;gt;&lt;br /&gt;  &amp;lt;!-- End defining the build path  --&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;taskdef name="dbrelease" classname="net.sf.migratedb.ant.MigrateDbTask" classpath="${buildMigrateDB.classpath}" /&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;target name="dbmigrate" depends="init" description="Create Latest Database Version"&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;dbrelease driver="${db.drivername}"&lt;br /&gt;               url="${db.url}"&lt;br /&gt;               userid="${db.user}"&lt;br /&gt;               password="${db.password}"&lt;br /&gt;               apply="true"&lt;br /&gt;               verbose="true"&lt;br /&gt;               &amp;lt;!-- location for above change xml file --&amp;gt;&lt;br /&gt;               file="${root.dir}/database/postgres/db.xml"&lt;br /&gt;    /&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4417860727304408382?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4417860727304408382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/07/agile-management-of-database-changes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4417860727304408382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4417860727304408382'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/07/agile-management-of-database-changes.html' title='Agile Management of Database Changes'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-4346159804599702605</id><published>2007-07-19T23:17:00.000-07:00</published><updated>2008-11-13T14:27:41.892-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='production logs'/><category scheme='http://www.blogger.com/atom/ns#' term='production log management'/><category scheme='http://www.blogger.com/atom/ns#' term='change log4j loggers production'/><category scheme='http://www.blogger.com/atom/ns#' term='runtime log4j loggers'/><title type='text'>Managing Log4j Appenders @ Runtime</title><content type='html'>Many a times when debugging production issues we wish the log level would have been @ DEBUG level or some other lower level to get more insight into the issue. The usual way to debug non-obvious production issue is to reproduce it in you local development environment. In many cases it works but in some cases its just hard to reproduce the exact environment which caused the error. For instance trying to reproduce a complex hibernate transaction error and that sort. In our application we use a hell lot of webservice calls to interact with various third party hosted services. Its almost impractical to log all the SOAP interactions and many a times reproducing the environment which generated the faulty SOAP call is not possible.&lt;br /&gt;&lt;br /&gt;For this reason we manage our Log4j appenders @ runtime wherein we can add new appenders and change priority levels of existing appenders @ runtime. Once the stacktrace or the required log is gathered, the priority levels can be reverted back to the non-voluminous/required levels.&lt;br /&gt;&lt;br /&gt;We have a Log4j administration page in our application which can only be accessed by super ninjas a.k.a developers. This page can be used to change/add appenders at runtime. The page has sections to add new appenders and change priority levels of existing appenders.&lt;br /&gt;&lt;br /&gt;To start with we display all the current appenders with their current priority levels. This can be achieved using the code below (for simplicity sake I am :&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt; // collect all current appenders&lt;br /&gt; List appenders = new ArrayList(50);&lt;br /&gt; Enumeration e = LogManager.getCurrentLoggers();&lt;br /&gt;&lt;br /&gt; while ( e.hasMoreElements() )&lt;br /&gt; {&lt;br /&gt;    appenders.add(e.nextElement());&lt;br /&gt; }&lt;br /&gt; request.setAttribute("appenders",appenders);&lt;br /&gt;&lt;br /&gt; // all possible priority levels&lt;br /&gt; Priority [] prios = Priority.getAllPossiblePriorities();&lt;br /&gt; request.setAtrribute("possiblePriorities", prios);&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In the JSP page you can use a simple JSTL tag to display the above collected information in a tabular format.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ page import="java.util.*,org.apache.log4j.*"&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;&amp;lt;table&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt; &amp;lt;td&amp;gt; Appender &amp;lt;/td&amp;gt;&lt;br /&gt; &amp;lt;c:forEach var="priority" items='${possiblePriorities}'&amp;gt;&lt;br /&gt;      &amp;lt;td&amp;gt;&amp;lt;c:out value='${priority}'/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt; &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;c:forEach var="appender" items='${appenders}'&amp;gt;&lt;br /&gt;   &amp;lt;tr&amp;gt;    &lt;br /&gt;     &amp;lt;td&amp;gt;&amp;lt;c:out value='${appender.getName()}'/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;     &amp;lt;c:forEach var="priority" items='${possiblePriorities}'&amp;gt;&lt;br /&gt;      &amp;lt;td&amp;gt;&lt;br /&gt;         &amp;lt;input type="radio" name="'${appender.getName()}'" value="'${priority}'"&lt;br /&gt;            &amp;lt;c:if test='${appender.getChainedPriority() == priority)}'&amp;gt; checked &amp;lt;/c:if&amp;gt;&lt;br /&gt;         &amp;gt;&lt;br /&gt;      &amp;lt;/td&amp;gt;&lt;br /&gt;     &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;   &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/c:forEach&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;  &amp;lt;td rowspan=5 align="center"&amp;gt; &amp;lt;button type="submit" name="submit" value="update"&amp;gt;Update&amp;lt;/button&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- section of page to add new appender--&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;table style="width:auto;"&amp;gt;&lt;br /&gt;  &amp;lt;tr&amp;gt;&lt;br /&gt;     &amp;lt;td align="center"&amp;gt;&lt;br /&gt;          &amp;lt;input type="text" name="newLogger" size="70"&amp;gt;&lt;br /&gt;     &amp;lt;td&amp;gt;&lt;br /&gt;     &amp;lt;td&amp;gt;&lt;br /&gt;       &amp;lt;select name="newLoggerLevel"&amp;gt;&lt;br /&gt;          &amp;lt;c:forEach var="priority" items='${possiblePriorities}'&amp;gt;&lt;br /&gt;             &amp;lt;option value="&amp;lt;c:out value='${priority}' /&amp;gt;"&amp;gt;&amp;lt;c:out value='${priority}' /&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;         &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;       &amp;lt;/select&amp;gt;&lt;br /&gt;     &amp;lt;td&amp;gt;&lt;br /&gt;     &amp;lt;td&amp;gt;&lt;br /&gt;       &amp;lt;button type="submit" name="submit" value="Add"&amp;gt;Add Logger&amp;lt;/button&amp;gt;&lt;br /&gt;     &amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The idea is to get a view of this sort:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_Wx-8OjwLTqs/RqKgu3CBP5I/AAAAAAAAAAc/XG2VfiGqPxY/s1600-h/log4j_admin.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_Wx-8OjwLTqs/RqKgu3CBP5I/AAAAAAAAAAc/XG2VfiGqPxY/s400/log4j_admin.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5089807255788928914" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Two events can generate from the above page:&lt;br /&gt;1) add a new appender&lt;br /&gt;2) update level of existing appender&lt;br /&gt;&lt;br /&gt;Both of these events can be handled with the below servlet code:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&lt;br /&gt;&lt;br /&gt;import org.apache.log4j.*;&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;Enumeration e = LogManager.getCurrentLoggers();&lt;br /&gt;while (e.hasMoreElements())&lt;br /&gt;{&lt;br /&gt;   Logger logger = (Logger) e.nextElement();&lt;br /&gt;   String prio = request.getParameter(logger.getName());&lt;br /&gt;   if (prio != null &amp;&amp;amp;amp; prio.length() &gt; 0)&lt;br /&gt;   {&lt;br /&gt;       Level p = Level.toLevel(prio);&lt;br /&gt;       if (p != null &amp;&amp;amp; ! p.equals(logger.getEffectiveLevel()))&lt;br /&gt;       {&lt;br /&gt;           logger.setLevel(p);&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}   &lt;br /&gt;&lt;br /&gt;// add new loggers desired&lt;br /&gt;String newLogger = request.getParameter("newLogger");&lt;br /&gt;String newLoggerLevel = request.getParameter("newLoggerLevel");&lt;br /&gt;if (newLogger != null)&lt;br /&gt;{&lt;br /&gt;    Level p = Level.toLevel(newLoggerLevel);&lt;br /&gt;    Logger logger = Logger.getLogger(newLogger);&lt;br /&gt;    logger.setLevel(p);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4346159804599702605?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4346159804599702605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/07/managing-log4j-appenders-runtime.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4346159804599702605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4346159804599702605'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/07/managing-log4j-appenders-runtime.html' title='Managing Log4j Appenders @ Runtime'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Wx-8OjwLTqs/RqKgu3CBP5I/AAAAAAAAAAc/XG2VfiGqPxY/s72-c/log4j_admin.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-1992185304064638729</id><published>2007-06-24T16:35:00.000-07:00</published><updated>2007-06-24T18:06:52.141-07:00</updated><title type='text'>Hibernate fetching strategies</title><content type='html'>A fetching strategy is the strategy Hibernate will use for retrieving associated objects if the application needs to navigate the association. Fetch strategies may be declared in the O/R mapping metadata, or over-ridden by a particular HQL or Criteria query.&lt;br /&gt;&lt;br /&gt;Hibernate3 defines the following fetching strategies:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Join fetching - Hibernate retrieves the associated instance or collection in the same SELECT, using an OUTER JOIN.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&amp;lt;set name="permissions" fetch="join"&amp;gt;&lt;br /&gt;    &amp;lt;key column="userId"/&amp;gt;&lt;br /&gt;    &amp;lt;one-to-many class="Permission"/&amp;gt;&lt;br /&gt;&amp;lt;/set&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&amp;lt;many-to-one name="mother" class="Cat" fetch="join"/&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;Can be specified at query level:&lt;br /&gt;&lt;br&gt;&lt;br /&gt;User user = (User) session.createCriteria(User.class)&lt;br /&gt;                .setFetchMode("permissions", FetchMode.JOIN)&lt;br /&gt;                .add( Restrictions.idEq(userId) )&lt;br /&gt;                .uniqueResult();&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Select fetching - a second SELECT is used to retrieve the associated entity or collection. Unless you explicitly disable lazy fetching by specifying lazy="false", this second select will only be executed when you actually access the association. Use fetch="select" or &lt;a class="missing wiki" href="/trac/paid/wiki/FetchMode" rel="nofollow"&gt;FetchMode?&lt;/a&gt;.Select to accomplish this.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Subselect fetching - a second SELECT is used to retrieve the associated collections for all entities retrieved in a previous query or fetch. Unless you explicitly disable lazy fetching by specifying lazy="false", this second select will only be executed when you actually access the association. Use fetch="subselect" or &lt;a class="missing wiki" href="/trac/paid/wiki/FetchMode" rel="nofollow"&gt;FetchMode?&lt;/a&gt;.&lt;a class="missing wiki" href="/trac/paid/wiki/SubSelect" rel="nofollow"&gt;SubSelect?&lt;/a&gt; to accomplish this.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;* Batch fetching - an optimization strategy for select fetching - Hibernate retrieves a batch of entity instances or collections in a single SELECT, by specifying a list of primary keys or foreign keys. You may also enable batch fetching of collections. For example, if each Person has a lazy collection of Cats, and 10 persons are currently loaded in the Sesssion, iterating through all persons will generate 10 SELECTs, one for every call to getCats(). If you enable batch fetching for the cats collection in the mapping of Person, Hibernate can pre-fetch collections. With a batch-size of 8, Hibernate will load 3, 3, 3, 1 collections in four SELECTs. Again, the value of the attribute depends on the expected number of uninitialized collections in a particular Session. Batch fetching of collections is particularly useful if you have a nested tree of items, ie. the typical bill-of-materials pattern. (Although a nested set or a materialized path might be a better option for read-mostly trees.) &lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em .75em;padding: .25em;width: 780px;"&gt;&lt;pre style="margin: 0;"&gt;&amp;lt;class name="Person"&amp;gt;&lt;br /&gt;    &amp;lt;set name="cats" batch-size="3"&amp;gt;&lt;br /&gt;    ...&lt;br /&gt;    &amp;lt;/set&amp;gt;&lt;br /&gt;&amp;lt;/class&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Hibernate also distinguishes between:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Immediate fetching - an association, collection or attribute is fetched immediately, when the owner is loaded.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Lazy collection fetching - a collection is fetched when the application invokes an operation upon that collection. (This is the default for collections.)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;"Extra-lazy" collection fetching - individual elements of the collection are accessed from the database as needed. Hibernate tries not to fetch the whole collection into memory unless absolutely needed (suitable for very large collections)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Proxy fetching - a single-valued association is fetched when a method other than the identifier getter is invoked upon the associated object.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;"No-proxy" fetching - a single-valued association is fetched when the instance variable is accessed. Compared to proxy fetching, this approach is less lazy (the association is fetched even when only the identifier is accessed) but more transparent, since no proxy is visible to the application. This approach requires buildtime bytecode instrumentation and is rarely necessary.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Lazy attribute fetching - an attribute or single valued association is fetched when the instance variable is accessed. This approach requires buildtime bytecode instrumentation and is rarely necessary. &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;By &lt;strong&gt;default&lt;/strong&gt;, Hibernate3 uses lazy select fetching for collections and lazy proxy fetching for single-valued associations. These defaults make sense for almost all associations in almost all applications.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To enable lazy property loading, set the lazy attribute on your particular property mappings:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt; &lt;pre style="margin: 0;"&gt;&amp;lt;class name="Document"&amp;gt;&lt;br /&gt;       &amp;lt;id name="id"&amp;gt;&lt;br /&gt;        &amp;lt;generator class="native"/&amp;gt;&lt;br /&gt;    &amp;lt;/id&amp;gt;&lt;br /&gt;    &amp;lt;property name="name" not-null="true" length="50"/&amp;gt;&lt;br /&gt;    &amp;lt;property name="summary" not-null="true" length="200" lazy="true"/&amp;gt;&lt;br /&gt;    &amp;lt;property name="text" not-null="true" length="2000" lazy="true"/&amp;gt;&lt;br /&gt;&amp;lt;/class&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-1992185304064638729?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/1992185304064638729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/06/hibernate-fetching-strategies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/1992185304064638729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/1992185304064638729'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/06/hibernate-fetching-strategies.html' title='Hibernate fetching strategies'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-5346726572232569278</id><published>2007-06-09T16:42:00.000-07:00</published><updated>2007-06-09T17:02:34.855-07:00</updated><title type='text'>XWORK external reference resolver</title><content type='html'>XWORK external reference resolver&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Sometimes xwork action classes needs to be wired with external references, for example spring maintained resources. In such cases the dependencies are defined using a &lt;strong&gt;&amp;lt;external-ref&amp;gt;&lt;/strong&gt; tag. For example: see below a sample xwork configuration wherein an action class needs to be wired with a spring maintained datasource:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;br /&gt;&lt;pre style="margin: 0;"&gt;&amp;lt;package name="auditIntegration" extends="auditResultRun"&amp;gt;&lt;br /&gt;    &amp;lt;action name="executeAllAudits" class="com.xxx.AllSchemasAuditAction"&amp;gt;&lt;br /&gt;      &amp;lt;external-ref name="dataSource" required="true"&amp;gt;/db/dw/DataSource&amp;lt;/external-ref&amp;gt;&lt;br /&gt;      &amp;lt;param name="nestedActionName"&amp;gt;executeAudit&amp;lt;/param&amp;gt;&lt;br /&gt;    &amp;lt;/action&amp;gt;&lt;br /&gt;  &amp;lt;/package&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;In such cases external resolvers need to be specified which perform the property setting. XWORK provides a specification using &lt;strong&gt;com.opensymphony.xwork.config.ExternalReferenceResolver&lt;/strong&gt; and provides a default implementation &lt;strong&gt;com.opensymphony.xwork.spring.SpringExternalReferenceResolver&lt;/strong&gt; for spring reference resolver. Custom implementation can be provided to resolve other external references like JNDI dependencies into xwork etc. In any case these external resolvers must be explicitly declared to be used by XWORK. See below for a sample declaration (extends the webwork default config):&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;br /&gt;&lt;pre style="margin: 0;"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;xwork&amp;gt;&lt;br /&gt;  &amp;lt;include file="webwork-default.xml"/&amp;gt;&lt;br /&gt;  &amp;lt;package name="xwork-common" extends="webwork-default"&lt;br /&gt;           externalReferenceResolver="com.xxx.SpringExternalReferenceResolver"&amp;gt;&lt;br /&gt; &amp;lt;/package&amp;gt;&lt;br /&gt;&amp;lt;/xwork&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;Sample implementation for the external resolver (code adapted from XWORK com.opensymphony.xwork.spring.SpringExternalReferenceResolver implementation):&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;br /&gt;&lt;pre style="margin: 0;"&gt;public class SpringExternalReferenceResolver implements com.opensymphony.xwork.config.ExternalReferenceResolver&lt;br /&gt;{&lt;br /&gt;    private static final Logger log = Logger.getLogger(SpringExternalReferenceResolver.class);&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * resolve the references for this invocation&lt;br /&gt;     * @param invocation the invocation to resolve&lt;br /&gt;     * @throws ReferenceResolverException if we had issues.&lt;br /&gt;     */&lt;br /&gt;    public void resolveReferences(ActionInvocation invocation) throws ReferenceResolverException&lt;br /&gt;    {&lt;br /&gt;        ApplicationContext ctx = {{get app context handle here}};&lt;br /&gt;        if (ctx == null)&lt;br /&gt;            throw new IllegalStateException("application context has not been set for this "&lt;br /&gt;                                            + "external reference resolver!");&lt;br /&gt;&lt;br /&gt;        List externalRefs = invocation.getProxy().getConfig().getExternalRefs();&lt;br /&gt;        for (Iterator iter = externalRefs.iterator(); iter.hasNext(); )&lt;br /&gt;        {&lt;br /&gt;            ExternalReference reference = (ExternalReference) iter.next();&lt;br /&gt;            if (log.isDebugEnabled())&lt;br /&gt;                log.debug("resolving " + reference.getName() + " to " + reference.getExternalRef());&lt;br /&gt;            if (reference.getExternalRef() == null)&lt;br /&gt;            {&lt;br /&gt;                throw new ReferenceResolverException(&lt;br /&gt;                    "reference " + reference.getName() + " has no external ref");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            Object bean = null;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                // no such bean exception&lt;br /&gt;                bean = ctx.getBean(reference.getExternalRef());&lt;br /&gt;                if (log.isDebugEnabled())&lt;br /&gt;                    log.debug("resolved " + reference.getExternalRef() + " to " +&lt;br /&gt;                              (bean != null ? bean.getClass().toString() : "null"));&lt;br /&gt;&lt;br /&gt;                // other exceptions&lt;br /&gt;                Map context = Ognl.createDefaultContext(invocation.getAction());&lt;br /&gt;                if (log.isDebugEnabled())&lt;br /&gt;                    log.debug("setting bean into property " + reference.getName() + " of " +&lt;br /&gt;                              invocation.getAction().getClass());&lt;br /&gt;&lt;br /&gt;                // unbelievably, this actually throws a RuntimeException!  Unbelievable&lt;br /&gt;                OgnlUtil.setProperty(reference.getName(), bean, invocation.getAction(),&lt;br /&gt;                                     context, true);&lt;br /&gt;                if (log.isDebugEnabled())&lt;br /&gt;                    log.debug("resolved " + reference.getName() + " to " +&lt;br /&gt;                              reference.getExternalRef() + ": " + bean);&lt;br /&gt;            }&lt;br /&gt;            catch (NoSuchBeanDefinitionException e)&lt;br /&gt;            {&lt;br /&gt;                if (reference.isRequired())&lt;br /&gt;                {&lt;br /&gt;                    //if a dependency is required but wasn't found throw an exception&lt;br /&gt;                    throw new ReferenceResolverException(&lt;br /&gt;                        "Failed to find external reference: " + reference.getExternalRef(), e);&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    log.warn("Bean '" + reference.getExternalRef() +&lt;br /&gt;                             "' could not be found in spring");&lt;br /&gt;                    // just keep going&lt;br /&gt;                    continue;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            catch (Exception e)&lt;br /&gt;            {&lt;br /&gt;                throw new ReferenceResolverException(&lt;br /&gt;                    "Failed to set external reference: " + reference.getExternalRef()&lt;br /&gt;                    + " for bean attribute: " + reference.getName() + ": " + e.getMessage() +&lt;br /&gt;                    " bean hashcode: " + (bean != null ? bean.getClass().hashCode() : -1), e);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        if (log.isDebugEnabled())&lt;br /&gt;            log.debug("external reference resolution for " + invocation.getAction() + " complete.");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5346726572232569278?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5346726572232569278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/06/xwork-external-reference-resolver.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5346726572232569278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5346726572232569278'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/06/xwork-external-reference-resolver.html' title='XWORK external reference resolver'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-4009857880709595940</id><published>2007-06-09T16:33:00.000-07:00</published><updated>2007-06-09T16:37:16.002-07:00</updated><title type='text'>WS-BPEL</title><content type='html'>- &lt;span style="font-weight:bold;"&gt;What is WS-BPEL?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An XML-based grammar for describing the logic to orchestrate the interaction between Web services in a business process. It defines a set of basic control structures like conditions or loops as well as elements to invoke web services and receive messages from services. It relies on WSDL to express web services interfaces. Message structures can be manipulated, assigning parts or the whole of them to variables that can in turn be used to send other messages.&lt;br /&gt;&lt;br /&gt;- &lt;span style="font-weight:bold;"&gt;Why is it needed?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;• Web services --&gt; move towards service-oriented computing&lt;br /&gt;• Applications are viewed as “services”&lt;br /&gt;• Loosely coupled, dynamic interactions&lt;br /&gt;• Heterogeneous platforms&lt;br /&gt;• No single party has complete control&lt;br /&gt;• How do you compose services in this domain?&lt;br /&gt;• WSDL defined Web services have a stateless interaction model&lt;br /&gt;    • Messages are exchanged using&lt;br /&gt;       • Synchronous invocation&lt;br /&gt;       • Uncorrelated asynchronous invocations&lt;br /&gt;    • Most “real-world” business processes require a more robust interaction model&lt;br /&gt;    • Support for Messages exchanged in a two-way, peer-to-peer conversation lasting minutes, hours, days, etc.&lt;br /&gt;    • BPEL provides the ability to express stateful, long-running interactions&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;- &lt;span style="font-weight:bold;"&gt;Relationship with WSDL?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BPEL is layered on top of and extends the WSDL service model&lt;br /&gt;• WSDL defines the specific operations allowed&lt;br /&gt;• BPEL defines how WSDL operations are orchestrated to satisfy a business process&lt;br /&gt;• BPEL also specifies extensions to WSDL in support of long-running asynchronous business processes&lt;br /&gt;• Expressed entirely in XML&lt;br /&gt;• Uses and extends WSDL 1.1&lt;br /&gt;• Uses XML Schema 1.0 for the data model&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;- What is Apache ODE?&lt;/span&gt;&lt;br /&gt;Apache ODE (Orchestration Director Engine) executes business processes written following the WS-BPEL standard. It talks to web services, sending and receiving messages, handling data manipulation and error recovery as described by your process definition. It supports both long and short living process executions to orchestrate all the services that are part of your application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;- References&lt;br /&gt;• &lt;a href="http://www.oasis-open.org/committees/download.php/23069/The%20Business%20Value%20of%20WS-BPEL%20for%20Business%20Analysts%20and%20Managers%20-%20Part%202%20(Chris%20Keller).pdf"&gt;Real use cases scenarios &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-4009857880709595940?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/4009857880709595940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/06/ws-bpel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4009857880709595940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/4009857880709595940'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/06/ws-bpel.html' title='WS-BPEL'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-1986989596581972581</id><published>2007-05-25T23:15:00.000-07:00</published><updated>2007-05-30T11:58:55.814-07:00</updated><title type='text'>ACEGI Authentication Provider Examples</title><content type='html'>Acegi provides a very flexible way to configure the authentication provider. By default it provides two implementations of the authentication provider&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;InMemoryDaoImpl&lt;/strong&gt; : Retrieves user details from an in-memory list created by the bean context. So basically the list of users and their passwords are specified in the bean configuration file. (http://www.acegisecurity.org/multiproject/acegi-security/apidocs/org/acegisecurity/userdetails/memory/InMemoryDaoImpl.html). See below for sample bean configuration&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;br /&gt;&lt;pre style="margin: 0;"&gt;&amp;lt;bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl"&amp;gt;&lt;br /&gt;    &amp;lt;property name="userMap"&amp;gt;&lt;br /&gt;       &amp;lt;value&amp;gt;&lt;br /&gt;           marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR&lt;br /&gt;           dianne=emu,ROLE_TELLER&lt;br /&gt;           scott=wombat,ROLE_TELLER&lt;br /&gt;           peter=opal,disabled,ROLE_TELLER&lt;br /&gt;       &amp;lt;/value&amp;gt;&lt;br /&gt;   &amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;- &lt;strong&gt;JdbcDaoImpl&lt;/strong&gt; : Retrieves user details (username, password, enabled flag, and authorities) from a JDBC location. A default database structure is assumed, which most users of this class will need to override, if using an existing schema. This may be done by setting the default query strings used. If this does not provide enough flexibility, another strategy would be to subclass this class and override the MappingSqlQuery instances used, via the initMappingSqlQueries() extension point. (http://www.acegisecurity.org/multiproject/acegi-security/apidocs/org/acegisecurity/userdetails/jdbc/JdbcDaoImpl.html). See below for code sample to configure using a jdbc driver or a datasource. Irrespective of the database used and how a DataSource is obtained, a standard schema must exist in the database&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;br /&gt;&lt;pre style="margin: 0;"&gt;-- USING JDBC Driver&lt;br /&gt;&amp;lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&amp;gt;&lt;br /&gt;   &amp;lt;property name="driverClassName"&amp;gt;&amp;lt;value&amp;gt;org.hsqldb.jdbcDriver&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;   &amp;lt;property name="url"&amp;gt;&amp;lt;value&amp;gt;jdbc:hsqldb:hsql://localhost:9001&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;   &amp;lt;property name="username"&amp;gt;&amp;lt;value&amp;gt;sa&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;   &amp;lt;property name="password"&amp;gt;&amp;lt;value&amp;gt;&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;-- Using Datasource&lt;br /&gt;&amp;lt;bean id="jdbcDaoImpl" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl"&amp;gt;&lt;br /&gt;   &amp;lt;property name="dataSource"&amp;gt;&amp;lt;ref bean="dataSource"/&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;- &lt;strong&gt;Custom implementation&lt;/strong&gt; : The above two implementations basically implement the UserDetailsService interface. If you have complex needs (such as a special schema or would like a certain UserDetails implementation returned), you'd be better off writing your own UserDetailsService(http://www.acegisecurity.org/multiproject/acegi-security/apidocs/index.html?org/acegisecurity/userdetails/UserDetailsService.html). &lt;br /&gt;&lt;br /&gt;Code Sample:&lt;br /&gt;&lt;div style="background-color:#f7f7f7;border: 1px solid #d7d7d7;margin: 1em 1.75em;padding: .25em;width: 780px;"&gt;&lt;br /&gt;&lt;pre style="margin: 0;"&gt;&amp;lt;bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"&amp;gt;&lt;br /&gt;      &amp;lt;property name="providers"&amp;gt;&lt;br /&gt;         &amp;lt;list&amp;gt;&lt;br /&gt;            &amp;lt;ref local="daoAuthenticationProvider"/&amp;gt;&lt;br /&gt;         &amp;lt;/list&amp;gt;&lt;br /&gt;      &amp;lt;/property&amp;gt;&lt;br /&gt;   &amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider"&amp;gt;&lt;br /&gt;      &amp;lt;property name="userDetailsService"&amp;gt;&amp;lt;ref bean="UserService"/&amp;gt;&amp;lt;/property&amp;gt;    &lt;br /&gt;   &amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;bean id="UserService" class = "com.icrossing.xxx.CustomAuthenticationProvider"/&amp;gt;&lt;br /&gt;&lt;br /&gt;-- Sample implementation&lt;br /&gt;&lt;br /&gt;class CustomAuthenticationProvider implements org.acegisecurity.userdetails.UserDetailsService&lt;br /&gt;{&lt;br /&gt;   public UserDetails loadUserByUsername(String userId) throws UsernameNotFoundException, DataAccessException &lt;br /&gt;   {&lt;br /&gt;        User user = null;&lt;br /&gt;        GrantedAuthority[] grantedAuthorities = null;&lt;br /&gt;        try {&lt;br /&gt;            user = getUserDAO().lookupUser(userId);&lt;br /&gt;            &lt;br /&gt;            if(user==null) {&lt;br /&gt;                throw new UsernameNotFoundException("Invalid User");            &lt;br /&gt;            }&lt;br /&gt;            &lt;br /&gt;            Set roles = user.getRoles();&lt;br /&gt;            int i = 0;&lt;br /&gt;            grantedAuthorities = new GrantedAuthority[roles.size()];&lt;br /&gt;            for (Iterator iter = roles.iterator(); iter.hasNext(); i++) {&lt;br /&gt;                Role role = (Role) iter.next();&lt;br /&gt;                &lt;br /&gt;                GrantedAuthority authority = new GrantedAuthorityImpl(role.getRole());&lt;br /&gt;                grantedAuthorities[i] = authority;&lt;br /&gt;            }&lt;br /&gt;        } catch (DataStoreException e) {&lt;br /&gt;            throw new DataRetrievalFailureException("Cannot loadUserByUsername userId:"+userId+ " Exception:" + e.getMessage(), e);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        UserDetails userDetails = new org.acegisecurity.userdetails.User(&lt;br /&gt;                user.getUserId(), &lt;br /&gt;                user.getPassword(),&lt;br /&gt;                user.isEnabled(), //enabled&lt;br /&gt;                user.isEnabled(), //accountNonExpired&lt;br /&gt;                user.isEnabled(), //credentialsNonExpired&lt;br /&gt;                user.isEnabled(), //accountNonLocked&lt;br /&gt;                grantedAuthorities&lt;br /&gt;                );&lt;br /&gt;        return userDetails;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-1986989596581972581?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/1986989596581972581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/acegi-authentication-provider-examples.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/1986989596581972581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/1986989596581972581'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/acegi-authentication-provider-examples.html' title='ACEGI Authentication Provider Examples'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-5218500354671512788</id><published>2007-05-25T16:43:00.000-07:00</published><updated>2007-05-25T23:06:45.481-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apache commons net ftpclient buffer'/><category scheme='http://www.blogger.com/atom/ns#' term='apache commons net ftpclient default buffer'/><title type='text'>FTPClient Default Buffer Policy</title><content type='html'>Just found this while researching the buffer policy of org.apache.commons.net.ftp.FTPClient (Apache commons net FTP).&lt;br /&gt;&lt;br /&gt;Methods storeFile() and retrieveFile() in FTPClient use a default buffer size of 1024 (http://jakarta.apache.org/commons/net/apidocs/org/apache/commons/net/io/Util.html#DEFAULT_COPY_BUFFER_SIZE).&lt;br /&gt;&lt;br /&gt;Methods storeFileAsStream() and retrieveFileStream() do not use a default buffer when file type is BINARY however when file type is ASCII they use a default buffer of 1024. Here's the developer's comment as to why&lt;br /&gt;&lt;br /&gt;// We buffer ascii transfers because the buffering has to   &lt;br /&gt;// be interposed between ToNetASCIIOutputSream and the underlying&lt;br /&gt;// socket output stream.  We don't buffer binary transfers&lt;br /&gt;// because we don't want to impose a buffering policy on the&lt;br /&gt;// programmer if possible.  Programmers can decide on their&lt;br /&gt;// own if they want to wrap the SocketOutputStream we return&lt;br /&gt;// for file types other than ASCII.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-5218500354671512788?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/5218500354671512788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/ftpclient-default-buffer-policy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5218500354671512788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/5218500354671512788'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/ftpclient-default-buffer-policy.html' title='FTPClient Default Buffer Policy'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-1565725493354016134</id><published>2007-05-22T17:39:00.000-07:00</published><updated>2007-08-23T14:38:44.313-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apache commons net ftpclient socket timeout'/><category scheme='http://www.blogger.com/atom/ns#' term='apache commons net ftpclient data timeout'/><category scheme='http://www.blogger.com/atom/ns#' term='apache commons net ftpclient default timeout'/><category scheme='http://www.blogger.com/atom/ns#' term='apache commons net ftpclient timeout'/><title type='text'>FTPClient timeout values</title><content type='html'>In looking at the docs for org.apache.commons.net.ftp.FTPClient there are three timeouts which can be configured: &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;setDefaultTimeout&lt;/strong&gt; : Set the default timeout in milliseconds to use when opening a socket. This value is only used previous to a call to connect() and should not be confused with setSoTimeout() which operates on an the currently opened socket. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;setSoTimeout&lt;/strong&gt; : Set the timeout in milliseconds of a currently open connection. Only call this method after a connection has been opened by connect().&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;setDataTimeout&lt;/strong&gt; : Sets the timeout in milliseconds to use when reading from the data connection. This timeout will be set immediately after opening the data connection. &lt;br /&gt;&lt;br /&gt;This seemed confusing so I went ahead and peeked at the source code for FTPClient and the whole thing made sense. So basically the FTPClient uses the underlying java.net.Socket and the various timeouts apply at the various stages of socket usage.&lt;br /&gt;&lt;br /&gt;if the &lt;strong&gt;setDefaultTimeout&lt;/strong&gt; is set then the underlying java.net.Socket.setSoTimeout() is set and is used default for all connections made using this FTPClient instance.  It basically saves you the trouble of calling setSoTimeout after every connection establishment.&lt;br /&gt;&lt;br /&gt;if &lt;strong&gt;setSoTimeout&lt;/strong&gt; is set then the underlying java.net.Socket.setSoTimeout() is set for the current connection and at disconnect() the value reverts back to the defaultTimeout set using the setDefaultTimeout. If you call it before connecting, you'll get a NullPointerException&lt;br /&gt;&lt;br /&gt;if &lt;strong&gt;setDataTimeout&lt;/strong&gt; is set then the underlying java.net.Socket.setSoTimeout() is set before a read is performed and after the read completion the timeout value is restored to the pre-read state so basically should be called before a data connection is established (e.g., a file transfer) because it doesn't affect an active data connection. Usually when a read() method tries to read data from a socket the program will block until the data arrives. However, if you set the timeout property, the read() will only wait the specified number of milliseconds. Then, if no data was received, it will throw an InterruptedIOException. The data timeout specified blocks for each socket read() call and is not cumulative of all read calls.&lt;br /&gt;&lt;br /&gt;It seems obvious that defaultTimeout will suffice the purpose however there might be need have read specific dataTimeouts (e.g., you don't want a 2 gb file transfer to die just because there is a 10 minute loss of connectivity)...&lt;br /&gt;&lt;br /&gt;On another note what value is optimal to set for timeout given its implications at various stages? Online research recommends: timeout for connect : 5 secs, write/reads : 120 secs&lt;br /&gt;&lt;br /&gt;Update: 08/23/2007&lt;br /&gt;So the interesting fact is after all the babbling above I was not able to make the above timeouts to work So here's what I tried: I have a file of size 57mb and I tried setting various combinations of timeouts for upload:&lt;br /&gt;&lt;br /&gt;- set defaultTimeout (120 secs) and dataTimeout (1200 secs) before establishing login connection --&gt; Result: upload failed with timeout&lt;br /&gt;&lt;br /&gt;- set defaultTimeout (120 secs) before login connection and dataTimeout (1200 secs) after login connection (1200 secs) - Result: upload failed with timeout&lt;br /&gt;&lt;br /&gt;- set defaultTimeout (120 secs) before login connection and after login connection (1200 secs) connection --&gt; Result: upload failed with timeout&lt;br /&gt;&lt;br /&gt;- set defaultTimeout (1200 secs) before login connection --&gt; Result: upload succeeded&lt;br /&gt;&lt;br /&gt;So I tried the above @ various times to make sure I am not dealing with a nework spike or any of that sort and got the same results. I will update once I find more on this stuff.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-1565725493354016134?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/1565725493354016134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/ftpclient-timeout-values.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/1565725493354016134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/1565725493354016134'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/ftpclient-timeout-values.html' title='FTPClient timeout values'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-7574789314698869269</id><published>2007-05-02T11:04:00.000-07:00</published><updated>2007-05-02T11:19:47.817-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JUnit outofmemory'/><title type='text'>OutOfMemory issue in JUnit</title><content type='html'>Recently one of my colleague encountered this issue when running a JUnit test. Inspite of increasing the -vm settings the error kept coming. On further research we found that if JUnit is set with "fork=true" the task will be executed in forked VM. So the memory settings of default VM will not effective. So, you need to set maxmemory attribute of JUnit to avoid OutOfMemory? exception.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;&amp;lt;target name="test.class.inner" if="test.class"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;echo message="test.classpath"/&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;mkdir dir="${test.output.dir}"/&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;mkdir dir="${build.dir}/tmp"/&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;junit dir="${build.dir}" haltonfailure="yes" haltonerror="yes" printsummary="on"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fork="true" filtertrace="true" '''maxmemory="1024m"'''&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sysproperty key="merchantize.env" value="test"/&gt;&lt;br /&gt;....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-7574789314698869269?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/7574789314698869269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/outofmemory-issue-in-junit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7574789314698869269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/7574789314698869269'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2007/05/outofmemory-issue-in-junit.html' title='OutOfMemory issue in JUnit'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-116554161907099415</id><published>2006-12-07T16:59:00.000-07:00</published><updated>2007-05-02T11:23:18.411-07:00</updated><title type='text'>Hibernate mapping legacy data</title><content type='html'>I recently encountered this while working with Hibernate. Mapping legacy data where foreign key does not refer to a primary key of the associated table is complex and is not generated correctly using many of the IDE's out there.  You basically have to do some tweakings to make it work.&lt;br /&gt;&lt;br /&gt;Two cases arise:&lt;br /&gt;1) when foreign key refers to a unique key of the associated table&lt;br /&gt;2) when foreign key refers to a non-primary/non-unique key&lt;br /&gt;&lt;br /&gt;You will get an error of similar sort when mapping without the tweakings in the above cases:&lt;br /&gt;&lt;br /&gt;[java] org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id])&lt;br /&gt;&gt;      [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90)&lt;br /&gt;&gt;      [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73)&lt;br /&gt;&gt;      [java] at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1182)&lt;br /&gt;&gt;      [java] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1089)&lt;br /&gt;&gt;      [java] at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)&lt;br /&gt;&gt;      [java] at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The trick is to utilize the "property-ref" attribute to solve the above mapping issue.&lt;br /&gt;&lt;br /&gt;Consider you have two tables:&lt;br /&gt;Employee (emp_ID,   emp_SSN,  emp_Name)&lt;br /&gt;Manager (mgr_SSN, mgr_Id)&lt;br /&gt;&lt;br /&gt;In employee table empID is the primary key and empSSN is unique. Manager table has a many-to-one relation with the employee table with one manager can be assigned to multiple departments.&lt;br /&gt;&lt;br /&gt;In Employee.hbm.xml file the empSSN would be defined like this:&lt;br /&gt;&lt;br /&gt;        &amp;lt;property name="empSSN" type="java.lang.Integer"&gt;&lt;br /&gt;            &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;column name="emp_SSN" not-null="true" unique="true" /&gt;&lt;br /&gt;        &amp;lt;/property&gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;set name="managers" inverse="true"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key property-ref="empSSN"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;column name="mgr_SSN" not-null="true" /&gt;                &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/key&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;one-to-many class="com.hibernate.mapping.Manager"/&gt;&lt;br /&gt;        &amp;lt;/set&gt;&lt;br /&gt;&lt;br /&gt;In manager.hbm.xml the property will be defined like this&lt;br /&gt;&lt;br /&gt;        &amp;lt;property name="mgrSSN" type="java.lang.Integer"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;column name="mgr_SSN" not-null="true" /&gt;&lt;br /&gt;&amp;lt;/property&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;many-to-one name="employee" class="com.hibernate.mapping.Employee" update="false" insert="false" fetch="select" property-ref="empSSN" column="mgr_SSN" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This should make it work!!!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some other resources:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.theserverside.com/discussions/thread.tss?thread_id=37010"&gt;Post on Serverside&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html"&gt;Hibernate Docs&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-116554161907099415?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/116554161907099415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2006/12/hibernate-mapping-legacy-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/116554161907099415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/116554161907099415'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2006/12/hibernate-mapping-legacy-data.html' title='Hibernate mapping legacy data'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33560925.post-115689376794885672</id><published>2006-08-29T16:20:00.000-07:00</published><updated>2006-08-29T16:22:47.956-07:00</updated><title type='text'>SSL setup with MSN Adcenter</title><content type='html'>&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;&lt;div style="text-align: left;"&gt;I will be posting a series of blogs on my experiences with working on a project utilizing the Microsoft adcenter as I encounter them. Let me share my experience with the security set up I struggled with initially&lt;br /&gt;&lt;br /&gt;Platform: Linux&lt;br /&gt;environment: J2EE&lt;br /&gt;&lt;br /&gt;I kept getting the error&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;in the initial stage. The first time I encountered this error was during the WSDL to JAVA source creation. The WSDL's are hosted on a secure site (https://beta6.api.idss.msn.com/v2) and thus needed the certs to be stored in the keystore. I circumvented it by downloading the WSDL's from browser and supplying local file URL as parameter to axis's WSDL2Java utility and that created the source files.&lt;br /&gt;&lt;br /&gt;The error came back to haunt me as the webservice is also hosted on a secure site. I downloaded the certificate from the adcenter UI on sandbox (https://beta1.idss.msn.com/) using IE browser&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(Double click the SSL lock icon in the bottom pane in the IE browser --&gt; Details tab --&gt; Copy to file --&gt; [[format]] DER X.509)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;and stored the cert in my local keystore using the command&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;keytool -import -file [[saved cert file loc]] -alias sandbox_api_cert -keystore MSN_Keystore&lt;br /&gt;&lt;/span&gt;VM Arguments:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-Djavax.net.ssl.trustStore = [[keystore location]]&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;-Djavax.net.ssl.trustStorePassword = [[passwd]]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;However this did not solve the problem.&lt;br /&gt;&lt;br /&gt;On further research I found that "&lt;span style="font-style: italic;"&gt;if you use a certificate not signed by a pre-installed certificate authority (=root cert), you need to import both your cert and the root cert&lt;/span&gt;". I checked the browser to see the root cert&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(Double click the SSL lock icon in the bottom pane in the IE browser --&gt; Certification Path tab) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and voila!!!! the cert was internally chained 3 times (GTE CyberTrust Global Root --&gt; Microsoft Internet Authority --&gt; Microsoft Secure Server Authority --&gt; Beta1.idss.msn.com). I had already entered the cert for Beta1.idss.msn.com in my local keystore (as explained above) and so I proceeded to check if the certs for the other chain members are available in the jdk1.5.0_04/jre/lib/security/cacerts file using the command&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;keytool -v -list -keystore cacerts | grep gte&lt;/span&gt;&lt;br /&gt;Enter keystore password:  changeit&lt;br /&gt;Alias name: gtecybertrustglobalca&lt;br /&gt;Alias name: gtecybertrustca&lt;br /&gt;Alias name: gtecybertrust5ca&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;keytool -v -list -keystore cacerts -alias gtecybertrustglobalca&lt;/span&gt;&lt;br /&gt;Enter keystore password:  changeit&lt;br /&gt;Alias name: gtecybertrustglobalca&lt;br /&gt;Creation date: May 10, 2002&lt;br /&gt;Entry type: trustedCertEntry&lt;br /&gt;&lt;br /&gt;Owner: CN=&lt;span style="font-weight: bold;"&gt;GTE CyberTrust Global Root&lt;/span&gt;, OU="GTE CyberTrust Solutions, Inc.", O=GTE Corporation, C=US&lt;br /&gt;Issuer: CN=GTE CyberTrust Global Root, OU="GTE CyberTrust Solutions, Inc.", O=GTE Corporation, C=US&lt;br /&gt;Serial number: 1a5&lt;br /&gt;Valid from: Wed Aug 12 17:29:00 MST 1998 until: Mon Aug 13 16:59:00 MST 2018&lt;br /&gt;Certificate fingerprints:&lt;br /&gt;       MD5:  CA:3D:D3:68:F1:03:5C:D0:32:FA:B8:2B:59:E8:5A:DB&lt;br /&gt;       SHA1: 97:81:79:50:D8:1C:96:70:CC:34:D8:09:CF:79:44:31:36:7E:F4:74&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;keytool -v -list -keystore cacerts | grep microsoft&lt;/span&gt;&lt;br /&gt;Enter keystore password:  changeit&lt;br /&gt;&lt;br /&gt;So the middle chain members Microsoft Internet Authority --&gt; Microsoft Secure Server Authority were not available in my cacerts file. I went ahead and downloaded these certs from the browser&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(Double click the SSL lock icon in the bottom pane in the IE browser --&gt; Certification Path tab --&gt; click on each certicate --&gt; View Certificate)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;and follow the procedure above to save and enter the cert into local keystore. Once I did this the previous problem was resolved however I was getting a new error&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"java.security.cert.CertPathValidatorException: signature check failed"&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;I was pretty sure that one of my certs was wrong so I checked the WSDL to see where the webservice was hosted and it was different from where the UI was hosted. It was hosted on https://beta6.api.idss.msn.com. So I went ahead and downloaded the cert and stored it under local keystore and this resolved all the SSL errors.&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;   &lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33560925-115689376794885672?l=sudhirvn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudhirvn.blogspot.com/feeds/115689376794885672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sudhirvn.blogspot.com/2006/08/ssl-setup-with-msn-adcenter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/115689376794885672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33560925/posts/default/115689376794885672'/><link rel='alternate' type='text/html' href='http://sudhirvn.blogspot.com/2006/08/ssl-setup-with-msn-adcenter.html' title='SSL setup with MSN Adcenter'/><author><name>Sudhir</name><uri>http://www.blogger.com/profile/09080281818875815184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/x/blogger/4796/709/200/252937/IMG_0655_web.jpg'/></author><thr:total>0</thr:total></entry></feed>
