Thursday, April 15, 2010

Ajax and SharePoint web part loading

One of the marvels of modern web technology is the ability to communicate with the web server asynchronously using partial postbacks. This ensures that the web application behaves more like a desktop application and there are no full page refreshes required to reload the information that is hosted on a web page. Since 2005 Ajax has been used as a mainstream web development technique and has support from most software vendors including Microsoft.

Having the ability to reload only the areas of a web page that are required, improves the user experience and eliminates the page flickers that plagued early web applications. The benefits of using Ajax are really only seen on the client side, with very little to no changes in the web server infrastructure. The web request method still relies on a single call to request the web page content and does not support simultaneous requests.

If your web part relies on server requests to provide data to the UI, you may consider queueing the requests to ensure that the web parts each get a turn to request their information. The benefit of this approach is that the web parts will render their content and issue a postback once the entire page has been rendered.

The following script will enqueue post back requests and issue them in sequence for each web part.

Tuesday, April 13, 2010

SharePoint and Ajax Postback issue

SharePoint Server is a great application platform that has rich out of the box functionality. Building custom solutions on SharePoint may require a little more research to ensure that you are able to implement modern UI capabilities. One of the issues we found recently is that SharePoint in its native configuration does not support simultaneous postbacks.

Our design goal was to build web parts that behaved independently and that would issue postbacks as each part was loaded. This would allow the web page UI to load while the data was being fetched in the background.

Once we had built our Asp.Net user controls we found that they did not work as expected in a SharePoint enviornment. This relates to the way that Sharepoint handles post backs and a fix that Microsoft implemented to cater for double byte url's. Luckily the fix is quite easy to implement, that is once you have identifed the reason why subsequent post backs were failing.

Adding the following two lines of javascript code at the top of the web page solved the problem.

_spOriginalFormAction = document.forms[0].action;
_spSuppressFormOnSubmitWrapper=true;

Sunday, March 21, 2010

Slow Virtual PC on Windows 7 x64

The Windows 7 platform has changed the way we work and has introduced new levels of hardware abstraction that has never been seen before in the desktop and mobility markets. We are now able to boot directly into a virtual machine. This allows us to run multiple virtual desktop systems, based on our context and working role. As a software developer I find this useful to switch between my desktop developer environment and my consulting environment where i run product demos and power point presentations.

I recently discovered that while the technology was available the end user experience was not as smooth as I would have imagined it should be. I have seen many posts online with simillar symptoms. After I installed my new laptop with Windows 7 Ultimate x64 and installed the new Windows 7 virtual pc and XP mode, the virtual machine running Windows Server 2008 R2 was extremely slow and I was unable to work.

After some research the following items resolved my VM performance issue.

1. Install the following in sequence:
- WindowsXPMode_en-us.exe
- Windows6.1-KB958559-x64.msu
- Windows6.1-KB977206-x64.msu

2. Next install the Integration Features, very important.

3. Add your VHD folder to the exclude files and location on Microsoft Security Essentials. (Probably the main culprit)

4. Add the VMWindow.exe and vpc.exe processes to the Exclude Processes section in Microsoft Security Essentials.

5. Adjust the display for performance in the VM:




6. Adjust performance for programs in the VM:




7. Run windows update on the virtual machine. This ensures that you get the latest bits to support the hardware virtualisation.

Hope this helps anyone with performance issues in Windows 7 x64 virtual machines.

Monday, March 8, 2010

OSI SOFT RtWebParts on Windows Server 2008 R2

The OSI Soft RtWebparts add rich data visualisation capabilities to plant monitoring and Manufacturing Execution Systems. SharePoint Server provides the ideal application framework to host these parts and integrate LOB applciations with real-time plant information.

These parts Initially when we started testing with Windows Server 2008, we ran into the following issue which was reported in the application event log.

"Unable to access SCM Manager. 5 in AFManager::OnThreadStart”

The Pi services are not configured with sufficient rights to execute on a Server 2008 environment. Run the following commands at the command prompt with Administrator privileges to resolve the issue:

To query the current service permissions use the following command line option:
sc sdshow SCMANAGER
sc sdshow PINETMGR

Replace with the following settings:

NOTE: The entry for sdset must be on a single line in order for the changes to be made. Applying the security acl in the incorrect format can render the service unusable.

