Wednesday, April 15, 2009
Wednesday, April 8, 2009
Learning LINQ
I came across the blog of Eric White and this is the best material to learn linq i have seen.
http://blogs.msdn.com/ericwhite/pages/FP-Tutorial.aspx
Talks about functional programming and who C# implements functional programming using Linq.
Here one more link for learning LINQ technology.
http://www.linqhelp.com/
http://blogs.msdn.com/ericwhite/pages/FP-Tutorial.aspx
Talks about functional programming and who C# implements functional programming using Linq.
Here one more link for learning LINQ technology.
http://www.linqhelp.com/
Monday, April 6, 2009
Unity 1.2
Some thing to really look at new functionalities like Circular references with dependency injection, Interception with Unity http://unity.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=18855
Friday, April 3, 2009
MapReduce in F#
I came across the following link on MapReduce implementation in F#
http://www.twine.com/item/1229c60s4-4q/exploring-mapreduce-with-f
Also Microsoft is working on C# implementation known as LINQ to DataCenter.
For those who don't know MapReduce should think twice as anyone using google search is the user of MapReduce algorithm.
Wikipedia has clear explanation of the MapReduce http://en.wikipedia.org/wiki/MapReduce
http://www.twine.com/item/1229c60s4-4q/exploring-mapreduce-with-f
Also Microsoft is working on C# implementation known as LINQ to DataCenter.
For those who don't know MapReduce should think twice as anyone using google search is the user of MapReduce algorithm.
Wikipedia has clear explanation of the MapReduce http://en.wikipedia.org/wiki/MapReduce
WPF ConverterParameter
Just came to my knowledge and want share with people.
<TextBlock Text="{Binding Path=ABCD, Converter={StaticResource FormatConv}, ConverterParameter='{0:C}'}" />
The above code wont work i know there is nothing wrong in there but still compiler would cry about it.
One needs to add blank space in the ConverterParameter value and that will solve the problem.
ConverterParameter=' {0:C}'
<TextBlock Text="{Binding Path=ABCD, Converter={StaticResource FormatConv}, ConverterParameter='{0:C}'}" />
The above code wont work i know there is nothing wrong in there but still compiler would cry about it.
One needs to add blank space in the ConverterParameter value and that will solve the problem.
ConverterParameter=' {0:C}'
Functional Fibonnaci series in C#
C# code for functional fibonnaci numbers
Func<int, int> fib = null;
fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
Okay so you guys would think why would i declare the delegate in one line and instantiate in the next. The reason is that if you do everything in same line complier wont recognize the recursive call using the delegate. Try this
Func<int, int> fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
Above code wont compile
Haskell code for same
fib n
| n == 0 = 0
| n == 1 = 1
| n > 1 = fib (n-1) + fib (n-2)
Func<int, int> fib = null;
fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
Okay so you guys would think why would i declare the delegate in one line and instantiate in the next. The reason is that if you do everything in same line complier wont recognize the recursive call using the delegate. Try this
Func<int, int> fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
Above code wont compile
Haskell code for same
fib n
| n == 0 = 0
| n == 1 = 1
| n > 1 = fib (n-1) + fib (n-2)
Wednesday, April 1, 2009
New Class in .Net 4.1
Came across a new class in framework .Net 4.1 StringOr<TOther>
public class StringOr<TOther> {
public StringOr(string stringValue, TOther otherValue);
public string StringValue { get; }
public TOther OtherValue { get; }
}
There are lot of situations where you store datetime and other values in string simply because they are not formatted correctly or there are chances that database may or may not return a value which can be converted to exact format.
StringOr<int> userInput= GetUserInput("Quantity");
string szUserInput=userInput.StringValue;
int intUserInput=userInput.OtherValue;
Here is the solution to that problem.
public class StringOr<TOther> {
public StringOr(string stringValue, TOther otherValue);
public string StringValue { get; }
public TOther OtherValue { get; }
}
There are lot of situations where you store datetime and other values in string simply because they are not formatted correctly or there are chances that database may or may not return a value which can be converted to exact format.
StringOr<int> userInput= GetUserInput("Quantity");
string szUserInput=userInput.StringValue;
int intUserInput=userInput.OtherValue;
Here is the solution to that problem.
Subscribe to:
Posts (Atom)