String Extension Method Zip:
public static byte[] Zip(this string str)
{
var bytes = Encoding.ASCII.GetBytes(str);
using (var memorystreaminput = new MemoryStream(bytes))
using (var memorystreamoutput = new MemoryStream())
{
using (var gs = new GZipStream(memorystreamoutput, CompressionMode.Compress))
{
memorystreaminput.CopyTo(gs);
}
return memorystreamoutput.ToArray();
}
}
Repository Save:
var showsIQueryable = GetShowsIQueryable();
var serializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue };
var data = serializer.Serialize(showsIQueryable);
var compressedDataBlob = data.Zip();
//stores compressedDataBlob
Controller ActionResult Get:
var showsJsonText = _showService.CommandRepo.GetShowsCache();
Response.Headers.Remove("Content-Encoding");
Response.AppendHeader("Content-Encoding", "gzip");
return new FileContentResult(showsJsonText, "application/javascript");
JavaScript:
$.ajax({
type: "POST",
url: serverUrl,
dataType: 'json',
cache: false,
async: true,
data: JSON.stringify(model),
contentType: "application/json; charset=utf-8"
}).done(function (data) {
....
});
HTML:
<script type="text/javascript">
var shows = @Html.Raw(new JavaScriptSerializer().Serialize(Model.Shows)
</script>
Tuesday, July 21, 2015
Thursday, July 16, 2015
Friday, July 10, 2015
Watching: Website Performance
Website Performance
Introduction
Make Performance a Priority
Why web performance?
Performance and user experience
How we get web performance
Focus on the critical path
The total cost of ownership
The Middle-End: YSlow
YSlow rules
Beyond the big 14
The Middle-End: Resources
Images
Minification
The Middle-End: Architecture & Communication
Understanding the middle-end
Introduction to architecture
Data validation
JSON, ajax, & Web sockets
The Front-End: Resource Loading
Preloading images
Lazy loading
Parallel loading
The Front-End: Abstractions & Animation
OO is slower
JavaScript animations
CSS transition vs. css animation
The Front-End: UI Thread, Garbage Collection & jsPerf
The single threaded browser
Threaded JavaScript
Dynamic memory allocation
Introduction jsPerf
JavaScript performance mythbusters
Tuesday, June 30, 2015
Sunday, June 28, 2015
Tuesday, June 23, 2015
Wednesday, June 17, 2015
Friday, May 29, 2015
Friday, May 15, 2015
Using scrum methods with Rational Team Concert Version 4
Using scrum methods with Rational Team Concert Version 4: Part 1. Set up the project, team area, and Product Backlog
Using scrum methods with Rational Team Concert Version 4: Part 2. Plan and manage sprints
Migrate Collaborative Lifecycle Management applications to a cluster: Part 3. Upgrade CLM applications to new versions
Get Ready to Sprint with Rational Team Concert
Search results page: http://www.ibm.com/developerworks/views/rational/libraryview.jsp?sort_by=&show_abstract=true&show_all=&search_flag=&contentarea_by=Rational&search_by=Rational+Team+Concert+Version+4&product_by=-1&topic_by=-1&industry_by=-1&type_by=All+Types&ibm-search=Search
How to write a great user story: https://help.rallydev.com/writing-great-user-story
Image link https://help.rallydev.com/sites/default/files/multimedia/user_story_callouts.png
Using scrum methods with Rational Team Concert Version 4: Part 2. Plan and manage sprints
Migrate Collaborative Lifecycle Management applications to a cluster: Part 3. Upgrade CLM applications to new versions
Get Ready to Sprint with Rational Team Concert
Search results page: http://www.ibm.com/developerworks/views/rational/libraryview.jsp?sort_by=&show_abstract=true&show_all=&search_flag=&contentarea_by=Rational&search_by=Rational+Team+Concert+Version+4&product_by=-1&topic_by=-1&industry_by=-1&type_by=All+Types&ibm-search=Search
How to write a great user story: https://help.rallydev.com/writing-great-user-story
Image link https://help.rallydev.com/sites/default/files/multimedia/user_story_callouts.png
Wednesday, May 13, 2015
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);
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);
Tuesday, April 7, 2015
Friday, March 27, 2015
Sunday, March 8, 2015
Friday, March 6, 2015
Tuesday, February 17, 2015
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
Tuesday, February 3, 2015
Subscribe to:
Posts (Atom)
