Geeks With Blogs
.Nettuce Code Salad September 2009 Entries
Prime Number Generator
I've been trying to sharpen my blunt mathematical brain by solving some of the problems on Project Euler. Prime numbers figure in a few of the questions, so here's a bit of C#/LINQ goodness for generating them up to 100: Enumerable.Range(2, 100 - 2).Where(i => Enumerable.Range(2, (int)Math.Sqrt(i)).All((j) => i == 2 || i % j != 0)).ToList().ForEach(Consol... ......

Posted On Wednesday, September 30, 2009 5:39 PM

Simple javascript spinner control
Pretty straightforward this one - you can see an example here <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " xmlns=" <title>Simple spinner</title> <script type="text/javascript"> function RotateSpinner(spinnerId, up) { document.getElementById(spi... = up ? parseInt(document.getElemen... + 1 : parseInt(document.getElemen... ......

Posted On Sunday, September 6, 2009 7:43 PM

Linq Length
All thanks to Andrew for sharing for this idea, I just trimmed it down a bit: using System;using System.CodeDom;using System.Data.Linq.Mapping;using System.Web.Compilation;using System.Web.UI;using System.Text.RegularExpressi... LinqLength{ [ExpressionPrefix("LinqLenq... public class LinqLength : ExpressionBuilder { public override CodeExpression GetCodeExpression(BoundProp... entry, Object parsedData, ExpressionBuilderContext context) { return new CodePrimitiveExpression(Reg... ......

Posted On Friday, September 4, 2009 8:54 PM

Copyright © Jon Canning | Powered by: