<?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-14922998</id><updated>2012-02-16T07:15:58.167-08:00</updated><category term='SQLSERVER'/><category term='tgz'/><category term='RESTful services'/><category term='REST'/><category term='kubuntu'/><category term='vmware'/><category term='dia'/><category term='technical tip'/><category term='webcam'/><category term='maven'/><category term='tomcat'/><category term='JSR286'/><category term='sifybbclient'/><category term='ascii conversion'/><category term='open source'/><category term='ubuntu 9.10'/><category term='gz'/><category term='kopete'/><category term='sql injection'/><category term='myfaces'/><category term='oracle'/><category term='ubuntu sound'/><category term='hdmi'/><category term='jetty'/><category term='unix'/><category term='trinidad'/><category term='portlet 2.0'/><category term='video'/><category term='josso'/><category term='eclipse'/><category term='ubuntu'/><category term='jetpseed2.0'/><category term='oraclexe'/><title type='text'>Technology</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default?start-index=101&amp;max-results=100'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>103</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-14922998.post-7701534495667445903</id><published>2011-09-22T23:05:00.000-07:00</published><updated>2011-09-22T23:05:57.767-07:00</updated><title type='text'>Planning for failure</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Process in IT companies looks a very ambiguous word. What looks fine in one company may not be acceptable in another company.&amp;nbsp; I come across this site http://www.planningforfailure.com which&amp;nbsp; compared the agile/Scrum with Kanban/Lean startup. It is an interesting read. Also the links mentioned in the blog are good.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I also like the definition of a hacker. &lt;br /&gt;"Someone who thinks outside the box. Someone who discards conventional wisdom and does something else instead. Someone who looks at the edge and wonders what's beyond. Someone who sees a set of rules and wonders what happens if you don't follow them. &lt;span&gt;&lt;em&gt;- Bruce Schneie"&amp;nbsp;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;em&gt;from http://www.thehackerchickblog.com/&amp;nbsp;&lt;/em&gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-7701534495667445903?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/7701534495667445903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=7701534495667445903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/7701534495667445903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/7701534495667445903'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2011/09/planning-for-failure.html' title='Planning for failure'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-8672017799337098053</id><published>2011-02-05T05:51:00.000-08:00</published><updated>2011-02-05T05:59:17.803-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jetty'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Debug maven application with jetty plugin</title><content type='html'>Have the jetty plugin configured.&lt;br /&gt;        &amp;lt;plugin&amp;gt;&lt;br /&gt;         &amp;lt;groupId&amp;gt;org.mortbay.jetty&amp;lt;/groupId&amp;gt;&lt;br /&gt;        &amp;lt;artifactId&amp;gt;maven-jetty-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;         &amp;lt;version&amp;gt;6.1.12&amp;lt;/version&amp;gt;&lt;br /&gt;         &amp;lt;configuration&amp;gt;&lt;br /&gt;          &amp;lt;scanIntervalSeconds&amp;gt;10&amp;lt;/scanIntervalSeconds&amp;gt;&lt;br /&gt;          &amp;lt;connectors&amp;gt;&lt;br /&gt;            &amp;lt;connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"&amp;gt;&lt;br /&gt;              &amp;lt;port&amp;gt;8888&amp;lt;/port&amp;gt;&lt;br /&gt;              &amp;lt;maxIdleTime&amp;gt;60000&amp;lt;/maxIdleTime&amp;gt;&lt;br /&gt;            &amp;lt;/connector&amp;gt;&lt;br /&gt;          &amp;lt;/connectors&amp;gt;&lt;br /&gt;         &amp;lt;/configuration&amp;gt;&lt;br /&gt;        &amp;lt;/plugin&amp;gt;&lt;br /&gt;&lt;br /&gt;After that It’s time to configure eclipse for debugging the web app by selecting the Run &gt; Debug … from the menu&lt;br /&gt;# Set Main Class to "org.codehaus.classworlds.Launcher"&lt;br /&gt;&lt;br /&gt;Go to the argument tab:&lt;br /&gt;# Set Program arguments to "jetty:run"&lt;br /&gt;# Set VM arguments to "-Xmx512M -Dclassworlds.conf=[MAVEN_HOME]/bin/m2.conf -Dmaven.home=[MAVEN_HOME]"&lt;br /&gt;(Replace MAVEN_HOME with the location of maven on your system)&lt;br /&gt;&lt;br /&gt;Go to the classpath tab:&lt;br /&gt;# remove the application from the user entries&lt;br /&gt;# add the "[MAVEN_HOME]/lib/classworlds.jar" to the user entries. in case if the classworlds.jar have version number in the name, please include. Essentially we need to add the correct jar to the classpath&lt;br /&gt;&lt;br /&gt;Go to the source tab:&lt;br /&gt;# add the current project to debug&lt;br /&gt;&lt;br /&gt;Now you can start debugging your application like you do it always&lt;br /&gt;&lt;br /&gt;It is very interesting to set the –o option to the maven command in order to accelerate the fix/debug process.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-8672017799337098053?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/8672017799337098053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=8672017799337098053' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8672017799337098053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8672017799337098053'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2011/02/debug-maven-application-with-jetty.html' title='Debug maven application with jetty plugin'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-7986384277330429491</id><published>2010-08-02T00:34:00.000-07:00</published><updated>2010-08-02T00:35:08.249-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oraclexe'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>how to change oracle xe default http port number?</title><content type='html'>login to sqlpus with system account. &lt;br /&gt;sqlplus system@xe&lt;br /&gt;&lt;br /&gt;see the present value&lt;br /&gt;&lt;br /&gt;select dbms_xdb.gethttpport as "HTTP-Port", bms_xdb.getftpport as "FTP-Port" from dual;&lt;br /&gt;&lt;br /&gt;--it shows  actual value. now u want to change them, use the following?&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;&lt;br /&gt;   dbms_xdb.sethttpport('9999'); &lt;br /&gt;   dbms_xdb.setftpport('2100'); &lt;br /&gt;end;&lt;br /&gt;/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-7986384277330429491?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/7986384277330429491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=7986384277330429491' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/7986384277330429491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/7986384277330429491'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2010/08/how-to-change-oracle-xe-default-http.html' title='how to change oracle xe default http port number?'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-7268944883402132259</id><published>2010-01-16T14:35:00.000-08:00</published><updated>2010-01-16T14:38:55.865-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu 9.10'/><category scheme='http://www.blogger.com/atom/ns#' term='vmware'/><title type='text'>vmserver 2.0.2 ubuntu 9.10</title><content type='html'>vmserver 2.0.2 licenses:&lt;br /&gt;VMware Server for Windows A05FN-F2R0Z-V9380-4T085&lt;br /&gt;VMware Server for Linux AA4D0-F8D2G-U7JGM-4100H&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I had problem in installing vmserver in ubuntu 9.10. This &lt;a href="http://radu.cotescu.com/2009/10/30/how-to-install-vmware-server-2-0-x-on-ubuntu-9-10-karmic-koala/"&gt;link&lt;/a&gt; helped me to fix the problem. While trying the patch, it was showing error for a specific patch file that i have downloaded manually and placed along with the attahcment given in the post.&lt;br /&gt;&lt;br /&gt;it worked, have to see bringing up my vm images.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-7268944883402132259?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/7268944883402132259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=7268944883402132259' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/7268944883402132259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/7268944883402132259'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2010/01/vmserver-202-ubuntu-910.html' title='vmserver 2.0.2 ubuntu 9.10'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-2981713766692835139</id><published>2009-08-28T00:05:00.000-07:00</published><updated>2009-08-28T00:15:29.831-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webcam'/><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='hdmi'/><category scheme='http://www.blogger.com/atom/ns#' term='kopete'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu - hdmi, video, webcam</title><content type='html'>I had problem with hdmi audio from ubuntu. Video is going fine to LCD tv through HDMI cable, but no audio.&lt;br /&gt;&lt;br /&gt;Not sure if that is a problem with operating system or the multimedia softwares, but I found mplayer supporting audio as well.&lt;br /&gt;&lt;br /&gt;Following line has fixed hdmi audio for me.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;mplayer -afm hwac3,hwdts, -ao alsa:device=hdmi -channels 2 file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Skype, web cam:&lt;br /&gt;Web cam was not detected by skype on ubuntu (9.04). After searching on internet, installed gspcs-source, followed by a system restart.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;sudo apt-get install gspca-source&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Skype recognized my webcam and when ever I am on voice call with my skype contacts, I am able to share video through webcam.&lt;br /&gt;&lt;br /&gt;Kopete, yahoo IM problem:&lt;br /&gt;Kopete was not able to connect to Yahoo server. fix I found on internet is add subdomain "cn" in the server name (account preferences). this "cn.scs.msg.yahoo.com" one worked for me. the default port of 5050 is same.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;kopete is not able to detect webcam. It needs jasper conversion utility installed. I tried to to install libjasper-progs, but it seems replaced by another one in the ubuntu repository.&lt;br /&gt;Here is the line that worked for me.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;sudo apt-get install libjasper-runtime&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-2981713766692835139?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/2981713766692835139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=2981713766692835139' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2981713766692835139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2981713766692835139'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/08/ubuntu-hdmi-video-webcam.html' title='Ubuntu - hdmi, video, webcam'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-6542522740664934349</id><published>2009-08-04T01:58:00.000-07:00</published><updated>2009-08-04T02:00:19.689-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu sound'/><title type='text'>Low volumne in ubuntu</title><content type='html'>If you are struck up with low volumn in Ubuntu (even in 9.04)&lt;br /&gt;do the following:&lt;br /&gt;&lt;br /&gt;sudo apt-get install gnome-alsamixer&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;after installing gnome-alsamixer run it, it pops up a UI. Increase the PCM value towards maximum. &lt;br /&gt;&lt;br /&gt;try the sound now, you got it full right?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-6542522740664934349?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/6542522740664934349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=6542522740664934349' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6542522740664934349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6542522740664934349'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/08/low-volumne-in-ubuntu.html' title='Low volumne in ubuntu'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-3400582952106391463</id><published>2009-07-29T06:00:00.000-07:00</published><updated>2009-07-29T06:01:38.221-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Linux /Ubuntu  tomcat -&gt; too many open files</title><content type='html'>Issue:&lt;br /&gt;How do I set the maximum number of files allowed to be open on a system&lt;br /&gt;scenario: I am running 3 war files of magnolia CMS on local tomcat, third one is not getting deployed properly because of the "too many files" opened. &lt;br /&gt;&lt;br /&gt;Resolution:&lt;br /&gt;The current setting for maximum number of open files can be viewed with the command:&lt;br /&gt;&lt;br /&gt;    ulimit -n&lt;br /&gt;&lt;br /&gt;This number indicates the maximum number of files normal users (i.e. non-root) can have open in a single session. Note that for the root user, ulimit -n will sometimes output 1024 even after following the procedure to increase the maximum number of open files. This won't effect root's ability to open large numbers of files, as only normal users are bound by this value.&lt;br /&gt;&lt;br /&gt;To increase the maximum number of open files beyond the default of 1024, two changes to the system may be necessary. In these examples, we will increase the maximum number of open files to the arbitrary value of 2048. All changes need to be made by the root user and users will need to log out and log back in before the changes will take effect.&lt;br /&gt;&lt;br /&gt;   1. Configure the system to accept the desired value for maximum number of open files Check the value in /proc/sys/fs/file-max to see if it is larger than the value needed for the maximum number of open files:&lt;br /&gt;&lt;br /&gt;      # cat /proc/sys/fs/file-max&lt;br /&gt;&lt;br /&gt;      If the value isn't large enough, echo an appropriate number into the variable and add the change to /etc/sysctl.conf to make it persistent across reboots. If the number is already larger than the value you wish to use, skip to step 2.&lt;br /&gt;&lt;br /&gt;      # echo 2048 &gt; /proc/sys/fs/file-max&lt;br /&gt;&lt;br /&gt;      and edit /etc/sysctl.conf to include the line:&lt;br /&gt;&lt;br /&gt;      fs.file-max = 2048&lt;br /&gt;&lt;br /&gt;   2. Set the value for maximum number of open files In the file /etc/security/limits.conf, below the commented line that reads&lt;br /&gt;&lt;br /&gt;      #&lt;domain&gt;      &lt;type&gt;  &lt;item&gt;         &lt;value&gt;&lt;br /&gt;&lt;br /&gt;      add this line:&lt;br /&gt;&lt;br /&gt;      * - nofile 2048&lt;br /&gt;&lt;br /&gt;      This line sets the default number of open file descriptors for every user on the system to 2048. Note that the "nofile" item has two possible limit values under the &lt;type&gt; header: hard and soft. Both types of limits must be set before the change in the maximum number of open files will take effect. By using the "-" character, both hard and soft limits are set simultaneously.&lt;br /&gt;&lt;br /&gt;      The hard limit represents the maximum value a soft limit may have and the soft limit represents the limit being actively enforced on the system at that time. Hard limits can be lowered by normal users, but not raised and soft limits cannot be set higher than hard limits. Only root may raise hard limits.&lt;br /&gt;&lt;br /&gt;When increasing file limit descriptors, you may want to simply double the value. For example, if you need to increase the default value of 1024, increase the value to 2048 first. If you need to increase it again, try 4096, etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-3400582952106391463?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/3400582952106391463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=3400582952106391463' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/3400582952106391463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/3400582952106391463'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/07/linux-ubuntu-tomcat-too-many-open-files.html' title='Linux /Ubuntu  tomcat -&gt; too many open files'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-3358859542929269435</id><published>2009-07-19T05:29:00.000-07:00</published><updated>2009-07-19T05:32:13.406-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vmware'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>vmware keys not working on vmware server 2.0.1</title><content type='html'>Keys like del, arrows are not working for me. ubuntu host and windows guest (xp,2003).&lt;br /&gt;as per the &lt;a href="http://communities.vmware.com/message/1087595"&gt;forum &lt;/a&gt;suggestion, i have appended the following lines to /etc/vmware/config file (sudo credentials required on ubuntu).&lt;br /&gt;&lt;br /&gt;xkeymap.keycode.108 = 0x138 # Alt_R&lt;br /&gt;xkeymap.keycode.106 = 0x135 # KP_Divide&lt;br /&gt;xkeymap.keycode.104 = 0x11c # KP_Enter&lt;br /&gt;xkeymap.keycode.111 = 0x148 # Up&lt;br /&gt;xkeymap.keycode.116 = 0x150 # Down&lt;br /&gt;xkeymap.keycode.113 = 0x14b # Left&lt;br /&gt;xkeymap.keycode.114 = 0x14d # Right&lt;br /&gt;xkeymap.keycode.105 = 0x11d # Control_R&lt;br /&gt;xkeymap.keycode.118 = 0x152 # Insert&lt;br /&gt;xkeymap.keycode.119 = 0x153 # Delete&lt;br /&gt;xkeymap.keycode.110 = 0x147 # Home&lt;br /&gt;xkeymap.keycode.115 = 0x14f # End&lt;br /&gt;xkeymap.keycode.112 = 0x149 # Prior&lt;br /&gt;xkeymap.keycode.117 = 0x151 # Next&lt;br /&gt;xkeymap.keycode.78 = 0x46 # Scroll_Lock&lt;br /&gt;xkeymap.keycode.127 = 0x100 # Pause&lt;br /&gt;xkeymap.keycode.133 = 0x15b # Meta_L&lt;br /&gt;xkeymap.keycode.134 = 0x15c # Meta_R&lt;br /&gt;&lt;br /&gt;well, a short cut suggestion was adding the following line alone.&lt;br /&gt;xkeymap.keycode.135 = 0x15d # Menu &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;But I pasted both of them, not sure which one caused the fix.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-3358859542929269435?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/3358859542929269435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=3358859542929269435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/3358859542929269435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/3358859542929269435'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/07/vmware-keys-not-working-on-vmware.html' title='vmware keys not working on vmware server 2.0.1'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-701412092174770259</id><published>2009-07-07T00:49:00.000-07:00</published><updated>2009-07-07T00:53:44.644-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ascii conversion'/><title type='text'>FTP problem - Asci converted binary data</title><content type='html'>Recently I have taken all my data backup from ubuntu (laptop) to windows xp (desktop) to re-install OS in laptop. But ironically, filezilla ftp client transferred all images, pdf files, doc files in asci format.&lt;br /&gt;&lt;br /&gt;As I read on this, ascii format means, it strips off 8th bit of every byte (this bit used for a special purpose flag). Restoration may not be possible.&lt;br /&gt;&lt;br /&gt;See a sample, how I lost lot of data, print screen image of jetspeed tutorial page (in pdf)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BVsbx11wehY/SlL-LEH9ZqI/AAAAAAAAFFE/iLu34T_ZREA/s1600-h/asci_corrupted.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://2.bp.blogspot.com/_BVsbx11wehY/SlL-LEH9ZqI/AAAAAAAAFFE/iLu34T_ZREA/s400/asci_corrupted.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5355622372936083106" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-701412092174770259?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/701412092174770259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=701412092174770259' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/701412092174770259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/701412092174770259'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/07/ftp-problem-asci-converted-binary-data.html' title='FTP problem - Asci converted binary data'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_BVsbx11wehY/SlL-LEH9ZqI/AAAAAAAAFFE/iLu34T_ZREA/s72-c/asci_corrupted.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-6755179926163968823</id><published>2009-07-01T08:40:00.001-07:00</published><updated>2009-07-01T08:42:39.594-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>Eclipse Too many open files fix</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Solution:&lt;/span&gt;&lt;br /&gt;Fix is adding the following entry (to increase the  open file count)&lt;br /&gt;in configuration/config.ini&lt;br /&gt;osgi.bundlefile.limit=100&lt;br /&gt;&lt;br /&gt;Problem:&lt;br /&gt;I got this exception&lt;br /&gt;&lt;br /&gt;ZoneInfo: /usr/share/javazi/ZoneInfoMappings (Too many open files)&lt;br /&gt;ZoneInfo: /usr/share/javazi/ZoneInfoMappings (Too many open files)&lt;br /&gt;!SESSION 2009-07-01 20:47:34.805 -----------------------------------------------&lt;br /&gt;eclipse.buildId=M20090211-1700&lt;br /&gt;java.version=1.6.0_0&lt;br /&gt;java.vendor=Sun Microsystems Inc.&lt;br /&gt;BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_IN&lt;br /&gt;Command-line arguments:  -os linux -ws gtk -arch x86&lt;br /&gt;&lt;br /&gt;!ENTRY org.eclipse.tptp.platform.examples 4 0 2009-07-01 20:47:39.058&lt;br /&gt;!MESSAGE &lt;br /&gt;!STACK 0&lt;br /&gt;java.util.zip.ZipException: error in opening zip file&lt;br /&gt; at java.util.zip.ZipFile.open(Native Method)&lt;br /&gt; at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:131)&lt;br /&gt; at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:148)&lt;br /&gt; at org.eclipse.osgi.framework.util.SecureAction.getZipFile(SecureAction.java:251)&lt;br /&gt; at org.eclipse.osgi.baseadaptor.bundlefile.ZipBundleFile.basicOpen(ZipBundleFile.java:81)&lt;br /&gt; at org.eclipse.osgi.baseadaptor.bundlefile.ZipBundleFile.getZipFile(ZipBundleFile.java:94)&lt;br /&gt; at org.eclipse.osgi.baseadaptor.bundlefile.ZipBundleFile.checkedOpen(ZipBundleFile.java:67)&lt;br /&gt; at org.eclipse.osgi.baseadaptor.bundlefile.ZipBundleFile.getEntry(ZipBundleFile.java:239)&lt;br /&gt; at org.eclipse.osgi.baseadaptor.BaseData.getEntry(BaseData.java:97)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.AbstractBundle.getEntry(AbstractBundle.java:1310)&lt;br /&gt; at org.eclipse.core.internal.registry.osgi.EclipseBundleListener.getExtensionURL(EclipseBundleListener.java:120)&lt;br /&gt; at org.eclipse.core.internal.registry.osgi.EclipseBundleListener.addBundle(EclipseBundleListener.java:158)&lt;br /&gt; at org.eclipse.core.internal.registry.osgi.EclipseBundleListener.processBundles(EclipseBundleListener.java:90)&lt;br /&gt; at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.onStart(RegistryStrategyOSGI.java:210)&lt;br /&gt; at org.eclipse.core.internal.registry.ExtensionRegistry.&lt;init&gt;(ExtensionRegistry.java:699)&lt;br /&gt; at org.eclipse.core.runtime.RegistryFactory.createRegistry(RegistryFactory.java:59)&lt;br /&gt; at org.eclipse.core.internal.registry.osgi.Activator.startRegistry(Activator.java:135)&lt;br /&gt; at org.eclipse.core.internal.registry.osgi.Activator.start(Activator.java:56)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)&lt;br /&gt; at java.security.AccessController.doPrivileged(Native Method)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)&lt;br /&gt; at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)&lt;br /&gt; at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)&lt;br /&gt; at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:427)&lt;br /&gt; at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:370)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.MultiSourcePackage.loadClass(MultiSourcePackage.java:31)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:443)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)&lt;br /&gt; at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)&lt;br /&gt; at java.lang.ClassLoader.loadClass(ClassLoader.java:268)&lt;br /&gt; at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)&lt;br /&gt; at java.lang.Class.forName0(Native Method)&lt;br /&gt; at java.lang.Class.forName(Class.java:186)&lt;br /&gt; at org.eclipse.equinox.internal.app.Activator.start(Activator.java:55)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)&lt;br /&gt; at java.security.AccessController.doPrivileged(Native Method)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)&lt;br /&gt; at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)&lt;br /&gt; at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)&lt;br /&gt; at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:427)&lt;br /&gt; at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:370)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:443)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)&lt;br /&gt; at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)&lt;br /&gt; at java.lang.ClassLoader.loadClass(ClassLoader.java:268)&lt;br /&gt; at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)&lt;br /&gt; at org.eclipse.core.internal.runtime.PlatformActivator.startAppContainer(PlatformActivator.java:47)&lt;br /&gt; at org.eclipse.core.internal.runtime.PlatformActivator.start(PlatformActivator.java:32)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)&lt;br /&gt; at java.security.AccessController.doPrivileged(Native Method)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:355)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1074)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:616)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:299)&lt;br /&gt; at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:489)&lt;br /&gt; at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:211)&lt;br /&gt; at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:321)&lt;br /&gt;&lt;br /&gt;(eclipse:30567): Pango-WARNING **: error opening config file '/etc/pango/pangorc': Too many open files&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(eclipse:30567): Pango-WARNING **: error opening config file '/home/harinath/.pangorc': Too many open files&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(eclipse:30567): Pango-CRITICAL **: No modules found:&lt;br /&gt;No builtin or dynamically loaded modules were found.&lt;br /&gt;PangoFc will not work correctly.&lt;br /&gt;This probably means there was an error in the creation of:&lt;br /&gt;  '/etc/pango/pango.modules'&lt;br /&gt;You should create this file by running:&lt;br /&gt;  pango-querymodules &gt; '/etc/pango/pango.modules'&lt;br /&gt;Fontconfig error: Cannot load default config file&lt;br /&gt;&lt;br /&gt;(eclipse:30567): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-6755179926163968823?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/6755179926163968823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=6755179926163968823' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6755179926163968823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6755179926163968823'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/07/solution-fix-is-adding-following-entry.html' title='Eclipse Too many open files fix'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-1382937827995653712</id><published>2009-06-23T23:40:00.000-07:00</published><updated>2009-06-23T23:45:57.202-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSR286'/><category scheme='http://www.blogger.com/atom/ns#' term='portlet 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='jetpseed2.0'/><title type='text'>Building portlets with Jetspeed 2.0</title><content type='html'>If you are looking at open source based portlet 2.0 development, then a good starting point could be &lt;a href="http://portals.apache.org/jetspeed-2/"&gt;jetspeed 2.0&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can create a maven project with the custom archetype of jetspeed by following similar syntax as below.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate -DarchetypeGroupId=org.apache.portals.jetspeed-2 -DarchetypeArtifactId=jetspeed-archetype -DarchetypeVersion=2.2.0 -DartifactId=hello -Dpackage=com.springboard -DgroupId=com.springboard -Dversion=1.0-SNAPSHOT&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You might come across an exception something like this&lt;br /&gt;&lt;br /&gt;Caused by: java.lang.ClassNotFoundException: org.apache.jetspeed.tools.db.serializer.JetspeedSerializerApplicationImpl&lt;br /&gt;        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)&lt;br /&gt;        at java.security.AccessController.doPrivileged(Native Method)&lt;br /&gt;        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)&lt;br /&gt;        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)&lt;br /&gt;        at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)&lt;br /&gt;        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)&lt;br /&gt;        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)&lt;br /&gt;        at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)&lt;br /&gt;        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)&lt;br /&gt;        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)&lt;br /&gt;        at java.lang.Class.forName0(Native Method)&lt;br /&gt;        at java.lang.Class.forName(Class.java:242)&lt;br /&gt;        at org.apache.jetspeed.maven.utils.Serializer.execute(Serializer.java:73)&lt;br /&gt;        ... 19 more&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Total time: 9 seconds&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the fix is that db plugin dependency is missing, I got rid of it by adding the dependency.&lt;br /&gt;&lt;br /&gt;      &lt;dependency&gt;&lt;br /&gt;      &lt;groupId&gt;org.apache.portals.jetspeed-2&lt;/groupId&gt;&lt;br /&gt;      &lt;artifactId&gt;jetspeed-db-tools&lt;/artifactId&gt;&lt;br /&gt;      &lt;version&gt;${org.apache.portals.jetspeed.version}&lt;/version&gt;  &lt;br /&gt;    &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do not forget to add repository (might be optional).&lt;br /&gt;   &lt;repository&gt;&lt;br /&gt;  &lt;id&gt;central&lt;/id&gt;&lt;br /&gt;  &lt;name&gt;central&lt;/name&gt;&lt;br /&gt;  &lt;url&gt;http://repo1.maven.org/maven2&lt;/url&gt;&lt;br /&gt;  &lt;/repository&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-1382937827995653712?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/1382937827995653712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=1382937827995653712' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1382937827995653712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1382937827995653712'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/06/building-portlets-with-jetspeed-20.html' title='Building portlets with Jetspeed 2.0'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-8959627215335702434</id><published>2009-03-17T21:42:00.001-07:00</published><updated>2009-03-17T21:42:57.705-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gz'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='tgz'/><title type='text'>Unix command to uncompress</title><content type='html'>Compressed UNIX tar archives (typically tar.gz or .tgz extensions) can be extracted in a single command. This is faster and works with less disk space available.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To extract the compressed tar archive target.tar.gz into the current working directory with:&lt;br /&gt;&lt;br /&gt;gzip -dc target.tar.gz | tar xf -&lt;br /&gt;&lt;br /&gt;If the file was compressed with bzip2 (i.e., .tar.bz2), you can substitute the bzip2 command for gzip.&lt;br /&gt;&lt;br /&gt;If the archive was compressed with the UNIX compress command (archive ending in .Z) you can use:&lt;br /&gt;&lt;br /&gt;zcat target.tar.Z | tar xf -&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-8959627215335702434?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/8959627215335702434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=8959627215335702434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8959627215335702434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8959627215335702434'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/03/unix-command-to-uncompress.html' title='Unix command to uncompress'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-1423089929734531802</id><published>2009-02-24T08:43:00.000-08:00</published><updated>2009-03-01T20:25:17.342-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQLSERVER'/><category scheme='http://www.blogger.com/atom/ns#' term='sql injection'/><title type='text'>fix for sql injection</title><content type='html'>SET NOCOUNT ON&lt;br /&gt;&lt;br /&gt;DECLARE @stringToFind VARCHAR(100)&lt;br /&gt;DECLARE @stringToReplace VARCHAR(100)&lt;br /&gt;DECLARE @schema sysname&lt;br /&gt;DECLARE @table sysname&lt;br /&gt;DECLARE @count INT&lt;br /&gt;DECLARE @sqlCommand VARCHAR(8000)&lt;br /&gt;DECLARE @where VARCHAR(8000)&lt;br /&gt;DECLARE @columnName sysname&lt;br /&gt;DECLARE @object_id INT&lt;br /&gt;                 &lt;br /&gt;SET @stringToFind = '&lt;&lt;malicious script code&gt;&gt;'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SET @stringToReplace = ''&lt;br /&gt;                    &lt;br /&gt;DECLARE TAB_CURSOR CURSOR  FOR&lt;br /&gt;SELECT   B.NAME      AS SCHEMANAME,&lt;br /&gt;        A.NAME      AS TABLENAME,&lt;br /&gt;        A.OBJECT_ID&lt;br /&gt;FROM     sys.objects A&lt;br /&gt;        INNER JOIN sys.schemas B&lt;br /&gt;          ON A.SCHEMA_ID = B.SCHEMA_ID&lt;br /&gt;WHERE    TYPE = 'U'&lt;br /&gt;ORDER BY 1&lt;br /&gt;      &lt;br /&gt;OPEN TAB_CURSOR&lt;br /&gt;&lt;br /&gt;FETCH NEXT FROM TAB_CURSOR&lt;br /&gt;INTO @schema,&lt;br /&gt;    @table,&lt;br /&gt;    @object_id&lt;br /&gt;  &lt;br /&gt;WHILE @@FETCH_STATUS = 0&lt;br /&gt; BEGIN&lt;br /&gt;   DECLARE COL_CURSOR CURSOR FOR&lt;br /&gt;   SELECT A.NAME&lt;br /&gt;   FROM   sys.columns A&lt;br /&gt;          INNER JOIN sys.types B&lt;br /&gt;            ON A.SYSTEM_TYPE_ID = B.SYSTEM_TYPE_ID&lt;br /&gt;   WHERE  OBJECT_ID = @object_id&lt;br /&gt;          AND IS_COMPUTED = 0&lt;br /&gt;          AND B.NAME IN ('char','nchar','nvarchar','varchar','text','ntext')&lt;br /&gt;&lt;br /&gt;   OPEN COL_CURSOR&lt;br /&gt; &lt;br /&gt;   FETCH NEXT FROM COL_CURSOR&lt;br /&gt;   INTO @columnName&lt;br /&gt; &lt;br /&gt;   WHILE @@FETCH_STATUS = 0&lt;br /&gt;     BEGIN&lt;br /&gt;       SET @sqlCommand = 'UPDATE ' + @schema + '.' + @table + ' SET [' + @columnName + '] = REPLACE(convert(nvarchar(max),[' + @columnName + ']),''' + @stringToFind + ''',''' + @stringToReplace + ''')'&lt;br /&gt;     &lt;br /&gt;       SET @where = ' WHERE [' + @columnName + '] LIKE ''%' + @stringToFind + '%'''&lt;br /&gt;     &lt;br /&gt;       EXEC( @sqlCommand + @where)&lt;br /&gt;     &lt;br /&gt;       SET @count = @@ROWCOUNT&lt;br /&gt;     &lt;br /&gt;       IF @count &gt; 0&lt;br /&gt;         BEGIN&lt;br /&gt;           PRINT @sqlCommand + @where&lt;br /&gt;           PRINT 'Updated: ' + CONVERT(VARCHAR(10),@count)&lt;br /&gt;           PRINT '----------------------------------------------------'&lt;br /&gt;         END&lt;br /&gt;     &lt;br /&gt;       FETCH NEXT FROM COL_CURSOR&lt;br /&gt;       INTO @columnName&lt;br /&gt;     END&lt;br /&gt; &lt;br /&gt;   CLOSE COL_CURSOR&lt;br /&gt;   DEALLOCATE COL_CURSOR&lt;br /&gt; &lt;br /&gt;   FETCH NEXT FROM TAB_CURSOR&lt;br /&gt;   INTO @schema,&lt;br /&gt;        @table,&lt;br /&gt;        @object_id&lt;br /&gt; END&lt;br /&gt;&lt;br /&gt;CLOSE TAB_CURSOR&lt;br /&gt;DEALLOCATE TAB_CURSOR&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-1423089929734531802?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/1423089929734531802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=1423089929734531802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1423089929734531802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1423089929734531802'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/02/fix-for-sql-injection-for.html' title='fix for sql injection'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-2499850010674178580</id><published>2009-02-04T20:56:00.000-08:00</published><updated>2009-02-04T21:12:51.688-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='myfaces'/><category scheme='http://www.blogger.com/atom/ns#' term='trinidad'/><title type='text'>Apache MyFaces Trinidad</title><content type='html'>NOTE: some how all the xml related syntax is removed while rendering the post in blogspot.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;span style="font-weight:bold;"&gt;My team is exploring the use of JSF into one of our applications.&lt;br /&gt;&lt;br /&gt;We had smooth sail until we decided to use trinidad components. We wanted to have out of box support for the features we wanted to build into application and tomahawk and trinidad seem to be the way to go.&lt;br /&gt;Some of the dependencies we had in our project POM file(related with myfaces and trinidad) are&lt;br /&gt;   &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;org.apache.myfaces.core&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;myfaces-api&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.2.2&lt;/version&gt;&lt;br /&gt;           &lt;scope&gt;compile&lt;/scope&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;       &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;org.apache.myfaces.core&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;myfaces-impl&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.2.2&lt;/version&gt;&lt;br /&gt;           &lt;scope&gt;compile&lt;/scope&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;       &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;org.apache.myfaces.tomahawk&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;tomahawk&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.1.8&lt;/version&gt;&lt;br /&gt;           &lt;scope&gt;runtime&lt;/scope&gt;&lt;br /&gt;           &lt;exclusions&gt;&lt;br /&gt;               &lt;exclusion&gt;&lt;br /&gt;                   &lt;groupid&gt;javax.servlet&lt;/groupid&gt;&lt;br /&gt;                   &lt;artifactid&gt;jstl&lt;/artifactid&gt;&lt;br /&gt;               &lt;/exclusion&gt;&lt;br /&gt;               &lt;exclusion&gt;&lt;br /&gt;               &lt;groupid&gt;org.apache.myfaces.core&lt;/groupid&gt;&lt;br /&gt;               &lt;artifactid&gt;myfaces-api&lt;/artifactid&gt;&lt;br /&gt;               &lt;/exclusion&gt;&lt;br /&gt;                               &lt;exclusion&gt;&lt;br /&gt;               &lt;groupid&gt;org.apache.myfaces.core&lt;/groupid&gt;&lt;br /&gt;               &lt;artifactid&gt;myfaces-impl&lt;/artifactid&gt;&lt;br /&gt;               &lt;/exclusion&gt;&lt;br /&gt;           &lt;/exclusions&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;       &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;jstl&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;jstl&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.2&lt;/version&gt;&lt;br /&gt;           &lt;scope&gt;runtime&lt;/scope&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;       &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;com.sun.facelets&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;jsf-facelets&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.1.11&lt;/version&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;       &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;org.apache.myfaces.trinidad&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;trinidad-api&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.2.1&lt;/version&gt;&lt;br /&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;       &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;org.apache.myfaces.trinidad&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;trinidad-impl&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.2.1&lt;/version&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;           &lt;groupid&gt;org.apache.myfaces.trinidad&lt;/groupid&gt;&lt;br /&gt;           &lt;artifactid&gt;trinidad-build&lt;/artifactid&gt;&lt;br /&gt;           &lt;version&gt;1.2.1&lt;/version&gt;&lt;br /&gt;       &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Contents of web.xml&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee" xsi="http://www.w3.org/2001/XMLSchema-instance" schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;classpath:applicationContext.xml&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;listener&gt;&lt;br /&gt;   &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;&lt;br /&gt;&lt;/listener&gt;&lt;br /&gt;&lt;listener&gt;&lt;br /&gt;   &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener &lt;/listener-class&gt;&lt;br /&gt;&lt;/listener&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;facelets.LIBRARIES&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;/WEB-INF/tomahawk.taglib.xml&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;javax.faces.DEFAULT_SUFFIX&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;.xhtml&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;facelets.DEVELOPMENT&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;javax.faces.CONFIG_FILES&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;/WEB-INF/backoffice-config.xml&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;client&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;20&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.SERIALIZE_STATE_IN_SESSION&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.COMPRESS_STATE_IN_SESSION&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.ALLOW_JAVASCRIPT&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.DETECT_JAVASCRIPT&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;false&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;&lt;param-name&gt;org.apache.myfaces.PRETTY_HTML&lt;/param-name&gt;&lt;br /&gt;&lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.AUTO_SCROLL&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.SECRET&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;NzY1NDMyMTA=&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.VALIDATE&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.ADD_RESOURCE_CLASS&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;org.apache.myfaces.renderkit.html.util.DefaultAddResource&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.RESOURCE_VIRTUAL_PATH&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;/faces/myFacesExtensionResource&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.CHECK_EXTENSIONS_FILTER&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;true&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;javax.faces.PARTIAL_STATE_SAVING_METHOD&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;false&lt;/param-value&gt;&lt;br /&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;!-- Extensions Filter --&gt;&lt;br /&gt;&lt;filter&gt;&lt;br /&gt;   &lt;filter-name&gt;extensionsFilter&lt;/filter-name&gt;&lt;br /&gt;   &lt;filter-class&gt;org.apache.myfaces.webapp.filter.ExtensionsFilter&lt;/filter-class&gt;&lt;br /&gt;   &lt;init-param&gt;&lt;br /&gt;       &lt;param-name&gt;uploadMaxFileSize&lt;/param-name&gt;&lt;br /&gt;       &lt;param-value&gt;100m&lt;/param-value&gt;&lt;br /&gt;   &lt;/init-param&gt;&lt;br /&gt;   &lt;init-param&gt;&lt;br /&gt;       &lt;param-name&gt;uploadThresholdSize&lt;/param-name&gt;&lt;br /&gt;       &lt;param-value&gt;100k&lt;/param-value&gt;&lt;br /&gt;   &lt;/init-param&gt;&lt;br /&gt;&lt;/filter&gt;&lt;br /&gt;&lt;filter-mapping&gt;&lt;br /&gt;   &lt;filter-name&gt;extensionsFilter&lt;/filter-name&gt;&lt;br /&gt;   &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;&lt;br /&gt;&lt;/filter-mapping&gt;&lt;br /&gt;&lt;filter-mapping&gt;&lt;br /&gt;   &lt;filter-name&gt;extensionsFilter&lt;/filter-name&gt;&lt;br /&gt;   &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;&lt;br /&gt;&lt;/filter-mapping&gt;&lt;br /&gt;&lt;listener&gt;&lt;br /&gt;   &lt;listener-class&gt;org.apache.myfaces.webapp.StartupServletContextListener&lt;/listener-class&gt;&lt;br /&gt;&lt;/listener&gt;&lt;br /&gt;&lt;servlet&gt;&lt;br /&gt;   &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;&lt;br /&gt;   &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;&lt;br /&gt;   &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;&lt;br /&gt;&lt;/servlet&gt;&lt;br /&gt;&lt;servlet-mapping&gt;&lt;br /&gt;   &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;&lt;br /&gt;   &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;&lt;br /&gt;&lt;/servlet-mapping&gt;&lt;br /&gt;&lt;welcome-file-list&gt;&lt;br /&gt;   &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;&lt;br /&gt;   &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;&lt;br /&gt;&lt;/welcome-file-list&gt;&lt;br /&gt;&lt;filter&gt;&lt;br /&gt;&lt;filter-name&gt;trinidad&lt;/filter-name&gt;&lt;br /&gt;&lt;filter-class&gt;&lt;br /&gt;org.apache.myfaces.trinidad.webapp.TrinidadFilter&lt;br /&gt;&lt;/filter-class&gt;&lt;br /&gt;&lt;/filter&gt;&lt;br /&gt;&lt;filter-mapping&gt;&lt;br /&gt;&lt;filter-name&gt;trinidad&lt;/filter-name&gt;&lt;br /&gt;&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;&lt;br /&gt;&lt;/filter-mapping&gt;&lt;br /&gt;&lt;servlet&gt;&lt;br /&gt;&lt;servlet-name&gt;resources&lt;/servlet-name&gt;&lt;br /&gt;&lt;servlet-class&gt;&lt;br /&gt;org.apache.myfaces.trinidad.webapp.ResourceServlet&lt;br /&gt;&lt;/servlet-class&gt;&lt;br /&gt;&lt;/servlet&gt;&lt;br /&gt;&lt;servlet-mapping&gt;&lt;br /&gt;&lt;servlet-name&gt;resources&lt;/servlet-name&gt;&lt;br /&gt;&lt;url-pattern&gt;/adf/*&lt;/url-pattern&gt;&lt;br /&gt;&lt;/servlet-mapping&gt;&lt;br /&gt;&lt;br /&gt;&lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;com.sun.facelets.FaceletViewHandler&lt;/param-value&gt;&lt;br /&gt; &lt;/context-param&gt;&lt;br /&gt;&lt;br /&gt; &lt;context-param&gt;&lt;br /&gt;   &lt;param-name&gt;facelets.VIEW_MAPPINGS&lt;/param-name&gt;&lt;br /&gt;   &lt;param-value&gt;*.xhtml&lt;/param-value&gt;&lt;br /&gt; &lt;/context-param&gt;&lt;br /&gt;&lt;br /&gt;&lt;/web-app&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;faces-config.xml content is&lt;br /&gt;&lt;br /&gt;&lt;application&gt;&lt;br /&gt;&lt;variable-resolver&gt;&lt;br /&gt;           org.springframework.web.jsf.DelegatingVariableResolver&lt;br /&gt;     &lt;/variable-resolver&gt;&lt;br /&gt;&lt;default-render-kit-id&gt;&lt;br /&gt;org.apache.myfaces.trinidad.core&lt;br /&gt;&lt;/default-render-kit-id&gt;&lt;br /&gt;&lt;/application&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Eclipse design time didnt handle trinidad tags properly (no UI rendering for tr components),but it worked fine.&lt;br /&gt;&lt;br /&gt;What I needed was to select rows in table using radio button option. It looks simple functionality but always it created problem. I remember doing some custom java script implementation to handle it, then we had difficult time even in .Net development. Now in java also we spent few days in fixing some very basic issue.&lt;br /&gt;It is not technology which need to be blamed all the time. if we started with the &lt;a href="http://myfaces.apache.org/trinidad/installation.html#Platform%20Information"&gt;formal instructions&lt;/a&gt;, it would have been very easy for us.&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/14922998-2499850010674178580?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/2499850010674178580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=2499850010674178580' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2499850010674178580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2499850010674178580'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/02/apache-myfaces-trinidad.html' title='Apache MyFaces Trinidad'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-1876330645078784727</id><published>2009-02-04T00:48:00.000-08:00</published><updated>2009-02-04T00:58:06.711-08:00</updated><title type='text'>VMWare Server 2.0 on Ubuntu - Guest windows 2003 server</title><content type='html'>I had a need to refresh my M$ Knowledge and tried to do that.&lt;br /&gt;&lt;br /&gt;As my laptop (inspiron 1525) runs with Ubuntu, I have downloaded vmware server 2.0 (available for free from vmware site). And then installed windows 2003 on it. &lt;br /&gt;&lt;br /&gt;Few issues and how I resolved it.&lt;br /&gt;&lt;br /&gt;1. default windows desktop size was very small.&lt;br /&gt;  fix: increase the resolution, and it made my windows desktop to use full laptop screen.&lt;br /&gt;2. Login problem:&lt;br /&gt;   I was not able to send Ctrl+Alt+Del signal after installing it, but then some one on internet suggested to try&lt;br /&gt;   Ctrl+Alt+ PrintScrn combination, it worked.&lt;br /&gt;3. Keyboard problem: Del button and arrow keys were not working. probably some other keys were too not working. down arrow was behaving as if it is the windows button, and backspace was working as del button. Yes I had no way of backspacing my text.&lt;br /&gt;&lt;br /&gt;Fix: I followed this &lt;a href="http://nthrbldyblg.blogspot.com/2008/06/vmware-and-fubar-keyboard-effect.html"&gt;link&lt;/a&gt; and found the fix working. &lt;br /&gt;&lt;br /&gt;I tried solution 3 mentioned in the blog post. &lt;br /&gt;i.e login as root and execute 'echo "xkeymap.nokeycodeMap = true" &gt;&gt; ~/.vmware/config'&lt;br /&gt;It worked for me. Yes it is  not the typical sudo. sudo didnt work for me (also mentioned in the article). Opened new shell and logged in as root. then executed this command.&lt;br /&gt;&lt;br /&gt;Surprising, it worked. now I am very much comfortable in the vmware win2k3 image. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Yes, as it is free ware, vmware might have left some known issues along with it. But then I am able to solve the issues in front of me. &lt;br /&gt;&lt;br /&gt;Now, I can stick to Ubuntu and occassionally use windows by vmware server web console for specific needs.&lt;br /&gt;&lt;br /&gt;I am happy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-1876330645078784727?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/1876330645078784727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=1876330645078784727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1876330645078784727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1876330645078784727'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/02/vmware-server-20-on-ubuntu-guest.html' title='VMWare Server 2.0 on Ubuntu - Guest windows 2003 server'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-8655847435029948662</id><published>2009-01-21T02:17:00.000-08:00</published><updated>2009-01-21T02:19:08.098-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='josso'/><title type='text'>JOSSO 1.8</title><content type='html'>Today I tried playing with JOSSO, I spent around 4 to 5 hours. Wanted to setup JOSSO with NTLM authentication, but not successful yet. &lt;br /&gt;&lt;br /&gt;Here is the log of what I have done.&lt;br /&gt;&lt;br /&gt;Follow instructions from &lt;br /&gt;&lt;a href="http://www.josso.org/confluence/display/JOSSO1/Quick+Start"&gt;http://www.josso.org/confluence/display/JOSSO1/Quick+Start&lt;/a&gt;&lt;br /&gt;there is some confusion here, as the article talks of using commands to install josso, but the downloaded file is not having the stuff related with the documentation.&lt;br /&gt;&lt;br /&gt;Download Josso 1.8 release from sourceforge.net download lcoation.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sourceforge.net/project/showfiles.php?group_id=116854&amp;package_id=129496&amp;release_id=653379"&gt;http://sourceforge.net/project/showfiles.php?group_id=116854&amp;package_id=129496&amp;release_id=653379&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;you can download the .tgz file which is around 42MB. this contains josso-gsh shell, which can be used to deploy the war file (documents on josso confluence site use this shell to deploy, it took a while for me to identify which file has this gsh file)&lt;br /&gt;gateway install --target "D:/servers/Tomcat 6.0" --platform tc60&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Either you can do this or download the tomact version and use it directly/build from source and use it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;in case if you need any further information best option is to google and if the josso site pages are not coming properly (in my case its getting timedout) then read the google cache.&lt;br /&gt;&lt;br /&gt;As the 1.8 release happened almost a week back, we might face problems in setting up things propely, more help might come into internet in the comming weeks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-8655847435029948662?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/8655847435029948662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=8655847435029948662' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8655847435029948662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8655847435029948662'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/01/josso-18.html' title='JOSSO 1.8'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-8326464493790218232</id><published>2009-01-15T20:34:00.000-08:00</published><updated>2009-01-15T20:37:56.897-08:00</updated><title type='text'>FREE Cheat Sheets for Developers</title><content type='html'>&lt;a href="http://refcardz.dzone.com/"&gt;FREE Cheat Sheets for Developers&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-8326464493790218232?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/8326464493790218232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=8326464493790218232' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8326464493790218232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/8326464493790218232'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/01/free-cheat-sheets-for-developers.html' title='FREE Cheat Sheets for Developers'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-1789571467735673839</id><published>2009-01-02T03:38:00.000-08:00</published><updated>2009-01-02T03:41:16.061-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='dia'/><title type='text'>Open source alternatives for visio</title><content type='html'>As I am moving away from use of microsoft softwares, I was trying to find a proper alternative for visio, the famous microsoft modeling tool.&lt;br /&gt;&lt;br /&gt;There seem to be 2 of them as proper alternatives(dia and drawing of open office), but dia leads the way because of the similarity with visio and certain special objects which make it better in  casual designing. &lt;a href="http://projects.gnome.org/dia/"&gt;http://projects.gnome.org/dia/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Check the URL for more details. It is a wondeful contribution by Free Software Foundation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-1789571467735673839?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/1789571467735673839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=1789571467735673839' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1789571467735673839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/1789571467735673839'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2009/01/open-source-alternatives-for-visio.html' title='Open source alternatives for visio'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-4655872617036372993</id><published>2008-12-31T03:34:00.000-08:00</published><updated>2008-12-31T03:41:29.047-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Maven</title><content type='html'>Maven comes really handly when it comes to managing project structure, building code etc. Its flexible dependency management is the best feature I go for.&lt;br /&gt;&lt;br /&gt;In case if you want to start with maven, and looking for a starting point, Download latest maven (comes as a zip file, unzip it) and set your PATH environment variable to bin folder. &lt;br /&gt;Now type "mvn archetype:generate" it lists out possible project types available. the follow up steps are self explanatory.&lt;br /&gt;&lt;br /&gt;If you are looking for a specific project type (like a simple web application with springs configured etc), you might need to google for it. With little bit of effort you will get to find proper archtypes.&lt;br /&gt;&lt;br /&gt;One problem I faced with maven POM (Project Object Model) files is with specific dependencies (jar files) which are not at all available on internet. I resolve them by creating similar structure locally and getting the near best possible jar file (yes I create folder strtucture, file name as required).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-4655872617036372993?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/4655872617036372993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=4655872617036372993' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4655872617036372993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4655872617036372993'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2008/12/maven.html' title='Maven'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-6784867902703817089</id><published>2008-12-30T00:30:00.000-08:00</published><updated>2008-12-30T04:10:52.743-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RESTful services'/><category scheme='http://www.blogger.com/atom/ns#' term='REST'/><title type='text'>RESTful web services</title><content type='html'>RESTful services are a nice way of integrating how the web interacts with Humans and Machines in the simplest format. Though developer community doesn't feel any pain in building standard web services using SOAP, WSDL over HTTP, there is lot of complexity behind implementing web services. &lt;br /&gt;&lt;br /&gt;RESTful web services offer simplest solution, making same HTTP protocol used for web services as well.&lt;br /&gt;&lt;br /&gt;There are 2 important aspects in RESTful services. &lt;br /&gt;&lt;br /&gt;1. Web method&lt;br /&gt;2. Scope&lt;br /&gt;&lt;br /&gt;When we use standard web services, web service method name is very important. RESTful removes this overhead. Just use the standard HTTP GET, POST,PUT,DELETE etc methods for any transaction.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Scope of the request is similar to the query string logic of HTTP. Query string must be able to define the scope of a client request, on what he needs to be done.&lt;br /&gt;&lt;br /&gt;I will post more about it as and when I get time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-6784867902703817089?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/6784867902703817089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=6784867902703817089' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6784867902703817089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6784867902703817089'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2008/12/restful-web-services.html' title='RESTful web services'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-5567677132951073614</id><published>2008-12-27T01:17:00.000-08:00</published><updated>2008-12-27T01:30:12.053-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sifybbclient'/><category scheme='http://www.blogger.com/atom/ns#' term='kubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Sify broadband from Ubuntu/Kubuntu</title><content type='html'>Here are the instructions to install sify broadband client in Kubuntu/Ubuntu 8.10&lt;br /&gt;&lt;br /&gt;Download the client from the location http://202.144.65.70:8090&lt;br /&gt;When I clicked the link for linux, it opened up a PDF file with the details. look for the li. for ux client link http://202.144.65.70:8090/bbandclient_v30/sify_bbclient-3.0.tar.gz &lt;br /&gt;&lt;br /&gt;then execute the following commands (after downloading the file).&lt;br /&gt;&lt;br /&gt;gunzip sify_bbclient-3.0.tar.gz &lt;br /&gt;tar -xvf sify_bbclient-3.0.tar &lt;br /&gt;&lt;br /&gt;From the exploded location, execute install.sh&lt;br /&gt;&lt;br /&gt;execute sudo ./install.sh&lt;br /&gt;&lt;br /&gt;gksudo ln -s /usr/lib/libcrypto.so /usr/lib/libcrypto.so.4&lt;br /&gt;&lt;br /&gt;gksudo ln -s /usr/lib/libssl.so /usr/lib/libssl.so.4&lt;br /&gt;&lt;br /&gt;now, you can execute "sifyconnect" command from terminal and it pops up sify bb client.&lt;br /&gt;&lt;br /&gt;Make sure you call sify customer care to register your system/laptop physical address so as you can connect without any problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-5567677132951073614?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/5567677132951073614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=5567677132951073614' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/5567677132951073614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/5567677132951073614'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2008/12/sify-broadband-from-ubuntukubuntu.html' title='Sify broadband from Ubuntu/Kubuntu'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-2254796915957167962</id><published>2007-06-02T13:41:00.000-07:00</published><updated>2007-06-02T13:42:31.937-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>killing oracle session</title><content type='html'>select s.username, s.osuser, s.sid, s.serial#, p.spid&lt;br /&gt;  from v$session s,v$process p&lt;br /&gt; where s.paddr = p.addr&lt;br /&gt;   and s.username is not null;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This will return the database username, the operating system username, the session id, the serial number, and the system process id (SPID). Then, a DBA user can issue the following (using the SID and SERIAL# information from the previous query):&lt;br /&gt;&lt;br /&gt;ALTER SYSTEM KILL SESSION 'sid,serial#';&lt;br /&gt;ALTER SYSTEM KILL SESSION '9,203';&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-2254796915957167962?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/2254796915957167962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=2254796915957167962' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2254796915957167962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2254796915957167962'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/06/killing-oracle-session.html' title='killing oracle session'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-4672762719111773645</id><published>2007-02-14T23:53:00.000-08:00</published><updated>2007-02-15T00:16:45.544-08:00</updated><title type='text'>disabling browser back button</title><content type='html'>Its a very common question that many of the developers need often.&lt;br /&gt;&lt;br /&gt;I am too interested how we can do this.&lt;br /&gt;Oftent he problem is that after logout, if user clicks back in the browser and is able to see content, this is not expected. there will be many advantages if we can disable back button especially when we require it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cache control:&lt;/strong&gt;&lt;br /&gt;one of the best and easiest way to handle issues popup because of clicking back button is to set no cache for the pages.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;setting no cache:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can use client-side code to force the user's browser to not cache a Web page.&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;meta http-equiv="Expires" CONTENT="0"&amp;gt;&lt;br /&gt;  &amp;lt;meta http-equiv="Cache-Control" CONTENT="no-cache"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;meta http-equiv="Pragma" CONTENT="no-cache"&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;There are a couple things to keep in mind when using the above method to force a browser to &lt;i&gt;not&lt;/i&gt; &lt;br /&gt;cache a Web page:&lt;br /&gt;&lt;p&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;CODE&gt;Pragma: no-cache&lt;/code&gt; prevents caching only when used over a secure connection. &lt;br /&gt;A &lt;code&gt;Pragma: no-cache&lt;/code&gt; META tag is treated identically to &lt;code&gt;Expires: -1&lt;/code&gt; if used in a &lt;br /&gt;non-secure page. The page will be cached but marked as immediately expired.&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;Cache-Control&lt;/code&gt; META &lt;code&gt;HTTP-EQUIV&lt;/code&gt; tags are ignored and have no effect in Internet &lt;br /&gt;Explorer versions 4 or 5.&lt;br /&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;You can use both in your code. I tried this but this was not the solution because it did not work in all the &lt;br /&gt;browsers so I guess if one had an intranet environment where there was some control in place then they could &lt;br /&gt;use this method.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Javascript&lt;/strong&gt;&lt;br /&gt;My next area of research focused on the various rewiring the back button suggestions. An article by TJ &lt;br /&gt;Sylvester, &lt;a href="/webtech/012600-1.shtml"&gt;Rewiring the Back Button&lt;/a&gt;, makes interesting reading but I &lt;br /&gt;noticed that when one clicks back it does not indeed take you to the page you entered the data but if I &lt;br /&gt;clicked back twice it does and we would not want that too. Basically a determined user could always figure &lt;br /&gt;out a way to circumvent the preventative measures.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Another way to "disable the back button" is to use client-side JavaScript code to open a new window that&lt;br /&gt;doesn't have the toolbar.  (This makes it harder (not impossible) for the user to go back to the previous&lt;br /&gt;page.)&lt;br /&gt;Another, more failsafe approach (although quite annoying) is, when a form is submitted, to open a new window &lt;br /&gt;and close the window that the form existed in.  I didn't give this method serious thought because&lt;br /&gt;I would not like my site opening up a new window everytime a user submitted a form.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Next I examined the possibility of adding client-side JavaScript code on the page that we do not want to let &lt;br /&gt;the user return to.  Such JavaScript code could be used to have the effect of hitting the forward button, which would&lt;br /&gt;counter any action by a user clicking the back button.  The JavaScript code to accomplish this can be seen below:&lt;br /&gt;&lt;P&gt;&lt;TABLE WIDTH=95% BORDER=0&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD WIDTH=100% BGCOLOR=#CCCCCC&gt;&lt;br /&gt;&lt;CODE&gt;&lt;PRE&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="JavaScript"&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;  javascript:window.history.forward(1);&lt;br /&gt;//--&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/PRE&gt;&lt;/CODE&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;br /&gt;Again this is workable but it is far from the best way.&lt;br /&gt;I was then given the suggestion to use &lt;code&gt;location.replace&lt;/code&gt; to navigate form one page to another. &lt;br /&gt;What this does is it replaces the current history entry with the new page so only one page will be maintained &lt;br /&gt;in the history and the back button will never get enabled. This is, I guess, what a lot of people are looking &lt;br /&gt;for, but again this would not be the best answer in all cases.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;For one thing you will have to use client side script for this. For an anchor tag this will be easy by just &lt;br /&gt;using:&lt;br /&gt;&lt;P&gt;&lt;TABLE WIDTH=95% BORDER=0&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD WIDTH=100% BGCOLOR=#CCCCCC&gt;&lt;br /&gt;&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;&amp;lt;A HREF="PageName.htm" onclick="javascript:location.replace(this.href); event.returnValue=false; "&amp;gt;No back button when you do this.&amp;lt;/A&amp;gt;&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;[&lt;a HREF="/demos/foobar.htm" onclick="javascript:location.replace(this.href); event.returnValue=false; "&gt;Try out the above link!&lt;/A&gt;]&lt;P&gt;&lt;br /&gt;The above technique has its disadvantages: simply using &lt;code&gt;Response.Redirect&lt;/code&gt; will not work, since,&lt;br /&gt;each time a user jumps from one page to another, you need to clear out the &lt;code&gt;location.history&lt;/code&gt; field&lt;br /&gt;through client-side code.  Also, keep in mind that this will just remove the &lt;b&gt;last&lt;/b&gt; history entry, not all&lt;br /&gt;of them.  Go ahead and click the above hyperlink, you will be taken to a simple HTML page.  Try clicking the back button&lt;br /&gt;and you will notice you will be taken to the page you were visiting &lt;i&gt;before&lt;/i&gt; you came to this page!  (Assuming,&lt;br /&gt;of course, you have client-side JavaScript code enabled in your browser.)&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;After my exhaustive search I found that there is still no way of truly disabling the back button for all cases. &lt;br /&gt;All the methods I discussed in this article will, with varying degrees of success, prevent the &lt;br /&gt;user from viewing the previous page, but they, of course, all have their limitations.  The best solution involves&lt;br /&gt;a mixture of both client-side and server-side script; regardless, there is no way to completely disable the back&lt;br /&gt;button&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JSP&lt;/strong&gt;&lt;br /&gt;%&lt;br /&gt;  Response.Buffer = True&lt;br /&gt;  Response.ExpiresAbsolute = Now() - 1&lt;br /&gt;  Response.Expires = 0&lt;br /&gt;  Response.CacheControl = "no-cache"&lt;br /&gt;%&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ASP.NET&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;Response.CacheControl = "no-cache";&lt;br /&gt;&lt;br /&gt;Proxy Server Caching- &lt;br /&gt;&lt;br /&gt;Response.CacheControl = "private";&lt;br /&gt;&lt;br /&gt;           It disables the proxy server caching and page is cached on local machine.&lt;br /&gt;&lt;br /&gt;Response.CacheControl = "public";&lt;br /&gt;&lt;br /&gt;           Proxy server cache is enabled.&lt;br /&gt;&lt;br /&gt;Users request pages from a local server instead of direct from the source.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-4672762719111773645?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/4672762719111773645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=4672762719111773645' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4672762719111773645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4672762719111773645'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/02/disabling-browser-back-button.html' title='disabling browser back button'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-4735385738586399203</id><published>2007-02-02T05:18:00.000-08:00</published><updated>2007-02-02T05:23:42.639-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQLSERVER'/><title type='text'>SQL server,Date formats</title><content type='html'>&lt;a href="http://www.sql-server-helper.com/tips/date-formats.aspx"&gt;http://www.sql-server-helper.com/tips/date-formats.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-4735385738586399203?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/4735385738586399203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=4735385738586399203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4735385738586399203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4735385738586399203'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/02/sql-serverdate-formats.html' title='SQL server,Date formats'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-6645207369484006635</id><published>2007-02-01T22:59:00.000-08:00</published><updated>2007-02-01T23:03:26.126-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='technical tip'/><title type='text'>Setting default browser</title><content type='html'>To make Internet Explorer the default web browser,&lt;br /&gt;&lt;br /&gt;In Internet Explorer -&gt; View menu -&gt; Internet Options -&gt; Programs &lt;br /&gt;Enable &lt;br /&gt;'Internet Explorer should check to see whether it is the default web browser'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To make firefox as your default browser&lt;br /&gt;&lt;br /&gt;Go to Tools -&gt; Options.&lt;br /&gt;under general tab, check the check box for "Firefox should check to see if it is the default browser when starting".&lt;br /&gt;&lt;br /&gt;or you have a button "check now" if you click that you will get an alert if firefox is not the default browser. if you click yes, then it will become default browser.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-6645207369484006635?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/6645207369484006635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=6645207369484006635' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6645207369484006635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/6645207369484006635'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/02/setting-default-browser.html' title='Setting default browser'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-2372899999685855297</id><published>2007-01-18T23:32:00.000-08:00</published><updated>2007-01-18T23:40:02.955-08:00</updated><title type='text'>Browser detection</title><content type='html'>&lt;strong&gt;Using the navigator object to detect client's browser&lt;/strong&gt;&lt;br /&gt;Until one browser remains standing on the web (if ever), browser detection will continue to be part of any good JavaScripter's life. Whether you're gliding a div across the screen or creating an image rollover, it's fundamental that only relevant browsers pick up on your code. In this tutorial we'll probe the navigator object of JavaScript, and show how to use it to perform browser detection, whether the subject is Firefox, Internet Explorer 6, or even Opera 8.&lt;br /&gt;The navigator object&lt;br /&gt;The navigator object was conceived back in the days when Netscape Navigatorreined supreme. These days it serves as much as an irony of NS's diminished market share as way of probing browser information.&lt;br /&gt;The navigator object of JavaScript contains the following core properties:&lt;br /&gt;Properties&lt;br /&gt;Description&lt;br /&gt;appCodeName&lt;br /&gt;The code name of the browser.&lt;br /&gt;appName&lt;br /&gt;The name of the browser (ie: Microsoft Internet Explorer).&lt;br /&gt;appVersion&lt;br /&gt;Version information for the browser (ie: 4.75 [en] (Win98; U)).&lt;br /&gt;cookieEnabled&lt;br /&gt;Boolean that indicates whether the browser has cookies enabled. IE4 and NS6+.&lt;br /&gt;language&lt;br /&gt;Returns the default language of the browser version (ie: en-US). NS4 and NS6+ only.&lt;br /&gt;mimeTypes[]&lt;br /&gt;An array of all MIME types supported by the client. NS4 and NS6+ only. Array is always empty in IE.&lt;br /&gt;platform[]&lt;br /&gt;The platform of the client's computer (ie: Win32).&lt;br /&gt;plugins&lt;br /&gt;An array of all plug-ins currently installed on the client. NS4 and NS6+ only. Array is always empty in IE.&lt;br /&gt;systemLanguage&lt;br /&gt;IE4+ property that returns the default language of the operating system. Similar to NS's language property.&lt;br /&gt;userAgent&lt;br /&gt;String passed by browser as user-agent header. (ie: Mozilla /4.0 (compatible; MSIE 6.0; Windows NT 5.1))&lt;br /&gt;userLanguage&lt;br /&gt;IE4+ property that returns the preferred language setting of the user. Similar to NS's language property.&lt;br /&gt;Let's see exactly what these properties reveal of your browser:&lt;br /&gt;with (document){&lt;br /&gt;write("AppCodeName: "+navigator.appCodeName+"")&lt;br /&gt;write("AppName: "+navigator.appName+"")&lt;br /&gt;write("AppVersion: "+navigator.appVersion+"")&lt;br /&gt;write("UserAgent: "+navigator.userAgent+"")&lt;br /&gt;write("Platform: "+navigator.platform+"")&lt;br /&gt;}&lt;br /&gt;AppCodeName: MozillaAppName: Microsoft Internet ExplorerAppVersion: 4.0 (compatible; MSIE 6.0; &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink7" onmouseover="adlinkMouseOver(event,this,7);" style="POSITION: static; TEXT-DECORATION: underline! important" onclick="adlinkMouseClick(event,this,7);" onmouseout="adlinkMouseOut(event,this,7);" href="http://www.javascriptkit.com/javatutors/navigator.shtml#" target="_top"&gt;Windows NT&lt;/a&gt; 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)Platform: Win32&lt;br /&gt;At a glance&lt;br /&gt;You probably think you have a very solid idea now of how to utilize the navigator object to detect your client's browser type. At its most basic form, the following two properties are used:&lt;br /&gt;navigator.appNamenavigator.appVersion&lt;br /&gt;For example:&lt;br /&gt;//detect Netscape 4.7+&lt;br /&gt;if (navigator.appName=="Netscape"&amp;&amp;amp;parseFloat(navigator.appVersion)&gt;=4.7)&lt;br /&gt;alert("You are using Netscape 4.7+")&lt;br /&gt;However, depending on the browser you're trying to detect, you'll find the above two properties too limiting.&lt;br /&gt;Detecting Firefox 1.0+&lt;br /&gt;Take for example, Firefox 1.0+. It shares the same "appName" value as older Netscape browsers, which is "Netscape." The appVersion value returned is also out of wack, which is "5." So we need to look to another property, which turns out to be "UserAgent." For Firefox 1.04 for example, its userAgent property reads:&lt;br /&gt;UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4&lt;br /&gt;Ah ha, the text at the end of the string apparently contains the information we want. Based on this new found discovery, the below code detects if you're using Firefox 1.0+:&lt;br /&gt;if(navigator.userAgent.indexOf("Firefox")!=-1){&lt;br /&gt;var versionindex=navigator.userAgent.indexOf("Firefox")+8&lt;br /&gt;if (parseInt(navigator.userAgent.charAt(versionindex))&gt;=1)&lt;br /&gt;alert("You are using Firefox 1.x or above")&lt;br /&gt;}&lt;br /&gt;The code assumes that all Firefox versions contain the string "Firefox/" immediately followed by the version number (ie "1").&lt;br /&gt;Detecting IE 5.5+&lt;br /&gt;Detecting IE using the navigator object also poses a similar problem as Firefox, since its "navigator.appVersion" property contains more than just the version number of IE:&lt;br /&gt;4.0 (compatible; MSIE 5.5; Windows 98; Hotbar 3.0)&lt;br /&gt;If we were to use parseFloat to try and extract out the browser version in "navigator.appVersion", we'd get 4.0, instead of the correct number (5.5). This is due to the way parseFloat works- by returning the first number it encounters. So, how does one go about getting the version number in IE? As with Firefox, it really comes down to how you wish to approach the issue. Lets stick with using the "navigator.appVersion" property this time, though you can certainly use "navigator.userAgent" as well:&lt;br /&gt;//Detect IE5.5+&lt;br /&gt;version=0&lt;br /&gt;if (navigator.appVersion.indexOf("MSIE")!=-1){&lt;br /&gt;temp=navigator.appVersion.split("MSIE")&lt;br /&gt;version=parseFloat(temp[1])&lt;br /&gt;}&lt;br /&gt;if (version&gt;=5.5) //NON IE browser will return 0&lt;br /&gt;alert("You're using IE5.5+")&lt;br /&gt;In the above, &lt;a href="http://javascriptkit.com/javatutors/string4.shtml"&gt;string.split()&lt;/a&gt; is first used to divvy up navigator.appVersion into two parts, using "MSIE" as the separator:&lt;br /&gt;4.0 (compatible; MSIE 5.5; Windows 98; Hotbar 3.0)&lt;br /&gt;As a result temp[1] contains the part after "MSIE", with the browser version appearing first. Doing a parseFloat() on temp[1] therefore retrieves the browser version of IE.&lt;br /&gt;The Opera pitfall&lt;br /&gt;Using the navigator object to screen for Opera is even a little more complex, as Opera by default identifies itself as IE, with Opera 8 identifying itself as IE6, inside "navigator.userAgent." The rationale for this is so that scripts screening for IE would also allow Opera through, so that Opera will render these pages properly. Lets take a look at what the userAgent of Opera 8.5 returns depending on what it is set to identify as:&lt;br /&gt;As IE6: Mozilla/4.0 (compatible; MSIE 6.0; Windows XP) Opera 8.5 [en]As Moz5: Mozilla/5.0 (Windows XP; U) Opera 8.5 [en]As Opera: Opera/8.5 (Windows XP; U) [en]&lt;br /&gt;"What's the problem? Opera 8.5 appears in each case." you may say. Well, look closer, and notice how when Opera is set to identify as itself, the Opera string returned is slightly different ("Opera/8.5" versus "Opera 8.5"). So ironically enough, the expressionif (navigator.userAgent.indexOf("Opera 8.5")!=-1)&lt;br /&gt;will fail if the user has their browser set to identify as Opera, but not if any other browser!&lt;br /&gt;Despite this oddity, the code to detecting Opera need not be any different than the one used to detect Firefox:&lt;br /&gt;if(navigator.userAgent.indexOf("Opera")!=-1){&lt;br /&gt;var versionindex=navigator.userAgent.indexOf("Opera")+6&lt;br /&gt;if (parseInt(navigator.userAgent.charAt(versionindex))&gt;=8)&lt;br /&gt;alert("You are using Opera 8 or 9")&lt;br /&gt;}&lt;br /&gt;This also assumes that all Opera versions contain the string "Opera" immediately followed by either a space or "/", then the version number (ie "8"). And since it only looks at the first number within the version, it can only detect up to Opera 9, not 10 for example.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using object detection to sniff out different browsers&lt;/strong&gt;&lt;br /&gt;Since different browsers support different objects, you can use Object Detection as a quick though less than infallible way of detecting various browsers. For example, since only Opera supports the property "window.opera", you can use that to instantly separate an Opera browser from the herd. Here are a few sample test cases, and what they *imply* about the browser running it:&lt;br /&gt;Example objects used to "rough" detect a particular browser&lt;br /&gt;Scheme&lt;br /&gt;Description&lt;br /&gt;document.getElementById&lt;br /&gt;Detects modern browsers in general, which covers IE5+, Firefox1+, and Opera7+&lt;br /&gt;window.getComputedStyle&lt;br /&gt;Detects Firefox1+ and Opera 8+&lt;br /&gt;Array.every&lt;br /&gt;Detects Firefox1.5+ (method detection)&lt;br /&gt;window.Iterator&lt;br /&gt;Detects Firefox2+&lt;br /&gt;document.all&lt;br /&gt;Detects IE4+&lt;br /&gt;window.attachEvent&lt;br /&gt;Detects IE5+&lt;br /&gt;window.createPopup&lt;br /&gt;Detects IE5.5+&lt;br /&gt;document.compatMode &amp;&amp;amp; document.all&lt;br /&gt;Detects IE6+&lt;br /&gt;window.XMLHttpRequest&lt;br /&gt;Detects IE7, Firefox1+, and Opera8+&lt;br /&gt;window.XMLHttpRequest &amp;&amp;amp; document.all&lt;br /&gt;Detects IE7. Note: Will fail if visitor explicitly disables native xmlHTTPRequest support (under Toolbar-&gt; &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink0" onmouseover="adlinkMouseOver(event,this,0);" style="POSITION: static; TEXT-DECORATION: underline! important" onclick="adlinkMouseClick(event,this,0);" onmouseout="adlinkMouseOut(event,this,0);" href="http://www.javascriptkit.com/javatutors/objdetect3.shtml#" target="_top"&gt;Internet&lt;/a&gt; Options-&gt; Advanced)&lt;br /&gt;document.documentElement &amp;&amp;amp; typeof document.documentElement.style.maxHeight!="undefined"&lt;br /&gt;Another way of detecting IE7 that is more reliable than the above.&lt;br /&gt;window.opera&lt;br /&gt;Detects Opera (any version).&lt;br /&gt;* Since Opera by default also identifies itself as IE (apart from Opera), with support for many of IE's proprietary objects, the IE detection schemes above will also return true for Opera. Use "window.opera" in combination to filter out Opera browsers.&lt;br /&gt;It's important to mention that object detection's chief purpose is to help you detect within your script whether the browser supports a particular object/method/property before using it, not browser detection. As the later it may be convenient over probing the &lt;a href="http://www.javascriptkit.com/jsref/navigator.shtml" pglpj="0" ukhi0="0"&gt;Navigator object&lt;/a&gt;, but is only as reliable as your understanding of which objects are supported in which browsers. In other words, it's not a 100% reliable way of sniffing out the user's browser. Having said that, the below uses object detection to test for IE7:&lt;br /&gt;&lt;script type="text/&lt;a class=" oncontextmenu="return false;" id="KonaLink1" onmouseover="adlinkMouseOver(event,this,1);" style="POSITION: static; TEXT-DECORATION: underline! important" onclick="adlinkMouseClick(event,this,1);" onmouseout="adlinkMouseOut(event,this,1);" href="http://www.javascriptkit.com/javatutors/objdetect3.shtml#" target="_top"&gt;javascript&lt;/a&gt;"&gt;&lt;br /&gt;if (document.documentElement &amp;&amp;amp; typeof document.documentElement.style.maxHeight!="undefined")&lt;br /&gt;alert("You're using IE7")&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;Again object detection is really about feature detection. It detects whether your browser supports the feature your script intends to use and manipulate. For the lazy, that will substitute for browser detection just fine!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-2372899999685855297?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/2372899999685855297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=2372899999685855297' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2372899999685855297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/2372899999685855297'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/browser-detection.html' title='Browser detection'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-5222157043088371159</id><published>2007-01-18T21:13:00.000-08:00</published><updated>2007-01-18T21:15:57.854-08:00</updated><title type='text'>Task Manager menu /tabs disappear</title><content type='html'>last one or 2 days when ever i open task manager to kill some process, it just shows up without any menu bar/ tabs&lt;br /&gt;&lt;br /&gt;i thought it could be a virus effect or something, but when i searched on net it gave a solution.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SYMPTOMS&lt;br /&gt;loadTOCNode(1, 'symptoms');&lt;br /&gt;When you start Task Manager, the menu bar and tabs may not be visible.&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/193050#top"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/193050#top"&gt;Back to the top&lt;/a&gt;&lt;br /&gt;CAUSE&lt;br /&gt;loadTOCNode(1, 'cause');&lt;br /&gt;This behavior can occur if Task Manager is running in Tiny Footprint mode. When you double-click the empty space in the border around the tabs, Task Manager switches to this mode.&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/193050#top"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/193050#top"&gt;Back to the top&lt;/a&gt;&lt;br /&gt;RESOLUTION&lt;br /&gt;loadTOCNode(1, 'resolution');&lt;br /&gt;To switch Task Manager to its normal display mode, double-click the top border of the window.&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/193050#top"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/193050#top"&gt;Back to the top&lt;/a&gt;&lt;br /&gt;WORKAROUND&lt;br /&gt;loadTOCNode(1, 'workaround');&lt;br /&gt;To work around this behavior, perform the following steps:&lt;br /&gt;1.&lt;br /&gt;Click Start, and then click Run.&lt;br /&gt;2.&lt;br /&gt;Type taskmgr.exe.&lt;br /&gt;3.&lt;br /&gt;Hold down CTRL+ALT+SHIFT at the same time, and while holding them down press ENTER.&lt;br /&gt;&lt;br /&gt;Reference :&lt;a href="http://support.microsoft.com/kb/193050"&gt;http://support.microsoft.com/kb/193050&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-5222157043088371159?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/5222157043088371159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=5222157043088371159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/5222157043088371159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/5222157043088371159'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/task-manager-menu-tabs-disappear.html' title='Task Manager menu /tabs disappear'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-3509026675271877025</id><published>2007-01-18T03:45:00.000-08:00</published><updated>2007-01-18T03:50:26.349-08:00</updated><title type='text'>Service unavailable</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_BVsbx11wehY/Ra9e6U8PcSI/AAAAAAAAAAM/631ALTgBivE/s1600-h/SERVER+HEALTH.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_BVsbx11wehY/Ra9e6U8PcSI/AAAAAAAAAAM/631ALTgBivE/s320/SERVER+HEALTH.JPG" alt="" id="BLOGGER_PHOTO_ID_5021336465688195362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Hi guys,&lt;br /&gt;&lt;br /&gt;Service unavailable error in IIS 6 (Windows 2003 server) is really a painful one.&lt;br /&gt;&lt;br /&gt;It is occurring because the application pool supporting your asp.net application has just crashed.&lt;br /&gt;&lt;br /&gt;One way to get away from this error is to increase the error condition.&lt;br /&gt;&lt;br /&gt;Set the health condtions as shown in the image. increase threshold of error count.&lt;br /&gt;I am not sure if this is the right solution, but this worked for me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-3509026675271877025?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/3509026675271877025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=3509026675271877025' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/3509026675271877025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/3509026675271877025'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/service-unavailable.html' title='Service unavailable'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_BVsbx11wehY/Ra9e6U8PcSI/AAAAAAAAAAM/631ALTgBivE/s72-c/SERVER+HEALTH.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-4728712443998966254</id><published>2007-01-18T03:43:00.000-08:00</published><updated>2007-01-18T03:44:40.930-08:00</updated><title type='text'>Your HTML and javascript source</title><content type='html'>I found this site to be informative.&lt;br /&gt;&lt;a href="http://www.yourhtmlsource.com/"&gt;http://www.yourhtmlsource.com/ &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-4728712443998966254?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/4728712443998966254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=4728712443998966254' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4728712443998966254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/4728712443998966254'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/your-html-and-javascript-source.html' title='Your HTML and javascript source'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-5632731597754501037</id><published>2007-01-18T02:35:00.000-08:00</published><updated>2007-01-18T02:36:45.362-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='technical tip'/><title type='text'>You can learn</title><content type='html'>check this &lt;a href="http://www.youcanlearnseries.com/Programming%20Tips/CSharp/LDAPReader.aspx"&gt;you can learn site&lt;/a&gt;. got lot of tips that might help us&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-5632731597754501037?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/5632731597754501037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=5632731597754501037' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/5632731597754501037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/5632731597754501037'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/you-can-learn.html' title='You can learn'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116853457625715509</id><published>2007-01-11T08:55:00.000-08:00</published><updated>2007-01-11T08:56:16.583-08:00</updated><title type='text'>System internals</title><content type='html'>&lt;a href="http://www.microsoft.com/technet/sysinternals/default.mspx"&gt;http://www.microsoft.com/technet/sysinternals/default.mspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Sysinternals web site was created in 1996 by Mark Russinovich and Bryce Cogswell to host their advanced system utilities and technical information. Microsoft acquired Sysinternals in July, 2006.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116853457625715509?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116853457625715509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116853457625715509' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116853457625715509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116853457625715509'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/system-internals.html' title='System internals'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116853331486675247</id><published>2007-01-11T08:33:00.000-08:00</published><updated>2007-01-11T08:35:14.980-08:00</updated><title type='text'>client application - intermittently receiving an error</title><content type='html'>A client application may intermittently receive an error message when a client application tries to create a COM+ component&lt;br /&gt;View products that this article applies to.&lt;br /&gt;Article ID : 911359 &lt;br /&gt;Last Review : January 20, 2006 &lt;br /&gt;Revision : 2.0 &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SYMPTOMS&lt;br /&gt;When a client application tries to create a Microsoft COM+ component, the client application may intermittently receive an error message. Microsoft C++ applications may receive the following error message:&lt;br /&gt;E_INVALIDARG: "The parameter is incorrect" (0x80070057/-2147024809)&lt;br /&gt;Microsoft Visual Basic 6.0 applications may receive the following error message:&lt;br /&gt;Run-time error '5': "Invalid procedure call or argument" (0x800a0005/-2146828283)&lt;br /&gt;Client applications that are built on the Microsoft .NET Framework may receive the following error message:&lt;br /&gt;System.ArgumentException: "The parameter is incorrect." at System.Runtime.Type.CreateInstanceImpl(Boolean publicOnly) at System.Activator.CreateInstance(Type type, Boolean nonPublic) (with _HResult = 0x80070057/-2147024809)&lt;br /&gt;The COM+ application will typically function without error for some time immediately after the COM+ application is opened. The problem occurs intermittently, but increases in frequency over time until the application eventually fails on every activation request. &lt;br /&gt;&lt;br /&gt;Note When the client application is running on a remote computer, the following error message is logged in the system event log on the client computer: &lt;br /&gt;Event Type: Error &lt;br /&gt;Event Source: DCOM &lt;br /&gt;Event Category: None &lt;br /&gt;Event ID: 10006 &lt;br /&gt;Description: &lt;br /&gt;DCOM got error "One or more arguments are invalid " from the computer SERVERNAME when attempting to activate the server: GUID&lt;br /&gt;&lt;br /&gt; Back to the top &lt;br /&gt;&lt;br /&gt;CAUSE&lt;br /&gt;This problem occurs because the "COM initialization count" for a thread is incremented and decremented when the CoInitialize function and the CoUninitialize function are called. When this count reaches zero after you call the CoUninitialize function, COM will be uninitialized on the thread. When a COM+ STA ThreadPool thread is uninitialized, the thread's apartment activator is destroyed. The next activation request that is routed to this thread will fail with the E_INVALIDARG error message. This problem occurs because the thread apartment activator is no longer available. Only activation requests that are routed to the particular uninitialized thread will fail. As more COM+ ThreadPool threads become uninitialized, a larger percentage of requests will fail. When all COM+ ThreadPool threads become uninitialized, all requests will fail. If the process is restarted, the problem will recover for some time. However, the cycle will be repeated.&lt;br /&gt; Back to the top &lt;br /&gt;&lt;br /&gt;RESOLUTION&lt;br /&gt;To resolve this problem, remove the CoInitialize calls and the CoUninitialize calls from the affected COM DLL. A COM DLL that exposes COM components and is loaded through COM calls from a client should not call the CoInitialize function or the CoUninitialize function on any thread that is used to load or to start the DLL. These threads are owned by the client application, by the COM runtime, or by the COM+ runtime. Only the COM DLL should call these APIs on additional threads that were explicitly created by the COM DLL. However, it is a common bug for COM DLLs to call the CoInitialize function and the CoUninitialize function in response to attach events and detach events in the DllMain function. &lt;br /&gt;&lt;br /&gt;Note It is correct for a standard Win32 DLL that is not loaded through COM to call these APIs if the standard Win32 DLL plans to use COM APIs. However, these functions should not be called from the DllMain function. &lt;br /&gt;&lt;br /&gt;For more information about the CoInitialize function, visit the following Microsoft Developer Network (MSDN) Web site: &lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/0f171cf4-87b9-43a6-97f2-80ed344fe376.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/0f171cf4-87b9-43a6-97f2-80ed344fe376.asp)&lt;br /&gt;For more information about the DllMain function, visit the following MSDN Web site: &lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp)&lt;br /&gt;Note One Microsoft component that contains this bug is the Cdo.dll component. This component is not supported in multithreaded environments. Instead, we recommend that you use the Cdosys.dll component or the Cdonts.dll component. For more information, click the following article number to view the article in the Microsoft Knowledge Base: &lt;br /&gt;247288 (http://support.microsoft.com/kb/247288/) CDO applications are not supported in MTS or COM+&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116853331486675247?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116853331486675247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116853331486675247' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116853331486675247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116853331486675247'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/client-application-intermittently.html' title='client application - intermittently receiving an error'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116853312887224481</id><published>2007-01-11T08:30:00.000-08:00</published><updated>2007-01-11T08:32:09.363-08:00</updated><title type='text'>Service Unavailable - Application pool crash</title><content type='html'>HOWTO: Understand and Diagnose an Application Pool Crash &lt;br /&gt;Problems statements similar to the following questions pop up all the time on various IIS newsgroups, and the user usually claims that they have either seen (or not seen) many posts that look like theirs, and never any concrete solutions. I am going to try and explain the whole thought process, why things work the way it does, as well as useful next steps.&lt;br /&gt;&lt;br /&gt;Question:&lt;br /&gt;#1&lt;br /&gt;&lt;br /&gt;Our production server has recently started experiencing AppPool crashes. These seem to occur sporadically. sometimes three times a day, sometimes not for a couple of days. The error manifests itself to the client as "Service Unavailable". In the system event log we see the following:&lt;br /&gt;A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the World Wide Web Publishing Service With error number: 8007006d&lt;br /&gt;&lt;br /&gt;At the same time (but not always) we see this error in the Application Log &lt;br /&gt;"Faulting application w3wp.exe, version 6.0.3790.0, faulting module kernel32.dll, version 5.2.3790.0, fault address 0x000249d3"&lt;br /&gt;&lt;br /&gt;The application does usually start working again after anywhere between 2 and 15 minutes (although no worker process restarts or recycles appear in our perf logs).&lt;br /&gt;&lt;br /&gt;This problems seems to have started occuring following the latest MS patches being applied to our server. It may just be a coincidence though.&lt;br /&gt;&lt;br /&gt;We are running Windows Server 2003 Standard. We are about to apply SP1 in an attempt to solve this problem, but I wanted to find out if anyone else has had this problem and what the solution was. I have seen several similarish posts but nothing concrete as a solution.&lt;br /&gt;&lt;br /&gt;I have seen this article (http://support.microsoft.com/Default.aspx?id=885654) but it doesn't quite match our situation as we are not running as a domain controller. We haven't yet tried running registry monitor as I wanted to find out if  error 8007006d always equates to a registry permission problem?? before installing&lt;br /&gt;3rd party freeware onto our production server.&lt;br /&gt;&lt;br /&gt;Any help is much appreciated&lt;br /&gt;&lt;br /&gt;#2&lt;br /&gt;&lt;br /&gt;There is a similar question posted today, but the event ID is different&lt;br /&gt;&lt;br /&gt;I see the following error anywhere from 2-3 times a day on Windows 2003 server.&lt;br /&gt;Event ID- 1009, a process serving application pool 'Q' terminated unexpectedly. The process ID was 'xxxx' . The process code was 'xxx'&lt;br /&gt;&lt;br /&gt;So far we have not noticed anything on the application side, but once in a while W3WP.EXE starts using up all the CPU and the server comes to a halt. This is not associated with the application pool terminating, but wondering if it is conntributing it.&lt;br /&gt;&lt;br /&gt;I have applied SP1 for Windows 2003, that did not make any difference.&lt;br /&gt;&lt;br /&gt;Any help is apprciated.&lt;br /&gt;&lt;br /&gt;#3&lt;br /&gt;&lt;br /&gt;Hello Together!&lt;br /&gt;&lt;br /&gt;I've got a problem with my Windows Server 2003 SP 1 Web-Edition&lt;br /&gt;&lt;br /&gt;If I look in the event Viewer, I allways find the following Error:&lt;br /&gt;&lt;br /&gt;Event Type: Error&lt;br /&gt;Event Source: Application Error&lt;br /&gt;Event Category: (100)&lt;br /&gt;Event ID: 1000&lt;br /&gt;Date:  28.08.2005&lt;br /&gt;Time:  22:00:26&lt;br /&gt;User:  N/A&lt;br /&gt;Computer: {removed by the author}&lt;br /&gt;Description:&lt;br /&gt;Faulting application w3wp.exe, version 6.0.3790.1830, faulting module &lt;some module name&gt;, version &lt;some numbers with dots&gt;, fault address 0x&lt;some numbers and letters a thru f&gt;.&lt;br /&gt;&lt;br /&gt;Why does this error occur? What is it and what can I do to resolve this problem?&lt;br /&gt;&lt;br /&gt;Please help me&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt;You are looking at what is commonly refered to as a "crash" or "access violation" on the server. To be clear, this is different from a "hang" on the server, though the web browser may appear to "hang" or the browser's icon motions for some time (the length of time depends on various network connection timeout periods as well as whether the server-side connection stays open or closed) before reporting some random error response relating to missing server, DNS, or other service error.&lt;br /&gt;&lt;br /&gt;Crash vs. Hang&lt;br /&gt;What distinguishes between a crash and a hang on the server? Ok, for the astute reader in the back, just be quiet with this simplification. We want folks to to internalize and understand the issue, not regurgitate dry documentation. :-)&lt;br /&gt;&lt;br /&gt;Practically speaking, a crash is something that will simply wipe out its host process; this will stop whatever server side work and response generation that the process was supposed to perform. Now, prior to IIS6, this same process also held the connection open, so as soon as a user-mode crash happens, IIS will go down and the client browsers see a disconnected connection and usually report some sort of service disconnected/not-found error. With IIS6 Worker Process Isolation Mode, HTTP.SYS holds the connections in kernel-mode, so regardless if user code running in w3wp.exe crashes, the connection stays connected and IIS starts up a new process to handle future requests - so browser clients will NOT see a disconnection for a crash. Unfortunately, the request caught by the crash cannot be re-executed (suppose that request was a bank withdraw...) unless you implemented Transaction semantics, so any unsent response is lost.&lt;br /&gt;&lt;br /&gt;A hang, on the other hand, will usually keep its host process around but the hang prevents any real work from being done. There are many possible ways to do this - user code can be waiting for a lock that never gets released, either because it was leaked or there was a logical deadlock or livelock, or it could be in a clever infinite loop, etc. Once again, any unsent response will never happen once your code gets hung.&lt;br /&gt;&lt;br /&gt;As you can see, from the perspective of the client browser, both a crash and a hang on the server can prevent a complete HTTP response from being sent back, so they can LOOK similar. Add to the fact that browsers may have bugs that cause itself to either crash and hang, and sound security practices on the server should limit information disclosure of errors to the client... so I never use browser behavior or returned HTML to diagnose server-side issues - I always diagnose based on information from various server log files.&lt;br /&gt;&lt;br /&gt;About Diagnosing AppPool Failures...&lt;br /&gt;Unfortunately, there are multiple event log entries from IIS that indicate a "crash" has happened, so you cannot just key-in on any particular event ID for a resolution pattern. For example, the earlier questions illustrate two such events, and there are other related ones.&lt;br /&gt;&lt;br /&gt;Now, we did not intentionally try to make crashes harder to diagnose by making them appear as different events. What is happening is that the W3SVC component of IIS and the user-code execution component of IIS run in separate processes which execute independently of each other, yet asynchronously pass messages back and forth to indicate status. Suppose something crashes the process responsible for user-code execution...&lt;br /&gt;&lt;br /&gt;Sometimes, IIS first notices it when a ping response fails to arrive; other times, IIS notices that the process handle has gone away... and while IIS understands that these are both catestrophic events that should be reported in the event log, it maintains good system design by reporting them uniquely. It is the responsibility of any analysis layers on top of IIS to abstract such detailed reporting and present a  logical "process crashed" information to the user so that they can take action.&lt;br /&gt;&lt;br /&gt;Unfortunately, that analysis layer is frequently the user's brain, who may not be able to abstract the details... and gets confused. But hey, I do not think that IIS should stop giving the details. On the contrary, I think you just have to look at the problem harder. :-) Or complain loudly and get us to provide a better debugging tool (like DebugDiag...).&lt;br /&gt;&lt;br /&gt;What is a Crash&lt;br /&gt;You can consider a crash as an unrecoverable event that resulted from some bug in the program that is executing - in the case of IIS, it simply provides a thin process and support infrastructure for your user code to run. And a bug is basically a logical flaw that results in unintended behavior given some arbitrary set of inputs. Notice that the behavior is unintended, and the set of causes is arbitrary. This basically means that bugs can cause crashes that happen sporadically or periodically... all depending on the set of causes, which is arbitrary!&lt;br /&gt;&lt;br /&gt;Now, since the set of causes to a given bug is arbitrary, I would also caution against trying to "fix" crashes by blindly installing hotfixes, Service Packs, or making configuration changes. Crashes are caused by bugs, which are logical flaws, and the only way to "fix" the situation is to either:&lt;br /&gt;&lt;br /&gt;fix the logical flaw itself, which requires diagnosing the crash to figure out the root of the problem. &lt;br /&gt;change software configuration to avoid the logic flaw causing the crash, which can also require diagnosing the crash to figure out what is causing the issue.&lt;br /&gt;To make things even more interesting... a variety of logic flaws can cause crashes, all of which look the same from an IIS and event log entry perspective (to IIS, the crash ended the process; does not matter what; so just report it).&lt;br /&gt;&lt;br /&gt;Thus, you may see similar looking events, sometimes with similar looking error codes, but no single concrete solution. The reason should be clear to you now - one flaw causing a crash with a certain error code is NOT the same as another flaw causing a crash with an identical error code. You are talking about two different flaws, and depending on the code path taken by your server configuration choices, you may need to do different things.&lt;br /&gt;&lt;br /&gt;So, the take-away here is that the event log entry, the error code, and any other details you may discern are simply good clues to what is going on, but none are independently reliable for diagnosis. Treat them as pieces of a puzzle that you need to put together to correctly diagnose the issue, which is ultimately what you are trying to identify and resolve.&lt;br /&gt;&lt;br /&gt;For example, I treat these events as simply crashes that need to be caught and their stack trace logs analyzed to determine further action. I would not immediately pattern match crashes to "solutions" without other information, and I certainly would not change any system configuration in response.&lt;br /&gt;&lt;br /&gt;Frankly, I think it is rash for users to attempt to resolve their crashes without diagnosing the cause. However, most users seem to love pattern matching problem symptoms and event log entries with supposed solutions and blindly try them all, hoping some might work... all the while sinking deeper into some other problem due to their random changes. And the rationale should be clear now - if you do not know the bug causing the fault, how can you determine the configuration change to avoid that bug's path, or find the right patch to fix the bug?&lt;br /&gt;&lt;br /&gt;How to approach the Crash&lt;br /&gt;Ok, now that I have thoroughly trashed most people's usual methods of "dealing" with a crash, let me walk through another troubleshooting pattern on IIS. :-)  I realize that you are probably under the gun to take some action to fix a problem, so you are willing to try anything and if it works, great; if it doesn't, then there is always product support or newsgroup/forums support to fall back on. I just want to propose a more actionable way to deal with a crash, so that you may be able to take care of things yourself... doesn't that feel good? :-)&lt;br /&gt;&lt;br /&gt;Since you never notice a server crash until you interact with it (usually with a browser), when something unexpected happened and you do not think it is a bug in the application ("hanging" browser or server-error responses are reasonable clues), it is time to look for any signs of a crash on the server. When IIS6 runs in its default Worker Process Isolation Mode, you will see event log entries similar to the sort given in the questions - either IIS noticed the w3wp.exe handle signaled process exit/crash of some sort, or the w3wp.exe fails to respond to a ping, or Windows notices that a process crashed. In IIS5 Compatibility Mode, you will probably notice other event log entries, either saying that the IISADMIN or W3SVC service crashed and has done this for # times, or that dllhost.exe has crashed, etc. Anyways, all these events talk about something related to IIS crashing; you have no idea whether it is due to your code or not.&lt;br /&gt;&lt;br /&gt;Now that you have identified that your issue belongs to a crash, it is time to set up debugging traps so that you can catch the NEXT crash and diagnose it. Yes, you heard me - you cannot do anything about the crash that has already happened - and since you have no idea what it is, you CANNOT change any server settings to avoid it. So, the only reasonable thing you can do is to set up debugging monitors like IIS State or DebugDiag on the necessary processes running code that is crashing and then WAIT for the next crash. Hopefully, you can trigger the failure condition easily, to shorten this wait.&lt;br /&gt;&lt;br /&gt;On this next crash, these tools will produce a stack trace log as well as memory dumps to allow debugging, and you want to either analyze the stack trace log yourself, pay someone to perform an analysis (for example, Microsoft PSS) or post to a newsgroup like microsoft.publit.inetserver.iis to see if anyone will do a free analysis. Only after analysis of the crash can you determine what is truly going wrong&lt;br /&gt;&lt;br /&gt;Hopefully, you only have one crash happening on your server, but even if there are multiple crashes on your server, you simply apply the same technique in serial. You catch one crash, resolve it, get a patch/fix, and run again with debugging enabled to catch the next crash, get it resolved and a patch/fix, etc... As developers will say, crashes are the most straight forward to diagnose and fix - they are truly the low-hanging-fruit of bad behavior on the server, so you should pick them off real early...&lt;br /&gt;&lt;br /&gt;Now, I dissuade against tracking down multiple crashes in parallel because you simply do not know if the crashes are caused by the same or different bugs. If it is caused by the same bug, you are just wasting time diagnosing the other crashes. If it is caused by different bugs, you have no idea whether the bugs interact with each other or not in causing the crash. Ideally, you want to find and fix non-interacting bugs in parallel because interacting bugs may not be real bugs after you fix the original issue (so you would be just wasting resources again). In short, tracking parallel can be complicated and the pay-off is not certain... you have been warned!&lt;br /&gt;&lt;br /&gt;Yes, this is very similar to how the IIS product team approaches bug fixing during our stress/reliability test runs. We start up all IIS processes under the debugger and monitor it for any problems, and as soon as anything crashes/hangs, the debugger is already there so we can diagnose the first occurrence instead of waiting for a second occurrence. And as soon as we get a fix, we just crank everything up again under debuggers and wait for the next failure. Highly efficient and no wasted effort.&lt;br /&gt;&lt;br /&gt;Conclusion&lt;br /&gt;I hope that this helps clarify what is a crash on IIS and how to best deal with it.&lt;br /&gt;&lt;br /&gt;Resist your natural urge to pattern match event log messages or failure codes to a solution, and do not be discouraged if you do not find your particular failure code or if others have similar but supposedly unsolved issues. Crashes are usually arbitrary and requires stack trace analysis to determine the real cause and the next step. If you do not use tools like IIS State or DebugDiag to catch the crash, you will rarely figure out the real culprit and the correct next step. Pattern matching is nothing more than a random guess, so do not take chances.&lt;br /&gt;&lt;br /&gt;Personally, I always attach a debugger to gather a stack trace whenever I suspect a crash. Depending on your debugging skills, this can tell you a whole lot of info, sometimes sufficient to directly fix the issue. Guessing at solutions based on non-specific symptomes can never do this reliably. It is all up to you. :-)&lt;br /&gt;&lt;br /&gt;//David&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks to &lt;a href="http://blogs.msdn.com/david.wang/archive/2005/08/29/HOWTO_Understand_and_Diagnose_an_AppPool_Crash.aspx"&gt;David &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116853312887224481?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116853312887224481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116853312887224481' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116853312887224481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116853312887224481'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2007/01/service-unavailable-application-pool.html' title='Service Unavailable - Application pool crash'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116652938763567358</id><published>2006-12-19T03:55:00.000-08:00</published><updated>2006-12-19T03:56:27.990-08:00</updated><title type='text'>The XML page cannot be displayed</title><content type='html'>A copy of a web page on net.&lt;br /&gt;&lt;a href="http://www.madprops.org/cs/blogs/crucible/archive/2006/05/24/4959.aspx"&gt;source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Okay, well it's been a while since my last post and not with lack of anything to write about - instead I've just been too busy, and all round "tired".  Yes, in the physical sense, but also somewhat in the mental sense with all thats going on at work...&lt;br /&gt;&lt;br /&gt;Yeah, I know my coworkers will find that funny because not so much is going on at work, but with my slight tendancy to stress things are not fun for the moment - but looking up! :)&lt;br /&gt;&lt;br /&gt;Okay, now onto todays topic.&lt;br /&gt;&lt;br /&gt;I've had the worst time getting Community Server to work on my local machine.  You'll have noticed that Mabster has skinned his site over, which is something I've been meaning to do for a long time (along with those 500 other projects I never get onto).&lt;br /&gt;&lt;br /&gt;Well I decided to put Community Server onto my machine so I could play around and see what is indeed possible and I came up with an error message as follows:&lt;br /&gt;&lt;br /&gt;The XML page cannot be displayed &lt;br /&gt;&lt;br /&gt;Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;A name was started with an invalid character. Error processing resource 'http://localhost/cs/Default.aspx'. Line 1, ...&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %&gt;&lt;br /&gt;-^Okay, well that gives you the gist of it, the code might not be exact as I set up another script to mirror the issue.I found some similar input on the Community Server forums:http://communityserver.org/forums/thread/531227.aspxhttp://communityserver.org/files/40/betareleases/entry506323.aspx&lt;br /&gt;&lt;br /&gt;http://communityserver.org/forums/thread/521265.aspx&lt;br /&gt;&lt;br /&gt;http://communityserver.org/forums/thread/511415.aspx&lt;br /&gt;&lt;br /&gt;As well as this I sent off an issue to Telligent (or the Community Server site) team and got no response on this issue, or on the one that means I cannot actually log in to their forums (from two accounts I've set up - it's probably user error in some way, but I won't know since they haven't answered me).&lt;br /&gt;&lt;br /&gt;I've been searching around for the solution and found a lot of mixed up responses all of which end with the advice: run "%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i"&lt;br /&gt;&lt;br /&gt;This did not work for me, time and time again.&lt;br /&gt;&lt;br /&gt;What I found out in my case was, there may have been a conflict with either:&lt;br /&gt;&lt;br /&gt;I installed IIS after I installed the .NET Framework. &lt;br /&gt;I installed the Atlas beta - which apparently has issues. &lt;br /&gt;I have Zone Alarm. &lt;br /&gt;Theres something wrong out there in the air that causes bugs in computers.&lt;br /&gt;As I couldn't quite narrow it down I had to do some searching.  &lt;br /&gt;&lt;br /&gt;What I did come up with, was that although the .NET framework was installed, and IIS could see it on my local machine - .aspx files were not mapped to my IIS file mappings.&lt;br /&gt;&lt;br /&gt;You can find your mappings under:&lt;br /&gt;&lt;br /&gt;Control Panel -&gt; Administrative Tools -&gt; Internet Information Services&lt;br /&gt;&lt;br /&gt;then:&lt;br /&gt;&lt;br /&gt;Right-Click on the Site you want. &lt;br /&gt;Choose Properties. &lt;br /&gt;Go to the "Directory" tab. &lt;br /&gt;Click the "Configuration" button. &lt;br /&gt;Go to the "Mappings" tab. &lt;br /&gt;Look in the "Application Mappings" list.&lt;br /&gt;If you do not see ".aspx" listed as a mapping, your IIS to .NET Framework mappings are not correct.&lt;br /&gt;&lt;br /&gt;In this case, try to run the command: "%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i"&lt;br /&gt;&lt;br /&gt;(You can do this from a command prompt or from the Start -&gt; Run menu).&lt;br /&gt;&lt;br /&gt;If that does not correct your mappings you may have to do what I did, which is uninstall IIS.&lt;br /&gt;&lt;br /&gt;This becomes a bit more difficult, but I can assume if you're trying to install CS then you're probably not terrible with the computer thingy, right?&lt;br /&gt;&lt;br /&gt;Have your Windows XP discs on standby!&lt;br /&gt;&lt;br /&gt;You can uninstall IIS from:&lt;br /&gt;&lt;br /&gt;Control Panel -&gt; Add or Remove Programs&lt;br /&gt;&lt;br /&gt;Choose the: Add/Remove Windows Components button. &lt;br /&gt;Click off Internet Information Services (IIS) checkbox. &lt;br /&gt;Hit "Next" and proceed to uninstall.&lt;br /&gt;Then reinstall IIS from exactly the same place - Add/Remove Windows Components.&lt;br /&gt;&lt;br /&gt;Then run the script: "%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i"&lt;br /&gt;&lt;br /&gt;Make sure your ASP .NET site is back in the IIS web sites menu, and you may want to make sure its got the icon for a website and not just a web folder.&lt;br /&gt;&lt;br /&gt;If it doesn't, just go to the sites properties (Right-Click) and on the "Directory" tab, check to see if the "Application Settings" are filled in.  If they aren't there will be a "Create" button.&lt;br /&gt;&lt;br /&gt;Hit that "Create" button, and then check the "Configuration" button that the mappings are all in there.&lt;br /&gt;&lt;br /&gt;Test your ASP .NET page and it should, hopefully come up.&lt;br /&gt;&lt;br /&gt;If they aren't - well, theres something else thats wrong and give me a holler and I'll try to help out where I can.  I would answer this issue on the Community Server forums, but see the above issue of them not telling me why I cannot log in :)&lt;br /&gt;&lt;br /&gt;Note 1: You're version of the .NET Framework version may vary, check the c:\Windows\Microsoft.NET\Framework directory if the aspnet_regiis script doesn't work as I've stated.&lt;br /&gt;&lt;br /&gt;Note 2: This issue isn't just to do with Community Server, but all ASP .NET pages you'll serve up on your IIS server - I've just posted it this way because it was Community Server I was trying to install (read: It's not a CS problem, it's a .NET and IIS problem).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116652938763567358?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116652938763567358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116652938763567358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116652938763567358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116652938763567358'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/12/xml-page-cannot-be-displayed.html' title='The XML page cannot be displayed'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116592781589062247</id><published>2006-12-12T04:49:00.000-08:00</published><updated>2006-12-12T04:50:46.276-08:00</updated><title type='text'>regular expression checker</title><content type='html'>&lt;FORM ID="demoMatch" NAME="demoMatch" METHOD=POST ACTION="javascript:void(0)"&gt;&lt;br /&gt;&lt;P&gt;Regexp: &lt;INPUT TYPE=TEXT NAME="regex" VALUE="\bt[a-z]+\b" SIZE=50&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Subject string: &lt;INPUT TYPE=TEXT NAME="subject" &lt;br /&gt;   VALUE="This is a test of the JavaScript RegExp object" SIZE=50&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;INPUT TYPE=SUBMIT VALUE="Test Match" ONCLICK="demoMatchClick()"&gt;&lt;br /&gt;&lt;INPUT TYPE=SUBMIT VALUE="Show Match" ONCLICK="demoShowMatchClick()"&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;Replacement text: &lt;INPUT TYPE=TEXT NAME="replacement" VALUE="replaced" SIZE=50&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;Result: &lt;INPUT TYPE=TEXT NAME="result" &lt;br /&gt;   VALUE="click the button to see the result" SIZE=50&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;INPUT TYPE=SUBMIT VALUE="Replace" ONCLICK="demoReplaceClick()"&gt;&lt;/P&gt;&lt;br /&gt;&lt;/FORM&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116592781589062247?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116592781589062247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116592781589062247' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116592781589062247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116592781589062247'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/12/regular-expression-checker.html' title='regular expression checker'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116411323776836521</id><published>2006-11-21T04:45:00.000-08:00</published><updated>2006-11-21T04:47:27.136-08:00</updated><title type='text'></title><content type='html'>In Visual Studio 2005 you may encounter this error when starting an ASP.NET 2.0 debugging session. Particularly you might encounter it if you are using the ASP.NET development server local web server running a local filesystem web site project. &lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;Unable to attach. The binding handle is invalid. &lt;br /&gt;&lt;br /&gt;Do you want to continue anyway? &lt;br /&gt;&lt;br /&gt;Yes / No &lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;To fix this error, go to Start Menu --&gt; Administrative Tools --&gt; Services &lt;br /&gt;&lt;br /&gt;Select the Terminal Services service and make sure it is started. &lt;br /&gt;&lt;br /&gt;I got this error because in my machine the Terminal services was disabled.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116411323776836521?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116411323776836521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116411323776836521' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116411323776836521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116411323776836521'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/11/in-visual-studio-2005-you-may.html' title=''/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116374496810473738</id><published>2006-11-16T22:25:00.000-08:00</published><updated>2006-11-16T22:29:28.436-08:00</updated><title type='text'>huge file transfer over http (asp.net way)</title><content type='html'>/*&lt;br /&gt;Here is a method which reads the contents of the file in chunks and sends it to the client. this way we avoid unnecessary reading of the full file into the memory &lt;br /&gt;&lt;br /&gt;Courtesy: Microsoft website&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    public void DownloadFile(HttpResponse response, string filepath)&lt;br /&gt;    {&lt;br /&gt;        System.IO.Stream iStream = null;&lt;br /&gt;&lt;br /&gt;        // Buffer to read 10K bytes in chunk:&lt;br /&gt;        byte[] buffer = new Byte[10000];&lt;br /&gt;&lt;br /&gt;        // Length of the file:&lt;br /&gt;        int length;&lt;br /&gt;&lt;br /&gt;        // Total bytes to read:&lt;br /&gt;        long dataToRead;&lt;br /&gt;&lt;br /&gt;        // Identify the file to download including its path.&lt;br /&gt;       // string filepath = "DownloadFileName";&lt;br /&gt;&lt;br /&gt;        // Identify the file name.&lt;br /&gt;        string filename = System.IO.Path.GetFileName(filepath);&lt;br /&gt;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            // Open the file.&lt;br /&gt;            iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open,&lt;br /&gt;                        System.IO.FileAccess.Read, System.IO.FileShare.Read);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            // Total bytes to read:&lt;br /&gt;            dataToRead = iStream.Length;&lt;br /&gt;&lt;br /&gt;            response.ContentType = "application/octet-stream";&lt;br /&gt;            response.AddHeader("Content-Disposition", "attachment; filename=" + filename);&lt;br /&gt;&lt;br /&gt;            // Read the bytes.&lt;br /&gt;            while (dataToRead &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                // Verify that the client is connected.&lt;br /&gt;                if (response.IsClientConnected)&lt;br /&gt;                {&lt;br /&gt;                    // Read the data in buffer.&lt;br /&gt;                    length = iStream.Read(buffer, 0, 10000);&lt;br /&gt;&lt;br /&gt;                    // Write the data to the current output stream.&lt;br /&gt;                    response.OutputStream.Write(buffer, 0, length);&lt;br /&gt;&lt;br /&gt;                    // Flush the data to the HTML output.&lt;br /&gt;                    response.Flush();&lt;br /&gt;&lt;br /&gt;                    buffer = new Byte[10000];&lt;br /&gt;                    dataToRead = dataToRead - length;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    //prevent infinite loop if user disconnects&lt;br /&gt;                    dataToRead = -1;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            // Trap the error, if any.&lt;br /&gt;            response.Write("Error : " + ex.Message);&lt;br /&gt;        }&lt;br /&gt;        finally&lt;br /&gt;        {&lt;br /&gt;            if (iStream != null)&lt;br /&gt;            {&lt;br /&gt;                //Close the file.&lt;br /&gt;                iStream.Close();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt; &lt;br /&gt;/*&lt;br /&gt;Other links related to this, may be useful for a reading.&lt;br /&gt;http://www.odetocode.com/Articles/111.aspx&lt;br /&gt;http://www.codecomments.com/archive290-2005-5-471328.html&lt;br /&gt;http://www.ondotnet.com/pub/a/dotnet/2002/04/01/asp.html&lt;br /&gt;http://www.yoda.arachsys.com/csharp/readbinary.html&lt;br /&gt;http://msdn.microsoft.com/msdnmag/issues/05/11/BasicInstincts/&lt;br /&gt;http://asp-net-whidbey.blogspot.com/&lt;br /&gt;http://support.microsoft.com/kb/812406&lt;br /&gt;http://www.eggheadcafe.com/articles/20011006.asp&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116374496810473738?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116374496810473738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116374496810473738' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116374496810473738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116374496810473738'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/11/huge-file-transfer-over-http-aspnet.html' title='huge file transfer over http (asp.net way)'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116124328006277255</id><published>2006-10-18T23:55:00.000-07:00</published><updated>2006-10-19T00:40:51.790-07:00</updated><title type='text'>IIS Problem</title><content type='html'>When try to access an ASPX page on IIS, I got the following error yesterday. i spent few hours before finding a proper solution on this.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;problem description (copied from net)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The XML page cannot be displayed &lt;br /&gt;&lt;br /&gt;Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;A name was started with an invalid character. Error processing resource 'http://localhost/IssueTracker/Default.aspx'. Line...&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Language="vb" AutoEventWireup="false" Inherits="ASPNET.StarterKit.IssueTracker._Default" CodeFile="Default.aspx"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Solution&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;register the dotnet framework again. be sure of the specific version.&lt;br /&gt;you will be getting it in C:\Sysroot(it could be windows\system32)  all the installed .net versions are listed out there. go the correct folder and execute the  "aspnet_regiis -i" from command prompt. it worked for me.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;C:\SYSROOT\Microsoft.NET\Framework\v2.0.50727&lt;br /&gt;\aspnet_regiis -i&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;some other info on &lt;a href="http://professionalaspnet.com/blogs/aspnet_blog/archive/2006/04/07/A_name_was_started_with_an_invalid_character_Error_processing_resource.aspx"&gt;this blog&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116124328006277255?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116124328006277255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116124328006277255' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116124328006277255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116124328006277255'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/10/iis-problem.html' title='IIS Problem'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116012574004778816</id><published>2006-10-06T02:07:00.000-07:00</published><updated>2006-10-06T02:09:00.250-07:00</updated><title type='text'>Java magic</title><content type='html'>Today a collegue of me was having problem in running a Hello.java program which prints plain hello on the console.&lt;br /&gt;&lt;br /&gt;It was complaining time and again "NoSuchMethodError:main"...&lt;br /&gt;&lt;br /&gt;we thought its problem with the JDK in that machine. &lt;br /&gt;&lt;br /&gt;But actual culprit is my collegue only, what she did is that she wrote a Hello.java program with invalid main method (with no arguments) and placed it in JDK\bin directory. she compiled in that location itself so JDK\bin has the Hello.class file too.&lt;br /&gt;&lt;br /&gt;Now she is trying to create Hello.java in a different directory and with proper main method. but she is getting the error.&lt;br /&gt;&lt;br /&gt;When i gave java -verbose Hello &lt;br /&gt;it is showing me that the class is loaded from JDK\bin, that was the mistake.&lt;br /&gt;&lt;br /&gt;i removed the Hello.class file from JDK\bin and it is now referring the class file that is created in the current directory.&lt;br /&gt;&lt;br /&gt;Summary &lt;br /&gt;&lt;br /&gt;JVM gives preference to the JDK\bin directory for locating class files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116012574004778816?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116012574004778816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116012574004778816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116012574004778816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116012574004778816'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/10/java-magic.html' title='Java magic'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-116012330126351093</id><published>2006-10-06T01:28:00.000-07:00</published><updated>2006-10-06T01:28:21.500-07:00</updated><title type='text'>uselinks</title><content type='html'>&lt;a href="http://ajaxsearch.blogspot.com/"&gt;http://ajaxsearch.blogspot.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.hibernate.org/118.html"&gt;http://www.hibernate.org/118.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.javalobby.org/java/forums/t33002.html"&gt;&lt;br /&gt;http://www.javalobby.org/java/forums/t33002.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.javalobby.org/articles/hibernate-query-101/"&gt;&lt;br /&gt;http://www.javalobby.org/articles/hibernate-query-101/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-116012330126351093?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/116012330126351093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=116012330126351093' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116012330126351093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/116012330126351093'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/10/uselinks.html' title='uselinks'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-115875670416743701</id><published>2006-09-20T05:17:00.000-07:00</published><updated>2006-09-20T05:51:48.076-07:00</updated><title type='text'>Log4j</title><content type='html'>Log4j is a  nice logging solution for java developers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.vipan.com/htdocs/log4jhelp.html"&gt;http://www.vipan.com/htdocs/log4jhelp.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://rei1.m-plify.net/log4j/"&gt;http://rei1.m-plify.net/log4j/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.onjava.com/pub/a/onjava/2002/08/07/log4j.html?page=2"&gt;&lt;br /&gt;http://www.onjava.com/pub/a/onjava/2002/08/07/log4j.html?page=2&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-115875670416743701?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/115875670416743701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=115875670416743701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/115875670416743701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/115875670416743701'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/09/log4j.html' title='Log4j'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-115796135619861772</id><published>2006-09-11T00:54:00.000-07:00</published><updated>2006-09-11T00:58:00.636-07:00</updated><title type='text'>downloading a web page using java code</title><content type='html'>U can use the following code to call the following methods and classes:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;HttpURLConnection conn = getHttpURLConnectionUsingProxy(“http://www.google.com” "&lt;userid&gt;", "&lt;password&gt;", "11.11.11.11", "80");&lt;br /&gt;&lt;br /&gt;        conn.connect();&lt;br /&gt;&lt;br /&gt;        InputStream xmlStream = null;&lt;br /&gt;&lt;br /&gt;        xmlStream = conn.getInputStream();&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The code follows:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;public HttpURLConnection getHttpURLConnectionUsingProxy(String urlstring, String username, String password, String proxyHost, String proxyPort){&lt;br /&gt;&lt;br /&gt;        String input = username + ":" + password;&lt;br /&gt;&lt;br /&gt;        String encoding = base64Encode(input);&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;&lt;br /&gt;        // Enable the properties used for proxy support&lt;br /&gt;&lt;br /&gt;        System.getProperties().put("proxySet", "true" );&lt;br /&gt;&lt;br /&gt;        System.getProperties().put("proxyHost",proxyHost);&lt;br /&gt;&lt;br /&gt;        System.getProperties().put("proxyPort", proxyPort);&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;&lt;br /&gt;                        HttpURLConnection connection = null;&lt;br /&gt;&lt;br /&gt;                        try{&lt;br /&gt;&lt;br /&gt;                        URL url = new URL(urlstring);&lt;br /&gt;&lt;br /&gt;                        connection = (HttpURLConnection)url.openConnection();&lt;br /&gt;&lt;br /&gt;         // Set up the connection so it knows you are sending&lt;br /&gt;&lt;br /&gt;         // proxy user information&lt;br /&gt;&lt;br /&gt;         connection.setRequestProperty( "Proxy-Authorization", encoding );                                 &lt;br /&gt;&lt;br /&gt;                        }catch(MalformedURLException murle){&lt;br /&gt;&lt;br /&gt;                        System.out.println("MalformedURLException: " + murle.getMessage());&lt;br /&gt;&lt;br /&gt;                        }catch(IOException ioe){&lt;br /&gt;&lt;br /&gt;                        System.out.println("IOException: " + ioe.getMessage());&lt;br /&gt;&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;                        if (connection==null) System.out.println("Returning null connection");&lt;br /&gt;&lt;br /&gt;                        return connection;&lt;br /&gt;&lt;br /&gt;                        &lt;br /&gt;&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;     public String base64Encode(String s){&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;              ByteArrayOutputStream bOut = new ByteArrayOutputStream();&lt;br /&gt;&lt;br /&gt;                  Base64OutputStream out = new Base64OutputStream(bOut);&lt;br /&gt;&lt;br /&gt;                  try{  &lt;br /&gt;&lt;br /&gt;            out.write(s.getBytes());&lt;br /&gt;&lt;br /&gt;                    out.flush();&lt;br /&gt;&lt;br /&gt;                  }catch (IOException exception){&lt;br /&gt;&lt;br /&gt;                  }&lt;br /&gt;&lt;br /&gt;                  return bOut.toString();&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;A separate class:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;public class Base64OutputStream extends FilterOutputStream {&lt;br /&gt;&lt;br /&gt;            private int col = 0;&lt;br /&gt;&lt;br /&gt;            private int i = 0;&lt;br /&gt;&lt;br /&gt;              private int[] inbuf = new int[3];&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;            public Base64OutputStream(OutputStream out){  &lt;br /&gt;&lt;br /&gt;            super(out);&lt;br /&gt;&lt;br /&gt;              }&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;              public void write(int c) throws IOException{  &lt;br /&gt;&lt;br /&gt;            inbuf[i] = c;&lt;br /&gt;&lt;br /&gt;                  i++;&lt;br /&gt;&lt;br /&gt;                  if (i==3){&lt;br /&gt;&lt;br /&gt;            super.write(toBase64[(inbuf[0] &amp; 0xFC) &gt;&gt; 2]);&lt;br /&gt;&lt;br /&gt;                    super.write(toBase64[((inbuf[0] &amp; 0x03) &lt;&lt; 4) | ((inbuf[1] &amp; 0xF0) &gt;&gt; 4)]);&lt;br /&gt;&lt;br /&gt;                    super.write(toBase64[((inbuf[1] &amp; 0x0F) &lt;&lt; 2) | ((inbuf[2] &amp; 0xC0) &gt;&gt; 6)]);&lt;br /&gt;&lt;br /&gt;                    super.write(toBase64[inbuf[2] &amp; 0x3F]);&lt;br /&gt;&lt;br /&gt;                    col += 4;&lt;br /&gt;&lt;br /&gt;                    i = 0;&lt;br /&gt;&lt;br /&gt;                    if (col &gt;= 76){&lt;br /&gt;&lt;br /&gt;            super.write('\n');&lt;br /&gt;&lt;br /&gt;                        col = 0;&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;&lt;br /&gt;              public void flush() throws IOException{&lt;br /&gt;&lt;br /&gt;            if (i==1){&lt;br /&gt;&lt;br /&gt;            super.write(toBase64[(inbuf[0] &amp; 0xFC) &gt;&gt; 2]);&lt;br /&gt;&lt;br /&gt;                    super.write(toBase64[(inbuf[0] &amp; 0x03) &lt;&lt; 4]);&lt;br /&gt;&lt;br /&gt;                    super.write('=');&lt;br /&gt;&lt;br /&gt;                    super.write('=');&lt;br /&gt;&lt;br /&gt;                  }else if (i==2){  &lt;br /&gt;&lt;br /&gt;            super.write(toBase64[(inbuf[0] &amp; 0xFC) &gt;&gt; 2]);&lt;br /&gt;&lt;br /&gt;                    super.write(toBase64[((inbuf[0] &amp; 0x03) &lt;&lt; 4) | ((inbuf[1] &amp; 0xF0) &gt;&gt; 4)]);&lt;br /&gt;&lt;br /&gt;                    super.write(toBase64[(inbuf[1] &amp; 0x0F) &lt;&lt; 2]);&lt;br /&gt;&lt;br /&gt;                    super.write('=');&lt;br /&gt;&lt;br /&gt;                  }&lt;br /&gt;&lt;br /&gt;              }&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;              private char[] toBase64 = {  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',&lt;br /&gt;&lt;br /&gt;                  'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',&lt;br /&gt;&lt;br /&gt;                  'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',&lt;br /&gt;&lt;br /&gt;                  'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',&lt;br /&gt;&lt;br /&gt;                  'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',&lt;br /&gt;&lt;br /&gt;                  'o', 'p', 'q', 'r', 's', 't', 'u', 'v',&lt;br /&gt;&lt;br /&gt;                  'w', 'x', 'y', 'z', '0', '1', '2', '3',&lt;br /&gt;&lt;br /&gt;                  '4', '5', '6', '7', '8', '9', '+', '/'&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;i&gt;Thanks to chaya Infosys, chennai &lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-115796135619861772?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/115796135619861772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=115796135619861772' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/115796135619861772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/115796135619861772'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/09/downloading-web-page-using-java-code.html' title='downloading a web page using java code'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-115034764423008791</id><published>2006-06-14T21:55:00.000-07:00</published><updated>2006-06-14T22:00:44.636-07:00</updated><title type='text'>Database Connection Pooling with Tomcat</title><content type='html'>Database Connection Pooling with Tomcat&lt;br /&gt;by Kunal Jaggi&lt;br /&gt;04/19/2006 &lt;br /&gt;Software object pooling is not a new concept. There are many scenarios where some type of object pooling technique is employed to improve application performance, concurrency, and scalability. After all, having your database code create a new Connection object on every client request is an expensive process. Moreover, with today's demanding applications, creating new connections for data access from scratch, maintaining them, and tearing down the open connection can lead to massive load on the server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Connection pooling eliminates JDBC overhead. Further, object pooling also helps to reduce the garbage collection load. In this article, we'll look at an elegant way of creating a pool of open database-connection objects in Tomcat, so that they are handy whenever an application needs to access a DB resource.&lt;br /&gt;With Database Connection Pooling (DBCP), we can scale our applications to handle increased load and deliver high performance benefits. Using recycled database connection objects cuts the time taken to re-instantiate and load frequently used objects, thus reducing unnecessary overheads. Configuring a DB pool can be a daunting task, because there has to be a way for different components within an application to know about the available pooled objects, and a mechanism to locate them. This is exactly where JNDI steps in, tying these dependencies together.&lt;br /&gt;JNDI to the Rescue&lt;br /&gt;The Java Naming and Directory Interface (JNDI) has been at the core of Java EE since its inception. JNDI offers a generic mechanism for Java EE components to find other components, resources, or services indirectly at runtime. The primary role of JNDI in a Java EE application is to provide an indirection layer, so that components can find required resources without being particularly aware of the indirection. This indirection is almost transparent. JNDI helps in holding applications together, but this coupling is very flexible, so that apps can be easily reassembled. JNDI spares you from providing direct references to the data source, JDBC driver class names, user names and passwords, or any vendor-specific quirks of setting up pooling. We just look up all of these dependencies at runtime through a JNDI call. The developer, on the other hand, is ignorant of the external resources.&lt;br /&gt;Tomcat Configuration&lt;br /&gt;Our approach to DBCP uses the Jakarta-Commons database connection pool. But first, we need to configure the JNDI DataSource in Tomcat by adding a declaration for the resource to server.xml file, which resides inside the /conf directory of your Tomcat installation (indicated by the environment variable CATALINA_HOME). The JNDI DataSource is used as a factory for connections. One of the major advantages of using a configuration like this is that the characteristics of the pool can be changed without affecting the application code. Our application's use of connection pooling is almost transparent. The following code snippet shows us how to configure the container to enable connection pooling.&lt;br /&gt;&lt;Context path="/dbcp" docBase="dbcp" debug="5"&lt;br /&gt;reloadable="true" crossContext="true"&gt;&lt;br /&gt;&lt;br /&gt;&lt;Resource name="jdbc/TestDB" auth="Container"&lt;br /&gt;   type="javax.sql.DataSource" removeAbandoned="true"&lt;br /&gt;   removeAbandonedTimeout="30" maxActive="100"&lt;br /&gt;   maxIdle="30" maxWait="10000" username="kunal"&lt;br /&gt;   password="java_facier"&lt;br /&gt;   driverClassName="com.mysql.jdbc.Driver"&lt;br /&gt;   url="jdbc:mysql://localhost/dbcptest"/&gt;&lt;br /&gt;&lt;br /&gt;&lt;/Context&gt;&lt;br /&gt;We can configure a maximum number of DB connections in the pool. Make sure you choose a maximum connection count large enough to handle all of your database connections--alternatively, you can set 0 for no limit. Further, we can set the maximum number of idle database connections to be retained in the pool. Set this value to -1 for no limit. The most optimal performance is attained when the pool in its steady state contains just enough connections to service all concurrent connection requests, without having to create new physical database connections at runtime. We can also specify the maximum time (in milliseconds) to wait for a database connection to become available, which in this example is 10 seconds. An exception is thrown if this timeout is exceeded. You can set this value to -1 to wait indefinitely. Please make sure your connector driver, such as mysql.jar, is placed inside the /common/lib directory of your Tomcat installation.&lt;br /&gt;To achieve performance and high throughput, we also need to fine-tune the container to work under heavy traffic. Here's how we'll configure the Connector element for the maxProcessors and acceptCount parameters in the server.xml file:&lt;br /&gt;&lt;!--  Configuring the request and response endpoints --&gt;&lt;br /&gt;&lt;Connector port="80" maxHttpHeaderSize="8192" maxProcessors="150"&lt;br /&gt;   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"&lt;br /&gt;   enableLookups="false" redirectPort="8443" acceptCount="150"&lt;br /&gt;   connectionTimeout="20000" disableUploadTimeout="true" /&gt;&lt;br /&gt;Configuring JNDI Reference&lt;br /&gt;In order for JNDI to resolve the reference, we have to insert a &lt;resource-ref&gt; tag into the web.xml deployment descriptor file. We first begin by setting a &lt;listener&gt; tag for registering a ServletContextListener as shown below:&lt;br /&gt;&lt;br /&gt;&lt;listener&gt;&lt;br /&gt;        &lt;listener-class&gt; com.onjava.dbcp.DBCPoolingListener&lt;/listener-class&gt;&lt;br /&gt;&lt;/listener&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- This component has a dependency on an external resource--&gt;&lt;br /&gt; &lt;resource-ref&gt;&lt;br /&gt;      &lt;description&gt; DB Connection Pooling&lt;/description&gt;&lt;br /&gt;      &lt;res-ref-name&gt; jdbc/TestDB&lt;/res-ref-name&gt;&lt;br /&gt;      &lt;res-type&gt; javax.sql.DataSource&lt;/res-type&gt;&lt;br /&gt;      &lt;res-auth&gt; Container&lt;/res-auth&gt;&lt;br /&gt;  &lt;/resource-ref&gt;&lt;br /&gt;&lt;br /&gt;&lt;servlet&gt;&lt;br /&gt;        &lt;servlet-name&gt; EnrolledStudents&lt;/servlet-name&gt;&lt;br /&gt;        &lt;servlet-class&gt; com.onjava.dbcp.CourseEnrollmentServlet&lt;/servlet-class&gt;&lt;br /&gt;        &lt;load-on-startup&gt; 1&lt;/load-on-startup&gt;&lt;br /&gt;&lt;/servlet&gt;&lt;br /&gt;&lt;br /&gt;&lt;servlet-mapping&gt;&lt;br /&gt;        &lt;servlet-name&gt; EnrolledStudents&lt;/servlet-name&gt;&lt;br /&gt;        &lt;url-pattern&gt; /enrollment.do&lt;/url-pattern&gt;&lt;br /&gt;&lt;/servlet-mapping&gt;&lt;br /&gt;This binding is vendor-specific, and every container has its own mechanism for setting data sources. Please note that this is just a declaration for dependency on an external resource, and doesn't create the actual resource. Comprehending the tags is pretty straightforward: this indicates to the container that the local reference name jdbc/TestDB should be set by the app deployer, and this should match with the resource name, as declared in server.xml file.&lt;br /&gt;Putting DBCP into Action&lt;br /&gt;As our application first starts asking the pool for Connection objects, they will be newly created, but when the application has finished with an object, it's returned to the pool rather than destroyed. This has huge performance benefits. Now, as the application needs more Connection objects, the pool will be able to issue recycled objects that have previously been returned by the application.&lt;br /&gt;As an example, let's create a listener class to work with the pool. Our listener class implements the ServletContextListener interface; thus, it'll be initialized when the container starts and creates a ServletContext for this web app. Remember, there's only one ServletContext per web app. Any class implementing the ServletContextListener interface is initialized when the container starts. This early initialization cuts unnecessary overhead later, since it's ideal to have a cached set of open database connection objects available when the container starts rather than waiting for a client request. Inside the listener class, we'll do the necessary JNDI lookup and then set the DataSource as a ServletContext attribute so that it's available to the entire web app. The following code snippet shows us how to extract DataSource through a JNDI call:&lt;br /&gt;public class DBCPoolingListener implements&lt;br /&gt;ServletContextListener{&lt;br /&gt; public void contextInitialized&lt;br /&gt;  (ServletContextEvent sce){&lt;br /&gt;&lt;br /&gt;  try {&lt;br /&gt;    // Obtain our environment naming context&lt;br /&gt;    Context envCtx = (Context) new InitialContext().&lt;br /&gt;    lookup("java:comp/env");&lt;br /&gt;&lt;br /&gt;    // Look up our data source&lt;br /&gt;    DataSource  ds = (DataSource) envCtx.lookup&lt;br /&gt;       ("jdbc/TestDB");&lt;br /&gt;&lt;br /&gt;    sce.getServletContext().setAttribute&lt;br /&gt;      ("DBCPool", ds);&lt;br /&gt;   } catch(NamingException e){ e.printStackTrace();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; public void contextDestroyed(ServletContextEvent&lt;br /&gt; sce){&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;The component naming context is indicated by the prefix java:comp/env/.&lt;br /&gt;For the sake of simplicity, we'll create a simple servlet, hard-coding the business logic and presentation. We'll use the JDBC 2.0 Standard Extension API, which specifies that a database service provider can implement a pooling technique that can allow multiple Connection objects to be shared among several requesting clients. Here's how we'll extract DataSource from the ServletContext attribute and then establish a Connection to pooled DB connection objects.&lt;br /&gt;public void init() throws ServletException {&lt;br /&gt;    try {&lt;br /&gt; //Create a datasource for pooled connections.&lt;br /&gt; datasource = (DataSource) getServletContext().&lt;br /&gt; getAttribute("DBCPool");&lt;br /&gt;&lt;br /&gt;  //Register the driver for non-pooled connections.&lt;br /&gt;  Class.forName("com.mysql.jdbc.Driver").&lt;br /&gt;      newInstance();&lt;br /&gt;    }&lt;br /&gt;    catch (Exception e) {&lt;br /&gt;      throw new ServletException(e.getMessage());&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;The servlet is written to use either pooled or non-pooled database connections, depending on the query string passed in its URL. The servlet fetches a pooled connection object using Tomcat DBCP, and non-pooled connections directly from MySQL connector.&lt;br /&gt;Here's an example of obtaining a Connection object. If the pooledConnection flag is set, it simply calls getConnection() on the DataSource. If not, it manually creates a new Connection object:&lt;br /&gt;private synchronized Connection getConnection&lt;br /&gt;    (boolean pooledConnection)&lt;br /&gt;    throws SQLException {&lt;br /&gt;  if (pooledConnection) {&lt;br /&gt;     pooledCount++;&lt;br /&gt;&lt;br /&gt;    // Allocate and use a connection from the pool&lt;br /&gt;    return datasource.getConnection();&lt;br /&gt;  }&lt;br /&gt;  else {&lt;br /&gt;&lt;br /&gt;    nonPooledCount++;&lt;br /&gt;    Connection con = DriverManager.getConnection(&lt;br /&gt;      "jdbc:mysql://localhost/dbcptest","kunal",&lt;br /&gt;      "java_facier");&lt;br /&gt;    return con;   //return a newly created object&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;Having acquired a Connection, the servlet executes a simple join between the course and enrollment tables, and then formats and outputs the results as HTML. The example uses PreparedStatement to pre-compile SQL and run it repeatedly. This eliminates the tedious task of parsing and compiling the SQL query on every client request. Pre-compilation improves performance and offers enhanced security by preventing SQL injection attacks. For thread safety, we'll keep Connection, PreparedStatement, and ResultSet as local variables inside of the doGet() method.&lt;br /&gt;&lt;br /&gt;Connections issued from the JNDI DataSource factory will be returned to the pool when closed. Clients use a connection pool by borrowing a connection object, using it, and then returning it to the pool by closing it. We have to make sure that after we are done with the Connection, we close it. If a Connection is not closed, it will never be returned to the pool and become available for reuse. Of course, that would tie up resources. The finally block guarantees that used ResultSet, PreparedStatement, and Connection objects are closed and prevents any connection pool leaks, as shown below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;finally {&lt;br /&gt;      try {if (rs != null) rs.close();} catch (SQLException e) {}&lt;br /&gt;      try {if (pstmt != null) pstmt.close();} catch (SQLException e) {}&lt;br /&gt;      try {if (connection != null) connection.close();} catch (SQLException e) {}&lt;br /&gt;    }&lt;br /&gt;Performance Measurement&lt;br /&gt;Before our application hits the ground running, we would like to stress test the app, evaluate its performance, and compare the results between the cached set of pooled connection objects and the non-pooling alternative. For this, we'll rely on JMeter, an open source tool for load testing with a drag-and-drop-style GUI. I have written a test plan for stress testing the web app. I have set up JMeter to stimulate 50 concurrent users, accessing a common servlet two times without any interval. The results are pretty apparent after looking at the JMeter graph results shown in Figures 1 and 2, below.&lt;br /&gt; &lt;br /&gt;Figure 1. Pooled DB connections deviation (click for full-size image)&lt;br /&gt; &lt;br /&gt;Figure 2. Non-pooled DB connections deviation (click for full-size image)&lt;br /&gt;After several test runs, it turned out that connection pooling is at least four times faster than explicitly creating a DB connection object from the ground up. Admittedly, to get more accurate results, JMeter should run on a different machine. The ramp-up period, which describes the amount of time for creating the total number of threads, should be carefully chosen. It's not considered to be a good idea to set it to zero if you have a large number of threads, because that would create all of the threads at once and send out requests immediately. At the same time, a higher ramp-up period is also not appropriate, as it might underestimate the results.&lt;br /&gt;Conclusion&lt;br /&gt;Connection pooling is a technique used for sharing a cached set of open database connections among several requesting clients. It doesn't require you to modify your code significantly; rather, it provides enhanced performance benefits. Object pooling should be used with care. It does require additional overhead for such tasks as managing the state of the object pool, issuing objects to the application, and recycling used objects. Pooling is best suited for objects that have a short lifetime. If you are already working in a rich Java EE environment, then most likely you would be using an out-of-box connection pooling facility provided by your app server, and your applications' use of connection pooling is almost transparent.&lt;br /&gt;Resources&lt;br /&gt;http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html&lt;br /&gt;• Example source code used in this article&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Writing a custom session listener:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;listener&gt;    &lt;br /&gt;        &lt;listener-class&gt;central.OurSessionListener&lt;/listener-class&gt;  &lt;br /&gt;&lt;/listener&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is my listener class:&lt;br /&gt;package central;&lt;br /&gt; &lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import javax.servlet.http.HttpSession;&lt;br /&gt;import javax.servlet.http.HttpSessionEvent;&lt;br /&gt;import javax.servlet.http.HttpSessionListener;&lt;br /&gt; &lt;br /&gt;import wwxchange.utility.*;&lt;br /&gt;import wwxchange.beans.*;&lt;br /&gt; &lt;br /&gt;public class OurSessionListener implements HttpSessionListener {&lt;br /&gt; &lt;br /&gt;  public void sessionCreated(HttpSessionEvent se) {&lt;br /&gt;    HttpSession session = se.getSession();&lt;br /&gt;    UserAcctBean user = (UserAcctBean) session.getAttribute("currentuser");&lt;br /&gt;    String loginID = user.getLoginID();&lt;br /&gt;    System.out.println("Added session: " + session.getId() + " for user " + user.getLoginID());&lt;br /&gt;    SystemControl.addActiveUser(session.getId(), user.getLoginID() );&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  public void sessionDestroyed(HttpSessionEvent se) {&lt;br /&gt;    HttpSession session = se.getSession();&lt;br /&gt;    SystemControl.removeActiveUser(session.getId());&lt;br /&gt;    System.out.println("Removed session: " + session.getId());&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;source: http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html?page=3&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/t0010264.htm&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-115034764423008791?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/115034764423008791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=115034764423008791' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/115034764423008791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/115034764423008791'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/06/database-connection-pooling-with.html' title='Database Connection Pooling with Tomcat'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-114382258243493141</id><published>2006-03-31T08:29:00.000-08:00</published><updated>2006-03-31T08:29:42.870-08:00</updated><title type='text'>Developer zone</title><content type='html'>&lt;a href="http://developerzone.com/index.html"&gt;Developer zone&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-114382258243493141?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/114382258243493141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=114382258243493141' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114382258243493141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114382258243493141'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/03/developer-zone.html' title='Developer zone'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-114346448616763333</id><published>2006-03-27T05:00:00.000-08:00</published><updated>2006-03-27T05:23:33.636-08:00</updated><title type='text'>java and software performance</title><content type='html'>&lt;a href="http://sachinhejip.blogspot.com"&gt;Sachin's blog on Java and software performance&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here another one&lt;br /&gt;&lt;a href="http://www.me.umn.edu/%7Eshivane/blogs/cafefeed/"&gt;http://www.me.umn.edu/%7Eshivane/blogs/cafefeed/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-114346448616763333?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/114346448616763333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=114346448616763333' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114346448616763333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114346448616763333'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/03/java-and-software-performance.html' title='java and software performance'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-114313665099840005</id><published>2006-03-23T09:47:00.000-08:00</published><updated>2006-03-23T09:57:31.526-08:00</updated><title type='text'>Data Mining</title><content type='html'>www.luigidragone.com/datamining/&lt;br /&gt;&lt;br /&gt;http://www.helsinki.fi/~holler/datamining/algorithms.html&lt;br /&gt;http://www.csc.liv.ac.uk/~frans/KDD/Software/Apriori-TFP/aprioriTFP.html&lt;br /&gt;&lt;br /&gt;http://www.helsinki.fi/~holler/datamining/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-114313665099840005?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/114313665099840005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=114313665099840005' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114313665099840005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114313665099840005'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/03/data-mining.html' title='Data Mining'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-114190906392635584</id><published>2006-03-09T04:57:00.001-08:00</published><updated>2006-03-09T04:57:49.863-08:00</updated><title type='text'>java Exceptions</title><content type='html'>&lt;a href="http://radio.weblogs.com/0122027/stories/2003/04/01/JavasCheckedExceptionsWereAMistake.html"&gt;http://radio.weblogs.com/0122027/stories/2003/04/01/JavasCheckedExceptionsWereAMistake.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-114190906392635584?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/114190906392635584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=114190906392635584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114190906392635584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/114190906392635584'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/03/java-exceptions_09.html' title='java Exceptions'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113992256680818015</id><published>2006-02-14T05:05:00.000-08:00</published><updated>2006-02-14T05:27:22.190-08:00</updated><title type='text'>oracle top n query</title><content type='html'>&lt;a href="http://www.devx.com/gethelpon/10MinuteSolution/16608/0/page/5"&gt;http://www.devx.com/gethelpon/10MinuteSolution/16608/0/page/5&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;select * from &lt;br /&gt;emp a&lt;br /&gt;where 3 = (select count(distinct(sal)) from emp b&lt;br /&gt;where b.sal &gt;a.sal)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal&lt;br /&gt;   FROM&lt;br /&gt;   (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal,&lt;br /&gt;      RANK() OVER&lt;br /&gt;         (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank&lt;br /&gt;      FROM Emp&lt;br /&gt;      ORDER BY SAL Desc NULLS LAST)&lt;br /&gt;   WHERE Emp_Rank =2;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113992256680818015?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113992256680818015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113992256680818015' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113992256680818015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113992256680818015'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/02/oracle-top-n-query_14.html' title='oracle top n query'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113992200556119178</id><published>2006-02-14T04:55:00.000-08:00</published><updated>2006-02-14T05:04:16.093-08:00</updated><title type='text'>oracle top n query</title><content type='html'>select * from &lt;br /&gt;emp a&lt;br /&gt;where 3 = (select count(distinct(sal)) from emp b&lt;br /&gt;where b.sal &gt;a.sal)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal&lt;br /&gt;   FROM&lt;br /&gt;   (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal,&lt;br /&gt;      RANK() OVER&lt;br /&gt;         (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank&lt;br /&gt;      FROM Emp&lt;br /&gt;      ORDER BY SAL Desc NULLS LAST)&lt;br /&gt;   WHERE Emp_Rank =2;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113992200556119178?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113992200556119178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113992200556119178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113992200556119178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113992200556119178'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/02/oracle-top-n-query.html' title='oracle top n query'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113958498963211367</id><published>2006-02-10T07:22:00.000-08:00</published><updated>2006-02-10T07:23:09.986-08:00</updated><title type='text'>VB and oracle</title><content type='html'>Links i Referred&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.orafaq.com/faqmsvb.htm"&gt;http://www.orafaq.com/faqmsvb.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;300596&amp;sd=tech"&gt;http://support.microsoft.com/default.aspx?scid=kb;en-us;300596&amp;sd=tech&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create a System DSN in Windows XP&lt;br /&gt;&lt;br /&gt;1. Click Start, point to Control Panel, double-click Administrative Tools, and then double-click Data Sources(ODBC).&lt;br /&gt;2. Click the System DSN tab, and then click Add.&lt;br /&gt;3. Click the database driver that corresponds with the database type to which you are connecting, and then click Finish.&lt;br /&gt;4. Type the data source name. Make sure that you choose a name that you can remember. You will need to use this name later.&lt;br /&gt;5. Click Select.&lt;br /&gt;6. Click the correct database, and then click OK.&lt;br /&gt;7. Click OK, and then click OK.&lt;br /&gt;&lt;br /&gt;o Create a System DSN in Windows 2000&lt;br /&gt;1. Click Start, point to Programs, point to Administrative Tools, and then double-click Data Sources (ODBC).&lt;br /&gt;&lt;br /&gt;NOTE: In Windows 2000 Professional, click Start, point to Settings, click Control Panel, double-click Administrative Tools, and then double-click Data Sources (ODBC).&lt;br /&gt;2. Click the System DSN tab.&lt;br /&gt;3. Click Add.&lt;br /&gt;4. Click the database driver that corresponds with the database type to which you are connecting, and then click Finish.&lt;br /&gt;5. Type the data source name. Make sure to you a name that you will remember. You will need to use this name later.&lt;br /&gt;6. Click Select.&lt;br /&gt;7. Click the correct database, and then click OK.&lt;br /&gt;8. Click OK in the next two dialog boxes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ow does one connect to Oracle from VB?&lt;br /&gt;Connectivity to Oracle is provided via ODBC or OO4O (Oracle Objects for OLE). For more information about ODBC, read the ODBC FAQ. For information about OO4O, read the OO4O FAQ. Look at this examples:&lt;br /&gt;&lt;br /&gt;' DAO Example (Data Access Objects)&lt;br /&gt;&lt;br /&gt;Dim wstemp As Workspace&lt;br /&gt;Dim dbtemp As Database&lt;br /&gt;Dim rstemp As Recordset&lt;br /&gt;&lt;br /&gt;Set wstemp = DBEngine.Workspaces(0)&lt;br /&gt;Set dbtemp = wstemp.OpenDatabase("", False, False, "ODBC;DSN=Oracle;USR=scott;PWD=tiger")&lt;br /&gt;Set rstemp = dbtemp.OpenRecordset(myquery.Text, dbOpenDynaset, dbSQLPassThrough)&lt;br /&gt;howmany = 0&lt;br /&gt;Combo1.Clear&lt;br /&gt;Do Until rstemp.EOF&lt;br /&gt;  msgbox rstemp(0)&lt;br /&gt; rstemp.MoveNext&lt;br /&gt; howmany = howmany + 1&lt;br /&gt;Loop&lt;br /&gt;&lt;br /&gt;' RDO Example (Remote Data Objects)&lt;br /&gt;&lt;br /&gt;Dim contemp As New rdoConnection&lt;br /&gt;Dim rstemp  As rdoResultset&lt;br /&gt;Dim envtemp As rdoEnvironment&lt;br /&gt;Set envtemp = rdoEngine.rdoEnvironments(0)&lt;br /&gt;envtemp.CursorDriver = rdUseServer&lt;br /&gt;           ' or rdUseOdbc, rdUseNone, rdUseIfNeeded, rdUseClientBatch&lt;br /&gt;With contemp&lt;br /&gt;  .Connect = "ODBC;DSN=Oracle;USR=scott;PWD=tiger"&lt;br /&gt;  .EstablishConnection rdDriverNoPrompt, false, rdoForwardOnly&lt;br /&gt;                                           ' or rdoStatic, rdoKeyset, rdoDynamic&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;Set rstemp = contemp.OpenResultset("select ...") ' Your SQL here&lt;br /&gt;&lt;br /&gt;howmany = 0&lt;br /&gt;With rstemp&lt;br /&gt;Do Until .EOF Or howmany &gt; 2000&lt;br /&gt;   msgbox .rdoColumns(0) ' Popup a message box showing the 1st column&lt;br /&gt;   .MoveNext&lt;br /&gt;   howmany = howmany + 1&lt;br /&gt;Loop&lt;br /&gt;&lt;br /&gt;ADO Example&lt;br /&gt;&lt;br /&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Public m_adoCnn As New ADODB.Connection&lt;br /&gt;Public m_adoRst As New ADODB.Recordset&lt;br /&gt;&lt;br /&gt;Public Sub Command1_Click()&lt;br /&gt;    m_adoCnn.ConnectionString = "Provider=MSDAORA;Password=tiger;User ID=scott;Data Source=database"&lt;br /&gt;    m_adoCnn.Open&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Form_Unload(Cancel As Integer)&lt;br /&gt;    m_adoCnn.Close&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;OO4O Example&lt;br /&gt;&lt;br /&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Dim m_oraSession  As Object&lt;br /&gt;Dim m_oraDatabase As Object&lt;br /&gt;&lt;br /&gt;Private Sub Command1_Click()&lt;br /&gt;    Set m_oraSession = CreateObject("OracleInProcServer.XOraSession")&lt;br /&gt;    Set m_oraDatabase = m_oraSession.DBOpenDatabase("Database", "user/password", 0&amp;)&lt;br /&gt;    &lt;br /&gt;    MsgBox "Connected to " &amp; m_oraDatabase.Connect &amp; "@" &amp; m_oraDatabase.DatabaseName&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Form_Unload(Cancel As Integer)&lt;br /&gt;    Set m_oraDatabase = Nothing&lt;br /&gt;    Set m_oraSession = Nothing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;# Back to top of file&lt;br /&gt;Why is there only one record in my recordset?&lt;br /&gt;When you do a recordcount and it return only one record in the recordset, while you know there are more records, you need to move to the last record before doing the count. Look at this example.&lt;br /&gt;&lt;br /&gt;Dim rs As Recordset &lt;br /&gt;rs.MoveLast &lt;br /&gt;TxtNumRows.Text = rs.RecordCount&lt;br /&gt;&lt;br /&gt;NOTE: Don't forget to do a rs.MoveFirst to get back to the first record again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113958498963211367?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113958498963211367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113958498963211367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113958498963211367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113958498963211367'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/02/vb-and-oracle.html' title='VB and oracle'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113940407217334173</id><published>2006-02-08T05:05:00.000-08:00</published><updated>2006-04-18T20:48:57.160-07:00</updated><title type='text'>P2P SSL authentication and JAVA with OpenSSL</title><content type='html'>This post contains some of my work about java and openssl. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Pre-requisites&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;install apache, mod_ssl(if it is not available with apache), openssl&lt;br /&gt;configure openssl configuration file openssl.cnf&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The Certificate Stuff:&lt;/span&gt;&lt;br /&gt;there are 3 important options with openssl.&lt;br /&gt;i.e, genrsa, req,ca&lt;br /&gt;check the openssl help for all the detail input/output description.&lt;br /&gt;creating key and self certified certificate&lt;br /&gt;&lt;br /&gt;first create the key..&lt;br /&gt;openssl genrsa -des3 -out ca.key 1024&lt;br /&gt;&lt;br /&gt;then use the following command to create the CA certificate&lt;br /&gt;openssl req -new -x509 -days 365 -key ca.key -out ca.crt&lt;br /&gt;&lt;br /&gt;now we generate key and certificate request key..&lt;br /&gt;openssl genrsa -des3 -out server.key 1024&lt;br /&gt;&lt;br /&gt;certificate request (CSR)&lt;br /&gt;openssl req -new -key server.key -out server.csr&lt;br /&gt;(generating key, request are done at client side and sent across to the CA for &lt;br /&gt;certification)&lt;br /&gt;&lt;br /&gt;Command to certify using our own CA.&lt;br /&gt;openssl ca -in &lt;your request file&gt; -out &lt;certificate&gt; -keyfile &lt;CA key file&gt; -cert &lt;CA certificate&gt;&lt;br /&gt;example: openssl ca -in server.csr -out server.crt -keyfile ca.key -cert ca.crt&lt;br /&gt;this way we can sign any reguest use openssl.cnf file to put certifying&lt;br /&gt;criteria like city name should be &lt;something&gt; or country name should &lt;something&gt;&lt;br /&gt;Now generating keystores so that our application can use SSL certificates for&lt;br /&gt;secured communication.&lt;br /&gt;use pkcs12 facility to export certificates to a pkcs12 store with  a command&lt;br /&gt;similar to the following.. &lt;br /&gt;&lt;br /&gt;for CA..&lt;br /&gt;openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out ca.p12&lt;br /&gt;&lt;br /&gt;for client&lt;br /&gt;penssl pkcs12 -export -in client.crt -inkey client.key -out client.p12&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;NOTE:&lt;/span&gt;&lt;br /&gt;keytool -list -keystore test.p12 -storetype PKCS12&lt;br /&gt;keytool error: java.io.IOException: Set tag error&lt;br /&gt;You could try to clean up your keystore. Execute commands:&lt;br /&gt;openssl pkcs12 -in test.p12 -clcerts -out file.pem&lt;br /&gt;openssl pkcs12 -export -in file.pem -out clean.p12&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Using keystores&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;we need to put the ca keystore in trust store and the client certificate in keystore&lt;br /&gt; &lt;br /&gt;in java it is just setting the system properties as shown in the following program and the magic works..&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.PrintStream;&lt;br /&gt;import java.io.InputStreamReader;&lt;br /&gt;import java.io.BufferedReader;&lt;br /&gt;import java.net.InetAddress;&lt;br /&gt;import java.net.UnknownHostException;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.net.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;public class TestClient {&lt;br /&gt;public TestClient(){&lt;br /&gt;try{&lt;br /&gt;java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());&lt;br /&gt;//System.setProperty("javax.net.debug", "all");&lt;br /&gt;System.setProperty"java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");&lt;br /&gt;//System.setProperty("javax.net.ssl.trustStore", "truststore");&lt;br /&gt;System.setProperty("javax.net.ssl.trustStore", "ca.p12");&lt;br /&gt;System.setProperty("javax.net.ssl.trustStoreType", "pkcs12");&lt;br /&gt;System.setProperty("javax.net.ssl.trustStorePassword","password");&lt;br /&gt;System.out.println("after truststore setp");&lt;br /&gt;System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");&lt;br /&gt;System.setProperty("javax.net.ssl.keyStore", "client.p12");&lt;br /&gt;System.setProperty("javax.net.ssl.keyStorePassword", "password");&lt;br /&gt;System.out.println("after keystore setting");&lt;br /&gt;System.out.println("Sending XML with http ");&lt;br /&gt;URL url = new URL("https://SERVER_USRL");&lt;br /&gt;System.out.println("after url created");&lt;br /&gt;//URLConnection uc = (URLConnection)url.openConnection();&lt;br /&gt;//System.out.println("after connection establisht");&lt;br /&gt;//uc.setDoOutput(true);&lt;br /&gt;//uc.setDoInput(true);&lt;br /&gt;//uc.setAllowUserInteraction(false);&lt;br /&gt;//BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));&lt;br /&gt;//System.out.println("The instance of url.openConnection |" +url.openConnection()"|");&lt;br /&gt;com.sun.net.ssl.HttpsURLConnection connection = (com.sun.net.ssl.HttpsURLConnection)url.openConnection();&lt;br /&gt;BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));&lt;br /&gt;PrintWriter pw = new PrintWriter(new FileWriter("output.xml"));&lt;br /&gt;String inputLine;&lt;br /&gt;while ((inputLine = in.readLine()) != null)&lt;br /&gt;pw.println(inputLine);&lt;br /&gt;in.close();&lt;br /&gt;pw.close();&lt;br /&gt;}catch(Exception e){&lt;br /&gt;e.printStackTrace();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;public static void main(String arg[]){&lt;br /&gt;            System.out.println("before");&lt;br /&gt;            TestClient obj= new TestClient();&lt;br /&gt;            System.out.println("after");&lt;br /&gt;            }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;General notes about OPENSSL&lt;br /&gt;1)openssl uses openssl.cnf while creating certificate request as well as when we are certifying request with our own CA.&lt;br /&gt;&lt;br /&gt;so this is a crucial one, we can change the default options like country name,&lt;br /&gt;city, province etc., and while certifying also this configuration file is used to validate the client CSR file&lt;br /&gt;&lt;br /&gt;openssl uses 2 text files while certifying requests.&lt;br /&gt;serial&lt;br /&gt;index.txt&lt;br /&gt;serial will contain the certifiate serial number&lt;br /&gt;intially it contains 01 and after that it will be incremented automatically for each request.&lt;br /&gt;index.txt contains the created certificate information ( i think so) initially&lt;br /&gt;it will contain nothing..&lt;br /&gt;see that this file will have no content in the beginning&lt;br /&gt;may be size should be 0 kb&lt;br /&gt;this 2 things will create lot of errors if there is something wrong.&lt;br /&gt;use online help for setting up openssl and to resolve errors generated during&lt;br /&gt;creating .csr or .crt files..&lt;br /&gt;http://tirian.magd.ox.ac.uk/~nick/openssl-certs/index.shtml&lt;br /&gt;APACHE configuration:&lt;br /&gt;apache needs mod_ssl module for dealing with SSL. Load this module and ssl.conf will be used to create virtualhosts with SSL configurations.&lt;br /&gt;read apache documentation for various attribues in ssl.conf&lt;br /&gt;sample virtualhost configuration in ssl.conf&lt;br /&gt;&lt;br /&gt;&lt;VirtualHost 11.1.14.13:9999&gt;&lt;br /&gt;ServerName testing.cybernetsoft.com&lt;br /&gt;SSLEngine on&lt;br /&gt;ErrorLog logs/ssl_error_log&lt;br /&gt;TransferLog logs/ssl_access_log&lt;br /&gt;SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP&lt;br /&gt;SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt&lt;br /&gt;SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key&lt;br /&gt;SSLCertificateChainFile /etc/httpd/conf/ssl.crt/ca.crt&lt;br /&gt;SSLCACertificateFile /etc/httpd/conf/ssl.crt/ca.crt&lt;br /&gt;SSLCACertificatePath /etc/httpd/conf/ssl.crt&lt;br /&gt;SSLVerifyDepth  1&lt;br /&gt;HostnameLookups double&lt;br /&gt;#SSLVerifyClient require&lt;br /&gt;#SSLRequire (%(SSL_CLIENT_I_DN_CN) eq %(HTTP_HOST))&lt;br /&gt;#SSLRequire (%(SSL_CLIENT_I_DN_O) eq "Cybernet Software Systems Inc")&lt;br /&gt;#            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} &lt;br /&gt;#            and %{TIME_WDAY} &gt;= 1 and %{TIME_WDAY} &lt;= 5 &lt;br /&gt;#            and %{TIME_HOUR} &gt;= 8 and %{TIME_HOUR} &lt;= 20       ) &lt;br /&gt;#SLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ &lt;br /&gt;#            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." &lt;br /&gt;#            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} &lt;br /&gt;#            and %{TIME_WDAY} &gt;= 1 and %{TIME_WDAY} &lt;= 5 &lt;br /&gt;#            and %{TIME_HOUR} &gt;= 8 and %{TIME_HOUR} &lt;= 20       ) &lt;br /&gt; #          or %{REMOTE_ADDR} =~ m/^11\.1\.14\.[0-9]+$/&lt;br /&gt;&lt;br /&gt;CustomLog logs/ssl_request_log &lt;br /&gt;          "%t %h cn %{SSL_CLIENT_S_DN_CN}x remoteaddr %{REMOTE_ADDR}x remotehost %{REMOTE_HOST}x remoteident %{REMOTE_IDENT}x \"%r\" %b"&lt;br /&gt;&lt;IfModule mod_weblogic.c&gt;&lt;br /&gt;        WebLogicHost 11.1.14.13&lt;br /&gt;        WebLogicPort 7001&lt;br /&gt;        StatPath true&lt;br /&gt;        HungServerRecoverSecs 300&lt;br /&gt;        ConnectTimeoutSecs 10&lt;br /&gt;&lt;Location /WebServices&gt;&lt;br /&gt;#SSLRequire (%{SSL_CLIENT_S_DN_CN} eq %{REMOTE_HOST})&lt;br /&gt;#SSLRequire (%{SSL_CLIENT_VERIFY} eq "SUCCESS")&lt;br /&gt;       WebLogicHost 11.1.14.13&lt;br /&gt;       WebLogicPort 7001&lt;br /&gt;       SetHandler weblogic-handler&lt;br /&gt;&lt;/Location&gt;&lt;br /&gt;&lt;br /&gt;&lt;/IfModule&gt;&lt;br /&gt;&lt;/VirtualHost&gt;&lt;br /&gt;&lt;br /&gt;SETTING UP tomcat&lt;br /&gt;Setting up Apache Tomcat and a Simple Apache SOAP Client for SSL Communication.&lt;br /&gt;http://ws.apache.org/soap/docs/install/FAQ_Tomcat_SOAP_SSL.html&lt;br /&gt;create key and sertificate from keytool for server.&lt;br /&gt;keytool -genkey -alias tomcat-sv -dname "CN=harinath.cybernetsoft.com, OU=Java services team, O=Cybernet software systems, L=Chennai,&lt;br /&gt;&lt;br /&gt;S=TN, C=IN" -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore&lt;br /&gt;keytool -export -alias tomcat-cv -storepass changeit -file server.cer -keystore server.keystore&lt;br /&gt;do the same thing for client the following steps worked fine for tomcat&lt;br /&gt;CREATING KEYSTORE FOR TOMCAT:&lt;br /&gt;1) keytool -genkey -alias tomcat-cl -dname "CN=harinath.cybernetsoft.com,OU=J2EE TEAM, O=CSS, L=CHENNAI, S=TN, C=IN" -keyalg RSA -keypass changeit -storepass changeit -keystore client.keystore&lt;br /&gt;2)keytool -export -alias tomcat-cl -storepass changeit -file client.cer -keystore client.keystore&lt;br /&gt;keytool -export -alias tomcat -storepass password -file c.crt -keystore client.keystore&lt;br /&gt;3) and now change ur server.xml for ssl&lt;br /&gt;&lt;Connector className="org.apache.coyote.tomcat5.CoyoteConnector"    port="8443" minProcessors="5" maxProcessors="75"&lt;br /&gt;enableLookups="true" disableUploadTimeout="true"   acceptCount="100" debug="0" scheme="https" secure="true" keystoreFile="/usr/local/openssl/client.keystore"&lt;br /&gt;clientAuth="false" keystorePass="changeit" sslProtocol="TLS"/&gt;&lt;br /&gt;Tomcat by default uses keystore named ".keystore" inside the home directory of&lt;br /&gt;the user.&lt;br /&gt;I think we can provide keystore and truststore and their passwords in connector itself.&lt;br /&gt;Read the tomcat documentation of the version you are using.&lt;br /&gt;LINKS:&lt;br /&gt;http://www.flatmtn.com/computer/Linux-SSLCertificatesApache.html&lt;br /&gt;installing CA Into IE&lt;br /&gt;http://wasd.vsm.com.au/ht_root/other/faq/msie_ca_cert/&lt;br /&gt;http://httpd.apache.org/docs-2.0/&lt;br /&gt;http://www.impetus.us/~rjmooney/projects/misc/clientcertauth.html&lt;br /&gt;http://www.samspublishing.com/articles/article.asp?p=30115&amp;seqNum=11&lt;br /&gt;http://tirian.magd.ox.ac.uk/~nick/openssl-certs/index.shtml&lt;br /&gt;http://www.modssl.org/docs/2.8/ssl_reference.html#table3&lt;br /&gt;http://httpd.apache.org/docs-2.0/mod/mod_ssl.html#sslrequiressl&lt;br /&gt;http://www.samspublishing.com/articles/article.asp?p=30115&amp;seqNum=5&lt;br /&gt;http://www.impetus.us/~rjmooney/projects/misc/clientcertauth.html&lt;br /&gt;sample config file openssl.cnf&lt;br /&gt;http://paf.se/openssl/openssl.cnf.html&lt;br /&gt;A very useful stuff.. on how to create certificates etc.. just a text file but&lt;br /&gt;really useful.&lt;br /&gt;http://rei1.m-plify.net/howtoon-certificates.txt&lt;br /&gt;http://www.openssl.org/docs/apps/ca.html&lt;br /&gt;http://www.drh-consultancy.demon.co.uk/pkcs12faq.html&lt;br /&gt;http://search.netscape.com/ns/boomframe.jsp?query=installing+client+certificate+in+browser&amp;page=1&amp;offset=0&amp;result_url=redir%3Fsrc%3Dwebsearch%26requestId%3Deab426fbf64c7db%26clickedItemRank%3D1%26userQuery%3Dinstalling%2Bclient%2Bcertificate%2Bin%2Bbrowser%26clickedItemURN%3Dhttp%253A%252F%252Fzeus.phys.uconn.edu%252Fprod%252Fdocs%252FcertSetup.html%26invocationType%3D-%26fromPage%3Ddshnnp%26amp%3BampTest%3D1&amp;remove_url=http%3A%2F%2Fzeus.phys.uconn.edu%2Fprod%2Fdocs%2FcertSetup.html&lt;br /&gt;http://www.cs.sunysb.edu/documentation/jsse/api_users_guide.html&lt;br /&gt;http://java.sun.com/j2se/1.4.2/docs/api/javax/net/ssl/SSLSocketFactory.html&lt;br /&gt;http://forum.java.sun.com/thread.jsp?forum=60&amp;thread=204299&lt;br /&gt;http://forum.java.sun.com/thread.jsp?forum=60&amp;thread=525858&lt;br /&gt;http://forum.java.sun.com/thread.jsp?forum=2&amp;thread=258908&lt;br /&gt;http://java.sun.com/j2se/1.4.2/docs/guide/security/jsse/samples/sockets/client/SSLSocketClientWithClientAuth.java&lt;br /&gt;http://java.sun.com/products/jsse/doc/apidoc/com/sun/net/ssl/TrustManagerFactory.html&lt;br /&gt;http://www.javaworld.com/javaworld/javatips/jw-javatip96.html&lt;br /&gt;http://www.javaolympus.com/J2SE/NETWORKING/JavaSockets/JavaSockets.jsp&lt;br /&gt;http://www-106.ibm.com/developerworks/java/library/ws-secmap/&lt;br /&gt;http://java.sun.com/products/jsse/&lt;br /&gt;The following helps in customization of JSSE like keymanager, trustmanger etc. and includes a sample server/clients application with SSL.&lt;br /&gt;http://www-106.ibm.com/developerworks/java/library/j-customssl/&lt;br /&gt;file:///usr/weblogic81/samples/server/examples/src/examples/security/sslclient/SSLClient.html&lt;br /&gt;http://www-106.ibm.com/developerworks/java/library/j-customssl/&lt;br /&gt;http://archives.java.sun.com/cgi-bin/wa?A2=ind0201&amp;L=java-security&amp;D=0&amp;P=736&lt;br /&gt;permissions in java&lt;br /&gt;http://java.sun.com/j2se/1.4.2/docs/guide/security/permissions.html&lt;br /&gt;http://mindprod.com/jgloss/certificate.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113940407217334173?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113940407217334173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113940407217334173' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113940407217334173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113940407217334173'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/02/p2p-ssl-authentication-and-java-with.html' title='P2P SSL authentication and JAVA with OpenSSL'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113793861360812073</id><published>2006-01-22T06:03:00.000-08:00</published><updated>2006-01-22T06:03:33.766-08:00</updated><title type='text'>Design pattern links</title><content type='html'>&lt;a href="http://www.leocrawford.org.uk/work/jcea/part1/patterns.html"&gt;patterns&lt;/a&gt; &lt;br /&gt;&lt;a href="http://www.patterndepot.com/put/8/JavaPatterns.htm"&gt;patterns 1&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cs.wustl.edu/~schmidt/patterns.html"&gt;patterns 2&lt;/a&gt;&lt;a href="http://www.cmcrossroads.com/bradapp/docs/patterns-intro.html"&gt;&lt;br /&gt;patterns introduction&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cetus-links.org/oo_patterns.html"&gt;oo patterns&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.objectmentor.com/resources/articles/Principles_and_Patterns.PDF"&gt;Principles of Design patterns PDF&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.developer.com/design/article.php/1502691"&gt;common design patterns&lt;/a&gt;&lt;br /&gt;&lt;a href="http://time-tripper.com/uipatterns/ "&gt;UI design patterns&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.javacamp.org/designPattern/"&gt;java camp design patterns&lt;/a&gt;&lt;br /&gt;&lt;a href="www.netobjectives.com/design.htm "&gt;net objects design patterns&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113793861360812073?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113793861360812073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113793861360812073' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113793861360812073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113793861360812073'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/design-pattern-links_22.html' title='Design pattern links'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113793837710220735</id><published>2006-01-22T05:51:00.000-08:00</published><updated>2006-01-22T05:59:39.166-08:00</updated><title type='text'>Design pattern links</title><content type='html'>&lt;a href="http://www.leocrawford.org.uk/work/jcea/part1/patterns.html"&gt;patterns&lt;/a&gt; &lt;br /&gt;&lt;a href="http://www.patterndepot.com/put/8/JavaPatterns.htm"&gt;patterns 1&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cs.wustl.edu/~schmidt/patterns.html"&gt;patterns 2&lt;/a&gt;&lt;a href="http://www.cmcrossroads.com/bradapp/docs/patterns-intro.html"&gt;&lt;br /&gt;patterns introduction&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cetus-links.org/oo_patterns.html"&gt;oo patterns&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113793837710220735?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113793837710220735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113793837710220735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113793837710220735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113793837710220735'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/design-pattern-links.html' title='Design pattern links'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113785316140208629</id><published>2006-01-21T06:17:00.000-08:00</published><updated>2006-01-21T06:19:21.503-08:00</updated><title type='text'>sql - returning top n records</title><content type='html'>Returning only the first N records in a SQL query differs quite a bit between database platforms. Here's some samples:&lt;br /&gt;&lt;br /&gt;Microsoft SQL Server&lt;br /&gt;&lt;br /&gt;SELECT TOP 10 column FROM table&lt;br /&gt;&lt;br /&gt;PostgreSQL and MySQL&lt;br /&gt;&lt;br /&gt;SELECT column FROM table&lt;br /&gt;LIMIT 10&lt;br /&gt;&lt;br /&gt;Oracle&lt;br /&gt;&lt;br /&gt;SELECT column FROM table&lt;br /&gt;WHERE ROWNUM &lt;= 10&lt;br /&gt;(use order by too for the specific column - harinath)&lt;br /&gt;Due to these differences if you want to keep your code database independent you should use the maxrows attribute in the cfquery tag. The tradeoffs to database independance is performance, I would expect maxrows to be slower than specifying the rows in the SQL.&lt;br /&gt;&lt;br /&gt;&lt;cfquery datasource="#ds#" maxrows="10"&gt;&lt;br /&gt;SELECT column FROM table&lt;br /&gt;&lt;/cfquery&gt;&lt;br /&gt;&lt;br /&gt;PostgreSQL has a cool feature that will let you return an arbitrary range of rows (eg return rows 10-20). This is very handy for displaying pages of records:&lt;br /&gt;&lt;br /&gt;SELECT column FROM table&lt;br /&gt;LIMIT 10 OFFSET 20&lt;br /&gt;&lt;br /&gt;The above query will return rows 20-30&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113785316140208629?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113785316140208629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113785316140208629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785316140208629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785316140208629'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/sql-returning-top-n-records.html' title='sql - returning top n records'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113785303056626500</id><published>2006-01-21T06:16:00.000-08:00</published><updated>2006-01-21T06:17:11.156-08:00</updated><title type='text'>oracle -  removing duplicate records</title><content type='html'>Question:&lt;br /&gt;&lt;br /&gt;I have a table T1 with columns C1, C2 and C3. Currently, there are duplicate &lt;br /&gt;records in T1 with the C1, C2 combination. &lt;br /&gt;T1:&lt;br /&gt;         C1    C2    C3&lt;br /&gt;         --    --    --&lt;br /&gt;          1    50     a&lt;br /&gt;          1    50     b&lt;br /&gt;          2    89     x&lt;br /&gt;          2    89     y&lt;br /&gt;          2    89     z&lt;br /&gt;     &lt;br /&gt;I would like to delete the duplicate record on this combination. What is the best way of writing the PL/SQL block or query to &lt;br /&gt;do this?&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;delete from T1&lt;br /&gt;  2   where rowid &lt;&gt; ( select max(rowid)&lt;br /&gt;  3                      from t1 b&lt;br /&gt;  4                     where b.c1 = t1.c1&lt;br /&gt;  5                       and b.c2 = t1.c2 )&lt;br /&gt;  6  /&lt;br /&gt;&lt;br /&gt;3 rows deleted.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select * from t1;&lt;br /&gt;&lt;br /&gt;        C1         C2 C&lt;br /&gt;---------- ---------- -&lt;br /&gt;         1         50 b&lt;br /&gt;         2         89 z&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113785303056626500?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113785303056626500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113785303056626500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785303056626500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785303056626500'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/oracle-removing-duplicate-records.html' title='oracle -  removing duplicate records'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113785250039899004</id><published>2006-01-21T06:03:00.000-08:00</published><updated>2006-01-21T06:08:20.780-08:00</updated><title type='text'>oracle getting rows N through M of a result</title><content type='html'>Question:&lt;br /&gt;&lt;br /&gt;I would like to fetch data after joining 3 tables and &lt;br /&gt;sorting based on some field. As this query results into approx &lt;br /&gt;100 records, I would like to cut the result set into 4, each of &lt;br /&gt;25 record. and I would like to give sequence number to each &lt;br /&gt;record. Can I do using SQL Plus ?&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;n Oracle8i, release 8.1 -- yes.&lt;br /&gt;&lt;br /&gt;select * &lt;br /&gt;  from ( select a.*, rownum rnum&lt;br /&gt;           from ( YOUR_QUERY_GOES_HERE -- including the order by ) a&lt;br /&gt;          where rownum &lt;= MAX_ROWS )&lt;br /&gt; where rnum &gt;= MIN_ROWS&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;that'll do it.  It will *not* work in 8.0 or before.&lt;br /&gt;&lt;br /&gt;Here is a discussion on the same&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Your first query "where rownum between 90 and 100" never returns ANY data.  that &lt;br /&gt;predicate will ALWAYS evaluate to false -- always.&lt;br /&gt;&lt;br /&gt;I've already proven in another question (believe it was with you again) that &lt;br /&gt;&lt;br /&gt;select * from ( &lt;br /&gt;   select p.*, rownum rnum&lt;br /&gt;           from (select * from hz_parties ) p&lt;br /&gt;          where rownum &lt; 100&lt;br /&gt;) where rnum &gt;= 90&lt;br /&gt;&lt;br /&gt;is faster then:&lt;br /&gt;&lt;br /&gt;select * from ( &lt;br /&gt;   select p.*, rownum rnum&lt;br /&gt;           from (select * from hz_parties ) p&lt;br /&gt;) where rnum between 90 and 100&lt;br /&gt;&lt;br /&gt;which is what I believe you INTENDED to type.  It has to do with the way we &lt;br /&gt;process the COUNT(STOPKEY) and the fact that we must evaluate &lt;br /&gt;&lt;br /&gt;   select p.*, rownum rnum&lt;br /&gt;           from (select * from hz_parties ) p&lt;br /&gt;&lt;br /&gt;AND THEN apply the filter where as the other will find the first 100 AND THEN &lt;br /&gt;stop.&lt;br /&gt;&lt;br /&gt;so, say I have an unindexed table:&lt;br /&gt;&lt;br /&gt;ops$tkyte@ORA817DEV.US.ORACLE.COM&gt; select count(*) from big_table;&lt;br /&gt;&lt;br /&gt;  COUNT(*)&lt;br /&gt;----------&lt;br /&gt;   1099008&lt;br /&gt;&lt;br /&gt;(a copy of all_objects over and over and over) and I run three queries.  Yours &lt;br /&gt;to show it fails (no data), what I think you meant to type and what I would &lt;br /&gt;type:&lt;br /&gt;&lt;br /&gt;select p.*, rownum rnu&lt;br /&gt;  from ( select * from big_table ) p&lt;br /&gt; where rownum between 90 and 100&lt;br /&gt;&lt;br /&gt;call     count       cpu    elapsed       disk      query    current        rows&lt;br /&gt;------- ------  -------- ---------- ---------- ---------- ----------  ----------&lt;br /&gt;Parse        1      0.00       0.00          0          0          0           0&lt;br /&gt;Execute      1      0.00       0.00          0          0          0           0&lt;br /&gt;Fetch        1      6.17      15.31      14938      14985         81           0&lt;br /&gt;------- ------  -------- ---------- ---------- ---------- ----------  ----------&lt;br /&gt;total        3      6.17      15.31      14938      14985         81           0&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSE&lt;br /&gt;Parsing user id: 216&lt;br /&gt;&lt;br /&gt;Rows     Row Source Operation&lt;br /&gt;-------  ---------------------------------------------------&lt;br /&gt;      0  COUNT STOPKEY&lt;br /&gt;      0   FILTER&lt;br /&gt;1099009    TABLE ACCESS FULL BIG_TABLE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;your query -- no data found....  Look at the number of rows inspected &lt;br /&gt;however&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select *&lt;br /&gt;from (&lt;br /&gt;select p.*, rownum rnum&lt;br /&gt;  from ( select * from big_table ) p&lt;br /&gt;)&lt;br /&gt; where rnum between 90 and 100&lt;br /&gt;&lt;br /&gt;call     count       cpu    elapsed       disk      query    current        rows&lt;br /&gt;------- ------  -------- ---------- ---------- ---------- ----------  ----------&lt;br /&gt;Parse        1      0.00       0.00          0          0          0           0&lt;br /&gt;Execute      1      0.00       0.00          0          0          0           0&lt;br /&gt;Fetch        2      7.93      17.03      14573      14986         81          11&lt;br /&gt;------- ------  -------- ---------- ---------- ---------- ----------  ----------&lt;br /&gt;total        4      7.93      17.03      14573      14986         81          11&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 1&lt;br /&gt;Optimizer goal: CHOOSE&lt;br /&gt;Parsing user id: 216&lt;br /&gt;&lt;br /&gt;Rows     Row Source Operation&lt;br /&gt;-------  ---------------------------------------------------&lt;br /&gt;     11  VIEW&lt;br /&gt;1099008   COUNT&lt;br /&gt;1099008    TABLE ACCESS FULL BIG_TABLE&lt;br /&gt;&lt;br /&gt;what I believe you mean to type in -- agein -- look at the rows processed!&lt;br /&gt;&lt;br /&gt;Now, what I've been telling everyone to use:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select * from (&lt;br /&gt;   select p.*, rownum rnum&lt;br /&gt;           from (select * from big_table ) p&lt;br /&gt;          where rownum &lt; 100&lt;br /&gt;) where rnum &gt;= 90&lt;br /&gt;&lt;br /&gt;call     count       cpu    elapsed       disk      query    current        rows&lt;br /&gt;------- ------  -------- ---------- ---------- ---------- ----------  ----------&lt;br /&gt;Parse        1      0.00       0.00          0          0          0           0&lt;br /&gt;Execute      1      0.00       0.00          0          0          0           0&lt;br /&gt;Fetch        2      0.00       0.01          1          7         12          10&lt;br /&gt;------- ------  -------- ---------- ---------- ---------- ----------  ----------&lt;br /&gt;total        4      0.00       0.01          1          7         12          10&lt;br /&gt;&lt;br /&gt;Misses in library cache during parse: 0&lt;br /&gt;Optimizer goal: CHOOSE&lt;br /&gt;Parsing user id: 216&lt;br /&gt;&lt;br /&gt;Rows     Row Source Operation&lt;br /&gt;-------  ---------------------------------------------------&lt;br /&gt;     10  VIEW&lt;br /&gt;     99   COUNT STOPKEY&lt;br /&gt;     99    TABLE ACCESS FULL BIG_TABLE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;HUGE difference.  Beat that...  &lt;br /&gt;&lt;br /&gt;Claims -- don't want em.&lt;br /&gt;Benchmark, metrics, statistics -- love em -- want em -- need em.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113785250039899004?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113785250039899004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113785250039899004' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785250039899004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785250039899004'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/oracle-getting-rows-n-through-m-of.html' title='oracle getting rows N through M of a result'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113785174558440781</id><published>2006-01-21T05:49:00.000-08:00</published><updated>2006-01-21T05:55:45.676-08:00</updated><title type='text'>PDF password protection removal</title><content type='html'>&lt;a href="http://www.cs.cmu.edu/~dst/Adobe/Gallery/"&gt;tips&lt;/a&gt; to get rid of password protection of PDF files &lt;br /&gt;&lt;br /&gt;Easy thing is that we install Ghostscript and GhostViewer&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113785174558440781?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113785174558440781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113785174558440781' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785174558440781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785174558440781'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/pdf-password-protection-removal.html' title='PDF password protection removal'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113785114405438860</id><published>2006-01-21T05:25:00.000-08:00</published><updated>2006-01-21T05:45:44.556-08:00</updated><title type='text'>java free obfuscation tool</title><content type='html'>&lt;a href="http://www.yworks.com/en/products_yguard_about.htm"&gt;y guard&lt;/a&gt; from ywworks, works as an excellent tool for java source code obfuscation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113785114405438860?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113785114405438860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113785114405438860' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785114405438860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113785114405438860'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/java-free-obfuscation-tool.html' title='java free obfuscation tool'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113784975440343362</id><published>2006-01-21T05:17:00.000-08:00</published><updated>2006-04-18T05:44:25.493-07:00</updated><title type='text'>software security</title><content type='html'>&lt;a href="http://www.geocities.com/SiliconValley/2072/"&gt;Silicon valley&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.insecure.org/"&gt;insecure.org&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.astalavista.com"&gt;Astalavista&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.aladdin.com/"&gt;aladdin&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tomcat.apache.org/tomcat-5.0-doc/ssl-howto.html"&gt;http://tomcat.apache.org/tomcat-5.0-doc/ssl-howto.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113784975440343362?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113784975440343362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113784975440343362' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113784975440343362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113784975440343362'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/software-security.html' title='software security'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113765312256347024</id><published>2006-01-18T22:44:00.000-08:00</published><updated>2006-01-18T22:45:22.910-08:00</updated><title type='text'>quick reference</title><content type='html'>There are lot of simple PDF files, which work as quick reference for many of tech stuff like java, oracle etc. Here is the web link for &lt;br /&gt;&lt;a href="www.digilife.be/quickreferences/quickrefs.htm"&gt;quick references&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113765312256347024?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113765312256347024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113765312256347024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113765312256347024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113765312256347024'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/quick-reference.html' title='quick reference'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113756796371875000</id><published>2006-01-17T23:02:00.000-08:00</published><updated>2006-01-19T06:04:06.773-08:00</updated><title type='text'>links for interview questions on oracle</title><content type='html'>&lt;a href="http://www.geekinterview.com/Interview-Questions/Oracle"&gt;http://www.geekinterview.com/Interview-Questions/Oracle&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.cocoondev.org/tomk/archives/001062.html"&gt;http://blogs.cocoondev.org/tomk/archives/001062.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.hotscripts.com/Detailed/51514.html"&gt;http://www.hotscripts.com/Detailed/51514.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.jguru.com/forums/view.jsp?EID=1184213"&gt;http://www.jguru.com/forums/view.jsp?EID=1184213&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.fundoosite.com/interview-questions/type.asp?iType=57"&gt;http://www.fundoosite.com/interview-questions/type.asp?iType=57&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.databasejournal.com/features/oracle/article.php/3085171"&gt;http://www.databasejournal.com/features/oracle/article.php/3085171&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.geekinterview.com/Global-Interview-Questions/Oracle"&gt;http://www.geekinterview.com/Global-Interview-Questions/Oracle&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.arikaplan.com/oracle.html"&gt;&lt;br /&gt;http://www.arikaplan.com/oracle.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.macromedia.com/v1/documents/jrun30/acrobatdocs/jrun_qref.pdf"&gt;http://www.macromedia.com/v1/documents/jrun30/acrobatdocs/jrun_qref.pdf&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113756796371875000?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113756796371875000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113756796371875000' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113756796371875000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113756796371875000'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/links-for-interview-questions-on.html' title='links for interview questions on oracle'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113679538020433829</id><published>2006-01-09T00:25:00.000-08:00</published><updated>2006-01-09T00:36:47.956-08:00</updated><title type='text'>cyber crimes</title><content type='html'>&lt;a href="http://networking.webopedia.com/TERM/C/cyber_crime.html "&gt;cyber crime definations&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.uazuay.edu.ec/bibliotecas/e-marketing/E-Commerce%20and%20Cyber%20Crime.pdf "&gt;E-commerce and cyber crime&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.asianlaws.org/cyberlaw/library/cc/what_cc.htm"&gt;http://www.asianlaws.org/cyberlaw/library/cc/what_cc.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.crime-research.org/library/Pecul.htm"&gt;http://www.crime-research.org/library/Pecul.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.indiaforensic.com/compcrime1.htm"&gt;http://www.indiaforensic.com/compcrime1.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.computerworld.com/securitytopics/security/cybercrime"&gt;http://www.computerworld.com/securitytopics/security/cybercrime&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ehealthstrategies.com/files/cybersecurity.pdf"&gt;http://www.ehealthstrategies.com/files/cybersecurity.pdf&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.itu.int/dms_pub/itu-s/md/03/wsis/c/S03-WSIS-C-0006!!PDF-E.pdf"&gt;http://www.itu.int/dms_pub/itu-s/md/03/wsis/c/S03-WSIS-C-0006!!PDF-E.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.osborne-group.com/Fall_2003_-_Insert.pdf"&gt;http://www.osborne-group.com/Fall_2003_-_Insert.pdf&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113679538020433829?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113679538020433829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113679538020433829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113679538020433829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113679538020433829'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/cyber-crimes.html' title='cyber crimes'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113664115604724342</id><published>2006-01-07T05:36:00.000-08:00</published><updated>2006-01-21T06:23:18.956-08:00</updated><title type='text'>oracle useful links</title><content type='html'>&lt;a href="http://www.uaex.edu/srea/#Oracle_Scripts"&gt;http://www.uaex.edu/srea/#Oracle_Scripts&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.orafaq.com/scripts/index.htm#GENSQL"&gt;http://www.orafaq.com/scripts/index.htm#GENSQL&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.bytelife.com/sql4dba.htm"&gt;http://www.bytelife.com/sql4dba.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.orsweb.com/"&gt;http://www.orsweb.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.geocities.com/SiliconValley/Lakes/1261/"&gt;http://www.geocities.com/SiliconValley/Lakes/1261/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.oracle.com/oramag/code/index.html"&gt;http://www.oracle.com/oramag/code/index.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.materialdreams.com/oracle/scripts.html"&gt;http://www.materialdreams.com/oracle/scripts.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.bijoos.com/oracle/"&gt;http://www.bijoos.com/oracle/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;http://www.akadia.com/services/ora_analytic_functions.html&lt;a href="http://www.akadia.com/services/ora_analytic_functions.html"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113664115604724342?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113664115604724342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113664115604724342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113664115604724342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113664115604724342'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/oracle-useful-links.html' title='oracle useful links'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113664088775418454</id><published>2006-01-07T04:58:00.000-08:00</published><updated>2006-01-07T05:34:48.493-08:00</updated><title type='text'>queries</title><content type='html'>Oracle:&lt;br /&gt;&lt;br /&gt;1. Top 10 records&lt;br /&gt;sing the ROWNUM Pseudocolumn&lt;br /&gt;One way to solve this problem is by using the Oracle pseudocolumn ROWNUM. ROWNUM is available in Oracle versions 7, 8.0 and 8i (8.1); I am not sure about Oracle 6. For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle selects the row from a table or set of joined rows. The first row selected has a ROWNUM of 1, the second has 2, and so on.&lt;br /&gt;&lt;br /&gt;You can use the ROWNUM pseudocolumn to limit the number of rows returned by a query to 5:&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal &lt;br /&gt;   FROM Emp &lt;br /&gt;   WHERE ROWNUM &lt; 6;&lt;br /&gt;&lt;br /&gt;advertisement&lt;br /&gt;&lt;br /&gt;Get comprehensive solutions for building software.&lt;br /&gt;&lt;br /&gt;# Download: IBM Rational Rose XDE Developer for Visual Studio&lt;br /&gt;&lt;br /&gt;# Download: IBM Rational Application Developer for WebSphere Software&lt;br /&gt;&lt;br /&gt;# Download: IBM Rational Software Architect&lt;br /&gt;&lt;br /&gt;# On-Demand Webcast: Making Java Development Easier&lt;br /&gt;&lt;br /&gt;Listing 2 shows the output of the above code. As you see, the first five rows have been returned.&lt;br /&gt;&lt;br /&gt;If an ORDER BY clause follows ROWNUM in the same query, the rows will be reordered by the ORDER BY clause.&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal &lt;br /&gt;   FROM Emp &lt;br /&gt;   WHERE ROWNUM &lt; 6 &lt;br /&gt;   ORDER BY Sal;&lt;br /&gt;&lt;br /&gt;Listing 3 shows the output of the above code.&lt;br /&gt;&lt;br /&gt;Watch Out! Because the ROWNUM is assigned upon retrieval, it is assigned prior to any sorting! This is opposite to the result you would get in SQL Server using the TOP clause. In order to select employees with the highest five salaries, you have to force sorting and then apply ROWNUM condition. Here is the syntax for a top-N query where N = 5 (this syntax with the subquery works only in Oracle 8i):&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal&lt;br /&gt;   FROM&lt;br /&gt;   (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal&lt;br /&gt;      FROM Emp&lt;br /&gt;      ORDER BY NVL(Sal, 0) DESC)&lt;br /&gt;   WHERE ROWNUM &lt; 6;&lt;br /&gt;&lt;br /&gt;Listing 4 shows the output of the above code. I used the NVL() function to sort the expression because sorting just by Emp_Salary would have put all records with NULL salary before those with the highest salaries, and that's not what we wanted to achieve.&lt;br /&gt;&lt;br /&gt;Utilizing Oracle 8i's Ranking Functions&lt;br /&gt;Another way to perform a top-N query uses the new Oracle 8i feature called "analytic functions." The SQL language, while extremely capable in many areas, has never provided strong support for analytic tasks, such as computing rankings, cumulative and moving averages, lead/lag comparisons, and reporting. These tasks require extensive PL/SQL programming, often with performance issues. Oracle 8i now provides a new wide set of analytic functions that address this need.&lt;br /&gt;advertisement&lt;br /&gt;&lt;br /&gt;For a top-N query you can use two ranking functions: RANK and DENSE_RANK. Both allow you to rank items in a group—for example, finding the top-five employees by salary, which is exactly what we need to achieve.&lt;br /&gt;&lt;br /&gt;The difference between RANK() and DENSE_RANK() is that RANK() leaves gaps in the ranking sequence when there are ties. In our case, Scott and Ford tie for second place with a $3,000 salary; Jones' $2,975 salary brings him in third place using DENSE_RANK() but only fourth place using RANK():&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Sal,&lt;br /&gt;   RANK() OVER&lt;br /&gt;      (ORDER BY SAL Desc NULLS LAST) AS Rank,&lt;br /&gt;   DENSE_RANK() OVER&lt;br /&gt;      (ORDER BY SAL Desc NULLS LAST) AS Drank&lt;br /&gt;   FROM Emp&lt;br /&gt;   ORDER BY SAL Desc NULLS LAST;&lt;br /&gt;&lt;br /&gt;Listing 5 shows the output of the above code.&lt;br /&gt;&lt;br /&gt;The NULLS FIRST | NULLS LAST clause determines the position of rows with NULL values in the ordered query.&lt;br /&gt;&lt;br /&gt;If the sequence is in descending order, then NULLS LAST implies that NULL values are smaller than non-NULL ones and rows with NULLs will appear at the bottom of the list. If the NULLS FIRST | NULLS LAST clause is omitted, then NULL values are considered larger than any other values and their ordering position depends on the ASC | DESC arguments.&lt;br /&gt;&lt;br /&gt;If the ordering sequence is ascending (ASC), then rows with NULLs will appear last; if the sequence is descending (DESC), then rows with NULLs will appear first. NULLs are considered equal to other NULLs and, therefore, the order in which rows with NULLs are presented is nondeterministic.&lt;br /&gt;&lt;br /&gt;sing RANK() to Obtain a Top-N Query&lt;br /&gt;To obtain a top-N query, use RANK() in a subquery and then apply a filter condition outside the subquery:&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal&lt;br /&gt;   FROM&lt;br /&gt;   (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal,&lt;br /&gt;      RANK() OVER&lt;br /&gt;         (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank&lt;br /&gt;      FROM Emp&lt;br /&gt;      ORDER BY SAL Desc NULLS LAST)&lt;br /&gt;   WHERE Emp_Rank &lt; 6;&lt;br /&gt;&lt;br /&gt;advertisement&lt;br /&gt;Listing 6 shows the output of the above code.&lt;br /&gt;&lt;br /&gt;Using the same technique, you can retrieve the bottom-five employees by salary:&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal&lt;br /&gt;   FROM&lt;br /&gt;   (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal,&lt;br /&gt;      RANK() OVER&lt;br /&gt;         (ORDER BY SAL ASC NULLS FIRST) AS Emp_Rank&lt;br /&gt;      FROM Emp&lt;br /&gt;      ORDER BY SAL ASC NULLS FIRST)&lt;br /&gt;   WHERE Emp_Rank &lt; 6;&lt;br /&gt;&lt;br /&gt;Listing 7 shows the output of the above code.&lt;br /&gt;&lt;br /&gt;Ranking functions can be used to operate within groups, too—that is, the rank value gets reset whenever the group changes. This is achieved with a PARTION BY subclause. Here is the syntax to retrieve the top employee by salary per manager group:&lt;br /&gt;&lt;br /&gt;SELECT Empno, Ename, Job, Mgr, Hiredate, Sal&lt;br /&gt;   FROM&lt;br /&gt;   (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal,&lt;br /&gt;      RANK() OVER&lt;br /&gt;         (PARTITION BY MGR ORDER BY MGR, SAL DESC NULLS LAST) AS Emp_Rank&lt;br /&gt;      FROM Emp&lt;br /&gt;      ORDER BY MGR, SAL DESC NULLS LAST)&lt;br /&gt;   WHERE Emp_Rank = 1;&lt;br /&gt;&lt;br /&gt;Listing 8 shows the output of the above code.&lt;br /&gt;&lt;br /&gt;As you can see, analytic functions are extremely useful in all types of analysis and computations, and they provide substantial SQL extensions to Oracle 8i.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt; Sample SQL matrix report&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem UPDATED VERSION&lt;br /&gt;rem Filename:   matrix.sql&lt;br /&gt;rem Purpose:    Example of a CROSS MATRIX report implemented using&lt;br /&gt;rem             standard SQL.&lt;br /&gt;rem Date:       12-Feb-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem&lt;br /&gt;rem Updated By  Mahesh Pednekar. (bunty609@hotmail.com)&lt;br /&gt;rem Description Removed the Main query because the sub query itself&lt;br /&gt;rem             will full fill the requirement.&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   oerr.sql&lt;br /&gt;rem Purpose:    Lookup Oracle error messages. Similar to unix "oerr" command.&lt;br /&gt;rem             This script is handy on platforms like NT with no OERR support&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;set veri off feed off&lt;br /&gt;&lt;br /&gt;prompt Lookup Oracle error messages:&lt;br /&gt;prompt&lt;br /&gt;prompt Please enter error numbers as negatives. E.g. -1&lt;br /&gt;prompt&lt;br /&gt;&lt;br /&gt;exec dbms_output.put_line('==&gt; '||sqlerrm( &amp;errno ) );&lt;br /&gt;&lt;br /&gt;set veri on feed on&lt;br /&gt;undef errno&lt;br /&gt;SELECT job,&lt;br /&gt;                sum(decode(deptno,10,sal)) DEPT10,&lt;br /&gt;                sum(decode(deptno,20,sal)) DEPT20,&lt;br /&gt;                sum(decode(deptno,30,sal)) DEPT30,&lt;br /&gt;                sum(decode(deptno,40,sal)) DEPT40&lt;br /&gt;           FROM scott.emp&lt;br /&gt;       GROUP BY job&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Sample output:&lt;br /&gt;--&lt;br /&gt;-- JOB           DEPT10     DEPT20     DEPT30     DEPT40&lt;br /&gt;-- --------- ---------- ---------- ---------- ----------&lt;br /&gt;-- ANALYST                    6000&lt;br /&gt;-- CLERK           1300       1900        950&lt;br /&gt;-- MANAGER         2450       2975       2850&lt;br /&gt;-- PRESIDENT       5000&lt;br /&gt;-- SALESMAN                              5600&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some other common sql queries from orafaqs.com&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL&lt;br /&gt;&lt;br /&gt;General SQL Scripts&lt;br /&gt;&lt;br /&gt;Sample SQL matrix report&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem UPDATED VERSION&lt;br /&gt;rem Filename:   matrix.sql&lt;br /&gt;rem Purpose:    Example of a CROSS MATRIX report implemented using&lt;br /&gt;rem             standard SQL.&lt;br /&gt;rem Date:       12-Feb-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem&lt;br /&gt;rem Updated By  Mahesh Pednekar. (bunty609@hotmail.com)&lt;br /&gt;rem Description Removed the Main query because the sub query itself&lt;br /&gt;rem             will full fill the requirement.&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;SELECT job,&lt;br /&gt;                sum(decode(deptno,10,sal)) DEPT10,&lt;br /&gt;                sum(decode(deptno,20,sal)) DEPT20,&lt;br /&gt;                sum(decode(deptno,30,sal)) DEPT30,&lt;br /&gt;                sum(decode(deptno,40,sal)) DEPT40&lt;br /&gt;           FROM scott.emp&lt;br /&gt;       GROUP BY job&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Sample output:&lt;br /&gt;--&lt;br /&gt;-- JOB           DEPT10     DEPT20     DEPT30     DEPT40&lt;br /&gt;-- --------- ---------- ---------- ---------- ----------&lt;br /&gt;-- ANALYST                    6000&lt;br /&gt;-- CLERK           1300       1900        950&lt;br /&gt;-- MANAGER         2450       2975       2850&lt;br /&gt;-- PRESIDENT       5000&lt;br /&gt;-- SALESMAN                              5600&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lookup Oracle error messages&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   oerr.sql&lt;br /&gt;rem Purpose:    Lookup Oracle error messages. Similar to unix "oerr" command.&lt;br /&gt;rem             This script is handy on platforms like NT with no OERR support&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;set veri off feed off&lt;br /&gt;&lt;br /&gt;prompt Lookup Oracle error messages:&lt;br /&gt;prompt&lt;br /&gt;prompt Please enter error numbers as negatives. E.g. -1&lt;br /&gt;prompt&lt;br /&gt;&lt;br /&gt;exec dbms_output.put_line('==&gt; '||sqlerrm( &amp;errno ) );&lt;br /&gt;&lt;br /&gt;set veri on feed on&lt;br /&gt;undef errno&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Display Database version, installed options and port string&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   ver.sql&lt;br /&gt;rem Purpose:    Show database version with options intalled&lt;br /&gt;rem             (handy for your HELP/ABOUT menu)&lt;br /&gt;rem Date:       12-Nov-1999&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set head off feed off pages 0 serveroutput on&lt;br /&gt;&lt;br /&gt;col banner format a72 wrap&lt;br /&gt;&lt;br /&gt;select banner&lt;br /&gt;from   sys.v_$version;&lt;br /&gt;&lt;br /&gt;select '   With the '||parameter||' option'&lt;br /&gt;from   sys.v_$option&lt;br /&gt;where  value = 'TRUE';&lt;br /&gt;&lt;br /&gt;select '   The '||parameter||' option is not installed'&lt;br /&gt;from   sys.v_$option&lt;br /&gt;where  value &lt;&gt; 'TRUE';&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;    dbms_output.put_line('Port String: '||dbms_utility.port_string);&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;set head on feed on&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;•  "Who am I" script&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   whoami.sql&lt;br /&gt;rem Purpose:    Reports information about your current database context&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set termout off&lt;br /&gt;store set store rep&lt;br /&gt;set head off&lt;br /&gt;set pause off&lt;br /&gt;set termout on&lt;br /&gt;&lt;br /&gt;select 'User: '|| user || ' on database ' || global_name,&lt;br /&gt;       '  (term='||USERENV('TERMINAL')||&lt;br /&gt;       ', audsid='||USERENV('SESSIONID')||')' as MYCONTEXT&lt;br /&gt;from   global_name;&lt;br /&gt;&lt;br /&gt;@store&lt;br /&gt;set termout on&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Select the Nth highest value from a table&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   maxvalue.sql&lt;br /&gt;rem Purpose:    Select the Nth highest value from a table&lt;br /&gt;rem Date:       18-Apr-2001&lt;br /&gt;rem Author:     Deepak Rai, SSE, Satyam Computer Services Ltd. India&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;select level, max('col_name') from my_table&lt;br /&gt;where level = '&amp;n'&lt;br /&gt;connect by prior ('col_name') &gt; 'col_name')&lt;br /&gt;group by level;&lt;br /&gt;&lt;br /&gt;-- Example :&lt;br /&gt;--&lt;br /&gt;-- Given a table called emp with the following columns:&lt;br /&gt;--   id   number&lt;br /&gt;--   name varchar2(20)&lt;br /&gt;--   sal  number&lt;br /&gt;--&lt;br /&gt;-- For the second highest salary:&lt;br /&gt;--&lt;br /&gt;-- select level, max(sal) from emp&lt;br /&gt;-- where level=2&lt;br /&gt;-- connect by prior sal &gt; sal&lt;br /&gt;-- group by level&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;Select the Nth lowest value from a table&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   minvalue.sql&lt;br /&gt;rem Purpose:    Select the Nth lowest value from a table&lt;br /&gt;rem Date:       18-Apr-2001&lt;br /&gt;rem Author:     Deepak Rai, SSE, Satyam Computer Services Ltd. India&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;select level, min('col_name') from my_table&lt;br /&gt;where level = '&amp;n'&lt;br /&gt;connect by prior ('col_name') &lt; 'col_name')&lt;br /&gt;group by level;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- Example:&lt;br /&gt;--&lt;br /&gt;-- Given a table called emp with the following columns:&lt;br /&gt;--   id   number&lt;br /&gt;--   name varchar2(20)&lt;br /&gt;--   sal  number&lt;br /&gt;--&lt;br /&gt;-- For the second lowest salary:&lt;br /&gt;--&lt;br /&gt;-- select level, min(sal) from emp&lt;br /&gt;-- where level=2&lt;br /&gt;-- connect by prior sal &lt; sal&lt;br /&gt;-- group by level&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;Demonstrate default column values&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   default.sql&lt;br /&gt;rem Purpose:    Example script to demonstrate DEFAULT column values&lt;br /&gt;rem Date:       25-Apr-2001&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;-- drop table x&lt;br /&gt;-- /&lt;br /&gt;&lt;br /&gt;create table x (a char, b number default 99999, c date, d varchar2(6))&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;alter table x modify (c date default sysdate)&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;insert into x(a, d) values ('a', 'qwerty')&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;select * from x&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;--&lt;br /&gt;-- Expected output:&lt;br /&gt;--&lt;br /&gt;--  A          B C           D&lt;br /&gt;--  - ---------- ----------- ------&lt;br /&gt;--  a      99999 25-APR-2001 qwerty&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   comments.sql&lt;br /&gt;rem Purpose:    Display table and column comments for the current schema&lt;br /&gt;rem             Handy for getting to know the database schema&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set pages 50000&lt;br /&gt;set null 'No Comments'&lt;br /&gt;&lt;br /&gt;tti 'Table Comments'&lt;br /&gt;col comments format a29 wrap word&lt;br /&gt;&lt;br /&gt;select * from user_tab_comments;&lt;br /&gt;&lt;br /&gt;tti 'Column Comments'&lt;br /&gt;col comments format a18 wrap word&lt;br /&gt;break on table_name skip 1&lt;br /&gt;select * from user_col_comments;&lt;br /&gt;clear break&lt;br /&gt;&lt;br /&gt;set null ''&lt;br /&gt;set pages 23&lt;br /&gt;&lt;br /&gt;Pass application info through to the Oracle RDBMS&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   appinfo.sql&lt;br /&gt;rem Purpose:    Example of how to pass application info through to Oracle RDBMS&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;-- The following code tells the database what the application is up to: &lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;   dbms_application_info.set_client_info('BANCS application info');&lt;br /&gt;   dbms_application_info.set_module('BANCS XYZ module', 'BANCS action name');&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Retrieve application info from the database:&lt;br /&gt;&lt;br /&gt;select module, action, client_info&lt;br /&gt;from   sys.v_$session where audsid = USERENV('SESSIONID')&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;select sql_text&lt;br /&gt;from   sys.v_$sqlarea&lt;br /&gt;where  module = 'BANCS XYZ module'&lt;br /&gt;and  action = 'BANCS action name'&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;SQL*Plus Help script&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   help.sql&lt;br /&gt;rem Purpose:    Access the SQL*Plus Help table&lt;br /&gt;rem Notes:      If the HELP table doesn't exist, see the SQL*Plus FAQ for&lt;br /&gt;rem             installation instructions.&lt;br /&gt;rem Date:       05-July-98&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;select info&lt;br /&gt;from   system.help&lt;br /&gt;where  upper(topic)=upper('&amp;1')&lt;br /&gt;/&lt;br /&gt;•  Test for Leap Years&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   leapyear.sql&lt;br /&gt;rem Purpose:    Check if a year is a leap year&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;select year,&lt;br /&gt;       decode( mod(year, 4), 0,&lt;br /&gt;          decode( mod(year, 400), 0, 'Leap Year',&lt;br /&gt;             decode( mod(year, 100), 0, 'Not a Leap Year', 'Leap Year')&lt;br /&gt;          ), 'Not a Leap Year'&lt;br /&gt;       ) as leap_year_indicator&lt;br /&gt;from   my_table&lt;br /&gt;/&lt;br /&gt;Spell out numbers to words&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   spellout.sql&lt;br /&gt;rem Purpose:    This script will spell out numbers to words (handy for &lt;br /&gt;rem  cheque printing). Example '10' --&gt; Ten&lt;br /&gt;rem Date:       12-Sep-2000&lt;br /&gt;rem Author:     Anonymous&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;select decode( sign( &amp;num ), -1, 'Negative ', 0, 'Zero', NULL ) ||&lt;br /&gt;       decode( sign( abs(&amp;num) ), +1, to_char( to_date( abs(&amp;num),'J'),'Jsp') )&lt;br /&gt;from dual&lt;br /&gt;/&lt;br /&gt;Demonstrate simple encoding and decoding of messages&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   encode.sql&lt;br /&gt;rem Purpose:    Demonstrate simple encoding and decoding of secret messages &lt;br /&gt;rem             This method can be extended to create simple password&lt;br /&gt;rem             encryption&lt;br /&gt;rem Date:       15-Feb-2001&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;SELECT TRANSLATE(&lt;br /&gt;        'HELLO WORLD',                  -- Message to encode&lt;br /&gt;        'ABCDEFGHIJKLMNOPQRSTUVWXYZ ',&lt;br /&gt;        '1234567890!@#$%^&amp;*()-=_+;,.') ENCODED_MESSAGE&lt;br /&gt;FROM DUAL&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;SELECT TRANSLATE(&lt;br /&gt;        '85@@%._%*@4',                  -- Message to decode&lt;br /&gt;        '1234567890!@#$%^&amp;*()-=_+;,.',&lt;br /&gt;        'ABCDEFGHIJKLMNOPQRSTUVWXYZ ') DECODED_MESSAGE&lt;br /&gt;FROM DUAL&lt;br /&gt;/&lt;br /&gt;•  Count the number of rows for ALL tables in current schema&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   countall.sql&lt;br /&gt;rem Purpose:    Count the number of rows for ALL tables in the current schema&lt;br /&gt;rem Date:       30-Apr-1999&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set termout off echo off feed off trimspool on head off pages 0&lt;br /&gt;&lt;br /&gt;spool countall.tmp&lt;br /&gt;select 'SELECT count(*), '''||table_name||''' from '||table_name||';'&lt;br /&gt;from   user_tables&lt;br /&gt;/&lt;br /&gt;spool off&lt;br /&gt;&lt;br /&gt;set termout on&lt;br /&gt;@@countall.tmp&lt;br /&gt;&lt;br /&gt;set head on feed on&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Demonstrate Oracle database types and object tables&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   objopt.sql&lt;br /&gt;rem Purpose:    Demonstrate Oracle database types and object tables&lt;br /&gt;rem Date:       12-Feb-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;drop type employee_typ;&lt;br /&gt;&lt;br /&gt;create type employee_typ as object (&lt;br /&gt;        empno NUMBER,&lt;br /&gt;        emp_name varchar2(30),&lt;br /&gt;        hiredate date,&lt;br /&gt;        member function days_at_company return NUMBER,&lt;br /&gt;        pragma restrict_references(days_at_company, WNDS)&lt;br /&gt;)&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;create type body employee_tye is&lt;br /&gt;begin&lt;br /&gt;        member function days_at_company return number is&lt;br /&gt;        begin&lt;br /&gt;                return (SYSDATE-hiredate);&lt;br /&gt;        end;&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;drop type department_typ;&lt;br /&gt;&lt;br /&gt;create type department_typ as object (&lt;br /&gt;        deptno NUMBER(5),&lt;br /&gt;        manager ref employee_typ&lt;br /&gt;)&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;select * from user_types&lt;br /&gt;where predefined = 'NO';&lt;br /&gt;&lt;br /&gt;-- Create a object table&lt;br /&gt;create table emp1 as employee_typ;&lt;br /&gt;&lt;br /&gt;create table employee (emp_no NUMBER, emp employee_typ);&lt;br /&gt;&lt;br /&gt;insert into employee values (1, employee_typ(1, 'Frank Naude', SYSDATE));&lt;br /&gt;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;select * from employee;&lt;br /&gt;&lt;br /&gt;select x.emp.emp_name from employee x;&lt;br /&gt;Demonstrate VARRAY database types&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   varray.sql&lt;br /&gt;rem Purpose:    Demontrate VARRAY (variable array in one database column) &lt;br /&gt;rem             collection types&lt;br /&gt;rem Date:       12-Aug-2001&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE TYPE vcarray AS VARRAY(10) OF VARCHAR2(128);&lt;br /&gt;/&lt;br /&gt;CREATE TABLE varray_table (id number, col1 vcarray);&lt;br /&gt;&lt;br /&gt;INSERT INTO varray_table VALUES (1, vcarray('A'));&lt;br /&gt;INSERT INTO varray_table VALUES (2, vcarray('B', 'C'));&lt;br /&gt;INSERT INTO varray_table VALUES (3, vcarray('D', 'E', 'F'));&lt;br /&gt;&lt;br /&gt;SELECT * FROM varray_table;&lt;br /&gt;SELECT * FROM USER_VARRAYS;&lt;br /&gt;-- SELECT * FROM USER_SEGMENTS;&lt;br /&gt;&lt;br /&gt;-- Unnesting the collection:&lt;br /&gt;select t1.id, t2.COLUMN_VALUE&lt;br /&gt;from   varray_table t1, TABLE(t1.col1) t2&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Use PL/SQL to access the varray...&lt;br /&gt;set serveroutput on&lt;br /&gt;declare&lt;br /&gt;  v_vcarray vcarray;&lt;br /&gt;begin&lt;br /&gt;  for c1 in (select * from varray_table) loop&lt;br /&gt;      dbms_output.put_line('Row fetched...');&lt;br /&gt;      FOR i IN c1.col1.FIRST..c1.col1.LAST LOOP&lt;br /&gt;          dbms_output.put_line('...property fetched: '|| c1.col1(i));&lt;br /&gt;      END LOOP;&lt;br /&gt;  end loop;&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Clean-up...&lt;br /&gt;DROP TABLE varray_table;&lt;br /&gt;DROP TYPE vcarray;&lt;br /&gt;Demonstrate Oracle temporary tables&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   temptab.sql&lt;br /&gt;rem Purpose:    Demonstrate Oracle 8i temporary tables&lt;br /&gt;rem Date:       23-Apr-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;drop table x&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;create global temporary table x (a date)&lt;br /&gt;        on commit delete rows     -- Delete rows after commit&lt;br /&gt;        -- on commit preserve rows   -- Delete rows after exit session&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;select table_name, temporary, duration&lt;br /&gt;from   user_tables&lt;br /&gt;where  table_name = 'X'&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;insert into x values (sysdate);&lt;br /&gt;&lt;br /&gt;select * from x;&lt;br /&gt;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;-- Inserted rows are missing after commit&lt;br /&gt;select * from x;&lt;br /&gt;&lt;br /&gt;Convert LONG data types to LOBs&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:     conv2lob.sql&lt;br /&gt;rem Purpose:      Convert LONG datatypes to LOBs (Large Objects)&lt;br /&gt;rem Dependancies: Oracle 8.1.x or higher&lt;br /&gt;rem Date:         17-Sep-2001&lt;br /&gt;rem Author:       Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;create table old_long_table(c1 number, c2 long);&lt;br /&gt;insert into  old_long_table values (1, 'LONG data to convert to CLOB');&lt;br /&gt;&lt;br /&gt;create table new_lob_table(c1 number, c2 clob);&lt;br /&gt;&lt;br /&gt;-- Use TO_LOB function to convert LONG to LOB...&lt;br /&gt;insert into  new_lob_table&lt;br /&gt;       select c1, to_lob(c2) from old_long_table;&lt;br /&gt;&lt;br /&gt;-- Note: the same procdure can be used to convert LONG RAW datatypes to BLOBs.&lt;br /&gt;&lt;br /&gt;Delete duplicate values from a table&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Purpose:    Delete duplicate values from a table&lt;br /&gt;rem Date:       04-Mar-2005&lt;br /&gt;rem Notes:      Verify that the correct rows are deleted before you COMMIT!&lt;br /&gt;rem Author:     Dharmendra Srivastava,Associate, &lt;br /&gt;rem             MindTree Consulting Pvt Ltd. India&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;DELETE FROM my_table &lt;br /&gt; WHERE ROWID NOT IN (SELECT MIN(ROWID) &lt;br /&gt;                       FROM my_table &lt;br /&gt;                      GROUP BY delete_col_name);&lt;br /&gt;&lt;br /&gt;-- Example :&lt;br /&gt;--&lt;br /&gt;-- Given a table called emp with the following columns:&lt;br /&gt;--   id   number&lt;br /&gt;--   name varchar2(20)&lt;br /&gt;--   sal  number&lt;br /&gt;--&lt;br /&gt;-- To delete the duplicate values:&lt;br /&gt;-- &lt;br /&gt;-- DELETE FROM emp &lt;br /&gt;--  WHERE ROWID NOT IN (SELECT MIN(ROWID) FROM emp GROUP BY id); &lt;br /&gt;-- &lt;br /&gt;-- COMMIT;&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;General PL/SQL: Scripts&lt;br /&gt;1. Update/ delete from a huge table with intermittent commits&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:  plsloop.sql&lt;br /&gt;rem Purpose:   Example: UPDATE/DELETE in a loop and commit very X records&lt;br /&gt;rem            Handy for huge tables that cause rollback segment problems&lt;br /&gt;rem            DON'T ISSUE COMMIT TOO FREQUENTLY!&lt;br /&gt;rem Date:      09-Apr-1999; Updated: 25-Nov-2004&lt;br /&gt;rem Author:    Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;declare&lt;br /&gt;  i number := 0;&lt;br /&gt;  cursor s1 is SELECT rowid, t.* FROM tab1 t WHERE col1 = 'value1';&lt;br /&gt;begin&lt;br /&gt;  for c1 in s1 loop&lt;br /&gt;      update tab1 set col1 = 'value2'&lt;br /&gt;             where rowid = c1.rowid;&lt;br /&gt;&lt;br /&gt;      i := i + 1;              -- Commit after every X records&lt;br /&gt;      if i &gt; 10000 then&lt;br /&gt;         commit;&lt;br /&gt;         i := 0;&lt;br /&gt;      end if;&lt;br /&gt;&lt;br /&gt;  end loop;&lt;br /&gt;  commit;&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Note: More advanced users can use the mod() function to commit every N rows. &lt;br /&gt;--       No counter variable required:&lt;br /&gt;--&lt;br /&gt;-- if mod(i, 10000) &lt;br /&gt;--    commit;&lt;br /&gt;--    dbms_output.put_line('Commit issued for rows up to: '||c1%rowcount);&lt;br /&gt;--  end if;&lt;br /&gt;--&lt;br /&gt;Simple program to demonstrate BULK COLLECT and BULK BIND operations&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   bulkbind.sql&lt;br /&gt;rem Purpose:    Simple program to demonstrate BULK COLLECT and BULK BIND.&lt;br /&gt;rem Notes:      Bulk operations on ROWTYPE only work from and above.&lt;br /&gt;rem Date:       12-Feb-2004&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;set serveroutput on size 50000&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;  CURSOR emp_cur IS SELECT * FROM EMP;&lt;br /&gt;&lt;br /&gt;  TYPE emp_tab_t IS TABLE OF emp%ROWTYPE INDEX BY BINARY_INTEGER;&lt;br /&gt;  emp_tab emp_tab_t;            -- In-memory table&lt;br /&gt;&lt;br /&gt;  rows NATURAL        := 10000;   -- Number of rows to process at a time&lt;br /&gt;  i    BINARY_INTEGER := 0;&lt;br /&gt;BEGIN&lt;br /&gt;  OPEN emp_cur;&lt;br /&gt;  LOOP&lt;br /&gt;    -- Bulk collect data into memory table - X rows at a time&lt;br /&gt;    FETCH emp_cur BULK COLLECT INTO emp_tab LIMIT rows;&lt;br /&gt;    EXIT WHEN emp_tab.COUNT = 0;&lt;br /&gt;&lt;br /&gt;    DBMS_OUTPUT.PUT_LINE( TO_CHAR(emp_tab.COUNT)|| ' rows bulk fetched.');&lt;br /&gt;&lt;br /&gt;    FOR i IN emp_tab.FIRST .. emp_tab.LAST loop&lt;br /&gt;      -- Manipumate data in the memory table...&lt;br /&gt;      dbms_output.put_line('i = '||i||', EmpName='||emp_tab(i).ename);&lt;br /&gt;    END LOOP;&lt;br /&gt;&lt;br /&gt;    -- Bulk bind of data in memory table...&lt;br /&gt;    FORALL i in emp_tab.FIRST..emp_tab.LAST&lt;br /&gt;      INSERT /*+APPEND*/ INTO emp2 VALUES emp_tab(i);&lt;br /&gt;&lt;br /&gt;  END LOOP;&lt;br /&gt;  CLOSE emp_cur;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;Profile PL/SQL code for execution statistics&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   profiler.sql&lt;br /&gt;rem Purpose:    Profile PL/SQL code to get run-time statistics.&lt;br /&gt;rem             Shows execution time for each PL/SQL line. This data can&lt;br /&gt;rem             be used to improve performance.&lt;br /&gt;rem Date:       02-Mar-2004&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;conn / as sysdba&lt;br /&gt;&lt;br /&gt;-- Install the profiler...&lt;br /&gt;@?/rdbms/admin/proftab&lt;br /&gt;@?/rdbms/admin/profload&lt;br /&gt;@?/plsql/demo/profrep.sql&lt;br /&gt;&lt;br /&gt;-- Create a test procedure to time...&lt;br /&gt;CREATE OR REPLACE PROCEDURE proc1 IS&lt;br /&gt;  v_dummy CHAR;&lt;br /&gt;BEGIN&lt;br /&gt;   FOR i IN 1..100 LOOP&lt;br /&gt;      SELECT dummy INTO v_dummy FROM dual;&lt;br /&gt;   END LOOP;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;SHOW ERRORS&lt;br /&gt;&lt;br /&gt;-- Do the profilling and print the report...&lt;br /&gt;set line 5000 serveroutput on size 1000000&lt;br /&gt;DECLARE&lt;br /&gt;  v_run NUMBER;&lt;br /&gt;BEGIN&lt;br /&gt;  DBMS_PROFILER.START_PROFILER('test','test1',v_run);&lt;br /&gt;  proc1;&lt;br /&gt;  DBMS_PROFILER.STOP_PROFILER;&lt;br /&gt;  DBMS_PROFILER.ROLLUP_RUN(v_run);&lt;br /&gt;  PROF_REPORT_UTILITIES.PRINT_RUN(v_run);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;Select records from a cursor into PL/SQL table&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:  plstable.sql&lt;br /&gt;rem Purpose:   Example: how to populate a PL/SQL Table from a cursor&lt;br /&gt;rem Date:      09-Apr-1999&lt;br /&gt;rem Author:    Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;&lt;br /&gt;declare&lt;br /&gt;  -- Declare the PL/SQL table&lt;br /&gt;  type deptarr is table of dept%rowtype&lt;br /&gt;       index by binary_integer;&lt;br /&gt;  d_arr deptarr;&lt;br /&gt;&lt;br /&gt;  -- Declare cursor&lt;br /&gt;  type d_cur is ref cursor return dept%rowtype;&lt;br /&gt;  c1 d_cur;&lt;br /&gt;&lt;br /&gt;  i number := 1;&lt;br /&gt;begin&lt;br /&gt;  -- Populate the PL/SQL table from the cursor&lt;br /&gt;  open c1 for select * from dept;&lt;br /&gt;  loop&lt;br /&gt;    exit when c1%NOTFOUND;&lt;br /&gt;    fetch c1 into d_arr(i);&lt;br /&gt;    i := i+1;&lt;br /&gt;  end loop;&lt;br /&gt;  close c1;&lt;br /&gt;&lt;br /&gt;  -- Display the entire PL/SQL table on screen&lt;br /&gt;  for i in 1..d_arr.last loop&lt;br /&gt;    dbms_output.put_line('DEPTNO : '||d_arr(i).deptno );&lt;br /&gt;    dbms_output.put_line('DNAME  : '||d_arr(i).dname  );&lt;br /&gt;    dbms_output.put_line('LOC    : '||d_arr(i).loc    );&lt;br /&gt;    dbms_output.put_line('---------------------------');&lt;br /&gt;  end loop;&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Password encrypt/decrypt using DBMS Obfuscation Toolkit&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:  password.sql&lt;br /&gt;rem Purpose:   Simple password encryption package to demonstrate how&lt;br /&gt;rem            values can be encrypted and decrypted using Oracle's&lt;br /&gt;rem            DBMS Obfuscation Toolkit&lt;br /&gt;rem Note:      Connect to SYS AS SYSDBA and run ?/rdbms/admin/catobtk.sql&lt;br /&gt;rem Date:      18-Mar-2003&lt;br /&gt;rem Author:    Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE PASSWORD AS&lt;br /&gt;   function encrypt(i_password varchar2) return varchar2;&lt;br /&gt;   function decrypt(i_password varchar2) return varchar2;&lt;br /&gt;END PASSWORD;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE BODY PASSWORD AS&lt;br /&gt;&lt;br /&gt;  -- key must be exactly 8 bytes long&lt;br /&gt;  c_encrypt_key varchar2(8) := 'key45678';&lt;br /&gt;&lt;br /&gt;  function encrypt (i_password varchar2) return varchar2 is&lt;br /&gt;    v_encrypted_val varchar2(38);&lt;br /&gt;    v_data          varchar2(38);&lt;br /&gt;  begin&lt;br /&gt;     -- Input data must have a length divisible by eight&lt;br /&gt;     v_data := RPAD(i_password,(TRUNC(LENGTH(i_password)/8)+1)*8,CHR(0));&lt;br /&gt;&lt;br /&gt;     DBMS_OBFUSCATION_TOOLKIT.DESENCRYPT(&lt;br /&gt;        input_string     =&gt; v_data,&lt;br /&gt;        key_string       =&gt; c_encrypt_key,&lt;br /&gt;        encrypted_string =&gt; v_encrypted_val);&lt;br /&gt;     return v_encrypted_val;&lt;br /&gt;  end encrypt;&lt;br /&gt;&lt;br /&gt;  function decrypt (i_password varchar2) return varchar2 is&lt;br /&gt;    v_decrypted_val varchar2(38);&lt;br /&gt;  begin&lt;br /&gt;     DBMS_OBFUSCATION_TOOLKIT.DESDECRYPT(&lt;br /&gt;        input_string     =&gt; i_password,&lt;br /&gt;        key_string       =&gt; c_encrypt_key,&lt;br /&gt;        decrypted_string =&gt; v_decrypted_val);&lt;br /&gt;     return v_decrypted_val;&lt;br /&gt;  end decrypt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;end PASSWORD;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;-- Test if it is working...&lt;br /&gt;select password.encrypt('PASSWORD1') from dual;&lt;br /&gt;select password.decrypt(app_password.encrypt('PASSWORD1')) from dual;&lt;br /&gt;select password.encrypt('PSW2') from dual;&lt;br /&gt;select password.decrypt(app_password.encrypt('PSW2')) from dual;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pass result sets (REF CURSOR) between procedures and functions&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   refcurs.sql&lt;br /&gt;rem Purpose:    Pass result sets (REF CURSOR) between procedures and &lt;br /&gt;rem  functions&lt;br /&gt;rem Date:       15-Jun-2001&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;&lt;br /&gt;-- Define TYPES package separately to be available to all programming&lt;br /&gt;-- environments...&lt;br /&gt;CREATE OR REPLACE PACKAGE types AS&lt;br /&gt;   TYPE cursortyp is REF CURSOR;   -- use weak form&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Create test package to demonstrate passing result sets...&lt;br /&gt;CREATE OR REPLACE PACKAGE test_ref_cursor AS&lt;br /&gt;   PROCEDURE main;&lt;br /&gt;   FUNCTION  get_cursor_ref(typ NUMBER) RETURN types.cursortyp;&lt;br /&gt;   PROCEDURE process_cursor(cur types.cursortyp);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE BODY test_ref_cursor AS&lt;br /&gt;&lt;br /&gt;  -- Main program entry point&lt;br /&gt;  PROCEDURE main IS&lt;br /&gt;  BEGIN&lt;br /&gt;    process_cursor( get_cursor_ref(1) );&lt;br /&gt;    process_cursor( get_cursor_ref(2) );&lt;br /&gt;  END;&lt;br /&gt;&lt;br /&gt;  -- Get and return a CURSOR REF/ Result Set&lt;br /&gt;  FUNCTION get_cursor_ref(typ NUMBER) RETURN types.cursortyp IS&lt;br /&gt;    cur  types.cursortyp;&lt;br /&gt;  BEGIN&lt;br /&gt;    if typ = 1 THEN&lt;br /&gt;      OPEN cur FOR SELECT * FROM emp  WHERE ROWNUM &lt; 5;&lt;br /&gt;    ELSE&lt;br /&gt;      OPEN cur FOR SELECT * FROM dept WHERE ROWNUM &lt; 5;&lt;br /&gt;    END IF;&lt;br /&gt;    RETURN cur;&lt;br /&gt;  END;&lt;br /&gt;&lt;br /&gt;  -- Process rows for an EMP or DEPT cursor&lt;br /&gt;  PROCEDURE process_cursor(cur types.cursortyp) IS&lt;br /&gt;    empRec  emp%ROWTYPE;&lt;br /&gt;    deptRec dept%ROWTYPE;&lt;br /&gt;  BEGIN&lt;br /&gt;    LOOP&lt;br /&gt;      FETCH cur INTO empRec;    -- Maybe it was an EMP cursor, try to fetch...&lt;br /&gt;      EXIT WHEN cur%NOTFOUND;&lt;br /&gt;      dbms_output.put_line('EMP ROW: '||empRec.ename);&lt;br /&gt;    END LOOP;&lt;br /&gt;  EXCEPTION&lt;br /&gt;    WHEN ROWTYPE_MISMATCH THEN  -- OK, so it was't EMP, let's try DEPT.&lt;br /&gt;       LOOP&lt;br /&gt;         FETCH cur INTO deptRec;&lt;br /&gt;         EXIT WHEN cur%NOTFOUND;&lt;br /&gt;         dbms_output.put_line('DEPT ROW: '||deptRec.dname);&lt;br /&gt;       END LOOP;&lt;br /&gt;  END;&lt;br /&gt;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;EXEC test_ref_cursor.main;&lt;br /&gt;&lt;br /&gt;Convert between different numbering systems (binary, octal, decimal and hex)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   dbms_numsystem.sql&lt;br /&gt;rem Purpose:    Package with functions to convert numbers between the &lt;br /&gt;rem             Decimal, Binary, Octal and Hexidecimal numbering systems.&lt;br /&gt;rem Usage:      See sampels at the bottom of this file&lt;br /&gt;rem Author:     Frank Naude, 17 February 2003&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE dbms_numsystem AS&lt;br /&gt;   function bin2dec (binval in char  ) RETURN number;&lt;br /&gt;   function dec2bin (N      in number) RETURN varchar2; &lt;br /&gt;   function oct2dec (octval in char  ) RETURN number;&lt;br /&gt;   function dec2oct (N      in number) RETURN varchar2; &lt;br /&gt;   function hex2dec (hexval in char  ) RETURN number;&lt;br /&gt;   function dec2hex (N      in number) RETURN varchar2; &lt;br /&gt;END dbms_numsystem;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE BODY dbms_numsystem AS&lt;br /&gt;&lt;br /&gt;FUNCTION bin2dec (binval in char) RETURN number IS&lt;br /&gt;  i                 number;&lt;br /&gt;  digits            number;&lt;br /&gt;  result            number := 0;&lt;br /&gt;  current_digit     char(1);&lt;br /&gt;  current_digit_dec number;&lt;br /&gt;BEGIN&lt;br /&gt;  digits := length(binval);&lt;br /&gt;  for i in 1..digits loop&lt;br /&gt;     current_digit := SUBSTR(binval, i, 1);&lt;br /&gt;     current_digit_dec := to_number(current_digit);&lt;br /&gt;     result := (result * 2) + current_digit_dec;&lt;br /&gt;  end loop;&lt;br /&gt;  return result;&lt;br /&gt;END bin2dec;&lt;br /&gt;&lt;br /&gt;FUNCTION dec2bin (N in number) RETURN varchar2 IS&lt;br /&gt;  binval varchar2(64);&lt;br /&gt;  N2     number := N;&lt;br /&gt;BEGIN&lt;br /&gt;  while ( N2 &gt; 0 ) loop&lt;br /&gt;     binval := mod(N2, 2) || binval;&lt;br /&gt;     N2 := trunc( N2 / 2 );&lt;br /&gt;  end loop;&lt;br /&gt;  return binval;&lt;br /&gt;END dec2bin;&lt;br /&gt;&lt;br /&gt;FUNCTION oct2dec (octval in char) RETURN number IS&lt;br /&gt;  i                 number;&lt;br /&gt;  digits            number;&lt;br /&gt;  result            number := 0;&lt;br /&gt;  current_digit     char(1);&lt;br /&gt;  current_digit_dec number;&lt;br /&gt;BEGIN&lt;br /&gt;  digits := length(octval);&lt;br /&gt;  for i in 1..digits loop&lt;br /&gt;     current_digit := SUBSTR(octval, i, 1);&lt;br /&gt;     current_digit_dec := to_number(current_digit);&lt;br /&gt;     result := (result * 8) + current_digit_dec;&lt;br /&gt;  end loop;&lt;br /&gt;  return result;&lt;br /&gt;END oct2dec;&lt;br /&gt;&lt;br /&gt;FUNCTION dec2oct (N in number) RETURN varchar2 IS&lt;br /&gt;  octval varchar2(64);&lt;br /&gt;  N2     number := N;&lt;br /&gt;BEGIN&lt;br /&gt;  while ( N2 &gt; 0 ) loop&lt;br /&gt;     octval := mod(N2, 8) || octval;&lt;br /&gt;     N2 := trunc( N2 / 8 );&lt;br /&gt;  end loop;&lt;br /&gt;  return octval;&lt;br /&gt;END dec2oct;&lt;br /&gt;&lt;br /&gt;FUNCTION hex2dec (hexval in char) RETURN number IS&lt;br /&gt;  i                 number;&lt;br /&gt;  digits            number;&lt;br /&gt;  result            number := 0;&lt;br /&gt;  current_digit     char(1);&lt;br /&gt;  current_digit_dec number;&lt;br /&gt;BEGIN&lt;br /&gt;  digits := length(hexval);&lt;br /&gt;  for i in 1..digits loop&lt;br /&gt;     current_digit := SUBSTR(hexval, i, 1);&lt;br /&gt;     if current_digit in ('A','B','C','D','E','F') then&lt;br /&gt;        current_digit_dec := ascii(current_digit) - ascii('A') + 10;&lt;br /&gt;     else&lt;br /&gt;        current_digit_dec := to_number(current_digit);&lt;br /&gt;     end if;&lt;br /&gt;     result := (result * 16) + current_digit_dec;&lt;br /&gt;  end loop;&lt;br /&gt;  return result;&lt;br /&gt;END hex2dec;&lt;br /&gt;&lt;br /&gt;FUNCTION dec2hex (N in number) RETURN varchar2 IS&lt;br /&gt;  hexval varchar2(64);&lt;br /&gt;  N2     number := N;&lt;br /&gt;  digit  number;&lt;br /&gt;  hexdigit  char;&lt;br /&gt;BEGIN&lt;br /&gt;  while ( N2 &gt; 0 ) loop&lt;br /&gt;     digit := mod(N2, 16);&lt;br /&gt;     if digit &gt; 9 then &lt;br /&gt;        hexdigit := chr(ascii('A') + digit - 10);&lt;br /&gt;     else&lt;br /&gt;        hexdigit := to_char(digit);&lt;br /&gt;     end if;&lt;br /&gt;     hexval := hexdigit || hexval;&lt;br /&gt;     N2 := trunc( N2 / 16 );&lt;br /&gt;  end loop;&lt;br /&gt;  return hexval;&lt;br /&gt;END dec2hex;&lt;br /&gt;&lt;br /&gt;END dbms_numsystem;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;-- Examples:&lt;br /&gt;select dbms_numsystem.dec2bin(22)      from dual;&lt;br /&gt;select dbms_numsystem.bin2dec('10110') from dual;&lt;br /&gt;select dbms_numsystem.dec2oct(44978)   from dual;&lt;br /&gt;select dbms_numsystem.oct2dec(127662)  from dual;&lt;br /&gt;select dbms_numsystem.dec2hex(44978)   from dual;&lt;br /&gt;select dbms_numsystem.hex2dec('AFB2')  from dual;&lt;br /&gt;&lt;br /&gt;Random number/ string generator package&lt;br /&gt;/*&lt;br /&gt;------------------------------------------------------------------------------&lt;br /&gt;Filename:  random.txt&lt;br /&gt;Purpose:   Random number/ string generator package&lt;br /&gt;Author:    Unknown&lt;br /&gt;Original:  http://orafaq.net/scripts/sql/random.txt&lt;br /&gt;Edits:&lt;br /&gt; 19990908 Phil Rand &lt;prand@spu.edu&gt; Added functions rand_string(), smaller().&lt;br /&gt;------------------------------------------------------------------------------&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;create or replace package random&lt;br /&gt;is&lt;br /&gt;   procedure srand(new_seed in number);&lt;br /&gt;   procedure get_rand(r OUT number);&lt;br /&gt;   procedure get_rand_max(r OUT number, n IN number);&lt;br /&gt;   function  rand return number;&lt;br /&gt;   function  rand_max(n IN number) return number;&lt;br /&gt;   function  rand_string(ssiz IN number) return varchar2;&lt;br /&gt;   function  smaller(x IN number, y IN number) return number;&lt;br /&gt;   pragma restrict_references(rand, WNDS);&lt;br /&gt;   pragma restrict_references(rand_max, WNDS);&lt;br /&gt;   pragma restrict_references(random, WNDS, RNPS);&lt;br /&gt;   pragma restrict_references(rand_string, WNDS);&lt;br /&gt;   pragma restrict_references(smaller, WNDS);&lt;br /&gt;end random;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;create or replace package body random&lt;br /&gt;is&lt;br /&gt;   multiplier   constant number := 22695477;&lt;br /&gt;   increment    constant number := 1;&lt;br /&gt;   "2^32"       constant number := 2 ** 32;&lt;br /&gt;   "2^16"       constant number := 2 ** 16;&lt;br /&gt;   "0x7fff"     constant number := 32767;&lt;br /&gt;   Seed         number          := 1;&lt;br /&gt;&lt;br /&gt;   function  smaller(x IN number, y IN number) return number is&lt;br /&gt;   begin&lt;br /&gt; if x &lt;= y then&lt;br /&gt;     return x;&lt;br /&gt; else&lt;br /&gt;     return y;&lt;br /&gt; end if;&lt;br /&gt;   end smaller;&lt;br /&gt;&lt;br /&gt;   function rand_string(ssiz IN number) return varchar2 is&lt;br /&gt;     i      number;&lt;br /&gt;     m      number;&lt;br /&gt;     c      char;&lt;br /&gt;     result varchar2(2000) := '';&lt;br /&gt;   begin&lt;br /&gt; m := smaller(ssiz,2000);&lt;br /&gt; for i in 1..m loop&lt;br /&gt;     c := substr('abcdefghijklmnopqrstuvwxyz0123456789',rand_max(36),1);&lt;br /&gt;     result := result || c;&lt;br /&gt;        end loop;&lt;br /&gt; return result;&lt;br /&gt;   end rand_string;&lt;br /&gt;&lt;br /&gt;   procedure srand(new_seed in number) is&lt;br /&gt;   begin&lt;br /&gt;     Seed := new_seed;&lt;br /&gt;   end srand;&lt;br /&gt;&lt;br /&gt;   function rand return number is&lt;br /&gt;   begin&lt;br /&gt;     Seed := mod(multiplier * Seed + increment, "2^32");&lt;br /&gt;     return bitand(Seed/"2^16", "0x7fff");&lt;br /&gt;   end rand;&lt;br /&gt;&lt;br /&gt;   procedure get_rand(r OUT number) is&lt;br /&gt;   begin&lt;br /&gt;     r := rand;&lt;br /&gt;   end get_rand;&lt;br /&gt;&lt;br /&gt;   function rand_max(n IN number) return number is&lt;br /&gt;   begin&lt;br /&gt;     return mod(rand, n) + 1;&lt;br /&gt;   end rand_max;&lt;br /&gt;&lt;br /&gt;   procedure get_rand_max(r OUT number, n IN number) is&lt;br /&gt;   begin&lt;br /&gt;     r := rand_max(n);&lt;br /&gt;   end get_rand_max;&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;   select userenv('SESSIONID')&lt;br /&gt;   into   Seed&lt;br /&gt;   from   dual;&lt;br /&gt;end random;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Some examples:&lt;br /&gt;select random.rand_max(10) from dual;&lt;br /&gt;select random.rand_max(10) from dual;&lt;br /&gt;select random.rand_string(20) from dual;&lt;br /&gt;select random.rand_string(20) from dual;&lt;br /&gt;&lt;br /&gt;Function to test for Leap Years&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   leapyear.sql&lt;br /&gt;rem Purpose:    Check if a year is a leap year&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION isLeapYear(i_year NUMBER) RETURN boolean AS&lt;br /&gt;BEGIN&lt;br /&gt;  -- A year is a leap year if it is evenly divisible by 4 &lt;br /&gt;  -- but not if it's evenly divisible by 100 &lt;br /&gt;  -- unless it's also evenly divisible by 400 &lt;br /&gt;&lt;br /&gt;   IF mod(i_year, 400) = 0 OR ( mod(i_year, 4) = 0 AND mod(i_year, 100) != 0) THEN&lt;br /&gt;      return TRUE;&lt;br /&gt;   ELSE &lt;br /&gt;      return FALSE;&lt;br /&gt;   END IF;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;-- Let's test it&lt;br /&gt;SET SERVEROUTPUT ON&lt;br /&gt;BEGIN&lt;br /&gt;  IF isLeapYear(2004) THEN&lt;br /&gt;     dbms_output.put_line('Yes, it is a leap year');&lt;br /&gt;  ELSE&lt;br /&gt;     dbms_output.put_line('No, it is not a leap year');&lt;br /&gt;  END IF;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;•  Print the ASCII table&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   asciitab.sql&lt;br /&gt;rem Purpose:    Print ASCII table&lt;br /&gt;rem Date:       13-Jun-2000&lt;br /&gt;rem Author:     Anonymous&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on size 10240&lt;br /&gt;&lt;br /&gt;declare&lt;br /&gt;   i number;&lt;br /&gt;   j number;&lt;br /&gt;   k number;&lt;br /&gt;begin&lt;br /&gt;   for i in 2..15 loop&lt;br /&gt;       for j in 1..16 loop&lt;br /&gt;           k:=i*16+j;&lt;br /&gt;           dbms_output.put((to_char(k,'000'))||':'||chr(k)||'  ');&lt;br /&gt;           if k mod 8 = 0 then&lt;br /&gt;              dbms_output.put_line('');&lt;br /&gt;           end if;&lt;br /&gt;       end loop;&lt;br /&gt;   end loop;&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Recursive algorithms to calculate Fibonacci and Factorials&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   recurse.sql&lt;br /&gt;rem Purpose:    Script to demonstrate how recursive algorithms like&lt;br /&gt;rem             Fibonacci and Factorials can be implemented in PL/SQL&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;-- Computing the Factorial of a number (n!)&lt;br /&gt;CREATE OR REPLACE FUNCTION fac (n POSITIVE) RETURN INTEGER IS&lt;br /&gt;BEGIN&lt;br /&gt;  IF n = 1 THEN  -- terminating condition&lt;br /&gt;     RETURN 1;&lt;br /&gt;  ELSE&lt;br /&gt;     RETURN n * fac(n - 1);  -- recursive call&lt;br /&gt;  END IF;&lt;br /&gt;END fac;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Test n!&lt;br /&gt;SELECT fac(1), fac(2), fac(3), fac(4), fac(5) FROM dual;&lt;br /&gt;&lt;br /&gt;-- Sample output:&lt;br /&gt;--     FAC(1)     FAC(2)     FAC(3)     FAC(4)     FAC(5)&lt;br /&gt;-- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;--          1          2          6         24        120&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- Computing the Nth Fibonacci number&lt;br /&gt;CREATE OR REPLACE FUNCTION fib (n POSITIVE) RETURN INTEGER IS&lt;br /&gt;BEGIN&lt;br /&gt;  IF (n = 1) OR (n = 2) THEN  -- terminating condition&lt;br /&gt;     RETURN 1;&lt;br /&gt;  ELSE&lt;br /&gt;     RETURN fib(n - 1) + fib(n - 2);  -- recursive call&lt;br /&gt;  END IF;&lt;br /&gt;END fib;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Test Fibonacci Series:&lt;br /&gt;SELECT fib(1), fib(2), fib(3), fib(4), fib(5) FROM dual;&lt;br /&gt;&lt;br /&gt;-- Sample output:&lt;br /&gt;--     FIB(1)     FIB(2)     FIB(3)     FIB(4)     FIB(5)&lt;br /&gt;-- ---------- ---------- ---------- ---------- ----------&lt;br /&gt;--         1          1          2          3          5&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Fetch LOB column values piece-wise from PL/SQL&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   readlob.sql&lt;br /&gt;rem Purpose:    Fetch LOB column values piece-wise from PL/SQL&lt;br /&gt;rem Date:       12-Jun-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;&lt;br /&gt;DROP TABLE lob_table;                  -- Create table to hols LOBs&lt;br /&gt;CREATE TABLE lob_table  (&lt;br /&gt;        id      INTEGER,&lt;br /&gt;        b_lob   BLOB,&lt;br /&gt;        c_lob   CLOB,&lt;br /&gt;        b_file  BFILE );&lt;br /&gt;&lt;br /&gt;INSERT INTO lob_table                  -- Create sample record&lt;br /&gt; VALUES (1, EMPTY_BLOB(), 'abcde', NULL);&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;   clob_locator CLOB;&lt;br /&gt;   charbuf      VARCHAR2(20);&lt;br /&gt;   read_offset  INTEGER;&lt;br /&gt;   read_amount  INTEGER;&lt;br /&gt;BEGIN&lt;br /&gt;   -- First we need to get the lob locator&lt;br /&gt;   SELECT c_lob INTO clob_locator FROM lob_table WHERE id = 1;&lt;br /&gt;&lt;br /&gt;   DBMS_OUTPUT.PUT_LINE('CLOB Size: ' ||&lt;br /&gt;                       DBMS_LOB.GETLENGTH(clob_locator));&lt;br /&gt;&lt;br /&gt;   -- Read LOB field contents&lt;br /&gt;   read_offset := 1;&lt;br /&gt;   read_amount := 20;&lt;br /&gt;   dbms_lob.read(clob_locator, read_amount, read_offset, charbuf);&lt;br /&gt;   dbms_output.put_line('CLOB Value: ' || charbuf);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Upload and save binary files (like pictures, documents, etc) to/from the DB&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   loadlob.sql&lt;br /&gt;rem Purpose:    Load a binary file (images, documents, etc) into a&lt;br /&gt;rem             database table.&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;DROP TABLE lob_table;&lt;br /&gt;DROP SEQUENCE lob_seq;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE DIRECTORY my_dir AS '/app/oracle/';&lt;br /&gt;&lt;br /&gt;CREATE TABLE lob_table (id NUMBER, fil BLOB);&lt;br /&gt;CREATE SEQUENCE lob_seq;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE load_file(p_file VARCHAR2)&lt;br /&gt;IS&lt;br /&gt;    src_lob  BFILE := BFILENAME('MY_DIR', p_file);&lt;br /&gt;    dest_lob BLOB;&lt;br /&gt;BEGIN&lt;br /&gt;   INSERT INTO lob_table VALUES(lob_seq.nextval, EMPTY_BLOB())&lt;br /&gt;      RETURNING fil INTO dest_lob;&lt;br /&gt;&lt;br /&gt;   DBMS_LOB.OPEN(src_lob, DBMS_LOB.LOB_READONLY);&lt;br /&gt;   DBMS_LOB.LoadFromFile( DEST_LOB =&gt; dest_lob,&lt;br /&gt;                          SRC_LOB  =&gt; src_lob,&lt;br /&gt;                          AMOUNT   =&gt; DBMS_LOB.GETLENGTH(src_lob) );&lt;br /&gt;   DBMS_LOB.CLOSE(src_lob);&lt;br /&gt;&lt;br /&gt;   COMMIT;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;-- Let's test it&lt;br /&gt;exec load_file('pic1.gif');&lt;br /&gt;SELECT id, DBMS_LOB.GETLENGTH(fil) AS bytes_loaded&lt;br /&gt;  FROM lob_table;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   savelob.sql&lt;br /&gt;rem Purpose:    Save a binary file (images, documents, etc) from database&lt;br /&gt;rem             to a flat file.&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE save_file(p_id NUMBER, p_file VARCHAR2)&lt;br /&gt;IS&lt;br /&gt;   v_lob_loc      BLOB;&lt;br /&gt;   v_lob_len      NUMBER;&lt;br /&gt;   v_buffer       RAW(32767);&lt;br /&gt;   v_buffer_size  BINARY_INTEGER := 32767;&lt;br /&gt;   v_offset       NUMBER         := 1;&lt;br /&gt;   v_out_file     UTL_FILE.FILE_TYPE;&lt;br /&gt;BEGIN&lt;br /&gt;    SELECT fil INTO v_lob_loc FROM lob_table WHERE id = p_id;&lt;br /&gt;    v_lob_len := DBMS_LOB.GETLENGTH(v_lob_loc);&lt;br /&gt;&lt;br /&gt;    DBMS_LOB.OPEN(v_lob_loc, DBMS_LOB.LOB_READONLY);&lt;br /&gt;    v_out_file := UTL_FILE.FOPEN(location      =&gt; 'MY_DIR', &lt;br /&gt;                                 filename      =&gt; p_file, &lt;br /&gt;                                 open_mode     =&gt; 'w',&lt;br /&gt;                                 max_linesize  =&gt; 32767);&lt;br /&gt;&lt;br /&gt;    WHILE (v_offset &lt;= v_lob_len) LOOP&lt;br /&gt;      dbms_output.put_line('v_start : ' || to_char(v_offset));&lt;br /&gt;      DBMS_LOB.READ(lob_loc =&gt; v_lob_loc,&lt;br /&gt;                    amount  =&gt; v_buffer_size,&lt;br /&gt;                    offset  =&gt; v_offset,&lt;br /&gt;                    buffer  =&gt; v_buffer);&lt;br /&gt;      v_offset := v_offset + v_buffer_size;&lt;br /&gt;      UTL_FILE.PUT_RAW(file   =&gt; v_out_file,&lt;br /&gt;                       buffer =&gt; v_buffer);&lt;br /&gt;    END LOOP;&lt;br /&gt;&lt;br /&gt;    UTL_FILE.FCLOSE(v_out_file);&lt;br /&gt;    DBMS_LOB.CLOSE(v_lob_loc);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;-- Let's test it&lt;br /&gt;exec save_file(1, 'pic2.gif');&lt;br /&gt;! ls -l /app/oracle/pic*.gif&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Fetch LONG column values piece-wise from PL/SQL&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   readlong.sql&lt;br /&gt;rem Purpose:    Fetch Long column values piece-wise from PL/SQL&lt;br /&gt;rem Date:       12-Jan-1999&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on&lt;br /&gt;&lt;br /&gt;-- Create test table&lt;br /&gt;drop table longtable;&lt;br /&gt;create table longtable (longcol long) tablespace TOOLS;&lt;br /&gt;insert into longtable values ( rpad('x', 257, 'QWERTY') );&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;  cur1       PLS_INTEGER         := DBMS_SQL.OPEN_CURSOR;;&lt;br /&gt;  rc         NUMBER;&lt;br /&gt;  long_piece VARCHAR2(256);&lt;br /&gt;  piece_len  INTEGER             := 0;&lt;br /&gt;  long_tab   DBMS_SQL.VARCHAR2S;&lt;br /&gt;  long_len   INTEGER             := 0;&lt;br /&gt;BEGIN&lt;br /&gt;  DBMS_SQL.PARSE(cur1, 'select longcol from longtable', DBMS_SQL.NATIVE);&lt;br /&gt;  DBMS_SQL.DEFINE_COLUMN_LONG(cur1, 1);&lt;br /&gt;  rc := DBMS_SQL.EXECUTE(cur1);&lt;br /&gt;  rc := DBMS_SQL.FETCH_ROWS(cur1);                       -- Get one row&lt;br /&gt;&lt;br /&gt;  -- Loop until all pieces of the long column are processed&lt;br /&gt;  LOOP&lt;br /&gt;     DBMS_SQL.COLUMN_VALUE_LONG(cur1, 1, 256, long_len, long_piece, piece_len);&lt;br /&gt;     EXIT WHEN piece_len = 0;&lt;br /&gt;     DBMS_OUTPUT.PUT_LINE('Long piece len='|| piece_len);&lt;br /&gt;&lt;br /&gt;     long_tab( NVL(long_tab.LAST, 0)+1 ) := long_piece;  -- Add piece to table&lt;br /&gt;     long_len := long_len + piece_len;&lt;br /&gt;  END LOOP;&lt;br /&gt;  DBMS_SQL.CLOSE_CURSOR(cur1);&lt;br /&gt;  DBMS_OUTPUT.PUT_LINE('Total long col fetched, len='|| long_len);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;Demonstrate writing to a file using the UTL_FILE package&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   utlfile.sql&lt;br /&gt;rem Purpose:    Demonstrate writing to a file using the UTL_FILE package&lt;br /&gt;rem Date:       28-Aug-1998&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE DIRECTORY test_dir AS 'c:\';&lt;br /&gt;-- CREATE DIRECTORY test_dir AS '/tmp';&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;  fileHandler UTL_FILE.FILE_TYPE;&lt;br /&gt;BEGIN&lt;br /&gt;  fileHandler := UTL_FILE.FOPEN('test_dir', 'test_file.txt', 'W');&lt;br /&gt;  UTL_FILE.PUTF(fileHandler, 'Look ma, I''m writing to a file!!!\n');&lt;br /&gt;  UTL_FILE.FCLOSE(fileHandler);&lt;br /&gt;EXCEPTION&lt;br /&gt;  WHEN utl_file.invalid_path THEN&lt;br /&gt;     raise_application_error(-20000, 'ERROR: Invalid path for file.');&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;Map an external file to a database view&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   fileview.sql&lt;br /&gt;rem Purpose:    Create a database view on top of a file&lt;br /&gt;rem Date:       27-Nov-2002&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;-- Utl_file_dir must be set to the directory you want to read from&lt;br /&gt;show parameter utl_file_dir&lt;br /&gt;&lt;br /&gt;-- Define the table's columns&lt;br /&gt;CREATE OR REPLACE TYPE Alert_Row_Type AS OBJECT ( &lt;br /&gt; line NUMBER(8), &lt;br /&gt; text VARCHAR2(2000) &lt;br /&gt;);&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Create a table of many row objects&lt;br /&gt;CREATE OR REPLACE TYPE Alert_Type IS TABLE OF Alert_Row_Type; &lt;br /&gt;/ &lt;br /&gt;&lt;br /&gt;-- Create a function to read the data into the table &lt;br /&gt;CREATE OR REPLACE FUNCTION Get_Alert &lt;br /&gt;RETURN Alert_Type &lt;br /&gt;IS &lt;br /&gt;  Alert_Tab Alert_Type := Alert_Type(Alert_Row_Type(NULL, NULL)); &lt;br /&gt;  v_file  Utl_File.File_Type; &lt;br /&gt;  v_line  NUMBER(10) := 1; &lt;br /&gt;  v_text  VARCHAR2(2000); &lt;br /&gt;  b_read  BOOLEAN    := TRUE; &lt;br /&gt;  b_first BOOLEAN    := TRUE; &lt;br /&gt;BEGIN &lt;br /&gt;  dbms_output.put_line('About to open file...');&lt;br /&gt;  v_file := Utl_File.FOpen('/app/oracle/admin/orcl/bdump', 'alert_orcl.log', 'r'); &lt;br /&gt;  WHILE b_read LOOP &lt;br /&gt;   BEGIN &lt;br /&gt;     Utl_File.Get_Line(v_file, v_text); &lt;br /&gt;     IF b_first THEN &lt;br /&gt;       b_first := FALSE; &lt;br /&gt;     ELSE &lt;br /&gt;       Alert_Tab.Extend; &lt;br /&gt;     END IF; &lt;br /&gt;&lt;br /&gt;     Alert_Tab(Alert_Tab.Last) := Alert_Row_Type(v_line, v_text); &lt;br /&gt;     v_line := v_line + 1; &lt;br /&gt;   EXCEPTION &lt;br /&gt;     WHEN NO_DATA_FOUND THEN &lt;br /&gt;       b_read := FALSE; &lt;br /&gt;   END; &lt;br /&gt; END LOOP; &lt;br /&gt; Utl_File.FClose(v_file);&lt;br /&gt; RETURN Alert_Tab; &lt;br /&gt;EXCEPTION &lt;br /&gt; WHEN utl_file.invalid_path       THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.invalid_path');&lt;br /&gt; WHEN utl_file.invalid_mode       THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.invalid_mode');&lt;br /&gt; WHEN utl_file.invalid_filehandle THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.invalid_filehandle');&lt;br /&gt; WHEN utl_file.invalid_operation  THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.invalid_operation');&lt;br /&gt; WHEN utl_file.read_error         THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.read_error');&lt;br /&gt; WHEN utl_file.write_error        THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.write_error');&lt;br /&gt; WHEN utl_file.internal_error     THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.internal_error');&lt;br /&gt; WHEN OTHERS                      THEN&lt;br /&gt;   RAISE_APPLICATION_ERROR(-20001, 'ERROR: utl_file.other_error');   &lt;br /&gt;END; &lt;br /&gt;/ &lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;-- Create a view to get the info from the function &lt;br /&gt;CREATE OR REPLACE FORCE VIEW alert_log_file AS &lt;br /&gt; SELECT LINE, TEXT &lt;br /&gt; FROM Table(Cast(Get_Alert() As Alert_Type))&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;-- Test it!!!&lt;br /&gt;set pages 50000&lt;br /&gt;select * from alert_log_file&lt;br /&gt;where  text like '%ORA-%'&lt;br /&gt;/&lt;br /&gt;•  Demonstrate Dynamic SQL&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   dynasql.sql&lt;br /&gt;rem Purpose:    Example PL/SQL code to demonstrate Dynamic SQL&lt;br /&gt;rem Date:       25-Feb-2003&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE CREATE_TABLE1 AS&lt;br /&gt;  sql_stmt varchar2(4000);&lt;br /&gt;BEGIN&lt;br /&gt;  EXECUTE IMMEDIATE 'CREATE TABLE x (a NUMBER)';&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE CREATE_TABLE2 AS&lt;br /&gt;  cur integer;&lt;br /&gt;  rc  integer;&lt;br /&gt;BEGIN&lt;br /&gt;  cur := DBMS_SQL.OPEN_CURSOR;&lt;br /&gt;  DBMS_SQL.PARSE(cur, 'CREATE TABLE X (Y DATE)', DBMS_SQL.NATIVE);&lt;br /&gt;  rc := DBMS_SQL.EXECUTE(cur);&lt;br /&gt;  DBMS_SQL.CLOSE_CURSOR(cur);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;SET SERVEROUTPUT ON&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE DEPARTMENTS(NO IN DEPT.DEPTNO%TYPE) AS&lt;br /&gt;  v_cursor integer;&lt;br /&gt;  v_dname  char(20);&lt;br /&gt;  v_rows   integer;&lt;br /&gt;BEGIN&lt;br /&gt;  v_cursor := DBMS_SQL.OPEN_CURSOR;&lt;br /&gt;  DBMS_SQL.PARSE(v_cursor, 'select dname from dept where deptno &gt; :x', DBMS_SQL.V7);&lt;br /&gt;  DBMS_SQL.BIND_VARIABLE(v_cursor, ':x', no);&lt;br /&gt;  DBMS_SQL.DEFINE_COLUMN_CHAR(v_cursor, 1, v_dname, 20);&lt;br /&gt;  v_rows := DBMS_SQL.EXECUTE(v_cursor);&lt;br /&gt;  loop&lt;br /&gt;    if DBMS_SQL.FETCH_ROWS(v_cursor) = 0 then&lt;br /&gt;       exit;&lt;br /&gt;    end if;&lt;br /&gt;    DBMS_SQL.COLUMN_VALUE_CHAR(v_cursor, 1, v_dname);&lt;br /&gt;    DBMS_OUTPUT.PUT_LINE('Deptartment name: '||v_dname);&lt;br /&gt;  end loop;&lt;br /&gt;  DBMS_SQL.CLOSE_CURSOR(v_cursor);&lt;br /&gt;EXCEPTION&lt;br /&gt;  when others then&lt;br /&gt;       DBMS_SQL.CLOSE_CURSOR(v_cursor);&lt;br /&gt;       raise_application_error(-20000, 'Unknown Exception Raised: '||sqlcode||' '||sqlerrm);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;•  Demonstrate Java stored procedures&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   java.sql&lt;br /&gt;rem Purpose:    Demonstrate Java stored procedures (available from Oracle 8i)&lt;br /&gt;rem Date:       13-Jun-2002&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;conn / as sysdba&lt;br /&gt;&lt;br /&gt;-- @?/javavm/install/initjvm.sql&lt;br /&gt;grant javauserpriv to scott;&lt;br /&gt;&lt;br /&gt;conn scott/tiger&lt;br /&gt;&lt;br /&gt;prompt Loading java source into database... &lt;br /&gt;&lt;br /&gt;create or replace java source named "Hello" as&lt;br /&gt;        public class Hello {                             /* Pure Java Code */&lt;br /&gt;                static public String Msg(String tail) {&lt;br /&gt;                        return "Hello " + tail;&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;/&lt;br /&gt;-- SHOW ERRORS not needed&lt;br /&gt;-- Note, you can also use "loadjava" to load source files into Oracle.&lt;br /&gt;&lt;br /&gt;prompt Publish Java to PL/SQL...&lt;br /&gt;&lt;br /&gt;create or replace function hello (str varchar2) return varchar as&lt;br /&gt;        language java name 'Hello.Msg(java.lang.String) return java.lang.String';&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;prompt Call Java function...&lt;br /&gt;&lt;br /&gt;select hello('Frank') from dual&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;•  Execute Operating System commands from PL/SQL (Java call)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename: oscmd.sql&lt;br /&gt;rem Purpose:  Execute operating system commands from PL/SQL&lt;br /&gt;rem Notes:    Specify full paths to commands, for example, &lt;br /&gt;rem           specify /usr/bin/ps instead of ps.&lt;br /&gt;rem Date:     09-Apr-2005&lt;br /&gt;rem Author:   Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Grant Java Access to user SCOTT&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;conn / as sysdba&lt;br /&gt;&lt;br /&gt;EXEC dbms_java.grant_permission('SCOTT', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');&lt;br /&gt;EXEC dbms_java.grant_permission('SCOTT', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');&lt;br /&gt;EXEC dbms_java.grant_permission('SCOTT', 'SYS:java.io.FilePermission', '/bin/sh', 'execute');&lt;br /&gt;-- Other read ,write or execute permission may be requried&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Create Java class to execute OS commands...&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;conn scott/tiger&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS&lt;br /&gt;import java.io.*;&lt;br /&gt;public class Host {&lt;br /&gt;  public static void executeCommand(String command) {&lt;br /&gt;    try {&lt;br /&gt;      String[] finalCommand;&lt;br /&gt;      if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1) {&lt;br /&gt;        finalCommand = new String[4];&lt;br /&gt;        finalCommand[0] = "C:\\winnt\\system32\\cmd.exe";&lt;br /&gt;        finalCommand[1] = "/y";&lt;br /&gt;        finalCommand[2] = "/c";&lt;br /&gt;        finalCommand[3] = command;&lt;br /&gt;      } else {      // Linux or Unix System&lt;br /&gt;        finalCommand = new String[3];&lt;br /&gt;        finalCommand[0] = "/bin/sh";&lt;br /&gt;        finalCommand[1] = "-c";&lt;br /&gt;        finalCommand[2] = command;&lt;br /&gt;      }&lt;br /&gt;  &lt;br /&gt;      // Execute the command...&lt;br /&gt;      final Process pr = Runtime.getRuntime().exec(finalCommand);&lt;br /&gt;&lt;br /&gt;      // Capture output from STDOUT...&lt;br /&gt;      BufferedReader br_in = null;&lt;br /&gt;      try {&lt;br /&gt;        br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));&lt;br /&gt;        String buff = null;&lt;br /&gt;        while ((buff = br_in.readLine()) != null) {&lt;br /&gt;          System.out.println("stdout: " + buff);&lt;br /&gt;          try {Thread.sleep(100); } catch(Exception e) {}&lt;br /&gt;        }&lt;br /&gt;        br_in.close();&lt;br /&gt;      } catch (IOException ioe) {&lt;br /&gt;        System.out.println("Error printing process output.");&lt;br /&gt;        ioe.printStackTrace();&lt;br /&gt;      } finally {&lt;br /&gt;        try {&lt;br /&gt;          br_in.close();&lt;br /&gt;        } catch (Exception ex) {}&lt;br /&gt;      }&lt;br /&gt;  &lt;br /&gt;      // Capture output from STDERR...&lt;br /&gt;      BufferedReader br_err = null;&lt;br /&gt;      try {&lt;br /&gt;        br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));&lt;br /&gt;        String buff = null;&lt;br /&gt;        while ((buff = br_err.readLine()) != null) {&lt;br /&gt;          System.out.println("stderr: " + buff);&lt;br /&gt;          try {Thread.sleep(100); } catch(Exception e) {}&lt;br /&gt;        }&lt;br /&gt;        br_err.close();&lt;br /&gt;      } catch (IOException ioe) {&lt;br /&gt;        System.out.println("Error printing execution errors.");&lt;br /&gt;        ioe.printStackTrace();&lt;br /&gt;      } finally {&lt;br /&gt;        try {&lt;br /&gt;          br_err.close();&lt;br /&gt;        } catch (Exception ex) {}&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex) {&lt;br /&gt;      System.out.println(ex.getLocalizedMessage());&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Publish the Java call to PL/SQL...&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE host (p_command IN VARCHAR2)&lt;br /&gt;   AS LANGUAGE JAVA&lt;br /&gt;   NAME 'Host.executeCommand (java.lang.String)';&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Let's test it...&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CALL DBMS_JAVA.SET_OUTPUT(1000000);&lt;br /&gt;SET SERVEROUTPUT ON SIZE 1000000&lt;br /&gt;exec host('/usr/bin/ls');&lt;br /&gt;&lt;br /&gt;FTP Client (GET and PUT files from PL/SQL)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   ftpclient.sql&lt;br /&gt;rem Purpose:    PL/SQL FTP Client&lt;br /&gt;rem Date:       19-Nov-2003&lt;br /&gt;rem Author:     Russ Johnson, Braun Consulting&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE BRNC_FTP_PKG&lt;br /&gt;AS&lt;br /&gt;    /**&lt;br /&gt;     *                                                                     &lt;br /&gt;     *  PL/SQL FTP Client                                                  &lt;br /&gt;     *      &lt;br /&gt;     *  Created by: Russ Johnson, Braun Consulting&lt;br /&gt;     *&lt;br /&gt;     *  www.braunconsult.com&lt;br /&gt;     *&lt;br /&gt;     *  OVERVIEW&lt;br /&gt;     *  --------------------&lt;br /&gt;     *  This package uses the standard packages UTL_FILE and UTL_TCP to perform&lt;br /&gt;     *  client-side FTP functionality (PUT and GET) for text files as defined in&lt;br /&gt;     *  the World Wide Web Consortium's RFC 959 document - http://www.w3.org/Protocols/rfc959/  &lt;br /&gt;     *  The procedures and functions in this package allow single or multiple file transfer using&lt;br /&gt;     *  standard TCP/IP connections.  &lt;br /&gt;     * &lt;br /&gt;     *  LIMITATIONS&lt;br /&gt;     *  --------------------&lt;br /&gt;     *  Currently the API is limited to transfer of ASCII text files only.  This is &lt;br /&gt;     *  primarily because UTL_FILE only supports text I/O, but also because the original&lt;br /&gt;     *  design was for creating text files from data in the Oracle database, then transferring the file to a remote host. &lt;br /&gt;     *  Furthermore, the API does not support SSH/Secure FTP or connection through a proxy server.&lt;br /&gt;     *  Keep in mind that FTP passes the username/password combo in plain text over TCP/IP.&lt;br /&gt;     *&lt;br /&gt;     *  DB versions - 8i (8.1.x) and above.  8.0.x may work if it has the SYS.UTL_TCP package. &lt;br /&gt;     *&lt;br /&gt;     *&lt;br /&gt;     *  Note: Since UTL_FILE is used for the client-side I/O, this package is also limited to&lt;br /&gt;     *        transfer of files that exist in directories available to UTL_FILE for read/write.&lt;br /&gt;     *        These directories are defined by the UTL_FILE_DIR parameter in the init.ora file.&lt;br /&gt;     *&lt;br /&gt;     *  USAGE&lt;br /&gt;     *  --------------------&lt;br /&gt;&lt;br /&gt;     *  Three functions are available for FTP - PUT, GET, and FTP_MULTIPLE.  FTP_MULTIPLE takes &lt;br /&gt;     *  a table of records that define the files to be transferred (filename, directory, etc.).&lt;br /&gt;     *  That table can have 1 record or multiple records.  The PUT and GET functions are included &lt;br /&gt;     *  for convenience to FTP one file at a time.  PUT and GET return true if the file is transferred&lt;br /&gt;     *  successfully and false if it fails.  FTP_MULTIPLE returns true if no batch-level errors occur&lt;br /&gt;     *  (such as an invalid host, refused connection, or invalid login information).  It also takes the&lt;br /&gt;     *  table of file records IN and passes it back OUT.  Each record contains individual error information.&lt;br /&gt;     * &lt;br /&gt;     *  EXAMPLE&lt;br /&gt;     *  --------------------&lt;br /&gt;     *  Transfer multiple files - 1 GET and 2 PUT from a Windows machine to a host (assuming UNIX here).&lt;br /&gt;     *  Display any errors that occur.&lt;br /&gt;     *  DECLARE&lt;br /&gt;     *&lt;br /&gt;     *      v_username              VARCHAR2(40)    := 'rjohnson';&lt;br /&gt;     *      v_password              VARCHAR2(40)    := 'password';&lt;br /&gt;     *      v_hostname              VARCHAR2(255)   := 'ftp.oracle.com';&lt;br /&gt;     *      v_error_message         VARCHAR2(1000);&lt;br /&gt;     *      b_put            BOOLEAN;&lt;br /&gt;     *      t_files                 BRNC_FTP_PKG.t_ftp_rec; -- Declare our table of file records&lt;br /&gt;     *&lt;br /&gt;     *  BEGIN&lt;br /&gt;     *&lt;br /&gt;     *      t_files(1).localpath     := 'd:\oracle\utl_file\outbound';&lt;br /&gt;     *      t_files(1).filename      := 'myfile1.txt';&lt;br /&gt;     *      t_files(1).remotepath    := '/home/oracle/text_files';&lt;br /&gt;     *      t_files(1).transfer_mode        := 'PUT';&lt;br /&gt;     *&lt;br /&gt;     *      t_files(2).localpath     := 'd:\oracle\utl_file\inbound';&lt;br /&gt;     *      t_files(2).filename      := 'incoming_file.xml';&lt;br /&gt;     *      t_files(2).remotepath    := '/home/oracle/xml_files';&lt;br /&gt;     *      t_files(2).transfer_mode       := 'GET';&lt;br /&gt;     *&lt;br /&gt;     *      t_files(3).localpath    := 'd:\oracle\utl_file\outbound';&lt;br /&gt;     *      t_files(3).filename     := 'myfile2.txt';&lt;br /&gt;     *      t_files(3).remotepath          := '/home';&lt;br /&gt;     *      t_files(3).transfer_mode       := 'PUT';&lt;br /&gt;     *&lt;br /&gt;     *      b_put := BRNC_FTP_PKG.FTP_MULTIPLE(v_error_message,&lt;br /&gt;     *                             t_files,&lt;br /&gt;     *                             v_username,&lt;br /&gt;     *                             v_password,&lt;br /&gt;     *                             v_hostname);&lt;br /&gt;     *      IF b_put = TRUE&lt;br /&gt;     *      THEN&lt;br /&gt;     *         FOR i IN t_files.FIRST..t_files.LAST&lt;br /&gt;     *         LOOP&lt;br /&gt;     *              IF t_files.EXISTS(i)&lt;br /&gt;     *              THEN&lt;br /&gt;     *              DBMS_OUTPUT.PUT_LINE(t_files(i).status||' | '||&lt;br /&gt;     *                             t_files(i).error_message||' | '||&lt;br /&gt;     *                             to_char(t_files(i).bytes_transmitted)||' | '||&lt;br /&gt;     *                             to_char(t_files(i).trans_start,'YYYY-MM-DD HH:MI:SS')||' | '||&lt;br /&gt;     *                             to_char(t_files(i).trans_end,'YYYY-MM-DD HH:MI:SS'));&lt;br /&gt;     *              END IF;&lt;br /&gt;     *         END LOOP;&lt;br /&gt;     *      ELSE&lt;br /&gt;     *    DBMS_OUTPUT.PUT_LINE(v_error_message);&lt;br /&gt;     *      END IF;&lt;br /&gt;     *&lt;br /&gt;     *  EXCEPTION&lt;br /&gt;     *  WHEN OTHERS&lt;br /&gt;     *  THEN&lt;br /&gt;     *      DBMS_OUTPUT.PUT_LINE(SQLERRM);&lt;br /&gt;     *  END;&lt;br /&gt;     *&lt;br /&gt;     *  CREDITS&lt;br /&gt;     *  --------------------&lt;br /&gt;     *  The W3C's RFC 959 that describes the FTP process.&lt;br /&gt;     *&lt;br /&gt;     *  http://www.w3c.org&lt;br /&gt;     *&lt;br /&gt;     *  Much of the PL/SQL code in this package was based on Java code written by&lt;br /&gt;     *  Bruce Blackshaw of Enterprise Distributed Technologies Ltd.  None of that code&lt;br /&gt;     *  was copied, but the objects and methods greatly helped my understanding of the&lt;br /&gt;     *  FTP Client process.&lt;br /&gt;     *&lt;br /&gt;     *  http://www.enterprisedt.com&lt;br /&gt;     *     &lt;br /&gt;     * VERSION HISTORY&lt;br /&gt;     *  --------------------  &lt;br /&gt;     *  1.0     11/19/2002     Unit-tested single and multiple transfers between disparate hosts.             &lt;br /&gt;     *&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Exceptions&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;   &lt;br /&gt;    ctrl_exception EXCEPTION;&lt;br /&gt;    data_exception EXCEPTION;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Constants - FTP valid response codes&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    CONNECT_CODE CONSTANT PLS_INTEGER := 220;&lt;br /&gt;    USER_CODE  CONSTANT PLS_INTEGER := 331;&lt;br /&gt;    LOGIN_CODE  CONSTANT PLS_INTEGER := 230;&lt;br /&gt;    PWD_CODE  CONSTANT PLS_INTEGER := 257;&lt;br /&gt;    PASV_CODE  CONSTANT PLS_INTEGER := 227;&lt;br /&gt;    CWD_CODE  CONSTANT PLS_INTEGER := 250;&lt;br /&gt;    TSFR_START_CODE1 CONSTANT PLS_INTEGER := 125;&lt;br /&gt;    TSFR_START_CODE2 CONSTANT PLS_INTEGER := 150;&lt;br /&gt;    TSFR_END_CODE CONSTANT PLS_INTEGER := 226;&lt;br /&gt;    QUIT_CODE  CONSTANT PLS_INTEGER := 221;&lt;br /&gt;    SYST_CODE  CONSTANT PLS_INTEGER := 215;&lt;br /&gt;    TYPE_CODE  CONSTANT PLS_INTEGER := 200;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * FTP File record datatype&lt;br /&gt;     *&lt;br /&gt;     * Elements:&lt;br /&gt;     * localpath - full directory name in which the local file resides or will reside&lt;br /&gt;     *           Windows: 'd:\oracle\utl_file'&lt;br /&gt;     *           UNIX: '/home/oracle/utl_file'&lt;br /&gt;     * filename - filename and extension for the file to be received or sent&lt;br /&gt;     *          changing the filename for the PUT or GET is currently not allowed&lt;br /&gt;     *          Examples: 'myfile.dat' 'myfile20021119.xml'&lt;br /&gt;     * remotepath - full directory name in which the local file will be sent or the &lt;br /&gt;     *            remote file exists.  Should be in UNIX format regardless of FTP server - '/one/two/three'&lt;br /&gt;     * filetype - reserved for future use, ignored in code&lt;br /&gt;     * transfer_mode - 'PUT' or 'GET'&lt;br /&gt;     * status - status of the transfer.  'ERROR' or 'SUCCESS'&lt;br /&gt;     * error_message - meaningful (hopefully) error message explaining the reason for failure&lt;br /&gt;     * bytes_transmitted - how many bytes were sent/received&lt;br /&gt;     * trans_start - date/time the transmission started&lt;br /&gt;     * trans_end - date/time the transmission ended&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    TYPE r_ftp_rec IS RECORD(localpath   VARCHAR2(255),&lt;br /&gt;        filename   VARCHAR2(255),&lt;br /&gt;        remotepath  VARCHAR2(255),&lt;br /&gt;        filetype   VARCHAR2(20),&lt;br /&gt;        transfer_mode  VARCHAR2(5),&lt;br /&gt;        status   VARCHAR2(40),&lt;br /&gt;        error_message  VARCHAR2(255),&lt;br /&gt;        bytes_transmitted  NUMBER,&lt;br /&gt;        trans_start DATE,&lt;br /&gt;        trans_end  DATE);&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * FTP File Table - used to store many files for transfer&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    TYPE t_ftp_rec IS TABLE of r_ftp_rec INDEX BY BINARY_INTEGER;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Internal convenience procedure for creating passive host IP address&lt;br /&gt;     * and port number.&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;  &lt;br /&gt;    PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,&lt;br /&gt;     p_pasv_host OUT VARCHAR2,&lt;br /&gt;     p_pasv_port OUT NUMBER);&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Function used to validate FTP server responses based on the &lt;br /&gt;     * code passed in p_code.  Reads single or multi-line responses.&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    FUNCTION VALIDATE_REPLY(p_ctrl_con  IN OUT UTL_TCP.CONNECTION,&lt;br /&gt;       p_code  IN PLS_INTEGER,&lt;br /&gt;       p_reply  OUT VARCHAR2)&lt;br /&gt;     RETURN BOOLEAN;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Function used to validate FTP server responses based on the &lt;br /&gt;     * code passed in p_code.  Reads single or multi-line responses.&lt;br /&gt;     * Overloaded because some responses can have 2 valid codes.&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    FUNCTION VALIDATE_REPLY(p_ctrl_con  IN OUT UTL_TCP.CONNECTION,&lt;br /&gt;       p_code1  IN PLS_INTEGER,&lt;br /&gt;       p_code2 IN PLS_INTEGER,&lt;br /&gt;       p_reply  OUT VARCHAR2)&lt;br /&gt; RETURN BOOLEAN;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Procedure that handles the actual data transfer.  Meant&lt;br /&gt;     * for internal package use.  Returns information about the&lt;br /&gt;     * actual transfer.&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,&lt;br /&gt;   p_localpath IN VARCHAR2,&lt;br /&gt;   p_filename IN VARCHAR2,&lt;br /&gt;   p_pasv_host IN VARCHAR2,&lt;br /&gt;   p_pasv_port IN PLS_INTEGER,&lt;br /&gt;   p_transfer_mode IN VARCHAR2,&lt;br /&gt;   v_status OUT VARCHAR2,&lt;br /&gt;   v_error_message OUT VARCHAR2,&lt;br /&gt;   n_bytes_transmitted OUT NUMBER,&lt;br /&gt;   d_trans_start OUT DATE,&lt;br /&gt;                        d_trans_end OUT DATE);&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Function to handle FTP of many files. &lt;br /&gt;     * Returns TRUE if no batch-level errors occur.&lt;br /&gt;     * Returns FALSE if a batch-level error occurs.&lt;br /&gt;     *&lt;br /&gt;     * Parameters:&lt;br /&gt;     *&lt;br /&gt;     * p_error_msg - error message for batch level errors&lt;br /&gt;     * p_files - BRNC_FTP_PKG.t_ftp_rec table type.  Accepts&lt;br /&gt;     *           list of files to be transferred (may be any combination of PUT or GET)&lt;br /&gt;     *           returns the table updated with transfer status, error message,&lt;br /&gt;     *           bytes_transmitted, transmission start date/time and transmission end&lt;br /&gt;     *           date/time&lt;br /&gt;     * p_username - username for FTP server&lt;br /&gt;     * p_password - password for FTP server&lt;br /&gt;     * p_hostname - hostname or IP address of server Ex: 'ftp.oracle.com' or '127.0.0.1'&lt;br /&gt;     * p_port - port number to connect on.  FTP is usually on 21, but this may be overridden&lt;br /&gt;     *          if the server is configured differently.&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,&lt;br /&gt;     p_files IN OUT t_ftp_rec,&lt;br /&gt;     p_username IN VARCHAR2,&lt;br /&gt;     p_password IN VARCHAR2,&lt;br /&gt;     p_hostname IN VARCHAR2,&lt;br /&gt;     p_port IN PLS_INTEGER DEFAULT 21)&lt;br /&gt;     RETURN BOOLEAN;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Convenience function for single-file PUT&lt;br /&gt;     *&lt;br /&gt;     * Parameters:&lt;br /&gt;     * p_localpath - full directory name in which the local file resides or will reside&lt;br /&gt;     *           Windows: 'd:\oracle\utl_file'&lt;br /&gt;     *           UNIX: '/home/oracle/utl_file'&lt;br /&gt;     * p_filename - filename and extension for the file to be received or sent&lt;br /&gt;     *          changing the filename for the PUT or GET is currently not allowed&lt;br /&gt;     *          Examples: 'myfile.dat' 'myfile20021119.xml'&lt;br /&gt;     * p_remotepath - full directory name in which the local file will be sent or the &lt;br /&gt;     *            remote file exists.  Should be in UNIX format regardless of FTP server - '/one/two/three'&lt;br /&gt;     * p_username - username for FTP server&lt;br /&gt;     * p_password - password for FTP server&lt;br /&gt;     * p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'&lt;br /&gt;     * v_status - status of the transfer.  'ERROR' or 'SUCCESS'&lt;br /&gt;     * v_error_message - meaningful (hopefully) error message explaining the reason for failure&lt;br /&gt;     * n_bytes_transmitted - how many bytes were sent/received&lt;br /&gt;     * d_trans_start - date/time the transmission started&lt;br /&gt;     * d_trans_end - date/time the transmission ended&lt;br /&gt;     * p_port - port number to connect to, default is 21&lt;br /&gt;     * p_filetype - always set to 'ASCII', reserved for future use, ignored in code&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    FUNCTION PUT(p_localpath IN VARCHAR2,&lt;br /&gt;  p_filename IN VARCHAR2,&lt;br /&gt;  p_remotepath IN VARCHAR2,&lt;br /&gt;  p_username IN VARCHAR2,&lt;br /&gt;  p_password IN VARCHAR2,&lt;br /&gt;  p_hostname IN VARCHAR2,&lt;br /&gt;  v_status OUT VARCHAR2,&lt;br /&gt;  v_error_message OUT VARCHAR2,&lt;br /&gt;  n_bytes_transmitted OUT NUMBER,&lt;br /&gt;  d_trans_start OUT DATE,&lt;br /&gt;                d_trans_end OUT DATE,&lt;br /&gt;  p_port    IN PLS_INTEGER DEFAULT 21,&lt;br /&gt;  p_filetype IN VARCHAR2 := 'ASCII')&lt;br /&gt;     RETURN BOOLEAN;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Convenience function for single-file GET&lt;br /&gt;     *&lt;br /&gt;     * Parameters:&lt;br /&gt;     * p_localpath - full directory name in which the local file resides or will reside&lt;br /&gt;     *           Windows: 'd:\oracle\utl_file'&lt;br /&gt;     *           UNIX: '/home/oracle/utl_file'&lt;br /&gt;     * p_filename - filename and extension for the file to be received or sent&lt;br /&gt;     *          changing the filename for the PUT or GET is currently not allowed&lt;br /&gt;     *          Examples: 'myfile.dat' 'myfile20021119.xml'&lt;br /&gt;     * p_remotepath - full directory name in which the local file will be sent or the &lt;br /&gt;     *            remote file exists.  Should be in UNIX format regardless of FTP server - '/one/two/three'&lt;br /&gt;     * p_username - username for FTP server&lt;br /&gt;     * p_password - password for FTP server&lt;br /&gt;     * p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'&lt;br /&gt;     * v_status - status of the transfer.  'ERROR' or 'SUCCESS'&lt;br /&gt;     * v_error_message - meaningful (hopefully) error message explaining the reason for failure&lt;br /&gt;     * n_bytes_transmitted - how many bytes were sent/received&lt;br /&gt;     * d_trans_start - date/time the transmission started&lt;br /&gt;     * d_trans_end - date/time the transmission ended&lt;br /&gt;     * p_port - port number to connect to, default is 21&lt;br /&gt;     * p_filetype - always set to 'ASCII', reserved for future use, ignored in code&lt;br /&gt;     *&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    FUNCTION GET(p_localpath IN VARCHAR2,&lt;br /&gt;  p_filename IN VARCHAR2,&lt;br /&gt;  p_remotepath IN VARCHAR2,&lt;br /&gt;  p_username IN VARCHAR2,&lt;br /&gt;  p_password IN VARCHAR2,&lt;br /&gt;  p_hostname IN VARCHAR2,&lt;br /&gt;  v_status OUT VARCHAR2,&lt;br /&gt;  v_error_message OUT VARCHAR2,&lt;br /&gt;  n_bytes_transmitted OUT NUMBER,&lt;br /&gt;  d_trans_start OUT DATE,&lt;br /&gt;                d_trans_end OUT DATE,&lt;br /&gt;  p_port    IN PLS_INTEGER DEFAULT 21,&lt;br /&gt;  p_filetype IN VARCHAR2 := 'ASCII')&lt;br /&gt;     RETURN BOOLEAN;&lt;br /&gt;&lt;br /&gt;END BRNC_FTP_PKG;&lt;br /&gt;/&lt;br /&gt;CREATE OR REPLACE PACKAGE BODY BRNC_FTP_PKG&lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;    /*****************************************************************************&lt;br /&gt;    **  Create the passive host IP and port number to connect to&lt;br /&gt;    **&lt;br /&gt;    *****************************************************************************/&lt;br /&gt;&lt;br /&gt;    PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,&lt;br /&gt;     p_pasv_host OUT VARCHAR2,&lt;br /&gt;     p_pasv_port OUT NUMBER)&lt;br /&gt;    IS&lt;br /&gt;&lt;br /&gt; v_pasv_cmd VARCHAR2(30) :=  p_pasv_cmd;  --Host and port to connect to for data transfer&lt;br /&gt;        n_port_dec NUMBER;&lt;br /&gt; n_port_add NUMBER;        &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    BEGIN&lt;br /&gt;&lt;br /&gt; p_pasv_host := REPLACE(SUBSTR(v_pasv_cmd,1,INSTR(v_pasv_cmd,',',1,4)-1),',','.');&lt;br /&gt;&lt;br /&gt; n_port_dec := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,4)+1,(INSTR(v_pasv_cmd,',',1,5)-(INSTR(v_pasv_cmd,',',1,4)+1))));&lt;br /&gt; n_port_add := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,5)+1,LENGTH(v_pasv_cmd)-INSTR(v_pasv_cmd,',',1,5)));&lt;br /&gt;&lt;br /&gt; p_pasv_port := (n_port_dec*256) + n_port_add;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    EXCEPTION&lt;br /&gt;    WHEN OTHERS&lt;br /&gt;    THEN&lt;br /&gt;     --DBMS_OUTPUT.PUT_LINE(SQLERRM);&lt;br /&gt; RAISE;&lt;br /&gt;&lt;br /&gt;    END CREATE_PASV;&lt;br /&gt;&lt;br /&gt;    /*****************************************************************************&lt;br /&gt;    **  Read a single or multi-line reply from the FTP server and validate&lt;br /&gt;    **  it against the code passed in p_code.&lt;br /&gt;    **&lt;br /&gt;    **  Return TRUE if reply code matches p_code, FALSE if it doesn't or error&lt;br /&gt;    **  occurs&lt;br /&gt;    **&lt;br /&gt;    **  Send full server response back to calling procedure&lt;br /&gt;    *****************************************************************************/&lt;br /&gt;   &lt;br /&gt;    FUNCTION VALIDATE_REPLY(p_ctrl_con  IN OUT UTL_TCP.CONNECTION,&lt;br /&gt;       p_code  IN PLS_INTEGER,&lt;br /&gt;       p_reply  OUT VARCHAR2)&lt;br /&gt;    RETURN BOOLEAN&lt;br /&gt;    IS&lt;br /&gt; n_code   VARCHAR2(3) := p_code;&lt;br /&gt; n_byte_count  PLS_INTEGER;&lt;br /&gt; v_msg  VARCHAR2(255);&lt;br /&gt; n_line_count PLS_INTEGER := 0;&lt;br /&gt;    BEGIN&lt;br /&gt; LOOP&lt;br /&gt;     v_msg := UTL_TCP.GET_LINE(p_ctrl_con);&lt;br /&gt;     n_line_count := n_line_count + 1;&lt;br /&gt;     IF n_line_count = 1&lt;br /&gt;     THEN&lt;br /&gt;  p_reply := v_msg;&lt;br /&gt;     ELSE&lt;br /&gt;  p_reply := p_reply || SUBSTR(v_msg,4);&lt;br /&gt;     END IF;&lt;br /&gt;     EXIT WHEN INSTR(v_msg,'-',1,1) &lt;&gt; 4;&lt;br /&gt; END LOOP;&lt;br /&gt;        IF to_number(SUBSTR(p_reply,1,3)) = n_code&lt;br /&gt; THEN&lt;br /&gt;     RETURN TRUE;&lt;br /&gt; ELSE&lt;br /&gt;     RETURN FALSE;&lt;br /&gt; END IF;&lt;br /&gt;    EXCEPTION&lt;br /&gt;    WHEN OTHERS&lt;br /&gt;    THEN&lt;br /&gt;        p_reply := SQLERRM;&lt;br /&gt;        RETURN FALSE;&lt;br /&gt;    END VALIDATE_REPLY;&lt;br /&gt;&lt;br /&gt;    /*****************************************************************************&lt;br /&gt;    **  Reads a single or multi-line reply from the FTP server&lt;br /&gt;    **&lt;br /&gt;    **  Return TRUE if reply code matches p_code1 or p_code2,&lt;br /&gt;    **  FALSE if it doesn't or error occurs&lt;br /&gt;    **&lt;br /&gt;    **  Send full server response back to calling procedure&lt;br /&gt;    *****************************************************************************/&lt;br /&gt;&lt;br /&gt;    FUNCTION VALIDATE_REPLY(p_ctrl_con  IN OUT UTL_TCP.CONNECTION,&lt;br /&gt;       p_code1  IN PLS_INTEGER,&lt;br /&gt;       p_code2 IN PLS_INTEGER,&lt;br /&gt;       p_reply  OUT VARCHAR2)&lt;br /&gt;    RETURN BOOLEAN&lt;br /&gt;    IS&lt;br /&gt; v_code1  VARCHAR2(3) := to_char(p_code1);&lt;br /&gt; v_code2  VARCHAR2(3) := to_char(p_code2);&lt;br /&gt; v_msg  VARCHAR2(255);&lt;br /&gt; n_line_count PLS_INTEGER := 0;&lt;br /&gt;    BEGIN&lt;br /&gt; LOOP&lt;br /&gt;     v_msg := UTL_TCP.GET_LINE(p_ctrl_con);&lt;br /&gt;     n_line_count := n_line_count + 1;&lt;br /&gt;     IF n_line_count = 1&lt;br /&gt;     THEN&lt;br /&gt;  p_reply := v_msg;&lt;br /&gt;     ELSE&lt;br /&gt;  p_reply := p_reply || SUBSTR(v_msg,4);&lt;br /&gt;     END IF;&lt;br /&gt;     EXIT WHEN INSTR(v_msg,'-',1,1) &lt;&gt; 4;&lt;br /&gt; END LOOP;&lt;br /&gt;        IF to_number(SUBSTR(p_reply,1,3)) IN(v_code1,v_code2)&lt;br /&gt; THEN&lt;br /&gt;     RETURN TRUE;&lt;br /&gt; ELSE&lt;br /&gt;     RETURN FALSE;&lt;br /&gt; END IF;&lt;br /&gt;    EXCEPTION&lt;br /&gt;    WHEN OTHERS&lt;br /&gt;    THEN&lt;br /&gt;        p_reply := SQLERRM;&lt;br /&gt;        RETURN FALSE;&lt;br /&gt;    END VALIDATE_REPLY;&lt;br /&gt;&lt;br /&gt;    /*****************************************************************************&lt;br /&gt;    **  Handles actual data transfer.  Responds with status, error message, and&lt;br /&gt;    **  transfer statistics.&lt;br /&gt;    **&lt;br /&gt;    **  Potential errors could be with connection or file i/o&lt;br /&gt;    **&lt;br /&gt;    *****************************************************************************/&lt;br /&gt;&lt;br /&gt;    PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,&lt;br /&gt;   p_localpath IN VARCHAR2,&lt;br /&gt;   p_filename IN VARCHAR2,&lt;br /&gt;   p_pasv_host IN VARCHAR2,&lt;br /&gt;   p_pasv_port IN PLS_INTEGER,&lt;br /&gt;   p_transfer_mode IN VARCHAR2,&lt;br /&gt;   v_status OUT VARCHAR2,&lt;br /&gt;   v_error_message OUT VARCHAR2,&lt;br /&gt;   n_bytes_transmitted OUT NUMBER,&lt;br /&gt;   d_trans_start OUT DATE,&lt;br /&gt;                        d_trans_end OUT DATE)&lt;br /&gt;    IS&lt;br /&gt; u_data_con  UTL_TCP.CONNECTION;&lt;br /&gt; u_filehandle  UTL_FILE.FILE_TYPE;&lt;br /&gt;        v_tsfr_mode  VARCHAR2(3) := p_transfer_mode;&lt;br /&gt; v_mode   VARCHAR2(1);&lt;br /&gt;        v_tsfr_cmd  VARCHAR2(10);&lt;br /&gt; v_buffer  VARCHAR2(32767);&lt;br /&gt; v_localpath  VARCHAR2(255)  := p_localpath;&lt;br /&gt; v_filename  VARCHAR2(255)  := p_filename;&lt;br /&gt; v_host   VARCHAR2(20)   := p_pasv_host;&lt;br /&gt; n_port   PLS_INTEGER  := p_pasv_port;&lt;br /&gt; n_bytes   NUMBER;&lt;br /&gt; v_msg   VARCHAR2(255);&lt;br /&gt; v_reply   VARCHAR2(1000);&lt;br /&gt; v_err_status  VARCHAR2(20) := 'ERROR';&lt;br /&gt; &lt;br /&gt;    BEGIN&lt;br /&gt;&lt;br /&gt; /** Initialize some of our OUT variables **/&lt;br /&gt;&lt;br /&gt; v_status  := 'SUCCESS';&lt;br /&gt; v_error_message  := ' ';&lt;br /&gt; n_bytes_transmitted := 0;&lt;br /&gt;&lt;br /&gt; IF UPPER(v_tsfr_mode) = 'PUT'&lt;br /&gt;        THEN&lt;br /&gt;     v_mode  := 'r';&lt;br /&gt;     v_tsfr_cmd  := 'STOR ';&lt;br /&gt;&lt;br /&gt; ELSIF UPPER(v_tsfr_mode) = 'GET'&lt;br /&gt; THEN&lt;br /&gt;     v_mode := 'w';&lt;br /&gt;     v_tsfr_cmd  := 'RETR ';&lt;br /&gt;        END IF;&lt;br /&gt;&lt;br /&gt; /** Open data connection on Passive host and port **/&lt;br /&gt;&lt;br /&gt; u_data_con := UTL_TCP.OPEN_CONNECTION(v_host,n_port);&lt;br /&gt;&lt;br /&gt; /** Open the local file to read and transfer data **/&lt;br /&gt;&lt;br /&gt; u_filehandle := UTL_FILE.FOPEN(v_localpath,v_filename,v_mode);&lt;br /&gt;&lt;br /&gt; /** Send the STOR command to tell the server we're going to upload a file **/&lt;br /&gt;&lt;br /&gt; n_bytes := UTL_TCP.WRITE_LINE(u_ctrl_con,v_tsfr_cmd||v_filename);&lt;br /&gt; IF VALIDATE_REPLY(u_ctrl_con,TSFR_START_CODE1,TSFR_START_CODE2,v_reply) = FALSE&lt;br /&gt; THEN&lt;br /&gt;     RAISE ctrl_exception;&lt;br /&gt; END IF;&lt;br /&gt;&lt;br /&gt; d_trans_start := SYSDATE;&lt;br /&gt;&lt;br /&gt; IF UPPER(v_tsfr_mode) = 'PUT'&lt;br /&gt; THEN&lt;br /&gt;     LOOP&lt;br /&gt;      BEGIN&lt;br /&gt;         UTL_FILE.GET_LINE(u_filehandle,v_buffer);&lt;br /&gt;          EXCEPTION&lt;br /&gt;          WHEN NO_DATA_FOUND&lt;br /&gt;          THEN&lt;br /&gt;          EXIT;&lt;br /&gt;      END;&lt;br /&gt;&lt;br /&gt;      n_bytes := UTL_TCP.WRITE_LINE(u_data_con,v_buffer);&lt;br /&gt;      n_bytes_transmitted := n_bytes_transmitted + n_bytes;&lt;br /&gt;&lt;br /&gt;         END LOOP;&lt;br /&gt;&lt;br /&gt; ELSIF UPPER(v_tsfr_mode) = 'GET'&lt;br /&gt; THEN&lt;br /&gt;     LOOP&lt;br /&gt;  BEGIN&lt;br /&gt;         v_buffer := UTL_TCP.GET_LINE(u_data_con,TRUE);&lt;br /&gt;&lt;br /&gt;      /** Sometimes the TCP/IP buffer sends null data **/&lt;br /&gt;                    /** we only want to receive the actual data **/&lt;br /&gt;&lt;br /&gt;      IF v_buffer IS NOT NULL&lt;br /&gt;      THEN&lt;br /&gt;          UTL_FILE.PUT_LINE(u_filehandle,v_buffer);&lt;br /&gt;              n_bytes := LENGTH(v_buffer);&lt;br /&gt;              n_bytes_transmitted := n_bytes_transmitted + n_bytes;&lt;br /&gt;      END IF;&lt;br /&gt;      &lt;br /&gt;     &lt;br /&gt;          EXCEPTION&lt;br /&gt;          WHEN UTL_TCP.END_OF_INPUT&lt;br /&gt;          THEN&lt;br /&gt;          EXIT;&lt;br /&gt;      END;&lt;br /&gt;&lt;br /&gt;         END LOOP;&lt;br /&gt;  &lt;br /&gt; END IF;&lt;br /&gt;&lt;br /&gt; /** Flush the buffer on the data connection **/&lt;br /&gt;&lt;br /&gt; --UTL_TCP.FLUSH(u_data_con);&lt;br /&gt;&lt;br /&gt; d_trans_end := SYSDATE;&lt;br /&gt;&lt;br /&gt; /** Close the file **/&lt;br /&gt;&lt;br /&gt; UTL_FILE.FCLOSE(u_filehandle);&lt;br /&gt;&lt;br /&gt; /** Close the Data Connection **/&lt;br /&gt;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;&lt;br /&gt; /** Verify the transfer succeeded **/&lt;br /&gt;&lt;br /&gt; IF VALIDATE_REPLY(u_ctrl_con,TSFR_END_CODE,v_reply) = FALSE&lt;br /&gt; THEN&lt;br /&gt;     RAISE ctrl_exception;&lt;br /&gt; END IF;&lt;br /&gt;&lt;br /&gt;    EXCEPTION&lt;br /&gt;    WHEN ctrl_exception&lt;br /&gt;    THEN&lt;br /&gt; v_status := v_err_status;&lt;br /&gt; v_error_message := v_reply;&lt;br /&gt; IF UTL_FILE.IS_OPEN(u_filehandle)&lt;br /&gt; THEN&lt;br /&gt;     UTL_FILE.FCLOSE(u_filehandle);&lt;br /&gt; END IF;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;&lt;br /&gt;    WHEN UTL_FILE.invalid_path&lt;br /&gt;    THEN&lt;br /&gt; v_status  := v_err_status;&lt;br /&gt; v_error_message := 'Directory '||v_localpath||' is not available to UTL_FILE.  Check the init.ora file for valid UTL_FILE directories.';&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;&lt;br /&gt;    WHEN UTL_FILE.invalid_operation&lt;br /&gt;    THEN&lt;br /&gt; v_status := v_err_status;&lt;br /&gt;&lt;br /&gt; IF UPPER(v_tsfr_mode) = 'PUT'&lt;br /&gt; THEN&lt;br /&gt;     v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for reading.';&lt;br /&gt;&lt;br /&gt; ELSIF UPPER(v_tsfr_mode) = 'GET'&lt;br /&gt; THEN&lt;br /&gt;     v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for writing.';&lt;br /&gt;&lt;br /&gt; END IF; &lt;br /&gt;&lt;br /&gt; IF UTL_FILE.IS_OPEN(u_filehandle)&lt;br /&gt; THEN&lt;br /&gt;     UTL_FILE.FCLOSE(u_filehandle);&lt;br /&gt; END IF;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;&lt;br /&gt;    WHEN UTL_FILE.read_error&lt;br /&gt;    THEN&lt;br /&gt; v_status := v_err_status;&lt;br /&gt; v_error_message := 'The system encountered an error while trying to read '||v_filename||' in the directory '||v_localpath;&lt;br /&gt;&lt;br /&gt; IF UTL_FILE.IS_OPEN(u_filehandle)&lt;br /&gt; THEN&lt;br /&gt;     UTL_FILE.FCLOSE(u_filehandle);&lt;br /&gt; END IF;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;&lt;br /&gt;    WHEN UTL_FILE.write_error&lt;br /&gt;    THEN&lt;br /&gt; v_status := v_err_status;&lt;br /&gt; v_error_message := 'The system encountered an error while trying to write to '||v_filename||' in the directory '||v_localpath;&lt;br /&gt;&lt;br /&gt; IF UTL_FILE.IS_OPEN(u_filehandle)&lt;br /&gt; THEN&lt;br /&gt;     UTL_FILE.FCLOSE(u_filehandle);&lt;br /&gt; END IF;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;&lt;br /&gt;    WHEN UTL_FILE.internal_error&lt;br /&gt;    THEN&lt;br /&gt; v_status := v_err_status;&lt;br /&gt; v_error_message := 'The UTL_FILE package encountered an unexpected internal system error.';&lt;br /&gt;&lt;br /&gt; IF UTL_FILE.IS_OPEN(u_filehandle)&lt;br /&gt; THEN&lt;br /&gt;     UTL_FILE.FCLOSE(u_filehandle);&lt;br /&gt; END IF;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;&lt;br /&gt;    WHEN OTHERS&lt;br /&gt;    THEN &lt;br /&gt; v_status := v_err_status;&lt;br /&gt; v_error_message := SQLERRM;&lt;br /&gt; IF UTL_FILE.IS_OPEN(u_filehandle)&lt;br /&gt; THEN&lt;br /&gt;     UTL_FILE.FCLOSE(u_filehandle);&lt;br /&gt; END IF;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_data_con);&lt;br /&gt;    END TRANSFER_ASCII;&lt;br /&gt;&lt;br /&gt;    /*****************************************************************************&lt;br /&gt;    **  Handles connection to host and FTP of multiple files&lt;br /&gt;    **  Files can be any combination of PUT and GET&lt;br /&gt;    **&lt;br /&gt;    *****************************************************************************/&lt;br /&gt;&lt;br /&gt;    FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,&lt;br /&gt;     p_files IN OUT t_ftp_rec,&lt;br /&gt;     p_username IN VARCHAR2,&lt;br /&gt;     p_password IN VARCHAR2,&lt;br /&gt;     p_hostname IN VARCHAR2,&lt;br /&gt;     p_port IN PLS_INTEGER DEFAULT 21)&lt;br /&gt;    RETURN BOOLEAN&lt;br /&gt;    IS&lt;br /&gt; v_username   VARCHAR2(30)  := p_username;&lt;br /&gt; v_password   VARCHAR2(30)  := p_password;&lt;br /&gt; v_hostname   VARCHAR2(30)  := p_hostname;&lt;br /&gt; n_port   PLS_INTEGER  := p_port;&lt;br /&gt; u_ctrl_con  UTL_TCP.CONNECTION;&lt;br /&gt; n_byte_count  PLS_INTEGER;&lt;br /&gt; n_first_index  NUMBER;&lt;br /&gt; v_msg   VARCHAR2(250);&lt;br /&gt; v_reply   VARCHAR2(1000);&lt;br /&gt;        v_pasv_host  VARCHAR2(20);&lt;br /&gt;        n_pasv_port  NUMBER;&lt;br /&gt;&lt;br /&gt; invalid_transfer EXCEPTION;&lt;br /&gt;    BEGIN&lt;br /&gt;&lt;br /&gt; p_error_msg := 'FTP Successful';  --Assume the overall transfer will succeed&lt;br /&gt;&lt;br /&gt; /** Attempt to connect to the host machine **/&lt;br /&gt;&lt;br /&gt; u_ctrl_con := UTL_TCP.OPEN_CONNECTION(v_hostname,n_port);&lt;br /&gt; IF VALIDATE_REPLY(u_ctrl_con,CONNECT_CODE,v_reply) = FALSE&lt;br /&gt; THEN&lt;br /&gt;     RAISE ctrl_exception;&lt;br /&gt; END IF;&lt;br /&gt;&lt;br /&gt; /** Send username **/&lt;br /&gt;&lt;br /&gt; n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'USER '||v_username);&lt;br /&gt; IF VALIDATE_REPLY(u_ctrl_con,USER_CODE,v_reply) = FALSE&lt;br /&gt; THEN&lt;br /&gt;     RAISE ctrl_exception;&lt;br /&gt; END IF;&lt;br /&gt;   &lt;br /&gt; /** Send password **/&lt;br /&gt;&lt;br /&gt; n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASS '||v_password);&lt;br /&gt; IF VALIDATE_REPLY(u_ctrl_con,LOGIN_CODE,v_reply) = FALSE&lt;br /&gt; THEN&lt;br /&gt;     RAISE ctrl_exception;&lt;br /&gt; END IF;&lt;br /&gt;&lt;br /&gt; /** We should be logged in, time to transfer all files **/&lt;br /&gt;&lt;br /&gt; FOR i IN p_files.FIRST..p_files.LAST&lt;br /&gt;        LOOP&lt;br /&gt;     IF p_files.EXISTS(i)&lt;br /&gt;     THEN&lt;br /&gt;  BEGIN&lt;br /&gt;&lt;br /&gt;      /** Change to the remotepath directory **/&lt;br /&gt;&lt;br /&gt;      n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'CWD '||p_files(i).remotepath);&lt;br /&gt;      IF VALIDATE_REPLY(u_ctrl_con,CWD_CODE,v_reply) = FALSE&lt;br /&gt;      THEN&lt;br /&gt;           RAISE ctrl_exception;&lt;br /&gt;      END IF;&lt;br /&gt;&lt;br /&gt;      /** Switch to IMAGE mode **/&lt;br /&gt;&lt;br /&gt;      n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'TYPE I');&lt;br /&gt;      IF VALIDATE_REPLY(u_ctrl_con,TYPE_CODE,v_reply) = FALSE&lt;br /&gt;      THEN&lt;br /&gt;           RAISE ctrl_exception;&lt;br /&gt;      END IF;&lt;br /&gt;&lt;br /&gt;      /** Get a Passive connection to use for data transfer **/&lt;br /&gt;      &lt;br /&gt;      n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASV');&lt;br /&gt;      IF VALIDATE_REPLY(u_ctrl_con,PASV_CODE,v_reply) = FALSE&lt;br /&gt;      THEN&lt;br /&gt;           RAISE ctrl_exception;&lt;br /&gt;      END IF;&lt;br /&gt;&lt;br /&gt;         CREATE_PASV(SUBSTR(v_reply,INSTR(v_reply,'(',1,1)+1,INSTR(v_reply,')',1,1)-INSTR(v_reply,'(',1,1)-1),v_pasv_host,n_pasv_port);&lt;br /&gt;&lt;br /&gt;      /** Transfer Data **/&lt;br /&gt;&lt;br /&gt;      IF UPPER(p_files(i).transfer_mode) = 'PUT'&lt;br /&gt;      THEN&lt;br /&gt;   TRANSFER_ASCII(u_ctrl_con,&lt;br /&gt;    p_files(i).localpath,&lt;br /&gt;    p_files(i).filename,&lt;br /&gt;    v_pasv_host,&lt;br /&gt;    n_pasv_port,&lt;br /&gt;    p_files(i).transfer_mode,&lt;br /&gt;    p_files(i).status,&lt;br /&gt;    p_files(i).error_message,&lt;br /&gt;    p_files(i).bytes_transmitted,&lt;br /&gt;    p_files(i).trans_start,&lt;br /&gt;                         p_files(i).trans_end);&lt;br /&gt;&lt;br /&gt;      ELSIF UPPER(p_files(i).transfer_mode) = 'GET'&lt;br /&gt;      THEN&lt;br /&gt;   TRANSFER_ASCII(u_ctrl_con,&lt;br /&gt;    p_files(i).localpath,&lt;br /&gt;    p_files(i).filename,&lt;br /&gt;    v_pasv_host,&lt;br /&gt;    n_pasv_port,&lt;br /&gt;    p_files(i).transfer_mode,&lt;br /&gt;    p_files(i).status,&lt;br /&gt;    p_files(i).error_message,&lt;br /&gt;    p_files(i).bytes_transmitted,&lt;br /&gt;    p_files(i).trans_start,&lt;br /&gt;                         p_files(i).trans_end);&lt;br /&gt;      ELSE&lt;br /&gt;   RAISE invalid_transfer; -- Raise an exception here&lt;br /&gt;      END IF;&lt;br /&gt;  &lt;br /&gt;  EXCEPTION&lt;br /&gt;  WHEN ctrl_exception&lt;br /&gt;  THEN&lt;br /&gt;      p_files(i).status := 'ERROR';&lt;br /&gt;      p_files(i).error_message := v_reply;&lt;br /&gt;&lt;br /&gt;  WHEN invalid_transfer&lt;br /&gt;  THEN&lt;br /&gt;      p_files(i).status := 'ERROR';&lt;br /&gt;      p_files(i).error_message := 'Invalid transfer method.  Use PUT or GET.';&lt;br /&gt;&lt;br /&gt;  END;&lt;br /&gt;     END IF;&lt;br /&gt; END LOOP;&lt;br /&gt;&lt;br /&gt; /** Send QUIT command **/&lt;br /&gt; n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'QUIT');&lt;br /&gt;&lt;br /&gt; /** Don't need to validate QUIT, just close the connection **/&lt;br /&gt;&lt;br /&gt; UTL_TCP.CLOSE_CONNECTION(u_ctrl_con); &lt;br /&gt; RETURN TRUE;&lt;br /&gt;&lt;br /&gt;    EXCEPTION&lt;br /&gt;    WHEN ctrl_exception&lt;br /&gt;    THEN&lt;br /&gt; p_error_msg := v_reply;&lt;br /&gt; UTL_TCP.CLOSE_ALL_CONNECTIONS;&lt;br /&gt; RETURN FALSE;&lt;br /&gt;    WHEN OTHERS&lt;br /&gt;    THEN&lt;br /&gt; p_error_msg := SQLERRM;&lt;br /&gt; UTL_TCP.CLOSE_ALL_CONNECTIONS;&lt;br /&gt; RETURN FALSE;&lt;br /&gt;    END FTP_MULTIPLE;&lt;br /&gt;&lt;br /&gt;    /*****************************************************************************&lt;br /&gt;    **  Convenience function for single-file PUT&lt;br /&gt;    **  Formats file information for FTP_MULTIPLE function and calls it.&lt;br /&gt;    **&lt;br /&gt;    *****************************************************************************/&lt;br /&gt;&lt;br /&gt;    FUNCTION PUT(p_localpath IN VARCHAR2,&lt;br /&gt;  p_filename IN VARCHAR2,&lt;br /&gt;  p_remotepath IN VARCHAR2,&lt;br /&gt;  p_username IN VARCHAR2,&lt;br /&gt;  p_password IN VARCHAR2,&lt;br /&gt;  p_hostname IN VARCHAR2,&lt;br /&gt;  v_status OUT VARCHAR2,&lt;br /&gt;  v_error_message OUT VARCHAR2,&lt;br /&gt;  n_bytes_transmitted OUT NUMBER,&lt;br /&gt;  d_trans_start OUT DATE,&lt;br /&gt;                d_trans_end OUT DATE,&lt;br /&gt;  p_port    IN PLS_INTEGER DEFAULT 21,&lt;br /&gt;  p_filetype IN VARCHAR2 := 'ASCII')&lt;br /&gt;    RETURN BOOLEAN&lt;br /&gt;    IS&lt;br /&gt; t_files  t_ftp_rec;&lt;br /&gt; v_username VARCHAR2(30)  := p_username;&lt;br /&gt; v_password VARCHAR2(50)  := p_password;&lt;br /&gt; v_hostname VARCHAR2(100)  := p_hostname;&lt;br /&gt; n_port  PLS_INTEGER  := p_port;&lt;br /&gt;        v_err_msg VARCHAR2(255);&lt;br /&gt; b_ftp  BOOLEAN;&lt;br /&gt;    BEGIN&lt;br /&gt; t_files(1).localpath  := p_localpath;&lt;br /&gt; t_files(1).filename    := p_filename;&lt;br /&gt; t_files(1).remotepath  := p_remotepath;&lt;br /&gt; t_files(1).filetype  := p_filetype;&lt;br /&gt; t_files(1).transfer_mode := 'PUT';&lt;br /&gt;&lt;br /&gt; b_ftp := FTP_MULTIPLE(v_err_msg,&lt;br /&gt;   t_files,&lt;br /&gt;   v_username,&lt;br /&gt;   v_password,&lt;br /&gt;   v_hostname,&lt;br /&gt;   n_port);&lt;br /&gt; IF b_ftp = FALSE&lt;br /&gt; THEN&lt;br /&gt;     v_status := 'ERROR';&lt;br /&gt;     v_error_message := v_err_msg;&lt;br /&gt;     RETURN FALSE;&lt;br /&gt; ELSIF b_ftp = TRUE&lt;br /&gt; THEN&lt;br /&gt;     v_status    := t_files(1).status;&lt;br /&gt;     v_error_message   := t_files(1).error_message;&lt;br /&gt;     n_bytes_transmitted  := t_files(1).bytes_transmitted;&lt;br /&gt;     d_trans_start   := t_files(1).trans_start;&lt;br /&gt;     d_trans_end   := t_files(1).trans_end;&lt;br /&gt;     RETURN TRUE;&lt;br /&gt; END IF;&lt;br /&gt;    EXCEPTION&lt;br /&gt;    WHEN OTHERS&lt;br /&gt;    THEN&lt;br /&gt; v_status  := 'ERROR';&lt;br /&gt; v_error_message := SQLERRM;&lt;br /&gt; RETURN FALSE;&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE(SQLERRM);&lt;br /&gt;    END PUT;&lt;br /&gt;&lt;br /&gt;    /*****************************************************************************&lt;br /&gt;    **  Convenience function for single-file GET&lt;br /&gt;    **  Formats file information for FTP_MULTIPLE function and calls it.&lt;br /&gt;    **&lt;br /&gt;    *****************************************************************************/&lt;br /&gt;&lt;br /&gt;    FUNCTION GET(p_localpath IN VARCHAR2,&lt;br /&gt;  p_filename IN VARCHAR2,&lt;br /&gt;  p_remotepath IN VARCHAR2,&lt;br /&gt;  p_username IN VARCHAR2,&lt;br /&gt;  p_password IN VARCHAR2,&lt;br /&gt;  p_hostname IN VARCHAR2,&lt;br /&gt;  v_status OUT VARCHAR2,&lt;br /&gt;  v_error_message OUT VARCHAR2,&lt;br /&gt;  n_bytes_transmitted OUT NUMBER,&lt;br /&gt;  d_trans_start OUT DATE,&lt;br /&gt;                d_trans_end OUT DATE,&lt;br /&gt;  p_port    IN PLS_INTEGER DEFAULT 21,&lt;br /&gt;  p_filetype IN VARCHAR2 := 'ASCII')&lt;br /&gt;    RETURN BOOLEAN&lt;br /&gt;    IS&lt;br /&gt; t_files  t_ftp_rec;&lt;br /&gt; v_username VARCHAR2(30)  := p_username;&lt;br /&gt; v_password VARCHAR2(50)  := p_password;&lt;br /&gt; v_hostname VARCHAR2(100)  := p_hostname;&lt;br /&gt; n_port  PLS_INTEGER  := p_port;&lt;br /&gt;        v_err_msg VARCHAR2(255);&lt;br /&gt; b_ftp  BOOLEAN;&lt;br /&gt;    BEGIN&lt;br /&gt; t_files(1).localpath  := p_localpath;&lt;br /&gt; t_files(1).filename    := p_filename;&lt;br /&gt; t_files(1).remotepath  := p_remotepath;&lt;br /&gt; t_files(1).filetype  := p_filetype;&lt;br /&gt; t_files(1).transfer_mode := 'GET';&lt;br /&gt;&lt;br /&gt; b_ftp := FTP_MULTIPLE(v_err_msg,&lt;br /&gt;   t_files,&lt;br /&gt;   v_username,&lt;br /&gt;   v_password,&lt;br /&gt;   v_hostname,&lt;br /&gt;   n_port);&lt;br /&gt; IF b_ftp = FALSE&lt;br /&gt; THEN&lt;br /&gt;     v_status := 'ERROR';&lt;br /&gt;     v_error_message := v_err_msg;&lt;br /&gt;     RETURN FALSE;&lt;br /&gt; ELSIF b_ftp = TRUE&lt;br /&gt; THEN&lt;br /&gt;     v_status   := t_files(1).status;&lt;br /&gt;     v_error_message  := t_files(1).error_message;&lt;br /&gt;     n_bytes_transmitted := t_files(1).bytes_transmitted;&lt;br /&gt;     d_trans_start  := t_files(1).trans_start;&lt;br /&gt;     d_trans_end  := t_files(1).trans_end;&lt;br /&gt;     RETURN TRUE;&lt;br /&gt; END IF;&lt;br /&gt;    EXCEPTION&lt;br /&gt;    WHEN OTHERS&lt;br /&gt;    THEN&lt;br /&gt; v_status  := 'ERROR';&lt;br /&gt; v_error_message := SQLERRM;&lt;br /&gt; RETURN FALSE;&lt;br /&gt; --DBMS_OUTPUT.PUT_LINE(SQLERRM);&lt;br /&gt;    END GET; &lt;br /&gt;&lt;br /&gt;END BRNC_FTP_PKG;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Send e-mail messages from PL/SQL&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   smtp.sql&lt;br /&gt;rem Purpose:    Send e-mail messages from PL/SQL&lt;br /&gt;rem Notes:      From Oracle8i release 8.1.6 one can send e-mail messages&lt;br /&gt;rem  directly from PL/SQL using either the UTL_TCP or UTL_SMTP &lt;br /&gt;rem  packages. JServer needs to be installed and configured. &lt;br /&gt;rem             Pont the IP Address to your local SMTP (Simple Mail&lt;br /&gt;rem             Transport) Server. No pipes or external procedures are&lt;br /&gt;rem             required. &lt;br /&gt;rem Date:       27-Mar-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE SEND_MAIL (&lt;br /&gt;  msg_from    varchar2 := 'oracle',&lt;br /&gt;  msg_to      varchar2,&lt;br /&gt;  msg_subject varchar2 := 'E-Mail message from your database',&lt;br /&gt;  msg_text    varchar2 := '' )&lt;br /&gt;IS&lt;br /&gt;  c  utl_tcp.connection;&lt;br /&gt;  rc integer;&lt;br /&gt;BEGIN&lt;br /&gt;  c := utl_tcp.open_connection('127.0.0.1', 25);       -- open the SMTP port 25 on local machine&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'HELO localhost');&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'MAIL FROM: '||msg_from);&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'RCPT TO: '||msg_to);&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'DATA');                 -- Start message body&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Subject: '||msg_subject);&lt;br /&gt;  rc := utl_tcp.write_line(c, '');&lt;br /&gt;  rc := utl_tcp.write_line(c, msg_text);&lt;br /&gt;  rc := utl_tcp.write_line(c, '.');                    -- End of message body&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'QUIT');&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  utl_tcp.close_connection(c);                         -- Close the connection&lt;br /&gt;EXCEPTION&lt;br /&gt;  when others then&lt;br /&gt;       raise_application_error(&lt;br /&gt;           -20000, 'Unable to send e-mail message from pl/sql because of: '||&lt;br /&gt;           sqlerrm);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;--  Examples:&lt;br /&gt;set serveroutput on&lt;br /&gt;&lt;br /&gt;exec send_mail(msg_to  =&gt;'you@yourdomain.com');&lt;br /&gt;&lt;br /&gt;exec send_mail(msg_to  =&gt;'you@yourdomain.com',  -&lt;br /&gt;        msg_text=&gt;'Look Ma, I can send mail from plsql' -&lt;br /&gt;              );&lt;br /&gt;•  Send e-mail messages from PL/SQL with MIME attachments&lt;br /&gt;&lt;br /&gt;rem ----------------------------------------------------------------------&lt;br /&gt;rem Filename:   smtp-att.sql&lt;br /&gt;rem Purpose:    Send e-mail messages and attachments from PL/SQL&lt;br /&gt;rem Notes:      From Oracle8i release 8.1.6 one can send e-mail messages&lt;br /&gt;rem             directly from PL/SQL using either the UTL_TCP or UTL_SMTP&lt;br /&gt;rem             packages. Jserver needs to be installed and configured.&lt;br /&gt;rem             No pipes or external procedures required.&lt;br /&gt;rem Date:       15-MAR-2001&lt;br /&gt;rem Author:     Virgilio Nunes (Virgilio@logtek.co.za)&lt;br /&gt;rem ----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE SEND_MAIL (&lt;br /&gt;  msg_from    varchar2 := 'EMAILADDRESS@DOMAIN.COM',    ----- MAIL BOX SENDING THE EMAIL&lt;br /&gt;  msg_to      varchar2 := 'EMAILADDRESS@DOMAIN.COM',    ----- MAIL BOX RECIEVING THE EMAIL&lt;br /&gt;  msg_subject varchar2 := 'Output file TEST1',          ----- EMAIL SUBJECT&lt;br /&gt;  msg_text    varchar2 := 'THIS IS THE TEXT OF THE EMAIL MESSAGE.',&lt;br /&gt;  v_output1   varchar2 := 'THIS IS THE TEXT OF THE ATTACHMENT FILE. THIS TEXT SHOULD BE IN A TEXT FILE ATTACHED TO THE EMAIL.')&lt;br /&gt;IS&lt;br /&gt;  c  utl_tcp.connection;&lt;br /&gt;  rc integer;&lt;br /&gt;  crlf VARCHAR2(2):= CHR(13)||CHR(10);&lt;br /&gt;  mesg VARCHAR2( 32767 );&lt;br /&gt;BEGIN&lt;br /&gt;  c := utl_tcp.open_connection('196.35.140.18', 25);       ----- OPEN SMTP PORT CONNECTION&lt;br /&gt;  rc := utl_tcp.write_line(c, 'HELO 196.35.140.18');       ----- PERFORMS HANDSHAKING WITH SMTP SERVER&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'EHLO 196.35.140.18');       ----- PERFORMS HANDSHAKING WITH SMTP SERVER, INCLUDING EXTRA INFORMATION&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'MAIL FROM: '||msg_from);    ----- MAIL BOX SENDING THE EMAIL&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'RCPT TO: '||msg_to);        ----- MAIL BOX RECIEVING THE EMAIL&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'DATA');                     ----- EMAIL MESSAGE BODY START&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Date: '||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'From: '||msg_from||' &lt;'||msg_from||'&gt;');&lt;br /&gt;  rc := utl_tcp.write_line(c, 'MIME-Version: 1.0');&lt;br /&gt;  rc := utl_tcp.write_line(c, 'To: '||msg_to||' &lt;'||msg_to||'&gt;');&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Subject: '||msg_subject);&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Content-Type: multipart/mixed;');     ----- INDICATES THAT THE BODY CONSISTS OF MORE THAN ONE PART&lt;br /&gt;  rc := utl_tcp.write_line(c, ' boundary="-----SECBOUND"');          ----- SEPERATOR USED TO SEPERATE THE BODY PARTS&lt;br /&gt;  rc := utl_tcp.write_line(c, '');                                   ----- INSERTS A BLANK LINE. PART OF THE MIME FORMAT AND NONE OF THEM SHOULD BE REMOVED.&lt;br /&gt;  rc := utl_tcp.write_line(c, '-------SECBOUND');&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Content-Type: text/plain');           ----- 1ST BODY PART. EMAIL TEXT MESSAGE&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Content-Transfer-Encoding: 7bit');&lt;br /&gt;  rc := utl_tcp.write_line(c, '');&lt;br /&gt;  rc := utl_tcp.write_line(c, msg_text);                             ----- TEXT OF EMAIL MESSAGE&lt;br /&gt;  rc := utl_tcp.write_line(c, '');&lt;br /&gt;  rc := utl_tcp.write_line(c, '-------SECBOUND');&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Content-Type: text/plain;');          ----- 2ND BODY PART.&lt;br /&gt;  rc := utl_tcp.write_line(c, ' name="Test.txt"');&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Content-Transfer_Encoding: 8bit');&lt;br /&gt;  rc := utl_tcp.write_line(c, 'Content-Disposition: attachment;');   ----- INDICATES THAT THIS IS AN ATTACHMENT&lt;br /&gt;  rc := utl_tcp.write_line(c, ' filename="Test.txt"');               ----- SUGGESTED FILE NAME FOR ATTACHMENT&lt;br /&gt;  rc := utl_tcp.write_line(c, '');&lt;br /&gt;  rc := utl_tcp.write_line(c, v_output1);&lt;br /&gt;  rc := utl_tcp.write_line(c, '-------SECBOUND--');&lt;br /&gt;  rc := utl_tcp.write_line(c, '');&lt;br /&gt;  rc := utl_tcp.write_line(c, '.');                    ----- EMAIL MESSAGE BODY END&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  rc := utl_tcp.write_line(c, 'QUIT');                 ----- ENDS EMAIL TRANSACTION&lt;br /&gt;  dbms_output.put_line(utl_tcp.get_line(c, TRUE));&lt;br /&gt;  utl_tcp.close_connection(c);                         ----- CLOSE SMTP PORT CONNECTION&lt;br /&gt;EXCEPTION&lt;br /&gt;  when others then&lt;br /&gt;       raise_application_error(-20000, SQLERRM);&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Mailmerge: Merge data from the table/view data sources into a custom template&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:  mailmerge.sql&lt;br /&gt;rem Purpose:   Merge data from the table/view data sources into a custom &lt;br /&gt;rem            template.&lt;br /&gt;rem Date:      30 Dec 2004&lt;br /&gt;rem Author:    Claudiu Ariton  (aritonc@yahoo.com)&lt;br /&gt;rem&lt;br /&gt;rem Package detail: &lt;br /&gt;rem    TEMP_MAIL_MERGE - temporary table to store the result &lt;br /&gt;rem    DATA_SOURCES - data sources table &lt;br /&gt;rem    mail_merge procedure - Merge data from list of values into template &lt;br /&gt;rem    generic_mail_merge - Merge data from a table/view into template &lt;br /&gt;rem&lt;br /&gt;rem To define a template use $n where n is the position of a field in &lt;br /&gt;rem data_sources_v view (escape character is $). &lt;br /&gt;rem&lt;br /&gt;rem E.G.: $2 $3 born on $4 has to pay $$$5. Call us at $6.&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/***************************  Create result temp table, test table and context *************************/&lt;br /&gt;&lt;br /&gt;create  GLOBAL TEMPORARY table TEMP_MAIL_MERGE&lt;br /&gt;(&lt;br /&gt;  PKID                               NUMBER         ,&lt;br /&gt;  RESULT                             VARCHAR2(4000) )&lt;br /&gt;On Commit Delete Rows&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;create table data_sources&lt;br /&gt;(ID        Number(10) primary key,&lt;br /&gt; P2        Varchar2(10),&lt;br /&gt; P3        Varchar2(50),&lt;br /&gt; P4        DATE,&lt;br /&gt; P5        NUMBER&lt;br /&gt;)&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Insert into DATA_SOURCES&lt;br /&gt;(ID, P2, P3, P4, P5)&lt;br /&gt;Values&lt;br /&gt;(1, 'Claudiu', 'Ariton', TO_DATE('09/21/1976 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100000)&lt;br /&gt;/&lt;br /&gt;Commit&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;create or replace context mm_ctx using mail_merge&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;create or replace view data_sources_v as&lt;br /&gt;select ID PKID, P2, P3, P4, P5,&lt;br /&gt;SYS_CONTEXT('mm_ctx','param1',2000) param1 from&lt;br /&gt;data_sources&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/***************************  Create package head  *************************/&lt;br /&gt;&lt;br /&gt;Create or Replace Package mail_merge as&lt;br /&gt;&lt;br /&gt;/**************************************************************************************&lt;br /&gt;*&lt;br /&gt;* TITLE......: Mail Merge &lt;br /&gt;* DESCRIPTION: Merge data from the data source into a custom template  &lt;br /&gt;*   &lt;br /&gt;* AUTHOR.....: Claudiu Ariton&lt;br /&gt;* DATE.......: april 2004 &lt;br /&gt;*&lt;br /&gt;* Modifications&lt;br /&gt;*&lt;br /&gt;**************************************************************************************/&lt;br /&gt;&lt;br /&gt;  type Argv is table of varchar2(4000) index by binary_integer;&lt;br /&gt;  emptyargv argv;&lt;br /&gt;&lt;br /&gt;  procedure set_ctx( p_name in varchar2, p_value in varchar2,p_ctx in varchar2 default 'mm_ctx'  );&lt;br /&gt;&lt;br /&gt;  function mail_merge(&lt;br /&gt;  p_message       in varchar2,&lt;br /&gt;  p_argv          in argv ,&lt;br /&gt;  p_esc_char      in varchar2 default '$') return varchar2;&lt;br /&gt;  &lt;br /&gt;  Procedure generic_mail_merge(p_ttext varchar2, p_query in varchar2,&lt;br /&gt;  p_date_format in varchar2 default 'dd-MON-yyyy hh24:mi:ss',&lt;br /&gt;p_bindid in number default null,p_list_val in argv default emptyargv);&lt;br /&gt;  &lt;br /&gt;end mail_merge;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;/***************************  Create package body  *************************/&lt;br /&gt;&lt;br /&gt;Create or Replace Package Body mail_merge as&lt;br /&gt;&lt;br /&gt;-- -----------------------------------------------------------------------------------&lt;br /&gt;-- Set_ctx - set generic context&lt;br /&gt;-- -----------------------------------------------------------------------------------&lt;br /&gt;procedure set_ctx( p_name in varchar2, p_value in varchar2,p_ctx in varchar2 default 'mm_ctx'  )&lt;br /&gt;as&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt; dbms_session.set_context( p_ctx, p_name, p_value, USER);&lt;br /&gt;end;&lt;br /&gt;&lt;br /&gt;-- -----------------------------------------------------------------------------------&lt;br /&gt;-- mail_merge - Merge data from list of vaalues into a custom template&lt;br /&gt;-- -----------------------------------------------------------------------------------&lt;br /&gt;function mail_merge(&lt;br /&gt;  p_message       in varchar2,&lt;br /&gt;  p_argv          in argv ,&lt;br /&gt;  p_esc_char      in varchar2 default '$') return varchar2 is&lt;br /&gt;--&lt;br /&gt;  l_message long := null;&lt;br /&gt;  l_str long := p_message;&lt;br /&gt;  l_idx number := 1;&lt;br /&gt;  l_ptr number := 1;&lt;br /&gt;  l_poz varchar2(10);&lt;br /&gt;  l_on number;&lt;br /&gt;begin&lt;br /&gt;  if nvl( instr( p_message, p_esc_char ), 0 ) = 0 and&lt;br /&gt;     nvl( instr( p_message, '\' ), 0 ) = 0 then&lt;br /&gt;    return p_message;&lt;br /&gt;  end if;&lt;br /&gt;  loop&lt;br /&gt;&lt;br /&gt;    l_on:=0;&lt;br /&gt;    l_ptr := instr( l_str, p_esc_char );&lt;br /&gt;    exit when l_ptr = 0 or l_ptr is null;&lt;br /&gt;    l_message := l_message || substr( l_str, 1, l_ptr-1 );&lt;br /&gt;    l_str :=  substr( l_str, l_ptr+1 );&lt;br /&gt;&lt;br /&gt;     l_poz:=null;&lt;br /&gt;     while substr( l_str, 1, 1 ) in ('0','1','2','3','4','5','6','7','8','9') loop&lt;br /&gt;      l_poz:=l_poz||substr( l_str, 1, 1 );&lt;br /&gt;      l_str := substr( l_str, 2 );&lt;br /&gt;      l_on:=1;&lt;br /&gt;     end loop;&lt;br /&gt;&lt;br /&gt;     begin&lt;br /&gt;      l_message := l_message || p_argv(to_number(l_poz));&lt;br /&gt;     exception&lt;br /&gt;      when no_data_found then l_message := l_message || '&lt;unknown&gt;';&lt;br /&gt;      when others then null;&lt;br /&gt;     end;&lt;br /&gt;&lt;br /&gt;    if (substr( l_str,1,1 ) = p_esc_char) and (l_on=0) then&lt;br /&gt;      l_message := l_message || p_esc_char;&lt;br /&gt;      l_str := substr( l_str, 2 );&lt;br /&gt;    end if;&lt;br /&gt;&lt;br /&gt;  end loop;&lt;br /&gt;&lt;br /&gt;  l_str := l_message || l_str;&lt;br /&gt;  l_message := null;&lt;br /&gt;  loop&lt;br /&gt;    l_ptr := instr( l_str, '\' );&lt;br /&gt;    exit when l_ptr = 0 or l_ptr is null;&lt;br /&gt;    l_message := l_message || substr( l_str, 1, l_ptr-1 );&lt;br /&gt;    l_str :=  substr( l_str, l_ptr+1 );&lt;br /&gt;    if substr( l_str, 1, 1 ) = 'n' then&lt;br /&gt;      l_message := l_message || chr(10);&lt;br /&gt;      l_str := substr( l_str, 2 );&lt;br /&gt;    elsif substr( l_str, 1, 1 ) = 't' then&lt;br /&gt;      l_message := l_message || chr(9);&lt;br /&gt;      l_str := substr( l_str, 2 );&lt;br /&gt;    elsif substr( l_str, 1, 1 ) = '\' then&lt;br /&gt;      l_message := l_message || '\';&lt;br /&gt;      l_str := substr( l_str, 2 );&lt;br /&gt;    else&lt;br /&gt;      l_message := l_message || '\';&lt;br /&gt;    end if;&lt;br /&gt;  end loop;&lt;br /&gt;&lt;br /&gt;  return l_message || l_str;&lt;br /&gt;end mail_merge;&lt;br /&gt;&lt;br /&gt;-- -----------------------------------------------------------------------------------&lt;br /&gt;-- mail_merge - Merge data from a table/viiew into a custom template&lt;br /&gt;-- -----------------------------------------------------------------------------------&lt;br /&gt;Procedure generic_mail_merge(p_ttext varchar2, p_query in varchar2,&lt;br /&gt;p_date_format in varchar2 default 'dd-MON-yyyy hh24:mi:ss',&lt;br /&gt;p_bindid in number default null,p_list_val in argv default emptyargv)&lt;br /&gt;is&lt;br /&gt;    l_theCursor     integer default dbms_sql.open_cursor;&lt;br /&gt;    l_defcolumn     varchar2(4000);&lt;br /&gt;    l_columnValue   argv;&lt;br /&gt;    l_status        integer;&lt;br /&gt;    l_descTbl       dbms_sql.desc_tab;&lt;br /&gt;    l_colCnt        number;&lt;br /&gt;    v_result        varchar2(4000);&lt;br /&gt;    v_pkid          number;&lt;br /&gt;begin&lt;br /&gt;    execute immediate&lt;br /&gt;    'alter session set&lt;br /&gt;        nls_date_format='''|| p_date_format ||'''';&lt;br /&gt;&lt;br /&gt;    dbms_sql.parse(  l_theCursor, p_query, dbms_sql.native );&lt;br /&gt;&lt;br /&gt;    if p_bindid is not null then&lt;br /&gt;     dbms_sql.bind_variable( l_theCursor, ':1', p_bindid );&lt;br /&gt;    end if;&lt;br /&gt;&lt;br /&gt;    dbms_sql.describe_columns&lt;br /&gt;    ( l_theCursor, l_colCnt, l_descTbl );&lt;br /&gt;&lt;br /&gt;    -- seteaza context&lt;br /&gt;    begin&lt;br /&gt;     for i in 1..p_list_val.count loop&lt;br /&gt;      set_ctx('param'||to_char(i),p_list_val(i));&lt;br /&gt;     end loop;&lt;br /&gt;    exception&lt;br /&gt;     when others then null;&lt;br /&gt;    end;&lt;br /&gt;&lt;br /&gt;    for i in 1 .. l_colCnt loop&lt;br /&gt;        dbms_sql.define_column&lt;br /&gt;        (l_theCursor, i, l_defcolumn, 4000);&lt;br /&gt;    end loop;&lt;br /&gt;&lt;br /&gt;    l_status := dbms_sql.execute(l_theCursor);&lt;br /&gt;&lt;br /&gt;    while ( dbms_sql.fetch_rows(l_theCursor) &gt; 0 ) loop&lt;br /&gt;        for i in 1 .. l_colCnt loop&lt;br /&gt;            dbms_sql.column_value&lt;br /&gt;            ( l_theCursor, i, l_columnValue(i) );&lt;br /&gt;            if upper(l_descTbl(i).col_name)='PKID' then&lt;br /&gt;             v_pkid:=to_number(l_columnValue(i));&lt;br /&gt;            end if;&lt;br /&gt;        end loop;&lt;br /&gt;&lt;br /&gt;        v_result:=mail_merge( p_ttext,l_columnValue);&lt;br /&gt;        insert into TEMP_MAIL_MERGE(pkid,result) values (v_pkid,v_result);&lt;br /&gt;    end loop;&lt;br /&gt;    dbms_sql.close_cursor(  l_theCursor);&lt;br /&gt;    execute immediate&lt;br /&gt;        'alter session set nls_date_format=''dd-MON-rr'' ';&lt;br /&gt;exception&lt;br /&gt;    when others then&lt;br /&gt;      if dbms_sql.is_open(l_theCursor) then&lt;br /&gt;      dbms_sql.close_cursor(  l_theCursor);&lt;br /&gt;      end if;&lt;br /&gt;      execute immediate&lt;br /&gt;          'alter session set nls_date_format=''dd-MON-rr'' ';&lt;br /&gt;      raise;&lt;br /&gt;end;&lt;br /&gt;&lt;br /&gt;end mail_merge;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;/***************************  Test it  *************************/&lt;br /&gt;declare&lt;br /&gt; v_list_val mail_merge.argv;&lt;br /&gt; v_query varchar2(4000);&lt;br /&gt;begin&lt;br /&gt; v_list_val(1):='(040)-2313543';&lt;br /&gt; v_query:= 'select * from data_sources_v vt where 1=1'||' AND vt.pkid=:1';&lt;br /&gt; mail_merge.generic_mail_merge('$2 $3 born on $4 has to pay $$$5. Call us at $6. Thank you very much.',&lt;br /&gt;  v_query,'dd-MON-yyyy',1,v_list_val);&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;select * from temp_mail_merge&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;•  Read an Internet Web pages from PL/SQL&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   httpget.sql&lt;br /&gt;rem Purpose:    Access Internet Web pages from SQL or PL/SQL&lt;br /&gt;rem Notes:      From Oracle 8.0 one can retrieve web pages directly&lt;br /&gt;rem  from SQL or PL/SQL. Note you need to run utlhttp.sql as &lt;br /&gt;rem  SYS before this procedure will work.&lt;br /&gt;rem Date:       27-Mar-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set pages 50000&lt;br /&gt;&lt;br /&gt;select utl_http.request('http://www.orafaq.net/') from dual;&lt;br /&gt;&lt;br /&gt;Track DLL changes (create, drop, alter) within a schema&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   auditdll.sql&lt;br /&gt;rem Purpose:    Maintain an audit log of DDL changes (alter/ drop/ create)&lt;br /&gt;rem             within a schema&lt;br /&gt;rem Date:       15-Feb-2002&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;DROP TRIGGER audit_ddl_changes&lt;br /&gt;/&lt;br /&gt;DROP TABLE   dll_audit_log&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;CREATE TABLE dll_audit_log (&lt;br /&gt;   stamp     DATE,&lt;br /&gt;   username  VARCHAR2(30),&lt;br /&gt;   osuser    VARCHAR2(30),&lt;br /&gt;   machine   VARCHAR2(30),&lt;br /&gt;   terminal  VARCHAR2(30),&lt;br /&gt;   operation VARCHAR2(30),&lt;br /&gt;   objtype   VARCHAR2(30),&lt;br /&gt;   objname   VARCHAR2(30))&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE TRIGGER audit_ddl_changes&lt;br /&gt;   AFTER create OR drop OR alter&lt;br /&gt;      ON scott.SCHEMA  -- Change SCOTT to your schema name!!!&lt;br /&gt;      -- ON DATABASE&lt;br /&gt;BEGIN&lt;br /&gt;  INSERT INTO dll_audit_log VALUES&lt;br /&gt;        (SYSDATE,&lt;br /&gt;         SYS_CONTEXT('USERENV', 'SESSION_USER'),&lt;br /&gt;         SYS_CONTEXT('USERENV', 'OS_USER'),&lt;br /&gt;         SYS_CONTEXT('USERENV', 'HOST'),&lt;br /&gt;         SYS_CONTEXT('USERENV', 'TERMINAL'),&lt;br /&gt;         ORA_SYSEVENT,&lt;br /&gt;         ORA_DICT_OBJ_TYPE,&lt;br /&gt;         ORA_DICT_OBJ_NAME&lt;br /&gt;        );&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- Now, let's test it&lt;br /&gt;CREATE TABLE my_test_table (col1 DATE)&lt;br /&gt;/&lt;br /&gt;DROP TABLE my_test_table&lt;br /&gt;/&lt;br /&gt;set pages 50000&lt;br /&gt;SELECT * FROM dll_audit_log&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Count the number of rows in ALL tables for the current schema&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   countall.sql&lt;br /&gt;rem Purpose:    Count the number of rows for ALL tables in current schema&lt;br /&gt;rem             using PL/SQL&lt;br /&gt;rem Date:       15-Apr-2000&lt;br /&gt;rem Author:     Eberhardt, Roberto (Bolton) (reberhar@husky.ca)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set serveroutput on size 1000000&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;  t_c1_tname      user_tables.table_name%TYPE;&lt;br /&gt;  t_command       varchar2(200);&lt;br /&gt;  t_cid           integer;&lt;br /&gt;  t_total_records number(10);&lt;br /&gt;  stat            integer;&lt;br /&gt;  row_count       integer;&lt;br /&gt;  t_limit         integer := 0;    -- Only show tables with more rows&lt;br /&gt;  cursor c1 is select table_name from user_tables order by table_name;&lt;br /&gt;BEGIN&lt;br /&gt;  t_limit := 0;&lt;br /&gt;  open c1;&lt;br /&gt;  loop&lt;br /&gt;        fetch c1 into t_c1_tname;&lt;br /&gt;        exit when c1%NOTFOUND;&lt;br /&gt;        t_command := 'SELECT COUNT(0) FROM '||t_c1_tname;&lt;br /&gt;        t_cid := DBMS_SQL.OPEN_CURSOR;&lt;br /&gt;        DBMS_SQL.PARSE(t_cid,t_command,dbms_sql.native);&lt;br /&gt;        DBMS_SQL.DEFINE_COLUMN(t_cid,1,t_total_records);&lt;br /&gt;        stat := DBMS_SQL.EXECUTE(t_cid);&lt;br /&gt;        row_count := DBMS_SQL.FETCH_ROWS(t_cid);&lt;br /&gt;        DBMS_SQL.COLUMN_VALUE(t_cid,1,t_total_records);&lt;br /&gt;        if t_total_records &gt; t_limit then&lt;br /&gt;                DBMS_OUTPUT.PUT_LINE(rpad(t_c1_tname,55,' ')||&lt;br /&gt;                        to_char(t_total_records,'99999999')||' record(s)');&lt;br /&gt;&lt;br /&gt;        end if;&lt;br /&gt;        DBMS_SQL.CLOSE_CURSOR(t_cid);&lt;br /&gt;  end loop;&lt;br /&gt;  close c1;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;List tables from schema with more than X rows&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   countall2.sql&lt;br /&gt;rem Purpose:    List tables from schema with more than X rows&lt;br /&gt;rem Date:       15-Sep-2005&lt;br /&gt;rem Author:     Praveen Kumar Chugh&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;REM First of all create the following function - rowcount...&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION rowcount(tname VARCHAR2) RETURN NUMBER IS&lt;br /&gt;        x    NUMBER;&lt;br /&gt;        stmt VARCHAR2(200);&lt;br /&gt;BEGIN&lt;br /&gt;        stmt := 'select count(*) from '||tname;&lt;br /&gt;        execute immediate stmt into x;&lt;br /&gt;        return x;&lt;br /&gt;EXCEPTION &lt;br /&gt; WHEN NO_DATA_FOUND THEN&lt;br /&gt;         RETURN 0;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;SHOW ERRORS&lt;br /&gt;&lt;br /&gt;REM Then write this query...&lt;br /&gt;&lt;br /&gt;SELECT table_name, roucount(table_name) Records &lt;br /&gt;FROM   cat &lt;br /&gt;WHERE  roucount(table_name) &gt;= 100;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Replace all occurences of a substring with another substring&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   strreplace.sql&lt;br /&gt;rem Purpose:    Replace all occurences of a substring with another substring&lt;br /&gt;rem Date:       28-Jul-2003&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;create or replace function strreplace(str varchar2, from_str varchar2, to_str varchar2)&lt;br /&gt;  return varchar2&lt;br /&gt;AS&lt;br /&gt;  str_temp varchar2(4000);&lt;br /&gt;  str_pos� number := instr(str, from_str);&lt;br /&gt;BEGIN&lt;br /&gt;  str_temp := str;&lt;br /&gt;  while ( str_pos &gt; 0 ) loop&lt;br /&gt;    str_temp := substr(str_temp, 0, str_pos-1) || to_str ||&lt;br /&gt;                substr(str_temp, str_pos + length(from_str));&lt;br /&gt;    str_pos� := instr(str_temp, from_str);&lt;br /&gt;  end loop;&lt;br /&gt;  return str_temp;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- Examples&lt;br /&gt;&lt;br /&gt;select strreplace('This is a beautiful day!', 'beautiful', 'horrible')&lt;br /&gt;from dual&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;select 'mv '||name||' '||strreplace(name, 'OLDSID', 'NEWSID')&lt;br /&gt;from   v$datafile&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Spell out numbers to words (handy for cheque printing)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   cheqprint.sql&lt;br /&gt;rem Purpose:    This function will convert a number to words, handy for &lt;br /&gt;rem             ptinting  cheques. &lt;br /&gt;rem Notes:      The number before the decimal should be between 1..5373484&lt;br /&gt;rem Date:       24-Feb-2003&lt;br /&gt;rem Author:     Sebastian Thomas, sebastianthomas@rediffmail.com&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION NUMBER_CONVERSION(NUM NUMBER) RETURN VARCHAR2&lt;br /&gt;IS&lt;br /&gt;  A VARCHAR2(1000);&lt;br /&gt;  B VARCHAR2(20);&lt;br /&gt;  X NUMBER;&lt;br /&gt;  Y NUMBER := 1;&lt;br /&gt;  Z NUMBER;&lt;br /&gt;  LSIGN NUMBER;&lt;br /&gt;  NO NUMBER;&lt;br /&gt;BEGIN&lt;br /&gt;  X:= INSTR(NUM, '.');&lt;br /&gt;  LSIGN := SIGN(NUM);&lt;br /&gt;  NO := ABS(NUM); &lt;br /&gt;  IF X = 0 THEN &lt;br /&gt;     SELECT  TO_CHAR(TO_DATE(NO, 'J'), 'JSP')  INTO A FROM DUAL;&lt;br /&gt;  ELSE&lt;br /&gt;     SELECT  to_char(to_date(SUBSTR(NO, 1,&lt;br /&gt;       NVL(INSTR(NO, '.')-1, LENGTH(NO))),&lt;br /&gt;        'J'), 'JSP') INTO A FROM DUAL;&lt;br /&gt;     SELECT LENGTH(SUBSTR(NO, INSTR(NO, '.')+1)) INTO Z FROM DUAL;&lt;br /&gt;     A := A ||' POINT ';&lt;br /&gt;     WHILE Y&lt; Z+1 LOOP&lt;br /&gt;  SELECT TO_CHAR(TO_DATE(SUBSTR(NO, (INSTR(NO, '.')+Y), 1), 'J'), 'JSP')&lt;br /&gt;        INTO B FROM DUAL;&lt;br /&gt;  A := A || B ||' ';&lt;br /&gt;  y :=y+1;&lt;br /&gt;     END LOOP;&lt;br /&gt;  END IF;&lt;br /&gt;  IF LSIGN = -1 THEN&lt;br /&gt;     RETURN 'NEGATIVE '||A;&lt;br /&gt;  ELSE&lt;br /&gt;     RETURN A;&lt;br /&gt;  END IF;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;-- Examples:&lt;br /&gt;Select number_conversion(-3786.9899876) from dual;&lt;br /&gt;Select number_conversion(7685.78788) from dual;&lt;br /&gt;Select number_conversion(7678) from dual;&lt;br /&gt;&lt;br /&gt;Print cheque amounts in Indian Style&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   indicheq.sql&lt;br /&gt;rem Purpose:    This procedure will convert numbers to chars for printing&lt;br /&gt;rem             cheques amount in Indian Style. It will print amount from&lt;br /&gt;rem             Rs1 to Rs.989999999.&lt;br /&gt;rem Note:       In order to see your output in SQL*Plus, set serverout on&lt;br /&gt;rem Date:       22-Feb-2003&lt;br /&gt;rem Author:     Birender Kumar, bir_canada@yahoo.com&lt;br /&gt;rem Updateded:  04-Aug-2003&lt;br /&gt;rem Updated By: marine, marine00072003@yahoo.com&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;SET SERVEROUTPUT ON;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE PROCEDURE cheq(n NUMBER)&lt;br /&gt;as&lt;br /&gt;  L       NUMBER := 0;&lt;br /&gt;  OUTPUT  VARCHAR2(2000) := '';&lt;br /&gt;  X       VARCHAR2(2000) := '';&lt;br /&gt;  X1      VARCHAR2(2000) := '';&lt;br /&gt;  C1      VARCHAR2(2000) := '';&lt;br /&gt;BEGIN&lt;br /&gt;   L := length(N);&lt;br /&gt;&lt;br /&gt;   IF N &lt; 0 OR N &gt; 999999999 THEN&lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('INVALID AMOUNT');&lt;br /&gt;   else&lt;br /&gt;&lt;br /&gt;      if ( N = 0 ) THEN&lt;br /&gt;         X := 'ZERO ';&lt;br /&gt;      elsif ( N  &lt;= 99999 ) THEN&lt;br /&gt;         X := to_char(to_date(N,'J'),'JSP') || ' ';&lt;br /&gt;      else&lt;br /&gt;        &lt;br /&gt;         if ( to_number(substr(N, L - 5 + 1)) = 0 ) then&lt;br /&gt;            X := '';&lt;br /&gt;         else&lt;br /&gt;            X := to_char(to_date(to_number(substr(N, L - 5 + 1)),'J'),'JSP') || ' ';&lt;br /&gt;         end if;&lt;br /&gt;&lt;br /&gt;         if ( L = 6 ) then&lt;br /&gt;            X1 := to_char(to_date(to_number(substr(N, 1, L - 5)),'J'),'JSP') || ' LAKH ';&lt;br /&gt;         else&lt;br /&gt;            if ( to_number(substr(N, L - 5 -1, 2)) = 0 ) then&lt;br /&gt;               X1 := '';&lt;br /&gt;            else&lt;br /&gt;               X1 := to_char(to_date(to_number(substr(N, L - 5 - 1, 2)),'J'),'JSP') || ' LAKH ';&lt;br /&gt;            end if;&lt;br /&gt;&lt;br /&gt;            if ( L &gt;= 8 ) then&lt;br /&gt;               C1 := to_char(to_date(to_number(substr(N, 1, L-7)),'J'),'JSP')||' CRORE ';&lt;br /&gt;            end if;&lt;br /&gt;         end if;&lt;br /&gt;      end if;&lt;br /&gt;&lt;br /&gt;      if ( N = 0 OR N = 1 ) THEN&lt;br /&gt;         DBMS_OUTPUT.PUT_LINE(N||' =&gt; '||X||'RUPEE ONLY');&lt;br /&gt;      else&lt;br /&gt;         DBMS_OUTPUT.PUT_LINE(N||' =&gt; '||C1||X1||X||'RUPEES ONLY');&lt;br /&gt;      end if;&lt;br /&gt;   end if;&lt;br /&gt;END CHEQ;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;NYSIIS function (an improvement on SoundeX)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   nysiis.pls&lt;br /&gt;rem Purpose: NYSIIS function (an improvement on soundex)&lt;br /&gt;rem Notes:      Convert a name to a phonetic coding of up to six characters&lt;br /&gt;rem Date:       19-Jul-2004&lt;br /&gt;rem Author:     Trevor Fairhurst, trevgf@yahoo.com&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION NYSIIS (v_text IN VARCHAR2) RETURN VARCHAR2 is&lt;br /&gt;&lt;br /&gt;    v_sub      varchar2(300);&lt;br /&gt;    v_length   number(10);&lt;br /&gt;    v_textin   varchar2(300);&lt;br /&gt;    v_key      varchar2(1);&lt;br /&gt;&lt;br /&gt;   begin&lt;br /&gt;    SELECT UPPER ( v_text ) into v_textin from dual;&lt;br /&gt;    dbms_output.put_line( 'Entered surname :' || v_textin);&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( ' [1] remove all S and Z chars from the end of the surname ' );&lt;br /&gt;    LOOP&lt;br /&gt;      SELECT SUBSTR ( v_textin , (length (v_textin))) into v_sub from dual;&lt;br /&gt;      dbms_output.put_line('Last letter :' || v_sub);&lt;br /&gt;      if v_sub = 'S' OR v_sub = 'Z' THEN&lt;br /&gt;        SELECT SUBSTR ( v_textin , 1 , (length (v_textin) -1 )) into v_textin from dual ;&lt;br /&gt;        dbms_output.put_line('As last letter s or z drop last letter giving :' || v_textin || ' and check new last letter');&lt;br /&gt;      else&lt;br /&gt;        dbms_output.put_line('Last letter not s or z completed step 1');&lt;br /&gt;        EXIT;&lt;br /&gt;      end if;&lt;br /&gt;    END LOOP;&lt;br /&gt;    dbms_output.put_line('Step 1 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( ' [2] transcode initial strings MAC =&gt; MC and PF =&gt; F and PH =&gt; F ' );&lt;br /&gt;    if SUBSTR ( v_textin , 1 , 3 ) = 'MAC' THEN&lt;br /&gt;      SELECT 'MC' || SUBSTR ( v_textin , 4 ) into v_textin from dual ; &lt;br /&gt;    elsif SUBSTR ( v_textin , 1 , 2 ) = 'PH' THEN&lt;br /&gt;      SELECT 'F' || SUBSTR ( v_textin , 3 ) into v_textin from dual ;&lt;br /&gt;    elsif SUBSTR ( v_textin , 1 , 2 ) = 'PF' THEN&lt;br /&gt;      SELECT 'F' || SUBSTR ( v_textin , 3 ) into v_textin from dual ;&lt;br /&gt;    end if;&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line('Step 2 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( ' [3] transcode trailing strings IX =&gt; IC and EX =&gt; EC and YE,EE,IE =&gt; Y and NT,ND =&gt; D ' );&lt;br /&gt;    SELECT SUBSTR ( v_textin , (length (v_textin) - 1)) into v_sub from dual;&lt;br /&gt;    dbms_output.put_line('Last 2 letters :' || v_sub);&lt;br /&gt;    if UPPER(v_sub) in ('IX','EX','YE','EE','IE','NT','ND') THEN&lt;br /&gt;      SELECT decode ( UPPER(v_sub) , 'IX','IC',&lt;br /&gt;                              'EX','EC',&lt;br /&gt;                              'YE','Y',&lt;br /&gt;                              'EE','Y',&lt;br /&gt;                              'IE','Y',&lt;br /&gt;                              'NT','D',&lt;br /&gt;                              'ND','D', NULL  ) into v_sub from dual ;&lt;br /&gt;      SELECT SUBSTR ( v_textin , 1, (length (v_textin) - 1)) || v_sub into v_textin from dual ;&lt;br /&gt;    end if;&lt;br /&gt;    dbms_output.put_line('Step 3 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[4] transcode EV to EF if not at start of name');&lt;br /&gt;    SELECT SUBSTR(v_textin, 1 , 1) || REPLACE( SUBSTR(v_textin, 2),'EV','EF') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 4 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[5] first character of name as first character of key continue with remaining characters');&lt;br /&gt;    SELECT SUBSTR ( v_textin , 1 , 1) into v_key from dual;&lt;br /&gt;    SELECT SUBSTR ( v_textin , 2 ) into v_textin from dual;&lt;br /&gt;    dbms_output.put_line('Step 5 completed first character of key :' || v_key );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[6] replace all vowels with A');&lt;br /&gt;    SELECT TRANSLATE( v_textin,'AEIOU','AAAAA') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 6 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[7] remove any W that follows a vowel');&lt;br /&gt;    SELECT REPLACE( v_textin,'AW','A') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 7 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[8] transcode GHT to GT ');&lt;br /&gt;    SELECT REPLACE( v_textin,'GHT','GT') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 8 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[9] transcode DG to G   ');&lt;br /&gt;    SELECT REPLACE( v_textin,'DG','G') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 9 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[10] transcode PH to F   ');&lt;br /&gt;    SELECT REPLACE( v_textin,'PH','F') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 10 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[11] if not first character, eliminate all H preceded or followed by a vowel ');&lt;br /&gt;    if length(v_textin) &gt; 1 THEN&lt;br /&gt;      SELECT SUBSTR(v_textin, 1 , 1) || REPLACE( SUBSTR(v_textin, 2),'HA','A') into v_textin from dual ;&lt;br /&gt;      SELECT SUBSTR(v_textin, 1 , 1) || REPLACE( SUBSTR(v_textin, 2),'AH','A') into v_textin from dual ;&lt;br /&gt;    end if;&lt;br /&gt;    dbms_output.put_line('Step 11 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[12] change KN to N, else K to C  ');&lt;br /&gt;    SELECT REPLACE( v_textin,'KN','N') into v_textin from dual ;&lt;br /&gt;    SELECT TRANSLATE( v_textin,'K','C') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line( 'Step 12 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[13] transcode M to N if not at start of name');&lt;br /&gt;    SELECT SUBSTR(v_textin, 1 , 1) || REPLACE( SUBSTR(v_textin, 2),'M','N') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 13 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[14] transcode Q to G if not at start of name');&lt;br /&gt;    SELECT SUBSTR(v_textin, 1 , 1) || REPLACE( SUBSTR(v_textin, 2),'Q','G') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 14 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[15] transcode transcode SH to S ');&lt;br /&gt;    SELECT REPLACE( v_textin,'SH','S') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 15 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[16] transcode transcode SCH to S ');&lt;br /&gt;    SELECT REPLACE( v_textin,'SCH','S') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 16 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[17] transcode transcode YW to Y ');&lt;br /&gt;    SELECT REPLACE( v_textin,'YW','Y') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 17 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[18] if not first or last character, change Y to A');&lt;br /&gt;    if length(v_textin) &gt; 2 THEN&lt;br /&gt;      SELECT SUBSTR(v_textin, 1 , 1) || REPLACE( SUBSTR(v_textin, 2, length(v_textin) - 2),'Y','A') || SUBSTR ( v_textin , (length (v_textin))) into v_textin from dual ;&lt;br /&gt;    end if;&lt;br /&gt;    dbms_output.put_line('Step 18 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[19] transcode transcode WR to R ');&lt;br /&gt;    SELECT REPLACE( v_textin,'WR','R') into v_textin from dual ;&lt;br /&gt;    dbms_output.put_line('Step 19 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[20] if not first character, change Z to S ');&lt;br /&gt;    if length(v_textin) &gt; 1 THEN&lt;br /&gt;      SELECT SUBSTR(v_textin, 1 , 1) || REPLACE( SUBSTR(v_textin, 2),'Z','S') into v_textin from dual ;&lt;br /&gt;    end if;&lt;br /&gt;    dbms_output.put_line('Step 20 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[21] transcode terminal AY to Y');&lt;br /&gt;    if length(v_textin) &gt; 1 THEN&lt;br /&gt;      SELECT SUBSTR ( v_textin , (length (v_textin) - 1)) into v_sub from dual;&lt;br /&gt;      if v_sub = 'AY' THEN&lt;br /&gt;        SELECT SUBSTR(v_textin, 1 , length(v_textin) - 2 ) || 'Y' into v_textin from dual ;&lt;br /&gt;      end if;&lt;br /&gt;    end if;&lt;br /&gt;    dbms_output.put_line('Step 21 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[22] remove trailing vowels');&lt;br /&gt;    LOOP&lt;br /&gt;      SELECT SUBSTR ( v_textin , (length (v_textin))) into v_sub from dual;&lt;br /&gt;      dbms_output.put_line('Last letter :' || v_sub);&lt;br /&gt;      if v_sub = 'A' THEN&lt;br /&gt;        SELECT SUBSTR ( v_textin , 1 , (length (v_textin) -1 )) into v_textin from dual ;&lt;br /&gt;        dbms_output.put_line('As last letter A drop last letter giving :' || v_textin || ' and check new last letter');&lt;br /&gt;      else&lt;br /&gt;        dbms_output.put_line('Last letter not A step 22 completed');&lt;br /&gt;        EXIT;&lt;br /&gt;      end if;&lt;br /&gt;    END LOOP;&lt;br /&gt;    dbms_output.put_line('Step 22 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line( '[23] collapse all strings of repeated characters');&lt;br /&gt;    if length(v_textin) &gt; 2 THEN&lt;br /&gt;      LOOP&lt;br /&gt;        SELECT v_textin into v_sub from dual;&lt;br /&gt;        SELECT REPLACE( v_textin,'AA','A') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'BB','B') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'CC','C') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'DD','D') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'FF','F') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'GG','G') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'HH','H') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'JJ','J') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'LL','L') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'NN','N') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'PP','P') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'RR','R') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'SS','S') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'TT','T') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'VV','V') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'WW','W') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'XX','X') into v_textin from dual ;&lt;br /&gt;        SELECT REPLACE( v_textin,'ZZ','Z') into v_textin from dual ;&lt;br /&gt;        dbms_output.put_line( v_textin );&lt;br /&gt;      if v_sub = v_textin OR v_sub is NULL THEN&lt;br /&gt;        EXIT;&lt;br /&gt;      end if;&lt;br /&gt;    END LOOP;&lt;br /&gt;    end if;&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line('Step 23 completed giving :' || v_textin );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    dbms_output.put_line('[24] put back in first letter and return' );&lt;br /&gt;    SELECT v_key || v_textin into v_textin from dual;&lt;br /&gt;&lt;br /&gt;    RETURN( v_textin );&lt;br /&gt;&lt;br /&gt;end NYSIIS;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;Converts a string of text into seperate soundex values&lt;br /&gt;rem --------------------------------------------------------------------------&lt;br /&gt;rem Filename: M_SOUNDEX.SQL&lt;br /&gt;rem Purpose:  Converts a string of text into seperate soundex values. Treating &lt;br /&gt;rem           it as space deliminated words. Useful when searching text strings for a sounds like.&lt;br /&gt;rem            &lt;br /&gt;rem Notes:    USEAGE "select M_SOUNDEX('the cat sat on the mat') from dual;"&lt;br /&gt;rem M_SOUNDEX('THECATSATONTHEMAT')&lt;br /&gt;rem -----------------------------------&lt;br /&gt;rem  T000 C300 S300 O500 T000 M300&lt;br /&gt;rem &lt;br /&gt;rem &lt;br /&gt;rem select M_SOUNDEX('the cat sat on the mat') from dual where&lt;br /&gt;rem M_SOUNDEX('the cat sat on the mat') like ('%' || SOUNDEX('cot') || '%');&lt;br /&gt;rem &lt;br /&gt;rem Date:     01-Mar-2005&lt;br /&gt;rem Author:   Trevor Fairhurst, trevgf@yahoo.com&lt;br /&gt;rem --------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE  FUNCTION "M_SOUNDEX" (v_text IN VARCHAR2) RETURN VARCHAR2 is&lt;br /&gt;    v_number   number(10);&lt;br /&gt;    v_textin   varchar2(4000);&lt;br /&gt;    v_textout   varchar2(4000);&lt;br /&gt;begin&lt;br /&gt;    SELECT UPPER (TRIM( v_text )) into v_textin from dual;&lt;br /&gt;    dbms_output.put_line( 'Entered text :' || v_textin);&lt;br /&gt;    SELECT '' into v_textout from dual;&lt;br /&gt;    LOOP&lt;br /&gt;      SELECT instr( v_textin , ' ' , 1 , 1 ) into v_number from dual;&lt;br /&gt;      if v_number = 0 THEN&lt;br /&gt;        SELECT v_textout || ' ' || SOUNDEX(v_textin) into v_textout from dual ;&lt;br /&gt;        EXIT;&lt;br /&gt;      else&lt;br /&gt;        SELECT v_textout || ' ' || SOUNDEX(substr (v_textin , 0 , v_number  - 1  )) into v_textout from dual;&lt;br /&gt;        SELECT substr (v_textin , v_number + 1 )  into v_textin from dual;&lt;br /&gt;      end if;&lt;br /&gt;    END LOOP;&lt;br /&gt;    RETURN( v_textout );&lt;br /&gt;end M_SOUNDEX;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;General DBA Scripts&lt;br /&gt;1. Show database uptime in days and hours&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   uptime.sql&lt;br /&gt;rem Purpose:    Display database uptime in days and hours&lt;br /&gt;rem             to SYS or SYSTEM&lt;br /&gt;rem Date:       12-Jan-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;select SYSDATE-logon_time "Days", (SYSDATE-logon_time)*24 "Hours"&lt;br /&gt;from   sys.v_$session&lt;br /&gt;where  sid=1 /* this is PMON */&lt;br /&gt;/&lt;br /&gt;Create database user like an exiting user (with exact privs)&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   cr8like.sql&lt;br /&gt;rem Purpose:    Script to create a new user (with privs) like an existing&lt;br /&gt;rem             database user. User data will not be copied.&lt;br /&gt;rem Date:       02-Nov-1998&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem Updated:    Konstantin Krivosheyev - 7 Dec 2002&lt;br /&gt;rem Updated:    Frank Naude - 18 Dec 2003, 2 Dec 2004&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set pages 0 feed off veri off lines 500&lt;br /&gt;&lt;br /&gt;accept oldname prompt "Enter user to model new user to: "&lt;br /&gt;accept newname prompt "Enter new user name: "&lt;br /&gt;-- accept psw     prompt "Enter new user's password: "&lt;br /&gt;&lt;br /&gt;-- Create user...&lt;br /&gt;select 'create user &amp;&amp;newname identified by values '''||password||''''||&lt;br /&gt;-- select 'create user &amp;&amp;newname identified by &amp;psw'||&lt;br /&gt;       ' default tablespace '||default_tablespace||&lt;br /&gt;       ' temporary tablespace '||temporary_tablespace||' profile '||&lt;br /&gt;       profile||';'&lt;br /&gt;from   sys.dba_users &lt;br /&gt;where  username = upper('&amp;&amp;oldname');&lt;br /&gt;&lt;br /&gt;-- Grant Roles...&lt;br /&gt;select 'grant '||granted_role||' to &amp;&amp;newname'||&lt;br /&gt;       decode(ADMIN_OPTION, 'YES', ' WITH ADMIN OPTION')||';'&lt;br /&gt;from   sys.dba_role_privs&lt;br /&gt;where  grantee = upper('&amp;&amp;oldname');  &lt;br /&gt;&lt;br /&gt;-- Grant System Privs...&lt;br /&gt;select 'grant '||privilege||' to &amp;&amp;newname'||&lt;br /&gt;       decode(ADMIN_OPTION, 'YES', ' WITH ADMIN OPTION')||';'&lt;br /&gt;from   sys.dba_sys_privs&lt;br /&gt;where  grantee = upper('&amp;&amp;oldname');  &lt;br /&gt;&lt;br /&gt;-- Grant Table Privs...&lt;br /&gt;select 'grant '||privilege||' on '||owner||'.'||table_name||' to &amp;&amp;newname;'&lt;br /&gt;from   sys.dba_tab_privs&lt;br /&gt;where  grantee = upper('&amp;&amp;oldname');  &lt;br /&gt;&lt;br /&gt;-- Grant Column Privs...&lt;br /&gt;select 'grant '||privilege||' on '||owner||'.'||table_name||&lt;br /&gt;       '('||column_name||') to &amp;&amp;newname;'&lt;br /&gt;from   sys.dba_col_privs&lt;br /&gt;where  grantee = upper('&amp;&amp;oldname');  &lt;br /&gt;&lt;br /&gt;-- Tablespace Quotas...&lt;br /&gt;select 'alter user '||username||' quota '||&lt;br /&gt;       decode(max_bytes, -1, 'UNLIMITED', max_bytes)||&lt;br /&gt;       ' on '||tablespace_name||';'&lt;br /&gt;from   sys.dba_ts_quotas&lt;br /&gt;where  username = upper('&amp;&amp;oldname'); &lt;br /&gt;&lt;br /&gt;-- Set Default Role...&lt;br /&gt;set serveroutput on&lt;br /&gt;declare&lt;br /&gt;  defroles varchar2(4000);&lt;br /&gt;begin&lt;br /&gt;  for c1 in (select * from sys.dba_role_privs &lt;br /&gt;              where grantee = upper('&amp;&amp;oldname')&lt;br /&gt;                and default_role = 'YES'&lt;br /&gt;  ) loop&lt;br /&gt;      if length(defroles) &gt; 0 then&lt;br /&gt;         defroles := defroles||','||c1.granted_role;&lt;br /&gt;      else&lt;br /&gt;         defroles := defroles||c1.granted_role;&lt;br /&gt;      end if;&lt;br /&gt;  end loop;&lt;br /&gt;  dbms_output.put_line('alter user &amp;&amp;newname default role '||defroles||';');&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;•  Switch from one database user to another without password (su.sql)&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   su.sql&lt;br /&gt;rem Purpose:    Switch from one database user to another (local db only)&lt;br /&gt;rem Syntax:     @su &lt;user&gt;&lt;br /&gt;rem Notes:      Require ALTER USER and SELECT ON DBA_USERS privileges&lt;br /&gt;rem Date:       12-Apr-1998&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set termout off head off&lt;br /&gt;col nl newline&lt;br /&gt;spool su.tmp&lt;br /&gt;&lt;br /&gt;select 'alter user &amp;&amp;1 identified by &amp;&amp;1;' nl,&lt;br /&gt;       'connect &amp;&amp;1/&amp;&amp;1' nl,&lt;br /&gt;       'alter user &amp;&amp;1 identified by values '''||u.password||''';' nl&lt;br /&gt;from   sys.dba_users u&lt;br /&gt;where  u.username = upper('&amp;&amp;1')&lt;br /&gt;  and  u.username &lt;&gt; user&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;spool off&lt;br /&gt;&lt;br /&gt;@su.tmp&lt;br /&gt;&lt;br /&gt;REM Delete the file. Use "rm" on Unix, "del" for Win/Dos&lt;br /&gt;! rm su.tmp&lt;br /&gt;! del su.tmp&lt;br /&gt;&lt;br /&gt;set termout on&lt;br /&gt;&lt;br /&gt;select 'Connected as '||USER||' on '||global_name||'.'&lt;br /&gt;from   global_name;&lt;br /&gt;&lt;br /&gt;set termout on head on&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;•  Dynamically ZIP large process trace files&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;--                                                                         -&lt;br /&gt;-- Purpose:     Dynamically zip a process's trace file                     -&lt;br /&gt;--                                                                         -&lt;br /&gt;-- Synopsis:    @trc_zip                                                   -&lt;br /&gt;--                                                                         -&lt;br /&gt;-- Description: This script creates a named pipe in place of the process's -&lt;br /&gt;--              trace file and spawns a gzip process to compress it.       -&lt;br /&gt;--                                                                         -&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;column trc_file new_value trc_file noprint&lt;br /&gt;column zip_file new_value zip_file noprint&lt;br /&gt;&lt;br /&gt;select p.value || '/ora_' || u.spid || '.trc' trc_file,&lt;br /&gt;       p.value || '/ora_' || u.spid || '.trc.gz' zip_file&lt;br /&gt;from   sys.v_$session s,&lt;br /&gt;       sys.v_$process u,&lt;br /&gt;       sys.v_$parameter p&lt;br /&gt;where  s.audsid = userenv('SESSIONID')&lt;br /&gt;  and  u.addr = s.paddr&lt;br /&gt;  and  p.name = 'user_dump_dest'&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;set define :&lt;br /&gt;host mknod :trc_file p &amp;&amp; nohup gzip &lt; :trc_file &gt; :zip_file &amp;&lt;br /&gt;set define &amp;&lt;br /&gt;&lt;br /&gt;alter session set max_dump_file_size = unlimited&lt;br /&gt;/&lt;br /&gt;Tabular display of redo-log archiving history (logs/hour)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   archdist.sql&lt;br /&gt;rem Purpose:    Tabular display of redo-log archiving history (logs/hour)&lt;br /&gt;rem             - Can only run from sqlplus&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set pagesize 50000&lt;br /&gt;set veri off&lt;br /&gt;set colsep ""&lt;br /&gt;&lt;br /&gt;set termout off&lt;br /&gt;def time="time"                    -- Oracle7&lt;br /&gt;col time new_value time&lt;br /&gt;select 'to_char(first_time,''DD/MM/YY HH24:MI:SS'')' time&lt;br /&gt;from   dual&lt;br /&gt;where  &amp;&amp;_O_RELEASE like '8%'      -- Oracle8&lt;br /&gt;/&lt;br /&gt;set termout on&lt;br /&gt;&lt;br /&gt;select substr(&amp;&amp;time, 1, 5) day,&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'00',1,0)),'99') "00",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'01',1,0)),'99') "01",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'02',1,0)),'99') "02",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'03',1,0)),'99') "03",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'04',1,0)),'99') "04",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'05',1,0)),'99') "05",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'06',1,0)),'99') "06",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'07',1,0)),'99') "07",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'08',1,0)),'99') "08",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'09',1,0)),'99') "09",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'10',1,0)),'99') "10",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'11',1,0)),'99') "11",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'12',1,0)),'99') "12",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'13',1,0)),'99') "13",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'14',1,0)),'99') "14",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'15',1,0)),'99') "15",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'16',1,0)),'99') "16",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'17',1,0)),'99') "17",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'18',1,0)),'99') "18",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'19',1,0)),'99') "19",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'20',1,0)),'99') "20",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'21',1,0)),'99') "21",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'22',1,0)),'99') "22",&lt;br /&gt;       to_char(sum(decode(substr(&amp;&amp;time,10,2),'23',1,0)),'99') "23"&lt;br /&gt;from   sys.v_$log_history&lt;br /&gt;group  by substr(&amp;&amp;time,1,5)&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;set colsep " "&lt;br /&gt;List control file structures with usage limits&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:  ctlimits.sql&lt;br /&gt;rem Purpose:   List control file structures with usage limits&lt;br /&gt;rem Date:      21-Sep-2000&lt;br /&gt;rem Author:    Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set pages 50000&lt;br /&gt;col PCT_USED format 990.09&lt;br /&gt;&lt;br /&gt;-- Controlfile creation parameters:&lt;br /&gt;-- Type DATAFILE    is for MAXDATAFILES&lt;br /&gt;-- Type REDO LOG    is for MAXLOGFILES&lt;br /&gt;-- Type LOG HISTORY is for MAXLOGHISTORY&lt;br /&gt;-- Type REDO THREAD is for MAXINSTANCES&lt;br /&gt;-- No entry for MAXLOGMEMBERS (?)&lt;br /&gt;&lt;br /&gt;select type, records_used, records_total,&lt;br /&gt;       records_used/records_total*100 "PCT_USED"&lt;br /&gt;from   sys.v_$controlfile_record_section&lt;br /&gt;/&lt;br /&gt;Log all database errors to a table&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   db-error.sql&lt;br /&gt;rem Purpose:    Log all database errors to a table&lt;br /&gt;rem             Oracle8i or above/ DBA or CREATE ANY TRIGGER privs/ and&lt;br /&gt;rem  GRANT SELECT ON SYS.V_$SESSION required &lt;br /&gt;rem Date:       21-Mar-2000&lt;br /&gt;rem Author:     Nico Booyse (booysen@saps.org.za)&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;drop trigger log_errors_trig;&lt;br /&gt;drop table   log_errors_tab;&lt;br /&gt;&lt;br /&gt;create table log_errors_tab (&lt;br /&gt; error     varchar2(30),&lt;br /&gt; timestamp date,&lt;br /&gt; username  varchar2(30),&lt;br /&gt;        osuser    varchar2(30),&lt;br /&gt;        machine   varchar2(64),&lt;br /&gt; process   varchar2(8),&lt;br /&gt; program   varchar2(48));&lt;br /&gt;&lt;br /&gt;create or replace trigger log_errors_trig &lt;br /&gt; after servererror on database&lt;br /&gt;declare&lt;br /&gt; var_user     varchar2(30);&lt;br /&gt; var_osuser   varchar2(30);&lt;br /&gt; var_machine  varchar2(64);&lt;br /&gt; var_process  varchar2(8);&lt;br /&gt; var_program  varchar2(48);&lt;br /&gt;begin&lt;br /&gt; select username, osuser, machine, process, program&lt;br /&gt; into   var_user, var_osuser, var_machine, var_process, var_program&lt;br /&gt; from   sys.v_$session&lt;br /&gt; where  audsid = userenv('sessionid');&lt;br /&gt;&lt;br /&gt; insert into log_errors_tab&lt;br /&gt;   values(dbms_standard.server_error(1),sysdate,var_user,&lt;br /&gt;          var_osuser,var_machine,var_process,var_program);&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;Demonstrate database and schema level triggers&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   db-trig.sql&lt;br /&gt;rem Purpose:    Demonstrate database triggers (available from Oracle 8i)&lt;br /&gt;rem             Need DBA or CREATE ANY TRIGGER privs&lt;br /&gt;rem Date:       28-Aug-1998&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;create or replace trigger restrict_login&lt;br /&gt;        after logon       on database&lt;br /&gt;--      after logoff      on database&lt;br /&gt;--      after servererror on database&lt;br /&gt;--      after startup     on database&lt;br /&gt;--      after shutdown    on database&lt;br /&gt;--      after create      on database&lt;br /&gt;--      after drop        on database&lt;br /&gt;--      after alter       on database&lt;br /&gt;declare&lt;br /&gt;        flag number := 0;&lt;br /&gt;begin&lt;br /&gt;        select 1 into flag from sys.v_$session where program like '%sqlplus%';&lt;br /&gt;        if flag = 1 then&lt;br /&gt;                raise_application_error(-20000, 'No access from sqlplus');&lt;br /&gt;        end if;&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE OR REPLACE TRIGGER startup_db&lt;br /&gt;after startup on database&lt;br /&gt;begin&lt;br /&gt;    dbms_shared_pool.keep ('SYS.STANDARD','P');&lt;br /&gt;    dbms_shared_pool.keep ('SYS.DBMS_STANDARD','P');&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt;show errors&lt;br /&gt;Limit resources using the Database Resource Manager&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   rsrc.sql&lt;br /&gt;rem Purpose:    Demonstrate resource manager capabilities (limit CPU,&lt;br /&gt;rem             degree and sessions, available from Oracle 8i)&lt;br /&gt;rem Date:       28-Aug-1998&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Create plan with consumer groups&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;exec dbms_resource_manager.create_pending_area;&lt;br /&gt;&lt;br /&gt;exec dbms_resource_manager.delete_plan_cascade('night_plan');&lt;br /&gt;&lt;br /&gt;exec dbms_resource_manager.create_plan('night_plan', 'Plan to use after 6PM');&lt;br /&gt;exec dbms_resource_manager.create_consumer_group('batch', 'Group for batch reports');&lt;br /&gt;&lt;br /&gt;exec dbms_resource_manager.create_plan_directive('night_plan', 'batch', 'Rules for overnight batch jobs', -&lt;br /&gt;                                                 cpu_p1 =&gt; 75, parallel_degree_limit_p1 =&gt; 20);&lt;br /&gt;exec dbms_resource_manager.create_plan_directive('night_plan', 'OTHER_GROUPS', 'Rules for overnight batch jobs', -&lt;br /&gt;                                                 cpu_p1 =&gt; 25, parallel_degree_limit_p1 =&gt; 0,                    -&lt;br /&gt;                                                 max_active_sess_target_p1 =&gt; 1);&lt;br /&gt;&lt;br /&gt;exec dbms_resource_manager.validate_pending_area;&lt;br /&gt;exec dbms_resource_manager.submit_pending_area;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- List plans and consumer groups&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set pages 50000&lt;br /&gt;col plan  format a12&lt;br /&gt;col status format a7&lt;br /&gt;col cpu_p1 format 999&lt;br /&gt;col cpu_p2 format 999&lt;br /&gt;col cpu_p3 format 999&lt;br /&gt;col group_or_subplan format a17&lt;br /&gt;col parallel_degree_limit_p1 format 999&lt;br /&gt;&lt;br /&gt;select plan, num_plan_directives, status, mandatory from sys.dba_rsrc_plans;&lt;br /&gt;&lt;br /&gt;select plan, group_or_subplan, cpu_p1, cpu_p2, cpu_p3, parallel_degree_limit_p1 as parallel, status&lt;br /&gt;from   sys.dba_rsrc_plan_directives&lt;br /&gt;order  by plan;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Switch a user to a new consumer group&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;exec dbms_resource_manager_privs.grant_switch_consumer_group('SCOTT', 'batch', FALSE);&lt;br /&gt;exec dbms_resource_manager.set_initial_consumer_group('SCOTT', 'batch');&lt;br /&gt;&lt;br /&gt;-- exec dbms_resource_manager.switch_consumer_group_for_user('SCOTT', 'batch');   -- Switch on-line users&lt;br /&gt;&lt;br /&gt;select username, initial_rsrc_consumer_group from sys.dba_users where username = 'SCOTT';&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Enable resource management for this instance&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;alter system set resource_manager_plan = 'NIGHT_PLAN';&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;-- Monitor the resource manager&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;col program format a40&lt;br /&gt;select program, resource_consumer_group from sys.v_$session where username = 'SCOTT';&lt;br /&gt;&lt;br /&gt;-- select * from sys.v_$rsrc_plan;&lt;br /&gt;select * from sys.v_$rsrc_consumer_group;&lt;br /&gt;&lt;br /&gt;Log Miner - extract undo statements from log files&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   logmgr.sql&lt;br /&gt;rem Purpose:    Log Miner: extract undo statements from online and archived&lt;br /&gt;rem             redo log files based on selection criteria.&lt;br /&gt;rem Date:       21-Sep-2000&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;-- Create a dictionary file &lt;br /&gt;--   (init.ora parameter utl_file_dir must be set)&lt;br /&gt;exec dbms_logmnr_d.build('mydictfile', '/tmp');&lt;br /&gt;&lt;br /&gt;-- Register log files, can be from a different db&lt;br /&gt;--   (NEWFILE=start new list/ ADDFILE=add next file)&lt;br /&gt;exec dbms_logmnr.add_logfile(&lt;br /&gt; LogFileName =&gt;&lt;br /&gt;'/app/oracle/arch/oradba/log_1_0000000027.oradba', &lt;br /&gt; Options     =&gt; dbms_logmnr.NEW);&lt;br /&gt;exec dbms_logmnr.add_logfile(&lt;br /&gt; LogFileName =&gt;&lt;br /&gt;'/app/oracle/arch/oradba/log_1_0000000028.oradba', &lt;br /&gt; Options     =&gt; dbms_logmnr.ADDFILE);&lt;br /&gt;&lt;br /&gt;-- Start the logminer session&lt;br /&gt;exec dbms_logmnr.start_logmnr(DictFileName =&gt; '/tmp/mydictfile');&lt;br /&gt;&lt;br /&gt;-- Query v_$logmnr_contents view to extract required info&lt;br /&gt;select timestamp, sql_undo&lt;br /&gt;from   sys.v_$logmnr_contents&lt;br /&gt;where  seg_name = 'EMPLOYEES';&lt;br /&gt;&lt;br /&gt;-- Stop the logminer session&lt;br /&gt;exec dbms_logmnr.end_logmnr;&lt;br /&gt;&lt;br /&gt;Database cursor usage (open_cursors parameter)&lt;br /&gt;&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   cursors.sql&lt;br /&gt;rem Purpose:    Track database cursor usage&lt;br /&gt;rem Date:       29-Nov-2002&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;prompt Open Cursor Limit&lt;br /&gt;col value format a30 head "Open Cursors Parameter Value"&lt;br /&gt;&lt;br /&gt;select value&lt;br /&gt;from   sys.v_$parameter&lt;br /&gt;where  name = 'open_cursors';&lt;br /&gt;&lt;br /&gt;prompt Summary of Current Curor Usage&lt;br /&gt;col name format a25&lt;br /&gt;&lt;br /&gt;select min(value) min, max(value) max, avg(value) avg&lt;br /&gt;from   sys.v_$sesstat&lt;br /&gt;where  statistic# = (select statistic#&lt;br /&gt;                       from sys.v_$statname&lt;br /&gt;                      where name like 'opened cursors current');&lt;br /&gt;&lt;br /&gt;prompt Top 10 Users With Most Open Cursors&lt;br /&gt;col program  format a15 trunc&lt;br /&gt;col osuser   format a15 trunc&lt;br /&gt;col username format a15 trunc&lt;br /&gt;&lt;br /&gt;select * from (&lt;br /&gt;  select s.sid, s.username, s.osuser, s.program, v.value "Open&lt;br /&gt;Cursors"&lt;br /&gt;  from   sys.v_$sesstat v,  sys.v_$session s&lt;br /&gt;  where  v.sid        = s.sid&lt;br /&gt;    and  v.statistic# = (select statistic#&lt;br /&gt;                       from sys.v_$statname&lt;br /&gt;                      where name like 'opened cursors current')&lt;br /&gt;  order  by v.value desc&lt;br /&gt;)&lt;br /&gt;where rownum &lt; 11;&lt;br /&gt;On-line table reorganizaton using the DBMS_REDEFINITION package&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;rem Filename:   tabreorg.sql&lt;br /&gt;rem Purpose:    Show how a table can be reorganized on-line using the &lt;br /&gt;rem             DBMS_REDEFINITION package introduced in Oracle9i.&lt;br /&gt;rem Date:       22-May-2003&lt;br /&gt;rem Author:     Frank Naude, Oracle FAQ&lt;br /&gt;rem -----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;-- Connect as SYSDBA to grant privs to scott...&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;connect / as sysdba&lt;br /&gt;&lt;br /&gt;grant execute on dbms_redefinition to scott;&lt;br /&gt;grant dba to scott;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;-- Create new empty interim table...&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;connect scott/tiger&lt;br /&gt;CREATE TABLE emp_work AS SELECT * FROM emp WHERE 1=2;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;-- Test if table can be redefined...&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;EXEC DBMS_REDEFINITION.CAN_REDEF_TABLE('scott', 'emp', 2);&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;-- Start table redefinition...&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;EXEC DBMS_REDEFINITION.START_REDEF_TABLE('scott', 'emp', 'emp_work', NULL, 2);&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------&lt;br /&gt;-- Add ALL constraints, indexes, triggers, grants, etc...&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;ALTER TABLE emp ADD PRIMARY KEY (empno);&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;-- Finish the redefinition process (this will swap the two tables)...&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;EXEC DBMS_REDEFINITION.FINISH_REDEF_TABLE('scott', 'emp', 'emp_work');&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;-- Drop the interim working table...&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;DROP TABLE emp_work;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113664088775418454?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113664088775418454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113664088775418454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113664088775418454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113664088775418454'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2006/01/queries.html' title='queries'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113596241346723778</id><published>2005-12-30T09:06:00.000-08:00</published><updated>2005-12-30T09:06:53.810-08:00</updated><title type='text'>eclipse pecular behavior</title><content type='html'>If we have a cycle dependency, then eclipse will go out of memory immediately.&lt;br /&gt;&lt;br /&gt;Like if  A extends B, and B extends A .. (by mistake if we do this kind of thing) eclipse will die.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113596241346723778?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113596241346723778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113596241346723778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113596241346723778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113596241346723778'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/12/eclipse-pecular-behavior.html' title='eclipse pecular behavior'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113352426534223257</id><published>2005-12-02T03:50:00.000-08:00</published><updated>2005-12-02T04:55:55.960-08:00</updated><title type='text'>security</title><content type='html'>nice notes on des algorithm&lt;br /&gt;http://www.aci.net/kalliste/des.htm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://www.informit.com/guides/content.asp?g=java&amp;seqNum=31&amp;rl=1&lt;br /&gt;http://www.angelfire.com/tx4/cus/notes/javaxcrypto.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113352426534223257?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113352426534223257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113352426534223257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113352426534223257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113352426534223257'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/12/security.html' title='security'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113333910439929207</id><published>2005-11-30T00:23:00.000-08:00</published><updated>2005-11-30T00:26:10.036-08:00</updated><title type='text'>mysql commands</title><content type='html'>&lt;table border=1&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td colspan=2 align=center bgcolor=#AAAAAA&gt;&lt;br /&gt;&lt;br /&gt;   &lt;font size=3&gt;&lt;b&gt;Handy MySQL Commands&lt;/b&gt;&lt;/font&gt;&lt;br /&gt; &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Command&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;To login (from unix shell) use -h only if needed.&lt;/td&gt;&lt;td&gt; [mysql dir]/bin/mysql -h hostname -u root -p&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Create a database on the sql server.&lt;/td&gt;&lt;td&gt;create database [databasename];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;List all databases on the sql server.&lt;/td&gt;&lt;td&gt;show databases;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Switch to a database.&lt;/td&gt;&lt;td&gt;use [db name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;To see all the tables in the db.&lt;/td&gt;&lt;td&gt;show tables;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;To see database's field formats.&lt;/td&gt;&lt;td&gt;describe [table name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;To delete a db.&lt;/td&gt;&lt;td&gt;drop database [database name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;To delete a table.&lt;/td&gt;&lt;td&gt;drop table [table name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Show all data in a table.&lt;/td&gt;&lt;td&gt;SELECT * FROM [table name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Returns the columns and column information pertaining to the designated table.&lt;/td&gt;&lt;td&gt;show columns from [table name];&lt;td&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Show certain selected rows with the value "whatever".&lt;/td&gt;&lt;td&gt; SELECT * FROM [table name] WHERE [field name] = "whatever";&lt;td&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Show all records containing the name "Bob" AND the phone number '3444444'.&lt;/td&gt;&lt;td&gt;SELECT * FROM [table name] WHERE name = "Bob" AND &lt;br /&gt;phone_number = '3444444';&lt;td&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Show all records not containing the name "Bob" AND the phone number '3444444' order by the phone_number field.&lt;/td&gt;&lt;td&gt;SELECT * FROM [table &lt;br /&gt;name] WHERE name != "Bob" AND phone_number = '3444444' order by phone_number;&lt;td&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Show all records starting with the letters 'bob' AND the phone number '3444444'.&lt;/td&gt;&lt;td&gt;SELECT * FROM [table name] WHERE name like "Bob%" AND &lt;br /&gt;phone_number = '3444444';&lt;td&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Use a regular expression to find records. Use "REGEXP BINARY" to force case-sensitivity. This finds any record beginning with a. &lt;br /&gt;&lt;/td&gt;&lt;td&gt;SELECT * FROM [table name] WHERE rec RLIKE "^a$";&lt;td&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Show unique records.&lt;/td&gt;&lt;td&gt;SELECT DISTINCT [column name] FROM [table name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Show selected records sorted in an ascending (asc) or descending (desc).&lt;/td&gt;&lt;td&gt;SELECT [col1],[col2] FROM [table name] ORDER BY [col2] &lt;br /&gt;DESC;&lt;/td&gt;&lt;/tr&gt; &lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Count rows.&lt;/td&gt;&lt;td&gt;SELECT COUNT(*) FROM [table name];&lt;td&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Join tables on common columns.&lt;/td&gt; &lt;td&gt;select lookup.illustrationid, lookup.personid,person.birthday from lookup&lt;br&gt;&lt;br /&gt;left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Switch to the mysql db. Create a new user.&lt;td&gt;INSERT INTO [table name] (Host,User,Password) VALUES('%','user',PASSWORD('password'));&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Change a users password.(from unix shell).&lt;/td&gt;&lt;td&gt;[mysql dir]/bin/mysqladmin -u root -h hostname.blah.org -p password 'new-password'&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Change a users password.(from MySQL prompt).&lt;/td&gt;&lt;td&gt;SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere');&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Switch to mysql db.Give user privilages for a db.&lt;/td&gt;&lt;td&gt;INSERT INTO [table name] &lt;br /&gt;(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES ('%','db','user','Y','Y','Y','Y','Y','N');&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;To update info already in a table.&lt;/td&gt;&lt;td&gt;UPDATE [table name] SET Select_priv = 'Y',Insert_priv = 'Y',Update_priv = 'Y' where [field name] = &lt;br /&gt;'user';&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Delete a row(s) from a table.&lt;/td&gt;&lt;td&gt;DELETE from [table name] where [field name] = 'whatever';&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Update database permissions/privilages.&lt;/td&gt;&lt;td&gt;FLUSH PRIVILEGES;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Delete a column.&lt;/td&gt;&lt;td&gt;alter table [table name] drop column [column name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Add a new column to db.&lt;/td&gt;&lt;td&gt;alter table [table name] add column [new column name] varchar (20);&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Change column name.&lt;/td&gt;&lt;td&gt;alter table [table name] change [old column name] [new column name] varchar (50);&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Make a unique column so you get no dupes.&lt;/td&gt;&lt;td&gt;alter table [table name] add unique ([column name]);&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Make a column bigger.&lt;/td&gt;&lt;td&gt;alter table [table name] modify [column name] VARCHAR(3);&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Delete unique from table.&lt;/td&gt;&lt;td&gt;alter table [table name] drop index [colmn name];&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Load a CSV file into a table.&lt;/td&gt;&lt;td&gt;LOAD DATA INFILE '/tmp/filename.csv' replace INTO TABLE [table name]&lt;br /&gt;FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1,field2,field3);&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Dump all databases for backup.Backup file is sql commands to recreate all db's.&lt;/td&gt;&lt;td&gt;[mysql dir]/bin/mysqldump --user=root --password=blah --all-databases &gt;/tmp/sql-01_backup.sql&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Create Table Example 1.&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;td&gt;CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),&lt;br&gt;    &lt;br /&gt;officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups &lt;br&gt;&lt;br /&gt;VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt; &lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Create Table Example 2.&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;td&gt;create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastname&lt;br /&gt;varchar(50) default 'bato');&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113333910439929207?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113333910439929207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113333910439929207' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113333910439929207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113333910439929207'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/11/mysql-commands.html' title='mysql commands'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113332793883299447</id><published>2005-11-29T21:18:00.000-08:00</published><updated>2005-11-29T21:18:58.866-08:00</updated><title type='text'>chat client</title><content type='html'>here is a list of &lt;a href="http://www.carbonize.co.uk/Yahoo/clients.php"&gt;chat clients&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113332793883299447?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113332793883299447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113332793883299447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113332793883299447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113332793883299447'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/11/chat-client.html' title='chat client'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-113283448670033059</id><published>2005-11-24T04:14:00.000-08:00</published><updated>2005-11-24T04:14:46.713-08:00</updated><title type='text'>security</title><content type='html'>http://www.isi.edu/gost/publications/kerberos-neuman-tso.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-113283448670033059?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/113283448670033059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=113283448670033059' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113283448670033059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/113283448670033059'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/11/security.html' title='security'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-112988022379409804</id><published>2005-10-21T00:31:00.000-07:00</published><updated>2005-10-21T00:37:03.806-07:00</updated><title type='text'>Webservices development IDE</title><content type='html'>Here is a Eclipse based J2EE IDE.&lt;br /&gt;Lomboz 3.1RC2&lt;br /&gt;&lt;a href="http://lomboz.objectweb.org/"&gt;http://lomboz.objectweb.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.roseindia.net/webservices/buildingsimplewebservice.shtml"&gt;Building a Simple Web Service – A Tutorial&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A copy of the tutorial is here.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; ·         By Jeevaraj Gnanaselvan Dhanaraj (jeevaraj_1970@yahoo.com)&lt;br /&gt;&lt;br /&gt;      (Jeeva has over 7 years of experience in designing and developing enterprise class web applications using JAVA and J2EE technologies.&lt;br /&gt;&lt;br /&gt;      He currently works for Itreya Technologies, Bangalore, leading a team of over 10 programmers and designers, developing a multi-user, distributed, web-based workflow application)&lt;br /&gt;&lt;br /&gt; ·        Introduction&lt;br /&gt;&lt;br /&gt;In this tutorial we will create a simple web service and a client web application using eclipse IDE along with Lomboz plug in. We will also deploy and test the web service on Tomcat 5.5.4 web application server. This application, while simple, provides a good introduction to Web service development and some of the Web development tools available.&lt;br /&gt;&lt;br /&gt; ·         Environment&lt;br /&gt;&lt;br /&gt;J2SDK 1.4.2&lt;br /&gt;&lt;a href="http://java.sun.com/"&gt;http://java.sun.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Eclipse 3.1&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.eclipse.org/"&gt;http://www.eclipse.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Tomcat 5.5.4&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tomcat.apache.org/"&gt;http://tomcat.apache.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Lomboz 3.1RC2&lt;br /&gt;&lt;a href="http://lomboz.objectweb.org/"&gt;http://lomboz.objectweb.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;·         Installation&lt;br /&gt;&lt;br /&gt;Install JDK (in D:\j2sdk1.4.2_04)&lt;br /&gt;&lt;br /&gt;Install Tomcat (in E:\Tomcat5.5)&lt;br /&gt;&lt;br /&gt;Install Eclipse (in E:\Eclipse3.1)&lt;br /&gt;&lt;br /&gt;Install Lomboz (in E:\Eclipse3.1)&lt;br /&gt;&lt;br /&gt;·         Setting up&lt;br /&gt;&lt;br /&gt;   1. Set up the installed JRE in eclipse (Windows -&gt; Preferences -&gt; Java -&gt; Installed JREs)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   2. Set up the installed runtime for server in eclipse (Windows -&gt; Preferences -&gt; Server -&gt; Installed Runtimes)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   3. Set up the Server view in eclipse (Windows -&gt; Show View -&gt; Other)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   4. Set up the Tomcat Server by right clicking and selecting New -&gt; Server option from the Server view in eclipse&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;·         Creating a Web service&lt;br /&gt;&lt;br /&gt;   1. Create a new Dynamic Web Project in eclipse (File -&gt; New -&gt; Other)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   2. Enter name as “WebServiceTutorial”, select project location as “E:\Test” and select Apache Tomcat v5.5 as the Target server.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   3. Now create a new Java class from the Project Explorer (Dynamic Web Projects -&gt; Java Source -&gt; New -&gt; Class)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   4. Enter name as “Hello” and package as “com.tutorial”.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   5. Add a simple method in the “Hello” class as below.&lt;br /&gt;&lt;br /&gt;            public String sayHello(String name){&lt;br /&gt;&lt;br /&gt;                        return "Hello " + name;&lt;br /&gt;&lt;br /&gt;            }            &lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   6. Save and build the project.&lt;br /&gt;   7. Create a new Web service in eclipse (File -&gt; New -&gt; Other)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   8. Select Generate a proxy.&lt;br /&gt;   9. Select Test the Web service.&lt;br /&gt;  10. Select Overwrite files without warning.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  11. Select or enter the Bean name as “com.tutorial.Hello”. This is the java class that we just now created.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  12. Continue the wizard by clicking Next and finish.&lt;br /&gt;  13. On Finish, the Tomcat server starts up and launches the Test client.&lt;br /&gt;  14. Verify the generated contents. Look for Hello.class and the generated JSPs as below.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  15. Verify the Tomcat folder and ensure the newly created web applications – WebServiceTutorial, WebServiceTutorialClient.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  16. We can also run the following url from the browser to access/test the Web service.&lt;br /&gt;&lt;br /&gt;http://localhost:8080/WebServiceTutorialClient/sampleHelloProxy/TestClient.jsp&lt;br /&gt;&lt;br /&gt;  17. If servlet error “org.eclipse.jst.ws.util.JspUtils cannot be resolved or is not a type” is thrown on the browser, then copy the webserviceutils.jar file from the E:\Eclipse3.1\eclipse\plugins\org.eclipse.jst.ws.consumption_0.7.0 into the WEB-INF\lib folder of the WebServiceTutorialClient application and restart the Tomcat server.&lt;br /&gt;&lt;br /&gt;  18. The browser displays the methods available in the web service.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  19. Click on the sayHello(..) method, enter your name (for e.g. “Jeeva”) in the inputs section and click “Invoke”.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  20. The browser greets using the web service.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  21. The WSDL for the Hello Web service can be found in E:\Test\WebServiceTutorial\WebContent\wsdl\Hello.wsdl. On double-click, the WSDL opens in a graphical editor.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  22. Right-click on the WSDL file and explore the options to test the web service / publish the WSDL file / generate client / etc.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;·         Conclusion&lt;br /&gt;&lt;br /&gt;In this tutorial we learned how to create a simple web service and a client web application using eclipse IDE along with Lomboz plug in. We also deployed and tested the web service on Tomcat 5.5.4 web application server. This application, while simple, provides a good introduction to Web service development and some of the Web development tools available.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-112988022379409804?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/112988022379409804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=112988022379409804' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112988022379409804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112988022379409804'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/10/webservices-development-ide.html' title='Webservices development IDE'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-112955339945973767</id><published>2005-10-17T05:48:00.000-07:00</published><updated>2005-10-17T05:49:59.466-07:00</updated><title type='text'>Google labs papers</title><content type='html'>I found this &lt;a href="http://labs.google.com/papers.html"&gt;site&lt;/a&gt; of google very useful. Interesting articles are available.I thought i could borrow thought for my future PhD.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-112955339945973767?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/112955339945973767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=112955339945973767' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112955339945973767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112955339945973767'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/10/google-labs-papers.html' title='Google labs papers'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-112799345068132223</id><published>2005-09-29T04:30:00.000-07:00</published><updated>2005-09-29T04:52:08.343-07:00</updated><title type='text'>tech-presentations</title><content type='html'>&lt;a href="http://www.cse.lehigh.edu/~glennb/oose/ppt/"&gt;presentations&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ida.liu.se/~uweas/Lectures/DesignPatterns01/"&gt;http://www.ida.liu.se/~uweas/Lectures/DesignPatterns01/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-112799345068132223?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/112799345068132223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=112799345068132223' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112799345068132223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112799345068132223'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/09/tech-presentations.html' title='tech-presentations'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-112756932510760561</id><published>2005-09-24T06:16:00.000-07:00</published><updated>2005-09-24T06:42:05.513-07:00</updated><title type='text'>Accenture Shaping the Future Forum 2005</title><content type='html'>Today i attended a full day training at Leela palace on SAP Netweaver. &lt;br /&gt;Actually my intention was to get lunch at Leela palace and so i paid 200/- when the entry fee for the event. But then i got enough stuff and a T-Shirt and importantly i got the first prize in the quiz which gave me 1500/- gift voucher.&lt;br /&gt;&lt;br /&gt;It was interesting to listen about &lt;a href="http://www.sap.com/solutions/netweaver/index.epx"&gt;Netweaver&lt;/a&gt;. Accenture is working on Netweaver to provide solutions to its client. Both Accenture and SAP are big players in the market and are capable of capturing market share on the Composite applications domain.&lt;br /&gt;&lt;br /&gt;Well, that was the interesting part of the session, that is the theme behind the Netweaver, its about Composite Applications. They seems ready to hit the market. At one point of time i was wondering is the Digital Harbor loosing its lead in the Composite Applications? they are talking more in detail about the Composite Applications. The theory looked better then what i heard at Digital Harbor.&lt;br /&gt;And they are working going to hit the market soon with CAF (Composite Application Framework, which is an IDE based on Eclipse). They are doing wonderful stuff, generate spicy real time reports in no time. They have &lt;a href="http://www.sap.com/solutions/xapps/index.epx"&gt;xApps&lt;/a&gt; for composite Applications.&lt;br /&gt;&lt;br /&gt;Features of SAP NetWeaver are&lt;br /&gt;&lt;br /&gt;1. People Integration&lt;br /&gt;2. Information Integration&lt;br /&gt;3. Process Integration&lt;br /&gt;4. Application Integration and Platform&lt;br /&gt;&lt;br /&gt;But then the issues that are ahead of composite applications are too discussed.&lt;br /&gt;&lt;br /&gt;1. Managing the complexities of the Composite Applications&lt;br /&gt;2. Life cycle management of the applications and making sure that those applications are running and talking with each other.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There was new thing that i come across, SAP is having a concept called ESA, which i havent heard before (as i know :-) ) well. This ESA (Enterprise Service Architecture) is a business implemetation of the SOA. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There was intersting discussion about how the innovation works.. first innovate something, then work on it and make sure you consolidate it. create a standardization of the innovation, then you outsource the work to somebody else and engage your guys to innovate something else.. Looks impressive isnt it?&lt;br /&gt;&lt;br /&gt;Few of the components that are required for developing composite applications are&lt;br /&gt;1. A single common execution architecture&lt;br /&gt;2. An eAI Tool&lt;br /&gt;3. A portal Engine&lt;br /&gt;4. A BI (Business Intelligence) Platform&lt;br /&gt;5. A custom Development Engine&lt;br /&gt;6. A collabarative engine&lt;br /&gt;7. Knowledge Management engine.&lt;br /&gt;8. A work flow engine&lt;br /&gt;9. A process management engine&lt;br /&gt;10.A mobile development plaftform&lt;br /&gt;&lt;br /&gt;Netweaver comes with a &lt;a href="http://www.sap.com/solutions/netweaver/pdf/BWP_SID_Building_StandardsBased_Applications.pdf"&gt;refrigiretor&lt;/a&gt;  architecture and it looks impressive.&lt;br /&gt;&lt;br /&gt;They are talking of various terms like XI (the SAP Exchange Infrastructure)&lt;br /&gt;Master Data Management (MDM),xIEP, ALE,IDocs, EP (Enterprise Portal)&lt;br /&gt;&lt;br /&gt;At the outset, it was an interesting session i attended. &lt;br /&gt;now i got think of what to do with my gift vouchers..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-112756932510760561?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/112756932510760561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=112756932510760561' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112756932510760561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112756932510760561'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/09/accenture-shaping-future-forum-2005.html' title='Accenture Shaping the Future Forum 2005'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-112720730756748125</id><published>2005-09-20T02:06:00.000-07:00</published><updated>2005-09-20T02:58:49.886-07:00</updated><title type='text'>White papers</title><content type='html'>&lt;a href="http://www.tessella.com/Literature/Supplements/PDF/n-tier.pdf"&gt;N-Tier Architecture&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The same website has lots of other &lt;a href="http://www.tessella.com/Literature/Supplements/"&gt;tech suppliments&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;White papers from Panda software on software &lt;a href="http://216.240.153.30/sales/Product_Info/White_Papers/Whitepaper_large_companies.pdf"&gt;security&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Tech Republic &lt;a href="http://whitepapers.techrepublic.com/?tag=header"&gt;White papers&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mandolin.cais.ntu.edu.sg/wise2002/boualem-tutorial-wise.pdf"&gt;Article on B2B&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;small intro to B2B&lt;/span&gt; from http://wisegeek.com&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;"B2B" is contemporary shorthand for a longtime sales practice called business-to-business. B2B transactions primarily target companies and other wholesale buyers, while transactions targeting individuals are called B2C, or business-to-customer. Many organizations have both B2B and B2C components, but it's not unusual for a company to specialize in B2B services or sales. In fact, the vast majority of products and services sold are considered to be B2B in nature.&lt;br /&gt;&lt;br /&gt;One major reason for the popularity of B2B sales and services is sheer volume. An individual customer may visit a clothing manufacturer's website catalog and order two pairs of shoes or a sweater. The buyer for a national chain of clothing stores, however, may order 5,000 pairs of shoes and 2,000 sweaters. Without a B2B component, the manufacturer would have lost out on a very lucrative sale. This is why many companies provide B2B options alongside the B2C offerings at their websites and other outlets.&lt;br /&gt;&lt;br /&gt;B2B sales are also generated by providing a specialized product line or service not available to the general public. This form of B2B transaction is very common in the manufacturing world. A company which produces shaving cream in cans, for example, may need a specific plastic nozzle. Several plastic injection molding companies would send sales representatives to pitch their particular designs. These nozzles would be useless for individual customers, but a manufacturer may order thousands of them.&lt;br /&gt;&lt;br /&gt;With the growth in electronic communications, B2B has taken on even more importance. Instead of simply focusing on business-to-business sales, modern corporations are conducting other financial transactions online. B2B communications are now being used to promote investment, trade stocks and form financial alliances. Because the price of these transactions is far beyond the reach of most individuals, there is no equivalent business-to-customer option available. Some B2B transactions handled electronically can literally run into the billions of dollars.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14922998-112720730756748125?l=tech-torch.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-torch.blogspot.com/feeds/112720730756748125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14922998&amp;postID=112720730756748125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112720730756748125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14922998/posts/default/112720730756748125'/><link rel='alternate' type='text/html' href='http://tech-torch.blogspot.com/2005/09/white-papers.html' title='White papers'/><author><name>Harinath Mallepally</name><uri>http://www.blogger.com/profile/13263604275213298262</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='22' src='http://harinathreddy.googlepages.com/utopia.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14922998.post-112679234685718701</id><published>2005-09-15T06:52:00.000-07:00</published><updated>2005-09-15T06:52:26.890-07:00</updated><title type='text'>C faqs abridged</title><content type='html'>Section 1. Declarations and Initializations&lt;br /&gt;&lt;br /&gt;1.1: How do you decide which integer type to use?&lt;br /&gt;&lt;br /&gt;A: If you might need large values (tens of thousands), use long.&lt;br /&gt; Otherwise, if space is very important, use short.  Otherwise,&lt;br /&gt; use int.&lt;br /&gt;&lt;br /&gt;1.4: What should the 64-bit type on a machine that can support it?&lt;br /&gt;&lt;br /&gt;A: C9X specifies long long.&lt;br /&gt;&lt;br /&gt;1.7: What's the best way to declare and define global variables?&lt;br /&gt;&lt;br /&gt;A: The best arrangement is to place each definition in some&lt;br /&gt; relevant .c file, with an external declaration in a header file.&lt;br /&gt;&lt;br /&gt;1.11: What does extern mean in a function declaration?&lt;br /&gt;&lt;br /&gt;A: Nothing, really; the keyword extern is optional here.&lt;br /&gt;&lt;br /&gt;1.12: What's the auto keyword good for?&lt;br /&gt;&lt;br /&gt;A: Nothing.&lt;br /&gt;&lt;br /&gt;1.14: I can't seem to define a linked list node which contains a&lt;br /&gt; pointer to itself.&lt;br /&gt;&lt;br /&gt;A: Structures in C can certainly contain pointers to themselves;&lt;br /&gt; the discussion and example in section 6.5 of K&amp;R make this&lt;br /&gt; clear.  Problems arise if an attempt is made to define (and use)&lt;br /&gt; a typedef in the midst of such a declaration; avoid this.&lt;br /&gt;&lt;br /&gt;1.21: How do I declare an array of N pointers to functions returning&lt;br /&gt; pointers to functions returning pointers to characters?&lt;br /&gt;&lt;br /&gt;A: char *(*(*a[N])())();&lt;br /&gt; Using a chain of typedefs, or the cdecl program, makes these&lt;br /&gt; declarations easier.&lt;br /&gt;&lt;br /&gt;1.22: How can I declare a function that returns a pointer to a&lt;br /&gt; function of its own type?&lt;br /&gt;&lt;br /&gt;A: You can't quite do it directly.  Use a cast, or wrap a struct&lt;br /&gt; around the pointer and return that.&lt;br /&gt;&lt;br /&gt;1.25: My compiler is complaining about an invalid redeclaration of a&lt;br /&gt; function, but I only define it once.&lt;br /&gt;&lt;br /&gt;A: Calling an undeclared function declares it implicitly as&lt;br /&gt; returning int.&lt;br /&gt;&lt;br /&gt;1.25b: What's the right declaration for main()?&lt;br /&gt;&lt;br /&gt;A: See questions 11.12a to 11.15.&lt;br /&gt;&lt;br /&gt;1.30: What am I allowed to assume about the initial values&lt;br /&gt; of variables which are not explicitly initialized?&lt;br /&gt;&lt;br /&gt;A: Uninitialized variables with "static" duration start out as 0,&lt;br /&gt; as if the programmer had initialized them.  Variables with&lt;br /&gt; "automatic" duration, and dynamically-allocated memory, start&lt;br /&gt; out containing garbage (with the exception of calloc).&lt;br /&gt;&lt;br /&gt;1.31: Why can't I initialize a local array with a string?&lt;br /&gt;&lt;br /&gt;A: Perhaps you have a pre-ANSI compiler.&lt;br /&gt;&lt;br /&gt;1.31b: What's wrong with "char *p = malloc(10);" ?&lt;br /&gt;&lt;br /&gt;A: Function calls are not allowed in initializers for global or&lt;br /&gt; static variables.&lt;br /&gt;&lt;br /&gt;1.32: What is the difference between char a[] = "string"; and&lt;br /&gt; char *p = "string"; ?&lt;br /&gt;&lt;br /&gt;A: The first declares an initialized and modifiable array; the&lt;br /&gt; second declares a pointer initialized to a not-necessarily-&lt;br /&gt; modifiable constant string.&lt;br /&gt;&lt;br /&gt;1.34: How do I initialize a pointer to a function?&lt;br /&gt;&lt;br /&gt;A: Use something like "extern int func(); int (*fp)() = func;" .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Section 2. Structures, Unions, and Enumerations&lt;br /&gt;&lt;br /&gt;2.1: What's the difference between struct x1 { ... }; and&lt;br /&gt; typedef struct { ... } x2; ?&lt;br /&gt;&lt;br /&gt;A: The first structure is named by a tag, the second by a typedef&lt;br /&gt; name.&lt;br /&gt;&lt;br /&gt;2.2: Why doesn't "struct x { ... }; x thestruct;" work?&lt;br /&gt;&lt;br /&gt;A: C is not C++.&lt;br /&gt;&lt;br /&gt;2.3: Can a structure contain a pointer to itself?&lt;br /&gt;&lt;br /&gt;A: See question 1.14.&lt;br /&gt;&lt;br /&gt;2.4: What's the best way of implementing opaque (abstract) data types&lt;br /&gt; in C?&lt;br /&gt;&lt;br /&gt;A: One good way is to use structure pointers which point to&lt;br /&gt; structure types which are not publicly defined.&lt;br /&gt;&lt;br /&gt;2.6: I came across some code that declared a structure with the last&lt;br /&gt; member an array of one element, and then did some tricky&lt;br /&gt; allocation to make it act like the array had several elements.&lt;br /&gt; Is this legal or portable?&lt;br /&gt;&lt;br /&gt;A: An official interpretation has deemed that it is not strictly&lt;br /&gt; conforming with the C Standard.&lt;br /&gt;&lt;br /&gt;2.7: I heard that structures could be assigned to variables and&lt;br /&gt; passed to and from functions, but K&amp;R1 says not.&lt;br /&gt;&lt;br /&gt;A: These operations are supported by all modern compilers.&lt;br /&gt;&lt;br /&gt;2.8: Is there a way to compare structures automatically?&lt;br /&gt;&lt;br /&gt;A: No.&lt;br /&gt;&lt;br /&gt;2.10: Can I pass constant values to functions which accept structure&lt;br /&gt; arguments?&lt;br /&gt;&lt;br /&gt;A: Not yet.  As of this writing, C has no way of generating&lt;br /&gt; anonymous structure values.&lt;br /&gt;&lt;br /&gt;2.11: How can I read/write structures from/to data files?&lt;br /&gt;&lt;br /&gt;A: It is relatively straightforward to use fread and fwrite.&lt;br /&gt;&lt;br /&gt;2.12: How can I turn off structure padding?&lt;br /&gt;&lt;br /&gt;A: There is no standard method.&lt;br /&gt;&lt;br /&gt;2.13: Why does sizeof report a larger size than I expect for a&lt;br /&gt; structure type?&lt;br /&gt;&lt;br /&gt;A: The alignment of arrays of structures must be preserved.&lt;br /&gt;&lt;br /&gt;2.14: How can I determine the byte offset of a field within a&lt;br /&gt; structure?&lt;br /&gt;&lt;br /&gt;A: ANSI C defines the offsetof() macro, which should be used if&lt;br /&gt; available.&lt;br /&gt;&lt;br /&gt;2.15: How can I access structure fields by name at run time?&lt;br /&gt;&lt;br /&gt;A: Build a table of names and offsets, using the offsetof() macro.&lt;br /&gt;&lt;br /&gt;2.18: I have a program which works correctly, but dumps core after it&lt;br /&gt; finishes.  Why?&lt;br /&gt;&lt;br /&gt;A: Check to see if a structure type declaration just before main()&lt;br /&gt; is missing its trailing semicolon, causing main() to be declared&lt;br /&gt; as returning a structure.  See also questions 10.9 and 16.4.&lt;br /&gt;&lt;br /&gt;2.20: Can I initialize unions?&lt;br /&gt;&lt;br /&gt;A: The current C Standard allows an initializer for the first-named&lt;br /&gt; member.&lt;br /&gt;&lt;br /&gt;2.22: What is the difference between an enumeration and a set of&lt;br /&gt; preprocessor #defines?&lt;br /&gt;&lt;br /&gt;A: At the present time, there is little difference.  The C Standard&lt;br /&gt; states that enumerations are compatible with integral types.&lt;br /&gt;&lt;br /&gt;2.24: Is there an easy way to print enumeration values symbolically?&lt;br /&gt;&lt;br /&gt;A: No.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Section 3. Expressions&lt;br /&gt;&lt;br /&gt;3.1: Why doesn't the code "a[i] = i++;" work?&lt;br /&gt;&lt;br /&gt;A: The variable i is both referenced and modified in the same&lt;br /&gt; expression.&lt;br /&gt;&lt;br /&gt;3.2: Under my compiler, the code "int i = 7;&lt;br /&gt; printf("%d\n", i++ * i++);" prints 49.  Regardless of the order&lt;br /&gt; of evaluation, shouldn't it print 56?&lt;br /&gt;&lt;br /&gt;A: The operations implied by the postincrement and postdecrement&lt;br /&gt; operators ++ and -- are performed at some time after the&lt;br /&gt; operand's former values are yielded and before the end of the&lt;br /&gt; expression, but not necessarily immediately after, or before&lt;br /&gt; other parts of the expression are evaluated.&lt;br /&gt;&lt;br /&gt;3.3: What should the code "int i = 3; i = i++;" do?&lt;br /&gt;&lt;br /&gt;A: The expression is undefined.&lt;br /&gt;&lt;br /&gt;3.3b: Here's a slick expression: "a ^= b ^= a ^= b".  It swaps a and b&lt;br /&gt; without using a temporary.&lt;br /&gt;&lt;br /&gt;A: Not portably; its behavior is undefined.&lt;br /&gt;&lt;br /&gt;3.4: Don't precedence and parentheses dictate order of evaluation?&lt;br /&gt;&lt;br /&gt;A: Operator precedence and explicit parentheses impose only a&lt;br /&gt; partial ordering on the evaluation of an expression, which does&lt;br /&gt; not generally include the order of side effects.&lt;br /&gt;&lt;br /&gt;3.5: But what about the &amp;&amp; and || operators?&lt;br /&gt;&lt;br /&gt;A: There is a special exception for those operators: left-to-right&lt;br /&gt; evaluation is guaranteed.&lt;br /&gt;&lt;br /&gt;3.8: What's a "sequence point"?&lt;br /&gt;&lt;br /&gt;A: A point (at the end of a full expression, or at the ||, &amp;&amp;, ?:,&lt;br /&gt; or comma operators, or just before a function call) at which all&lt;br /&gt; side effects are guaranteed to be complete.&lt;br /&gt;&lt;br /&gt;3.9: So given a[i] = i++; we don't know which cell of a[] gets&lt;br /&gt; written to, but i does get incremented by one, right?&lt;br /&gt;&lt;br /&gt;A: *No*.  Once an expression or program becomes undefined, *all*&lt;br /&gt; aspects of it become undefined.&lt;br /&gt;&lt;br /&gt;3.12: If I'm not using the value of the expression, should I use i++&lt;br /&gt; or ++i to increment a variable?&lt;br /&gt;&lt;br /&gt;A: Since the two forms differ only in the value yielded, they are&lt;br /&gt; entirely equivalent when only their side effect is needed.&lt;br /&gt;&lt;br /&gt;3.14: Why doesn't the code "int a = 1000, b = 1000;&lt;br /&gt; long int c = a * b;" work?&lt;br /&gt;&lt;br /&gt;A: You must manually cast one of the operands to (long).&lt;br /&gt;&lt;br /&gt;3.16: Can I use ?: on the left-hand side of an assignment expression?&lt;br /&gt;&lt;br /&gt;A: No.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Section 4. Pointers&lt;br /&gt;&lt;br /&gt;4.2: What's wrong with "char *p; *p = malloc(10);"?&lt;br /&gt;&lt;br /&gt;A: The pointer you declared is p, not *p.&lt;br /&gt;&lt;br /&gt;4.3: Does *p++ increment p, or what it points to?&lt;br /&gt;&lt;br /&gt;A: *p++ increments p.  To increment the value pointed to by p, use&lt;br /&gt; (*p)++ .&lt;br /&gt;&lt;br /&gt;4.5: I want to use a char * pointer to step over some ints.  Why&lt;br /&gt; doesn't "((int *)p)++;" work?&lt;br /&gt;&lt;br /&gt;A: In C, a cast operator is a conversion operator, and by&lt;br /&gt; definition it yields an rvalue, which cannot be assigned to, or&lt;br /&gt; incremented with ++.&lt;br /&gt;&lt;br /&gt;4.8: I have a function which accepts, and is supposed to initialize,&lt;br /&gt; a pointer, but the pointer in the caller remains unchanged.&lt;br /&gt;&lt;br /&gt;A: The called function probably altered only the passed copy of the&lt;br /&gt; pointer.&lt;br /&gt;&lt;br /&gt;4.9: Can I use a void ** pointer as a parameter so that a function&lt;br /&gt; can accept a generic pointer by reference?&lt;br /&gt;&lt;br /&gt;A: Not portably.&lt;br /&gt;&lt;br /&gt;4.10: I have a function which accepts a pointer to an int.  How can I&lt;br /&gt; pass a constant like 5 to it?&lt;br /&gt;&lt;br /&gt;A: You will have to declare a temporary variable.&lt;br /&gt;&lt;br /&gt;4.11: Does C even have "pass by reference"?&lt;br /&gt;&lt;br /&gt;A: Not really, though it can be simulated.&lt;br /&gt;&lt;br /&gt;4.12: I've seen different methods used for calling functions via&lt;br /&gt; pointers.&lt;br /&gt;&lt;br /&gt;A: The extra parentheses and explicit * are now officially&lt;br /&gt; optional, although some older implementations require them.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Section 5. Null Pointers&lt;br /&gt;&lt;br /&gt;5.1: What is this infamous null pointer, anyway?&lt;br /&gt;&lt;br /&gt;A: For each pointer type, there is a special value -- the "null&lt;br /&gt; pointer" -- which is distinguishable from all other pointer&lt;br /&gt; values and which is not the address of any object or function.&lt;br /&gt;&lt;br /&gt;5.2: How do I get a null pointer in my programs?&lt;br /&gt;&lt;br /&gt;A: A constant 0 in a pointer context is converted into a null&lt;br /&gt; pointer at compile time.  A "pointer context" is an&lt;br /&gt; initialization, assignment, or comparison with one side a&lt;br /&gt; variable or expression of pointer type, and (in ANSI standard C)&lt;br /&gt; a function argument which has a prototype in scope declaring a&lt;br /&gt; certain parameter as being of pointer type.  In other contexts&lt;br /&gt; (function arguments without prototypes, or in the variable part&lt;br /&gt; of variadic function calls) a constant 0 with an appropriate&lt;br /&gt; explicit cast is required.&lt;br /&gt;&lt;br /&gt;5.3: Is the abbreviated pointer comparison "if(p)" to test for non-&lt;br /&gt; null pointers valid?&lt;br /&gt;&lt;br /&gt;A: Yes.  The construction "if(p)" works, regardless of the internal&lt;br /&gt; representation of null pointers, because the compiler&lt;br /&gt; essentially rewrites it as "if(p != 0)" and goes on to convert 0&lt;br /&gt; into the correct null pointer.&lt;br /&gt;&lt;br /&gt;5.4: What is NULL and how is it #defined?&lt;br /&gt;&lt;br /&gt;A: NULL is simply a preprocessor macro, #defined as 0 (or&lt;br /&gt; ((void *)0)), which is used (as a stylistic convention, in&lt;br /&gt; preference to unadorned 0's) to generate null pointers.&lt;br /&gt;&lt;br /&gt;5.5: How should NULL be defined on a machine which uses a nonzero bit&lt;br /&gt; pattern as the internal representation of a null pointer?&lt;br /&gt;&lt;br /&gt;A: The same as on any other machine: as 0.  (The compiler makes the&lt;br /&gt; translation, upon seeing a 0, not the preprocessor; see also&lt;br /&gt; question 5.4.)&lt;br /&gt;&lt;br /&gt;5.6: If NULL were defined as "((char *)0)," wouldn't that make&lt;br /&gt; function calls which pass an uncast NULL work?&lt;br /&gt;&lt;br /&gt;A: Not in general.  The complication is that there are machines&lt;br /&gt; which use different internal representations for pointers to&lt;br /&gt; different types of data.  A cast is still required to tell the&lt;br /&gt; compiler which kind of null pointer is required, since it may be&lt;br /&gt; different from (char *)0.&lt;br /&gt;&lt;br /&gt;5.9: If NULL and 0 are equivalent as null pointer constants, which&lt;br /&gt; should I use?&lt;br /&gt;&lt;br /&gt;A: Either; the distinction is entirely stylistic.&lt;br /&gt;&lt;br /&gt;5.10: But wouldn't it be better to use NULL, in case the value of NULL&lt;br /&gt; changes?&lt;br /&gt;&lt;br /&gt;A: No.  NULL is a constant zero, so a constant zero is equally&lt;br /&gt; sufficient.&lt;br /&gt;&lt;br /&gt;5.12: I use the preprocessor macro "#define Nullptr(type) (type *)0"&lt;br /&gt; to help me build null pointers of the correct type.&lt;br /&gt;&lt;br /&gt;A: This trick, though valid, does not buy much.&lt;br /&gt;&lt;br /&gt;5.13: This is strange.  NULL is guaranteed to be 0, but the null&lt;br /&gt; pointer is not?&lt;br /&gt;&lt;br /&gt;A: A "null pointer" is a language concept whose particular internal&lt;br /&gt; value does not matter.  A null pointer is requested in source&lt;br /&gt; code with the character "0".  "NULL" is a preprocessor macro,&lt;br /&gt; which is always #defined as 0 (or ((void *)0)).&lt;br /&gt;&lt;br /&gt;5.14: Why is there so much confusion surrounding null pointers?&lt;br /&gt;&lt;br /&gt;A: The fact that null pointers are represented both in source code,&lt;br /&gt; and internally to most machines, as zero invites unwarranted&lt;br /&gt; assumptions.  The use of a preprocessor macro (NULL) may seem to&lt;br /&gt; suggest that the value could change some day, or on some weird&lt;br /&gt; machine.&lt;br /&gt;&lt;br /&gt;5.15: I'm confused.  I just can't understand all this null pointer&lt;br /&gt; stuff.&lt;br /&gt;&lt;br /&gt;A: A simple rule is, "Always use `0' or `NULL' for null pointers,&lt;br /&gt; and always cast them when they are used as arguments in function&lt;br /&gt; calls."&lt;br /&gt;&lt;br /&gt;5.16: Given all the confusion surrounding null pointers, wouldn't it&lt;br /&gt; be easier simply to require them to be represented internally by&lt;br /&gt; zeroes?&lt;br /&gt;&lt;br /&gt;A: Such a requirement would accomplish little.&lt;br /&gt;&lt;br /&gt;5.17: Seriously, have any actual machines really used nonzero null&lt;br /&gt; pointers?&lt;br /&gt;&lt;br /&gt;A: Machines manufactured by Prime, Honeywell-Bull, and CDC, as well&lt;br /&gt; as Symbolics Lisp Machines, have done so.&lt;br /&gt;&lt;br /&gt;5.20: What does a run-time "null pointer assignment" error mean?&lt;br /&gt;&lt;br /&gt;A: It means that you've written, via a null pointer, to an invalid&lt;br /&gt; location.  (See also question 16.8.)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Section 6. Arrays and Pointers&lt;br /&gt;&lt;br /&gt;6.1: I had the definition char a[6] in one source file, and in&lt;br /&gt; another I declared extern char *a.  Why didn't it work?&lt;br /&gt;&lt;br /&gt;A: The declaration extern char *a simply does not match the actual&lt;br /&gt; definition.  Use extern char a[].&lt;br /&gt;&lt;br /&gt;6.2: But I heard that char a[] was identical to char *a.&lt;br /&gt;&lt;br /&gt;A: Not at all.  Arrays are not pointers.  A reference like x[3]&lt;br /&gt; generates different code depending on whether x is an array or a&lt;br /&gt; pointer.&lt;br /&gt;&lt;br /&gt;6.3: So what is meant by the "equivalence of pointers and arrays" in&lt;br /&gt; C?&lt;br /&gt;&lt;br /&gt;A: An lvalue of type array-of-T which appears in an expression&lt;br /&gt; decays into a pointer to its first element; the type of the&lt;br /&gt; resultant pointer is pointer-to-T.  So for an array a and&lt;br /&gt; pointer p, you can say "p = a;" and then p[3] and a[3] will&lt;br /&gt; access the same element.&lt;br /&gt;&lt;br /&gt;6.4: Why are array and pointer declarations interchangeable as&lt;br /&gt; function formal parameters?&lt;br /&gt;&lt;br /&gt;A: It's supposed to be a convenience.&lt;br /&gt;&lt;br /&gt;6.7: How can an array be an lvalue, if you can't assign to it?&lt;br /&gt;&lt;br /&gt;A: An array is not a "modifiable lvalue."&lt;br /&gt;&lt;br /&gt;6.8: What is the real difference between arrays and pointers?&lt;br /&gt;&lt;br /&gt;A: Arrays automatically allocate space which is fixed in size and&lt;br /&gt; location; pointers are dynamic.&lt;br /&gt;&lt;br /&gt;6.9: Someone explained to me that arrays were really just constant&lt;br /&gt; pointers.&lt;br /&gt;&lt;br /&gt;A: An array name is "constant" in that it cannot be assigned to,&lt;br /&gt; but an array is *not* a pointer.&lt;br /&gt;&lt;br /&gt;6.11: I came across some "joke" code containing the "expression"&lt;br /&gt; 5["abcdef"] .  How can this be legal C?&lt;br /&gt;&lt;br /&gt;A: Yes, array subscripting is commutative in C.  The array&lt;br /&gt; subscripting operation a[e] is defined as being identical to&lt;br /&gt; *((a)+(e)).&lt;br /&gt;&lt;br /&gt;6.12: What's the difference between array and &amp;array?&lt;br /&gt;&lt;br /&gt;A: The type.&lt;br /&gt;&lt;br /&gt;6.13: How do I declare a pointer to an array?&lt;br /&gt;&lt;br /&gt;A: Usually, you don't want to.  Consider using a pointer to one of&lt;br /&gt; the array's elements instead.&lt;br /&gt;&lt;br /&gt;6.14: How can I set an array's size at run time?&lt;br /&gt;&lt;br /&gt;A: It's straightforward to use malloc() and a pointer.&lt;br /&gt;&lt;br /&gt;6.15: How can I declare local arrays of a size matching a passed-in&lt;br /&gt; array?&lt;br /&gt;&lt;br /&gt;A: Until recently, you couldn't; array dimensions had to be compile-&lt;br /&gt; time constants.  C9X will fix this.&lt;br /&gt;&lt;br /&gt;6.16: How can I dynamically allocate a multidimensional array?&lt;br /&gt;&lt;br /&gt;A: The traditional solution is to allocate an array of pointers,&lt;br /&gt; and then initialize each pointer to a dynamically-allocated&lt;br /&gt; "row."  See the full list for code samples.&lt;br /&gt;&lt;br /&gt;6.17: Can I simulate a non-0-based array with a pointer?&lt;br /&gt;&lt;br /&gt;A: Not if the pointer points outside of the block of memory it is&lt;br /&gt; intended to access.&lt;br /&gt;&lt;br /&gt;6.18: My compiler complained when I passed a two-dimensional array to&lt;br /&gt; a function expecting a pointer to a pointer.&lt;br /&gt;&lt;br /&gt;A: The rule by which arrays decay into pointers is not applied&lt;br /&gt; recursively.  An array of arrays (i.e. a two-dimensional array&lt;br /&gt; in C) decays into a pointer to an array, not a pointer to a&lt;br /&gt; pointer.&lt;br /&gt;&lt;br /&gt;6.19: How do I write functions which accept two-dimensional arrays&lt;br /&gt; when the width is not known at compile time?&lt;br /&gt;&lt;br /&gt;A: It's not always particularly easy.&lt;br /&gt;&lt;br /&gt;6.20: How can I use statically- and dynamically-allocated&lt;br /&gt; multidimensional arrays interchangeably when passing them to&lt;br /&gt; functions?&lt;br /&gt;&lt;br /&gt;A: There is no single perfect method, but see the full list for&lt;br /&gt; some ideas.&lt;br /&gt;&lt;br /&gt;6.21: Why doesn't sizeof properly report the size of an array which is&lt;br /&gt; a parameter to a function?&lt;br /&gt;&lt;br /&gt;A: The sizeof operator reports the size of the pointer parameter&lt;br /&gt; which the function actually receives.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Section 7. Memory Allocation&lt;br /&gt;&lt;br /&gt;7.1: Why doesn't the code "char *answer; gets(answer);" work?&lt;br /&gt;&lt;br /&gt;A: The pointer variable answer has not been set to point to any&lt;br /&gt; valid storage.  The simplest way to correct this fragment is to&lt;br /&gt; use a local array, instead of a pointer.&lt;br /&gt;&lt;br /&gt;7.2: I can't get strcat() to work.  I tried "char *s3 =&lt;br /&gt; strcat(s1, s2);" but I got strange results.&lt;br /&gt;&lt;br /&gt;A: Again, the main problem here is that space for the concatenated&lt;br /&gt; result is not properly allocated.&lt;br /&gt;&lt;br /&gt;7.3: But the man page for strcat() says that it takes two char *'s as&lt;br /&gt; arguments.  How am I supposed to know to allocate things?&lt;br /&gt;&lt;br /&gt;A: In general, when using pointers you *always* have to consider&lt;br /&gt; memory allocation, if only to make sure that the compiler is&lt;br /&gt; doing it for you.&lt;br /&gt;&lt;br /&gt;7.3b: I just tried the code "char *p; strcpy(p, "abc");" and it&lt;br /&gt; worked.  Why didn't it crash?&lt;br /&gt;&lt;br /&gt;A: You got "lucky".&lt;br /&gt;&lt;br /&gt;7.3c: How much memory does a pointer variable allocate?&lt;br /&gt;&lt;br /&gt;A: Only enough memory to hold the pointer itself, not any memory&lt;br /&gt; for the pointer to point to.&lt;br /&gt;&lt;br /&gt;7.5a: I have a function that is supposed to return a string, but when&lt;br /&gt; it returns to its caller, the returned string is garbage.&lt;br /&gt;&lt;br /&gt;A: Make sure that the pointed-to memory is properly (i.e. not&lt;br /&gt; locally) allocated.&lt;br /&gt;&lt;br /&gt;7.5b: So what's the right way to return a string?&lt;br /&gt;&lt;br /&gt;A: Return a pointer to a statically-allocated buffer, a buffer&lt;br /&gt; passed in by the caller, or memory obtained with malloc().&lt;br /&gt;&lt;br /&gt;7.6: Why am I getting "warning: assignment of pointer from integer&lt;br /&gt; lacks a cast" for calls to malloc()?&lt;br /&gt;&lt;br /&gt;A: Have you #included &lt;stdlib.h&gt;?&lt;br /&gt;&lt;br /&gt;7.7: Why does some code carefully cast the values returned by malloc&lt;br /&gt; to the pointer type being allocated?&lt;br /&gt;&lt;br /&gt;A: Before ANSI/ISO C, these casts were required to silence certain&lt;br /&gt; warnings.&lt;br /&gt;&lt;br /&gt;7.8: Why does so much code leave out the multiplication by&lt;br /&gt; sizeof(char) when allocating strings?&lt;br /&gt;&lt;br /&gt;A: Because sizeof(char) is, by definition, exactly 1.&lt;br /&gt;&lt;br /&gt;7.14: I've heard that some operating systems don't actually allocate&lt;br /&gt; malloc'ed memory until the program tries to use it.  Is this&lt;br /&gt; legal?&lt;br /&gt;&lt;br /&gt;A: It's hard to say.&lt;br /&gt;&lt;br /&gt;7.16: I'm allocating a large array for some numeric work, but malloc()&lt;br /&gt; is acting strangely.&lt;br /&gt;&lt;br /&gt;A: Make sure the number you're trying to pass to malloc() isn't&lt;br /&gt; bigger than a size_t can hold.&lt;br /&gt;&lt;br /&gt;7.17: I've got 8 meg of memory in my PC.  Why can I only seem to&lt;br /&gt; malloc 640K or so?&lt;br /&gt;&lt;br /&gt;A: Under the segmented architecture of PC compatibles, it can be&lt;br /&gt; difficult to use more than 640K with any degree of transparency.&lt;br /&gt; See also question 19.23.&lt;br /&gt;&lt;br /&gt;7.19: My pr
