Posts

Showing posts from 2016

HTML Scrubbing !

Just very recently I extended a little help to one of my UI developers (an Angular one :-)) and thought I'd share with the community a little piece of C# code.. Context : As with many legacy application data, we ran into one that has persisted a lot of garbage HTML data, copy-pasted from a Rich Text Editor, without application validating much of it..That accumulated a lot of HTML code persisted, when read and displayed using Angular.js framework, did not display the right content. The right content was intended to strip off all the HTML tags including &nbsp; as well. The below little utility as C# static function does exactly what I intend to put forth the above context..         public static string ScrubHtml(string value)         {             var step1OfScrubbedHtml = Regex.Replace(value, @"<[^>]+>|&nbsp;", "").Trim();             var step2OfScrubbedHtml = Regex.Replace(step1OfScrubbedHtml, @"\s{2,}", " ");

QuadKey - what it is?

Image
To start with, let me share an excerpt from MSDN as below: Bing Maps Tile System (Reference:   https://msdn.microsoft.com/en-us/library/bb259689.aspx ) Bing Maps provides a world map that users can directly manipulate to pan and zoom. To make this interaction as fast and responsive as possible, we chose to pre-render the map at many different levels of detail, and to cut each map into tiles for quick retrieval and display. This document describes the projection, coordinate systems, and addressing scheme of the map tiles, which collectively are called the Bing Maps Tile System. So if you follow the above references Bing Maps Tile System, you would get an idea that  - how the world map is kind of apportioned into a tile system and depending on what level of detail or zoom you are interested in, you would get a <N> character long quad-key.  For what I am involved with currently, we care to go for the maximum allowable detail to uniquely identify each geo-location,