Friday, April 17, 2015

3 Ways to Load Html with HtmlAgilityPack

Method 1:
var web = new HtmlWeb();
var doc = web.Load(sourceUrl);

Method 2:
var uri = new Uri(sourceUrl);
var request = (HttpWebRequest)WebRequest.Create(uri);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
var response = (HttpWebResponse)request.GetResponse();

var doc = new HtmlDocument();
var stream = response.GetResponseStream();
doc.Load(stream, Encoding.UTF8);

Method 3:
using (var wc = new WebClient()){
html = wc.DownloadString(sourceUrl);
}
var doc = new HtmlDocument();
doc.LoadHtml(html);

Monday, February 16, 2015

Case-insensitive and Accent-insensitive String Comparison in Linq to SQL

ALTER TABLE Stories ALTER COLUMN Name [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AI

Friday, January 30, 2015

Wednesday, January 28, 2015

AngularJS Directives

ng-app
ng-controller
ng-model
ng-click
ng-submit
ng-repeat
ng-view
ng-show
ng-hide

Tuesday, January 27, 2015

Watching: AngularJS: Get Started























Link: http://www.pluralsight.com/courses/angularjs-get-started

Watching: Building Mobile Apps With the Ionic Framework and AngularJS























Link: http://www.pluralsight.com/courses/building-mobile-apps-ionic-framework-angularjs

Wednesday, January 21, 2015

First Ionic App




Sublime Text Emmet (ex-Zen Coding)

table snippet:
table>tr*2>td*3+tab

generated text:
<table>
      <tr>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </table>

Node.js Setup


Tuesday, January 6, 2015

New Read: jQuery UI In Action


New Read: Microsoft.NET: Architecting Applications for the Enterprise - Second Edition


Elmah Security Settings

<elmah>
    <security allowRemoteAccess="1"/>
</elmah>

<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.allowedRoles" value="Admin" />

Saturday, December 20, 2014

jQuery UI Autocomplete Changes in 1.10

Legacy 1.9 Code:
$("#searchBox").data("uiAutocomplete")._renderItem = function (ul, item) {
 return renderAutoCompleteItems(ul, item);
};

renderAutoCompleteItems = function(ul, item) {
 return $("<li />")
   .data("item.autocomplete", item)
   .append("<a><img style='width:50px; height:50px;' src='" + item.icon + "' /> " + item.label + "</a>")
   .appendTo(ul);
};

Updated 1.10 Code:
$("#searchBox").data("ui-autocomplete")._renderItem = function (ul, item) {
 return renderAutoCompleteItems(ul, item);
};

renderAutoCompleteItems = function(ul, item) {
 return $("<li />")
   .data("ui-autocomplete-item", item)
   .append("<a><img style='width:50px; height:50px;' src='" + item.icon + "' /> " + item.label + "</a>")
   .appendTo(ul);
};