Friday, December 13, 2013

Reset Identity

DBCC CHECKIDENT can reseed (reset) the identity value of the table. For example, YourTable has 25 rows with 25 as last identity. If we want next record to have identity as 35 o Run following T SQL script in Query Analyzer.
DBCC CHECKIDENT (‘table_name’, reseed, 34)
If identity seed is set below values that currently are in table, it will violate the uniqueness constraint as soon as the values start to duplicate and will generate error.

Friday, December 6, 2013


WCF uses an opt-in model to define what belongs to one of its contracts. In a service contract interface, only methods decorated with [OperationContract] are exposed to the client. That means that, in the interface below, if used within a WCF service, a client could call both Add and Subtract operations, but not Multiply.
public interface ICalculator
    int Add(int x, int y);

    int Subtract(int x, int y);

    // Not decorated
    int Multiply(int x, int y);

There are two overload of OperationContract one is without parameter and other is with parameter.

Parameters are

Action → Gets or sets the WS-Addressing action of the request message.
AsyncPattern  → Indicates that an operation is implemented asynchronously using a Begin and End method pair in a service contract.HasProtectionLevel → Gets a value that indicates whether the messages for this operation must be encrypted, signed, or both.
IsInitiating → Gets or sets a value that indicates whether the method implements an operation that can initiate a session on the server (if such a session exists).
IsOneWay → Gets or sets a value that indicates whether an operation returns a reply message.
IsTerminating → Gets or sets a value that indicates whether the service operation causes the server to close the session after the reply message, if any, is sent.
Name → Gets or sets the name of the operation.
ProtectionLevel → Gets or sets a value that specifies whether the messages of an operation must be encrypted, signed, or both.
ReplyAction →  Gets or sets the value of the SOAP action for the reply message of the operation.
TypeId → When implemented in a derived class, gets a unique identifier for this
Attribute. → (Inherited from Attribute.)

Friday, May 24, 2013

Remember value after application closed

var name = Properties.Settings.Default.FileName;

Properties.Settings.Default.FileName = "....";

Friday, May 17, 2013

ScrollIntoView HtmlElement VC++

VARIANT varargStart;
varargStart.vt = VT_BOOL;
varargStart.boolVal = true;

Friday, May 10, 2013

error C2509: 'GetEventSinkMap'

error C2509: 'GetEventSinkMap'

Add this line in .h file under protected section


Friday, May 3, 2013

Fast Web View PDF

How to Save a Fast Web View  PDF  using pdftorn

PDFDoc doc;

private void SaveFastWebViewPDF()
         doc = new PDFDoc(FilePath);
         doc.Save(sTempPdfPath, pdftron.SDF.SDFDoc.SaveOptions.e_linearized);

Friday, April 26, 2013

Convert Pdf from color to GrayScale using Ghost Script 8.57

gswin32.exe -sOutputFile=%2 -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH %1

First Parameter is Input PDF Path, Second Parameter is Output PDF Path

This command also convert a pdf into version 1.4.

Wednesday, March 20, 2013

Merge Pdf using pdftorn

static void MergePDF(PDFDoc new_doc, string filename) 

   using (PDFDoc in_doc = new PDFDoc(filename))  
      ArrayList copy_pages = new ArrayList(); 
      for (PageIterator itr = in_doc.GetPageIterator(); itr.HasNext();itr.Next())

   ArrayList imported_pages = new_doc.ImportPages(copy_pages); 
   for (int i=0; i!=imported_pages.Count; ++i) 
      new_doc.PagePushBack((Page)imported_pages[i]); // Order pages in reverse order. 

The following snippet shows now to merge multiple PDF documents: 
private void CallMeregPDF()
using (PDFDoc new_doc = new PDFDoc()) 

