Wednesday, June 11, 2014

Find the 1’s Compliment for the binary number in the SQL SERVER

Example :-1

1’s Complete Example

Declare @MainChar Varchar(Max)='0101010101'
set @MainChar=replace(replace(replace(@MainChar,'1','a'),'0','1'),'a','0')
select @MainChar

output
1010101010


Example :-2

1’s Complete Example

Declare @MainChar Varchar(Max)='000000'
set @MainChar=replace(replace(replace(@MainChar,'1','a'),'0','1'),'a','0')
select @MainChar

output
111111

Example :-3 

1’s Complete Example

Declare @MainChar Varchar(Max)='11111'
set @MainChar=replace(replace(replace(@MainChar,'1','a'),'0','1'),'a','0')
select @MainChar

output

00000
Read More »

Find the 2’s Compliment for the binary number in the SQL SERVER

2’s Complete Example

Declare @MainChar Varchar(Max),@ReveL Varchar(Max),@ReveR Varchar(Max)
set @MainChar='0010010010'
if(len(replace(@MainChar,'0',''))>0)
begin
set @MainChar=replace(replace(replace(@MainChar,'1','a'),'0','1'),'a','0')
set @MainChar=REVERSE(@MainChar)
set @ReveL=replace(replace(replace(SUBSTRING(@MainChar,1,CHARINDEX('0', @MainChar)),'1','a'),'0','1'),'a','0');
set @ReveR=SUBSTRING(@MainChar,CHARINDEX('0', @MainChar)+1,Len(@MainChar)-(CHARINDEX('0', @MainChar)))
select REVERSE(@ReveL+@ReveR)
end
else
select @MainChar

output

1111011110
Read More »

Convert Textbox in the Custom Language Transliteration in ASP.Net

Create on sample we page and write this code below


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LanguageTextBox.aspx.cs"
    Inherits="SampleTestingCodes.LanguageTextBox" ClientIDMode="Static" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load("elements", "1", {
            packages: "transliteration"
        });
        var control = null;
        function GetConvertText() {
            var options = {
                sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage: [google.elements.transliteration.LanguageCode.TELUGU],
                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };
            // Create an instance on TransliterationControl with the required options.
            control = new google.elements.transliteration.TransliterationControl(options);
            control.makeTransliteratable(['TextBox1']);
        }
       
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    <asp:TextBox ID="TextBox1" runat="server" onKeyup="GetConvertText();"></asp:TextBox>
    </form>
</body>
</html>




Happy coding  JJJJJJJJJJJJJJJJJJJJJJJ
Read More »