Java Script to use XMLHttpRequest : readyState, statusText , responseText, responseXML

The below is a simple HTML code containing JAVA script to use the object  XMLHttpRequest to retrieve the contents of a weburl when GET is applied. Simple to say do HTTP GET and show the contents of URL.
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  alert('Http State is:' + xmlhttp.readyState);
  alert('HTTP Status is :' + xmlhttp.statusText);
  if (xmlhttp.readyState==4 )
    {
    if ( xmlhttp.status==200 )
    {
       alert('Response data as String :' + xmlhttp.responseText);
       alert('Response data as XML:' + xmlhttp.responseXML);
    }
    }
  }
  try {
      xmlhttp.open("GET","http://www.krishnababug.com/",true);
      xmlhttp.send("");
      }
      catch (e) {
                 alert(e);
                }
}

</script>
</head>
<body>

<h2>How to use XMLHttpRequest object</h2>
<div id="myDiv"></div>
<button type="button" onclick="loadXMLDoc()">Load URL - Click to change state</button>

</body>
</html>

References:
[1] [2]
Note : working only on Internet Explorer


Read more


Top / Best Android apps - My selection on Android 2.3.7

I am using Cyanogen Mod7 (Android 2.3.7) so most of the built-in things are helping me :) Adding to them I have the below best apps for my daily use.

1.  3G Mobile Hotspot
     The best wifi tither app on my phone. Less radiation , less heat and more over easy to use and connect any device. 
2.  Adobe reader
     Nothing to say about it, best pdf reader as always.
3.  Advance English (MSDict Viewer)
     Good English dictionary for quick access.  But till today couldn't locate the dictionary file where it is saving. When ever you go for factory reset you have to re download the dictionary file if you wont take back up of SDCARD.
4.  Andro FTP
     Best app to start FTP server on your phone and share your files with others when wifi enabled, and vice-verse to take files from others.
5.  Android Booster
    Famous app to monitor your GPRS usage, power management and statistics , and managing your memory by killing unwanted apps.
6.  Androzip 
     File manager come zip application for my phone. I use send to bluetooth device option directly from here as I don't see , send via Bluetooth option in normal file manager.
7.  Angry birds
    Nothing to say about it , don't remember how many hours I spent on this :)
8.  Any Post
   Simple, lite app for posting status to multiple social networking sites at  a time. Photo, Map and text options available.
10. Background
When ever I feel boring to see my phone screen I logon to this app to download new beautiful backgrounds for my phone.
11. BookMy show
      Suitable for Indian Android users to book your movies, and special events near your city.
12. Brillinat Quotes
      Want some inspiring quotes every day ? try this app ! 
13. Bubble pop
      Most famous used app by my niece :) time pass bubble breaking game.  
14. ByteConverter
     When I see big numbers to convert between Bytes and bits etc need this.
15. compass
      Helped multiple times to locate sun in new locations :)
16. Documents to go 
      Best office tool I have seen for my phone. Support doc,xls, ppt etc.
17. ES Task Manager
      Helps controlling startup apps or services and cleaning cache memory.
18. Expense Manager
      Password protected app to keep track of your expenses and income with clean analytical charts. 
19. Facebook
      Nothing to say about it , I still don't find the way to share videos I saw from others wall.
