Archive for February, 2012:


Few useful js / jquery functions in day today life

/*Element auto scroller*/ function scroll_to_bottom(obj,speed){ //$(‘html, body’).animate({scrollTop: $(‘html, body’)[0].scrollHeight}); if(!obj){ obj = $(‘html, body’); } if(!speed){ speed = ”; } obj.animate({scrollTop: obj[0].scrollHeight},speed); } function scroll_to_top(obj,speed,top_margin){ //$(‘html, body’).animate({scrollTop:0}); if(!obj){ obj = $(‘html, body’); } if(!speed){ speed = ”; } if(!top_margin){ top_margin = 0; } obj.animate({scrollTop:top_margin},speed); } usage $(document).ready(function(){ var obj = $(‘.class_of_element’); Or var obj =

(Read More…)

Few useful php functions in day today life..!

Few useful php functions in day today life..! /*This function strip html tags you want , Inside text area. In database those tags will not inserted */ function strip_only($str) { $tags = array(‘html’,'body’,'style’,'div’, ‘table’,'tr’,'td’,'script’,'img’); if(!is_array($tags)) { $tags = (strpos($str, ‘>’) !== false ? explode(‘>’, str_replace(‘#is’, ”, $str); return $str; } /*Returns ‘——-’ if variable passed

(Read More…)

Get IP Address of server by sql query

Script which will give IP Address of server by sql query. CREATE TABLE #temp1 (sql_ip varchar(3000)) insert into #temp1 exec xp_cmdshell ‘ipconfig’ DECLARE @ipaddress varchar(300) — subject to localisation SET @ipaddress = (SELECT top 1 sql_ip from #temp1 where sql_ip like ‘%Address%’ order by sql_ip DESC) declare @len int set @Len = CHARINDEX(‘:’, @ipaddress) SELECT

(Read More…)

nice quotes

“The greatest discovery of any generation is that a human being can alter his life by altering his attitude.”

jquery validate addon functions

$(document).ready(function(){ jQuery.validator.addMethod( “intgrt0″, function(value, element) { return value.match(/^([1-9]{1}[0-9]*)$/); }, “Please enter a quantity greater then 0 & it should not start with 0″ ); /*email*/ jQuery.validator.addMethod( “emailproper”, function(value, element) { return value.match(/^[A-Za-z0-9]+\w*([\.-]\w+)*@\w+([\.][A-Za-z0-9]{2,3})+$/); }, “Please enter proper email like abc@domain.com” ); /*Letters only*/ jQuery.validator.addMethod(“lettersonly”, function(value, element) { return this.optional(element) || /^[a-zA-Z\s]+$/i.test(value); }, “Please enter Characters only”);

(Read More…)

© Open Source Rocks