Monday, 22 December 2014

How do I disable right click on my web page?

<script language="javascript">
document.onmousedown=disableclick;
status="Right Click Disabled";
Function disableclick(event)
{
  if(event.button==2)
   {
     alert(status);
     return false;    
   }
}
</script>
and
<body oncontextmenu="return false">
...
</body>

Thursday, 18 December 2014

Split test using delimiter and find last text

declare @abc nvarchar(200)='TM/OP/12012'
SELECT RIGHT(@abc,CHARINDEX('/',REVERSE(@abc),0)-1)

blink text using css html

The original Netscape <blink> had an 80% duty cycle. This comes pretty close, although the real <blink> only affects text:

use in css
    .blink {
      animation: blink 1s steps(5, start) infinite;
      -webkit-animation: blink 1s steps(5, start) infinite;
    }
    @keyframes blink {
      to {
        visibility: hidden;
      }
    }
    @-webkit-keyframes blink {
      to {
        visibility: hidden;
      }
    }
 
 
Use in html 
This is <span class="blink">blinking</span> text.

Wednesday, 17 December 2014

difference between WCF Services and Web Services and REST Service

Web Service is an abstract term encompassing a large variety of data providers for distributed systems. Perhaps you are referring to ASMX web services, which can still be found in the wild but aren't really widely used in new development these days.
WCF Service is Microsoft's implementation of SOAP. There are others implementations or you could roll your own (not recommended).
SOAP is a kind of stateful, session-based, message-based web service. It's good if your service is designed as a set of complex actions.
REST is a stateless, sessionless, resource-based web service. It's good if your service is designed to access data and perform simple CRUD operations on it. SOAP and REST are mutually exclusive. A service cannot be both. There are ways to manipulate vanilla WCF to make is RESTful but these techniques are becoming deprecated. If you want to implement a RESTful web service there are two main choices in the Microsoft world: WCF Data Services and ASP.NET Web API.

Wednesday, 3 December 2014

Select xml using sql table

SET NOCOUNT on
SELECT CountryId,CountryName
FROM Country
--WHERE ID = 1
FOR XML AUTO, ELEMENTS
SET NOCOUNT Off