20  Full on SMS
      Free SMS sending App works in India, but wont display name on the receiver phone :( with new TROI rules.
21. IBM Leap Manager
      WIFI manager to connect to IBM wifi networks
22. IMDB
      Nothing to say about it , on-time guide to find your favorite movie review.  
23. Indian Rail
      Simple app to find the trains status, PNR status and locating the train etc. Work in India.
24. Mail (Yahoo)
      Mail client for Yahoo.
25. Maps
      Google maps , still don't know how to use voice navigation on this. Any other best maps app for android which can compete with OVI maps.
26. Milage Tracker
    Started recently to keep track of the petrol expenses.  Need time to rate it.
27. MixZing Basic
     Good music player with folder wise section options and categorizing with albums etc. 
28. Mobo Video Player
    Felt happy using it multiple times while playing 720 p videos on my phone and while watching movies with subtitles which sync perfectly with audio and video.
29. MX Video Player
Another best video player like above to watch all videos which needs some soft encoding.
30. NetQin Security
Good Security anti-virus app required for my phone to keep it healthy.
31. NewsHunt
Indian regional news papers with easy use and automatic support of regional language fonts like Telugu, kanada, Tamil, Gujarathi, Marathi,Hindi and many more. I like to read my favorite eenadu Telugu daily on this.  
32. ngpay 
Mall on the phone is the best apt quote for this. Easy to use HDFC and other bank transactions. Book your bus or train ticket on a fly. Order your piza or sweets what not day by day its growing like any thing in India. Safe to use.
33. Nimbuzz
Superb! multi-messenger . 
34. Note Evrything
35. Pansi SMS
36. PVR
37. Quick boot
38. Radio Kushi
39. Ragalahari
40. Sametime
41. skype
42. speed Test
43. Super Manager
44. Tangram Moment
45. Terminal Emulator
46. TM World clock
47. Torch
48. TORI
49. Translate
50. TubeMate
51. Twica
52. Ustream
53. YuppTV

Please try to add your best apps in comments , I would like to tune my list to shift to stable apps.

Read more


How to upgrade to Android 2.3.X (Gingerbread) from 2.1 (Eclair) using CynogenMod 7.1 (CM 7.1) on Motorola Milestone A853 / A953 ?

How to upgrade to Android 2.3.X (Gingerbread) from 2.1 (Eclair) using CynogenMod 7.1 (CM 7.1) on Motorola Milestone A853 / A953 ?

Before following the below steps to flash your phone with new Cynogenmod7 ROM; make sure that you have taken all necessary backups like contacts, SMS and most used apps etc.

Pre-Reqs:
1. Your phone must be rooted before. To root the phone follow the below instructions.(http://www.krishnababug.com/2011/07/root-android-phones-motorola-htc.html)

2. Download the required below files and keep it ready from http://forum.xda-developers.com/showthread.php?t=941346
    a. Open Recovery - OpenRecovery 1.46 - BR 0.3.zip (for update OR1.46_extfs_mmcfix_update.zip )
        Download from link
    b. Google apps - gapps-gb-20110828-newtalk-signed.zip
    c. CynogenMod ROM - update-cm-7.1.0-11.10.12-Milestone-odexed-signed.zip

3. Disable_recovery_check_by_OTA.sh - Search in google and download this file.   

4. Enable USB debugging on your phone from Menu > Settings > Applications > Development and connect it to your computer via USB.

Now Create a Folder structure under sdcard root like below

sdcard
    |
    |__update.zip
    |
    |
    |__OpenRecovery
    |      |
    |      |__scripts
    |      |     |
    |      |     |__Disable_recovery_check_by_OTA.sh
    |      |
    |      |__updates
    |            |
    |            |__update-cm-7.1.0-11.10.12-Milestone-odexed-signed.zip
    |            |
    |            |__gapps-gb-20111012-signed.zip
    |
    |____ Other_Stuff
   

Steps to flash your phone with new Android build by CynogenMod:
1. Once the above tree structure is ready on your phone just power off the phone
2. While you Power on; press X button on the physical keyboard on your milestone.
3. Hold ‘X’ until you see a Triangle with an Exclamation mark on it, and then let go of ‘X’.
4. (If required ) Press & Hold the Volume up button and press the camera button. You'll be taken to Android System Recovery.
5. Using D-Pad as cursor and golden button in the middle as ‘Enter’ , Perform a ‘Wipe Data/Factory Reset’ & ‘Wipe Cache Partition’
6. Once done , apply Sdcard :update.zip.
7. You will be taken to Motorola Milestone Open Recovery Version 1.46 .
8. From menu, go to Nandroid > Backup All. This will place a backup of your current ROM in a folder called Nandroid on your SD Card.
9. Move it to a safe location later.
10. Perform a wipe data/factory reset (In case of CynogenMod updates skip this step)
11. Perform wipe > wipe cache partition and wipe Dalvik cache.
12. Apply Update, scroll to ‘update milestone-signed.zip’ and apply.
13. Now Apply  ‘gapps signed.zip’ and Apply.
14. Go back to Main Menu and reboot system
15. All set to see new CynogenMod logo after Motorola logo :) The first boot may take more time.

Possible errors :
1. E:signature verification failed error - If you get this error , make sure that the file under SDCARD > OpenRecovery > scripts > Disable_recovery_check_by_OTA.sh is fine and readable.
Note : Keep the above tree structure available always on ur sdcard and replace the new updates under updates directory each time when new updates are available.

Reference :

Read more


Websphere 6.1.0.0 to 6.1.0.35 upgrade steps

This post aims to explain the simple steps to upgrade the base build version of Websphere 61.0.0 to 6.10.35

Please follow the below steps one by one ..
How to upgrade WAS 6.1.0.0 to WAS 6.1.0.35 ?


  • Choose the required OS and bit level of hardware and then select both JAVA SDK and AppServer files for upgrade
  • Along with this download the IBM Update Installer V7.0.0.19 for WebSphere Software for Windows.
  • Once you download the required 3 files
6.1.0-WS-WASSDK-WinX32-FP0000035.pak
6.1.0-WS-WAS-WinX32-FP0000035.pak
7.0.0.19-WS-UPDI-WinIA32.zip
  • Extract the update installer, and install it.
  • Once installation created the folder structure
C:\Program Files\ibm\WebSphere 6.1\UpdateInstaller\maintenance

Copy the files 6.1.0-WS-WASSDK-WinX32-FP0000035.pak and 6.1.0-WS-WAS-WinX32-FP0000035.pak to the above path.
then let installer pick this two packages and install it.
All set to go ..now your WebSphere is upgraded :)

