Programming
Batch Files
- Hidden gotcha: The command processor’s AutoRun setting
- HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
- HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
PHP Code Analysis
- *[http://www.program-transformation.org/PHP/PhpSat PHP-sat: PHP static analysis tool]
- *[http://www.owasp.org/index.php/Category:OWASP_SWAAT_Project Category:OWASP SWAAT Project]
- *[http://www.fortifysoftware.com/security-resources/rats.jsp RATS – Rough Auditing Tool for Security]
PNG Images in IE6
Transparency in PNG images is not supported in IE6 natively. Here are some work-arounds.
- IE6 PNG Fix by Twin Helix — this is a very good fix, but there are a couple of gotchas.
- First, applying the behavior to all IMG and DIV tags results in some instability–lots of crashes and very slow load times.
- Second, there’s also a minor issue with relatively and absolutely positioned links that has a PNG background–a warning is shown that the link may not be accessible; I’ve found no instance where this is actually the case, so I have commented out the alert line in the .htc file.
- Third, applying the behavior to many elements results in IE6 hanging on initial page load. Waiting for 2+ minutes or refreshing the page usually results in the browser unfreezing.
- IE behaviour
- Christopher Schmitt’s method
Programming Articles
- Martian Headsets — by Joel S — about the web and how we got to where we are with standards, etc.
- How Microsoft Lost the API War — by Joel S — about how Microsoft made the switch away from being compatibility-centric
- The End of Dumb Software — by Seth Godin
- Alex’s Soapbox — A great series of articles by Alex Papadimoulis
Find absolute position of an element
While working on a project, I discovered that I needed to find the absolute coordinates of an element in a page in order to dynamically position another element before showing it.
A quick Google search yielded this gem from quirksmode.org: JavaScript – Find position.
Here’s the condensed code:
/** * Determines the absolute position of an element * * @author Peter-Paul Koch * * @see http://www.quirksmode.org/js/findpos.html * * @param object obj The element whose absolute position is to be found. * @return array An array with two elements: 0 is the left position, 1 is the top position. */ function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curleft,curtop]; } }
text/application type is deprecated
This was news to me–RFC4329 explicity declares text/javascript to be obsolete. Instead, application/javascript is to be used. The problem? Not all browsers support it yet.
Here’s the breakdown:
Firefox
- Firefox 3.5.4 – supported
Internet Explorer
- IE 8 – NOT supported
Safari
- Safari 4.0.3 – supported
Chrome
- Chrome 3.0 – supported
Determining if a method was called statically
In PHP, it’s occasionally helpful to call a method sometimes statically and sometimes from class instance. Figuring out which way a method has been called is pretty straightforward, thanks to a function posted in the PHP documentation:
<?php
function foo () {
$isStatic = !(isset($this) && get_class($this) == __CLASS__);
}
?>