May 29, 2009

What do you know about BCL?

Posted at Friday, May 29, 2009
Reactions: 
0 comments Links to this post

image The BCL (Base Class Library) is a combination of classes or we can say that it’s a library of functionalities and types available to all languages that used in .NET Framework. To make the programmer job more easier dot net gave a advantage to includes the BCL in order to collect a large number of common functions, just like to read a file and write to file, graphic rendering, database interaction, and XML document manipulation at one place . The scope of this is large and standard libraries for most other languages, including C++, and would be comparable in scope to the standard libraries is just like Java. The BCL is sometimes incorrectly referred to as the Framework Class Library (FCL), which is a superset including the Microsoft namespaces.

Namespaces

Some of the namespaces may or may not be officially considered part of the BCL by Microsoft, but all are included as part of the standard libraries that are provided with the .NET Framework.

System
This namespace includes the core needs for programming. It includes base types like String, DateTime, Boolean, and so forth, support for environments such as the console, math functions, and base classes for attributes, exceptions, and arrays.
System.CodeDom
This library provides the ability to create code and run it, at runtime.[1]
System.Collections
Defines many common containers or collections used in programming, such as lists, queues, stacks, hashtables, and dictionaries. It includes support for generics.
System.ComponentModel
Provides the ability to implement the run-time and design-time behavior of components and controls. It contains the infrastructure "for implementing attributes and type converters, binding to data sources, and licensing components".[2]
System.Configuration
Provides the infrastructure for handling configuration data.
System.Data
This namespace represents the ADO.NET architecture, which is set of computer software components that can be used by programmers to access data and data services.
System.Deployment
Allows you to customize the way your application upgrades when using ClickOnce.
System.Diagnostics
Gives you the ability to diagnose your application. It includes event logging, performance counters, tracing, and interaction with system processes.
System.DirectoryServices
Provides easy access to Active Directory from managed code.
System.Drawing
Provides access to GDI+ graphics functionality, including support for 2D and vector graphics, imaging, printing, and text services.
System.Globalization
Provides help for writing internationalized applications. "Culture-related information, including the language, the country/region, the calendars in use, [and] the format patterns for dates, currency, and numbers" can be defined.[3]
System.IO
Allows you to read from and write to different streams, such as files or other data streams. Also provides a connection to the file system.
System.Management
Allows you to query for information, "such as how much free space is left on the disk, what is the current CPU utilization, which database a certain application is connected to, and much more."[4]
System.Media
Provides you the ability to play system sounds and .wav files.
System.Messaging
Allows you "to connect to, monitor, and administer message queues on the network and send, receive, or peek messages."[5] .NET Remoting is another name for some of the functionality provided. This namespace is being superseded by Windows Communication Foundation.
System.Net
Provides an interface "for many of the protocols used on networks today",[6] such as HTTP, FTP, and SMTP. Secure communication is supported by protocols such as SSL.
System.Linq
Defines the IQueryable interface and related methods, that lets LINQ providers to be plugged in.
System.Linq.Expressions
Allows Delegates and Lambda expressions to be represeted as expression trees, so that the high-level code can be examined and processed at runtime.
System.Reflection
Provides an object view of types, methods, and fields. You have "the ability to dynamically create and invoke types".[7] It exposes the API to access the Reflective programmingcapabilities of CLR.
System.Resources
Allows you to manage many different resources in the application in order to internationalize an application for different cultures and languages.
System.Runtime
Allows you to manage the runtime behavior of an application or the CLR. Some of the included abilities are interoping with COM or other native code, writing distributed applications, and serializing objects into binary or SOAP.
System.Security
"Provides the underlying structure of the common language runtime security system."[8] This namespace allows you to build security into your application based on policy and permissions. It provides services such as cryptography.
System.ServiceProcess
Allows you to create applications that run as a service within Windows.
System.Text
Supports various encodings, regular expressions, and a more efficient mechanism for manipulating strings (StringBuilder).
System.Threading
Helps facilitate multithreaded programming. It allows the synchronizing of "thread activities and access to data" and provides "a pool of system-supplied threads".[9]
System.Timers
"Allows you to raise an event on a specified interval."[10]
System.Transactions
Provides support for local or distributed transactions.
read more “What do you know about BCL?”

SQL Server ROW_NUMBER() Function

Posted at Friday, May 29, 2009
Reactions: 
0 comments Links to this post

ROW_NUMBER() Function


Problem
For many applications searching and providing a subset of a large result set is the core application functionality. Often the result sets are large and it is a resource intensive process to gather and display the data. This is because the same query is issued each time a new page is rendered, but a different portion of the result set is displayed. Once this technique becomes too much of a performance burden, custom solutions are built to meet the need. With all of the improvements in SQL Server 2005, does a simpler and less resource intensive approach exist to efficiently page through a large result set?

Solution
Yes - SQL Server 2005 now ships with the ROW_NUMBER function which is directly supported in T-SQL. The ROW_NUMBER function provides the ability to issue a query and just return a subset of the result set. This is achieved by using the partition clause and order by clause of the ROW_NUMBER function. In the example below, the partition clause is RowNumber and the order by clause is the OrderDate. The OVER clause is used to determine the partitioning and ordering of the intermediary result set before the ROW_NUMBER function is applied. This is wrapped by the WITH clause which is being used as a common table expression (CTE) for a temporary named result set. With this being said, in the last SELECT statement the CTE is queried and only rows 50 to 60 are returned.