Read more


shell script to check newly created files in a directory and its sub directories

Shell script to check newly created files in a directory and its sub directories
The below shell script is to monitor a Directory and its sub-directories, and log the information when particular type of files are created/found.

The below script will monitor a directory "/opt/krish" for .sh files.
If there exists any .sh files in the directory (includes sub-directories) it will log the information in the results.log file in the same directory.
It repeats this operation for every 10 seconds so that any newly created file information will be captured.

You can keep on creating some test files using "touch d11.sh" in the same directory to verify whether the same is been logged in the results.log or not.

nc184120:/opt/krish # cat check.sh
#!/bin/ksh
cd /opt/krish
> results.log
date >> results.log
while true
do
    for file in `find . -type f -name "*.sh"`
    do
          ls -lrt $file >> results.log

    done
    sleep 0
done

Read more


How to see created trigger description and SQl stament , to confirm new or old is used ?

I was looking for a SQL query which can display the Trigger description, like while creating a trigger what condition was used especially which key word used like new or old. The below SQL query helped me to know such details.

How to see created trigger description and SQl stament , to confirm new or old is used ?

Launch the SQL prompt and connect to you database as sysdba.

Then run the below commands to know about the trigger you created ...

SQL> drop trigger TSIN_TR;

Trigger dropped.

SQL> CREATE OR REPLACE TRIGGER TSIN_TR
  2  AFTER INSERT ON TARGET_SERVER
  3  FOR EACH ROW
  4  BEGIN
  5  INSERT INTO ADJUST_DISTRIBUTION (PACKAGE_ID) SELECT PACKAGE_ID FROM TARGETLIST_MAP T
  6  WHERE T.TARGETLIST_ID = :NEW.TARGETLIST_ID;
  7  END;
  8  /


Trigger created.

SQL> set linesize 200
SQL> set pagesize 500
SQL> desc user_source;
 Name                                                                                                              Null?    Type
 ---------------------------------------------------------------------------------------------------
 NAME                                                                                                                       VARCHAR2(30)
 TYPE                                                                                                                       VARCHAR2(12)
 LINE                                                                                                                       NUMBER
 TEXT                                                                                                                       VARCHAR2(4000)

SQL> select distinct type from user_source;

TYPE
------------
TRIGGER

SQL> select text from user_source where name='TSIN_TR' order by line asc;

TEXT
----------------------------------------------------------------------------------------------------
TRIGGER TSIN_TR
AFTER INSERT ON TARGET_SERVER
FOR EACH ROW
BEGIN
INSERT INTO ADJUST_DISTRIBUTION (PACKAGE_ID) SELECT PACKAGE_ID FROM TARGETLIST_MAP T
WHERE T.TARGETLIST_ID = :NEW.TARGETLIST_ID;
END;

7 rows selected.

SQL> select DESCRIPTION, TRIGGER_BODY from user_triggers where trigger_name = 'TSIN_TR';

