Thursday, January 31, 2013

Plot Marker on Google map form excel sheet

Plot Marker on Google map form excel sheet

Below the .aspx code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<html>
<head> 

<%-- Google api --%>
    <script src="http://maps.google.com/maps/api/js?sensor=false"
          type="text/javascript"></script> 
</head>
<body>
   <div id="map" style="width: 1290px; height: 570px;"></div>
   <script type="text/javascript">

    <%=Locations %>

    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 3,
      center: new google.maps.LatLng(28.692997,77.233429),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var infowindow = new google.maps.InfoWindow();

    var marker, i;

    for (i = 0; i < locations.length; i++) { 
      marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2]),
        map: map
      });

      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i][0]);
          infowindow.open(map, marker);
        }
      })(marker, i));
    }
  </script>
</body>
</html>

Note : -

    <%=Locations %>  here is code represent the lat ,long and adresses of location which is gerated from code behind page i.e dynamically.

 

For simple static Google map you can replace the

<%=Locations %> by

var locations = [
['9043, Malviya Nagar', 28.548338, 77.213287,1],
['Road No :1, Banjara Hills', 17.4126362, 78.4502041,2],
['Near Clock Tower, Market Street', 17.5169711, 78.5150626,3];

 Format of Location : -

['address', lat, lon,ID]
 
for static google map no need of code behind page. 

Code behind page

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.OleDb;

public partial class Default3 : System.Web.UI.Page
{
    string OledbConnectionString;
    public string Desc;
    public double lat;
    public double lon;
    public string GoogleAPIKey;
    public int ZoomLevel;
    public String Locations;
    protected void Page_Load(object sender, EventArgs e)
    {
        // Excel 2007
       
        string location = Server.MapPath("~/Excel/") + ConfigurationManager.AppSettings["filename"].ToString().Trim();
        ZoomLevel = Int32.Parse("10");
        OledbConnectionString = string.Empty;

// Get extension of excel file
        string ext = Path.GetExtension(ConfigurationManager.AppSettings["filename"].ToString().Trim());
        if (ext == ".xls")
        {
            OledbConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + location + ";Extended Properties=Excel 8.0;";
        }
        else if (ext == ".xlsx")
        {
            OledbConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + location + ";Extended Properties=Excel 12.0;";
        }
        else
        { }
        try
        {
            OleDbConnection objConn = null;
            objConn = new OleDbConnection(OledbConnectionString);
            if (objConn.State == ConnectionState.Closed)
            {
                objConn.Open();
            }
            OleDbDataAdapter da = new OleDbDataAdapter("select Latitude as [Lat], Longitude as [Long] ,Address as [Address]   from [Sheet2$]", objConn);
            //Latitude    Longitude Address

            DataSet ds = new DataSet();
            da.Fill(ds);
            DataTable dt = ds.Tables[0];
            lat = 24.20689;
            lon = 78.046875;
            int i = 0;
            Locations = "var locations = [";          

            foreach (DataRow dr in dt.Rows)
            {
                i++;
                if (dr["lat"].ToString().Trim() != "")
                {
                    Locations += Environment.NewLine + "['" + dr["Address"].ToString().Trim().Replace("/", "").Replace("'", "").Replace("\n", "").Replace("@", "").Replace("&", "") + "', " + dr["Lat"].ToString().Trim() + ", " + dr["Long"].ToString().Trim() + "," + i + "],";
                    //
 
                }
                if (i == 1200)
                {
                    break;
                }
            }
            Locations = Locations.Substring(0, Locations.Length - 1);
            Locations +="];";
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
}
 

Put appsetting in webconfingWebconfig

Note : -  put hospital.xlsx file in excel folder.....file having three column adress ,latitude, longitude

 

<appSettings>
        <add key="class" value="server=.;database=Hcl;uid=sa;pwd=sa123"/>
        <add key="filename" value="hospital.xlsx"/>
    </appSettings>
 

Monday, January 28, 2013

Online Website security check tool

  1. http://safeweb.norton.com/   Is This Website Safe | Website Security | Norton Safe Web - Check your website for virus.
  2. http://www.siteadvisor.com/
    McAfee SiteAdvisor software is a free browser plug-in that provides simple Web site safety ratings and a Secure Search box so you can surf, search and shop more safely.
  3. http://www.google.com/safebrowsing/diagnostic?site=malwarehelp.org Just replace malwarehelp.org with your given site to check what happen when google visited that site.
  4. http://www.mywot.com/ Check the reputation of your website.
  5. http://www.unmaskparasites.com
    Hackers exploit security vulnerabilities in popular web software such as blogs, forums, CMS, image galleries and wikis to insert hidden illicit content into web pages of innocent third-party web sites.
  6. http://wepawet.iseclab.org  Wepawet is a service for detecting and analyzing web-based threats. It currently handles Flash, JavaScript, and PDF files
  7. http://hosts-file.net/  hpHosts is a community managed and maintained hosts file that allows an additional layer of protection against access to ad, tracking and malicious websites. 
  8. http://onlinelinkscan.com/    Online Virus Scanner - Check websites for Malware &amp; Viruses Before you Visit.

Wednesday, January 23, 2013

Visual Studio Short cut

General

ShortcutDescription
Ctrl-X or
Shift-Delete
Cuts the currently selected item to the clipboard
Ctrl-C or
Ctrl-Insert
Copies the currently selected item to the clipboard
Ctrl-V or
Shift-Insert
Pastes the item in the clipboard at the cursor
Ctrl-Z or
Alt-Backspace
Undo previous editing action
Ctrl-Y or
Ctrl-Shift-Z
Redo the previous undo action
Ctrl-Shift-V or
Ctrl-Shift-Insert
Pastes an item from the clipboard ring tab of the Toolbox at the cursor in the file and automatically selects the pasted item. Cycle through the items on the clipboard by pressing the shortcut keys repeatedly
Esc Closes a menu or dialog, cancels an operation in progress, or places focus in the current document window
Ctrl-S Saves the selected files in the current project (usually the file that is being edited)
Ctrl-Shift-S Saves all documents and projects
Ctrl-PDisplays the Print dialog
F7Switches from the design view to the code view in the editor
Shift-F7Switches from the code view to the design view in the editor
F8Moves the cursor to the next item, for example in the TaskList window or Find Results window
Shift-F8Moves the cursor to the previous item, for example in the TaskList window or Find Results window
Shift-F12 Finds a reference to the selected item or the item under the cursor
Ctrl-Shift-GOpens the file whose name is under the cursor or is currently selected
Ctrl-/Switches focus to the Find/Command box on the Standard toolbar
Ctrl-Shift-F12Moves to the next task in the TaskList window
Ctrl-Shift-8Moves backward in the browse history. Available in the object browser or Class View window
Alt-Left ArrowGo back in the web browser history
Alt-Right ArrowGo forward in the web browser history




Text navigation

ShortcutDescription
Left Arrow Moves the cursor one character to the left
Right Arrow Moves the cursor one character to the right
Down Arrow Moves the cursor down one line
Up Arrow Moves the cursor up one line
Page Down Scrolls down one screen in the editor window
Page Up Scrolls up one screen in the editor window
End Moves the cursor to the end of the current line
HomeMoves the cursor to the beginning of the line. If you press Home when the cursor is already at the start of the line, it will toggle the cursor between the first non-whitespace character and the real start of the line
Ctrl-End Moves the cursor to the end of the document
Ctrl-Home Moves the cursor to the start of the document
Ctrl-GDisplays the Go to Line dialog. If the debugger is running, the dialog also lets you specify addresses or function names to go to
Ctrl-] Moves the cursor to the matching brace in the document. If the cursor is on an opening brace, this will move to the corresponding closing brace and vice versa
Ctrl-K, Ctrl-NMoves to the next bookmark in the document
Ctrl-K, Ctrl-PMoves to the previous bookmark
Ctrl-K, Ctrl-IDisplays Quick Info, based on the current language
Ctrl-Down Arrow Scrolls text down one line but does not move the cursor. This is useful for scrolling more text into view without losing your place. Available only in text editors
Ctrl-Up Arrow Scrolls text up one line but does not move the cursor. Available only in text editors
Ctrl-Right Arrow Moves the cursor one word to the right
Ctrl-Left Arrow Moves the cursor one word to the left
Ctrl-Shift-1Navigates to the next definition, declaration, or reference of an item. Available in the object browser and Class View window. Also available in source editing windows if you have already used the Edit.GoToReference (Shift-F12) shortcut
Ctrl-Shift-2Navigates to the previous definition, declaration, or reference of an item




Text manipulation

ShortcutDescription
Enter Inserts a new line
DeleteDeletes one character to the right of the cursor
InsertToggles between insert and overtype insertion modes
TabIndents the currently selected line or lines by one tab stop. If there is no selection, this inserts a tab stop
Shift-Tab Moves current line or selected lines one tab stop to the left
Backspace or
Shift-Backspace
Deletes one character to the left of the cursor
Ctrl-K, Ctrl-CMarks the current line or selected lines of code as a comment, using the correct comment syntax for the programming language
Ctrl-K, Ctrl-URemoves the comment syntax from the current line or currently selected lines of code
Ctrl-T or 
Shift-Enter
Swaps the characters on either side of the cursor. (For example, AC|BD becomes AB|CD.) Available only in text editors
Ctrl-K, Ctrl-LRemoves all unnamed bookmarks in the current document
Ctrl-M, Ctrl-OAutomatically determines logical boundaries for creating regions in code, such as procedures, and then hides them. This collapses all such regions in the current document
Alt-Right Arrow or 
Ctrl-Spacebar
Displays statement completion based on the current language or autocompletes word if existing text unambiguously identifies a single symbol
Ctrl-K, Ctrl-\ Removes horizontal whitespace in the selection or deletes whitespace adjacent to the cursor if there is no selection
Ctrl-K, Ctrl-FApplies the indenting and space formatting for the language as specified on the Formatting pane of the language in the Text Editor section of the Options dialog to the selected text.
Ctrl-LCuts all selected lines or the current line if nothing has been selected to the clipboard
Ctrl-Shift-LDeletes all selected lines or the current line if no selection has been made
Ctrl-Enter Inserts a blank line above the cursor
Ctrl-Shift-Enter Inserts a blank line below the cursor
Shift-Alt-T Moves the line containing the cursor below the next line
Ctrl-JLists members for statement completion when editing code
Ctrl-UChanges the selected text to lowercase characters
Ctrl-Shift-UChanges the selected text to uppercase characters
Ctrl-Shift-Spacebar Displays a tooltip that contains information for the current parameter, based on the current language
Ctrl-M, Ctrl-URemoves the outlining information for the currently selected region
Ctrl-M, Ctrl-PRemoves all outlining information from the entire document
Ctrl-R, Ctrl-PSwaps the anchor and endpoint of the current selection
Ctrl-M, Ctrl-LToggles all previously marked hidden text sections between hidden and display states
Ctrl-K, Ctrl-KSets or removes a bookmark at the current line
Ctrl-M, Ctrl-MToggles the currently selected hidden text section or the section containing the cursor if there is no selection between the hidden and display states
Ctrl-K, Ctrl-HSets or removes a shortcut in the tasklist to the current line
Ctrl-R, Ctrl-REnables or disables word wrap in an editor
Ctrl-R, Ctrl-WShows or hides spaces and tab marks
Ctrl-Delete Deletes the word to the right of the cursor
Ctrl-Backspace Deletes the word to the left of the cursor
Ctrl-Shift-TTransposes the two words that follow the cursor. (For example, |End Sub would be changed to read Sub End|.)
Ctrl-.[dot]Display options on smarttag menu.
Very useful for showing using/Imports options.

Wednesday, January 16, 2013

Send Email notification when web server is down

If you are managing more then one web server its tough to manage everyone and check ragularly . so i have metion the code which send email notification when the server is down .

It ping production server and check

using System;

using System.Net;

using System.Net.NetworkInformation;

using System.Text;

using System.Configuration;

using System.Net.Mail;


namespace PingServer

{

    public class PingExample

    {

       

        public static void Main(string[] args)

        {

            try

            {

                Ping ping = new Ping();

                string sServers = ConfigurationManager.AppSettings["SERVER_LIST"];

                string [] sServerList = sServers.Split(',');

                foreach (string server in sServerList)

                {

                    try

                    {

                        PingReply reply = ping.Send(server);

                        if (reply.Status == IPStatus.Success)

                            Console.WriteLine("Server " + server + " running");

                        else

                        {

                            Console.WriteLine("Server " + server + " down");

                            SendMail("Server " + server + " down", "SERVER_STATUS", new string[] { "me@mycompany.com", "mymanager@mycompany.com" });

                        }

                    }

                    catch

                    {

                        Console.WriteLine(server + " is not reachable.Exception raised by ping.Send()");

                    }

                }

            }

            catch (Exception ex)

            {

                Console.WriteLine(ex.Message);

            }

            Console.Read();

        }

        public static void SendMail(String message, String subject, String[] notificationList)

        {

            try

            {

                MailMessage MyMessage = new MailMessage();

                MyMessage.From = new MailAddress("me@mycompany.com");

                foreach (String email in notificationList)

                    MyMessage.To.Add(new MailAddress(email));


                MyMessage.Subject = subject;

                MyMessage.Body = message;


                SmtpClient emailClient = new SmtpClient("smtp.me.mycompany.com");

                emailClient.Send(MyMessage);

            }

            catch

            {

            }

        }

    }

}

Friday, January 11, 2013

Godaddy coupan 90% off

GoDaddy Renewal Coupon

GDBXX1026

GoDaddy Domain Renewal Coupon

33% Off .COM renewal coupon -SAVE $5.00
GDBBX1705
 $9.99 .COM renewal per year + $0.18 ICANN fee
33% Off .NET renewal coupon -SAVE $5.00
GDBBX1705
 $9.99 .NET renewal per year + $0.18 ICANN fee
44% Off .ORG renewal coupon -SAVE $8.00
GDBBX1705
  $9.99 .ORG renewal per year + $0.18 ICANN fee

GoDaddy New Domain Coupon

iap199
  $1.99 new domains per year+ $0.18 ICANN fee[1]
iap249a
  $2.49 new domains per year+ $0.18 ICANN fee[1]
iap599v1
  $5.99 new domains per year+ $0.18 ICANN fee
$5.99 price good for the first year of one new or transfer .COM per customer. Additional years or .COMs may be purchased for $9.99 per year. Limit of 5 domains per customer.
- See more at: http://renewalcoupon2014.com/#sthash.MiA4yDJe.dpuf