Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Download: ASP.NET mvc4: Get response from authorize.net after payment (Auto redirect)

Tuesday

                 In this post we will learn how to get response from Authorize.Net credit card payment using ASP.NET MVC4

One of my client projects I need to implement Authorize.net payment gateway. So just implemented using SIM (Server Integration Method). But my client wants, if the payment getting success then shown a custom receipt page and save the transaction details in to our own database. In other case if the payment getting fail then provides repayment option.

In SIM method this is not possible (or not advisable) because we using “x_relay_response” to get response from Authorize.net. Note,this is just relay the url, not redirect to the result page. And URL always points to the https://test.authorize.net/gateway/transact.dll. And the response time also only 10 seconds. If your server not responds within 10 seconds then you get time out error like

“An error occurred while trying to report this transaction to the merchant. An email has been sent to the merchant informing them of the error. The following is a result of the attempt to charge your credit card.”

This error indicates that Authorize.Net is unable to connect to the page that you have specified as your relay response URL. To avoid this kind of errors you need to go with Authorize.net’s another one integration method AIM (Advanced Integration Method)


You can get more about AIM method from here http://www.authorize.net/support/AIM_guide.pdf

Implement  AIM :
First create a sandbox account in Authorize.Net. https://developer.authorize.net/sandbox/. After you registered you will get the API Credentials

API Login ID
Transaction Key
Secret Question

Create you view page as per your requirement. Here I'm taking from Authorize.net default payment screen



Then add that details  into your web.config file


<!-- Payment Authorize.NET - Begins --> <add key="Payment.AuthLoginID" value="XXXXXXXXXX" /> <add key="Payment.AuthTransactionKey" value="XXXXXXXXX" /> <add key="Payment.TestMode" value="true" /> <add key="Payment.URL" value="https://test.authorize.net/gateway/transact.dll" /> <!--<add key="Payment.URL" value="https://secure.authorize.net/gateway/transact.dll" />--> <!-- Payment Authorize.NET - End -->


Then call the following function into your post method