USE AdventureWorks;
GO
WITH OrderedOrders AS
(
SELECT SalesOrderID, OrderDate,
ROW_NUMBER() OVER (order by OrderDate) AS 'RowNumber'
FROM Sales.SalesOrderHeader
)
SELECT *
FROM OrderedOrders
WHERE RowNumber between 50 and 60;
GO

Source - SQL Server 2005 Books Online - ROW_NUMBER (Transact-SQL)


The example above is simple and straight forward. This code can be greatly enhanced by passing in parameters and further customized to meet your specific paging needs, see the related articles in the 'Next Steps' section below. Although an initial usage of this code would be for paging through records in a web based application, think about some of the application challenges you have faced and consider the ROW_NUMBER function as a simple means to address these issues.


Next Steps


read more “SQL Server ROW_NUMBER() Function”

CodeSnip: How to Create a Dynamic Searchable DropDown List in ASP.NET

Posted at Friday, May 29, 2009
Reactions: 
0 comments Links to this post

In this article Nidal examines how to create a dynamic searchable dropdown list using ASP.NET.

Article Contents:

Problem
I have come across many situations where I found myself in need of providing the end user with a searchable combo box that returns the selected value to a text box. An example of such a case is giving the end user the ability to select the name of a product from a long list. ASP.NET does not provide the ability as a default control. So, what I am going to do?

Suggested Design

One idea is to create your own control. Note, I have seen some solutions on the web, however none of them satisfied my requirements. Therefore, I took one and updated it to suit my needs. I created a new popup window that takes the given parameters as to what to fill the box, as well as, the return control.

Solution

Obviously, you are eager to open your Visual Studio .NET 2003 and start coding. So let us do it.

1. Open Visual Studio .NET 2003, create a new ASP.NET website and give it a name: EDropDown.

2. In the default form created, insert two labels and two HTML input boxes.

3. Give the first label a text property My Product Name and the second one a text property My Employee Name.

4. As for the two input boxes, put the ID property type TxtProductName and TxtEmployeeName in sequence.

By now we should have Figure 1 on the first form, the default start up design.

read more “CodeSnip: How to Create a Dynamic Searchable DropDown List in ASP.NET”

Tip/Trick: Guard Against SQL Injection Attacks in .NET

Posted at Friday, May 29, 2009
Reactions: 
0 comments Links to this post

SQL Injection attacks are really nasty security vulnerabilities, and something all web developers (regardless of platform, technology or data layer) need to make sure they understand and protect themselves against. Unfortunately developers too often neglect putting focused time on this - and leave their applications (and worse their customers) extremely vulnerable.

Michael Sutton recently published a very sobering post about just how widespread this issue is on the public web. He built a C# client application that uses the Google Search API to look for sites vulnerable to SQL Injection Attacks. The steps to achieve this were simple:

  1. Look for sites that have querystring values (example: search for URLs with "id=" in the URL)
  2. Send a request to the sites identified as dynamic with an altered id= statement that adds an extra quote to attempt to cancel the SQL statement (example: id=6')
  3. Parse the response sent back to look for words like "SQL" and "query" - which typically indicate that the app is often sending back detailed error messages (also bad)
  4. Review whether the error message indicates that the parameter sent to SQL wasn't encoded correctly (in which case the site is open to SQL Injection Attacks)

Of a random sampling of 1000 sites he found via his Google search, he detected possible SQL Injection Attack vulnerability with 11.3% of them. That is really, really scary. It means hackers can remotely exploit the data in those applications, retrieve any unhashed/encrypted passwords or credit-card data, and potentially even log themselves in as administrators to the application. This is bad not only for the developer who built the application, but even worse for any consumer/user of the application who has provided data to the site thinking it will be secure.

Tip/Trick: Guard Against SQL Injection Attacks in .NET

read more “Tip/Trick: Guard Against SQL Injection Attacks in .NET”

Tip/Trick: Enabling Back Button in ASP.NET AJAX ATLAS UpdatePanel

Posted at Friday, May 29, 2009
Reactions: 
0 comments Links to this post

Tip/Trick: Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel

For example, the below code could be written by a developer in response to a selection change within a list to to add the previous list selection to the browser's history via Nikhil's "HistoryControl":



Code :

private void ContentList_SelectedIndexChanged(object sender, EventArgs e) {
history.AddEntry(contentList.SelectedIndex.ToString()
;
}

private void HistoryControl_Navigate(object sender, HistoryEventArgs e) {

int selectedIndex = 0;

if
(String.IsNullOrEmpty(e.Identifier) == false) {
selectedIndex
= Int32.Parse(e.Identifier);
}

// Update the content being displayed in the page
contentList.SelectedIndex = selectedIndex;

// Mark the update panels as needing an update
mainUpdatePanel.Update();
}


read more “Tip/Trick: Enabling Back Button in ASP.NET AJAX ATLAS UpdatePanel”
 

.NET SUPPORT TEAM © 2008 using D'Bluez Theme Designed by Ipiet Supported by Tadpole's Notez