Saturday, July 04, 2009

How to install PHP on IIS 5.1

I found the extracting the PHP source files into PHP folder in windows XP over PHP installer [Executing .exe file for the ISAPI extension].

Steps to install PHP 5.2.1 in IIS 5.1

Create the folder in C:\PHP.

Extract the compressed format "php-5.2.10-Win32" on the newly created folder.

give the permission for the folder C:\PHP by right click on the folder like you see here..
and do not forget to share the websharing option for the folder.select Share this folder option.



Now the major property setting is how the IIS is going to process the PHP script.
We can achieve this by setting ISAPI Filter as follows.



Now home directory setting for the PHP processes by IIS,Just see next to ISAPI Filter tab.



After completing this process,reset the IIS server by typing "iisreset" in command prompt.

type the script as follows to check IIS process the php scripting.

phpinfo();
?>

save this under C:\Inetpub\wwwroot as First.php

type the http://localhost/First.php

My setting works fine and got output as like this..

Saturday, June 20, 2009

Converting DataSet to array list

public string[] ProductList()
{

ArrayList al = new ArrayList();
string s = "";

Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand("SELECT ProductName from Products");
DataSet ds = db.ExecuteDataSet(cmd);

foreach (DataRow dRow in ds.Tables[0].Rows)
{

al.Add(dRow);
}

foreach (Object row in al)
{
s = s + ((DataRow)row)["ProductName"].ToString() + ",";

}
string rawString = s.TrimEnd(',').ToString();
string[] result = rawString.Split(',');
return result;

}
then you can bind this array to Gridview
Gridview1.DataSource=ProductList();
Gridview1.Bind();

Tuesday, June 16, 2009

MSMQ - Architecture

This will be the simplest understanding diagram of what MSMQ architecture is
********************************************************
Sending Application[Physical]
|
|
|
V
MSMQ [Layer built in topof SQL Server]
|
|
|
V
Receiving Application [Physical]

**********************************************

Sending Application
|
|
|------>Writes Message [Transaction - 1]
|
|
|
|------> Put written message into Queue [Transaction-2]


Sending application prepares a message and puts into Queue.
A Message can be any type of information that receiving application understand.
Receiving Application
Receives the messages and process them.
Notes:
Receiving application and Sending application were not tightly coupled,they can work
without help of other application support

How it was possible ?
Because of built-in layers between connected computers[clients].
Two types of Messages are there,one is Private Message and secondly we have Public
message
Private message :These messages only on locally on particular machine and are not
published on publically.
Public message: These messages will reside on active directory.So applications
running on different servers throughout the network can find the public queues
through active directory.

Monday, June 15, 2009

Exception handling in WCF

This is an simple example for how to manage exception in WCF and their client.
WCF returns system exception and application exception during development time.
But hosting time,these kind of exception will not handled by SOAP protocol.
So SOAP friendly exception details must be implemented on service side using FaultContractAttribute.
Generate the custome exception message must be implemented on a class that start preceding with DataContractAttribute.

WCF Source for Exception handling

[ServiceContract]
public interface IService
{
[OperationContract]
[FaultContractAttribute(typeof(FaultContractExceptionTest))]
string GetData(int value);

}
[DataContractAttribute]
public class FaultContractExceptionTest
{
private string Msg;
public FaultContractExceptionTest(string msg)
{
this.Msg = msg;
}
[DataMember]
public string ErrorMessage
{
get { return this.Msg; }
set { this.Msg = value; }
}
}
________________________________________________________________________

Service Implementation Source
_________________________________________________________________________
public class Service : IService
{
public string GetData(int value)
{

if (value == 152)
{
return "Your authentication code is " + value.ToString();
}
else
{
throw new FaultException(new FaultContractExceptionTest("Check your Pass Number"),"Some Problem");
}}}


Client Implementation - Source code - I written on Button click event
ServiceClient sc = new ServiceClient();
try
{

Response.Write(sc.GetData(Convert.ToInt32(TextBox1.Text)));

}

catch (FaultException msgObj)
{
Response.Write(msgObj.Detail.ErrorMessage);
}