Posts

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 ...

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...

Yep! Canadians are the nicest people on the planet.

Image
A recent travel story posted on BBC travel site prompted me to write this up on my humble blog and more than that, makes me feel proud Canadian, sharing with you all ... Pretty much everything is relative, at least from my perspective - and this blog is about it, isn't it? Our behavior is observed and compared vis-a-vis someone else's and having myself spent significant amount of time in 3 different continents - I agree 200% with the writer of this post on BBC.

KISS Principle - Your website should be so SIMPLE, a drunk person could use it.

Image
What in the world we are talking about? A drunk person playing with a web site to ensure it is 'tested' in a realistically simplistic nature !! Yes, these days you can hire a person for $150 - who would get drunk and jump on browsing on your website - with an objective of ensuring it is usable by pretty much anyone :-) Refer this link on the geek.com for a ping-back POST.

XSL1.0 String.Replace() is missing! How can that be achieved?

A couple of months ago, one of my team members, Ali Chaudhary dealt with an issue for which XSL 1.0 is in place and couldn't really figure out the String replacement feature in it .. until he hit the following URL .. seems there is always a way to achieve what you want to ...  http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx

Using T-SQL Convert LOCAL datetime to UTC datetime value using UTC offset (defined)

While working on some things recently, I figured there is an easy way to convert (using T-SQL) local time to UTC departure time … and that is leveraging built-in DATEADD function   Reference http://technet.microsoft.com/en-us/library/ms186819.aspx The key is using the right offset value for calculating UTC .. in the scenario that we dealt with, the database has Offset defined in minutes and is based on the offset/difference in minutes FROM UTC time so to convert the captured local date time to UTC.. the following works just fine .. DATEADD ( mi , - < UTCOffsetValue> , <LOCALDateCaptured> )    // mi - minutes As an example for offset, Canada EST (with Daylight) has the value for the Offset defined as -300 [5 hours behind of UTC] whereas for France it is defined as + 60 [1 hour ahead of UTC]

SQL Server database is Case In-Sensitive - is a MYTH!

The case sensitivity or insensitivity depends on the collation applied to the column or at the DB level .. Normally, the default collation is ‘CI’ but please remember it is not always ‘Case Insensitive’  If you run the below query on any particular db server .. SELECT SERVERPROPERTY ( 'COLLATION' )   what you could retrieve the data value, normally would be,  Latin1_General_CI_AS  (CI – Case Insensitive, AS – Accent Sensitive) But it could also be something like this …   Latin1_General_CS_AS  (CS – in this case, it is Case Sensitive)        So though it may take an additional 1/100 th of a nano-second, I'd generally prefer to UPPERize the string comparison such as below … UPPER(SUBSTRING ( COMMENT_ , 1 , 8 )) = ' Schedule '  instead of exact match such as SUBSTRING(COMMENT_, 1, 8) = 'Schedule'

Entity Framework: IQueryable vs. IEnumerable

Found a great post on this, with example .. Entity Framework: IQueryable vs. IEnumerable Many of us sometimes get confused of different aspects of using  IEnumerable < T >  and  IQueryable < T >  in Entity Framework. One of considered opinions is that Entity Framework and  DbContext  and deffered execution just do all the magic and there is no difference. ... But even though LINQ query result remains basically the same, it may significantly impact  the query performance. http://ivanitskyi.blogspot.ca/2013/04/entity-framework-iqueryable-vs-ienumerable.html Hope it is helpful for the team. Cheers Kam

Baseless merge!

Baseless merge in TFS ? or a Baseless Question? :-) A colleague came over wondering for what someone asked him to do - and that is to merge two branches. I believe, the tool allows you to do that however, I wouldn't recommend it simply because it is a sort of sibling-sibling merge rather than (what it is intended for) parent-child merge. Reference to support my perspective ... How do I merge two branches? To perform a merge, you can use the merge functionality in Source Control Explorer, or you can use the  merge  command-line tool. You can merge based on changeset, label, date, or version. You might find that your branching structure becomes deeper than one level. If this happens, keep in mind that it is only possible to merge one level at a time. For example, consider the following source tree structure: Development  – Container for isolation development branches. Feature A Source Feature B Source Main  – Main integration build bran...

How do you sort worksheets in Excel 2010?

Image
Interestingly enough, Microsoft Excel does not have an inherent functionality of sorting data sheets. I was working on something that required to segregate data across multiple worksheets and in no time had come up with several data sheets on the same workbook. I had to find a better way of organizing them and the first thing I needed was an ability to sort my worksheets ... However, there is always a way to find a workaround to it .. and to be honest, I do not find that difficult to apply - this post is about the same. and there I have it my worksheets, sorted ... Basically, you will have to run the macro in VB Editor and run that under a module. Do remember that unless you <save as..> as your workbook as type .xlsm, the macro will not be part of the spreadsheet and in which case you will have to revisit the steps to run the macro again. Reference:  http://support.microsoft.com/kb/812386

K A N B A N

