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

 /*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;

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