Ebeworld’s Weblog

Trying to create

why is configuration is more important in modern applications?


In my understanding configuration gives us following advantages:
  1. Customization: Organizations more likely to develop feature rich, general purpose product addressing public, then according to client specification they customize the product, turn off/on special features.
  2. Externalization: It gives advantage of changing software without rebuilding it,and not setting up build environment, build manager etc.  
  3. Centralization of variable parts: putting variable parts in centralized external places. Instead of looking through code to change, and debugging we put it in well known location
  4. Simplifying change: In order to change configuration of most software, per say xml, one doesn’t have to be programmer and know implementation language, detail etc.
  5. Ease of administration: After product is shipped, product is mostly under administrator’s responsibility. To admin the product, one has to see the configuration only, not whole code etc.

November 25, 2008 Posted by ebeworld | software architecture | , | No Comments Yet

Web site owners help from google

November 25, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

Web crawler catalog


http://www.searchtools.com/robots/robot-code.html

Found this one and wrote one by myself in C#, basically they are the same

November 25, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

What is the difference between foreground and background thread?

• Foreground threads have the ability to prevent the current application from terminating. The CLR will not shut down an application (which is to say, unload the hosting AppDomain) until all foreground threads have ended.

• Background threads (sometimes called daemon threads) are viewed by the CLR as expendable paths of execution that can be ignored at any point in time (even if they are currently laboring over some unit of work). Thus, if all foreground threads have terminated, any and all background threads are automatically killed when the application domain unloads.

November 25, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

Object initializer syntax

now we can use {} for object initializer such as Point p=new Point{X=1,Y=2};

Also quite the similar to anonymous methods, there is anonymous class

November 24, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

Partial methods

Partial methods are methods living in partial classes which are marked as partial and has to return void, can have non out argument and implicitly private.

November 23, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

Extended methods

We could’t add methods unless you use reflection etc, prior to  C# 2008.(Though we can use visitor pattern here:)) Now we can do that using extended methods. It can be inside only static classes and this should be the first keyword of  parameters.

for example:

 static class TesterUtilClass

  {

    // Every Int32 now has a Foo() method…

    public static void Foo(this int i)

    { Console.WriteLine(“{0} called the Foo() method.”, i); }

 

    // …which has been overloaded to take a string!

    public static void Foo(this int i, string msg)

    { Console.WriteLine(“{0} called Foo() and told me: {1}”, i, msg); }

  }

 

Also it has direct access to ther classes. For example:

using System;

using System.Collections.Generic;

using System.Text;

 

namespace MyExtensionMethods 

{

  public class Car

  {

    public int Speed;

    public int SpeedUp()

    {

      return ++Speed;

    }

  }

 

  public static class CarExtensions

  {

    public static int SlowDown(this Car c)

    {

      return –c.Speed;

    }

  }

}

Also using keyword also imports extension methods. Extension methods can work through classes
 static void Main(string[] args)
    {
      Console.WriteLine(“***** Extending an interface *****\n”);
      // Call IBasicMath members from MyCalc object.
      MyCalc c = new MyCalc();
      Console.WriteLine(“1 + 2 = {0}”, c.Add(1, 2));
      Console.WriteLine(“1 – 2 = {0}”, c.Subtract(1, 2));
      // Can also cast into IBasicMath to invoke extension.
      Console.WriteLine(“30 – 9 = {0}”,
        ((IBasicMath)c).Subtract(30, 9));
      // This would NOT work!
      // IBasicMath itfBM = new IBasicMath();
      // itfBM.Subtract(10, 10);
      Console.ReadLine();
    }

November 23, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

Automatic properties

It can be defined as 

public String MyName{get;set;}

where get set body is not defined. There is no read only or write only automatic property, since they are automatically generated.. If it is an abstract then the class needs to be abstract.

November 23, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

Implicit typing

C# it uses var keyword, and the variable must be initialized non null statement (since compiler needs to know which type it is referring) at the time of declaring. Also it has to be used as local variable, not field, return value or parameters etc. It can’t be nullable, since its type has to be known.

November 23, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet

Declaration of MulticastDelegate which is default base class of delegates should include 

public string Invoke(bool a, bool b, bool c);//which has to match with delegate function signature

public IAsyncResult BeginInvoke(bool a, bool b, bool c,AsyncCallback cb, object state);//Above plus callback.

public string EndInvoke(IAsyncResult result); //get the results.

 

but if the delegate includes ref or out method the EndInvoke method has to include the them.

November 23, 2008 Posted by ebeworld | Uncategorized | | No Comments Yet