MergePDF(new_doc, @"c:\mypdfs\1.pdf"); 
MergePDF(new_doc, @"c:\mypdfs\2.pdf"); 
MergePDF(new_doc, @"c:\mypdfs\3.pdf"); 
new_doc.Save("merged.pdf", , SDFDoc.SaveOptions.e_linearized); 


Tuesday, March 12, 2013

IntelliSense is not working in C++

If the no compile browser (.ncb) file located at the root of your project directory is read-only or becomes corrupt in some manner, IntelliSense information will no longer be available. To fix this, do the following:
  1. Close the solution.
  2. Delete the .ncb file.
  3. Reopen the solution.

Friday, February 15, 2013

Friday, February 8, 2013

Default Param in VC++

Declaration :
void AddVal(int iFirstVal, int iSecondVal=0);

void AddVal(int iFirstVal, int iSecondVal)

int iVal = iFirst+iSecond;
    cout << "Sum : " << iVal << endl;

int main()
    AddVal(1); // nValue2 will use default parameter of 10
    AddVal(3, 4); // override default value for nValue2

1. Default Parameter should be last parameter.[Otherwise hot compiler will know which attributes should be omit.]
2. No default value allowed in definition. Default value should be given only in declaration.
3. Default arguments can be provided for pointers to functions. For example:
int (*pShowIntVal)( int i = 0 );

Friday, February 1, 2013

Readonly and Const

We can assign a value to a readonly variable at runtime (in constructor only)
till it is a unassined identifier, but once value is 
assigned, it cannot be changed.

In case of const we cannot assign a value at run time i.e. 
the value assigned to it at declaration time cannot be 

Friday, January 25, 2013


1. Difference between string and StringBuilder
Ans : Click Here
2. Difference between Readonly and Constant
Ans: Click Here
3. Difference between Stored Procedure and Trigger.
Ans: Click Here
4. Can we call trigger?
Ans : Trigger can't be called , it is automatically executed when we insert,update or delete a table row
5. What is Static Class?
6. Can we create an object of static class?
Ans No
7. Can a static class inherit another class?
Ans : No Detail
8 Can we call stored procedure inside stored procedure?
Ans: Yes Click Here
9. Difference between Interface and Abstract class.
10. What is AJILE technology?
Ans: Click Here
11. Can we call webscript with the help of javascript? What is the syntax?
12. What is the syntax for Stored Procedure?
13. How can we set Identity column to a particular value?
Ans : DBCC CHECKIDENT('table_name',reseed,30)

Friday, January 18, 2013

Mime Type

EPUB is fast becoming the digital platform to learn for ebook publishing. EPUB stands forElectronic Publishing and is the XML format from the International Digital Publishing Forum. By design, EPUB works with two languages, XHTML and XML. This means once you have an understanding of the syntax and structure of these formats, creating an EPUB digital book will be a natural step up in the learning process. EPUB comes in three separate sections, or folders.
  • Mimetype [Multipurpose Internet Mail Extension]
In order to create a viable EPUB document, you must have all three.

Writing the Mimetype File

Of these divisions, mimetype is the most simplistic. Mimetype is an ASCII text file. A mimetype file tells the operating system of the reader how the ebook is formatted — the MIME type. All mimetype files say the same thing. To write your first mimetype document all you need is a text editor, such asNotepad. Type in this code on to the editor screen:
Save the file as ‘mimetype’. The file must have this title in order to work correctly. Your mimetype document should only contain this code. There should be no additional characters, lines or carriage returns. Put the file into the root directory of the EPUB project. This means mimetype goes in the first folder. It is not contained in its own section.
This is the first step to creating your EPUB document and the easiest. All mimetype files are the same. If you can remember this tiny snippet of code, you can write a mimetype file for EPUB.

Friday, January 11, 2013

Set/Remove Style

IHtmlStyle *objHtmlStyle;

Friday, January 4, 2013

insertAdjacentHTML VC++

tempCStr = "" + sAttribVal+ "";
BSTR bstrSpan =tempCStr.AllocSysString();