Archives

Installing Android 6 Marshmallow on Nexus 7
I got a Nexus 7 in 2013. In 2014 it was upgraded to Android 5.0 Lollipop, and then became way slower. This month, Google released Android 6.0.0 factory images  build MRA58K, Nexus 7 2013 included. So maybe it is time to refresh the device.
Here are the steps of installing from Windows 10:

Category Theory via C# (22) More Monad: Continuation Monad
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (17) Monadlike Tuple<>, Task<>, IQueryable<> And IQbservable<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (18) More Monad: IO<> Monad
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (19) More Monad: State< , > Monad
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (20) More Monad: Reader< , > Monad
[Obsolete] See latest version  [Category Theory]
Reader< , > Monad
Sometimes there are functions work with a shared environment. Typical examples are:
 Environment variables
 Application’s settings stored in App.config
 web application’s configurations stored in Web.config
The Reader< , > monad is a specialized State< , > monad. It threads an environment parameter through a sequence of functions.
The definition is simple:
// Reader<TEnvironment, T> is alias of Func<TEnvironment, T> public delegate T Reader<in TEnvironment, out T>(TEnvironment environment);
It is nothing but a Func< , >. This is its SelectMany:

Category Theory via C# (21) More Monad: Writer< , > Monad
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (12) More Monoidal Functors: Lazy<>, Func<> And Nullable<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (13) Monoidal Functorlike Tuple<> And Task<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (14) Monad And IEnumerable<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (15) IEnumerable<> Monad And LINQ: SelectMany For All
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (16) More Monads: Lazy<>, Func<>, Nullable<>, ParallelQuery<> And IObservale<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (8) Functor Category
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (9) Bifunctor
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (10) Monoidal Category
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (11) Monoidal Functor And IEnumerable<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (5) More Functors: Lazy<>, Func<> And Nullable<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (6) Functorlike Tuple<>, Task<> And IQueryable<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (7) Natural Transformation
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (4) Functor And IEnumerable<>
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (3) Monoid as Category
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (2) Monoid
[Obsolete] See latest version  [Category Theory]

Category Theory via C# (1) Fundamentals  Category, Object And Morphism
[Obsolete] See latest version  [Category Theory]

Attach SQL Server 2000 database to SQL Server 2014
In the MSDN introduction for LINQ to SQL, the Northwind sample database is used. It is a 15 years old database for SQL Server 2000. After downloading the database files, it cannot be attached to the latest SQL Server 2014 or 2016. trying to do so results an error:

Lambda Calculus via C# (8) Undecidability of Equivalence
[LINQ via C#]  [Lambda Calculus]

Lambda Calculus via C# (23) Y Combinator, And Divide
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (22) Iota Combinator
[Obsolete] See latest version  [Lambda Calculus]
Language with 1 element
Iota is an esoteric programming language with minimum elements but still Turingcomplete. Iota's universal combinator is:
ι := λf.f S K ≡ λf.f (λx.λy.λz.x z (y z)) (λx.λy.x)
That’s the whole language.

Lambda Calculus via C# (21) SKI Combinator Calculus
[Obsolete] See latest version  [Lambda Calculus]
The previous part shows SKI calculus is untyped and strongly typed C# implementation does not work. So here comes the SKI in untyped C#:
public static partial class SkiCombinators { public static Func<dynamic, Func<dynamic, Func<dynamic, dynamic>>> S = x => y => z => x(z)(y(z)); public static Func<dynamic, Func<dynamic, dynamic>> K = x => _ => x; public static Func<dynamic, dynamic> I = x => x; }
Notice closed types (Func<dynamic, …>) are used instead of open type (Func<T, …>) in previous part. So S, K and I do not have to be in the form of C# methods.

Lambda Calculus via C# (20) Combinators
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (19) Church Encoding, And More
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (18) Encoding Signed Number
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (17) Encoding Church List with Fold (Aggregate) Function
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (16) Encoding Church List with 2 Church Pairs as a Node
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (15) Encoding Church List with Church Pair, And Null
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (14) Church Pair (2Tuple) and Church Numeral Decrease
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (13) Encoding Church Pairs (2Tuples) and Generic Church Booleans
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (12) Church Numeral Comparison Operators
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (11) Predicates, And Divide
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (10) Church Numeral Arithmetic Operators
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (9) Wrapping Church Numerals And Arithmetic
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (8) Church Numeral Arithmetic
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (7) Encoding Church Numerals
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (6) If Logic, And Reduction Strategies
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (5) Boolean Logic
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (4) Encoding Church Booleans
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (3) Fundamentals  Function composition
[Obsolete] See latest version  [Lambda Calculus]

Lambda Calculus via C# (2) Fundamentals  Lambda Expression, Variables, Reductions
[Obsolete] See latest version  [Lambda Calculus]
The C# lambda expression has been discussed in detail. This post will explain lambda expression and other concepts in lambda calculus.
Lambda expression
In lambda calculus, the syntax of lambda expressions are:
 Variables v1, v2, …, vN
 The abstraction symbols lambda (λ) and dot (.)
 For example, the C# lambda expression x => x + 1 will be λx.x + 1 in lambda calculus, except the C# specific type system (Int32, Int 64, …) does not exist in λx.x + 1.
 Parentheses (), meaning higher precedence

Lambda Calculus via C# (1) Fundamentals  Closure, Currying and Partial Application
[Obsolete] See latest version  [Lambda Calculus]

Understanding C# async / await (3) Runtime Context
Understanding C# async / await:
 Understanding C# async / await (1) Compilation
 Understanding C# async / await (2) AwaitableAwaiter Pattern
 Understanding C# async / await (3) Runtime Context
Part 1 explained the compilation of await:
 In a async method with await keyword, all the code are compiled into a state machine’s MoveNext() method.
 When this async method is called, the state machine is started. Along with the change of the state, MoveNext() will be called in a callbacklike style.