Image
I've been thinking of writing about Kanban for a while and then I happened to read this fantastic blog site which describes pretty much everything that I'd like to share/put up on this site .. why bother typing, eh? Reference:   kanban What is Kanban?

Top 5 TDD Mistakes

While digging into some material related to Telerik's controls, I happened to stumble upon an interesting article by Bradley Braithwaite .. I couldn't agree any more for what Bradley has listed the top 5 mistakes people make in context to the Test Driven Development (TDD) 1. Not using a Mocking Framework 2. Too Much Test Setup 3. Asserting Too Many Elements 4. Writing Tests Retrospectively 5. Testing Too Much Code Navigate here   top5-TDD-mistakes   to dig in more ..

Reverse The Gear

Image
Something triggered this evening and prompted me to write up this post .. and the first thing it came to my mind, what are two difficult things the Driving License folks ask before handing you over for the G/G2 license .. and they are a. Reverse the Car (of course, the car has to be backed up properly between the two yellow lines) b. Parallel Parking -- Park this topic for now, some day we will talk about Parallel Programming Alright, so why the heck I am even talking about it.. well, like I mentioned earlier, something prompted me to ponder over writing up a Reverse routine that must not use a temporary array .. well, sure we can use a temporary variable to (temporarily) store a node value -- and then some one (from my kind of background) may say, well, I don't want to use any temporary variable, whatsoever ..  The following are the two quick code snippets that I believe should work for now :-) Snippet 1: Reverse Method (NOT using temporary Array) Note: Th...

Be cautious! Name your WCF operation contract right

..  and attach a distinct and  meaningful name. When publishing metadata for a service that exposes two different service contracts in which each contain an operation of the same name an exception is thrown.  For example, if you have a service that exposes a service contract called ICarService that has an operation Get(Car c) and the same service exposes a service contract called IBookService that has an operation Get(Book b) , an exception is thrown or an error message is displayed when generating the service's metadata.  To remedy this issue you may want to consider one of the following approach: Rename one of the operations. I'd suggest give them some meaningful name, any way (such as GetCar(Car car) and GetBook(Book book) ) Set the operation Name to a different name Set one of the operations' Namespaces to a different namespace using the Namespace property Reference :  Metadata Architecture Overview

What's up with 2013 in context to 1987?

Image
2013 is the year with distinct numbers (digits) since 1987.. and 1987 was the year when I was out of high-school into the exciting world of pursuing higher education at universities. 1987-1990 : B.S. (Statistics) 1990-1993 : M.S. (Computers) a great snapshot of the MSU at evening time

India Becoming - A portrait of life in Modern India

Image
During the holiday break, the last couple of weeks, I read up a book that resonates so well with my personal observations about the transformation happening in Modern India, these days. This blog, being about a perspective, I couldn't not mention about it. A very brilliantly written and a must read for people interested in understanding various transformation a life juxtaposes while the country is going through some serious, drastic changes - cultures which have flourished over not years, but centuries ... amazon.com URL for the book

What's in a NAME?

Image
It seems, either you can take College Way on your left or Husband Road on the right - depends on whether you are driving up North or down South .. (a perspective, eh!) Never thought there would be such interesting names as well.. ever heard of a Dusty Lane?

An ever bulging wallet!

Image
Lately, I have often spotted people carrying a really bloated wallet! P erhaps they have loads of cash and credit cards to spend during this festive time of the year .. however, one thing for sure that I'd suggest ( am not a professional chiropractor ) do NOT sit in the car with that *bloated* wallet in your back pocket .. too much of an asymmetrical bum balance (not sure if that's even a proper English!) Purge (if Delete is a little too strong for you) any receipts that is being sitting in their for a while... and stow away your plastics, as much as you can. I'd like to share a funny video clip from one of my all time favourite sitcoms Seinfeld - keep your wallet sleek unless you want to end up like George (as below)

Newtown tragedy - a situation WE must do everything to avert!

Horrific ! Terrible ! Gruesome ! are some of the words that comes to our mind naturally, the moment our mind wanders into what happened last Friday (December 14th 2012) at Sandy Hook Elementary School in a beautiful small town in Connecticut. I'm completely appalled! I can't imagine we are really living in the 21st century and these sort of things are happening in one of the most developed countries of the world. Loads of people across the world dream of raising their kids in developed countries foreseeing their best upbringings and nurturing global citizenship in them. Alas! with tons of freedom that some of the developed countries offer, they come with little too many liberal laws - gun control to name one of them! I'd think there certainly are some vested interest and tight lobbying around keeping guns floating around in the countries - but after what happened at Newtown, even the toughest of the tough heart would cry out to STOP this now and for ever! Th...

Visual Studio 2012 Theme Editor

Image
Let me share the URL where I picked up Visual Studio 2012 theme editor .. thanks VS team to have done that work! http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05 I settled on the one as below for now .. Rest assured you can modify the templates that you see now as bunch of options under Environment | General | Color theme .. And if you dare to go as far as *restoring* the icons similar to VS 2010 .. here is where you should navigate to.. http://vsip.codeplex.com/