Thursday, February 7. 2013
Skype Collaboration Provider Not Listed
On a project at a new client we are using the Skype Collaboration Provider for VS2010. For some unknown reason, after running the apropriate installer, the Skype Collaboration Provider did not show in the dialog where you can choose the desired provider.
Repairing, uninstalling, rebooting and re-installing the the provider multiple times, did not end up in the desired result. I still could not select the Skype Collaboration Provider from the Personal Settings dialog. As if it just was NOT installed at all. Finally I had an epiphany... Maybe it just did not install to the correct location! So I investigated the location of the Windows Live Messenger Collaboration Provider. To my surprise the Skype provider was not in the same directory! Eureka!
It seems that the Skype Collaboration Provider installer puts the binaries in the default installation directory of VS2010. And as I did not install my VS2010 in the default location, the binaries could not be found. The final solution was quite simple. Just copy the binaries to the correct location... Sigh
- Yes, VS2010 Service Pack 1 is installed correctly.
- Yes, Team Foundation Power Tools for VS2010 are installed correctly.
Repairing, uninstalling, rebooting and re-installing the the provider multiple times, did not end up in the desired result. I still could not select the Skype Collaboration Provider from the Personal Settings dialog. As if it just was NOT installed at all. Finally I had an epiphany... Maybe it just did not install to the correct location! So I investigated the location of the Windows Live Messenger Collaboration Provider. To my surprise the Skype provider was not in the same directory! Eureka!
It seems that the Skype Collaboration Provider installer puts the binaries in the default installation directory of VS2010. And as I did not install my VS2010 in the default location, the binaries could not be found. The final solution was quite simple. Just copy the binaries to the correct location... Sigh
Friday, April 6. 2012
Truncating text while respecting word boundaries.
Every so once in a while the issue rises where you need to truncate a piece of text to a certain maximum length.
Now that in itself is not so hard to do. But the result can look quite strange when the truncation point happens in the middle of a word.
As always StackOverflow provides a good starting point.
I just thought using a Regular Expression would be more concise. So here is my solution:
private const string Ellipsis = "...";
// Match word boundaries at the end of a word.
private static Regex wordRegex = new Regex(@"(?<=\w)(?!\w)", RegexOptions.Compiled);
private static string Truncate(string source, int length)
{
int maxLength = length - Ellipsis.Length;
if (source != null && source.Length > length)
{
int afterLastWordIndex = 0;
foreach (Match m in wordRegex.Matches(source))
{
if (m.Index <= maxLength)
{
afterLastWordIndex = m.Index;
}
else
{
break;
}
}
return String.Concat(source.Substring(0, afterLastWordIndex), Ellipsis);
}
return source;
}
static void Main(string[] args)
{
string source = "The quick brown fox jumps over the lazy dog";
Console.WriteLine(" 1 2 3 4 5");
Console.WriteLine("12345678901234567890123456789012345678901234567890");
Console.WriteLine(source);
int[] truncingLengths = { 0, 1, 3, 4, 8, 9, 10, 15, 19, 20, 21, 22, 23, 28, 30, 33, 42, 43, 50 };
foreach (int truncAt in truncingLengths)
{
Console.WriteLine("{0}: \"{1}\"", truncAt, Truncate(source, truncAt));
}
Console.ReadLine();
}
Now that in itself is not so hard to do. But the result can look quite strange when the truncation point happens in the middle of a word.
As always StackOverflow provides a good starting point.
I just thought using a Regular Expression would be more concise. So here is my solution:
private const string Ellipsis = "...";
// Match word boundaries at the end of a word.
private static Regex wordRegex = new Regex(@"(?<=\w)(?!\w)", RegexOptions.Compiled);
private static string Truncate(string source, int length)
{
int maxLength = length - Ellipsis.Length;
if (source != null && source.Length > length)
{
int afterLastWordIndex = 0;
foreach (Match m in wordRegex.Matches(source))
{
if (m.Index <= maxLength)
{
afterLastWordIndex = m.Index;
}
else
{
break;
}
}
return String.Concat(source.Substring(0, afterLastWordIndex), Ellipsis);
}
return source;
}
static void Main(string[] args)
{
string source = "The quick brown fox jumps over the lazy dog";
Console.WriteLine(" 1 2 3 4 5");
Console.WriteLine("12345678901234567890123456789012345678901234567890");
Console.WriteLine(source);
int[] truncingLengths = { 0, 1, 3, 4, 8, 9, 10, 15, 19, 20, 21, 22, 23, 28, 30, 33, 42, 43, 50 };
foreach (int truncAt in truncingLengths)
{
Console.WriteLine("{0}: \"{1}\"", truncAt, Truncate(source, truncAt));
}
Console.ReadLine();
}
Wednesday, June 1. 2011
MSBuild Exec task - IgnoreStandardErrorWarningFormat
If you are using MSBuild 4.0.30319 and try to set the property IgnoreStandardErrorWarningFormat on the Exec task you might run into the following message error:
The solution is very, very simple: be sure to add ToolsVersion="4.0" to the Project tag.
<Project DefaultTargets="Bla" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Target Name="Bla">
<Exec IgnoreStandardErrorWarningFormat="true" Command="dir /w" />
</Target>
</Project>
error MSB4064: The "IgnoreStandardErrorWarningFormat" parameter is not supported by the "Exec" task.
The solution is very, very simple: be sure to add ToolsVersion="4.0" to the Project tag.
<Project DefaultTargets="Bla" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Target Name="Bla">
<Exec IgnoreStandardErrorWarningFormat="true" Command="dir /w" />
</Target>
</Project>
« previous page
(Page 1 of 5, totaling 15 entries)
next page »