Posts

Showing posts from December, 2005

GROUP BY techniques

Useful GROUP BY techniques (source: Jeff's Blog ( SQLTeam hosted)) for SQL Server developers. Rather than grouping unneccesarily columns, use a derived table. i.e. (SELECT ... FROM ... WHERE ... GROUP BY ...) AggregateTableName . Plus don't group expressions, but the columns that make up the expression. Tags: Web Developer Blog , SQL Server , SQL Team

PHP Email Encode

Function to encode an email address to help protect against spamming. function mailto_link($email) { $encoded = bin2hex($email); $encoded = chunk_split($encoded, 2, '%'); $encoded = '%'.substr($encoded, 0, strlen($encoded) - 1); $htmlencoded = substr(chunk_split(bin2hex(" $email"), 2, ";&#x"), 3,-3); return "<a href=\"mailto:$encoded\">$htmlencoded</a>"; } Takes an email address as the parameter and outputs an encoded mailto link. You could use this while looping through email records in a database for example. <?php echo mailto_link("user@example.com"); ?> Tags: Web Developer Blog , PHP

PortableApps.com

PortableApps.com is the new site for Portable Firefox / Thunderbird / FileZilla / OpenOffice etc. All of the applications on this site can be run from an external flash/hard drive. No installation neccessary. Just unzip and go. More applications will be on the site in the future. From operating systems and office suites to image editors and games. Tags: Web Developer Blog , Portable Applications

Extensions for Web Developers (Firefox / Internet Explorer)

A list of Firefox extensions that are useful for web development. The Web Developer Extension is a 'must have' for web developers (i.e. if you could only have one, it would be it). Some haven't been updated for Firefox 1.5 (or you may have to go to the extension authors homepage to get an updated version). Update (07 Dec 2005) : Add N Edit Cookies, DevBoi, Screen grab!, MozRef Sidebar. Update (20 Jan 2006) : Console², FireBug, View Cookies, View Rendered Source Chart. Update (25 Jan 2006) : IE View Lite. Aardvark (remove elements of a page, can view tag type/id/class) Add N Edit Cookies Codetch (WYSIWYG editor) ColorZilla (colour picker) Console² (JavaScript Console Replacement) DevBoi (web development documentation reference) EditCSS Fangs Screen Reader Emulator FireFTP FireBug (DOM Inspector + JavaScript console) Html Validator Hypertext DOM Browser IE Tab IE View IE View Lite (smaller download than IE View, by almost 10x) JavaScript Debugger L

getElementDimensions (JavaScript)

This function returns the dimensions of an element (left, right, top, bottom, width and height). You can pass on either a string (which gets the element by ID), or the element itself. function getElementDimensions(el) { if(typeof(el) == "string") { el = document.getElementById(el); } if(!el || !el.offsetParent) return false; var left = el.offsetLeft, top = el.offsetTop, width = el.offsetWidth, height = el.offsetHeight; do { el = el.offsetParent, left+= el.offsetLeft, top+= el.offsetTop; } while (el.offsetParent); return {"left" : left, "right" : left + width, "top" : top, "bottom" : top + height, "width" : width, "height" : height}; } Example use: var foo = document.getElementById("foo"); var fooDim = getElementDimensions(foo); if(fooDim) { alert(fooDim.left); } var barDim = getElementDimensions("bar"); if(barDim) { alert(barDim.top); } Tags: Web Developer Blog , JavaScrip