Thursday, June 9, 2011

Debugging the Network traffic(Testing whether the HTTP headers going fine or not?)

I was trying to debug the outgoing request headers whether the Accept-Encoding flag is set or not. One way to do that is setting up a proxy server and diverting all the web traffic through that proxy channel. But i don't want to set a proxy server.

After searching in google I found the following tool, its called fiddler, which will display all the web trafic in a details format.

I found it very helpful.

Video: http://www.fiddler2.com/fiddler/help/video/FiddlerQuickStart.wmv
Download link: http://www.fiddler2.com/fiddler2/version.asp

Thursday, June 2, 2011

Simple command to move all the out put dlls to a specific target

I have been trying to automate the process 'Build sln file and copy all the latest dlls to a specific output folder other than /bin/Debug or /bin/Relase' (Similar to RiskSpan N:\ContinuousBuild). But the problem there was we need the CrusiseControl running continously.

The following command made my life easy to recompile all the projects associated with the sln file and copy to specified output folder (in this case  C:\Users\Anumolu\Desktop\ContinousBuild\).

use VS cmd prompt and goto the project folder where the .sln file is located and run the following command with modified out put folder path.


msbuild   /property:WarningLevel=2;OutDir=C:\Users\Anumolu\Desktop\ContinousBuild\

Monday, May 30, 2011

Editing Page in SharePoint Designer 2010 with Advance Mode

I have tried to edit a page and got a code that was marked in yellow. In addition, the Ribbon was missing some of the tabs. I was unable to edit the code on the page.

Solution:Click on “Advance Mode” button that is located on the Ribbon.
Once you have clicked it, you’ll see the other tabs and you will be able to edit the page.

Sunday, April 3, 2011

Yeshwant kanetkar articles

Wn ever i need C# fundamentals i would prefer Yeshwant kanetkar's C# Fundas book. The following link has few articles published by Yeshwant kanetkar.

Wednesday, November 17, 2010

EXCEL- INDIRECT() function

INDIRECT() saves my time, particularly when we want to pull some data from dynamic sheets(Sheet names are defined in a cell value).

I was trying to VLOOKUP some data from a dynamic sheet (sheet name was defined in column A).
In the following eg A2592 has the sheet name and A7:I413 is the vlookup range in the dynamic range.

=VLOOKUP(C2592,INDIRECT("'"&$A2592&"'!$A$7:$I$413"),2)


More details about INDIRECT -

 In Microsoft Excel, the INDIRECT worksheet function returns the contents of the specified reference and displays its contents. You can use the INDIRECT worksheet function to create linked references to other workbooks. You can reference each attribute of the reference (workbook name, worksheet name, and cell reference) individually by using the INDIRECT function to create a user-defined dynamic reference with worksheet cell references as inputs.

 Note The INDIRECT function only returns the result of a reference to an open file. If a workbook that the INDIRECT function is indirectly referencing is closed, the function returns a #REF! error.

To create a reference to a workbook using three different cell inputs as references for the workbook, worksheet, and cell link, follow the steps in the following examples.

Example 1

  1. Start Excel.
  2. In Book1, Sheet1, cell A1 type This is a test.
  3. In Microsoft Office Excel 2003 and in earlier versions of Excel, click New on the File menu, click Workbook, and then click OK.

    In Microsoft Office Excel 2007, click the Microsoft Office Button, click New, and then click Create.
  4. In Book2, Sheet1, cell A1 type Book1.
  5. In Book2, Sheet1, cell A2 type Sheet1.
  6. In Book2, Sheet1, cell A3 type A1.
  7. Save both workbooks.
  8. In Excel 2003 and in earlier versions of Excel, type the following formula in Book2, Sheet1, cell B1:
    =INDIRECT("'["&A1&".xls]"&A2&"'!"&A3)
    In Excel 2007, type the following formula:
    =INDIRECT("'["&A1&".xlsx]"&A2&"'!"&A3)
    The formula returns "This is a test."

Example 2

In Excel 2003 and in earlier versions of Excel, you can replace the formula in Example 1 with multiple INDIRECT statements, as in the following formula:
=INDIRECT("'["&INDIRECT("A1")&".xls]"&INDIRECT("A2")&"'!"&INDIRECT("A3"))
 In Excel 2007 and Excel 2010, type the following formula:
=INDIRECT("'["&INDIRECT("A1")&".xlsx]"&INDIRECT("A2")&"'!"&INDIRECT("A3"))
Note the difference in how Excel references the cells. Example 1 references cells A1, A2, and A3 without using quotation marks, while Example 2 references the cells using quotation marks around the references.

The INDIRECT function references cells without using quotation marks. This function evaluates the result of the cell reference. For example, if cell A1 contains the text "B1," and B1 contains the word "TEST," the formula =INDIRECT(A1) returns the result "TEST."

However, referencing a cell with quotation marks returns the result of the cell contents. In the example in the previous sentence, the formula returns the text string "B1" instead of the contents of cell B1.

Friday, October 22, 2010

Excel short cuts

http://chandoo.org/wp/2010/02/22/complete-list-of-excel-shortcuts/#Formatting

DataTable Merge but omit adding rows? This improves the performance

Data table merge/load works only when one of the Datatables have a primary key.

Merge can work only when you have specified the primary key. Having an "RowId" column in both datatables isn't enough. You need to set the RowId column as the primary key in at least one of the datatables. Once you've done so, or if this is already in place from a strongly typed dataset/datatable, the call to Merge will work as you want it to.

Let's assume your datatables are called dt1 and dt2 with a primary key of RowId. The following code will do what you want:

Code Snippet
// set primary key prior to merge
dt1.PrimaryKey = new DataColumn[] { dt1.Columns["RowId"] };
dt1.Merge(dt2);

In More detail ...

The Merge method is used to merge two DataTable objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing DataTable. This allows the client application to have a refreshed DataTable with the latest data from the data source.
The merge operation takes into account only the original table, and the table to be merged. Child tables are not affected or included. If a table has one or more child tables, defined as part of a relationship, each child table must be merged individually.
The Merge method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing DataTable.
When performing a merge, changes made to the existing data before the merge are preserved by default during the merge operation. Developers can modify this behavior by calling one of the other two overloads for this method, and specifying a false value for the preserveChanges parameter.
In a client application, it is usual to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle tier component. In this scenario, the GetChanges method is first invoked. That method returns a second DataTable optimized for validating and merging. This second DataTable object contains only the DataRow objects that were changed, resulting in a subset of the original DataTable. This subset is generally smaller and thus more efficiently passed back to a middle tier component. The middle tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new DataTable that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned DataTable can be merged back into the client application's original DataTable with the Merge() method.
When merging a new source DataTable into the target, any source rows with a DataRowState value of Unchanged, Modified, or Deleted, is matched to target rows with the same primary key values. Source rows with a DataRowState value of Added are matched to new target rows with the same primary key values as the new source rows.


Please check the following link for further information...
http://msdn.microsoft.com/en-us/library/fk68ew7b%28VS.90%29.aspx#CommunityContent