This is a mirror of official site: http://jasper-net.blogspot.com/

How Many Hard Drives Do I Need to Support SQL Server?

| Tuesday, April 6, 2010
Your RAID configuration and the placement of your database files depend on the number of hard drives in your server. Or in other words, you can only use what you have—a real world physical limitation. This is the third post in a series about the file subsystem for SQL Server.

Like almost everyone else that has written about this very complex and important issue, we started talking about RAID and the optimal RAID for this or that. (We had to start somewhere.) However, before you decide which RAID level to deploy, you need to count your hard drives.

Buying New

Are you purchasing a new server to run SQL Server and want to know the number of hard drives to use? The flip answer is more than one and less than 100—about the size of a breadbasket.

OK, here's the serious answer. The number of hard drives you'll want to deploy is a matter of economics and not a consideration of RAID deployment. In fact, the size of the data that you want to hold is the determining factor for the number of drives. We are going to cover this in another post. For perspective, let's run through each scenario.

One Drive

You'll have major issues. If you have only one drive, you don't have any redundancy to your file system, and you can't use RAID. The best thing you can do is deploy another server and implement SQL Server replication to protect your data. Even then, you may lose the transactions in progress if the physical disk fails. Not a good idea. Try again.

Two Drives

Now things are better. With a two-drive server for SQL Server, you deploy RAID level 1 (mirroring), and everything—Windows, SQL Server, database data files, transaction logs, and tempdb—goes onto the one logical drive. For a reminder of what RAID level 1 is, read our previous post. This deployment is fast and redundant; however, it creates a bottleneck around the disk I/O.

The disk subsystem has the potential to be the greatest bottleneck to SQL Server when it comes to hardware.

The speed of the disk drives and their ability to read and write are what truly slow down a server that is running SQL Server—in other words, the more disk heads you have, the faster the server will perform. So even though two drives create a safe environment (using RAID level 1), you want to try to get as many disk heads (i.e., physical disks) in your deployment as possible.

Three Drives

Read more: PTC Windchill on SQL Server

Posted via email from jasper22's posterous

How to call a web service from JavaScript with asp.net Ajax

|
Calling a web service from JavaScript was easy task earlier you need to create a proxy class for JavaScript and then you need to write lots of java script but with Microsoft ASP.NET Ajax you can call web services from JavaScript very easily with some line of JavaScript and even better you can also handle the errors if web service failed to return result. Let’s create a simple hello world web service which will print Hello world string and then we will call that web service into JavaScript. Following is a code for web service.

namespace DotNetJapsSocial
{
 /// <summary>
 /// Summary description for HelloWorld
 /// </summary>
 [WebService(Namespace = "http://tempuri.org/")]
 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
 [System.ComponentModel.ToolboxItem(false)]
 // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
 [System.Web.Script.Services.ScriptService]
 public class HelloWorld : System.Web.Services.WebService
 {
     [WebMethod]
     public string PrintHelloWolrdMessage()
     {
         return "Hello World";
     }
 }
}

Read more: Dotnetjaps

Posted via email from jasper22's posterous

Testing NHibernate Mappings

|
I’m currently in the process of moving Suteki Shop from Linq-to-SQL to NHibernate. It turns out to be a bigger job than I anticipated, and I’ll be writing a post about my experiences soon. I’m using FNH (Fluent NHibernate) to build my mapping files rather than use the tedious built-in XML mapping. One of the big jobs I have is to write unit tests for all the mapping files. For each entity, I want to have a test that creates an instance of it, saves it to the database, and retrieves it. As you can imagine, it would be a tedious task to write all these. With that in mind I’ve created a simple NUnit test that can be reused for any mapped entity

using System;
using System.Reflection;
using NUnit.Framework;
using Suteki.Common.Extensions;
using Suteki.Shop.Tests.Models.Builders;