DESCRIPTION
----------------------------------------------------------------------------------------------------
TRIGGER_BODY
--------------------------------------------------------------------------------
TSIN_TR
AFTER INSERT ON TARGET_SERVER
FOR EACH ROW
BEGIN
INSERT INTO ADJUST_DISTRIBUTION (PACKAGE_ID) SELECT PACKAGE_ID FROM TARGET

SQL >

Hope this helps ...

Read more


How to root android phones ?

The below is the procedure I tried to root my Motorola Milestone Android 2.1. Hope this will help the rest of the phones like HTC, Samsung etc.
I felt this is the simple and easy way to root your Android phone. Before going to implement this rooting procedure let's understand the need for it.
If you are not a gadget geek or you don't want to play with your phone, please stop reading this article here only and browse your other favorite site.
Though we all know that android is a Unix mobile OS built on Linux kernel, new users mind will flash a question that "with which user I am logged in to this OS?" . If you got this question you can directly follow the procedure to gain root privileges. Otherwise read through need for rooting.
Need for rooting :  
  1. By default Android login will be a non root user.
  2. So if you gain root privileges you can have full control over the hardware for which you spent lot of money.
  3. In other words rooting your phone will unveil the functionalities hidden by vendor which can be supported by costly hardware.
  4. Rooting Android OS helps you in tweaking the android OS functionalities.
  5. To install lattest Apps supported in next Version android you need to root your old Android version OS.
  6. Improving your keyboard interaction with possible tools.
  7. Bluetooth and Wifi tethering made available with rooting
  8. Install your new apps directly on to SD card instead of overloading the phone memory.

Like above there will lot more advantages if you take control of your phone which will be only possible by rooting your Android.

 
Now we are ready to root your phone and let's follow the below process.

Required :

 
  1. Android phone.
  2. USB connector
  3. superoneclick installer (Win 32 app)

 Where to download superoneclick ?

  1. Link1
  2. Link2
 Procedure :
  1. Install superoneclick application on your windows(32 bit) laptop.
  2. Enable USB debugging on your phone. To do this go to Settings->Applications->Development and enabling “USB Debugging“.
  3. Now connect your android phone using USB cable to laptop. (You should see notification on phone "USB debugging connected").
  4. Now after unziping the downloaded superoneclick.zip run the superoneclick.exe by clicking it.
  5. In the launched GUI you will see large buttons with "Root", "Allow non market Apps" etc.
  6. Click on Root..it will do it's job by running several steps and at last it will run "SU test". If it is success.  
  7. You finished rooting your phone.
  8. Disconnect your phone, disable "USB debugging" and reboot your phone.
  9. So from next time onwards if you install any app which requests root access will be notified through a message saying that app was granted super access.
P.S  : If you root your phone your warranty terms will expire. 
Related : [1] [2] [3]

Read more


