Tuesday, December 14, 2010

Auto refresh parent window after closing popup - Dev Articles

Auto refresh parent window after closing popup - Dev Articles
useful codes to refresh parent/main window when a popup closes.

function refreshParent() {   window.opener.location.href = window.opener.location.href;    if (window.opener.progressWindow)     {     window.opener.progressWindow.close()   }   window.close(); }


window. operner. location. reload();

Monday, December 13, 2010

Check visibility of item in jQuery

var isVisible = $('#as_txt_techname').is(':visible');
isVisible will return true if it is visible, false if it is not

PHP SELF

some servers cannot support PHP_SELF, to be safe, use $_SERVER['PHP_SELF'];

Thursday, December 9, 2010

Refreshing another window for the same browser using javascript

window.opener.location.reload()

can also replace opener with window name if previously set with window.name = "main";

Wednesday, December 1, 2010

How to use ArrayList in Java

How to use ArrayList in Java
Useful tips here, but it din mention the big frustration I have today when using ArrayList.
when reassigning the same array to an ArrayList, make sure to reinitialize the Array, or else all items inside the ArrayList will refer to the same array and u will have duplicates of the last Array

Object[] tempObj = new Object[3];
while ((s = br.readLine()) != null) {
if(c == (rowItems)){
c = 0;
tempObj = new Object[3];//REINITIALIZE HERE
}
//if (s != null && s.equals("")==false) {
tempObj[c] = s;
System.out.println("Line" + c + ": " + tempObj[c]);
//}
if (c == (rowItems - 1)) {
userData.add(tempObj);
System.out.println("Expected result: \'" + tempObj[0].toString() + "\', \'" + tempObj[1].toString() + "\', \'" + tempObj[2].toString() + "\'");
}
c++;
}

Wednesday, October 27, 2010

4shared.com - perkongsian dan storan fail percuma

4shared.com - perkongsian dan storan fail percuma
great file sharing site

check which item is selected in a radio button group

$('#edit-checkbox-id').is(':checked');

Dynamically create drop down list for maximum compatibility

The W3C DOM Level 2 HTML defines an add method for the select element object

but not for the options collection. However using that method is
difficult as IE implements the method with the same name with different
parameters.
If you simply want to add an option then using the DOM Level 0
var select = document.forms.formName.elements.selectName;
select.options[select.options.length] = new Option('text', 'value');

is much better in terms of browser compatibility.
[color=blue]
> anOption.innerText = "NewElement";[/color]

Firefox does not support the innerText property at all. For option
element objects you can set
anOption.text
[color=blue]
> anOption.Value = "99";[/color]

JavaScript is case sensitive, the property is named value and not Value.

Tuesday, October 26, 2010

Mozilla id attr issue

Mozilla seems to have problem when mixing small cap n big caps letter in the id attr, example <div id="txtVAns">, better use all small caps next time