private string AuthorizePayment(PaymentDataModel payDataModel)
        {
            
            string AuthNetVersion = "3.1"; // Contains CCV support
            string AuthNetLoginID = System.Configuration.ConfigurationManager.AppSettings["Payment.AuthLoginID"].ToString();
            string AuthNetTransKey = System.Configuration.ConfigurationManager.AppSettings["Payment.AuthTransactionKey"].ToString();
            string AuthNetMode = System.Configuration.ConfigurationManager.AppSettings["Payment.TestMode"].ToString();

            WebClient objRequest = new WebClient();
            System.Collections.Specialized.NameValueCollection objInf = new System.Collections.Specialized.NameValueCollection(30);
            System.Collections.Specialized.NameValueCollection objRetInf = new System.Collections.Specialized.NameValueCollection(30);
            byte[] objRetBytes;
            string[] objRetVals;
            string retMessage;

            objInf.Add("x_version", AuthNetVersion);
            objInf.Add("x_delim_data", "True");
            objInf.Add("x_login", AuthNetLoginID);
            // objInf.Add("x_password", AuthNetPassword);
            objInf.Add("x_tran_key", AuthNetTransKey);
            objInf.Add("x_relay_response", "False");

            // Switch this to False once you go live
            objInf.Add("x_test_request", AuthNetMode);

            objInf.Add("x_delim_char", ",");
            objInf.Add("x_encap_char", "|");

            // Billing Address
            objInf.Add("x_first_name", payDataModel.FirstName);
            objInf.Add("x_last_name", payDataModel.LastName);
            objInf.Add("x_address", payDataModel.Address);
            objInf.Add("x_city", payDataModel.City);
            objInf.Add("x_state", payDataModel.State);
            objInf.Add("x_zip", payDataModel.ZIP);
            objInf.Add("x_country", payDataModel.Country);
            objInf.Add("x_email", payDataModel.Email);
            objInf.Add("x_fax", payDataModel.Fax);
            objInf.Add("x_phone", payDataModel.Phone);

            objInf.Add("x_description", payDataModel.Description);

            // Card Details
            objInf.Add("x_card_num", payDataModel.CardNumber);
            objInf.Add("x_exp_date", payDataModel.CardExpiryDate);

            // Authorisation code of the card (CCV)
            objInf.Add("x_card_code", payDataModel.CCV);

            objInf.Add("x_method", "CC");
            objInf.Add("x_type", "AUTH_CAPTURE");
            objInf.Add("x_amount", payDataModel.Amount);

            // Currency setting. Check the guide for other supported currencies
            objInf.Add("x_currency_code", "USD");

            try
            {
                // Pure Test Server
                objRequest.BaseAddress = System.Configuration.ConfigurationManager.AppSettings["Payment.URL"].ToString().Trim();

                objRetBytes = objRequest.UploadValues(objRequest.BaseAddress, "POST", objInf);
                objRetVals = System.Text.Encoding.ASCII.GetString(objRetBytes).Split(",".ToCharArray());

                if (objRetVals[0].Trim(char.Parse("|")) == "1")
                {
                    // Returned Authorisation Code
                    ViewBag.AuthNetCode = objRetVals[4].Trim(char.Parse("|"));
                    // Returned Transaction ID
                    ViewBag.AuthNetTransID = objRetVals[6].Trim(char.Parse("|"));
                    return retMessage = "1";
                }
                else
                {
                    // Error!
                    retMessage = objRetVals[3].Trim(char.Parse("|")) + " (" + objRetVals[2].Trim(char.Parse("|")) + ")";

                    if (objRetVals[2].Trim(char.Parse("|")) == "44")
                    {
                        // CCV transaction decline
                        retMessage += "Our Card Code Verification (CCV) returned the following error: ";

                        switch (objRetVals[38].Trim(char.Parse("|")))
                        {
                            case "N":
                                retMessage += "Card Code does not match.";
                                break;
                            case "P":
                                retMessage += "Card Code was not processed.";
                                break;
                            case "S":
                                retMessage += "Card Code should be on card but was not indicated.";
                                break;
                            case "U":
                                retMessage += "Issuer was not certified for Card Code.";
                                break;
                        }
                    }

                    if (objRetVals[2].Trim(char.Parse("|")) == "45")
                    {
                        if (retMessage.Length > 1)
                            retMessage += "<br />n";

                        // AVS transaction decline
                        retMessage += "Our Address Verification System (AVS) returned the following error: ";

                        switch (objRetVals[5].Trim(char.Parse("|")))
                        {
                            case "A":
                                retMessage += " the zip code entered does not match the billing address.";
                                break;
                            case "B":
                                retMessage += " no information was provided for the AVS check.";
                                break;
                            case "E":
                                retMessage += " a general error occurred in the AVS system.";
                                break;
                            case "G":
                                retMessage += " the credit card was issued by a non-US bank.";
                                break;
                            case "N":
                                retMessage += " neither the entered street address nor zip code matches the billing address.";
                                break;
                            case "P":
                                retMessage += " AVS is not applicable for this transaction.";
                                break;
                            case "R":
                                retMessage += " please retry the transaction; the AVS system was unavailable or timed out.";
                                break;
                            case "S":
                                retMessage += " the AVS service is not supported by your credit card issuer.";
                                break;
                            case "U":
                                retMessage += " address information is unavailable for the credit card.";
                                break;
                            case "W":
                                retMessage += " the 9 digit zip code matches, but the street address does not.";
                                break;
                            case "Z":
                                retMessage += " the zip code matches, but the address does not.";
                                break;
                        }
                    }

                    // strError contains the actual error
                    ViewBag.ErrorMsg = retMessage;
                    return retMessage;
                }
            }
            catch (Exception ex)
            {
                return retMessage = ex.Message;
            }
        }
That's it. You can download sample  for get response from authorize.net payment gateway using asp,net mvc project. Please share this post to social media if its is help you and also don't forgot to write some comments. 

Solution:Error during serialization or deserialization using the json javascriptserializer. the length of the string exceeds

Thursday