K-Tube (Krishna's page official channel KTube)

Hi All,
This is my official Tube on which I livecast some of the important events ...

Leave ur valuable comments either in the website or below...

Read more


shell script to capture OS and hardware details along with DB2 level and Websphere version details

Here I would like post a simple shell script which will help to capture multiple details in a test environment like ..

  1. Linux OperatingSystem name Version and level
  2. OS Bit level 
  3. Hardware (Processor) bit level
  4. DB2 Version and level
  5. Websphere version and level
  6. Hostname / IP
    The important re-usable things in shell script includes extracting the jar file contents in to a desired directory, logging the stdout (Output of shell script) on to a file, validating the number of arguments passed to a shell script etc ....

    #!/bin/sh
    # Log the stdout to a file in parameter 2
    exec 1> $2
    if [ $# != "2" ]; then
    echo "Usage: checkEnv.sh db2inst1 /opt/myEnv.log"
    exit
    else
    > $2
    chmod 777 $2
    echo "DCD Build Tested in this environment"
    for i in `find / -name MgmtCenterVersion.jar`
    do
    echo $i
    done
    jar -xvf $i
    echo "DCD Version and build number:"
    cat com/ibm/tivoli/cds/MgmtCenterVersion.properties
    rm -rf com/ META-INF/
    echo -e "\n########################################################################## "
    echo "System information :"
    uname -a
    nslookup `hostname`
    echo "Linux Level:"
    cat /etc/issue
    echo "Operating system Bit Level :"
    getconf WORD_BIT
    echo "Processor Bit Level : "
    getconf LONG_BIT
    echo "Websphere version:"
    /opt/IBM/WebSphere/AppServer/bin/versionInfo.sh
    file=`pwd`/$2
    echo $file
    echo "DB2 Version :"
    su - $1 << kris db2level >> $file
    exit
    kris
    echo "End of Script"
    fi


    Modify it according to your requirements.

    Read more


    class finder in JAR WAR EAR JarScan.jar

    It is very much important and most common for many java Developer to search for the required class file in the numurous jars/ ears / wars in the big project code base. So it is very much useful to have a handy tool like JarScan in work place. It is very simple and light weight tool which will help in searching the required class files in the big project code.
    JarScan.jar file can be downloaded from below link.
    http://www.softpedia.com/get/System/File-Management/JarScan.shtml

    JarScan helps when you are having problems finding a class that you need in order to compile your project. It will locate the class files in no time at all.
    Requirements:
    · Java 1.4 or above
    Download
     Usage : 
    1. To search class xyz
    java -jar e:\jarscan.jar -class xyz

    2.To display the help message type: 
    java -jar jarscan.jar -help OR java -jar jarscan.jar


    Hope this this helps my java mate ! :)

    Read more


    Shell script to pass arguments and validation of arguments in side shell

    The below is a simple shell script snippet which accepts two kinds of parameters(1. start 2. -start) while running.
    How to validate these parameters and how to run the shell script accordingly is the main motto :)
    set -x
    if [[ "$1" == "start" || "$1" == "-start" ]]; then
    echo "code for start action"
    else
    echo "Please input valid arguments"
    echo "Usuage: setup.sh start or setup.sh -start "
    exit
    fi

    Hope this helps in passing parameters to installer like scripts. 
    I observed the behavior of the same script differ in different shells like k shell and bash shell.
     

     
     

    Read more


    MANAGEMENT FUNCTIONS AND BEHAVIOUR (MS 1) IMP Questions and Answers

    I have compiled few improtant questions and their answers while preparing for MANAGEMENT FUNCTIONS AND BEHAVIOUR - MS 1 (MBA-IGNOU) exam. Please find the below PDF. Hope this helps :)
    MS 1 Imp Questions IGNOU MANAGEMENT FUNCTIONS AND BEHAVIOUR
    Old Papers :[1] [2]

    Read more


    How to broadcast your live video for streaming on internet ?

    How to broadcast your live streaming video on the internet ?
    This was most haunted question many computer geeks !This has made very simple with http://www.livestream.com/ .

    All you need to have is a good internet connection, Video source (Handy cam / Digi cam / Webcam / Mobile cam with supported Software) and Laptop / computer .
    http://www.ustream.tv/ is another best application which helps live streaming your events on net through phone.
    If you have an android phone you are ready to livecast your events. Log in to http://www.ustream.tv/ and create ur account and share the tube link for ur friends then install the ustream app on your android phone form market Ustream-app download for android . Now once ur 3G/Wifi connection is started on your phone you can start your own show.


    Live video by Ustream
    Once Internet is connected on your laptop login at http://www.livestream.com/ and start your own channel and start Go live and select your video source ! Thats it ! you all set to go LIVE ! :)


    kuube on livestream.com. Broadcast Live Free
    The above is my personal channel KUUBE, which K-tube for all my personal live casts !
    Today First time I tried the http://www.livestream.com/ site to broadcast my live videos.
    It is awesome and amazing. Best suits for multiple live broadcasring purposes like interacting with friends
    and live broadcasting your events like parties etc. I got this idea when most of our friends missed to attend one of my friends marriage event.
    Now there is no worry at all. You be any where just connect to http://www.livestream.com/ and broadcast your seld to be close with your loved ones.

    Below is my channel "Kuube" it is K-tube for all my live broadcasts

    Thanks you all for your great support and happy watching ... 

    Read more


    Sreesailam,Ishta kameswari,Alampur Jogulamba,Paataala Ganga, Akkamahadevi Caves

    Trip to Sreesailam, Nallamalai Ishta kameswari and Alampur Jogulamba
    This time I'm not the planner , I just joined with two of my friends who are very interested to visit this place again.
    Up on my interested request they extended the bookings for me also. Plan was simple start on Friday evening to Sreesailam by APSRTC bus and reach Sreesailam

    cover the places Sakshi Ganapati, Hatakeswaram , Lalitha peetam, phaala daara - pancha daara , sikaram and Chenchu Lakshmi Museum and visit to main temple of Sri Brahmarambika Mallikarjuna Swamy.
    And next to cover Rope way journey to paataala ganga, Trip to Damn and return journey to Karnool by bus and visit Alampur Jogulamba on the way before 10:30 to catch Bangalore express train in Karnool.

    It was well executed with out any interrupts. We reached majestic by 6 thinking that bus will leave sharply at 6:30 PM sharply. But it started at 7 PM and with many stops it reached sreesailam at 9:30 AM. Immediately with the help of a broker we got into one Lodge which was called as Telikala satram. Though we paid unnecessarily to broker we got really brand new AC room and it was a pleasure stay in between the nallamalai hills enjoying the damn view from the hotel room. Good thing is that they provided food for free.

    After quick fresh-up we started for local sight seeing to cover Sakshi Ganapati, Hatakeswaram , Lalitha peetam, phaala daara - pancha daara and sikaram by auto paying 50 INR per head. All the places are filled by Siva swamys and they were coming from different places by walk to here. As the road was single lane it was critical for drivers to drive in between. As that was shiva raatri season Temple committee started "Brahmotsavaalu" and full place was crowded with many groups performing different arts in front of Lord shiva. By 1 PM we finished visiting these places and lunch, next plan is to reach  NallaMala Ishta kameswari temple by commander jeeps. We were just three people and we have to wait for the jeep to fill minimum 10 people. They were charing around 250 per head and finally around at 2:45 pm we were able to start to that place and the whole road is full of rocks and the road was a difficult for any body to drive, I can say it's a good adventurous journey. I thoroughly enjoyed the ride and the scenic place near the temple.

    The ishta kameswari Deity was so beautiful and the temple was very very small. Any body has to bow-down their head and enter in the temple. Finally we were able to return to lodge by 6:45 pm.
    And after fresh-up we visited the main temple and then returned to room and took rest.

    The next day early morning we got fresh-up and went to main temple for darshan of Sreesaila Jyotirling and visited "Vrudda mallana" and other small temples inside the premises.Then after breakfast we went to patalaganga by rope-way and visited damn by boat. From there AP tourism is providing packaged tours to Akkamahadevi caves which are quite famous in this place but due to lack of time we couldn't go there.

    Finally we returned home and packed-up luggage to catch the Karnool bus. Luckily with uma maheswara swamy blessings we three got seats in the bus. We reached karnool town around at 5 PM , immediately from bus stop we hired one auto to go to Jogulamba temple in alampur for 400 INR. We reached the temple premises very quickly in less than 40 mins due to the village routes chosen by driver.

    Jogulamba temple in alampur is one of the powerful temple among the ashtadasa shakti peetas. There were no bounds to my joy when I see the Tungabadra river in the the evening just beside the temple. It's really worthy trip at the end.

    Read more


    Grep multiline pattern between two words. find particular block from set of files.

    Grep Multi-line pattern between two words. find particular block from set of files.
    The below shell script searches the list of java files in the current directory and try to look for the catch blocks that doesn't contain any logger initiated messages.
    Ex file :
    public class Download extends HttpServlet {

    static final String sccsId = "%Z%%M% %I% %W% %G% %U%";

    private static final PDLogger msgLogger = Logger.getCDSLoggerByName(Logger.PORTAL_LOGGER);
    private static final String className = Download.class.getName();

    static PublicKey anonymousPublicKey;
    // standard anonymous public Key
    static {
    try {
    KeyPairGenerator keyGen = null;
    keyGen = KeyPairGenerator.getInstance("RSA");
    keyGen.initialize(1024);
    KeyPair keyPair = keyGen.generateKeyPair();
    anonymousPublicKey = keyPair.getPublic();
    } catch (Exception ex) {
    msgLogger.exception(Level.DEBUG_MIN, className, "{static}", ex);
    }

    }
    }

    In the above file there is logger initiated message so, the script won't report any thing. But in case it won't find any keyword "logger" in catch block it reports the information.

    Shell Script to recognize multi-line pattern :
    #!/bin/sh
    echo "Starting Recursive catch block search on the Dir : `pwd`"
    fileCount=1
    for i in `find . -name '*.java'`
    do
    echo "Working with file no:$fileCount and the file is:$i"
    let fileCount="fileCount+1"
    ttl=`cat $i | wc -l`
    n=1
    TTL=`cat $i | grep -c catch`
    while read line
    do

    found=`echo $line | grep -i "catch" | sed 's/ //g' | cut -d "(" -f1`
    if [ $found ]; then
    while [ $n -le $TTL ]
    do
    begLineno=`grep -n catch $i | sed -n "$n"p | cut -d ":" -f1`
    EndLineno=`sed = $i | sed 'N;s/\n/:/' | sed -n $begLineno,${ttl}p | grep -v "catch" | grep "}" | sed -n 1p | cut -d ":" -f1`
    Logfound=`sed -n $begLineno,${EndLineno}p $i | grep -i Logger | sed 's/ //g' | cut -d "(" -f1 | sed -n 1p`
    if [ $Logfound ]; then
    echo "Logger message found In the $begLineno,$EndLineno Range Catch block" >> FoundLog.log
    else
    echo "No Logger messages(s)found In the $begLineno,$EndLineno Range Catch block in file $i" >> NotFound.log
    fi
    n=`expr $n + 1`
    done
    fi
    done<$i
    done

    Hope this helps !

    Read more


    eWAS installation and Configuration

    Since long time I know that there exists a eWAS which is express edition, but never played with it.
    Today I got a chance to play with and deploy my project in it.

    I got the installers from the below urls

    http://bob.greenock.uk.ibm.com/tgl_build/embedded_products/ewas/7.0.0.7/EmbeddedExpress_wintel_ia32.zip
    http://bob.greenock.uk.ibm.com/tgl_build/embedded_products/ewas/7.0.0.7/EmbeddedExpress_linux_ia32.zip

    Installation :
    It's simple zip file which will be extracted to desired location when we pass the path where it has to be
    by running the below command

    nc184197:/opt/builds/eWAS7 # ./install.sh -installRoot /opt/IBM/EWAS

    +---------------------------------------+
    +       EWAS Version 7.0 Install        +
    +---------------------------------------+

        Validating target directory ...
        Copying files ...
        Setting permissions ...
        Installation complete.

    Now the next job is to create a profile :
    nc184197:/opt/IBM/EWAS/bin # ./manageprofiles.sh -create -templatePath /opt/IBM/EWAS/profileTemplates/default/ -profileName AppSrv01 -profilePath /opt/IBM/EWAS/AppServer/AppSrv01
    INSTCONFSUCCESS: Success: Profile AppSrv01 now exists. Please consult /opt/IBM/EWAS/AppServer/AppSrv01/logs/AboutThisProfile.txt for more information about this profile.
    nc184197:/opt/IBM/EWAS/bin #
    nc184197:/opt/IBM/EWAS/AppServer/AppSrv01/bin # ./startServer.sh server1
    ADMU0116I: Tool information is being logged in file
               /opt/IBM/EWAS/AppServer/AppSrv01/logs/server1/startServer.log
    ADMU0128I: Starting tool with the AppSrv01 profile
    ADMU3100I: Reading configuration for server: server1
    ADMU3200I: Server launched. Waiting for initialization status.
    ADMU3000I: Server server1 open for e-business; process id is 16248
    I guess rest of the things are simple and same ...


    To create secure profile in normal WAS -
    [root@nc9118041006 bin]# ./manageprofiles.sh -create -templatePath /opt/IBM/WebSphere/AppServer/profileTemplates/default/ -profileName AppSrv02 -profilePath /opt/IBM/WebSphere/AppServer/profiles/AppSrv02 -enableAdminSecurity -adminUserName krishna -adminPassword krishna

    Read more


    SQL1013N The database alias name or database name ..could not be found SQL0843N

     While creating New databse If you are facing any of the below errors .. please follow the below solution.
    db2inst1@nc184158:~/db2inst1/NODE0000/SQL00001> db2 -tf /opt/builds/DCD1321/MC/cds_db2_admin.sql
    SQL1005N  The database alias "CDSDB" already exists in either the local
    database directory or system database directory.

    SQL1013N  The database alias name or database name "CDSDB" could not be found.
    SQLSTATE=42705

    DB21034E  The command was processed as an SQL statement because it was not a
    valid Command Line Processor command.  During SQL processing it returned:
    SQL1024N  A database connection does not exist.  SQLSTATE=08003

    SQL0843N  The server name does not specify an existing connection.
    SQLSTATE=08003

    SQL1013N  The database alias name or database name "CDSDB" could not be found.
    SQLSTATE=42705


    SQL1005N The database alias "<name>" already exists

    Solution

    1. Db2 get dbm cfg | grep DFTDBPATH ( if unix , windows check for DFTDBPATH)
    2. Db2 catalog db dbname on DFTDBPATH
    3. Db2 terminate
    4. Db2 drop db dbname
    5. Then create db

    Read more


    How to change the location of Data file used by a Table space in Oracle?

     How to change the location of Datable used by a Table space in Oracle?
    Process to change the location of TABLE SPACE file in oracle :
    Note : The below steps are very sensitive; not run by normal users. It is recommended to run with the help of Oracle DBA prior taking backups. If any problem happens the old data might be lost.
     1. Confirm and note down the existing Data file location for both  CDS_TEMP_TS and CDS_TS by running the SQL commands.
         Ex : current Data file locations are
    •      C:\ORACLE\PRODUCT\10.2.0\DB\DATABASE\CDS_TEMP_TS.DBF
    •      C:\ORACLE\PRODUCT\10.2.0\DB\DATABASE\CDS_TS.DBF
     2. Down the Oracle instance by running below command in the SQL prompt.
    • SQL > shutdown immediate;
     3. Now identify the new location where you want to maintain your new data files; and move the CDS_TEMP_TS.DBF and CDS_TS.DBF files from old location to new location manually.
         Ex : For new location of Data files.
    • C:\DCD_DB\CDS_TEMP_TS.DBF
    • C:\DCD_DB\CDS_TS.DBF 
     4. Come out of the sql prompt and re login to SQL prompt separately
    slplus sys as sysdba; Provide password and connect to idle instance.
     5.start the Oracle and mount it with the below command
    • SQL> startup mount;ORACLE instance started.Total System Global Area  612368384 bytes
      Fixed Size                  1250428 bytes
      Variable Size             188746628 bytes
      Database Buffers          415236096 bytes
      Redo Buffers                7135232 bytes
      Database mounted.
       6. Now run the below commands at SQL> to associate the new data file location with database.
    • alter database rename file 'C:\oracle\product\10.2.0\db\database\CDS_TEMP_TS.DBF' to 'C:\DCD_DB\CDS_TEMP_TS.DBF';
    • alter database rename file 'C:\oracle\product\10.2.0\db\database\CDS_TS.DBF' to 'C:\DCD_DB\CDS_TS.DBF';
    • alter database open;
     7. Now exit the existing SQL prompt and relogin to new SQL prompt.
    • sqlplus "sys/oracle@orcl as sysdba" 
     8. Now check the new Data file locations by running the below commands at SQL prompt; to confirm the usage of new Data file locations by your database.
    •  SQL> select tablespace_name,file_name from dba_temp_files where tablespace_name LIKE 'CDS%';
    •  SQL> select tablespace_name,file_name from dba_data_files where tablespace_name LIKE 'CDS%'; 
     9. Now Start your DCD and check the working of DCD and observe the old data as well.

    Where are Oracle logs Reflecting this ? 

    SQL> show parameter dump;
    NAME                                 TYPE        VALUE
    ----------------------------------- --------- -----------------------------
    background_core_dump                 string      partial
    background_dump_dest                 string      C:\ORACLE\PRODUCT\10.2.0\ADMIN
                                                     \ORCL\BDUMP
    core_dump_dest                       string      C:\ORACLE\PRODUCT\10.2.0\ADMIN
                                                     \ORCL\CDUMP
    max_dump_file_size                   string      UNLIMITED
    shadow_core_dump                     string      partial
    user_dump_dest                       string      C:\ORACLE\PRODUCT\10.2.0\ADMIN
                                                     \ORCL\UDUMP
    SQL>
    C:\ORACLE\PRODUCT\10.2.0\ADMIN\ORCL\bdump
    check the " alert_orcl.log " which shows the commands and details used to create CDS_TEMP_TS and CDS_TS.

    Reference : http://www.orafaq.com/wiki/Move_datafile_to_different_location 

    Read more

    Popular Posts

    Enter your email address:

    Buffs ...

    Tags


    Powered by WidgetsForFree

    Archives