Posted on 07 November 2009, 16:35, by Ola, under
C#.
Sometimes you want to convert arrays back and forth. This is to nice extension methods to convert a int array into a string array and vice versa.
public static class ExtensionMethods {
public static string[] ToStringArray(this int[] intArray) {
return Array.ConvertAll<int, string>(intArray, delegate(int intParameter) { return intParameter.ToString(); });
}
public static [...]
Posted on 13 February 2009, 12:25, by Ola, under
ASP.NET,
C#,
php.
The URL shortening service http://bit.ly has a really simple and convient API that lets just get a short url like this.
http://bit.ly/api?url=http://www.myreallylong.com/url/with/lots?of=crap
I’ve used this in a wordpress installation with PHP before and there i could just do.
$twitter_url .= file_get_contents(’http://bit.ly/api?url=’ . get_permalink());
Simple and clean. But today i wanted to do the same thing with asp.net and found [...]
Posted on 14 October 2008, 16:13, by Ola, under
C#,
LINQ.
Today i built a Tag cloud for my new site. I found this great article about on how to do it with LINQ and C#. But i missed some features. Especially how to limit the number of tags that was shown. So if you read that article and then have a look at this code [...]