How to Focus element using pure HTML ? How to set CSS for on Focus?

To set focus on page load using pure html you can use the autofocus keyword. Here is an example on JsFiddle. And to set the css for on focus use the :focus selector in your css. Below is the sample code I have used.

<form>
    <input type="text" id="FirstName" placeholder="First Name" autofocus>
    <input type="text" id="LastName" placeholder="Last Name">
    <input type="text" id="EmailAddress" placeholder="Email Address">
</form>

@import url(http://fonts.googleapis.com/css?family=Roboto);
form input {font-family: Roboto;}
form input:focus {border: 1px solid #044068;}

Hope this helps.

Achieving versioning with Web API in ASP.NET MVC

There are two ways to achieve versioning with Web API

Method 1 : The simple method

/api/accountv1/
/api/accountv2/

The simplest way I found in versioning your API is to create an identical controller of “AccountV1Controller” and name it “AccountV2Controller“, notice the suffix V1 and V2 in controller name, we’ll depend on this part to select the appropriate controller based on API version.

Method 2 : Using routes

/api/v1/account
/api/v2/account

Or you could play with Routes to get the same behavior

config.Routes.MapHttpRoute(
    name: "1-0Api",
    routeTemplate: "api/v1/Account/{id}",
    defaults: new { controller = "AccountV1", id = RouteParameter.Optional }
);
config.Routes.MapHttpRoute(
    name: "2-0Api",
    routeTemplate: "api/v2/Account/{id}",
    defaults: new { controller = "AccountV2", id = RouteParameter.Optional }
);

Taken from here and here

How to get current page URL in PHP WordPress ?

I have been working on my new site called careerbaba.in, its a PHP WordPress based site. On one of my pages I have installed this very interesting Q & A plugin called DW Question and Answer, here is how the page looks like after configuring it.

So to get the current page URL in PHP, I used the below line of code and it worked for me. Noting it down here so that I don’t have to Google it out again, Surprisingly I couldn’t get this easily when I Googled this “How to get current page URL in PHP WordPress ?

<?php the_permalink(); ?>