sc sdset PINETMGR D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA) (A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)


sc sdset SCMANAGER D:(A;;CCLCRPRC;;;AU)(A;;CCLCRPRC;;;IU)(A;;CCLCRPRC;;;SU)(A;;CCLCRPWPRC;;;SY)(A;;KA;;;BA)S:(AU;FA;KA;;;WD)(AU;OIIOFA;GA;;;WD)

Monday, July 27, 2009

A point of view on SCRUM

Having worked in the industry for over 11 years, I have seen projects implemented in a number of different ways. In my current role I am working with an extremely detailed and rigorous project methodology that is based on Waterfall. While I am a certified Scrum Master, I think that marrying the best of agile and waterfall you will have a methodology that satisfies the development teams, our clients and project and programme management.

For me the fundamental difference between waterfall and SCRUM is selling products vs projects. While I am not promoting either methodology, it is interesting to consider and discuss the merits of each.

The following points describe the key areas that will help establish a high performance Scrum team:

- Estimates are provided by the team. Estimates are based on the teams ability to deliver.
- Team velocity is based on the current actual ability of the team.
- High performance teams, understand each other and work from project to project as a delivery team.
- Software is an art, more than a science. Ensuring software quality will inevitably take time. Working on software until it is right, trading off features is the right approach provided your client accepts that they may not get everything that they want.
- There is no leadership. One person is not responsible for driving the project to completion the team is.
- Assessing the delivery approach during a sprint retrospective, helps the team re-organize and optimize the delivery process.
- Sprints help organize the focus o f the team for the next period of the project.
- Having a Scrum Master removing impediments, allows the team to focus on delivery and not have to deal with issues that don’t add value to the project.
- Things change over time, on large projects it is difficult to estimate whether we will reach the 6 month target date. Scrum does not implement end dates, it lets the project take its course.
- Problems are detected earlier rather than later. The client gets to see the product regularly and does not test the product at the end of the project.
- Having the team report directly to the Product Owner means that they are no longer shielded by the project manager. This enforces accountability.
- Teams are self organizing, this lets team members focus on the areas that they are interested in.
- Using a backlog to identify features and requirements allows the team to have visibility on what is going to be delivered in the lifecycle of the project. Scrum promotes visibility to all stakeholders.
- Daily scrum meetings allows the team to refocus their effort daily and each team member must report on what they achieved, what they are going to achieve and what impediments they currently have holding them back.
- Producing code early on in the project allows the client to start getting the benefits of the product much sooner than in a traditional waterfall methodology.
- There is an inherent increase in the ability of the team to cross skill and grow their knowledge through osmosis and the collaborative nature of the Scrum project.
- When a problem is found, the entire team is stopped to focus on resolving the issue, while this stops the entire production line, the team learns together and the problem is resolved much quicker than when one person focuses on the problem.

The following observations help clarify the role of SCRUM:

- There must be inherent trust between the product owner and the team.
- Scrum teams are typically between 4-9 people. On a large project you will need to have multiple teams, with multiple product owners and SCRUM masters .
- Scrum aims to keep the development team happy and productive removing the unnecessary structure and rigor that stops them from producing code, which ultimately adds the real business value.
- Scrum implies that software requirements are emergent, meaning that as you go you will discover new requirements. Your client must understand that you are going through a discovery process. Discovery takes place for the duration of the process and not like in waterfall, up front.
- A scrum master is a servant leader person. They need good people skills and do not take a leadership position within the team.
- Scrum aims to make the project more visible, notifying all of the stakeholders of the teams velocity (ability to deliver). Clients must understand that if the team mix is not right, the velocity will be low. New teams will also have a low velocity. Teams that work together on multiple projects will have a much higher velocity.
- Teams must be groomed over time.


The following points are where I see challenges in using Scrum on some of the projects that I have worked on:

- Teams must be co-located. Scrum relies heavily on human interactions, collaboration and knowledge sharing. This will not suit the nature of distributed projects.
- Relying on extensive human interaction means that information is not always documented.
- Organizing work in sprints and starting development right away, removes the ability of the team to focus on research. Going directly to code before understanding the design options available. This approach assumes that you have an experienced and mature team that understands the application domain. This will work well in in-house IT departments where people work in the same environment for a prolonged period of time.
- Re-factoring comes at a cost. Waterfall reduces the amount of refactoring by doing all of the planning and design upfront.
- The project is not outcomes based, this means that the end product is not known upfront and the client only says its done when they are satisfied that they have what they want (which may or may not entirely be what they had initially envisioned). The client can change the scope during the project and on fixed price contracts this is detrimental to the project.
- The small team size, 4-9 members will mean additional resources to facilitate multiple teams. Additional Product owners and scrum masters.
- Each team member is expected to know what they are doing from day one. Coding starts as soon as possible.
- There is a huge emphasis on face to face communication while this is good for the team to bond, the knowledge is not recorded. If people leave that knowledge leaves. The low focus on creating documentation means that you don’t have anything to go back to when there is a dispute with the client, hence the inherent trust with the client that is a requirement.
- Scrum implies that the team will be happy and that attrition is naturally low. Attrition is a reality and the knowledge that is lost during a project, must be recorded somewhere, specifically on large complex implementations.
- There are huge contractual implications if the understanding of the team and the client are vastly different. Scrum will work in an organization where the team understands the application domain and requirements. Typically these type of resources belong to in-house IT departments.
- Scrum assumes that the team will do what is required to deliver the product, including business analysis, design, testing and coding from day one. While the analysts and designers have not yet uncovered the actual design, the coders will not be able to start and if they do there will be inherent re-work.
- There is a lot of bargaining and negotiation with the client as to which functionality is delivered first, typically our clients expect everything to be completed. SCRUM projects must have the ability to push back and the understanding from the client that this is part of the process.

Tuesday, July 7, 2009

Getting started with PerformancePoint Server Monitoring Installation

Microsoft announced earlier this year that PerformancePoint Server was not going to be released in a stand alone version, instead it would be bundled with Microsoft Office Sharepoint Server Enterprise Edition in future releases. They confirmed that Service Pack 3 is going to be made available for the current version of PerformancePoint software.

If you are planning on installing PerformancePoint Server 2007 on Windows Server 2008, SQL Server 2008 and MOSS 2007, you should read the following, as it will save you loads of time when you need to troubleshoot the installation.

The following redistributable files are required to pass the pre-requisite check on installation. Ensure that you do all of the installation below before running the Monitoring Server Configuration Manager.

The following files are part of the Feature Pack for Microsoft SQL Server 2005 and can be found here.


  • sqlncli.msi

  • SQLServer2005_ADOMD.msi

  • SQLServer2005_ASOLEDB9.msi

  • SQLServer2005_XMO.msi


  • Next you are going to need to install the Ajax Extensions found here: ASPAJAXExtSetup.msi

    Finally you will need to install service pack 2 for Performance Point Server found here

    One of the indications that the installation did not complete correctly the first time was an error message that appeared creating a new data source in the Dashboard Designer. Even though I knew the SQL credentials were correct, the test failed with the following message.

    Unable to connect to the specified server. Make sure the address is correct.













    If you are unable to connect to the external data source, try calling the web service directly using http://localhost:40000/WebService/PmService.asmx. This failed with the following error message:

    The page must have a <%@ webservice ...="" class="MyNamespace.MyClass"%> directive.


    Wednesday, June 24, 2009

    An easy technique for inverting a SQL table


    The following is an easy technique for inverting a table structure in T-SQL. I will explain the mechanics behind the technique and provide the sample code that we used on a recent project. The original code was more than 200 lines and was extremely complex. While the code was more than sufficient for our environment, there may be other ways that accomplish the same goal, this post aims to present one of the available options.

    The first step is to create a temp table that holds the table structure containing the rows of data that are going to be inverted into columns. You need to add an additional integer column that contains the row number for each of the rows in the table. This is automatically populated using the
    Row_Number() function.

    Declare @Count int, @i int, @SQL nVarchar(3000)
    Create Table #tmp(ModuleHierarchyID Int, WebPartCode Varchar(10), SVGFilename Varchar(255), XSLTFilename Varchar(255), RowNumber Int)

    The next step is to populate the temp table with the data that you want to invert into a column structure.
    Insert into #tmp(ModuleHierarchyID, WebPartCode, SVGFilename, XSLTFilename, RowNumber)
    Select
    ModuleHierarchyID, W.WebPartCode, SVGFilename, XSLTFilename,Row_Number() Over(ORDER BY ModuleHierarchyId DESC)As RowNumber
    from
    SVG_SVGMapping S, WEP_WebPart W

    where
    S.ModuleHierarchyId= @ModuleHierarchyID

    and
    S.WebPartId= W.WebPartId

    The data from the query above looks as follows






    The following section dynamically builds a sql query that extracts the tabular data and presents it in a column format. The @Count variabledetermines the depth of the table and uses this to iterate through each row using the rownumber to build each column. The dynamic SQL below contains a global select statement, with sub select statements for each column.
    Set@Count = (Selectcount(1) from #tmp)
    Set @i = 0
    Set
    @SQL = N'Select ' + Ltrim(str(@ModuleHierarchyID)) + ' As ModuleHierarchyId'

    While
    @i < @Count
    BeginSet @SQL = @SQL+ N', '
    Set
    @SQL = @SQL + N'(Select WebPartCode from #tmp where Rownumber = ' +ltrim(Str(@i + 1)) + ') As WebPartCode' + ltrim(str(@i + 1))+ ','
    Set
    @SQL = @SQL +N'(Select SVGFilename from #tmp where Rownumber = '+
    ltrim(Str(@i+ 1)) + ') As SVGFilename' + ltrim(str(@i + 1)) + ','
    Set
    @SQL = @SQL +N'(Select XSLTFilename from #tmp where Rownumber = '+
    ltrim(Str(@i + 1)) + ') As XSLTFilename' + ltrim(str(@i+ 1))
    Set
    @i = @i +1

    End


    EXECUTE sp_executesql @SQL

    The dynamic SQL should look as follows:

    Select 4 As ModuleHierarchyId,Select WebPartCode from #tmp where Rownumber = 1) As WebPartCode1,
    Select SVGFilename from #tmp where Rownumber = 1) As SVGFilename1,
    Select XSLTFilename from #tmp where Rownumber = 1) As XSLTFilename1,
    Select WebPartCode from #tmp where Rownumber = 2) As WebPartCode2,
    Select SVGFilename from #tmp where Rownumber = 2) As SVGFilename2,
    Select XSLTFilename from #tmp where Rownumber = 2) As XSLTFilename2)




    Once the query is run the following results are returned:



    The complete code looks as follows:


    Declare@Count int, @i int, @SQL nVarchar(3000)

    Create
    Table #tmp(ModuleHierarchyID Int, WebPartCode Varchar (10), SVGFilename Varchar(255), XSLTFilename Varchar(255), RowNumber Int)

    Insert
    into #tmp(ModuleHierarchyID,WebPartCode, SVGFilename, XSLTFilename, RowNumber)

    Select
    ModuleHierarchyID, W.WebPartCode , SVGFilename, XSLTFilename, Row_Number()Over (ORDERBY ModuleHierarchyId DESC) As RowNumber
    from
    SVG_SVGMapping S, WEP_WebPart W

    where
    S.ModuleHierarchyId = @ModuleHierarchyID
    and S.WebPartId= W.WebPartId

    Set
    @Count = (Select count(1) from #tmp)
    Set
    @i = 0
    Set @SQL = N'Select ' +Ltrim(str(@ModuleHierarchyID)) + ' As ModuleHierarchyId'

    While
    @i < @Count
    Begin
    Set
    @SQL = @SQL + N', '

    Set + N'(Select WebPartCode from #tmp where Rownumber = ' + ltrim(Str(@i + 1))+ ') As WebPartCode' + ltrim(str(@i + 1)) + ','

    Set
    @SQL = @SQL + N'(Select SVGFilename from #tmp where Rownumber = ' +ltrim(Str(@i + 1)) +') As SVGFilename' +ltrim(str(@i + 1)) +','

    Set
    @SQL = @SQL + N'(Select XSLTFilename from #tmp where Rownumber = ' + ltrim(Str(@i + 1))+ ') As XSLTFilename' + ltrim(str(@i + 1))

    Set
    @i = @i + 1

    End


    EXECUTE
    sp_executesql @SQL