Monthly Archives: December 2010

Length of LOB data (96896) to be replicated exceeds configured maximum 65536.

Error:

Length of LOB data (78862) to be replicated exceeds configured maximum 65536

Scenario:

We published some articles that use varchar(max) and a lot of XML data types for the columns. When we enabled replication, we got the error Length of LOB data (78862) to be replicated exceeds configured maximum 65536

Solution:

Increase the size that can be replicated. This is applicable for transactional replication only.

T-SQL: 
EXEC sp_configure ‘max text repl size’, 2147483647

SSMS (excerpt from BOL):

    1. In Object Explorer, right-click a server and select Properties.
    2. Click the Advanced node.
    3. Under Miscellaneous, change the Max Text Replication Size option to the desired value.

Reference:

BOL ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/3056cf64-621d-4996-9162-3913f6bc6d5b.htm

Advertisements

Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.

during Replication i faced this issue reason was simple that user prefix was not working properly in SQL server 2005. here is how to do it.

This problem occurs because SQL Server 2005 cannot obtain the information about the context when you try to impersonate a database user to run a statement or a module.

SQL Server cannot obtain the information about the context that you are trying to impersonate under the conditions that are listed in the “Symptoms” section. If you impersonate a SQL Server authorization login, SQL Server cannot find a login that matches the security identifier (SID) of the impersonated user. If you impersonate a domain user, the domain controller cannot find the information about the specific user who matches the SID of the impersonated user.

To work around this problem, change the database owner to a valid login or domain user. To do this, run the following statements:

USE
GO
sp_changedbowner ”

Note represents the name of the database. represents the name of the login that you want to set.
http://support.microsoft.com/kb/913423
related one
http://awesomesql.wordpress.com/2010/02/08/sql-error-cannot-execute-as-the-database-principal-because-the-principal-sec_user-does-not-exist-this-type-of-principal-cannot-be-impersonated-or-you-do-not-have-permission/
http://dbaspot.com/forums/ms-sqlserver/354286-event-id-28005-error-15517-a.html
http://dbaspot.com/forums/ms-sqlserver/231821-re-cannot-view-database-properties.html
the best way to do it
http://msdn.microsoft.com/en-us/library/ms176060.aspx
http://forums.devx.com/showthread.php?t=150354

the way to do it
USE databsename
GO
–sp_changedbowner sa Run this first to change the owenber of the database to sa because we are processing with sa account
–ALTER AUTHORIZATION ON DATABASE::EmployeeDB TO sa then run this command to change the authorization schema.

CRM 4.0 IIS 7.5 Unable to Display Static Content

many suggestions like
http://romikoderbynew.wordpress.com/2010/10/27/dynamics-crm-4-0-windows-server-2008iis-7-5-install-problems/
and
http://telligent.com/support/telligent_evolution_platform/community/f/533/t/1059142.aspx
but none of these worked for me then found following article on msdn which was good and it resolved the problem
how to resovle see below.l
To resolve this problem, install the Static Content feature of the Common HTTP Features under the Web Server role on the webserver. If the Static Content feature is already installed, then simply edit the StaticFileHandler mappings using the IIS Manager user interface to add StaticFileModule to the module list.

To install the Static Content feature on Windows Server 2008 and Windows Server 2008 R2, follow these steps:

a. Open Server Manager, and then expand Roles.
b. Right-click Web Server (IIS), and then click Add Role Services.
c. Under Web Server, click to select the “Static Content” check box.
d. Click Next to complete the installation.
Then
To edit the StaticFileHandler mappings, follow these steps:

a. Click Start, type Inetmgr in the Start Search box, and then click Inetmgr in the Programs list.

Note If you are prompted for an administrator password or for a confirmation, type the password or click Continue.

b. In IIS Manager, expand server name, expand Web sites, and then click the web site that you want to modify the settings for.

c. In Features view, double-click Handler Mappings.

d. In the Handler Mappings pane, right-click the StaticFile handler mapping, and then click Edit.

e. In the Edit Module Mapping dialog box, add StaticFileModule in Module box by manually typing it, and then click OK.

Note The default entries in the Module box are StaticFileModule,DefaultDocumentModule,DirectoryListingModule
Source

