Friday, October 21, 2011

Connection attempt failed with "ECONNREFUSED

Status: Connecting to ...
Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server".
Error: Could not connect to server
Status: Waiting to retry...

Have you faced it before when using FileZilla? I just faced it just now.Previously, I get connected without problem but suddenly it happen.Stress, I google, some said due to antivirus some said due to firewall.So I open my MCAfee and try to uncheck something UNBLOCK like below and puff... the error goes away.

Thursday, October 20, 2011

Convert array to string and put delimiter to separate the elements

Can you see it? Well the output should be like  "1,2,3"

Saturday, October 15, 2011

Dynamically check/tick the related check boxes whenever one of it's group is checked

Imagine if you have multiple groups of check boxes and inside the group it self contain multiple check boxes. The user want if they select one check box , all the check boxes in the same group will be checked.So the same thing happen when the user unchecked the check box.It will ensure that all the member in the group will be checked or unchecked.(Just wondering why they don't to use radio button, only one for one group??!!Maybe they have the reason, and I forgot ..)

With my brain damage, I stayed up till 2.00 am plus because I cannot find it in Google.Surely got somewhere in Google but maybe I didn't type the correct keywords.

So at last, after trying and modifying then I got the result.If you find it useful then, enjoy !

function checkGroup(str,field) {
 
     var fieldid;
     var criteria;
     var checkedValue=str.checked
           str=str.value;


 /*this gets the information we want to evaluate,i put substring because I name the checkbox with the  group id and    follow by increment_number for example 44411000-111888-1_1. The first 17 character is group id, so i use this   group id to identify which group the checkbox fall into */
  
   criteria = str.substring(0,17); 
 
  for (i=0; i<field.length; i++) {
          fieldid = field[i].value;
       if (fieldid.substring(0,17)==criteria) {
         field[i].checked = checkedValue;
       }
    
   }
}//checkGroupClaim

It called by:
<html:checkbox name="myForm" property="strCheck" value="<%=strIndex1.toString()%>" id="<%=strIndex1.toString()%>"  onClick="checkGroup(this,document.myForm.strCheck)"/>

Thursday, July 07, 2011

Syntax Error : Malformed SQL92

I got error

java.sql.SQLException: Malformed SQL92 string at position: 53

What is that? Not sure.Headache.Then I stare at the code..deeply

cStmt = con.prepareCall("call MYPACKAGE.MYPROCEDURE(?)}");

Nah..see the cause?
cStmt = con.prepareCall("call MYPACKAGE.MYPROCEDURE(?)}");

Now you see... the correct version should be like this.

cStmt = con.prepareCall("{call MYPACKAGE.MYPROCEDURE(?)}");

Simple '{' can make my life haywire.My clumsiness cannot be helped!

Package Error : ORA-06550 and PLS-00201

I called my package in Oracle through jdbc like this :

int num = 0;
CallableStatement cStmt = null;
cStmt = con.prepareCall("{call MYPACKAGE.MYPROCEDURE(?)}");
cStmt.registerOutParameter(1, OracleTypes.NUMERIC)
cStmt.execute();
num=cStmt.getInt(1);

Get exception like below :


java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00201: identifier 'MYPACKAGE.MYPROCEDURE' must be declared
After headache for hours, then I saw the light. CREATE SYNONYM,GRANT ACCESS for that package!


CREATE OR REPLACE PUBLIC SYNONYM MYPACKAGE FOR MYPACKAGE;
GRANT EXECUTE ON  MYPACKAGE TO USERNAME;
The error went pooofff  away. Always forget about basic thing!

Friday, April 29, 2011

Play with Kornshell

Create test.ksh file


#!/bin/ksh
echo inout yes or no
read answer
case $answer in
 yes|Yes|y)
   echo got a positive answer
   #the following ';;' is mandatory for every set
   #of comparative xxx) that you do
   ;;
 no)
   echo got a 'no' ! ':('
   ;;
 q*|Q*)
   #assume the user wants to quit
   exit
   ;;
 *)
   echo This is the default clause
   ;;
esac

Make sure you write #!/bin/ksh at the top  of your file

I use this to give permission

> chmod 0755 test.ksh

Run the file

>./test.ksh
>ksh: ./test.ksh:  not found  <-- upps I got this error

So I try use this command
>ksh test.ksh
>test.ksh[2]: ^M:  not found  <--- upp this error meaning something to do with space


Use dos2unix,
>dos2unix -437 test.ksh test1.ksh
>dos2unix -437 test1.ksh test.ksh  

-437 is use to avoid this error
could not open /dev/kbd to get keyboard type US keyboard assumed
could not get keyboard type US keyboard assumed

After this maybe you can delete test1.ksh.I am not sure how to dos2unix using only one file, will dig it out later

>chmod 0755 test.ksh
>./test.ksh      <---- I can use this command back instead of   > ksh test.ksh

Yey!! The output something like below, of course depend on your input

inout yes or no
no
got a no ! :(



Reference : http://www.bolthole.com/solaris/ksh.html