Showing posts with label .net tip and trick. Show all posts
Showing posts with label .net tip and trick. Show all posts

Thursday, December 29, 2016

Increase performance of IF ELSE condition ASP.NET

static void Main(string[] args)
{
Stopwatch obj=new Stopwatch();
obj.Start();
for(int i=0;i<10000;i++)
{
string str=getdesignation('M');
}

obj.Stop();

console.WriteLine(obj.ElaspsedTicks.ToString());
}


When user login mostly give top wrost performance
public static string getdesignation(char c)
{
if(c=="M")
return "Manager";
else if(c=="W")
return "Worker";

}
Increase Performance:
public static string getdesignation(char c)
{
if(c=="W")
return "Worker";
else  if(c=="M")
return "Manager";


}

GET Connection String in asp.net?

Open the Notepad.exe


Save file "myconection.udl"

then open notepad the Get conecting string details

What is JIT?

JIT
Its is configuration  code to machine language OS Hardware config



Just In time Complier

How types of Just In time Complier?

Per File
PEr Method/Function
Code Fragment

What is Intermediate Language?

expands Intermediate language
Partially compiled or half compiled language

Its run JIT

Thursday, April 9, 2015

Sharepoint:How to disable options cut, copy, paste, right click using JavaScript in SharePoint page ?

Sharepoint:How to disable options cut, copy, paste, right click using JavaScript in SharePoint page

disable options cut, copy, paste, right click using JavaScript

  • Below is the simple jQuery code which will disable cut and copy from a web page
  • Remove copy paste option you will have to disable right click
  • allow the users to use the right click to copy, paste, or by using ctrl+C , ctrl+v to copy and paste


Javascript:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Disabling options cut, copy, paste, right click and context menu using Javascript </title>
<script type="text/javascript">
//below javascript is used for Disabling right-click on HTML page
document.oncontextmenu=new Function("return false");//Disabling right-click


//below javascript is used for Disabling text selection in web page
document.onselectstart=new Function ("return false"); //Disabling text selection in web page
if (window.sidebar){
document.onmousedown=new Function("return false");
document.onclick=new Function("return true") ;


//Disable Cut into HTML form using Javascript
document.oncut=new Function("return false");


//Disable Copy into HTML form using Javascript
document.oncopy=new Function("return false");


//Disable Paste into HTML form using Javascript
document.onpaste=new Function("return false");
}
</script>
</head>
<body>

</body>
</html>

<html>
<head>
</head>
<body oncopy="return false;" onpaste="return false;" oncut="return false;">


</body>
</html>
Step 1:you have to add Script Editor webpart
Step 2: Above the copy and paste your Script editor Webpart