Understanding Html5 GeoLocation API-Part II


In the previous blog post we looked at basic GeoLocation API. If you are new to HTML5, refer my previous blog post on HTML5 GeoLocation before continuing with this blog post.

In previous post we saw how to access user's current location just by their browser. We saw three basic functions are available to us as part of GeoLocation API. All these three functions can be found in geolocation *object attribute of the *Navigator object.

  • getCurrentPosition
  • watchPosition
  • clearWatch

From above three we explored getCurrentPosition and saw how we can get users' location, specifically latitude, longitude, accuracy and bunch of other information. The next step once you have the location of the user is track where your users is going !!

Well not exactly, but sometimes you do want to keep track of users' location data, probably for your smart phone application to draw the path on the map or to see how much distance your user traveled. For these purposes, you constantly need to read user's location.

watchPosition and clearWatch functions will provide us the exact same features. Let's enhance on our previously created sample to test these two functions. First let's go ahead and modify our JavaScript to watch user's position. The function will return the ID of the watch you just added. You need to keep this ID around because in future if user does not want you to track him/her you will need this ID to clear the watch. As you might have guessed already, by calling clearWatch function passing this watchID.


Understanding Html5 GeoLocation API Part I


When building web applications, knowing users' current location has a lot of benefits.Following are some examples of real-time use cases of such API.

  • A news channel website knowing the users current location can give higher preferences to the local news near to that user.
  • A movie theater website can leverage users current location and list nearby movies being played.
  • A taxi service can get your location and provided a faster taxi services.

Above are just some of many real time examples, where geolocation API can come really handy and greatly improve user experience.With introduction to HTML5 geolocation API, it is very easy to get users current approximate location. In this blog post we will quickly go through the basics of the new geolocation API.

So without any further discussion let's jump right into the discussion of the actual API. For this sample I will be using Visual Studio as my IDE, however it is not necessary at all for you guys to use it if you do not want to.

Creating Asp .Net Empty Web Application

Let us start by creating a new empty ASP.net Web application using Visual Studio 2012.


Strongly Typed Data Controls In Asp .Net 4.5


One of the cool feature of Asp .Net 4.5 is Strongly typed data controls. In past when we worked with Asp .Net applications we used controls like GridView, Repeater etc. When defining the ItemTemplate for these controls we had to use the 'not very intuitive' Embedded code block technique. And to add to that we had to pass the property names as blind strings hoping that when objects are bound to these controls they will have relevant properties.

Following is an example of one such binding.


Asp .Net MVC Remote Validation


In previous blog posts, we have seen different DataAnnotations attributes provided as part of .Net Framework. In this blog post we will explore once such attribute Remote. Following links refers to other DataAnnotation attributes.

Generally, there are two types of validations we enforce in our applications. One is the client side validation and the other is the server side validation.

Implementing the client side validation mainly involves writing custom JavaScript that performs validation just on the browser itself. The server side validations are obviously performed on the server side, with server side scripting language. The challenge is what if I want to carry out a validation on the client but with the help of some data on the server side.

In Asp .Net, we have used technique like AJAX to perform such validations. But with Asp .Net MVC things are much more simpler, thanks to jQuery and .Net DataAnnotations.

In this blog we will go over the technique called RemoteValidation in Asp .Net MVC Framework.

The [Remote] DataAnnotation Attribute

One of the attribute of Asp .Net DataAnnotation is [Remote]. Based on the parameters provided to this attribute, it will automatically generate the Ajax request on our behalf to perform the validation on the server side. So idea is still the same but we will not have to do lot of JavaScripting.

Creating Asp .Net MVC 4 Application

Let's start by creating the new Asp .Net MVC 4 application.


Installing Windows 8.1 in Hyper-V


In this short blog post we will see how to install Windows 8.1 preview (Windows Blue) using Windows 8 Professional and Hyper-V.

To follow along with this blog post you need following things

First of all we need to enable Hyper-V feature in our system if it is not currently enabled. Running Windows 8 Professional you should have this service already running. In case it is not following are the steps to enable the Hyper-V Services.

Open Control Panel and select Programs