Error: 
           "Error during serialization or deserialization using the json javascriptserializer. the length of the string exceeds kendoui" I faced this error in Kendo-Grid.

Reason:
            This exception is raised when the length of the data serialized as JSON exceeds the default MaxJsonLength. It means  The JavaScript Serialization settings allow maximum 2097152 character by default. But getMethod return string larger then this then it throw above error.

Solutions:
             According from the documents There are few possible solutions available to fix this issue

  • Setting the MaxJsonLength property default value within your web.config
  • Return a custom action result
  • Setting the MaxJsonLength property of a JavascriptSerializer object to perform your serialization.
  • Enable paging by calling the Pageable method
  • Use a View Model to serialize only the required properties of your model

Solution 1: Setting the MaxJsonLength property default value within your web.config
                       The MaxJsonLength property which can be set within the web.config of your application controls the maximum size of the JSON strings that are accepted by the JsonSerializer class. The default value is  2097152 characterswhich is equivalent to 4 MB of Unicode string data.

                   This will only apply to web-services that handle JSON.

 You can just copy and paste the following code to your web.config file to increase the size of this value 

<configuration>
  <system.web.extensions>
    <scripting>
     <webServices>
      <jsonSerialization maxJsonLength="2097089" />
     </webServices>
  </scripting>
</system.web.extensions>
</configuration>

Solution 2: Return a custom action result

public ActionResult Read([DataSourceRequest] DataSourceRequest request)
{
    var data = GetData();
    var serializer = new JavaScriptSerializer();
    var result = new ContentResult();
    serializer.MaxJsonLength = Int32.MaxValue; // Whatever max length you want here
    result.Content = serializer.Serialize(data.ToDataSourceResult(request));
    result.ContentType = "application/json";
    return result;
}


Solution 3: Setting the MaxJsonLength property of a JavascriptSerializer object

                Using an instance of a JavascriptSerializer will not actually inherit the previously defined within the web.config (as the web.config only applies to Web Services that handle the JSON) so you can easily just create an instance of the serializer and set the property accordingly :

//Creates an instance of your JavaScriptSerializer and Setting the MaxJsonLength
var serializer = new JavaScriptSerializer() { MaxJsonLength = 86753090 };

//Perform your serialization
serializer.Serialize("Your JSON Contents");

This will allow you to easily your larger data and adjust your maximum size easily.

Difference between jQuery .bind() vs .live() methods

Tuesday


.bind():
                     The .bind() method registers the type of event and an event handler directly to the DOM element in question. This method has been around the longest and in its day it was a nice abstraction around the various cross-browser issues that existed. This method is still very handy when wiring-up event handlers, but there are various performance concerns as are listed below.

The .bind() method will attach the event handler to all of the anchors that are matched! That is not good. Not only is that expensive to implicitly iterate over all of those items to attach an event handler, but it is also wasteful since it is the same event handler over and over again.

Pros
                     This methods works across various browser implementations.
It is pretty easy and quick to wire-up event handlers. The shorthand methods (.click(), .hover(), etc...)  make it even easier to wire-up event handlers. For a simple ID selector, using .bind() not only wires-up quickly, but also when the event fires the event handler is invoked almost immediately.

Cons
             The method attaches the same event handler to every matched element in the selection.
It doesn't work for elements added dynamically that matches the same selector.
There are performance concerns when dealing with a large selection.
The attachment is done upfront which can have performance issues on page load.

                 

.live():
              The .live method attaches the event handler to the root level document along with the associated selector and event information. By registering this information on the document it allows one event handler to be used for all events that have bubbled (a.k.a. delegated, propagated) up to it. Once an event has bubbled up to the document jQuery looks at the selector/event metadata to determine which handler it should invoke, if any. This extra work has some impact on performance at the point of user interaction, but the initial register process is fairly speedy.

              The good thing about this code as compared to the .bind() example above is that it is only attaching the event handler once to the document instead of multiple times. This not only is faster, but less wasteful,

