Working with WebClient object and Timeout

יום שלישי, אפריל 3, 2012

Hi,The WebClient object in .NET doesn't expose the request TimeOut property.In case you decided to use this object it is better to inherit from it and expose the TimeOut property.  Example: public class SearchWebClient : WebClient { public SearchWebClient() { Timeout = 2000; } public SearchWebClient(int timeout) { Timeout = timeout; } ///<summary> /// Request timeout in milliseconds ///</summary> public int Timeout { get; set; } protected override WebRequest GetWebRequest(Uri address) { WebRequest result = base.GetWebRequest(address); ...
no comments

How to find and reproduce bugs in multi thread applications – CHESS is to tool you must use!!!

יום רביעי, נובמבר 11, 2009

Hi All, If you want to test and reproduce multi thread applications bugs there is a new tool from Microsft called: CHESS. CHESS is a tool for finding and reproducing Heisenbugs in concurrent programs. CHESS repeatedly runs a concurrent test ensuring that every run takes a different interleaving. If an interleaving results in an error, CHESS can reproduce the interleaving for improved debugging. CHESS is available for both managed and native programs. Great movie that explain CHESS: An Automated Concurrency Testing Tool You must adopt this tool for your future multi threaded (concurrent programs) programs. More information on Threading in C# can be found...
no comments

Do we need to Releasing COM objects in .NET?? Write your opinion.

יום רביעי, דצמבר 3, 2008

Well, Good friend of mine, ask me interesting question: "Do I need to release my COM objects on my office add-in application I wrote in .NET??!!". It seems that there are different opinion on this issue. Do we have to use ReleaseComObject or let GC do the job for me? I have my opinion I will write later, but please write your opinion, I really wants to read what you think. Thanks, Rotem 
no comments

Back To Basics: Use Regular Expression Comments

יום ראשון, נובמבר 23, 2008

Regular expressions are much easier to understand if you use the following syntax and comment each component of the expression by using a number sign (#). To enable comments, you must also specify RegexOptions.IgnorePatternWhitespace, which means that non-escaped white space is ignored. Regex regex = new Regex(@"                         ^           # anchor at the start                        (?=.*\d)     # must contain at least one numeric character                        (?=.*)  # must contain one lowercase character                        (?=.*)  # must contain one uppercase character                        .{8,10}      # From 8 to 10 characters in length                        \s           # allows a space                        $            # anchor at the end",                        RegexOptions.IgnorePatternWhitespace);  Enjoy, Rotem
no comments

Microsoft Web Deployment Tool – Beta 1

יום רביעי, אוקטובר 29, 2008

Hi, The Microsoft Web Deployment Tool (msdeploy.exe) is a command-line tool that enables you to synchronize or migrate Web sites or Web servers. It can be used with Information Services (IIS) version 6.0 on Microsoft® Windows Server™ 2003 or IIS 7.0 on Microsoft® Windows Server™ 2008. It can be used to accomplish the following tasks:  1. Migrate your Web server or a single Web site from IIS 6.0 to an IIS 7.0 server. 3. Sync your Web server or a single Web site from IIS 7.0 to another IIS 7.0 server.  3. Sync your Web server or a single Web site from IIS 6.0 to another...
no comments

Customize your .NET object XML serialization with .NET XML attributes

יום ראשון, יולי 27, 2008

Hi, Serialize .net object to XML is very simple operation but let's say you want to control on the serialization and decide on the name of the XML attributes and elements that .net serialization create for your object. Well this is very simple to achive using built-in XML attributes (attributes like: XmlType, XmlAttribute, XmlArray, XmlArrayItem and more...) .NET gives us. The code example include 3 classes: MainStory, Story and BaseStory. MainStory and Story both inherits from BaseStory, MainStory also contain list (List<Story>) of stories objects. BaseStory: public class BaseStory {     protected const string DescriptionContentDelimiter = ":::";           public string Content { get; set; }           public...

How to load an assembly at runtime from specific location

יום חמישי, יולי 3, 2008

Did you know that you do not have to put an assembly that an application must use at runtime in the bin folder of the application. You can put the assembly in any folder on the system, and then you can refer to the assembly at runtime.   In order to do so you can use the AssemblyResolve event. Here is the code example:   AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(CustomResolveEventHandler);   private Assembly CustomResolveEventHandler(object sender, ResolveEventArgs args) {     //This handler is called only when the common language runtime tries to bind to the assembly and fails.     //Retrieve the list of referenced assemblies in an...

Assembly Information Tool

יום רביעי, יוני 25, 2008

Hi,I wrote a nice .NET tool that display .net assembly information like:1) Compilation mode Debug\Release.2) .NET Assembly full name3) .NET Assembly referencesHow to use:After the installation you can point on any .NET Assembly (DLL), press right click and press on the new menu called: "Assembly Information".A popup window with useful information on your Assembly will pops. You can find it in codeplex: .NET Assembly Information Screen Shots: