Skip to main content

Posts

Showing posts from July, 2016

C#: Geocoding to get Latitude and Longitude using Google Maps API

Geocoding is the process of getting the latitude and longitude of an address or set of addresses, which you can use to place markers or position the map. Geocoding can be done on the client-side as well as on the server-side, based on your requirements you need to choose one out of both options. For geocoding I am using Google Maps API which is quite reliable and faster in response to other geocoding APIs. You can check the JSON response by directly running the API with the address on the browser window or you can take service of POSTMAN as well. Sample JSON response of Google Map API is given below: Requested geocoding of "Gurgaon" using Google Maps API Request: http://maps.googleapis.com/maps/api/geocode/json?sensor=true&address=Gurgaon Response: {     "results" : [        {            "address_components" : [          ...

SQL Server: Storing language specific data in SQL Server table field.

While working on multi language support we need to insert different language data in same field or different fields of a SQL server table. There are two basic rules one need to keep in mind while storing multi lingual or Unicode data: ·          First is column must be of Unicode data type (i.e., nchar, nvarchar, ntext). ·          And second is that the value must be prefixed with N while insertion. Below is the sample script with output to understand it better. USE MASTER GO -- Drop and Create TestMultiLingualDB IF db_id ( 'TestMultiLingualDB' ) IS NOT NULL       DROP DATABASE TestMultiLingualDB GO SET NOCOUNT ON GO CREATE DATABASE TestMultiLingualDB GO USE TestMultiLingualDB GO CREATE TABLE MultiLanguage ( Id INT , Var_Field VARCHAR ( 50 ), NVar_Field NVARCHAR ( 50 )) GO -- Insert Hindi Characters INSERT ...

Knockoutjs check/uncheck all checkboxes using header checkbox.

While working with Knockoutjs ViewModel, if we implement the select all checkbox feature using traditional JavaScript/JQuery, then in such scenario we can see that Knockoutjs observable property is not getting updated when all checkboxes are checked/unchecked. To handle such situation, we can create Knockoutjs computed property ( with read/write ) and can bind it to header checkbox and there is no need to use the traditional JQuery. Below is the sample code to demonstrate the same: As usual create the Knockoutjs ViewModel and then bind it to UI using ko.applyBindings function CheckViewModel() {     var self = this ;     self.Countries = ko.observableArray(                                                 ...