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