Today i decided to upgrade our site AlternativeTo to ASP.NET Framework 4.0 and naturally there where some stuff that didn’t work. Hopefully someone else who is having the same issues will find this post and get some help from it. I started by follow this article from MSDN about upgrading from 3.5 (or lower) to [...]
Posted on 01 June 2010, 14:33, by Ola, under
C#,
LINQ.
This is another awesome feature in LINQ to SQL that i always forget about. Sometimes you have an array of strings or any other type and want to query the database for all values that have one of the values in the array. string platform = “windows|linux”; string[] platformList = platform.Split(‘|’); itemQuery = from m [...]
Posted on 20 April 2010, 14:29, by Ola, under
C#.
For some reason I always forget that you do not do .Join on your actual string array. So i might as well write it down here so i never forget about this again. string mycommalist = string.Join(“,”, alternatives.Select(x=>x.Item.Name).ToArray())
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 int[] ToIntArray(this string[] strArray) [...]
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 [...]
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 [...]