Creating Understanding and Educating Programmers, Developers and Technical Communities, one post at a time.

Friday, May 15, 2009

Structure

Structure is a lightweight class in C#. The following list details the differences between structures and classes.

Structure
  • implicity inherits from System.ValueType (always reside on stack)
  • are sealed and can not be inherited, and also cannot inherit classes and other structures
  • The default constructor of a structure cannot be replaced by a custom constructor.
  • Custom constructors of a structure must fully initialize the value of the structure.
  • Dont have a destructor
  • Field initialization is not allowed. Const members of a structure can be initialized.

Thursday, May 14, 2009

Global.asax

The Global.asax file(the ASP.NET application file) contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules.

By default, the ASP.NET Framework maintains a pool of HttpApplication objects to service incoming page requests. A separate HttpApplication instance is assigned to each request.

If you prefer, you can create a custom HttpApplication class. That way, an instance of your custom class is assigned to each page request.

You can create custom properties in your derived class. These properties can be accessed from any page, control, or component. You also can handle any application events in your custom HttpApplication class.

You create a custom HttpApplication class by creating a special file named Global.asax in the root of your application. Following are few more detail about it.

  • It is optional file.
  • It must be located in the root directory. (file located in sub-directory is simply ignored)
  • Only one global.asax file per application. (you can not have more than one for an application.)
Example:

public class Global: System.Web.HttpApplication
{
//It is derived from HttpApplication base class

protected void Application_Start(Object sender, EventArgs e)
{
//lush(good) code
}
}

Sunday, May 10, 2009

void pointer

Pointer to void (void *) is a generic pointer capable of representing any pointer type. All pointer types can be assigned a pointer to void without casting. However, a pointer to void cannot be assigned directly to a pointer of another type - the void pointer must first be cast to proper pointer type.

A void * pointer can not be dereferenced.

Wednesday, April 22, 2009

Software Engineering and Ethics

Software is the core for any computer–based system, which affect all aspects of our life. Software development is a complex, expensive, and ethical engineering task which requires qualified SWE professionals. Ethical and professional principles for software engineering professionals were adopted by professional committees such as IEEE and ACM.

In software engineering; there are several problems related to ethical issues. These issues include: professional responsibilities, social responsibility, quality as moral issue, software ownership and intellectual property rights, privacy, computer crimes, confidentiality, responsibility and liability, professional competence, impact on society and work place, security and reliability, and safety.

You should not use your skills and abilities to behave in a dishonest way or in a way that will bring disrepute to the software engineering profession. However, there are areas where standards of acceptable behavior are not bounded by laws but by the more tenuous notion of professional responsibility. Some of these are:

  • Confidentiality: You should normally respect the confidence of your employers or clients irrespective of whether a formal confidentiality agreement.
  • Competence: You should not misrepresent your level of competence. You should not knowingly accept work that is outside your competence.
  • Intellectual property rights: You should be aware of local laws governing the use of intellectual property such as patents and copyright. You should be careful to ensure that the intellectual property of employers and clients is protected.
  • Computer misuse: You should not use any technical skills to misuse other people’s computers.Computer misuse ranges from relatively trivial (game playing on an employer’s machine, say) to extremely serious (dissemination of viruses).
Software engineering is still a young field. In this regard software engineers should supportive of their colleague and provide good environment where they can grow and learn. Lead software engineer should also know about their competence areas. They also have to follow policies and procedure which established by technical communities.

References:
  • Software Engineering Code of Ethics and Professional Practice (ACM/IEEE-CS)
    http://www.acm.org/about/se-code
  • Software Engineering by Ian Sommerville, 8th Ed.

Saturday, April 18, 2009

System.Object

All .Net types are derived from System.Object. Therefore every object of every type has a minimum set of method from System.Object class.
More specifically, System.Object offers following public methods.
  • Equals
  • GetHashCode
  • ToString
  • GetType

Moreover, it also allow access to protected methods.
  • MemberwiseClone
  • Finalize

Tuesday, April 7, 2009

What Causes Application Restart

ASP.net run-time environment implements a good deal of checks and automatically restarts an application if any of the following scenarios occur:
  • The maximum limit of dynamic page compilations is reached.
  • The physical path of the Web application has changed, or any directory under the Web application folder is renamed.
  • Changes occurred in global.asax, machine.config or web.config in the application root, or in the Bin directory or any of its subdirectories.
  • Changes occurred in the code-access security policy file, if one exists.
  • Too many files are changed in one of the content directories. (Typically, this happens if files are generated on the fly when requested.)
  • Changes occurred to settings that control the restart/shutdown of the ASP.NET worker process. These settings are read from machine.config if you don't use Windows 2003 Server with the IIS 6.0 process model. If you're talking full advantage of IIS 6.0, an application is restarted if you modify properties in the Application Pools node of the IIS manager.

Friday, April 3, 2009

ISAPI Filter

ISAPI filters are DLL files that can be used to modify and enhance the functionality provided by IIS. ISAPI filters always run on an IIS server, filtering every request until they find one they need to process. The ability to examine and modify both incoming and outgoing streams of data makes ISAPI filters powerful and flexible.

Comment will be answered quickly to the reader of this post...
;)