Search This Blog

Tuesday, December 19, 2017

What is sendgrid ??

SendGrid is a cloud-based SMTP provider that allows you to send email without having to 

maintain email servers. SendGrid manages all of the technical details, from scaling the 

infrastructure to ISP outreach and reputation monitoring to whitelist services and real time

analytics.

SendGrid mail code:

using SendGridMail;
using SendGridMail.Transport;


public bool SendEmailThroughSendGrid(string MailTo, string DisplayName, string Subject, string MailFrom, string MailBody)
    {
        try
        {
            string sgUsername = "***********";
            string sgPassword = "***************";
            SendGrid myMessage = SendGrid.GetInstance();
            myMessage.AddTo(MailTo);
            myMessage.From = new MailAddress(MailFrom, DisplayName);
            myMessage.Subject = Subject;
            myMessage.Text = "";
            myMessage.Html = MailBody;
            var credentials = new NetworkCredential(sgUsername, sgPassword);
            var transportWeb = Web.GetInstance(credentials);
            transportWeb.Deliver(myMessage);
            return true;
        }
        catch (Exception)
        {
            return false;
        }
        finally
        {

        }
    }




Error: The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.

Process with an ID #### is not running on Visual Studio 2015

Error:

The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.

1.       Delete the \Documents\IISExpress folder using the following console command: rmdir /s /q "%userprofile%\Documents\IISExpress"
2.       Delete the applicationhost.config file which is placed within the \.vs\Config\ folder in your Visual Studio project root folder.
3.       Close Visual Studio and re-start it with Administrative (right-click > Run as Administrator).
The .vs is a hidden folder so you have to enable the Show hidden files, folders, and drives option in Windows Explorer.

E:\CP\xxxxxx\.vs\config




we create an application at IIS and enable the windows authentication then it is stored ApplicationHost.config as


         <sites>
            <site name="WebSite1" id="1" serverAutoStart="true">
                <application path="/">
                    <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation=":8080:localhost" />
                </bindings>
            </site>
            <site name="xxxxxxx" id="2">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="E:\CP\xxxxxxx\webadhar" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:65417:localhost" />
                </bindings>
            </site>

Friday, June 16, 2017

How can restore a backup on lower version of SQL Server:

How can restore a backup on lower version of SQL Server:

We have SQL command to find out SQL version.
SELECT @@VERSION  by this commant we can find out our SQL version.


Out Put:
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)   Apr  2 2010 15:48:46   Copyright (c) Microsoft Corporation  Developer Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )

Meaning of 4 digit output - 10.50.1600.1
1st digit product version (8 means, SQL 2000, 9 means SQL 2005, 10 means SQL 2008, 11 means SQL 2012).
2nd digit product level - different releases have different numbers. 10.00 is SQL 2008, 10.50 is SQL 2008 R2.
3rd digit - Service Pack to you SQL Server installation.
4th digit - one is a build number

Three cases we will face when restore SQL database one version to other version:
Source server is an older version and target server is a newer version of SQL Server.
For example:
Source: 9.00.2234.0 (SQL 2005)
Target: 10.00.5500.0 (SQL 2008 SP2)
Backups are compatible. You can restore a database backup on a newer version of SQL Server.

Source server and target server are the same product version and product level. They may differ on 3rd  or 4th  digit  in the version number.
For example:
Source server is 10.50.2876.0 and target is 10.50.2799.0.
Backups are compatible. Microsoft does not introduce significant changes in BACKUP/RESTORE functionality that breaks backward compatibility by a hotfix or Service Pack.
Source server and target server differ by 1st  or 2nd  digit - a product version or a product level and the target is older than the source.
For example:
Source: 11.00.2100 (SQL 2012)
Target: 10.00.5500 (SQL 2008 SP2)
Backups are incompatible. 

Thursday, June 8, 2017

Dynamic Message box, Alert Message popup box with java script

How can create Dynamic Alert Message box :



Evert times we need confirmation after data created or updated in database. In this case we can make one popup message box with help of java script we can also put dynamic value in this popup message box.

1 STEP:  Create 2 two function one for show message box or second one for hide message box.

2 STEP: Write CSS for message box design.

3 STEP: Create div where display message.

4 STEP: Write our message in label control in cs page.

1 STEP:

<script type="text/javascript">
    function ShowDialog(modal) {
      
        $("#overlay").show();
        $("#dialog").fadeIn();
        if (modal) {
            $("#overlay").unbind("click");
        }
        else {
            $("#overlay").click(function (e) {
                HideDialog();
            });
        }
        return false;
    }

    function HideDialog() {
        $("#overlay").hide();
        $("#dialog").fadeOut(300);

    }

</script>

2 STEP:<style type="text/css">
.web_dialog_overlaycm
{
    position: fixed;
    top: 25%;
    right: 0%;
    bottom: 5%;
    left: 40%;
    height: 29%;
    width: 56%;
    margin: 0;
    padding: 0;
    background: #f3c022;
    -moz-opacity: .15;
    z-index: 20000;
    display: none;
}

.web_dialogcm
{
    display: none;
    position: fixed;
    width: 54%;
    height: 24%;
    top: 27%;
    left: 41%;
    background-color: #ffffff;
   /* border: 1px solid #993333;*/
    border: 1px solid #5db2ff;
    padding: 0px;
    z-index: 20000;
    font-family: Verdana;
    font-size: 10pt;
}
    .style1
    {
        width: 100%;
    }
</style>

3 STEP:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <table class="style1">
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
                
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
   <div id="overlay" class="web_dialog_overlaycm" style="width: 20%; float: center;">
                <div id="dialog" class="web_dialogcm" style="width: 18%; float: center;">
                    <div style="width: 100%; float: center;">
                        <table style="width: 100%;">
                            <tr align="center">
                                <td style="text-align: center;">
                                  
                                </td>
                            </tr>
                             <tr align="center">
                                <td style="text-align: center;">
                                  
                                </td>
                            </tr>
                            <br>
                             <tr align="center">
                                <td style="text-align: center;">
                                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                                </td>
                            </tr>
                           
                           
                        </table>
                    </div>
                    <div style="width: 100%; float: left;">
                        <table id="tblZoom" style="width: 200px;" align="center">
                            <tr id="Zoom1" runat="server">
                                <td id="Td2" runat="server">
                                    <div id="divZoom" style="border: 1px solid #5db2ff; float: center; vertical-align: top;"
                                        align="center">
                                    </div>
                                </td>
                            </tr>
                            <br>
                             <tr align="center">
                                <td style="text-align: center;">
                                  
                                </td>
                            </tr>
                             <tr align="center">
                                <td style="text-align: center;">
                                    
                                </td>
                            </tr>
                             <tr align="center">
                                <td style="text-align: center;">
                                    <input id="btnClose" type="button" value="OK" onclick="HideDialog()" />
                                </td>
                            </tr>
                           
                        </table>
                    </div>
                </div>
            </div>
    </form>
</body>
</html>

4 STEP:

using System;
using System.Data;
using System.Globalization;
using System.Resources;
using System.Threading;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Web;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       
        Label1.Text = "Country Created Or Updated Sucessfully In Database.";

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "function", "ShowDialog(true);", true);
    }
}




Saturday, March 25, 2017

Publish your package on NPM - node package manager

Now a good new for every developer you can publish your own package on NPM, you just have to follow mentioned step...


Publish your package on NPM - node package manager, publish your javascript library on npm, publish your javascript library on cdn