Data Structures and Algorithms with Object-Oriented Design Patterns in C#

Wednesday, May 23, 2007

Let me share with you a book whose primary goal is to promote object-oriented design using C# and to illustrate the use of the emerging object-oriented design patterns.

The book deals with software design patterns like: singleton, container, enumeration, adapter and visitor and how we can use them in an Object Oriented Approach with C#.

Virtually all of the data structures are presented in the context of a single, unified, polymorphic class hierarchy. This framework clearly shows the relationships between data structures and it illustrates how polymorphism and inheritance can be used effectively. In addition, algorithmic abstraction is used extensively when presenting classes of algorithms. By using algorithmic abstraction, it is possible to describe a generic algorithm without having to worry about the details of a particular concrete realization of that algorithm.

A secondary goal of the book is to present mathematical tools just in time. Analysis techniques and proofs are presented as needed and in the proper context. In the past when the topics in this book were taught at the graduate level, an author could rely on students having the needed background in mathematics. However, because the book is targeted for second and third-year students, it is necessary to fill in the background as needed. To the extent possible without compromising correctness, the presentation fosters intuitive understanding of the concepts rather than mathematical rigor.

This book presents the various data structures and algorithms as complete C# program fragments. All the program fragments presented in this book have been extracted automatically from the source code files of working and tested programs. It has been tested that by developing the proper abstractions, it is possible to present the concepts as fully functional programs without resorting to pseudo-code or to hand-waving.

This book does not teach the basics of programming. It is assumed that you have taken an introductory course in programming and that you have learned how to write a program in C#. That is, you have learned the rules of C# syntax and you have learned how to put together C# statements in order to solve rudimentary programming problems.

View/Download This Book

Validation Controls in ASP.NET

Monday, May 21, 2007

You might have used Validation controls in ASP.NET. There are two noteworthy enhancements to BaseValidator class from which all validation controls derive from.

1) A new property SetFocusOnError is now available, which when set to True, will automatically generate necessary JS script to set the focus to the control being validated if there is a validation failure.

2) Another property named ValidationGroup has been added. By setting a common value to a set of validation controls and to a Submit button in your Form, you can selectively fire validation events for some controls. In ASP.NET 1.x this kind of granular control over the validation process is not feasible. If you have a set of validation controls, all events would fire when the Form is attempted for submission. This new feature can be leveraged when you have two logical sets of UI elements to be validated and the user can initiate two distinct operations using two different buttons in the screen.

IButtonControl Interface in ASP.NET 2.0

Friday, May 11, 2007

ASP.NET 2.0 has introduced a new interface named IButtonControl under System.Web.UI.WebControls namespace. The properties and methods of this interface can be implemented to make a control behave like a button in a web form. One of the important properties is PostBackUrl. This can be used to post the current page to a different page, in other words, doing cross-page posting.

On a related note, view state related to cross-page posting is stored in a hidden variable named __PREVIOUSPAGE. The target page can refer to the posting page by using Page.PreviousPage property which is also new in ASP.NET 2.0.

To know more about the interface, please read the MSDN library link.

ASP.NET 2.0 Provider Model

Tuesday, May 8, 2007

ASP.NET 2.0 introduces a new Provider model which allows developers to implement a requirement differently without changing a common interface. There three aspects to it - the provider class, the configuration layer and a data store. The Provider class implements the functionality, the configuration layer lets you configure which provider to use irrespective of the data store. The data store could be Active Directory, SQL Server, Oracle, etc. Let me explain with an example.

Consider authenticating users using a Membership provider. If you want to use “as is”, you need to set up a SQL Server database, make few configuration entries in Web.config and have a login control in your ASP.NET page. No explicit coding is required to authenticate users. On other hand, if you want to have your custom authentication method, you can create your own Membership Provider by extending the MembershipProvider class and overriding the ValidateUser method and other “must override” members. While doing so, you do not have to change the code tightly coupled with the UI (the code that invokes the provider).

To learn more, read this MSDN article.

Drag and Drop in Javascript

Monday, May 7, 2007

Implementing a Drag and Drop functionality to your web page sounds really cool, but it is not simple and you will agree on that.
Here we will see how can we implement drag and drop in out web site using Javascript 1.2 and layers.

Check out this ebook from to see how can we implement this.

To download the file click on the image below

Note : This ebook is under the Creative Commons Attribution License. This ebook is free and legal.

How To Start a Website From Scratch

There must be many of you who want to create a website of your own, but you are not sure how to proceed for that.

Well Here is a tutorial from that will teach you how to create a website from scratch.

To download the file click on the image below

Note : This ebook is under the Creative Commons Attribution License. This ebook is free and legal.

Threading in .NET 2.0

Thursday, May 3, 2007

If you have used threading in .NET framework 1.x, you may be familiar with Suspend and Resume methods. Please note that these two methods have been deprecated in .NET Framework 2.0. As a replacement, use one of the following thread synchronization methods based on the scenario.

1. Use the Interlocked class and associated Add, Increment, Decrement methods if the operation that you want to perform is a very simple mathematical operation.
2. Use lock object to encapsulate the critical section (the lines of code that need to run as one atomic operation).
3. Use Monitor class for more granular control. This class exposes methods such as TryEnter and Wait in order to obtain an exclusive lock.
4. Use ReaderWriterLock class in scenarios where multiple threads need to read from a common source and only one thread needs to write to the common source at any given point of time.
5. For thread synchronization across AppDomains or processes, you can use kernel-level objects exposed through .NET classes such as Mutex, Semaphore and EventWaitHandle.



2009 ·Techy Freak by TNB