The search application on server did not finish loading. View the event logs on the affected server for more information.

Please delete the search service application proxy first, then delete search service application. The search service application proxy is under the search service application.

For more information about provisioning the search service application, please refer to the following blogs:

https://blogs.technet.com/b/wbaer/archive/2009/11/23/step-by-step-provisioning-the-search-service-application.aspx

http://blogs.msdn.com/b/russmax/archive/2009/10/20/sharepoint-2010-configuring-search-service-application-using-powershell.aspx

 

t this point, I would probably just go and delete the existing Search Service Application and create a new one.

http://social.technet.microsoft.com/Forums/en/sharepoint2010setup/thread/8e3a3c6a-ca8d-40cb-8ba5-f02faefd1519

https://blogs.technet.com/b/wbaer/archive/2009/11/23/step-by-step-provisioning-the-search-service-application.aspx

http://blogs.msdn.com/b/russmax/archive/2009/10/20/sharepoint-2010-configuring-search-service-application-using-powershell.aspx

http://www.go4answers.com/Example/delete-incomplete-search-application-99140.aspx

String Vs StringBuilder

from my Standpoint I would say string builder is better than strings. rest of the stories can be seen here.

In this post, I am going to discuss about using String Concatenation vs String Builder. I have created a very simple page which creates a string using three different methods.

1) Writes directly to the Response Cache
2) Creates a String variable using String concatenation
3) Creates a String variable using String Builder

I have tried to keep it as simple and self explanatory. Basically there is a string variable called strSample which is 64 bytes in size, and I use simple loops to create strings of the required size and discuss about performance accordingly.

Lets begin by creating an aspx file (say, StringPerf.aspx) in your C:\Inetpub\WWWroot folder (or any other virtual folder of your choice). Now, open StringPerf.aspx in Notepad and paste the following code…

  StringPerf
 
‘At this point I am declraring a string which is 64 bytes
Dim strSample As String = “0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF”
Dim intListValue As Integer
Dim i As Integer
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ‘Put user code to initialize the page here
    Response.Write(“











“)
    intListValue = Val(DropDownList1.SelectedValue)
End Sub
Private Sub btnResponseWrite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Trace.Write(“In Response Write before writing”)
    For i = 1 To 16 * intListValue
        Response.Write(strSample)
    Next
    Trace.Write(“In Response Write after writing”)
End Sub
Private Sub btnStringConcat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim strConcat As String
    Trace.Write(“In String Concatenation before concatenating”)
    For i = 1 To 16 * intListValue
        strConcat += strSample
    Next
    Trace.Write(“Length of the string = ” & strConcat.Length)
    Trace.Write(“In String Concatenation after concatenating”)
    Response.Write(strConcat)
End Sub
Private Sub btnStringBuilder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim stbBuilder As New StringBuilder
    Trace.Write(“In String builder before building”)
    For i = 1 To 16 * intListValue
        stbBuilder.Append(strSample)
    Next
    Trace.Write(“Length of the string = ” & stbBuilder.Length)
    Trace.Write(“In String builder after building”)
    Response.Write(stbBuilder.ToString)
End Sub
 
 
 
 
  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5“>

 
  
  
    
   <asp:Label id="Label1" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 32px" runat="server"
    Font-Bold=”True” Font-Names=”Arial”> In this sample, we will see the performance difference in using String Concatenation vs String Builder
   <asp:Label id="Label2" style="Z-INDEX: 105; LEFT: 104px; POSITION: absolute; TOP: 72px" runat="server"
    Width=”56px” Font-Bold=”True” Height=”19″>KB
   <asp:DropDownList id="DropDownList1" style="Z-INDEX: 106; LEFT: 24px; POSITION: absolute; TOP: 69px"
    runat=”server” Height=”19px” AutoPostBack=”True”>
    1
    2
    4
    8
    16
    32
    64
    128
    256
    512
    1024
  
 

Save the aspx file and browse it. (http://localhost/StringPerf.aspx). You should be able to see a page with a drop down combo box with three buttons called Response.Write, String Concatenation and String Builder. I have turned trace to “true” in the page so that we could see how much time is taken for a similar operation using different methods.

Cool!! Time to start testing :o)

