Skip to main content

Posts

Showing posts from February, 2014

Remove HTML tags from string including   in C#

        public static string RemoveHTML(string html)         {             try             {                 StringCollection sc = new StringCollection();                 // get rid of unnecessary tag spans (comments and title)                 sc.Add(@"<!--(\w|\W)+?-->");                 sc.Add(@"<title>(\w|\W)+?</title>");                 // Get rid of classes and styles                 sc.Add(@"\s?class=\w+");                 sc.Add(@"\s+style='[^']+'");                 // Get rid of unnecessary tags                 sc.Add(                 @"<(meta|link|/?o:|/?style|/?div|/?st\d|/?head|/?html|body|/?body|/?span|!\[)[^>]*?>");                 // Get rid of empty paragraph tags                 sc.Add(@"(<[^>]+>)+&nbsp;(</\w+>)+");                 // remove bizarre v: element attached to <img> tag                 sc.Add(@"\s+v:\w+="&quo

Validate Between Two Times - C#

How to check if DateTime.Now is between two given DateTimes for time part only? Since you are only gathering two times without dates, you need to figure out if the two times are from the same day or not. If you put the   StartTime ,   EndTime , and   Now   into   TimeSpans : If ( StartTime > EndTime ) { // the range crosses midnight, do the comparisons independently Return ( StartTime < Now ) || ( Now < EndTime ); } Else { // the range is on the same day, both comparisons must be true Return StartTime < Now && Now < EndTime ; } Ref : http://stackoverflow.com/questions/12998739/how-to-check-if-datetime-now-is-between-two-given-datetimes-for-time-part-only

Find your Facebook ID - a 5-second easy tool for locating your Facebook numeric personal ID

Enter Facebook Page Name:    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>     <script>         $(document).ready(function ($) {             $("#btnGetPageId").click(function () {                 var companyName = $("#txtKey").val();                 //alert( companyName );                 $.ajax({                     //url: "https://graph.facebook.com/gate6agency",                     url: "https://graph.facebook.com/" + companyName ,                     type: "GET",                     cache: false,                     dataType: "JSON",                     contentType: "application/json",                     success: function (data) {                         console.log(data);                         alert("page Id :" + data.id);                     }                 });