commadelimitedstringcollection makes nice csv

just posted this here as a reminder to myself or anyone else looking for a quick way to create a comma-seperated string from a list of things.

public static string ListToCsv<T>(List<T> list)
{
CommaDelimitedStringCollection commaStr = new CommaDelimitedStringCollection();
list.ForEach(delegate(T item)
  {
  commaStr.Add(item.ToString());
   });
       return commaStr.ToString();
}
  -edoode
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

windows foldershare beta is now windows live sync

i've been using the foldershare beta for some time now, and I like it! it keeps folders between my home pc and laptop syncronized without any fuss. just set it up and boom, instant sync. works behind nat, firewall etc. when I started up this day foldershare notified me that they have gone out of beta. the new name is now windows live sync. the upgrade went with unexpected smoothness. i installed the new client, and all my settings and shared folders were migrated.

big kudo's to the team!

  -edoode
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

sql issue with cast

was working with a quick query to find some data in a netxt field containing a comma-seperated list of countries, so i wrote:
select id, countries from tablea where cast(countries as varchar) LIKE '%mozambique%'
this didn't return the number of rows i expected so i investigated further. it seems that using cast() in this way (without specifiying  a length) creates a varchar of default length. if a string in my ntext fields is longer than this length thestring is terminated. hmm, fun.
my curiosity got the better of my so i checked to see what the default length actually is.
select len(cast(countries as varchar)), datalength(cast(countries as varchar)), countries 
from tablea
returns 30 for both len() and datalenght(). 30? why 30?? what an decidly odd default.

  -edoode

[update] thanks to my friends at stackoverflow i now see the official ms doc stating that the default is 30. I still wonder about the why though...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

stack overflow

i love stack overflow. it's like experts exchange, only it works. i have posted several questions (see here) and got answers on almost all happy happy joy joy. answering questions gains you reputation. more reputation means more functions, like up or downvoting. elegant. go try it with a question.

  -edoode
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

blogging is back

after a well deserved break from the blog stratosphere, i have returned. i'll try and post an entry weekly

stay tuned!

  -edoode
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
«January»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234