Scenario 1
Combo Box set to 4 KB.

a) Trace With “Response.Write” looks similar to (have a look at the trace generated)

In Response Write before writing 0.00105879378524366 0.000030
In Response Write after writing 0.00112276839654202 0.000064

b) Trace With “String Concatenation” looks similar to

In String Concatenation before concatenating 0.000805130260968922 0.000029
Length of the string = 4096 0.00130072397469511 0.000496
In String Concatenation after concatenating 0.00135128906048115 0.000051
Time taken = 0.00135128906048115 – 0.000805130260968922 = 0.000546158799512228

c) Trace With “String Builder” looks similar to

In String builder before building 0.000985041394925891 0.000030
Length of the string = 4096 0.00104063505277905 0.000056
In String builder after building 0.00106298426196626 0.000022
Time taken = 0.000077942867040369

It looks pretty harmless, isn’t it? And in fact for small strings, it doesn’t make too much difference anyways. Now look at another scenario. The “Time Taken” what I have calculated above will vary from system to system, but I hope it sohuld give you the idea.

Scenario 2
Combo Box set to 256 KB.

a) Trace With “Response.Write” looks similar to (have a look at the trace generated)

In Response Write before writing 0.000857650902558845 0.000030
In Response Write after writing 0.00188180341356234 0.001024

b) Trace With “String Concatenation” looks similar to

In String Concatenation before concatenating 0.000866590586233725 0.000029
Length of the string = 262144 15.6489126411318 15.648046
In String Concatenation after concatenating 15.6490316506707 0.000119
Time taken = 15.648165060084466275

c) Trace With “String Builder” looks similar to

In String builder before building 0.00103979695743453 0.000029
Length of the string = 262144 0.00564960071740961 0.004610
In String builder after building 0.00575743565173786 0.000108
Time taken = 0.00471763869430333

Now, here comes the difference. And what an amount! String Builder is performing almost ~3317 times faster than String Concatenation (15.648165 / 0.004717)!!!

As you can see the performance dips down drastically. And thankfully, we have an explanation. Visit the following links and enlighten yourself. You may try with different values in the Combo box and see for yourself how badly it can effect your server’s performance.

Sources to

http://blogs.msdn.com/b/rahulso/archive/2006/08/29/string-concatenation-vs-string-builder-_2d00_-the-performance-hit_2100_-see-it-to-believe-it-_3a00_o_2900_.aspx

http://support.microsoft.com/?id=893660

http://support.microsoft.com/?id=306821

http://support.microsoft.com/?id=306822

Interesting Discussions

http://channel9.msdn.com/Forums/TechOff/14294-C-string-vs-StringBuilder

http://channel9.msdn.com/Forums/TechOff/211803-Net-String-vs-StringBuilder-metrics

nice and short article

http://blogs.msdn.com/b/msdnstudentflash/archive/2005/01/31/364217.aspx

Detailed explanations

http://www.codeproject.com/KB/string/string.aspx

http://www.codeproject.com/KB/cs/StringBuilder_vs_String.aspx

More blog

http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=site%3Ablogs.msdn.com+string+stringbuilder

A Bit more detail

http://blogs.msdn.com/b/ricom/archive/2003/12/02/40778.aspx

http://blogs.msdn.com/b/ricom/archive/2003/12/15/43628.aspx

Visual Studio Test Professional tutorial

Post Adapted from here

For this tutorial, I’m using Visual Studio Team Suite 2010 (which includes all of the roles and TFS access).  I’ve already added the demo to TFS so I have full source control.  For the sake of demonstration, I’ve commented out the final fix from the walk through so the label does not update:

image

When I run the application, the label is not updated:

image

The Tester

To create my test, I’m going to run the Test and Lab Manager tool from the start menu:

image

The main page has tabs for test plans, tests, and for tracking work items:

image

First I need to connect to my TFS server by click Add.  My server is VLM13267036 (auto generated name by our internal Hyper-V testing tools):

image

I’ve already got a collection with my code stored in the Projects folder:

image

Next I’ll select Projects and choose the Connect option. This prompts me to set a context:

image

I’ll choose “Set context” which brings up the editor for my new context:

image

I’ll select New:

image

I can now edit all of the properties:

image

After all data has been entered, click Save and Close.  The new item is now in our list:

image

Double clicking the item allows me to add a new test case to this test suite:

image

Here you can fill out all details for the test case:

image

Steps can now be added by clicking on the “Click here to add a step”:

image

I’ve added a few steps including launching the application, hitting the buttons, etc:

image

Now hit Save and Close to go back to the test case list.  The Plan is now complete.  We can run it any time a new build is produced, for each flavor of build, for different configurations, etc.  To execute the test, change focus to the Test tab:

image

Our test plan and test case are already in the list.  Right click the test case and select Run:

image

This will launch the test case.  The manual test runner window docks itself to the left side of my desktop so I can see both the steps I want to run and the full Windows desktop:

image

The “Start test and record” option allows me to not only do the testing steps, but it will also allow recording a WMV of all the steps I do as well as recording my steps to help me author coded UI tests (big helper with automation).  This is really handy if you want someone to see exactly what you did to produce a bug and automate testing in the future.

In this case I will select “Start test”.  Notice the Test Runner now shows the steps I created above:

image

The first step is to “Launch the PicViewer application” which I’ll do by running the application.  Since that worked, I’ll press the combo box status item behind the step and select ‘Pass’ from the drop down:

image

The item is now marked as passing:

image

I’ll repeat the process for the next two steps, so far so good:

image

When I get to my last step, I discover the file path isn’t actually set.  That makes this item a failure.  Select the drop down box and choose ‘Fail’ from the list.  I’m automatically asked for comments on the failure:

image

Since I didn’t record a video of my steps, I would like to give the developer a screen shot of what went wrong.  Select the camera tool bar button:

image

This will bring up a capture tool turning the cursor into a cross hair that allows me to select a region of the screen.  I’ll select the top of the application to demonstrate the busted label:

image

Notice that the failed test now has a .png file added with the image:

image

I’ve got enough supporting data now so I’ll create a new bug using the toolbar:

image

I’m now prompted to create my bug with a description, etc:

image

Notice the detailed test steps I’ve taken have already been added to the bug:

image

As has my screen shot (the .png file):

image

I’ll now do a Save and Close which will commit the bug to TFS as a Work Item.  Finally I’ll do End Test then Save and Close the test runner.  This will return us to Test and Lab Manager.

image

as a tester, I could now double click the test case and see all of the same data I just saved for the failure:

image

I can also select My Bugs and see the bug filed for this issue (since I conveniently assigned it to me):

image

And just to show how everything is wired together, I can open Visual Studio, Team Explorer and look for bugs assigned to me there as well:

image

At this point my job as a tester is now done.

The Developer

As a developer, I can now open the bug and read through the issue.  If I select Other Links I’ll find the .png which I can open to see the issue:

image

Sure enough, the label is not updated.  If a WMV had been recorded, I could have actually watched the testing steps in action.  Because the bug is quite simple to find and fix (some idiot commented out the update line!) I can simply make my fix and test it.

Now that things are fixed, I want to check in the bug fix and resolve the work item at the same time.  Click on the Pending Changes tab in VS and select the correct work item:

image

Now we can Check In the fix:

image

I can now verify the bug has been Resolved:

image

In Summary

A key goal for Visual Studio Team System 2010 was to reduce the number of times a tester and developer wind up in a ‘no-repro’ situation.  There are several things I’ve demonstrated in this tutorial which help:

  • Test case steps are documented and set up for repeatable execution
  • Pass/Fail steps are outlined and stored in bugs automatically
  • Video capture is allowed to see all steps taken, and screen snapshots are easy to acquire and file with a bug
  • System information including build number, OS, etc are recorded for you (System Info tab)
  • Although not shown, I could also have collected all of the historical debugging traces from the run as well
  • All data from test cases, results, work items, and source code are kept in TFS and can be shared by test and dev

I hope you’ll pick up Beta 1 and try this set of tutorials for yourself.  Let us know how well it works for you and if you have any suggestions.  I should also point out the work item tracking, auto resolve, etc are all part of VS 2008 so a great way to get prepared for the new version is to get TFS deployed today and get your projects into the system.

Enjoy!