Categories
Code

IE8 checkbox not printing bug fix using jQuery

checkbox IE8 bug

IE8 has a bug where if you check a checkbox then print the form the checkbox does not show as being checked. MSFT bug #431489 I’ve found that this piece of code solves that problem and it works for HTML5.

IE8 checkbox printing bug FIX

// fix for ie8 printed checkbox bug
$('input[type=checkbox]').live('change', function(){
	if($(this).is(':checked')){
		$(this).attr('checked', true);
	} else {
		$(this).attr('checked', false);
	}
});

You can also try this method of changing the DOCTYPE tag if you don’t need HTML5 markup.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

Categories
Code Tutorials

How to create a 1 gig file

dd if=/dev/zero of=big-file.bin bs=1g count=1

or

mkfile 1g big-file.bin

Categories
Code Tutorials Work

How to tar a directory and only include certain file types

find myProjectDirectory -type f \( -name \*\.php -o -name \*\.js -o -name \*\.css -o -name \*\.inc \) | xargs tar -rf myProjectTarName.tar
Categories
Code Tutorials Work

How to change file or folder permissions recursively with chmod

To set only files that end with .tpl to 600 (pattern escaped with slashes)

find . -name \*\.tpl -exec chmod 600 {} \;