This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "PresentationCore.dll" | |
#r "PresentationFramework.dll" | |
#r "WindowsBase.dll" | |
#r "WriteableBitmapEx.Wpf.dll" // requires custom version with DrawString | |
open System | |
open System.Windows | |
open System.Windows.Controls | |
open System.Windows.Media | |
open System.Windows.Media.Imaging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
/// <summary> | |
/// Dynamic rules engine, translated from visual basic | |
/// Demonstration of demonstrating how to build a generic dynamic rules engine. | |
/// Original purpose: arbitrary classes are generated to reflect types from tables in a database | |
/// Two databases were being merged and a method of checking arbitrary rows in any table was required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Cells = | |
// Types | |
type LifeSpec = | |
| LifeSpec of GenerationSpec list | |
and GenerationSpec = | |
| GenerationSpec of strength: int * liveness: (int -> bool) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Reflection | |
Imports System.Linq.Expressions | |
''' <summary> | |
'''This generic class encapsulates the main algorithms for building a rule engine and a list of matched source/merge '''"rows"To prove whether a row in source and target are equivalent. | |
''' A property in the classes we may be using represent columns in a table or query. | |
'''Say we have an instance thus: | |
'''SourcePerson = New Person with {.Name = "ommitted db query", | |
''' .DOB =" ommitted db query"} | |
'''MergedPerson = New Person with {.Name = "ommitted db query", | |
''' .DOB =" ommitted db query"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS `country` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`iso` char(2) NOT NULL, | |
`name` varchar(80) NOT NULL, | |
`nicename` varchar(80) NOT NULL, | |
`iso3` char(3) DEFAULT NULL, | |
`numcode` smallint(6) DEFAULT NULL, | |
`phonecode` int(5) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; |