Thursday, March 3, 2011

JavaScript Multiple Select Code

Struts Select Tag:

<s:select list="assignedMembers" name="assignedTo1" id="assignedTo1"  size="8"  cssClass="inputSelectExtraLarge" value="%{currentRequirement.assignedTo}" multiple="true" onclick="listbox_moveacross('assignedTo1', 'assignedTo')"/>

JavaScript Function For Moving Items:

--> listbox_moveacross('source Id', 'Destination Id')

JavaScript Function Def:


<script type="text/JavaScript">
            function listbox_moveacross(sourceID, destID) {
                var src = document.getElementById(sourceID);
                var dest = document.getElementById(destID);

                for(var count=0; count < src.options.length; count++) {

                    if(src.options[count].selected == true) {
                        var option = src.options[count];

                        var newOption = document.createElement("option");
                        newOption.value = option.value;
                        newOption.text = option.text;
                        newOption.selected = true;
                        try {
                            dest.add(newOption, null); //Standard
                            src.remove(count, null);
                        }catch(error) {
                            dest.add(newOption); // IE only
                            src.remove(count);
                        }
                        count--;

                    }

                }

            }

            function listbox_selectall(listID, isSelect) {

                var listbox = document.getElementById(listID);
                for(var count=0; count < listbox.options.length; count++) {

                    listbox.options[count].selected = isSelect;

                }
            }


        </script>

Generating List  :

 if(currentRequirement.getAssignedTo()!=null){
                        assignedList=new ArrayList();
                        String names[]=currentRequirement.getAssignedTo().split(",");
                        for(int i=0;i<names.length;i++){
                            assignedList.add(names[i]);
                        }
                    }

Getter and Setter method for assainList has to be added.
private List assainList;

Thursday, February 10, 2011

Creating Queue manager using Command Prompt.

****************************************
* Command: crtmqm  -q Apple
****************************************
WebSphere MQ queue manager created.
Creating or replacing default objects for Apple.
Default objects statistics : 43 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
exitvalue = 0
****************************************
* Command: amqmdain qmgr start Apple
****************************************
WebSphere MQ queue manager 'Apple' starting.
5 log records accessed on queue manager 'Apple' during the log replay phase.
Log replay for queue manager 'Apple' complete.
Transaction manager state recovered for queue manager 'Apple'.
WebSphere MQ queue manager 'Apple' started.
exitvalue = 0
****************************************
* Command: runmqsc Apple
* Input: DEFINE LISTENER('LISTENER.TCP') TRPTYPE(TCP) PORT(3414) CONTROL(QMGR)
****************************************
5724-H72 (C) Copyright IBM Corp. 1994, 2004.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager Apple.


     1 : DEFINE LISTENER('LISTENER.TCP') TRPTYPE(TCP) PORT(3414) CONTROL(QMGR)
AMQ8626: WebSphere MQ listener created.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
exitvalue = 0
****************************************
* Command: runmqsc Apple
* Input: START LISTENER('LISTENER.TCP')
****************************************
5724-H72 (C) Copyright IBM Corp. 1994, 2004.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager Apple.


     1 : START LISTENER('LISTENER.TCP')
AMQ8021: Request to start WebSphere MQ Listener accepted.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
exitvalue = 0
****************************************
* Command: amqmdain auto Apple
****************************************
5724-H72 (C) Copyright IBM Corp. 1994, 2004.  ALL RIGHTS RESERVED.
Queue Manager 'Apple' successfully set to 'Automatic' mode
exitvalue = 0

Tuesday, February 8, 2011

Emails Seperator from Text File


<!-- TWO STEPS TO INSTALL EXTRACT EMAIL ADDRESSES:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Ronnie T. Moore, Editor -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function findEmailAddresses(StrObj) {
var separateEmailsBy = ", ";
var email = "<none>"; // if no match, use this
var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
if (emailsArray) {
email = "";
for (var i = 0; i < emailsArray.length; i++) {
if (i != 0) email += separateEmailsBy;
email += emailsArray[i];
      }
   }
return email;
}
//  End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<center>
<form>
<textarea name=comments rows=10 cols=50 onBlur="this.form.email.value=findEmailAddresses(this.value);"></textarea>
<br>
Email:  <input type=text name=email>
</form>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

Monday, February 7, 2011

Persistence Through Mb Sample Code

Hi All:
CREATE COMPUTE MODULE selectDatabase_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
        -- CALL CopyMessageHeaders();
        -- CALL CopyEntireMessage();
        DECLARE a INTEGER;
        DECLARE Sname CHARACTER;
       
    --    SET a=InputRoot.XMLNSC.message.a;
        --SET Sname =
        SET OutputRoot.XMLNSC.message.
Result[]=PASSTHRU('SELECT SNAME,SNO FROM STUDENT   WHERE SNO= ? WITH UR',InputRoot.XMLNSC.message.a);
        SET Environment.Sname=OutputRoot.XMLNSC.message.Result[1].SNAME;
        SET OutputRoot.XMLNSC=null;
        SET OutputRoot.XMLNSC.Result=Environment.Sname;
        RETURN TRUE;
    END;
// the code above coloured is Mb generated code.





For insertion into the database:


CREATE COMPUTE MODULE selectDatabase_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
        -- CALL CopyMessageHeaders();
        -- CALL CopyEntireMessage();
       
    PASSTHRU('INSERT INTO STUDENT(SNO,SNAME) VALUES(?,?) ',InputRoot.XMLNSC.message.a,InputRoot.XMLNSC.message.b);
    RETURN TRUE;
    END;