namespace Suteki.Shop.Tests.Maps
{
   /// <summary>
   /// Runs a simple test for each entity listed. That it can be saved to the database and retrieved.
   /// </summary>
   [TestFixture]
   public class SimpleMapTests : MapTestBase
   {
       [TestCase(typeof (PostZone))]
       [TestCase(typeof (Postage))]
       [TestCase(typeof (Country))]
       public void SimpleMapTest(Type entityType)
       {
           var runSimpleMapTest = GetType().GetMethod("RunSimpleMapTest");
           var runSimpleMapTestForType = runSimpleMapTest.MakeGenericMethod(entityType);
           runSimpleMapTestForType.Invoke(this, new object[0]);
       }

       public void RunSimpleMapTest<TEntity>() where TEntity : class, new()
       {
           var id = 0;


Read more: DZone

Posted via email from jasper22's posterous

PostgreSQL 9.0: Includes the new MySQL Emulation Layer

|
PostgreSQL 9.0.0, released today, contains the MySQL Emulation Layer.

To enable this feature, set the mysql_compatible option GUC to "on".

postgres=# SELECT * FROM pg_settings WHERE name = 'mysql_compatible';
-[ RECORD 1 ]----------------------------------------------------------------
name         | mysql_compatible
setting       | ON
unit            |
category     | Version AND Platform Compatibility / Other Platforms AND Clients
short_desc | Enable MySQL Emulation Layer
extra_desc |
context       | backend
vartype      | bool
source        | DEFAULT
min_val      |
max_val     |

Enabling this option changes the following characteristics (in the entire PostgreSQL cluster):

   * The boolean data type now takes positive integers in addition to "true" and "false".
   * The default TCP port is 3306 to make porting applications easier.
   * Non-aggregate columns in the SELECT list need no longer appear in the GROUP BY clause.
   * CAST may or may not work.
   * ENUMs can no longer contain numbers, only characters are allowed
   * CHAR, VARCHAR and TEXT are case insensitive now. Case sensitive matching is only done with the new BINARY keyword.
   * VARCHAR supports texts up to a length of 255 bytes. Bear in mind that since Unicode/UTF8 characters may need more than one byte for any given character, you must take this into account when calculating what VARCHAR can actually store.
   * Double dash comments must be start with a space after the dashes.
   * Division by zero now raises a warning instead of an error.
   * The || no longer concats strings but is Exclusive OR.
   * For convenience, you may use dates like 2010-02-31.
   * Replication - including bugs - is integrated.
   * The parser now understands DESC and SHOW CREATE syntax.
   * Porters did not finish the MySQL authentication system in the time allotted. DBAs will need to continue to use pg_hba.conf.


Read more: Andreas

Posted via email from jasper22's posterous

Как применять IDisposable и финализаторы: 3 простых правила

|
После рассказа об утечке памяти и правильной реализации событий размещаю еще один перевод понравившейся мне статьи на тему управления памятью. Я видел несколько разных реализаций Dispose паттерна, иногда они даже противоречили друг другу. В этой статье автор представил хорошее и четкое разъяснение, когда следует реализовывать интерфейс IDisposable, когда финализаторы, а когда — все вместе.

Как применять IDisposable и финализаторы: 3 простых правила

Документация Microsoft о применении IDisposable довольно запутанная. На самом деле она упрощается до трех простых правил.

Правило первое: не применять (до тех пор, пока это действительно не понадобится)

Реализуя интерфейс IDisposable, вы не создаете деструктор. Помните, что в среде .NET есть сборщик мусора, который работает достаточно хорошо, чтобы не присваивать null многочисленным переменным.

Существует только две ситуации, когда необходимо реализовывать IDisposable. Посмотрите на класс и определите, нужен ли вам этот интерфейс:

   * В классе есть неуправляемые ресурсы
   * В классе есть управляемые (IDisposable) ресурсы


Обратите внимание, что ресурсы должны освобождать только те классы, которым эти ресурсы принадлежат. В частности, класс может иметь ссылку на общий ресурс — в этом случае вы не должны освобождать его, поскольку другие классы могут продолжать использовать этот ресурс.

Read more: habrahabr.ru

Posted via email from jasper22's posterous

Implementation of Diffie-Hellman algorithm of key exchange

|
Contents

  1. Introduction
  2. Diffie–Hellman algorithm of key exchange
        1. Description of the algorithm
        2. Brief survey of some existing implementations
  3. C++ library, which implements the algorithm
        1. Class ULong of long integer with the arbitrary dimension
        2. Implementation of Diffie – Hellman algorithm
        3. Illustration of library usage with an example
  4. Structure of project files

1. Introduction

The article is devoted to the development of the library that implements the Diffie – Hellman cryptographic algorithm of key exchange. The library appeared as a result of the necessity to use the Diffie – Hellman algorithm without the involvement of any third-party libraries.
2. Diffie – Hellman algorithm of key exchange
2.1 Description of the algorithm

Diffie – Hellman algorithm is an algorithm that allows two parties to get the shared secret key using the communication channel, which is not protected from the interception but is protected from modification.

Diffie – Hellman algorithm is extremely simple in its idea and with it has rather high level of cryptographic stability, which is based on the supposed complexity of the discrete problem of taking the logarithm.

Supposing there are two participants of the exchange (let’s call them Alice and Bob, as it is traditionally established in cryptography). Both of them know two numbers P and G. These numbers are not secret and can be known to anyone. The goal of Alice and Bob is to obtain the shared secret key to help them to exchange messages in future.

Read more: Codeproject

Posted via email from jasper22's posterous

SQL SERVER – Difference Between GRANT and WITH GRANT

|
What is the difference between GRANT and WITH GRANT when giving permissions to the user? This is a very interesting question recently asked me to during my session at TechMela Nepal.

Let us first see the syntax and analyze.

GRANT:
USE master;
GRANT VIEW ANY DATABASE TO username;
GO

WITH GRANT:
USE master;
GRANT VIEW ANY DATABASE TO username WITH GRANT OPTION;
GO

The difference between these options is very simple. In case of only GRANT, the username cannot grant the same permission to other users. On the other hand, with the option WITH GRANT, the username will be able to give the permission after receiving requests from other users.

Read more: Journey to SQL Authority with Pinal Dave

Posted via email from jasper22's posterous

How to Serialize/Deserialize Complex XML in ASP.Net / C#

|
Did you ever want to Serialize/Deserialize a complex XML, like Youtube's API XML Response or Flickr's Feed XML Response. Lets start with Flickr's XML Response and see how to Deserialize it.
You can view the full details on XML over here: http://www.flickr.com/services/feeds/docs/photos_public/

To download/View sample XML head over to this link http://api.flickr.com/services/feeds/photos_public.gne?tags=water

Lets start disecting the XML First thing to identify are the Namespaces Used in the Feed, Namesaces
The namespace used here is:

   * xmlns="http://www.w3.org/2005/Atom"

Other name spaces are used within subelements of the XML, like below:

Other Namespaces

The root node that we have to read is feed and then subsiquently move to the child nodes.Noe to start the correcponding class for this XML, add a new class file to your project as we will be needing many different classes to map to diff objects withing the same XML, its adviceable to add a namespace and then add corresponding classes to the same namespace for easier readability and association to one XML becomes easier.
I am calling the project "FlickPics" and adding a namespace "Classes" under FlickPics, here is a code snippet of the same, also added the XMLRoot Attribute, Remember to use System.Xml.Serialization namespace.

Adding Namespace

adding up of the root element maps the class to that particular element under XML (like here we are mapping "feed" to "FlickrFeed" class),it is very important to give the corresponding namespace of that element, else an error is thrown while deserializing the XML.

Read more: Impact work

Posted via email from jasper22's posterous

Microsoft Office File Formats and Protocols documentation updated for Office 2010 (Think “Now with added ‘X’ flavor… DocX, PptX, XlsX, etc”)

|
The Microsoft Office file formats documentation provides technical specifications for Microsoft proprietary file formats that are implemented and used in the Microsoft Office system.
Version: 0310a
Date Published: 4/2/2010
Language: English
Download Size: 150 KB - 330.4 MB*

The Microsoft Office file formats documentation provides detailed technical specifications for Microsoft proprietary file formats.

The documentation includes a set of companion overview and reference documents that supplement the technical specifications with conceptual background, overviews of file format relationships and interactions, and technical reference information.

Read more: Greg's Cool [Insert Clever Name] of the Day
Download: MS Download

Posted via email from jasper22's posterous

Automate builds using SVN, MSBuild, Cruise control

|
This article will explain that how to use SVN, msbuild, Cruise control and CCtray to automate the build process.

msbuild.xml

msbuild document is used the build the .net solution file. below is the snapshot of the msbuild document. It starts with tag Project and we must have to import the msbuild path installed on our local system. There are Target tags (can be more than one) and we can give them any name. compiler will search for the tag Build and starts with that tag. Before that it will go through the tags specified in DependsOnTarget.  

Read more: Codeproject

Posted via email from jasper22's posterous

Tracing time taken in garbage collection and undertanding CLR GC events

|
CLR GC performance counters % time spent in GC provides approximate time taken by GC in garbage collection.

CLR ETW events can provide very useful insights into how GC is preforming for a process.  Xperf tool found at http://msdn.microsoft.com/en-us/performance/cc825801.aspx can be used to trace CLR events.

Run the following to enable and trace CLR events:

wevtutil im C:\Windows\Microsoft.NET\Framework64\v4.0.30128\CLR-ETW.man (Change the path  C:\Windows\Microsoft.NET\Framework64\v4.0.30128 to appropriate value).
xperf -start clr -on ClrGc -f gcevents.etl
sleep.exe %1
\xperf -stop clr
set _NT_SYMBOL_PATH=srv*d:\symbols*<symbolpath to public symbols>
xperf.exe -evXml C:\Windows\Microsoft.NET\Framework64\v4.0.30128\CLR-ETW.man -i gcevents.etl -o merged.csv -symbols -a dumper
findstr /ips "\/Start \/Stop" merged.csv > gcevents.csv // Filter only start and stop event. Filter any other events required.
notepad gcevents.csv

Read more: Cache & Grid

Posted via email from jasper22's posterous

NTLM authentication may not work for websites based due to Network Security Policies

|
Issue:
===============

We used to get three prompts resulting in 401.1 while our website hosted on IIS 6 was configured to use NTLM. The event logs showed following entries during the issue.

Event Type:   Failure Audit
Event Source: Security
Event Category:       Logon/Logoff
Event ID:       529
Date:            10/08/2009
Time:            16:30:27
User:            NT AUTHORITY\SYSTEM
Computer:     ********
Description:
Logon Failure:
         Reason:                  Unknown user name or bad password
         User Name:   Administrator
         Domain:                  ****
         Logon Type:   3
         Logon Process:         NtLmSsp
         Authentication Package:       NTLM
         Workstation Name:   ******
         Caller User Name:    -
         Caller Domain:         -
         Caller Logon ID:       -
         Caller Process ID:     -
         Transited Services:   -
         Source Network Address:    ***********
         Source Port:  1856


Resolution:
===============

We found that even the file shares were not working, so this was not just a website specific problem. We took the network traces and found from the network traces that we were using NTLM v1 on the client as opposed to NTLM v2. The v2 is more secure and is preferred. Probably they had set LMCompatibility to 0 as discussed in http://support.microsoft.com/kb/239869

So we focussed our investigation towards the NTLM versions being used and the group policy settings for them.  We found that our security group policies had prohibited NTLNv1 due to which we had the issue.

Read more: Simple Solutions To Strange Problems!!

Posted via email from jasper22's posterous

Quick and dirty network usage meter with C#

|
I have always been doubtful of my billing by my internet providers. I wanted to write some code that could help me get a rough estimate of bandwidth I was using in every session. In this article, I will show you how to create a very basic network usage meter for serial port/USB/mobile phone modems with only C# (no Win API calls, sockets or fancy stuff).


The network meter's icon (one with yellow dot).
Note that network icon status.
The icon's tooltip shows usage.
Note that network icon status.

Some entries from the log file.
The last entry corresponds to reported usage.
Clicking on 'Exit' menu item will close the program.
My program is not as sophisticated as others available on the internet, but it does work well for me. It shows usage in current session and logs it in a file. This code should work with many USB modems which actually setup a COM port for communication (example GPRS/3G/HSIA data cards or mobile phones being used as modems).

The basics
The reason, I call this code 'dirty' is, it not well tested and was written in hurry. The program revolves around only two concepts:

   * If data usage is available, then read it from performance counters.
   * If not, then assume that the network is down and wait for network to be available using the 'System.Net.NetworkInformation.NetworkChange' class.

My program has only been tested with HSIA modem, which gets connected to a virtual COM4 port. The program is written in such a way that it handles frequent connection/disconnection and tries to log usage in every session.

The Code
This is a winforms application. In the constructor of the Form we :

   * Create two performance counters, one for measuring downloads and another for measuring uploads.
   * A Timer to poll the performance counters, so that we can check if they are readable (network/port is available).
   * Attach event handler to 'NetworkAvailabilityChanged' event of 'NetworkChange' class, so that we are updated when the COM4 port is available.

The code is given below:

static PerformanceCounter dataSentCounter;
       static PerformanceCounter dataReceivedCounter;
       System.Timers.Timer  networkMonitor;
       string category, instance, fileName;
       static float u, d;

       public Form1()
       {
            InitializeComponent();
            category = ConfigurationSettings.AppSettings["Category"];
            instance = ConfigurationSettings.AppSettings["Instance"];
            fileName = ConfigurationSettings.AppSettings["FilePath"];
            dataSentCounter = new PerformanceCounter(category, "Bytes Transmitted", instance);
            dataReceivedCounter = new PerformanceCounter(category, "Bytes Received", instance);
            NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
            networkMonitor = new System.Timers.Timer();
            networkMonitor.Interval = Int32.Parse(ConfigurationSettings.AppSettings["NetworkPollInterval"]);
            networkMonitor.Elapsed += new ElapsedEventHandler(networkMonitor_Elapsed);        
       }

       private void Form1_Load(object sender, EventArgs e)
       {
           try
           {
               u = dataSentCounter.NextValue();
               d = dataReceivedCounter.NextValue();
           }
           catch
           { return; }
           networkMonitor.Start();
       }


Read more: ashishware.com

Posted via email from jasper22's posterous

Configuring Eclipse PDT to work with Subversion source control

|
Introduction

This is the fifth article of a series of blog post called the WIMPinator Chronicles that describe how to setup a PHP development environment for Windows 7 and IIS 7.5.

So far we covered how to install a Wordpress blog and all its dependencies using the WPI (Web Platform Installer). Then we added additional features and extensions to the PHP deployment on Windows for IIS. I explained how to get PEAR setup and how to download and deploy the PHPUnit unit testing framework using PEAR. Finally I installed Eclipse PDT that I is my preferred IDE for PHP.

In this part I am going to hook up Eclipse to my subversion source control service.
The Series

  1. Getting a Wordpress blog installed in a jiffy on Windows 7 using the Web Platform Installer
  2. Adding additional features to PHP
  3. Installing PEAR and PHPUnit
  4. Installing Eclipse PDT
  5. Configuring Eclipse PDT to work with Subversion source control
  6. Configuring Eclipse to work with Ant build tasks
  7. Creating a new IIS 7.5 fast CGI web site
  8. Setting up XDebug with Eclipse and IIS 7.5
  9. Setting up the Zend Debugger with Eclipse and IIS 7.5
 10. Configuring Ruby and Watir
 11. Moving a Wordpress blog from GoDaddy shared hosting to my local debugging system.

Integrating Eclipse with Subversion
General comments

There are basically two general approaches to use Subversion with Eclipse. First you can just use shell commands like the SVN command line client or, on Windows, TortoiseSVN. And second you can use Subclipse, which is an Eclipse plug-in that gives you Subversion access from within the Eclipse IDE.

This article explains how to install, configure and use Subclipse within Eclipse on Windows 7.
Subclipse links

Subclipse Subversion IDE access can be downloaded manually from here, but, hold on, Eclipse provides a much easier way installing it via a wizard that just needs a URL.

   * Subclipse installation instructions: http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
   * Subclipse project page: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240
   * Download link: site-1.6.6.zip

Installing the Subclipse Eclipse plug-in

This article is specific to Windows 7, Eclipse Galileo and Subversion 1.6.

Note: More general instructions that refer to different versions of Subversion use the following link: http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA

Read more: Tellingmachine

Posted via email from jasper22's posterous

'Midori' concepts materialize in .NET

|
Some of Microsoft’s latest technologies could be green shoots on a migration toward its "Midori" operating system, according to analysts who are familiar with the project.

Recent additions to the .NET Framework adhere to the concurrent programming principles outlined in the Midori documents that SD Times viewed in 2008. Silverlight and the Windows Azure platform could also be complementary to a potential release of Midori, the analysts said.

Midori is a technology incubation project that was born out of Microsoft Research’s (MSR) Singularity operating system, the tools and libraries of which are completely managed code.

Microsoft has designed Midori to be Internet-centric with an emphasis on distributed concurrent systems. It also introduces a new security model that sandboxes applications.

"Midori is an attempt to create a new foundation for the operating system that runs ‘inside the box,’ on the desktop and in the rack. As such, it's willing to break with compatibility (or at least wall off compatibility to a virtual machine)," explained Larry O’Brien, a private consultant and author of the "Windows & .NET Watch" column for SD Times.

Microsoft may be laying a foundation for Midori in its existing development stack through languages and Silverlight as a runtime, O’Brien said. Microsoft Research is also increasingly focused on reasoning about concurrent programs, he added.

Read more: SD Times

Posted via email from jasper22's posterous

BUG: .NET 4.0 (System.Net.Mail) Unable to send emails with large attachments (more than 3MB)

|
This is probably the first bug reported by customer so far for System.Net.Mail Class in .NET 4.0 Framework, or at least the first one I worked on. This was pretty straight forward repro and I did not had to do much to reproduce the issue locally.

static void Main(string[] args)
       {
           SmtpClient client = new SmtpClient("contoso_smtp_server");
           client.Credentials = new System.Net.NetworkCredential("User1", "Password", "contoso");

           MailMessage msg = new MailMessage("user1@contoso.com", "user2@contoso.com", "Large Attachment Mail", "Large Attachment - Test Body");

           Attachment attachment = new Attachment(@"d:\3mb.dat");
           msg.Attachments.Add(attachment);

           client.Send(msg);
       }

That was the simplest code you could possibly write to send out email using SNM but the problem is it Fail with an “Error in sending email” message. So I looked around what was happening and found that the problem was not directly related to SNM but its underlying classes and specifically the Base64Encoding class which was used as default method of encoding emails attachments while sending.

That saved me more troubleshooting and I changed the way the attachments were being encoded from Base64 to 7Bit and it worked like charm.

So all you need to do is add any of the following line to your code to make it work.

// Any "one" of those two code section will work
attachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
attachment.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit;

Read more: Vikas

Posted via email from jasper22's posterous

Microsoft Updates Linux Code

|
Microsoft has released enhancements to the Hyper-V Linux Integration Services that the company contributed to the Linux community last year.

Last July, in a move many compared to seeing pigs fly, Microsoft submitted source code for the Hyper-V Linux Integration Services to the Linux Kernel Community to provide the integration that customers were looking for with Hyper-V. The Integration Services (ISs) are now part of the Linux kernel. On March 31, Microsoft announced a beta release of Integration Services that adds the following new functionality:

·         SMP support for up to 4 virtual CPUs
·         Integrated shutdown, which provides the ability to gracefully shutdown Linux from the Hyper-V console (management partition)
·         Timesync, which keeps the time in the guest OS synchronized with the management partition.

In a March 31 blog post, Microsoft's Brett Shoemaker said interested parties can get a hold of the beta version of the new Linux Integration Components here.

Shoemaker said: "Microsoft developed the ISs to enhance the performance of Linux when virtualized on Windows Server 2008 R2 Hyper-V. The Linux Integration Services allow Linux to run in an 'enlightened mode' on top of Hyper-V. Without this code, Linux runs but without the same high performance."

In a separate post on the issue, Mike Sterling of Microsoft's virtualization team, said:

"Customers who have a heterogeneous operating system environment desire their virtualization platform to provide support for all operating systems that they have in their datacenters. We have supported Linux as a guest operating system on our virtualization platform from the days of Virtual Server and continue to enhance our support in that regard. In July of last year, we submitted our Linux Integration Services for Hyper-V to the Linux community so that they can be included in the Linux kernel.  We have seen great support from the community, having received over 200 patches."

Read more: Naveed Bajwa's Blog

Posted via email from jasper22's posterous

Apache HTTP Server Tutorial

|
The Apache HTTP Server, commonly referred to as Apache , is web server software notable for playing a key role in the initial growth of the World Wide Web. In 2009 it became the first web server software to surpass the 100 million web site milestone.

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.

Apache HTTP Server Presentation

List of Topics Covered ::

Apache HTTP Server Overview
Apache Configuration Files
Core Apache Configuration Directives
Virtual Hosts
Error Handling
Important Apache Modules
Q & A

Read more: LAMP Ville

Posted via email from jasper22's posterous

Handling errors within Stored Procedures in SQL Server

|
The robust Transact-SQL (T-SQL) syntax in SQL Server provides developers with an efficient way to handle errors within stored procedures. This article discusses the @@ERROR, SP_ADDMESSAGE, and RAISERROR functions within SQL Server.

The @@ERROR Function

Upon the completion of any T-SQL statement, SQL Server sets the @@ERROR object. If the statement was successful, @@ERROR is set to 0, otherwise it is set to the designate error code. All SQL Server error codes can be found within the master.dbo.sysmessages system table. One important thing to remember is that @@ERROR is cleared each time a statement is executed. It is a good practice to store the value within a local variable.

Anatomy of an Error

All errors raised by SQL Server return the following information.

   * Number - Each error has a unique number assigned to it.
   * Message - Contains information about the error. Many errors have substitution variables that can be placed within the text. We will cover this in the SP_ADDMESSAGE and RAISERROR sections.
   * Severity - Indicates how serious the error is. The values are between 1 and 25.
   * State - As quoted from SQL Server books on line: "Some error codes can be raised at multiple points in the source code for SQL Server. For example, an 1105' error can be raised for several different conditions. Each place the error code is raised assigns a unique state code. A Microsoft support engineer can use the state code from an error to find the location in the source code where that error code is being raised, which may provide additional ideas on how to diagnose the problem."
   * Procedure name - If the destruction occurred within a stored procedure, the name is returned.
   * Line - The line number of the demon code.

Read more: C# Corner

Posted via email from jasper22's posterous

System.Security.Cryptography.Xml Namespace

|
The System.Security.Cryptography.Xml namespace contains a full implementation of the World Wide Web Consortium standard for digitally signing XML data and files. In other words, the namespace helps you to sign any XML object with a digital signature. Refer to the XML-Signature Syntax and Processing page at http://www.w3.org/TR/xmldsig-core/  for details on this progressing standard.

The sample code in Listing 22.37 shows how to sign XML data and produce an envelope for it via the RSA algorithm.

Listing 22.37: SignXML1.cs, Compute Signature for XML Data

using System;
using System.Xml;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;

public class DigitalSignSample
{
   public static void Main()
   {
       // generate XML data
       XmlDocument document = new XmlDocument();
       XmlNode node = document.CreateNode(XmlNodeType.Element, "", @"Visual Studio .NET", "sign xml samples");
       node.InnerText = @"C# wimps the lama's bass...";
       document.AppendChild(node);
       Console.WriteLine("OriginalXML data:\r\n" + document.OuterXml + "\r\n");

       // create signedxml variable
       RSA rsa = System.Security.Cryptography.RSA.Create();
       SignedXml signedXml = new SignedXml();
       signedXml.SigningKey = rsa;

       // create dataobject
       DataObject dataObject = new System.Security.Cryptography.Xml.DataObject();
       dataObject.Data = document.ChildNodes;
       dataObject.Id = "goo";

       // add dataobject and reference
       signedXml.AddObject(dataObject);
       signedXml.AddReference(new Reference("#goo"));

Read more: C# Corner

Posted via email from jasper22's posterous