Pros
              There is only one event handler registered instead of the numerous event handlers that could have been registered with the .bind() method.The upgrade path from .bind() to .live() is very small. All you have to do is replace "bind" to "live". Elements dynamically added to the DOM that match the selector magically work because the real information was registered on the document. You can wire-up event handlers before the document ready event helping you utilize possibly unused time.

Cons
               This method is deprecated as of jQuery 1.7 and you should start phasing out its use in your code.
Chaining is not properly supported using this method.
The selection that is made is basically thrown away since it is only used to register the event handler on the document.

               Using event.stopPropagation() is no longer helpful because the event has already delegated all the way up to the document.Since all selector/event information is attached to the document once an event does occur jQuery has match through its large metadata store using the matchesSelector method to determine which event handler to invoke, if any.
Your events always delegate all the way up to the document. This can affect performance if your DOM is deep.

C#:Remove Special Characters from Text box in ASP.Net

Thursday

Asp.net C# - Replace all special characters from string:        
                                                                                                 "Input string was not in correct format" more or less all the .net programmers facing this issue at least one time in his carrier. Most of the times this issue caused by special characters mingle in data base query and it may entered via input controls. For example single quotes(') in address like "Peter's Road" in that time the SQL query binding with error due to that single quotes.

                         

In this case we need to replace the  special characters from the  input values that produce this error.  In c# the "String.Replace" method used to replace the string values. Here You can replace the user input's  special characters by using the following c# method.

        public static string ReplaceSpecialCharacters(string strInput)        {
            strInput = strInput.Replace("--", "++");
            strInput = strInput.Replace('&', ',');
            strInput = strInput.Replace("%", "[%]");
            strInput = strInput.Replace('+', ',');
            strInput = strInput.Replace("_", "[_]");
            strInput = strInput.Replace("[", "[[]");
            strInput = strInput.Replace("]", "[]]");
            strInput = strInput.Replace("'", "''");
            return strInput;
         }
Just send your input control value as parameter:
string txtAddress = StringHelper.ReplaceSpecialCharacters(txtAddress.Text.Trim());

Get parameters value from .exe files using ASP.NET C#

Tuesday

                                                                                    In one of my project my clients requirements is scanning a document from local scanner and directly upload into the server through web application. But there is no direct method to access local machine from sever code in dot net, so we need some other solutions to access local .exe (to activate scanner) file from server.

Finally Google answering me "ActiveX0bject". Yes we can run .exe file from server by using ActiveX shell command. Here is the sample code to run client's side .exe file from server  by using JavaScript and ActiveX0bject.

Enable ActiveX controls in IE for run .exe files from local :
                                Before  we enable ActiveX in IE settings with the following simple steps, 
Step -1:  Open IE -->Tools --> Internet Options

Step -2:  Go to security tab choose your zone (Internet (OR) Local)  then click custom Level button

Step-3:  Just set "The Initialize and script ActiveX controls not marked as safe" as "Prompt"

          



 And the following JavaScript code is for run .exe (In my case "ImageScanner.exe")file with parameter session id, display order  and user id.

JavaScript Code 

function runScaningApp(sessId, disorder, userId){

var shell=new ActiveX0bject("WScript.shell");

var res = shell.run('"ImageScanner.exe" "'+ sessId +'" "'+ disorder+'" "'+ userId+'", '1', true);

 if (res == "0"){
   alert ("Your success message");
 }
 else{
   alert ("Sorry! Some error occurred");
 }
}

Finally the following c# code for accessing the .exe's param value. Use this code in your .exe's  .cs file 

public class scanner :system.Windows.Forms.Form, IMessageFilter{

private string sessionId;
private string disorder;
private string userId;

 public Scanner (string[args){
  sessionId = args [0];
  disorder= args [1];
  userId = args [2];
 }
}

Code for pure css menu

An attractive mouse hover menu using CSS only:                      
                                                                 One of the fundamental things in web design in reference to usability is navigation. Navigation menus are important to help the user find the information that he or she seeks. Use of colors, highlights and mouse-over effects will facilitate detection of the items that are being searched. 

In this post  I give cool css only menu. The items background change with rounded corner when mouse hover .  This menu build with css and 'UL' tag only. Just copy and paste the  following html code to build this  cool menu.


<html>
<head>
<style>
#topmenu {
 float:left;
 padding-right: 20px;
 padding-left: 80px;
 padding-top: 46px;
 font-family: 'GibsonRegular'; 
}
#topmenu ul {
 display: block;
 height: 34px;
 width: 540px;
}
#topmenu ul li {
 display: block;
 float: left;
 margin-right: 5px;
}
#topmenu ul li a {
 -webkit-border-radius: 17px;
 -moz-border-radius: 17px;
 border-radius: 17px;
 -webkit-transition-property: color, border;
 -webkit-transition-duration: .2s;
 -webkit-transition-timing: ease-in;
 -moz-transition-property: color, border;
 -moz-transition-duration: .2s;
 -moz-transition-timing: ease-in;
 -o-transition-property: color, border;
 -o-transition-duration: .2s;
 -o-transition-timing: ease-in;
 transition-property: color, border;
 transition-duration: .2s;
 transition-timing: ease-in;
 display: block;
 float: left;
 font-size: 14px;
 color: #65778c;
 text-decoration: none;
 line-height: 30px;
 height: 30px;
 padding-left: 13px;
 padding-right: 13px;
 border: 2px solid transparent;
}
#topmenu ul li a.active {
 border: 2px solid #c8d8df;
 color: #DE3068;
 text-decoration: none;
}
#topmenu ul li a:hover {
 border: 2px solid #c8d8df;
 color: #DE3068;
 text-decoration: none;
}
.ie7 #topmenu ul li a, .ie8 #topmenu ul li a {
 line-height: 34px;
 height: 34px;
 padding-left: 15px;
 padding-right: 15px;
 border: none;
}
</style>
</head>
<body>
<div id="topmenu">
  <ul>
    <li><a href="#" title="Hello!" class="active"><span>Hello!</span></a></li>
    <li><a href="#" title="Portfolio"><span>Portfolio</span></a></li>
    <li><a href="#" title="Services"><span>Services</span></a></li>
    <li><a href="#" title="About us"><span>About us</span></a></li>
    <li><a href="#" title="Blog"><span>Blog</span></a></li>
  </ul>
