Free Code Collection

Developers

[jQuery] changing default thickbox behavior

by Hussain on Jul.05, 2009, under Developers, JQuery

To prevent closing by clicking on the overlay and remove the ‘close’ link
(better IMHO than just disabling it), remove line 38:
$("#TB_overlay").click(TB_remove);

remove the TB_closeWindow <div> from line 133:
$("#TB_window").append("<a href=” id=’TB_ImageOff’ title=’Close’><img
id=’TB_Image’ src=’"+url+"’ width=’"+imageWidth+"’ height=’"+imageHeight+"’
alt=’"+caption+"’/></a>" + "<div id=’TB_caption’>"+caption+"<div
id=’TB_secondLine’>" + imageCount + prev.html + next.html + "</div></div>");

remove line 135:
$("#TB_closeWindowButton").click(TB_remove);

remove the TB_closeAjaxWindow <div> from line 205:
$("#TB_window").append("<div id=’TB_title’><div
id=’TB_ajaxWindowTitle’>"+caption+"</div></div><iframe
frameborder=’0′
hspace=’0′ src=’"+urlNoQuery[0]+"’ id=’TB_iframeContent’
name=’TB_iframeContent’ style=’width:"+(ajaxContentW +
29)+"px;height:"+(ajaxContentH + 17)+"px;’ onload=’TB_showIframe()’>
</iframe>");

and 207:
$("#TB_window").append("<div id=’TB_title’><div
id=’TB_ajaxWindowTitle’>"+caption+"</div></div><div
id=’TB_ajaxContent’
style=’width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;’></div>");

remove line 210:
$("#TB_closeWindowButton").click(TB_remove);
and remove lines 258-259:
$("#TB_overlay").unbind("click");
$("#TB_closeWindowButton").unbind("click");


Thickbox also has a keydown handler so that if you push ‘escape’ it closes.
Remove lines 236-245 to prevent this:
document.onkeyup = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
TB_remove();
}
}


To add the ‘close’ functionality to something, do this:
$("#myTbCloseButton").click(TB_remove);

Source: (http://www.mail-archive.com/discuss@jquery.com/msg18856.html)
  • Share/Save/Bookmark
Leave a Comment :, , , , , , , , more...

Code Review

by Hussain on Jun.07, 2009, under Developers

Code reviews can often find and remove common vulnerabilities such as format string exploits, race conditions, memory leaks and buffer overflows, thereby improving software security. Online software repositories based on Subversion with Trac, Mercurial, GIT or others allow groups of individuals to collaboratively review code. Additionally, specific tools for collaborative code review can facilitate the code review process.

Automated code reviewing software lessens the task of reviewing large chunks of code on the developer by systematically checking source code for known vulnerabilities.

There are many examples of where it is claimed that adopting code reviews improved a software development project. Capers Jones ongoing analysis of over 12,000 software development projects showed that the latent defect discovery rate of formal inspection is in the 60-65% range. For informal inspection, the figure is less than 50%. The latent defect discovery rate for most forms of testing is about 30%. Other examples include:

  • Blender (software), a 3D graphics design package greatly improved by the open source development community.
  • Linux kernel, once a hobby project of Linus Torvalds, is now reviewed and improved by hundreds of programmers worldwide.
These claims can be hard to evaluate because each project was implemented only once; it’s not possible to know for sure how the project would have turned if it hadn’t adopted code reviews, or if it had instead adopted other quality control measures.

Source: wikipedia.org
  • Share/Save/Bookmark
Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Archives

All entries, chronologically...