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 24 November 2008, 13:16, by Ola, under
LINQ.
Today i wanted to do a group by query with LINQ wich is something i never done before. I turned out to be kind of easy. If you just want to group by a single field. (from s in db.CrewStatsSet where s.LogDate >= date1 && s.LogDate <= date2 && s.Action == action group s by [...]
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 [...]
Posted on 09 October 2008, 14:42, by Ola, under
JQuery.
Like everyone else i’ve been playing around with JQuery alot latley. Asp.net and JQuery is not the best friends in the world but i guess it will be alot better when using ASP.NET MVC. Microsoft also annoncued that they will support JQuery natively in future versions. Nice! If you want to learn more about ASP.NET [...]