Tuesday, June 21, 2011

Can we overload methods in WCF Service or Web Service?

Yes for a WCF Service use the Name property of OperationContractAttribute class
example:
[ServiceContract]
interface ddd
{
[OperationContract(Name = "one")]
int calc(int a,int b);

[OperationContract(Name = "two")]
double calc(double a,double b);
}

1)For a Web Service use the MessageName property of WebMethodAttribute class
2)Please comment the following line in the .cs file of the Web Service
//[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[WebMethod]
public string HelloWorld(string a) {
return "Hello"+" "+a;
}
[WebMethod(MessageName="second")]
public string HelloWorld()
{
return "Hello second";
}

What does a Windows Communication Foundation, or WCF, service application use to present exception information to clients by default?

However, the service cannot return a .NET exception to the client. The WCF service and the client communicate by passing SOAP messages. If an exception occurs, the WCF runtime serializes the exception into XML and passes that to the client.

What is the use of Is Required Property in Data Contracts?

Data Contracts, is used to define Required or NonRequired data members. It can be done with a property named IsRequired on DataMember attribute.


[DataContract]
public class test
{
      [DataMember(IsRequired=true)]
      public string NameIsMust;

      [DataMember(IsRequired=false)]
      public string Phone;          
}

Wednesday, June 15, 2011

Delete Duplicate Recods from a Table in SQL Server 2005

CREATE TABLE dbo.Dupes
(
    PK_Column INT IDENTITY(1,1),
    Dupe_String VARCHAR(32)
)



INSERT dbo.Dupes(Dupe_String)
    SELECT 'foo'
    UNION ALL SELECT 'foo'
    UNION ALL SELECT 'foo'
    UNION ALL SELECT 'bar'
    UNION ALL SELECT 'bar'
    UNION ALL SELECT 'splunge'
    UNION ALL SELECT 'splunge'
    UNION ALL SELECT 'mort'

SELECT * FROM dbo.Dupes


DELETE dbo.Dupes
    FROM dbo.Dupes d
    LEFT OUTER JOIN
    (
        SELECT Dupe_String, pk_column = MIN(PK_Column)
        FROM dbo.Dupes
        GROUP BY Dupe_String
    ) x
    ON d.pk_column = x.pk_column
    WHERE x.pk_column IS NULL

What is Event bubling?

The concept of calling parent event from child event.
For example, Let us take a GridView Control. GridView control consists of several events like row edit,update. We can edit a particular row of a gridview control by raising row edit event. The reslt of that row edit event effects to the gridview control data. Hence this concept is called Event Bubbling

Saturday, May 14, 2011

Difference between Oracle & Sql Server?

  • a better transaction system
  • packages
  • Cursor For Loops
  • anchored declarations (variables declared as table.column%type)
  • initial values for variable declarations
  • %rowtype variables
  • much lower overhead for cursors
  • BEFORE triggers
  • FOR EACH ROW triggers
  • While sequences require either discipline or before each row triggers, they are more flexible than SQL Server identity columns.
SQL Server Strengths:
  • Transact-SQL is just one language, so you don't have to worry about what's SQL, what's SQL*PLUS and what's PL/SQL.
  • Because T-SQL is just one language, the T-SQL collections actually work decently with SQL. You can join T-SQL table variables to real tables. This tends to mean, while PL/SQL is more powerful for procedural programming, you just don't need to do procedural programming in T-SQL.
  • If you perform a select query with no target, the results are automatically returned to the client. For production code, this means you don't need to declare and pass sys_refcursor. For ad-hoc research work, this means you can easily make scripts that perform lookups and display multiple recordsets.
  • SQL Server Management Studio is much better than SQL*Plus or SQL Developer. Because it just displays any returned recordsets, data retrieval procedures are very easy to test.
  • easier client connectivity setup (nothing as bad as tnsnames)
  • less confusion about what drivers to use, apart from JDBC
  • Declare a column "Int Identity Not Null Primary Key" and then you can forget about it.
  • Every variable name starts with an "@" sigil, which looks terrible, but prevents name collisions between variables and columns.
  • The case you declared a table or column with will be remembered, but it's not case sensitive, and you aren't limited to 30 characters.
  • Crystal Reports can call SQL Server stored procedures, where you tend to be forced into a view with Oracle.

Thursday, May 12, 2011

How to Show Flash movie

function createFlashMarkup(width,height,uri,replaceid){

 var embed = document.createElement('embed');
 embed.setAttribute('width',width);
 embed.setAttribute('height',height);
 embed.setAttribute('src',uri);

 var div = document.getElementById(replaceid);
 document.getElementsByTagName('body')[0].replaceChild(embed,div); 
}

window.onload = function(){
 createFlashMarkup('550','400','vuurwerk.swf','replaced-by-flash');
}