Oracle: Check for special character in SQL

select str, dump(str)
from test
where translate(upper(str),
CHR(0)||'QWERTYUIOPASDFGHJKLZXCVBNM ,.<>/?;:''"[{]}1234567890-=!@#$%^&*()_+\|`~',
CHR(0)
) IS NOT NULL

Weblogic: Changing context root and redirection

Sometime you might have to change the context root(CR) of the application deployed on weblogic from CR1 to CR2. This can be easily done by updating the context root in the application.xml file in your ear file.

But then if you might also want to redirect all the old URL references to this new context root. So if somebody access http://yourhost/CR1 it should redirect to http://yourhost/CR2. It’s easy to do in Apache server using mod_rewrite module. But weblogic as such don’t provide this functionality.

 

So here is quick handy way to achieve this:

1.    Create a dummy web module under CR1.

2.    Update application.xml as follows:

   

<module > 

       <web>

         <web-uri>newAppDir</web-uri>

         <context-root>/CR2</context-root>

      </web>

   </module>

    <module> 

       <web>

         <web-uri>oldAppDir</web-uri>

         <context-root>/CR1</context-root>

      </web>

   </module>

     

3.    Configure web.xml for this dummy web application such that all the requests will be handled by a single JSP, redirector.jsp

a.    Set the welcome file as redirector.jsp

b.    Add Following servlet mapping to catch all the URLs and let it handle by redirector.jsp

 

<servlet-name>wlRedirector</servlet-name>

<jsp-file>/redirector.jsp</jsp-file>

</servlet>

<servlet-mapping>

     <servlet-name>wlRedirector</servlet-name>

     <url-pattern>/*</url-pattern>

 </servlet-mapping>

 

4.    In the redirector.jsp add code to change the CR1 to CR2 and sendRedirect to CR2

                                String recvUrl = request.getRequestURI();

          recvUrl = "/CR2" + recvUrl;

         if (request.getQueryString() != null) {

          recvUrl += '?' + request.getQueryString();

         }

URL reconstructedURL = new URL(request.getScheme(),

                               request.getServerName(),

                               request.getServerPort(),

                               recvUrl);

response.sendRedirect (reconstructedURL.toString());

 

 

Rahul Ner

 

Recursive and Non-Recursive find in Unix

Recursive Find in Unix for "*.log"
find . -name "*.log" -print -type f


Non-Recursive Find in Unix for "*.log": Just current directory
find . \( ! -name . -prune \) -name "*.log" -print -type f

Protect your email address from automated spammer

<SCRIPT TYPE="text/javascript">
emailE=('xxx' + '@' + 'ccc.org')
document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>')
</script>

Book Publishing on joomla website

1. Convert word to PDF using cutePDF write/PDF 999
2. Convert PDF to images using converter http://www.officeconvert.com/purchase.htm
3. Resize to 50% using fastStone
4. Display using any book modules. e.g.