Sunday, 24 August 2014

Date format using Javascript


Date format mm / dd / yyyy. We can chage format also.




window.onload = function currentDate()
{
var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; //January is 0!

    var yyyy = today.getFullYear();
    if(dd<10 span="">
        dd='0'+dd
    }
    if(mm<10 span="">
        mm='0'+mm
    }
    var today = mm+'/'+dd+'/'+yyyy;
$("#datetoday").html(today);
}

Digital Clock

This is a pretty cool way to display the time on your web page using jQuery to get the current time and then refresh the clock every 1 second.




function Clock ( )     {  

  var currentTime = new Date ( ); 
   var currentHours = currentTime.getHours ( ); 
   var currentMinutes = currentTime.getMinutes ();   


 var currentSeconds = currentTime.getSeconds ( );  

 currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;    

currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;     
  
   var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";   
   currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;     

  currentHours = ( currentHours == 0 ) ? 12 : currentHours;  
 
  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;     
           $("#clock").html(currentTimeString);
           }


  $(document).ready(function() {
    setInterval('Clock()', 1000);
}); 


Thursday, 14 August 2014

Avoiding Memory Leaks SP2010

In this article we will discuss how we can detect memory leaks while working SharePoint 2010 object model.
  1. Use Dispose() appropriately
  2. Use SPDisposeCheck utility to identify issues
  3. General rules[No need to dispose from SPContext, If  you used new you should use Dispose]
  4. Use dispose when  [enumerating AllWebs or Webs, open web]
  5. Don't use dispose with  [Parent web, RootWeb] 
Step 1: Go to C: --> ProgramFiles-->Microsoft-->SharepointDispose check
Step 2: Select SPDisposeCheck.exe. Copy fill path paste in CMD prompt


Step 3: Go to c:--> users\Select your user-->Documents\Visual Studio 2010\Projects\ExploringTheObjectmodel --> ExploringtheObjectModel --> Bin --> Debug
Copy this path and paste in cmd.

Step 4: Result of Out.txt.



Step 5: Open Code


Memory Leaks




 Step 6: Go to build Events --> post-build Event command Line paste fill path of  SPDisposeCheck.exe. 

Next

Output:






Saturday, 19 July 2014

what is difference between equals() and == operator?


For value comparison, with value type use “==” operator and for value comparison with reference type use “.Equals()” method.