Wednesday, June 9, 2010

Codec packs

These are based on the open source ffdshow project and will add support for VP6-encoded Flash (.flv) files, H.264 video in the Matroska (.mkv) container, and Ogg (.ogg) video files to Windows Media Player.

See Also:

Tuesday, June 8, 2010

Changing the Compare/diff tool used in VS2010

Tools > Options > Source Control - Visual Studio Team Foundation Service > Configure User Tools...

For both Compare and Merge I've set the extension to .*.

Compare Arguments for DiffMerge: /title1=%6 /title2=%7 %1 %2

Merge Arguments for DiffMerge: /title1=%6 /title2=%8 /title3=%7 /result=%4 %1 %3 %2


Diffing Word Documents

Better yet, you can configure TFS to Diff Word documents.

Save the diff-doc.js somewhere convenient and reference it as the Command. Then give it the Arguments %1 %2


See Also:

Sunday, June 6, 2010

Gotchas when upgrading from VS2008 to VS2010

Ran into a few issues when upgrading a solution with 26 projects from Visual Studio 2008 to Visual Studio 2010.

I started by creating a new solution file to be used by VS2010 and added the existing projects.

Issue 1 - Referencing a higher framework version

VS2008 was fairly accepting of a framework 2.0 project referencing DLL's or projects with a higher framework target.

VS2010 will stop the build with a error like:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "newerFrameworkProject, Version=18.0.0.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "newerFrameworkProject, Version=18.0.0.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and errors that all the functions/types used in the api dll are not defined.

In this case adding <SpecificVersion>true</SpecificVersion> to the reference resolves the issue.

See Also

Issue 2 - Project ToolsVersion

The ToolsVersion attribute on the Project node is changed from 3.5 to 4.0 by the upgrade wizard.

Before
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
After
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

Since our TFS build server hasn't been updated yet I needed to revert this in the TFSBuild.proj

Issue 3 - Microsoft.WebApplication.targets path

The project import for Microsoft.WebApplication.targets differs for VS2010. See Working with both VS 2010 and 2008 on the team for a solution using conditional statements.

Issue 4 - System.Web.Security provider types have been forwarded to System.Web.ApplicationServices

See System.Web.MembershipProvider and RoleProvider references not found in unit tests after VS2010 upgrade

Thursday, May 20, 2010

Using jQuery to show assigned tabindex

This is a bit crude but I've found it useful for debugging tabindex attributes

$(document).ready(function(){
       
     $('[tabindex]').each(function () {
             $(this).after('<span style="background-color:red;color:white;">' + $(this).attr('tabindex') + '</span>');
         });
 });

Sunday, May 16, 2010

BinaryFormatter versus XmlElement

Ran into an issue trying to store a Web Reference tool generated class in ViewState that had an internal XmlElement array.

System.Runtime.Serialization.SerializationException: Type 'System.Xml.XmlElement' in Assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

One possible solution would be to create a ISerializationSurrogate that gets added to the BinaryFormatter.SurrogateSelector (example). However, it isn't clear how this would work with ViewState serilization (I.e. where to plug it in?).

Instead I extended the partial class created by the web reference tool so that it implemented ISerializable. Then using the GetObjectData method and a custom deserilization constructor I stored the OuterXml of the XmlElement at a string.

Saturday, May 15, 2010

S4S web.config settings to use the Sandbox API

The following web.config applicationSettings can be used to override the default Partner API URL for S4S.

Note: The setting names will alter with updates to S4S as the Salesforce Partner API is updated.

    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="FuseIT.Sitecore.SalesforceConnector.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <applicationSettings>
        <FuseIT.Sitecore.SalesforceConnector.Properties.Settings>
            <setting name="Sitecore_Salesforce_SalesforcePartner170_SforceService"
                serializeAs="String">
                <value>https://test.salesforce.com/services/Soap/u/17.0</value>
            </setting>
            <setting name="FuseIT_Sitecore_SalesforceConnector_SalesforceMetadata160_MetadataService"
                serializeAs="String">
                <value>https://ap1-api.salesforce.com/services/Soap/m/16.0</value>
            </setting>
        </FuseIT.Sitecore.SalesforceConnector.Properties.Settings>
    </applicationSettings>

As of 1.4 the preferred approach is to change the binding environment in the connection string. E.g.

<connectionStrings>
  <add name="S4SConnString" connectionString="S4S:user id=user_name;password=user_password;token=user_security_token;environment=Sandbox" />
</connectionStrings>

Key

Description

user id

The Salesforce user name that will be used to establish the Partner API session

password

The password for the Partner API user. If the servers IP address isn’t trusted by the Salesforce Organization being connected to the users security token can be appended to the password.

token

(Optional) As an alternative to appending the users security token to the password in the connection string it can be defined separately to provide the same functionality.

environment

(Optional) The type of Salesforce environment being connected to. Defaults to Production if unspecified which will also work for developer edition organizations if required.

Possible values:

  • Production
  • DeveloperEdition
  • Sandbox
  • Pre_release