Tuesday 6 September 2016

Obtaining canonical URL using JavaScript

<!DOCTYPE html>
<html>
    <head>
        <link href="http://www.example.com/" rel="canonical" />
        <title>Canonical</title>
        <script type="text/javascript">
            window.onload = function () {
                var canonical = "";
                var links = document.getElementsByTagName("link");
                for (var i = 0; i < links.length; i ++) {
                    if (links[i].getAttribute("rel") === "canonical") {
                        canonical = links[i].getAttribute("href")
                    }
                }
                alert(canonical);
            };
        </script>
    </head>
    <body>
        <h1>Canonical</h1>
    </body>
</html>



Monday 5 September 2016

C# Reading and writing to console

Reading from the console => Console.ReadLine
Writing to the console => Console.WriteLine
       Two ways to write a console
            1. Concatenation
            2. Place holder which is most preferred


Example with Concatenation

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Enter First Name");
        string FirstName = Console.ReadLine();
        Console.WriteLine("Enter Last Name");        
        string LastName = Console.ReadLine();
        Console.WriteLine("Hello "+FirstName +LastName);
        Console.ReadLine();
    }

}

Output:
Enter First Name
Balamurugan
Enter Last Name
Ganesan
Hello BalamuruganGanesan



Example with Place holder

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Enter First Name");
        string FirstName = Console.ReadLine();
        Console.WriteLine("Enter Last Name");        
        string LastName = Console.ReadLine();
        Console.WriteLine("Hello {0} {1}", FirstName, LastName);
        Console.ReadLine();
    }

}

Output







Note1:
C# is a case sensitive

Note2:
Difference between Write and WriteLine

Write() method => Output values to the screen without newline character
WriteLine() method => Output will start on a new line



Run comments

How to get the run comment?
Press windows+r

Some useful Run comments 
Microsoft Paint- mspaint
Notepad- notepad
Calculator- calc
Microsoft Word- winword



Attach Event vs add Event Listener

Attach Event is only works on Opera and Internet Explore
AddEvent Listener is works on Firefox, Google chrome and Safari (and Opera and Internet Explore from version 9)



Definitions

DOM- Document Object Model is a standard for how to get, change, add and delete the HTML elements






Abbreviations

DOM- Document Object Model
HTML- Hyper Text Markup Language
CSS- Cascading Style Sheets
JS- JavaScript
IIS- Internet Information Services
POC - Proof Of Concept
RSS - Rich Site Summary


Sunday 4 September 2016

Windows 8 tricks

Increase the font size in windows 8         Fn (+) +
Decrease the font size in windows 8        Fn (+) -
Open Run command widow                    Windows (+) R



How to change the background in Windows 8

Method1

Go to Start
Search Change desktop background
Select Background desktop
Browse your picture location from your local disk
If you select more than 1 pictures than, give time for change the picture
Choose your picture position
Click Save Changes


Method II

Go to Control Panel
Select Appearance and Personalization
Select Personalization
Select Background desktop
Browse your picture location from your local disk
If you select more than 1 pictures than, give time for change the pictue
Choose your picture position
Click Save Changes





Saturday 3 September 2016

Techmix

Troubleshoot Google Publisher Tags

Now most of the websites are using DFP (Doubleclick for Publisher) ad. When we open the website the DFP ad will has been render.

How to check the DFP ad render properly or not
Open your website
Add the below tag at end of your website name:
?google_force_console (or) ?google_force_console=1

Keyboard shortcut: CTRL+F10

For Example: http://csharp-sql-tutorials.in?google_force_console
                       http://csharp-sql-tutorials.in?google_force_console=1





How to reset and start IIS with iis command

Internet Information Services (IIS) is a web server.

Why?
When the connection of db server is going high, then our application that is website not responding properly. For immediate action we are go for iis reset which is the server is off and the existing connections are closed. After getting the value '0', then restart the server, the new connection will be accepted.

Procedure:
Go to Start
Type Command Prompt
Right click and select Run as administration


iisreset/stop
iis attempt to stop all services








iisreset/start
iis start all services










iisreset/restart
iis stop all services and automatically start all services.