</div>
</body>
</html>

Run client side .exe file from server side using asp.net

Saturday

                                                                   In one of my project my clients requirements is scanning a document from local scanner and directly upload into the server through web application. But there is no direct method to access local machine from sever code in dot net, so we need some other solutions to access local .exe (to activate scanner) file from server.

Finally Google answering me "ActiveX0bject". Yes we can run .exe file from server by using ActiveX shell command. Here is the sample code to run client's side .exe file from server  by using JavaScript and ActiveX0bject.

Enable ActiveX controls in IE for run .exe files from local :
                                Before  we enable ActiveX in IE settings with the following simple steps, 
Step -1: Open IE -->Tools --> Internet Options

Step -2:  Go to security tab choose your zone (Internet (OR) Local)  then click custom Level button

Step-3:  Just set "The Initialize and script ActiveX controls not marked as safe" as "Prompt"

          



 And the following JavaScript code is for run .exe (In my case "ImageScanner.exe")file with parameter session id, display order  and user id.

JavaScript Code 

function runScaningApp(sessId, disorder, userId){

var shell=new ActiveX0bject("WScript.shell");

var res = shell.run('"ImageScanner.exe" "'+ sessId +'" "'+ disorder+'" "'+ userId+'", '1', true);

 if (res == "0"){
   alert ("Your success message");
 }
 else{
   alert ("Sorry! Some error occurred");
 }
}

Multiple checkbox validation in asp .net mvc3 using jquery

Friday



<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
function ValidateCheckBox()
    {
        var selectedCheckBoxesValue = '';

        $('#ValidateCheckBox').find("input:checkbox.CheckBoxClassName:checked").each(function (i, selected) {
         if (selectedCheckBoxesValue.length == 0) {
          selectedCheckBoxesValue += $(selected).val();
         }
         else {
         selectedCheckBoxesValue += ',' + $(selected).val();
         }});
         // Here you also get all the comma separated values if you want else use below method for it
        if(selectedCheckBoxesValue.length == 0)
        {
            alert("Select atleast one checkbox");
        }
    }
</script>
</head>
<body>
<div id="ValidateCheckBox" style="background-color:#0099FF; color:#FFFFFF; width:190;">
  <table width="200" cellspacing="2" cellpadding="2">
    <tr>
      <td><input type="checkbox" class="CheckBoxClassName"></td>
      <td><label>Checkbox 1</label></td>
    </tr>
    <tr>
      <td><input type="checkbox" class="CheckBoxClassName"></td>
      <td><label>Checkbox 2</label></td>
    </tr>
    <tr>
      <td><input type="checkbox" class="CheckBoxClassName"></td>
      <td><label>Checkbox 3</label></td>
    </tr>
    <tr>
      <td><input type="checkbox" class="CheckBoxClassName"></td>
      <td><label>Checkbox 4</label></td>
    </tr>
    <tr>
      <td><input type="checkbox" class="CheckBoxClassName"></td>
      <td><label>Checkbox 5</label></td>
    </tr>
    <tr>
      <td colspan="2"><input type="button" onClick="ValidateCheckBox();" value="Validate checkbox"></td>
    </tr>
  </table>
</div>
</body>
</html>
         
                    

drag and drop between two divs using jquery ui

Tuesday

Jquery drag and drop sortable between different divs:
                                           In this tutorial I'm using jquery 1.4 2 min js and jquery-ui-1.8.13.min.js for drag and drop divs with image. In this simaple example you can Drag and drop items within a list and also Drag and drop items within and between lists of divs
                                           First download the requirement Jquey fils, you can download it from here or you can directly call from google.





Download jquery 1.4 2 min js

Downloadjquery-ui-1.8.13.min.js

Using the parameter connectWith (jQuery selector) we can define which other lists that items within a list can be dragged and dropped to. Add the following code into page load function.

<script>
$(document).ready(function () {
 $('.container .draggable-list').sortable({
 connectWith: '.container .draggable-list'
 });
});
</script>

then add that js reference to your page header tag

  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>

Then  copy and paste the following css in to your style region 
<style>
.container {
 width: 400px;
 background-color:#000000;
 border-bottom-color:#003366;
}
.draggable-list {
 background-color: #0066FF;
 list-style: none;
 margin: 0;
 min-height: 70px;
 padding: 10px;
}
.draggable-item {
 background-color: #FFF;
 border: 1px dotted #000;
 cursor: move;
 display: block;
 font-weight: bold;
 color:#CC0033;
 text-shadow: 5px 5px 5px #FF0000;
 padding-bottom:  70px;
 margin: 5px;
}
.img1 {
 width:76px;
 height: 62px;
 background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmPR_z7HNH5_D5mL3iSnN3TKntSKvOpWrGXApaXvYRRgEViP9zN5X5hlXxt4JAbshSv4YOHSzyHFaXSfCZI1rKDU68JZm3PvonazswiGKHLGCwd-gbeFF5rpd0nquiDk07XylsVJRzlvaD/s1600/how+to+use+sprite+image.jpg') -3.5px -9px;
 float:left;
}
.img2 {
 background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmPR_z7HNH5_D5mL3iSnN3TKntSKvOpWrGXApaXvYRRgEViP9zN5X5hlXxt4JAbshSv4YOHSzyHFaXSfCZI1rKDU68JZm3PvonazswiGKHLGCwd-gbeFF5rpd0nquiDk07XylsVJRzlvaD/s1600/how+to+use+sprite+image.jpg') -98px -7px;
 width: 70px;
 height: 66px;
 float:left;
}
.img3 {
 background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmPR_z7HNH5_D5mL3iSnN3TKntSKvOpWrGXApaXvYRRgEViP9zN5X5hlXxt4JAbshSv4YOHSzyHFaXSfCZI1rKDU68JZm3PvonazswiGKHLGCwd-gbeFF5rpd0nquiDk07XylsVJRzlvaD/s1600/how+to+use+sprite+image.jpg') -198px -9px;
 width: 63px;
 height: 58px;
 float:left;
}
Finally add the draggable-list and draggable-item with in the container div.
<div class="container">
  <div class="draggable-list" style="float:left">
    <div class="draggable-item">
      <div class="img1"></div>
      <p style="float:right"> Group A </p>
    </div>
    <div class="draggable-item"> <span class="img2"></span>
      <p style="float:right"> Group A </p>
    </div>
    <div class="draggable-item"> <span class="img3"></span>
      <p style="float:right"> Group A </p>
    </div>
    <div class="draggable-item"> <span class="img5"></span>
      <p style="float:right"> Group A </p>
    </div>
    <div class="draggable-item"> <span class="img6"></span>
      <p style="float:right"> Group A </p>
    </div>
    <div class="draggable-item"> <span class="img4"></span>
      <p style="float:right"> Group A </p>
    </div>
  </div>
  <div class="draggable-list" style="float:right">
    <div class="draggable-item"> <span class="img7"></span>
      <p style="float:right"> Group B </p>
    </div>
    <div class="draggable-item"> <span class="img8"></span>
      <p style="float:right"> Group B </p>
    </div>
    <div class="draggable-item"> <span class="img9"></span>
      <p style="float:right"> Group B </p>
    </div>
    <div class="draggable-item"> <span class="img10"></span>
      <p style="float:right"> Group B </p>
    </div>
    <div class="draggable-item"> <span class="img11"></span>
      <p style="float:right"> Group B </p>
    </div>
    <div class="draggable-item"> <span class="img12"></span>
      <p style="float:right"> Group B </p>
    </div>
  </div>
</div>



Enabling Service Broker in SQL Server 2008

Thursday

Activate  Service Broker in SQL Server 2008:
                          If you are working in sql dependency, SignalR related projects you must enable service broker for  messaging and queuing functions between instances. The basic functions of sending and receiving messages forms a part of a “conversation.”

What is services broker?
                        According  from Microsoft SQL Server Service Broker provides native support for messaging and queuing applications in the SQL Server Database Engine. This makes it easier for developers to create sophisticated applications that use the Database Engine components to communicate between disparate databases. Developers can use Service Broker to easily build distributed and reliable applications.

                        Service broker find applications when single or multiple SQL server instances are used. This functionality helps in sending messages to remote databases on different servers and processing of the messages within a single database. In order to send messages between the instances, the Service Broker uses TCP/IP.

Check the sql server services broker status?
                          Before enable service broker better  we need check the current services broker status of the database. The following simple command used to do that.

SELECT name, is_broker_enabled FROM sys.databases

Then activate services broker on "codingclusterDB" database by using the following command.

ALTER DATABASE CodingClusterDB SET ENABLE_BROKER
GO

Enable SQL Server Broker taking too long time?
                                         If your Alter Database query takes long time to process, then use the following command to activate services broker on your database

ALTER DATABASE CodingClusterDB SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;
GO

Install .nupkg file locally(OR)Offline in visual studio from NuGet

Tuesday

Install NuGet Package from local machine manually:
              Some  companies  not allowed internet connection for development environment for some security purpose. On that time we can't install packages directly  from Nuget.Org  through  Package Manager console. This type of situation the following s three easy steps to install Nuget packages to visual studio when your are working in offline mode.

Step-1: First download your package from http://www.nuget.org/packages/

Download Nuget Packages Without VS/NuGet Package Manager (Manuallydownload): 
                 If you not able to directly download the package from http://www.nuget.org/packages/ , then you try a chrome extension called  "NuTake". This extension create a direct link to download the package. The link just shown  under the "PM>Install - Package..." command box.



Step-2: After download your package open visual studio and open "Tools - > Options -> Package Manager"

              


Give a name and folder location. Click OK. Drop your NuGet package files in that folder.

                        
         
Step-3: In the third step, Go to your Project, Right click and select "Manage Nuget Packages" and

select /Install  your new Package source.
                      

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets