Geeks With Blogs

News My Blog has been MOVED to
Michael Freidgeim's OLD Blog My Blog has been MOVED to September 2011 Entries
Change DocType dynamically
I have a single page(created before Master pages were available) that loaded dynamically one or another user control.Some child controls have css for quirk mode, but for new controls I want to use latest DocType <!DOCTYPE html> The solution is to set it dynamically in code-behind depending on current control to load(the code is copied from =========aspx=============== <%@ Page Language="C#" ......

Posted On Friday, September 23, 2011 9:38 PM

Select First Row In Group using Custom Comparer
We have a requirement for a list of itineraries with multple itinerary items show only single itinerary in the list with details of one of the items selected based on some custom sorting logic. So I needed to group by itinerary ID and sort by custom Comparison and select the first in each group. Below is a LinqPad file that I've used for testing: void Main() { // http://smehrozalam.wordpres... // ......

Posted On Monday, September 19, 2011 6:43 AM

Serializable attribute is not related to XmlSerializer.
.Net has several methods of serialization and sometimes it causes a lot of confusion even for experienced programmers. I believe the best article to describe the different methods is Aaron Skonnard’s Serialization in Windows Communication Foundation(MSDN Magazine > Issues > 2006 > August) (by some reason it’s not highly rated by Google and other articles are coming first for Serialization related requests) There is also a brief comparison table in StackOverflow What are the differences between ......

Posted On Friday, September 16, 2011 11:40 PM

Set Offset to not attached div doesn't work correctly in IE
We want to dynamically show an image below a span html element. The javascript creates a div element, than assigns new offsets using jQuery offset() and then appends the div to document.It worked as expected in FireFox, but moved the new element to the bottom of the page in IE.I found, that if I will call offset after document.body.appendChild, it will assign values correctly.In the test page below if offset is called after document.body.appendChild, new img assigned left: -8, top: 110img left: -8, ......

Posted On Saturday, September 10, 2011 8:50 PM

Compiler doesn’t report missing 'Microsoft.Practices.ServiceLocation”
I’ve upgraded Enterprise Library form 4. to 5 and replaced references to the DLLs (in particular we are using EnterpriseLibrary.Logging”) Compiler doesn’t report any errors about missing dependencies however at run time I’ve got Could not load file or assembly 'Microsoft.Practices.Servic... I had to add the library explicitly. It will be good if the error will be shown during the build. Related links ......

Posted On Saturday, September 10, 2011 8:30 AM

Changing “Trusted Sites” list affected HttpWebRequest in application running under different account
We have a webscraper ASP.Net application, that worked fine on developers and test environments, but didn’t work on some machines with more strict security settings. HttpWebRequest failed with System.Net.WebException: Unable to connect to the remote server It start working when my colleague added the site that application tried to access to his “Trusted Sites” zone using Internet Explorer. What we couldn’t understand, how it affected an application that ran under DIFFERENT account. I didn’t find any ......

Posted On Saturday, September 10, 2011 7:45 AM

Put reusable code into libraries to share between projects
I’ve recently read the post The Mooney Project » Reusable Code Is Bad. Also I disagree with the title of the post, most of the issues in the text are valid and important. Mike Mooney is mostly talking of creating customizable applications, that have hundreds of configuration settings. Most close to my opinion is a comment from Geoff H Design libraries for reuse, glue code to bind together, and logic code to call libraries through the glue. When I am writing an individual method, I am asking myself, ......

Posted On Saturday, September 3, 2011 10:13 PM

Include MoreLinq Library for LINQ extensions
Last week I needed to find an object from collection with maximum value of the property and wrote the following double maxHours = (from loc in locations select loc.TotalHours).Max(); var location = (from loc in locations where (loc.TotalHours == maxHours) select loc).FirstOrDefault(); but wasn’t happy and checked the internet. The answer in referred to ......

Posted On Saturday, September 3, 2011 7:31 PM

Copyright © Michael Freidgeim | Powered by: