TwitterLinkedInBlog

Sunday, November 27, 2011

iTunes - Remember playback position

iTunes > Right-click song > 'Get Info' > 'Options' tab > Check 'Remember playback position' > OK.

Tuesday, November 22, 2011

Error: Mount-SPContentDatabase - SPUnrecoverableException

Problem:
I received an error when running the following cmdlet:
Mount-SPContentDatabase -Name SampleContentDB -DatabaseServer SampleDBServer -WebApplication http://intranet.samplecompany.com/

Error:
InvalidData: (Microsoft.Share...ContentDatabase:SPCmdletMountContentDatabase) [Mount-SPContentDatabase], SPUnrecoverableException

Resolution:
The drive was full. I cleared some space and then it worked.

Monday, November 21, 2011

XML - Should I Use an Element or an Attribute?

From MSDN...

Elements are used to encapsulate pieces of data, and attributes are generally used to provide accompanying information about an element, rather than to encapsulate raw data itself. Whether you actually use an element or an attribute is up to the needs of your application.

Use attributes if your information requires data of a simple type and:

•Your information requires a default or fixed value.
•Your information requires data that is metadata for an existing element
•If the size of your XML file is an issue, attributes tend to take up fewer bytes than elements

The following list describes the key differences between elements and attributes from a schema perspective:

•A schema can define whether the ordering of elements is significant, but attributes can occur in any order.
•Elements can be nested with the tag, which means one and only one of the listed elements can appear.
•Elements can occur more than once, but attributes cannot.

Source:
http://msdn.microsoft.com/en-us/library/7f0tkwcx(v=vs.71).aspx

Thursday, November 10, 2011

_layouts web.config

Reminder: The following web.config file exists and must be updated for debugging purposes:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config

<configuration>
  <system.web>
    <customerrors mode="Off">
  </system.web>
</configuration>

Using URL Rewrite to Redirect

The following is performed at the web site level in IIS. See 'Resources' below for the 'URL Rewrite' download link, the user reference guide, and a couple other helpful links.
Match URL > Requested URL: 'Matches the Pattern' > Using: 'Regular Expressions' > Pattern:

*Note: Pattern: tests against the <path>, not the entire URL!
http(s)://<host>:<port>/<path>?<querystring>

So if you want to test if a string is in the beggining of the path, you would use ^. For example, if you want to redirect...
http://intranet.samplecompany.com/hr/Pages/default.aspx
... to ...
http://intranet.samplecompany.com/teams/hr/Pages/default.aspx
... you would use:
Pattern: ^hr/.*

Then, Action > Action type: 'Redirect' > Action Properties > Redirect URL:
http://intranet.samplecompany.com/teams/{R:0}
The {R:0} is a back reference variable. You can see it when you use the 'Test pattern...' button in the 'Match URL' section of the form.

*Tip: When using the 'Test pattern...' button > Input data to test:
Use the path, not the entire URL! Remember, the pattern tests against the path, not the entire URL!

*Note: It seems that when using 'Conditions', the path needs a leading forward slash. So for the 'Redirect URL' with no Conditions, one would use the pattern...
^hr/.*
... and the 'Redirect URL'...
http://intranet.samplecompany.com/teams/{R:0}

... but with Conditions, one would use the Condition pattern...
^/hr/.*
... and the 'Redirect URL'...
http://intranet.samplecompany.com/teams{C:0}

*Another Note:
If you attempt to browse to a non-existent page, you will get a 404 error. This is by design, because if the following link doesn't exist here...
http://intranet.samplecompany.com/hr/Pages/sample.aspx

... it's not going to exist here either...
http://intranet.samplecompany.com/teams/hr/Pages/sample.aspx


Resources:

Tuesday, November 8, 2011

CQWP - Date Example

ItemStyle.xsl <xsl:template>

<xsl:value-of select="ddwrt:FormatDateTime(string(@PublicationDate),1033,'MM.dd.yyyy')"></xsl:value-of>

Make sure to include the following in the <xsl:stylesheet> tag:
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"

Friday, November 4, 2011

Edit in Notepad

  • Open C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\DOCICON.XML
  • <Mapping Key="txt" Value="ictxt.gif" EditText="Notepad" OpenControl="SharePoint.OpenDocuments"/>
  • Reset IIS
Source: http://sladescross.wordpress.com/2010/04/26/sharepoint-adding-a-custom-document-template/