HTML5 Geolocation API - Getting Started

0 comments


Geolocation is one of the first HTML5 features that has been embraced across all major browsers. In this article, we will look at the HTML5 Geolocation API to get/access a user’s Geolocation.

Using HTML5 Geolocation API, you can share your current location with trusted web sites or even use it to provide additional geo location features in your own website, like providing discounts to visitors of your city. Finding out a visitor’s current location can be done using various methods. For example –
  • Find location using IP address
  • Wireless network connection
  • Using GPS etc
In HTML5, we can fetch Latitude and Longitude using JavaScript. We can make use of the global “navigator.geolocation” object to do so. Using the latitude and longitude of Geolocation, you can then share your location for example with apps like Google Maps.

Tracing in ASP.NET Web API

3 comments


Tracing plays an important part in keeping track of how things are flowing through in your Application Services. Configuring tracing to collate system output is invaluable in gathering correct information about what the service is actually doing other than throwing a HTTP 5xx or HTTP 4xx error.

If you want to implement a TraceWriter of your own, you can implement the ITraceWriter and register it as the required or you could use the Microsoft.AspNet.WebApi.Tracing package from Nuget and simply turn on Tracing.

Before we look into tracing let’s take a sneak peek behind the ‘interesting’ implementation of Tracing in Web API.

Backbone.js Handling DOM events and working with Collections

0 comments


Backbone.js is a lightweight JavaScript library loosely based on the Model-View-Controller (MVC) pattern (it’s not an MVC framework) and it allows developers to create single-page web applications. We covered some basics of Backbone in a previous article

To manage data of web applications, Backbone provides a Model creation strategy. The model allows us to define properties to contain data and business logic. The Collection declaration allows to store collection of the data, which is later used by the view.

In Backbone, the View (UI) is generally rendered using HTML Templates, and elements declared in this Template are accessible to View, but it might be possible that the HTML page (or MVC view or .aspx) already contains HTML elements and you need to handle the DOM events for these elements. The question then is how to handle them?

In the following implementation we will see that the ‘click’ event for the html button element is handled inside the View object. The method which gets executed for the click event is used to add the model object into the collection and then the collection is rendered using HTML Table.

Validate a Form using jQuery and Bootstrap Validator

0 comments


One of the typical tasks when developing a web site is building a form to accept information, feedback or comments from visitors. But before submitting the form, it becomes necessary for us to validate user input before submitting the data to the server. You can validate phone numbers, emails, addresses, dates, credit cards etc. depending on your requirements.

In this article, I will show you a simple way to validate a form. For this purpose, we will use a plugin called Bootstrap Validator (project on http://bootstrapvalidator.com/ ).

This plugin is based on Twitter Bootstrap.js and offers some great and expanding list of features. Some of them are:
  • Bootstrap UI and web-fonts integration
  • Validator initialization based on plugin options or HTML data-attribute
  • Some built-in fields validators like: length of the content, date, credit card, IBAN, IMEI, phone, and some others
  • Custom fields validators
  • Possibility to add multiple validators to each field
  • Possibility to show a feedback icon on the field after its validation
  • Possibility to show the validation messages in a specific HTML element
  • Rich API’s to manipulate the plugin instance and behaviors
  • Some supported languages for localization

Using CSS Selection Pseudo-element to change the Default Selection Style of your WebPage

0 comments


CSS Pseduo-elements allow you to style certain parts of a document. In this article, we will see how to change the default selection style of your web page contents using ::Selection PseudoElement.

Although you can use any webeditor of your choice, I am using Visual Studio 2013 for this demonstration. Let’s start by creating a new ASP.NET Web application. Start Visual Studio and click on New Project. Choose the Web Category and choose ASP.NET Web Application as shown below –

crtwebapp

Load Dynamic Content in jQuery UI Tabs in an ASP.NET MVC 4 application

2 comments


In this article we will see how to load the contents into Tabs dynamically using ASP.NET MVC 4.0.
Create a new ASP.NET MVC 4.0 application with the name “DynamicContentsTabs”. Choose Internet Application template as shown below –

internet-application

Once the project is created, let’s add the latest version of jQuery script and jQuery UI using NuGet packages. Install the required jQuery Scripts.

Free Chart Control for WinForms, WPF and ASP.NET

2 comments


Nevron has released a Lite edition of Nevron Chart for .NET as Community edition and they are providing licenses for it absolutely free of charge. Some supported charting types and other features of their chart controls are listed over here: https://www.nevron.com/products-dot-net-chart-free-control.aspx

Since the Community edition is part of the Nevron Chart control, it also relies on licenses (free of charge). They are providing 3 types of licenses –
  • Desktop (required for redistribution of your compiled desktop app),
  • Developer (for your development machine) and
  • Server (required for web application deployment)
The Developer and Server licenses are bound to specific machine IDs and they will require these IDs in order to issue your community license.

You can acquire the free license by following these steps:

1. Register a Nevron.com account and activate it

2. Download the Nevron Vision for .NET installation. They are providing 5 separate installations for the different versions of Visual Studio and the .NET Framework

3. Once you install the Vision suite on your development machine, run the Nevron License Key Manager and obtain the machine ID (located in the key manager window title)

4. Send them your development machine ID via email

Nevron will reply back once the account is updated and the corresponding licenses are available.
I think overall if you are a developer who needs a free chart control for your .NET apps, this is as good as it gets. Get your free license here

ASP.NET Web API 2.0 and the new OData keywords

1 comments


Web API gained OData Support with the Visual Studio 2012 Update 2 release. However it was missing support for some keywords like $select, $expand and $batch. Today we’ll see how to setup our ASP.NET project to use Web API 2.0 beta binaries in Visual Studio 2012 Update 2 and use the new Keywords.

Setting up a WebAPI 2.0 project using Visual Studio 2012

Step 1: We start our project with a Visual Studio 2012 ASP.NET Project. Note that we use .NET Framework 4.5. This is because Web API 2.0 takes dependency of .NET Framework 4.5.

webapi-project-empty-new
 

Copyright © 2009-2014 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions