Archive for the ‘Uncategorized’ Category
PHP Power Set
Thursday, January 22nd, 2009Here is a snippet that shows how to get the power set of an array.
/**
* Takes the power set of a one dimensional array and returns a 2-D array.
* array(a,b,c) ->
* array(array(a),array(b),array(c),array(a,b),array(b,c),array(a,b,c))
*/
function powerSet($in,$minimumNumber = 1) {
$count = count($in);
$members = pow(2,$count);
$return = array();
for ($i = 0; $i < $members; $i++) {
$b = sprintf("%0".$count."b",$i);
$out = array();
for ($j = 0; $j < $count; $j++) {
if ($b{$j} == '1') $out[] = $in[$j];
}
if (count($out) >= $minimumNumber) {
$return[] = $out;
}
}
return $return;
}
Which browsers load images that have display:none or visibility:hidden?
Thursday, January 15th, 2009Turns out all of them, with the sole exception of Opera 9, and only for display:none. It looks like Opera is the only browser that cares about the speed of the browsing experience.
browsers tested: IE 7, IE 6, FF 3.0, Safari, Chrome and Opera 9.
Test Page: http://janitor61.com/test/test.html
What the SWF
Wednesday, November 26th, 2008New SWF Properties application - What the SWF.
