Geeks With Blogs

News My Blog has been MOVED to

Michael Freidgeim's OLD Blog My Blog has been MOVED to December 2008 Entries
IIS Set Expiration Dates adds the expiration header only to static content
12 Steps To Faster Web Pages With Visual Round Trip Analyzer recommends (among others useful suggestions) to Set Expiration Dates - follow Using Content Expiration (IIS 6.0), . I've looked in a few articles, including Best Practices for Speeding Up Your Web Site, "Optimizing a Page-Load Performance Profile and Optimization of a Web Site - Using Content Expiration (IIS 6.0) . Finally the post IIS Content expiration header and ASP.NET cleared my concerns: IIS is smart enough to add the expiration header ......

Posted On Wednesday, December 31, 2008 3:57 PM

Helper functions to find pattern contaned in string from pattern List
Below are a few helper functions for List<string> generic class. They could be modified to be extension methods. //See also StringArrayHelper.cs, CollectionsHelper.cs public static class ListOfStringsHelper { public static bool StringContainsAnyFromList(L... patternsList, string sMsg) { bool bFound = patternsList.Exists( delegate(string pattern) { return sMsg.Contains(pattern); } ); return bFound; } public static string FindFirstListItemContainedI... patternsList, ......

Posted On Friday, December 12, 2008 10:39 PM

ToString function for Generic List
Below is the method to output Generic list of objects as string. UPDATE: I've replaced my original function with the code suggested by James Curran (see his comment below). public static string ToString<T>(IEnumerab... messages, string sComment) { StringBuilder sRet = new StringBuilder(sComment); if (messages != null) { foreach (T msg in messages) { sRet.AppendLine(msg.ToStrin... } } return sRet.ToString(); } /// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> ......

Posted On Friday, December 12, 2008 10:34 PM

Access to Relative To Application Root File
Sometimes you have a file relative to the root of application, that you want to read from your code. However when your code is build on development machine, the binary files are located in "\bin\debug","\bin\release" or just "\bin"(for VB or Web projects). And you need to make copy of files relative to bin/debug folder. The function below helps to find the file, even if it was not copied to bin subfolder. (Should I name it ResolvePath smilar to Page.ResolveUrl?) Note, that in most cases Visual Studio ......

Posted On Friday, December 12, 2008 10:22 PM

Debugging Windows Services with "Edit & Continue"
I needed to debug Windows Services. But I didn't like suggested in multiple articles Debugger.Launch. Thanks to post "Debugging Windows Services is a Pain" (and article CodeProject: Debugging Windows Services under Visual Studio .NET) I was able 1. To download Service Debugging Helper (Binary) (or Service Debugging Helper (Binary + Source)) 2. Add in my service project a Reference to AndersonImes.ServiceProcess... 3. Change in the Main() function //ServiceBase.Run(ServicesT... ServicesLoader.StartService... ......

Posted On Monday, December 8, 2008 9:35 PM

Understand Project dependency Hierarchy in VS solution
I have a huge VS solution(with more than 60 projects) and for some projects order of references is not obvious. If you do not understand the hierarchy,you will get circular dependency":Adding this project as a reference would cause a circular dependency." Unfortunately, Visual Studio doesn't create diagram to show projects hierarchy. Open Source Project dependency graph generator didn't help me, because it created only 2 levels of hierarchy for my huge solution. Also for project with . in the name(e.g. ......

Posted On Friday, December 5, 2008 12:47 PM

Avoid throwing exception from asynchronous delegate.
I am using delegate to invoke asyncronous call of the function. Sometimes the function can throw exception. As described in thread Re: exception handling with events , article "Handling Exceptions Thrown from an Asynchronous Delegate"(and in many other places) "You should call EndInvoke in a try/catch block to catch any exceptions your asynchronous method threw". I followed the same approach in my Asynchronous long-running tasks in ASP.NET application The code is like the following: RecalculateDelegate ......

Posted On Wednesday, December 3, 2008 10:45 PM

Helper functions to get last element in collection
Below are couple simple helper functions to get last element in collection: public static Object LastElement(Object[] myArr) { if( IsNullOrEmpty(myArr)) { return null; } return myArr[myArr.Length-1]; } public static DataRow GetLastRow(DataTable tbl) { if (tbl == null) { throw new NullReferenceException("tbl is null"); } if (tbl.Rows.Count == 0) { return null; } return tbl.Rows[tbl.Rows.Count - 1]; } ......

Posted On Wednesday, December 3, 2008 10:06 PM

Copyright © Michael Freidgeim | Powered by: