Pages

Wednesday, June 25, 2008

SQL Injection Attack

Microsoft and Hewlett-Packard have unveiled free tools to help web developers and site administrators defend against the rapidly growing number of SQL injection attacks that aim to hijack legitimate sites.

Check out the below link for more information
http://www.computerworlduk.com/technology/security-products/prevention/news/index.cfm?newsid=9749

Tuesday, June 24, 2008

Sort Array

This C# code snippet sorts the elements of an array into ascending order


public class ReverseArraySort
{

public static void Main()
{
string[] strings = {"beta", "alpha", "gamma"};
Console.WriteLine ("Array elements: ");
DisplayArray (strings);
Array.Sort (strings); // Sort elements
DisplayArray (strings);
}

public static void DisplayArray (Array array)
{
foreach (object o in array)
{
Console.Write ("{0} ", o);
}
Console.WriteLine();
}
}

Thursday, June 19, 2008

Side-by-side execution

Side by Side Excution enables the existence of multiple
versions of .Net Framework on the same machine at the same
time and also multiple versions of applications that use a
version of the .Net Framework.

Also the side by side implenetation requires the use of a
startup Shim.
Shim is a thin piece of code that accepts a Version No and
other start up parameters from host to start the CLR.

Startup shim is implemented in the mscoree.dll.
Only one version of the shim exists in the machine and is
available in the System 32 folder.

Retrieve Current Screen Resolution

Gets the dimensions, in pixels, of the current video mode of the primary display

MessageBox.Show( "Monitor Size:" + SystemInformation.PrimaryMonitorSize );

Cross Join Power

Cross Joins produce results that consist of every combination of rows from two or more tables. That means if table A has 3 rows and table B has 2 rows, a CROSS JOIN will result in 6 rows. There is no relationship established between the two tables – you literally just produce every possible combination.

The danger here, of course, is that if you have table A with 10,000 rows and Table B with 30,000 rows, and you accidentally create the product of these two tables, you will end up with a 300,000,000 row result -- probably not a good idea. (Though it is great for creating test data and the like.)

So, how can this ever be useful? Actually, if you do lots of report writing in SQL, a CROSS JOIN can be your best friend.

Suppose you need to write a report that returns total sales for each Store and each Product. You might come up with this:

SELECT Store, Product, SUM(Sales) as TotalSales
FROM Sales
GROUP BY Store, Product

Thursday, June 12, 2008

NLog

NLog is a .NET logging library designed with simplicity and flexibility in mind. With NLog you can process diagnostic messages emitted from any .NET language, augment them with contextual information, format them according to your preference and send them to one or more targets.

The API (application programming interface) is similar to log4net, and the configuration is very simple. NLog uses a routing table while log4net uses a logger hierarchy with attachable appenders. This makes NLog's configuration very easy to read and maintain.

NLog is licensed under the terms of BSD license, which permits commercial use and the source code is available to anyone at no cost. Everyone is encouraged to test it and report feedback to the mailing list.

NLog supports .NET, C/C++ and COM interop API so that all your application components including legacy modules written in C++/COM can send their messages through a common log routing engine.

The .NET API is very fast at filtering messages, so that you can keep your logging instructions in code and let NLog filter them out at runtime. NLog can filter out as many as 150 million logging instructions per second on a single-CPU 1.6 GHz laptop. Add that to asynchronous processing and other wrappers and you'll get a very powerful and scalable logging tool.

Look for more information
http://www.nlog-project.org/