Standing on the shoulders of giants. RSS 2.0
Previous Page Page 2 of 11 in the Development category Next Page
# Thursday, October 05, 2006

"If you are designing a piece of tech gear - be it hardware or software - and you need to choose an arbitrary limit or range for something, make sure the limit is either 2^n or 2^n - 1."

Source: Eric Gunnerson

Thursday, October 05, 2006 6:21:40 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Development | Fun
# Saturday, August 19, 2006

Frank just started his new blog and his first post details how to work with control adapters in SPS2007. Very good stuff.

Saturday, August 19, 2006 5:18:43 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Development | Sharepoint
# Thursday, August 17, 2006

It seems VS 2003 has been out forever, but sp1 has been released for download yesterday. I never experieced any real problems with it, but it's great to see the DDCPX team is still working on improving its stability.

Download here: VS 2003 SP1 and release notes

List of Fixes: KB 918007

Thursday, August 17, 2006 2:48:31 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Development
# Thursday, January 12, 2006

Well, maybe...

 

public class GenericComparer : IComparer {

public GenericComparer( CompareDelegate doCompare ){

if( doCompare == null ){

throw new ArgumentNullException("doCompare");

}

this.doCompare = doCompare;

}

public int Compare( object x, object y ){

if( x == null ){

if( y == null ){

return 0;

}

return -1;

}

if( y == null ){

return 1;

}

return doCompare(x,y);

}

private CompareDelegate doCompare;

}

public delegate int CompareDelegate( object x, object y );

Update:
My colleague Branimir did a little experimentation and found this implementation is similar in performance to a 'regular' methodcall when sorting around 10.000 items.

LastComparer.zip (30.65 KB)
Thursday, January 12, 2006 4:42:19 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0] - Trackback
Codesnippet | Development
# Wednesday, January 04, 2006

See also: A horrible way to calculate a squareroot

using System;
using System.Query;

namespace SquareRoot
{
class Program
{
static void Main(string[] args)
{
int input = 16;
decimal margin = 0.01M;

Func<decimal, decimal> abs = (decimal x) =>
x < 0 ? -x : x;

Func<decimal, bool> goodEnough = (decimal guess) =>
abs(guess * guess - input) < margin;

Func<decimal, decimal> newGuess = (decimal guess) =>
(guess + input / guess) / 2;

Console.WriteLine( "Guess {0}", Try(1, goodEnough, newGuess) );
Console.ReadLine();
}

static decimal Try(decimal guess, Func<decimal, bool> goodEnough, Func<decimal, decimal> newGuess)
{
if (!goodEnough(guess))
{
return Try(newGuess(guess), goodEnough, newGuess);
}

return guess;
}
}
}

Wednesday, January 04, 2006 5:32:56 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0] - Trackback
Development
# Monday, January 02, 2006

But fun to write:

using System;

class MyClass {
public static void Main() {

int input = 16;
decimal margin = 0.01M;

Func<decimal, decimal> abs = delegate(decimal x) {
return x < 0 ? -x : x;
};

Func<decimal, bool> goodEnough = delegate(decimal guess) {

return abs(guess * guess - input) < margin;
};

Func<decimal, decimal> newGuess = delegate(decimal guess) {
return (guess + input / guess) / 2;
};

Console.WriteLine("guess {0}", Try(1, goodEnough, newGuess) );
Console.ReadLine();
}

static decimal Try(decimal guess, Func<decimal, bool> goodEnough, Func<decimal, decimal> newGuess) {

if (!goodEnough(guess)) {
return Try(newGuess(guess), goodEnough, newGuess);
}

return guess;
}


delegate ReturnType Func<U, ReturnType>(U guess);
}

Inspired by Joel and Chris.

Monday, January 02, 2006 5:37:31 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0] - Trackback
Development
# Wednesday, December 07, 2005

The lowest level useful description of the goal of any software is probably best put as "elicit a positive emotional response
in a human".

2005 – DJ Mort

Wednesday, December 07, 2005 8:13:51 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0] - Trackback
Development
# Tuesday, December 06, 2005
Stef wrote an extension to NDoc, which can be used to create XmlDoc files for your database.
Tuesday, December 06, 2005 11:47:33 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0] - Trackback
Development
# Wednesday, September 21, 2005

My highlights of the PDC 05:

  • Linq and the associated C# 3.0 features
  • IIS 7.0, plugable modules and xcopy deployment of configurations.
  • Windows Workflow Foundation

Expect more indepth articles in the coming weeks, when I’ve had some time to experiment with everything.

Wednesday, September 21, 2005 1:56:42 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Development | PDC
# Wednesday, July 27, 2005

public static string HashPasswordForStoringInConfigFile(
   string password,
   string passwordFormat
);

In the FormsAuthentication class in the System.Web.Security namespace.

The first parameter is the string you want hashed, the second is the hashalgorithm, “sha1” or “md5”, to use.

[more info on msdn]

Wednesday, July 27, 2005 8:22:06 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Codesnippet | Development
Ads
About
© Copyright 2012
Paul van Brenk
Sign In
newtelligence dasBlog 2.3.2011.0
All Content © 2012, Paul van Brenk
DasBlog theme 'Business' created by Christoph De Baene (delarou)