├── UserSimulation ├── .gitignore ├── ErrorCondition.cs ├── Exceptions.cs ├── AnalysisType.cs ├── UserResults.cs ├── EnumerableExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── Error.cs ├── PrepData.cs ├── LogEntry.cs ├── UserSimulation.csproj ├── SimulationStep.cs └── CutoffKind.cs ├── Resources ├── clear.png ├── analyze.png ├── correct.png ├── clear_small.png ├── mark_as_ok.png ├── analyze_small.png ├── correct_small.png └── mark_as_ok_small.png ├── .gitmodules ├── CheckCell ├── Resources │ ├── about.png │ ├── clear_small.png │ ├── analyze_small.png │ ├── correct_small.png │ └── mark_as_ok_small.png ├── CheckCell_TemporaryKey.pfx ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── App.config ├── AboutBox.cs ├── ThisAddIn.Designer.xml ├── ThisAddIn.cs ├── CellFixForm.cs ├── RibbonHelper.cs ├── CellFixForm1.Designer.cs ├── CellFixForm.Designer.cs ├── CellFixForm.resx ├── AboutBox.Designer.cs ├── AboutBox.resx ├── Ribbon.cs └── Ribbon.Designer.cs ├── DataDebug_2_TemporaryKey.pfx ├── packages ├── FParsec.1.0.1 │ ├── FParsec.1.0.1.nupkg │ └── lib │ │ └── net40-client │ │ ├── FParsec.dll │ │ ├── FParsecCS.dll │ │ └── FParsecCS.XML └── repositories.config ├── CheckCellTests ├── TestData │ └── grades_spreadsheet.xlsx ├── App.config ├── Properties │ └── AssemblyInfo.cs ├── SimulationTests.cs ├── ClassificationTests.cs ├── ErrorClassifierTests.cs ├── ErrorGeneratorTests.cs ├── CheckCellTests.csproj └── CheckCellTests.cs ├── Properties ├── Settings.settings ├── Settings.Designer.cs ├── AssemblyInfo.cs ├── Resources.Designer.cs └── Resources.resx ├── .gitignore ├── DataDebug.vsmdi ├── DataDebugMethods ├── ExtensionMethods.cs ├── Utility.cs ├── FunctionOutput.cs ├── Properties │ └── AssemblyInfo.cs ├── ProgBar.Designer.cs ├── BootMemo.cs ├── ProgBar.cs ├── BiDictionary.cs ├── DataDebugMethods.csproj ├── InputSample.cs ├── ProgBar.resx └── NormalDistribution.cs ├── CheckCellSetup └── CheckCellSetup.isproj ├── LongestCommonSubsequence └── LongestCommonSubsequence.fsproj ├── README.md ├── MTurkParser ├── MTurkParser.fsproj └── Data.fs └── DataDebug.sln /UserSimulation/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | -------------------------------------------------------------------------------- /Resources/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/clear.png -------------------------------------------------------------------------------- /Resources/analyze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/analyze.png -------------------------------------------------------------------------------- /Resources/correct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/correct.png -------------------------------------------------------------------------------- /Resources/clear_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/clear_small.png -------------------------------------------------------------------------------- /Resources/mark_as_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/mark_as_ok.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "parcel"] 2 | path = parcel 3 | url = https://github.com/plasma-umass/parcel.git 4 | -------------------------------------------------------------------------------- /Resources/analyze_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/analyze_small.png -------------------------------------------------------------------------------- /Resources/correct_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/correct_small.png -------------------------------------------------------------------------------- /CheckCell/Resources/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/CheckCell/Resources/about.png -------------------------------------------------------------------------------- /DataDebug_2_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/DataDebug_2_TemporaryKey.pfx -------------------------------------------------------------------------------- /Resources/mark_as_ok_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/Resources/mark_as_ok_small.png -------------------------------------------------------------------------------- /CheckCell/Resources/clear_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/CheckCell/Resources/clear_small.png -------------------------------------------------------------------------------- /CheckCell/CheckCell_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/CheckCell/CheckCell_TemporaryKey.pfx -------------------------------------------------------------------------------- /CheckCell/Resources/analyze_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/CheckCell/Resources/analyze_small.png -------------------------------------------------------------------------------- /CheckCell/Resources/correct_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/CheckCell/Resources/correct_small.png -------------------------------------------------------------------------------- /CheckCell/Resources/mark_as_ok_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/CheckCell/Resources/mark_as_ok_small.png -------------------------------------------------------------------------------- /packages/FParsec.1.0.1/FParsec.1.0.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/packages/FParsec.1.0.1/FParsec.1.0.1.nupkg -------------------------------------------------------------------------------- /CheckCellTests/TestData/grades_spreadsheet.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/CheckCellTests/TestData/grades_spreadsheet.xlsx -------------------------------------------------------------------------------- /packages/FParsec.1.0.1/lib/net40-client/FParsec.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/packages/FParsec.1.0.1/lib/net40-client/FParsec.dll -------------------------------------------------------------------------------- /packages/FParsec.1.0.1/lib/net40-client/FParsecCS.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plasma-umass/DataDebug/HEAD/packages/FParsec.1.0.1/lib/net40-client/FParsecCS.dll -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CheckCell/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | A*~ 2 | main.aux 3 | main.log 4 | main.bbl 5 | main.blg 6 | main.pdf 7 | *.out 8 | texput.log 9 | .DS_Store 10 | bin 11 | obj 12 | *.suo 13 | ~$* 14 | *.bbl 15 | *.blg 16 | *.log 17 | *.aux 18 | *.trx 19 | AgentRestart.dat 20 | TestResults 21 | CheckCellTests/.gitignore 22 | CheckCellSetup/CheckCellSetup/Express 23 | -------------------------------------------------------------------------------- /UserSimulation/ErrorCondition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace UserSimulation 7 | { 8 | [Serializable] 9 | public enum ErrorCondition 10 | { 11 | OK, 12 | ContainsNoInputs, 13 | Exception 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /UserSimulation/Exceptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace UserSimulation 7 | { 8 | public class NoRangeInputs : Exception { } 9 | public class NoFormulas : Exception { } 10 | public class SimulationNotRunException : Exception 11 | { 12 | public SimulationNotRunException(string message) : base(message) { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CheckCell/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CheckCellTests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /DataDebug.vsmdi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /UserSimulation/AnalysisType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace UserSimulation 7 | { 8 | [Serializable] 9 | public enum AnalysisType 10 | { 11 | CheckCell5 = 0, // 0.05 12 | CheckCell10 = 1, // 0.10 13 | NormalPerRange = 2, //normal analysis of inputs on a per-range granularity 14 | NormalAllInputs = 3, //normal analysis on the entire set of inputs 15 | CheckCellN = 4 // CheckCell, n steps 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DataDebugMethods/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ExtensionMethods 7 | { 8 | public static class DataDebugExtensions 9 | { 10 | public static int ArgMax(this IEnumerable ie) where T : IComparable 11 | { 12 | var arr = ie.ToArray(); 13 | int argmax = 0; 14 | for (int i = 0; i < arr.Length; i++) 15 | { 16 | if (arr[i].CompareTo(arr[argmax]) > 0) 17 | { 18 | argmax = i; 19 | } 20 | } 21 | return argmax; 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CheckCell/AboutBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace CheckCell 11 | { 12 | public partial class AboutBox : Form 13 | { 14 | public AboutBox() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void OK_Click(object sender, EventArgs e) 20 | { 21 | this.Close(); 22 | } 23 | 24 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 25 | { 26 | System.Diagnostics.Process.Start("http://checkcell.org"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /UserSimulation/UserResults.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ErrorDict = System.Collections.Generic.Dictionary; 6 | 7 | namespace UserSimulation 8 | { 9 | [Serializable] 10 | public class UserResults 11 | { 12 | public List true_positives = new List(); 13 | public List false_positives = new List(); 14 | public HashSet false_negatives = new HashSet(); 15 | //Keeps track of the largest errors we observe during the simulation for each output 16 | public ErrorDict max_errors = new ErrorDict(); 17 | public List current_total_error = new List(); 18 | public List PrecRel_at_k = new List(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CheckCell/ThisAddIn.Designer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /CheckCell/ThisAddIn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Linq; 6 | using Excel = Microsoft.Office.Interop.Excel; 7 | using Office = Microsoft.Office.Core; 8 | using Microsoft.Office.Tools.Excel; 9 | 10 | namespace CheckCell 11 | { 12 | public partial class ThisAddIn 13 | { 14 | private void ThisAddIn_Startup(object sender, System.EventArgs e) 15 | { 16 | } 17 | 18 | private void ThisAddIn_Shutdown(object sender, System.EventArgs e) 19 | { 20 | } 21 | 22 | #region VSTO generated code 23 | 24 | /// 25 | /// Required method for Designer support - do not modify 26 | /// the contents of this method with the code editor. 27 | /// 28 | private void InternalStartup() 29 | { 30 | this.Startup += new System.EventHandler(ThisAddIn_Startup); 31 | this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); 32 | } 33 | 34 | #endregion 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DataDebug.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CheckCell/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CheckCell.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /UserSimulation/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace UserSimulation 7 | { 8 | public static class EnumerableExtensions 9 | { 10 | public static IEnumerable Shuffle(this IEnumerable source) 11 | { 12 | return source.Shuffle(new Random()); 13 | } 14 | 15 | public static IEnumerable Shuffle( 16 | this IEnumerable source, Random rng) 17 | { 18 | if (source == null) throw new ArgumentNullException("source"); 19 | if (rng == null) throw new ArgumentNullException("rng"); 20 | 21 | return source.ShuffleIterator(rng); 22 | } 23 | 24 | private static IEnumerable ShuffleIterator( 25 | this IEnumerable source, Random rng) 26 | { 27 | var buffer = source.ToList(); 28 | for (int i = 0; i < buffer.Count; i++) 29 | { 30 | int j = rng.Next(i, buffer.Count); 31 | yield return buffer[j]; 32 | 33 | buffer[j] = buffer[i]; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /DataDebugMethods/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Excel = Microsoft.Office.Interop.Excel; 6 | using System.Reflection; 7 | 8 | namespace DataDebugMethods 9 | { 10 | public class Utility 11 | { 12 | public static Excel.Application NewApplicationInstance() 13 | { 14 | return new Excel.Application(); 15 | } 16 | 17 | public static Excel.Workbook OpenWorkbook(string filename, Excel.Application app) 18 | { 19 | // we need to disable all alerts, e.g., password prompts, etc. 20 | app.DisplayAlerts = false; 21 | 22 | // disable macros 23 | app.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable; 24 | 25 | // This call is stupid. See: 26 | // http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.open%28v=office.11%29.aspx 27 | app.Workbooks.Open(filename, 2, true, Missing.Value, "thisisnotapassword", Missing.Value, true, Missing.Value, Missing.Value, Missing.Value, false, Missing.Value, Missing.Value, Missing.Value, Missing.Value); 28 | 29 | return app.Workbooks[1]; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CheckCell/CellFixForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace CheckCell 11 | { 12 | public partial class CellFixForm : Form 13 | { 14 | Microsoft.Office.Interop.Excel.Range _cell; 15 | System.Drawing.Color _color; 16 | Action _fn; 17 | 18 | public CellFixForm(Microsoft.Office.Interop.Excel.Range cell, System.Drawing.Color color, Action ReAnalyzeFn) 19 | { 20 | _cell = cell; 21 | _color = color; 22 | _fn = ReAnalyzeFn; 23 | InitializeComponent(); 24 | } 25 | 26 | private void CancelFix_Click(object sender, EventArgs e) 27 | { 28 | this.Close(); 29 | } 30 | 31 | private void AcceptFix_Click(object sender, EventArgs e) 32 | { 33 | // change the cell value 34 | _cell.Value2 = this.FixText.Text; 35 | 36 | // change color 37 | _cell.Interior.Color = _color; 38 | 39 | // close form 40 | this.Close(); 41 | 42 | // call callback 43 | _fn.Invoke(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DataDebugMethods/FunctionOutput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Numerics; 6 | 7 | namespace DataDebugMethods 8 | { 9 | public class FunctionOutput 10 | { 11 | private T _value; 12 | private BigInteger _excludes; 13 | 14 | public FunctionOutput(T value, BigInteger excludes) 15 | { 16 | _value = value; 17 | _excludes = excludes; 18 | } 19 | 20 | public T GetValue() 21 | { 22 | return _value; 23 | } 24 | 25 | public BigInteger GetExcludes() 26 | { 27 | return _excludes; 28 | } 29 | 30 | public HashSet GetExcludesAsHashSet() 31 | { 32 | var bits = new HashSet(); 33 | var e = _excludes; 34 | int i = 0; 35 | while (e != BigInteger.Zero) 36 | { 37 | // if the LSB is set, then the 38 | // ith index is excluded 39 | if ((BigInteger.One & e) == BigInteger.One) 40 | { 41 | bits.Add(i); 42 | } 43 | // right shift 44 | e = e >> 1; 45 | // increment counter 46 | i += 1; 47 | } 48 | return bits; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CheckCellTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CheckCellTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CheckCellTests")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2035316b-8880-477a-aa51-f59916b634c2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /CheckCellTests/SimulationTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Excel = Microsoft.Office.Interop.Excel; 5 | using OptChar = Microsoft.FSharp.Core.FSharpOption; 6 | 7 | 8 | namespace CheckCellTests 9 | { 10 | [TestClass] 11 | public class SimulationTests 12 | { 13 | [TestMethod] 14 | public void SimulationRunTest() 15 | { 16 | UserSimulation.Simulation sim = new UserSimulation.Simulation(); 17 | //sim.Run(100, "C:\\\\Users\\Dimitar Gochev\\Documents\\GitHub\\papers\\DataDebug\\OOPSLA-2013\\Spreadsheets\\test\\accurate_runtimes2.xlsx", 0.95, new Excel.Application(), 0.05); 18 | //sim.Run(100, "C:\\\\Users\\Dan Barowy\\Desktop\\corn-size-con.xls", 0.95, new Excel.Application(), 0.05, "C:\\\\Users\\Dan Barowy\\Documents\\Visual Studio 2010\\Projects\\papers\\DataDebug\\PLDI-2014\\Experiments\\ClassificationData_2013-11-14.bin"); 19 | // 20 | //sim.Run(100, "C:\\\\Users\\Dimitar Gochev\\Documents\\GitHub\\papers\\DataDebug\\OOPSLA-2013\\Spreadsheets\\test\\Test2.xlsx", 0.95, new Excel.Application(), 0.05, "C:\\\\Users\\\\Dimitar Gochev\\\\Documents\\\\GitHub\\\\papers\\\\DataDebug\\\\PLDI-2014\\\\Experiments\\\\ClassificationData_2013-11-14.bin"); 21 | //sim.Run(100, "C:\\\\Users\\Dimitar Gochev\\Documents\\GitHub\\papers\\DataDebug\\OOPSLA-2013\\Spreadsheets\\test\\no_inputs.xlsx", 0.95, new Excel.Application(), 0.05); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DataDebugMethods/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DataDebugMethods")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DataDebugMethods")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c72b1089-ebec-4aed-b2e9-1244beef723c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /UserSimulation/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("UserSimulation")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("UserSimulation")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("696214c6-ebd9-42ed-b045-38befced67ab")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Security; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("DataDebug")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("DataDebug")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("216cfd22-765a-4958-a05e-abd92bdd005e")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | -------------------------------------------------------------------------------- /CheckCell/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Security; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("CheckCell")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("CheckCell")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("f9cbd821-fa40-4b0b-841d-be0e6d7e2272")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | 39 | -------------------------------------------------------------------------------- /CheckCellSetup/CheckCellSetup.isproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express 6 | 7 | Debug 8 | $(Configuration) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | CheckCell 35 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80} 36 | 37 | 38 | -------------------------------------------------------------------------------- /UserSimulation/Error.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Xml.Serialization; 7 | using System.IO; 8 | 9 | namespace UserSimulation 10 | { 11 | [Serializable] 12 | public class ErrorDB 13 | { 14 | public List Errors { get; set; } 15 | 16 | public ErrorDB() 17 | { 18 | Errors = new List(); 19 | } 20 | 21 | public void AddError(int r, int c, string worksheet, string workbook, string path, string value) 22 | { 23 | var e = new Error(); 24 | e.row = r; 25 | e.col = c; 26 | e.worksheet = worksheet; 27 | e.workbook = workbook; 28 | e.path = path; 29 | e.value = value; 30 | Errors.Add(e); 31 | } 32 | 33 | public void Serialize(string filename) 34 | { 35 | XmlSerializer x = new System.Xml.Serialization.XmlSerializer(this.GetType()); 36 | using (StreamWriter sw = File.CreateText(filename)) 37 | { 38 | x.Serialize(sw, this); 39 | } 40 | } 41 | 42 | public static ErrorDB Deserialize(string filename) 43 | { 44 | ErrorDB obj; 45 | XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(ErrorDB)); 46 | using (StreamReader sr = new StreamReader(filename)) 47 | { 48 | obj = (ErrorDB)x.Deserialize(sr); 49 | } 50 | return obj; 51 | } 52 | } 53 | 54 | [Serializable] 55 | public struct Error 56 | { 57 | public int row; 58 | public int col; 59 | public string path; 60 | public string workbook; 61 | public string worksheet; 62 | public string value; 63 | public AST.Address GetAddress() 64 | { 65 | return AST.Address.FromR1C1(row, col, worksheet, workbook, path); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /DataDebugMethods/ProgBar.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DataDebugMethods 2 | { 3 | partial class ProgBar 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 32 | this.SuspendLayout(); 33 | // 34 | // progressBar1 35 | // 36 | this.progressBar1.Location = new System.Drawing.Point(12, 10); 37 | this.progressBar1.Name = "progressBar1"; 38 | this.progressBar1.Size = new System.Drawing.Size(507, 23); 39 | this.progressBar1.TabIndex = 0; 40 | // 41 | // ProgBar 42 | // 43 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 44 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 45 | this.ClientSize = new System.Drawing.Size(531, 45); 46 | this.Controls.Add(this.progressBar1); 47 | this.Name = "ProgBar"; 48 | this.Text = "Looking for errors..."; 49 | this.Load += new System.EventHandler(this.ProgBar_Load); 50 | this.ResumeLayout(false); 51 | 52 | } 53 | 54 | #endregion 55 | 56 | private System.Windows.Forms.ProgressBar progressBar1; 57 | } 58 | } -------------------------------------------------------------------------------- /DataDebugMethods/BootMemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Concurrent; 4 | using System.Linq; 5 | using System.Text; 6 | using Excel = Microsoft.Office.Interop.Excel; 7 | using Range = Microsoft.Office.Interop.Excel.Range; 8 | using System.Diagnostics; 9 | 10 | namespace DataDebugMethods 11 | { 12 | public class BootMemo 13 | { 14 | private Dictionary[]> _d = new Dictionary[]>(); 15 | 16 | public FunctionOutput[] FastReplace(Excel.Range com, DAG dag, InputSample original, InputSample sample, AST.Address[] outputs, bool replace_original) 17 | { 18 | FunctionOutput[] fo_arr; 19 | if (!_d.TryGetValue(sample, out fo_arr)) 20 | { 21 | // replace the COM value 22 | ReplaceExcelRange(com, sample); 23 | 24 | // initialize array 25 | fo_arr = new FunctionOutput[outputs.Length]; 26 | 27 | // grab all outputs 28 | for (var k = 0; k < outputs.Length; k++) 29 | { 30 | // save the output 31 | fo_arr[k] = new FunctionOutput(dag.readCOMValueAtAddress(outputs[k]), sample.GetExcludes()); 32 | } 33 | 34 | // Add function values to cache 35 | // Don't care about return value 36 | _d.Add(sample, fo_arr); 37 | 38 | // restore the COM value 39 | if (replace_original) 40 | { 41 | ReplaceExcelRange(com, original); 42 | } 43 | } 44 | return fo_arr; 45 | } 46 | 47 | public static void ReplaceExcelRange(Range com, InputSample input) 48 | { 49 | bool done = false; 50 | while (!done) 51 | { 52 | try 53 | { 54 | com.Value2 = input.GetInputArray(); 55 | done = true; 56 | } 57 | catch (Exception) 58 | { 59 | 60 | } 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /DataDebugMethods/ProgBar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace DataDebugMethods 11 | { 12 | public class ProgressMaxUnsetException : Exception { } 13 | 14 | /// 15 | /// This progress bar's lifecycle should be managed by the UI layer. 16 | /// 17 | public partial class ProgBar : Form 18 | { 19 | private bool _max_set = false; 20 | private int _count = 0; 21 | 22 | public ProgBar() 23 | { 24 | InitializeComponent(); 25 | progressBar1.Minimum = 0; 26 | progressBar1.Maximum = 100; 27 | this.Visible = true; 28 | } 29 | 30 | private void ProgBar_Load(object sender, EventArgs e) 31 | { 32 | 33 | } 34 | 35 | public void IncrementProgress() 36 | { 37 | // if this method is called from any thread other than 38 | // the GUI thread, call the method on the correct thread 39 | if (progressBar1.InvokeRequired) 40 | { 41 | progressBar1.Invoke(new MethodInvoker(() => IncrementProgress())); 42 | return; 43 | } 44 | 45 | if (!_max_set) 46 | { 47 | throw new ProgressMaxUnsetException(); 48 | } 49 | 50 | if (_count < 0) 51 | { 52 | progressBar1.Value = 0; 53 | } 54 | else if (_count > progressBar1.Maximum) 55 | { 56 | progressBar1.Value = progressBar1.Maximum; 57 | } 58 | else 59 | { 60 | progressBar1.Value = (int)(_count); 61 | } 62 | _count++; 63 | } 64 | 65 | public int maxProgress() 66 | { 67 | if (!_max_set) 68 | { 69 | throw new ProgressMaxUnsetException(); 70 | } 71 | return progressBar1.Maximum; 72 | } 73 | 74 | public void setMax(int max_updates) 75 | { 76 | progressBar1.Maximum = max_updates; 77 | _max_set = true; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /CheckCellTests/ClassificationTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Classification = UserSimulation.Classification; 5 | using OptChar = Microsoft.FSharp.Core.FSharpOption; 6 | 7 | namespace CheckCellTests 8 | { 9 | [TestClass] 10 | public class ClassificationTests 11 | { 12 | [TestMethod] 13 | public void TestSerialize() 14 | { 15 | var classification = new Classification(); 16 | var s = System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()); 17 | var v = System.IO.Directory.GetParent(s.FullName).FullName; 18 | System.IO.Directory.CreateDirectory(v + "\\GeneratedFiles"); 19 | var full_path = v + "\\GeneratedFiles\\testfile_foo.bin"; 20 | classification.Serialize(full_path); 21 | 22 | var t = System.IO.File.OpenRead(full_path); 23 | t.Close(); 24 | } 25 | 26 | [TestMethod] 27 | public void TestDeserialize() 28 | { 29 | var classification = new Classification(); 30 | //set typo dictionary to explicit one 31 | Dictionary, int> typo_dict = new Dictionary, int>(); 32 | var key = new Tuple(OptChar.Some('t'), "y"); 33 | typo_dict.Add(key, 1); 34 | 35 | key = new Tuple(OptChar.Some('t'), "t"); 36 | typo_dict.Add(key, 0); 37 | 38 | key = new Tuple(OptChar.Some('T'), "TT"); 39 | typo_dict.Add(key, 1); 40 | 41 | key = new Tuple(OptChar.Some('e'), "e"); 42 | typo_dict.Add(key, 1); 43 | 44 | key = new Tuple(OptChar.Some('s'), "s"); 45 | typo_dict.Add(key, 1); 46 | classification.SetTypoDict(typo_dict); 47 | var s = System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()); 48 | var v = System.IO.Directory.GetParent(s.FullName).FullName; 49 | System.IO.Directory.CreateDirectory(v + "\\GeneratedFiles"); 50 | var full_path = v + "\\GeneratedFiles\\testfile.bin"; 51 | classification.Serialize(full_path); 52 | 53 | Classification c2 = Classification.Deserialize(full_path); 54 | var typo_dict_2 = c2.GetTypoDict(); 55 | Assert.AreEqual(typo_dict_2.Count, typo_dict.Count); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CheckCell/RibbonHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using DataDebugMethods; 6 | using Excel = Microsoft.Office.Interop.Excel; 7 | using OptString = Microsoft.FSharp.Core.FSharpOption; 8 | using OptTuple = Microsoft.FSharp.Core.FSharpOption>; 9 | 10 | namespace CheckCell 11 | { 12 | public class CellColor 13 | { 14 | private int _colorindex; 15 | private double _color; 16 | 17 | public CellColor(int colorindex, double color) 18 | { 19 | _colorindex = colorindex; 20 | _color = color; 21 | } 22 | 23 | public double Color 24 | { 25 | get { return _color; } 26 | } 27 | 28 | public int ColorIndex 29 | { 30 | get { return _colorindex; } 31 | } 32 | } 33 | 34 | static class RibbonHelper 35 | { 36 | private static int TRANSPARENT_COLOR_INDEX = -4142; //-4142 is the transparent default background 37 | 38 | public static OptTuple getExperimentInputs() 39 | { 40 | // ask the user for the classification data 41 | var ofd = new System.Windows.Forms.OpenFileDialog(); 42 | ofd.ShowHelp = true; 43 | ofd.FileName = "ClassificationData-2013-11-14.bin"; 44 | ofd.Title = "Please select a classification data input file."; 45 | if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) 46 | { 47 | return OptTuple.None; 48 | } 49 | var c = UserSimulation.Classification.Deserialize(ofd.FileName); 50 | 51 | // ask the user where the output data should go 52 | var cdd = new System.Windows.Forms.FolderBrowserDialog(); 53 | cdd.Description = "Please choose an output folder."; 54 | if (cdd.ShowDialog() != System.Windows.Forms.DialogResult.OK) 55 | { 56 | return OptTuple.None; 57 | } 58 | var foo = new Tuple(c, cdd.SelectedPath); 59 | return OptTuple.Some(foo); 60 | } 61 | 62 | public static Excel.Worksheet GetWorksheetByName(string name, Excel.Sheets sheets) 63 | { 64 | foreach (Excel.Worksheet ws in sheets) 65 | { 66 | if (ws.Name == name) 67 | { 68 | return ws; 69 | } 70 | } 71 | return null; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /CheckCellTests/ErrorClassifierTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using DataDebugMethods; 4 | using OptString = Microsoft.FSharp.Core.FSharpOption; 5 | using Classification = UserSimulation.Classification; 6 | 7 | namespace CheckCellTests 8 | { 9 | [TestClass] 10 | public class ErrorClassifierTests 11 | { 12 | //[TestMethod] 13 | //public void TestHasSignError() 14 | //{ 15 | // var c = new Classification(); 16 | 17 | // Assert.AreEqual(OptString.Some("-3748"), c.HasSignError("-3748", "3748")); 18 | // Assert.AreEqual(OptString.Some("+3748"), c.HasSignError("+3748", "3748")); 19 | // Assert.AreEqual(OptString.Some("3748"), c.HasSignError("3748", "-3748")); 20 | // Assert.AreEqual(OptString.Some("3748"), c.HasSignError("3748", "+3748")); 21 | // Assert.AreEqual(OptString.None, c.HasSignError("3748", "3748")); 22 | // Assert.AreEqual(OptString.None, c.HasSignError("3748", "33748")); 23 | // Assert.AreEqual(OptString.None, c.HasSignError("3748", "")); 24 | // Assert.AreEqual(OptString.None, c.HasSignError("-3748", "-g3748")); 25 | // Assert.AreEqual(OptString.None, c.HasSignError("+3748", "+3748")); 26 | //} 27 | 28 | //public void TestDecimalOmission() 29 | //{ 30 | // var c = new Classification(); 31 | 32 | // Assert.AreEqual(OptString.Some("1.2"), c.TestDecimalOmission("1.2","12")); 33 | // Assert.AreEqual(OptString.None, c.TestDecimalOmission("12", "123")); 34 | // Assert.AreEqual(OptString.None, c.TestDecimalOmission("12", "12")); 35 | // Assert.AreEqual(OptString.Some("1.25"), c.TestDecimalOmission("1.25", "12")); 36 | // Assert.AreEqual(OptString.Some("1.2"), c.TestDecimalOmission("1.2", "123")); 37 | // Assert.AreEqual(OptString.Some("12345.6"), c.TestDecimalOmission("12345.6", "12")); 38 | //} 39 | 40 | //public void TestDecimalMisplacement() 41 | //{ 42 | // var c = new Classification(); 43 | 44 | // Assert.AreEqual(OptString.Some("1.2"), c.TestMisplacedDecimal("1.2", "12.")); 45 | // Assert.AreEqual(OptString.None, c.TestMisplacedDecimal("12", "123")); 46 | // Assert.AreEqual(OptString.Some("1.23"), c.TestMisplacedDecimal("1.2", ".123")); 47 | // Assert.AreEqual(OptString.None, c.TestMisplacedDecimal("12", "1.23")); 48 | // Assert.AreEqual(OptString.Some("1.20"), c.TestMisplacedDecimal("1.2345", "120.")); 49 | //} 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /UserSimulation/PrepData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Excel = Microsoft.Office.Interop.Excel; 6 | using DataDebugMethods; 7 | using CellDict = System.Collections.Generic.Dictionary; 8 | using TreeScore = System.Collections.Generic.Dictionary; 9 | using ErrorDict = System.Collections.Generic.Dictionary; 10 | 11 | namespace UserSimulation 12 | { 13 | public struct PrepData 14 | { 15 | public DAG dag; 16 | public CellDict original_inputs; 17 | public CellDict correct_outputs; 18 | public AST.Range[] terminal_input_nodes; 19 | public AST.Address[] terminal_formula_nodes; 20 | } 21 | 22 | public static class Prep 23 | { 24 | public static PrepData PrepSimulation(Excel.Application app, Excel.Workbook wbh, ProgBar pb, bool ignore_parse_errors) 25 | { 26 | // build graph 27 | var dag = new DAG(wbh, app, ignore_parse_errors); 28 | if (dag.containsLoop()) 29 | { 30 | throw new DataDebugMethods.ContainsLoopException(); 31 | } 32 | pb.IncrementProgress(); 33 | 34 | // get terminal input and terminal formula nodes once 35 | var terminal_input_nodes = dag.terminalInputVectors(); 36 | var terminal_formula_nodes = dag.terminalFormulaNodes(true); ///the boolean indicates whether to use all outputs or not 37 | 38 | if (terminal_input_nodes.Length == 0) 39 | { 40 | throw new NoRangeInputs(); 41 | } 42 | 43 | if (terminal_formula_nodes.Length == 0) 44 | { 45 | throw new NoFormulas(); 46 | } 47 | 48 | // save original spreadsheet state 49 | CellDict original_inputs = UserSimulation.Utility.SaveInputs(dag); 50 | 51 | // force a recalculation before saving outputs, otherwise we may 52 | // erroneously conclude that the procedure did the wrong thing 53 | // based solely on Excel floating-point oddities 54 | UserSimulation.Utility.InjectValues(app, wbh, original_inputs); 55 | 56 | // save function outputs 57 | CellDict correct_outputs = UserSimulation.Utility.SaveOutputs(terminal_formula_nodes, dag); 58 | 59 | return new PrepData() 60 | { 61 | dag = dag, 62 | original_inputs = original_inputs, 63 | correct_outputs = correct_outputs, 64 | terminal_input_nodes = terminal_input_nodes, 65 | terminal_formula_nodes = terminal_formula_nodes 66 | }; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CheckCell/CellFixForm1.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CheckCell { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public partial class CellFixForm { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal CellFixForm() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CheckCell.CellFixForm", typeof(CellFixForm).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /LongestCommonSubsequence/LongestCommonSubsequence.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 2.0 8 | e3b87cad-521f-41ea-b3e8-ecd0d7d5074b 9 | Library 10 | LongestCommonSubsequence 11 | LongestCommonSubsequence 12 | v4.0 13 | LongestCommonSubsequence 14 | 15 | 4.3.0.0 16 | 17 | 18 | true 19 | full 20 | false 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | 3 25 | bin\Debug\LongestCommonSubsequence.XML 26 | 27 | 28 | pdbonly 29 | true 30 | true 31 | bin\Release\ 32 | TRACE 33 | 3 34 | bin\Release\LongestCommonSubsequence.XML 35 | 36 | 37 | 11 38 | 39 | 40 | 41 | 42 | $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets 43 | 44 | 45 | 46 | 47 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CheckCell 2 | ========= 3 | 4 | Testing and static analysis can help root out bugs in programs, but not in data. We introduce _data debugging_, an approach that combines program analysis and statistical analysis to _automatically_ find potential data errors. Since it is impossible to know a priori whether data are erroneous, data debugging instead locates data that has a disproportionate impact on the computation. Such data is either very important or wrong. Data debugging is especially useful in the context of data-intensive programming environments that intertwine data with programs in the form of queries or formulas. 5 | 6 | CheckCell is an implementation of data debugging for Excel spreadsheets. CheckCell highlights suspected errors in red, one cell at a time. After inspecting a cell, the user can correct the data or marked the cell as 'OK'. CheckCell is efficient; its algorithms are asymptotically optimal, and the current prototype runs in seconds for most spreadsheets. 7 | 8 | License 9 | ------- 10 | 11 | CheckCell is licensed under the GPLv2, Copyright (C) 2011-2015 The University of Massachusetts Amherst. 12 | 13 | Prerequisites 14 | -------------- 15 | 16 | You will need Microsoft Excel 2010 and Windows 7 or newer. CheckCell now supports Excel 2013! 17 | 18 | Installing CheckCell 19 | -------------------- 20 | Download the [CheckCell installer](https://github.com/plasma-umass/DataDebug/releases/latest). Double-click on the file `CheckCellInstaller.exe` to install. The installer should install all prerequisites for you (namely Microsoft .NET 4.0 and Visual Studio Tools for Office 2010). 21 | 22 | You will find CheckCell installed in Excel, under the "CheckCell" tab in the ribbon. 23 | 24 | Getting CheckCell Source 25 | ------------------------ 26 | CheckCell depends on an Excel parsing library called "Parcel", also available on GitHub. Parcel is a git submodule for CheckCell. This means that you should recursively clone the CheckCell repository if you plan to work with the source: 27 | 28 | ``` 29 | git clone --recursive https://github.com/plasma-umass/DataDebug.git 30 | ``` 31 | 32 | You will need Visual Studio 2013 in order to build the CheckCell plugin. 33 | 34 | Using CheckCell 35 | --------------- 36 | To use CheckCell, open the spreadsheet you would like to audit, and click CheckCell's "Analyze" button (look for the "CheckCell" tab in the ribbon.) CheckCell will perform its analysis, and if any potential errors are found, they will be highlighted one at a time in decreasing order of importance. For each highlighted cell, you will have to decide if it is actually an error. If so, click on the "Fix Error" button and enter the correct value in the box that comes up. Otherwise, click the "Mark as OK" button. After each correction, CheckCell will re-run its analysis using the corrected value. 37 | 38 | CheckCell's sensitivity level is adjustable. By default it is set to display the top 5% most unusual values, but you may change it by entering a different value in the box labeled "% Most Unusual to Show". Note that CheckCell may report that no values warrant special attention. 39 | 40 | Uninstalling CheckCell 41 | ---------------------- 42 | CheckCell can be uninstalled in the Windows Add/Remove Programs dialog. 43 | 44 | Read the Paper 45 | -------------- 46 | ["CheckCell: Data-Debugging for Spreadsheets."](http://dl.acm.org/citation.cfm?id=2660207) D. Barowy, D. Gochev, E. Berger. OOPSLA 2014, Portland, OR. 47 | -------------------------------------------------------------------------------- /MTurkParser/MTurkParser.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 2.0 8 | 5c2def3e-a805-49a2-b88a-8eb59f6974dc 9 | Library 10 | MTurkParser 11 | MTurkParser 12 | v4.0 13 | MTurkParser 14 | 15 | 4.3.0.0 16 | 17 | 18 | true 19 | full 20 | false 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | 3 25 | bin\Debug\MTurkParser.XML 26 | 27 | 28 | pdbonly 29 | true 30 | true 31 | bin\Release\ 32 | TRACE 33 | 3 34 | bin\Release\MTurkParser.XML 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | ExcelParser 49 | {6de2a2b9-c029-4bdb-8992-d16276471d9f} 50 | True 51 | 52 | 53 | 54 | 11 55 | 56 | 57 | 58 | 59 | $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets 60 | 61 | 62 | 63 | 64 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets 65 | 66 | 67 | 68 | 69 | 76 | -------------------------------------------------------------------------------- /CheckCell/CellFixForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CheckCell 2 | { 3 | public partial class CellFixForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.FixText = new System.Windows.Forms.TextBox(); 32 | this.label1 = new System.Windows.Forms.Label(); 33 | this.AcceptFix = new System.Windows.Forms.Button(); 34 | this.CancelFix = new System.Windows.Forms.Button(); 35 | this.SuspendLayout(); 36 | // 37 | // FixText 38 | // 39 | this.FixText.Location = new System.Drawing.Point(12, 38); 40 | this.FixText.Name = "FixText"; 41 | this.FixText.Size = new System.Drawing.Size(348, 20); 42 | this.FixText.TabIndex = 0; 43 | // 44 | // label1 45 | // 46 | this.label1.AutoSize = true; 47 | this.label1.Location = new System.Drawing.Point(9, 9); 48 | this.label1.Name = "label1"; 49 | this.label1.Size = new System.Drawing.Size(130, 13); 50 | this.label1.TabIndex = 1; 51 | this.label1.Text = "Enter the corrected value:"; 52 | // 53 | // AcceptFix 54 | // 55 | this.AcceptFix.Location = new System.Drawing.Point(285, 83); 56 | this.AcceptFix.Name = "AcceptFix"; 57 | this.AcceptFix.Size = new System.Drawing.Size(75, 23); 58 | this.AcceptFix.TabIndex = 2; 59 | this.AcceptFix.Text = "Fix"; 60 | this.AcceptFix.UseVisualStyleBackColor = true; 61 | this.AcceptFix.Click += new System.EventHandler(this.AcceptFix_Click); 62 | // 63 | // CancelFix 64 | // 65 | this.CancelFix.Location = new System.Drawing.Point(204, 83); 66 | this.CancelFix.Name = "CancelFix"; 67 | this.CancelFix.Size = new System.Drawing.Size(75, 23); 68 | this.CancelFix.TabIndex = 3; 69 | this.CancelFix.Text = "Cancel"; 70 | this.CancelFix.UseVisualStyleBackColor = true; 71 | this.CancelFix.Click += new System.EventHandler(this.CancelFix_Click); 72 | // 73 | // CellFixForm 74 | // 75 | this.AcceptButton = this.AcceptFix; 76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 78 | this.ClientSize = new System.Drawing.Size(372, 125); 79 | this.Controls.Add(this.CancelFix); 80 | this.Controls.Add(this.AcceptFix); 81 | this.Controls.Add(this.label1); 82 | this.Controls.Add(this.FixText); 83 | this.Name = "CellFixForm"; 84 | this.Text = "CellFixForm"; 85 | this.ResumeLayout(false); 86 | this.PerformLayout(); 87 | 88 | } 89 | 90 | #endregion 91 | 92 | private System.Windows.Forms.TextBox FixText; 93 | private System.Windows.Forms.Label label1; 94 | private System.Windows.Forms.Button AcceptFix; 95 | private System.Windows.Forms.Button CancelFix; 96 | } 97 | } -------------------------------------------------------------------------------- /CheckCellTests/ErrorGeneratorTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using System.Collections.Generic; 4 | using ErrorGenerator = UserSimulation.ErrorGenerator; 5 | using Classification = UserSimulation.Classification; 6 | using Sign = LongestCommonSubsequence.Sign; 7 | using OptChar = Microsoft.FSharp.Core.FSharpOption; 8 | 9 | 10 | namespace CheckCellTests 11 | { 12 | [TestClass] 13 | public class ErrorGeneratorTests 14 | { 15 | [TestMethod] 16 | public void TestTypoGenerator() 17 | { 18 | var eg = new ErrorGenerator(); 19 | var classification = new Classification(); 20 | 21 | //set typo dictionary to explicit one 22 | Dictionary, int> typo_dict = new Dictionary, int>(); 23 | 24 | var key = new Tuple(OptChar.Some('t'), "y"); 25 | typo_dict.Add(key, 1); 26 | 27 | key = new Tuple(OptChar.Some('t'), "t"); 28 | typo_dict.Add(key, 0); 29 | 30 | key = new Tuple(OptChar.Some('T'), "TT"); 31 | typo_dict.Add(key, 1); 32 | 33 | key = new Tuple(OptChar.Some('e'), "e"); 34 | typo_dict.Add(key, 1); 35 | 36 | key = new Tuple(OptChar.Some('s'), "s"); 37 | typo_dict.Add(key, 1); 38 | 39 | //The transpositions dictionary is empty so no transpositions should occur 40 | classification.SetTypoDict(typo_dict); 41 | var s = eg.GenerateErrorString("Testing", classification); 42 | Assert.AreEqual("TTesying", s); 43 | } 44 | 45 | [TestMethod] 46 | public void TestTranspositionGenerator() 47 | { 48 | var eg = new ErrorGenerator(); 49 | var classification = new Classification(); 50 | 51 | //set typo dictionary to explicit one -- it's empty so no typos are possible 52 | Dictionary, int> typo_dict = new Dictionary, int>(); 53 | 54 | //Set the transpositions dictionary to explicit one 55 | Dictionary transpositions_dict = new Dictionary(); 56 | transpositions_dict.Add(3, 10); 57 | //transpositions_dict.Add(0, 1); 58 | 59 | classification.SetTranspositionDict(transpositions_dict); 60 | classification.SetTypoDict(typo_dict); 61 | string s = eg.GenerateErrorString("abcd", classification); 62 | Assert.AreEqual("dbca", s); 63 | 64 | //NOTE: Need a new ErrorGenerator for each test because the distribution tables are associated with it 65 | var eg2 = new ErrorGenerator(); 66 | //Set the transpositions dictionary to explicit one 67 | var transpositions_dict2 = new Dictionary(); 68 | transpositions_dict2.Add(1, 10); 69 | //transpositions_dict2.Add(0, 1); 70 | Classification classification2 = new Classification(); 71 | classification2.SetTranspositionDict(transpositions_dict2); 72 | classification2.SetTypoDict(typo_dict); 73 | string s2 = eg2.GenerateErrorString("abcd", classification2); 74 | Assert.AreEqual("bcda", s2); 75 | 76 | var eg3 = new ErrorGenerator(); 77 | //Set the transpositions dictionary to explicit one 78 | var transpositions_dict3 = new Dictionary(); 79 | transpositions_dict3.Add(10, 10); 80 | transpositions_dict3.Add(-10, 10); 81 | transpositions_dict3.Add(0, 1); 82 | Classification classification3 = new Classification(); 83 | classification3.SetTranspositionDict(transpositions_dict3); 84 | classification3.SetTypoDict(typo_dict); 85 | string s3 = eg3.GenerateErrorString("abcd", classification3); 86 | Assert.AreEqual("abcd", s3); 87 | // TODO: this test originally checked that a certain class of error 88 | // was impossible; what kind of error? 89 | //Assert.AreEqual(0, result3.Item2.Count); 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /UserSimulation/LogEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace UserSimulation 7 | { 8 | [Serializable] 9 | public class LogEntry 10 | { 11 | readonly AnalysisType _procedure; 12 | readonly string _filename; 13 | readonly AST.Address _address; 14 | readonly string _original_value; 15 | readonly string _erroneous_value; 16 | readonly double _output_error_magnitude; 17 | readonly double _num_input_error_magnitude; 18 | readonly double _str_input_error_magnitude; 19 | readonly bool _was_flagged; 20 | readonly bool _was_error; 21 | readonly double _significance; 22 | readonly double _threshold; 23 | public LogEntry(AnalysisType procedure, 24 | string filename, 25 | AST.Address address, 26 | string original_value, 27 | string erroneous_value, 28 | double output_error_magnitude, 29 | double num_input_error_magnitude, 30 | double str_input_error_magnitude, 31 | bool was_flagged, 32 | bool was_error, 33 | double significance, 34 | double threshold) 35 | { 36 | _filename = filename; 37 | _procedure = procedure; 38 | _address = address; 39 | _original_value = original_value; 40 | _erroneous_value = erroneous_value; 41 | _output_error_magnitude = output_error_magnitude; 42 | _num_input_error_magnitude = num_input_error_magnitude; 43 | _str_input_error_magnitude = str_input_error_magnitude; 44 | _was_flagged = was_flagged; 45 | _was_error = was_error; 46 | _significance = significance; 47 | _threshold = threshold; 48 | } 49 | 50 | public static String Headers() 51 | { 52 | return "filename, " + // 0 53 | "procedure, " + // 1 54 | "significance, " + // 2 55 | "threshold, " + // 3 56 | "address, " + // 4 57 | "original_value, " + // 5 58 | "erroneous_value," + // 6 59 | "total_relative_error, " + // 7 60 | "num_input_err_mag, " + // 8 61 | "str_input_err_mag, " + // 9 62 | "was_flagged, " + // 10 63 | "was_error" + // 11 64 | Environment.NewLine; // 12 65 | } 66 | 67 | public void WriteLog(String logfile) 68 | { 69 | if (!System.IO.File.Exists(logfile)) 70 | { 71 | System.IO.File.AppendAllText(logfile, Headers()); 72 | } 73 | System.IO.File.AppendAllText(logfile, String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}{12}", 74 | _filename, // 0 75 | _procedure, // 1 76 | _significance, // 2 77 | _threshold, // 3 78 | _address.A1Local(), // 4 79 | _original_value, // 5 80 | _erroneous_value, // 6 81 | _output_error_magnitude,// 7 82 | _num_input_error_magnitude, // 8 83 | _str_input_error_magnitude, // 9 84 | _was_flagged, // 10 85 | _was_error, // 11 86 | Environment.NewLine // 12 87 | )); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /DataDebugMethods/BiDictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DataDebugMethods 7 | { 8 | public class BiDictionary 9 | { 10 | Dictionary _dict1 = new Dictionary(); 11 | Dictionary _dict2 = new Dictionary(); 12 | 13 | public void Add(T v1, U v2) 14 | { 15 | _dict1.Add(v1, v2); 16 | _dict2.Add(v2, v1); 17 | } 18 | 19 | public bool ContainsKey(T key) 20 | { 21 | return _dict1.ContainsKey(key); 22 | } 23 | 24 | public bool ContainsKey(U key) 25 | { 26 | return _dict2.ContainsKey(key); 27 | } 28 | 29 | public bool Remove(T key) 30 | { 31 | return _dict2.Remove(_dict1[key]) && 32 | _dict1.Remove(key); 33 | } 34 | 35 | public bool Remove(U key) 36 | { 37 | return _dict1.Remove(_dict2[key]) && 38 | _dict2.Remove(key); 39 | } 40 | 41 | public bool TryGetValue(T key, out U value) 42 | { 43 | return _dict1.TryGetValue(key, out value); 44 | } 45 | 46 | public bool TryGetValue(U key, out T value) 47 | { 48 | return _dict2.TryGetValue(key, out value); 49 | } 50 | 51 | public U this[T key] 52 | { 53 | get 54 | { 55 | return _dict1[key]; 56 | } 57 | set 58 | { 59 | U oldval = _dict1[key]; 60 | _dict1[key] = value; 61 | _dict2.Remove(oldval); 62 | _dict2.Add(value, key); 63 | } 64 | } 65 | 66 | public T this[U key] 67 | { 68 | get 69 | { 70 | return _dict2[key]; 71 | } 72 | set 73 | { 74 | T oldval = _dict2[key]; 75 | _dict2[key] = value; 76 | _dict1.Remove(oldval); 77 | _dict1.Add(value, key); 78 | } 79 | } 80 | 81 | public void Add(System.Collections.Generic.KeyValuePair item) 82 | { 83 | _dict1.Add(item.Key, item.Value); 84 | _dict2.Add(item.Value, item.Key); 85 | } 86 | 87 | public void Add(System.Collections.Generic.KeyValuePair item) 88 | { 89 | _dict2.Add(item.Key, item.Value); 90 | _dict1.Add(item.Value, item.Key); 91 | } 92 | 93 | public void Clear() 94 | { 95 | _dict1.Clear(); 96 | _dict2.Clear(); 97 | } 98 | 99 | public bool Contains(System.Collections.Generic.KeyValuePair item) 100 | { 101 | var vkp = new KeyValuePair(item.Value, item.Key); 102 | return _dict1.Contains(item) && _dict2.Contains(vkp); 103 | } 104 | 105 | public int Count 106 | { 107 | get { return _dict1.Count; } 108 | } 109 | 110 | public bool IsReadOnly 111 | { 112 | get { return false; } 113 | } 114 | 115 | public bool Remove(System.Collections.Generic.KeyValuePair item) 116 | { 117 | return _dict1.Remove(item.Key) && _dict2.Remove(item.Value); 118 | } 119 | 120 | public bool Remove(System.Collections.Generic.KeyValuePair item) 121 | { 122 | return _dict1.Remove(item.Value) && _dict2.Remove(item.Key); 123 | } 124 | 125 | public IEnumerable> AsTUEnum() 126 | { 127 | return _dict1; 128 | } 129 | 130 | public IEnumerable> AsUTEnum() 131 | { 132 | return _dict2; 133 | } 134 | 135 | public IEnumerable KeysT 136 | { 137 | get { return _dict1.Keys; } 138 | } 139 | 140 | public IEnumerable KeysU 141 | { 142 | get { return _dict2.Keys; } 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /DataDebugMethods/DataDebugMethods.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A} 9 | Library 10 | Properties 11 | DataDebugMethods 12 | DataDebugMethods 13 | v4.0 14 | 512 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | 38 | {e3b87cad-521f-41ea-b3e8-ecd0d7d5074b} 39 | LongestCommonSubsequence 40 | 41 | 42 | {6de2a2b9-c029-4bdb-8992-d16276471d9f} 43 | ExcelParser 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | Form 57 | 58 | 59 | ProgBar.cs 60 | 61 | 62 | 63 | 64 | 65 | 66 | ProgBar.cs 67 | 68 | 69 | 70 | 71 | 72 | 73 | True 74 | 75 | 76 | True 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 92 | -------------------------------------------------------------------------------- /UserSimulation/UserSimulation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236} 8 | Library 9 | Properties 10 | UserSimulation 11 | UserSimulation 12 | v4.0 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | {64dbf1b4-b0b7-4490-8c7c-2deea22cb25a} 36 | DataDebugMethods 37 | 38 | 39 | {e3b87cad-521f-41ea-b3e8-ecd0d7d5074b} 40 | LongestCommonSubsequence 41 | 42 | 43 | {5c2def3e-a805-49a2-b88a-8eb59f6974dc} 44 | MTurkParser 45 | 46 | 47 | {6de2a2b9-c029-4bdb-8992-d16276471d9f} 48 | ExcelParser 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | True 74 | 75 | 76 | 77 | 78 | 79 | 80 | 87 | -------------------------------------------------------------------------------- /CheckCellTests/CheckCellTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223} 10 | Library 11 | Properties 12 | CheckCellTests 13 | CheckCellTests 14 | v4.0 15 | 512 16 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | {64dbf1b4-b0b7-4490-8c7c-2deea22cb25a} 38 | DataDebugMethods 39 | 40 | 41 | {e3b87cad-521f-41ea-b3e8-ecd0d7d5074b} 42 | LongestCommonSubsequence 43 | 44 | 45 | {6de2a2b9-c029-4bdb-8992-d16276471d9f} 46 | ExcelParser 47 | 48 | 49 | {cb1aade6-ad72-4ae5-aaa8-351cebc61236} 50 | UserSimulation 51 | 52 | 53 | 54 | 55 | False 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | True 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 88 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DataDebug.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataDebug.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap analyze_small { 67 | get { 68 | object obj = ResourceManager.GetObject("analyze_small", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap clear_small { 77 | get { 78 | object obj = ResourceManager.GetObject("clear_small", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap correct_small { 87 | get { 88 | object obj = ResourceManager.GetObject("correct_small", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap mark_as_ok_small { 97 | get { 98 | object obj = ResourceManager.GetObject("mark_as_ok_small", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /CheckCell/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CheckCell.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CheckCell.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap analyze_small { 67 | get { 68 | object obj = ResourceManager.GetObject("analyze_small", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap clear_small { 77 | get { 78 | object obj = ResourceManager.GetObject("clear_small", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap correct_small { 87 | get { 88 | object obj = ResourceManager.GetObject("correct_small", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap mark_as_ok_small { 97 | get { 98 | object obj = ResourceManager.GetObject("mark_as_ok_small", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /DataDebugMethods/InputSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Diagnostics; 6 | using System.Numerics; 7 | 8 | namespace DataDebugMethods 9 | { 10 | public class InputSample 11 | { 12 | private int _i = 0; // internal length counter for Add 13 | private object[,] _input_array; // this is stored in Excel ONE-BASED format, DANGER!!! 14 | private int[] _includes; // a counter of values included by this sample 15 | private BigInteger _excludes; // a bitvector representing the excluded values 16 | private int _rows; 17 | private int _cols; 18 | 19 | public InputSample(int rows, int cols) 20 | { 21 | _rows = rows; 22 | _cols = cols; 23 | } 24 | 25 | public void Add(string datum) { 26 | if (_i == 0) 27 | { 28 | // initialize _input_array 29 | Int32[] lowerBounds = { 1, 1 }; 30 | Int32[] lengths = { _rows, _cols }; 31 | _input_array = (object[,])Array.CreateInstance(typeof(object), lengths, lowerBounds); 32 | } 33 | var pair = OneDToTwoD(_i); 34 | var col_idx = pair.Item1; 35 | var row_idx = pair.Item2; 36 | _input_array[col_idx, row_idx] = datum; 37 | _i++; 38 | } 39 | 40 | public void AddArray(object[,] data) 41 | { 42 | if (_i != 0) 43 | { 44 | throw new Exception("You must use EITHER Add or AddArray, but not both."); 45 | } 46 | _input_array = data; 47 | } 48 | 49 | // this also adds a one to each index 50 | // Excel is also row-major 51 | private Tuple OneDToTwoD(int idx) { 52 | var row_idx = (idx % _cols) + 1; 53 | var col_idx = (idx / _cols) + 1; 54 | return new Tuple(col_idx, row_idx); 55 | } 56 | 57 | public string GetInput(int num) 58 | { 59 | // we assign a numbering scheme from 60 | // topleft to bottom right, starting at 0 61 | if (num >= _input_array.Length) 62 | { 63 | throw new Exception("num >= _input_array.Length"); 64 | } 65 | var pair = OneDToTwoD(num); 66 | var col_idx = pair.Item1; 67 | var row_idx = pair.Item2; 68 | return System.Convert.ToString(_input_array[col_idx, row_idx]); 69 | } 70 | 71 | public int Length() 72 | { 73 | return _input_array.Length; 74 | } 75 | 76 | public int Rows() 77 | { 78 | return _rows; 79 | } 80 | 81 | public int Columns() 82 | { 83 | return _cols; 84 | } 85 | 86 | public BigInteger GetExcludes() 87 | { 88 | return _excludes; 89 | } 90 | 91 | public int[] GetIncludes() 92 | { 93 | return _includes; 94 | } 95 | 96 | // indicate which values are included in a resample 97 | public void SetIncludes(int[] includes) 98 | { 99 | _includes = includes; 100 | for (int i = 0; i < includes.Length; i++) 101 | { 102 | if (includes[i] == 0) 103 | { 104 | var e = BigInteger.One << i; // left shift by i 105 | _excludes = _excludes | e; // bitwise OR with exclude bitvector 106 | } 107 | } 108 | } 109 | 110 | public override int GetHashCode() 111 | { 112 | // note that in C#, shift never causes overflow 113 | int sum = 0; 114 | for (int i = 0; i < _includes.Length; i++) 115 | { 116 | sum += _includes[i] << i; 117 | } 118 | return sum; 119 | } 120 | 121 | public override bool Equals(object obj) 122 | { 123 | InputSample other = (InputSample)obj; 124 | return _includes.SequenceEqual(other.GetIncludes()); 125 | } 126 | 127 | public override string ToString() 128 | { 129 | return String.Join(",", _input_array); 130 | } 131 | 132 | public object[,] GetInputArray() 133 | { 134 | //// create one-based 2D multi-array 135 | //var output = Array.CreateInstance(typeof(object), new int[2] { _input_array.GetLength(0), _input_array.GetLength(1) }, new int[2] { 1, 1}); 136 | 137 | return _input_array; 138 | } 139 | 140 | public string Text() 141 | { 142 | string text = ""; 143 | foreach (object obj in _input_array) 144 | { 145 | text += obj + ","; 146 | } 147 | text.Remove(text.LastIndexOf(',') - 1); 148 | return text; 149 | } 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /DataDebugMethods/ProgBar.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CheckCell/CellFixForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /MTurkParser/Data.fs: -------------------------------------------------------------------------------- 1 | namespace MTurkParser 2 | 3 | open System 4 | open System.Collections.Generic 5 | 6 | type App = Microsoft.Office.Interop.Excel.Application 7 | type TextFieldParser = Microsoft.VisualBasic.FileIO.TextFieldParser 8 | type FieldType = Microsoft.VisualBasic.FileIO.FieldType 9 | 10 | // some constants 11 | type Offsets = 12 | static member HITDEF_WIDTH = 7 13 | // MTurk prepends 27 fields to all HITs. 14 | static member OFFSET_WORKER_ID = 15 15 | // Then come the following: 16 | static member OFFSET_STATE_ID = 27 17 | // + (n * HITDEF_WIDTH) columns, where n = inputs_per_hit 18 | // the HITDEF_WIDTH columns describe the following: 19 | // path, workbook, worksheet, row, column, original string, image url 20 | static member OFFSET_PATH = 0 21 | static member OFFSET_WB = 1 22 | static member OFFSET_WS = 2 23 | static member OFFSET_ROW = 3 24 | static member OFFSET_COL = 4 25 | static member OFFSET_ORIG = 5 26 | static member OFFSET_URL = 6 27 | static member OFFSET_HITDEFS = 28 28 | // + n answers 29 | static member OFFSET_ANSWERS inputs_per_hit = 28 + (inputs_per_hit * Offsets.HITDEF_WIDTH) 30 | // last two columns are for "Approve" and "Reject" 31 | 32 | // all processed data goes into one of these 33 | type Data() = 34 | // address -> (original value, retyped value) 35 | let input_pairs = new Dictionary() 36 | // worker_id -> address list 37 | let worker_ids = new Dictionary() 38 | // this data structure is for sanity-check purposes 39 | let addresses = new HashSet() 40 | member self.LearnFromCSV(csvdata: string[][]) = 41 | // get width 42 | let inputs_per_hit = Data.CalculateNumInputs(csvdata) 43 | 44 | // each row 45 | Array.iteri (fun i row -> 46 | // create worker ID key in dictionary if it doesn't alreay exist 47 | let worker_id = csvdata.[i].[Offsets.OFFSET_WORKER_ID] 48 | if not (worker_ids.ContainsKey(worker_id)) then 49 | worker_ids.Add(worker_id, []) 50 | 51 | // each input 52 | Array.iter (fun j -> 53 | let path = csvdata.[i].[Offsets.OFFSET_HITDEFS + j * Offsets.HITDEF_WIDTH + Offsets.OFFSET_PATH] 54 | let workbook = csvdata.[i].[Offsets.OFFSET_HITDEFS + j * Offsets.HITDEF_WIDTH + Offsets.OFFSET_WB] 55 | let worksheet = csvdata.[i].[Offsets.OFFSET_HITDEFS + j * Offsets.HITDEF_WIDTH + Offsets.OFFSET_WS] 56 | let addr_r = Int32.Parse(csvdata.[i].[Offsets.OFFSET_HITDEFS + j * Offsets.HITDEF_WIDTH + Offsets.OFFSET_ROW]) 57 | let addr_c = Int32.Parse(csvdata.[i].[Offsets.OFFSET_HITDEFS + j * Offsets.HITDEF_WIDTH + Offsets.OFFSET_COL]) 58 | let image_url = csvdata.[i].[Offsets.OFFSET_HITDEFS + j * Offsets.HITDEF_WIDTH + Offsets.OFFSET_URL] 59 | let original_string = csvdata.[i].[Offsets.OFFSET_HITDEFS + j * Offsets.HITDEF_WIDTH + Offsets.OFFSET_ORIG] 60 | let retyped_string = csvdata.[i].[Offsets.OFFSET_ANSWERS(inputs_per_hit) + j] 61 | 62 | // get address object 63 | let addr = AST.Address.FromR1C1(addr_r, addr_c, worksheet, workbook, path) 64 | 65 | // add address to address hashset 66 | addresses.Add(addr) |> ignore 67 | 68 | // add address to worker dict 69 | worker_ids.[worker_id] <- addr :: worker_ids.[worker_id] 70 | 71 | // add input pairs 72 | input_pairs.Add(addr, (original_string, retyped_string)) 73 | ) [|0..inputs_per_hit-1|] 74 | ) csvdata 75 | member self.OverallAccuracy = 76 | let numsame = Seq.fold (fun acc (pair: KeyValuePair) -> 77 | acc + if fst pair.Value = snd pair.Value then 1 else 0 78 | ) 0 input_pairs 79 | System.Convert.ToDouble(numsame) / System.Convert.ToDouble(input_pairs.Count) 80 | member self.NumInputs = input_pairs.Count 81 | member self.NumWorkers = worker_ids.Count 82 | member self.MaxWorker = worker_ids.[self.MaxWorkerID].Length 83 | member self.MaxWorkerID : string = 84 | // get (worker_id, count) 85 | let w_counts = Seq.map (fun (pair: KeyValuePair) -> pair.Key, pair.Value.Length) worker_ids 86 | let max_w_pair = w_counts |> Seq.sortBy (fun (worker_id: string, count: int) -> -count) |> Seq.head 87 | fst max_w_pair 88 | member self.AssignmentsPerWorker worker_id = worker_ids.[worker_id].Length 89 | member self.WorkerAccuracy worker_id = 90 | let addrs = worker_ids.[worker_id] 91 | let numcorrect = (List.filter (fun addr -> fst input_pairs.[addr] = snd input_pairs.[addr]) addrs).Length 92 | System.Convert.ToDouble(numcorrect) / System.Convert.ToDouble(addrs.Length) 93 | member self.WorkerAssignments worker_id = worker_ids.[worker_id].Length 94 | // sorted by the most accurate worker 95 | member self.WorkerIDsSortedByAccuracy = 96 | Seq.sortBy (fun (pair: KeyValuePair) -> -self.WorkerAccuracy pair.Key) worker_ids |> 97 | Seq.map (fun (pair: KeyValuePair) -> pair.Key) 98 | member self.StringPairs = Seq.map (fun (pair: KeyValuePair) -> pair.Value) input_pairs 99 | static member private CalculateNumInputs(csvdata: string[][]) : int = 100 | let total_width = csvdata.[0].Length 101 | let payload_cols = total_width - Offsets.OFFSET_HITDEFS 102 | payload_cols / (Offsets.HITDEF_WIDTH + 1) // the +1 is to include the input's answer column 103 | // VisualBasic.NET has a handy-dandy CSV parser 104 | static member ParseCSV(path: string) = 105 | let parser = new TextFieldParser(path) 106 | parser.TextFieldType <- FieldType.Delimited 107 | parser.SetDelimiters(",") 108 | let mutable rows = [] 109 | while not (parser.EndOfData) do 110 | rows <- parser.ReadFields() :: rows 111 | parser.Close() 112 | // convert to array 113 | let outarray = List.rev rows |> List.toArray 114 | // exclude the first element 115 | outarray.[1..outarray.Length-1] -------------------------------------------------------------------------------- /CheckCell/AboutBox.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CheckCell 2 | { 3 | partial class AboutBox 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox)); 32 | this.label1 = new System.Windows.Forms.Label(); 33 | this.label2 = new System.Windows.Forms.Label(); 34 | this.label3 = new System.Windows.Forms.Label(); 35 | this.label4 = new System.Windows.Forms.Label(); 36 | this.label5 = new System.Windows.Forms.Label(); 37 | this.linkLabel1 = new System.Windows.Forms.LinkLabel(); 38 | this.OK = new System.Windows.Forms.Button(); 39 | this.label6 = new System.Windows.Forms.Label(); 40 | this.SuspendLayout(); 41 | // 42 | // label1 43 | // 44 | this.label1.AutoSize = true; 45 | this.label1.Location = new System.Drawing.Point(29, 12); 46 | this.label1.Name = "label1"; 47 | this.label1.Size = new System.Drawing.Size(150, 13); 48 | this.label1.TabIndex = 0; 49 | this.label1.Text = "CheckCell 1.0.5 (Dec 8, 2014)"; 50 | // 51 | // label2 52 | // 53 | this.label2.AutoSize = true; 54 | this.label2.Location = new System.Drawing.Point(29, 86); 55 | this.label2.Name = "label2"; 56 | this.label2.Size = new System.Drawing.Size(180, 13); 57 | this.label2.TabIndex = 1; 58 | this.label2.Text = "University of Massachusetts Amherst"; 59 | // 60 | // label3 61 | // 62 | this.label3.AutoSize = true; 63 | this.label3.Location = new System.Drawing.Point(29, 41); 64 | this.label3.Name = "label3"; 65 | this.label3.Size = new System.Drawing.Size(244, 13); 66 | this.label3.TabIndex = 2; 67 | this.label3.Text = "Daniel Barowy, Dimitar Gochev, and Emery Berger"; 68 | // 69 | // label4 70 | // 71 | this.label4.AutoSize = true; 72 | this.label4.Location = new System.Drawing.Point(29, 57); 73 | this.label4.Name = "label4"; 74 | this.label4.Size = new System.Drawing.Size(107, 13); 75 | this.label4.TabIndex = 3; 76 | this.label4.Text = "©2014 PLASMA Lab"; 77 | // 78 | // label5 79 | // 80 | this.label5.AutoSize = true; 81 | this.label5.Location = new System.Drawing.Point(29, 71); 82 | this.label5.Name = "label5"; 83 | this.label5.Size = new System.Drawing.Size(142, 13); 84 | this.label5.TabIndex = 4; 85 | this.label5.Text = "School of Computer Science"; 86 | // 87 | // linkLabel1 88 | // 89 | this.linkLabel1.AutoSize = true; 90 | this.linkLabel1.Location = new System.Drawing.Point(87, 111); 91 | this.linkLabel1.Name = "linkLabel1"; 92 | this.linkLabel1.Size = new System.Drawing.Size(102, 13); 93 | this.linkLabel1.TabIndex = 5; 94 | this.linkLabel1.TabStop = true; 95 | this.linkLabel1.Text = "http://checkcell.org"; 96 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); 97 | // 98 | // OK 99 | // 100 | this.OK.Location = new System.Drawing.Point(114, 305); 101 | this.OK.Name = "OK"; 102 | this.OK.Size = new System.Drawing.Size(75, 23); 103 | this.OK.TabIndex = 6; 104 | this.OK.Text = "OK"; 105 | this.OK.UseVisualStyleBackColor = true; 106 | this.OK.Click += new System.EventHandler(this.OK_Click); 107 | // 108 | // label6 109 | // 110 | this.label6.AutoSize = true; 111 | this.label6.Location = new System.Drawing.Point(22, 140); 112 | this.label6.MaximumSize = new System.Drawing.Size(260, 0); 113 | this.label6.Name = "label6"; 114 | this.label6.Size = new System.Drawing.Size(258, 156); 115 | this.label6.TabIndex = 7; 116 | this.label6.Text = resources.GetString("label6.Text"); 117 | // 118 | // AboutBox 119 | // 120 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 121 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 122 | this.ClientSize = new System.Drawing.Size(292, 340); 123 | this.Controls.Add(this.label6); 124 | this.Controls.Add(this.OK); 125 | this.Controls.Add(this.linkLabel1); 126 | this.Controls.Add(this.label5); 127 | this.Controls.Add(this.label4); 128 | this.Controls.Add(this.label3); 129 | this.Controls.Add(this.label2); 130 | this.Controls.Add(this.label1); 131 | this.Name = "AboutBox"; 132 | this.Text = "About CheckCell"; 133 | this.ResumeLayout(false); 134 | this.PerformLayout(); 135 | 136 | } 137 | 138 | #endregion 139 | 140 | private System.Windows.Forms.Label label1; 141 | private System.Windows.Forms.Label label2; 142 | private System.Windows.Forms.Label label3; 143 | private System.Windows.Forms.Label label4; 144 | private System.Windows.Forms.Label label5; 145 | private System.Windows.Forms.LinkLabel linkLabel1; 146 | private System.Windows.Forms.Button OK; 147 | private System.Windows.Forms.Label label6; 148 | } 149 | } -------------------------------------------------------------------------------- /CheckCell/AboutBox.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For a copy of the GNU General Public License, see http://www.gnu.org/licenses/. 122 | 123 | -------------------------------------------------------------------------------- /packages/FParsec.1.0.1/lib/net40-client/FParsecCS.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FParsecCS 5 | 6 | 7 | 8 | An opaque representation of a CharStream index. 9 | 10 | 11 | Returns -1 if the IndexToken was zero-initialized. 12 | 13 | 14 | Provides read‐access to a sequence of UTF‐16 chars. 15 | 16 | 17 | The current index in the string, or Int32.MinValue if the end of the stream has been reached. 18 | 19 | 20 | Index of the first char in the string belonging to the stream. Is always non-negative. 21 | 22 | 23 | 1 + index of the last char in the string belonging to the stream. Equals IndexBegin if the stream is empty. 24 | 25 | 26 | Any CharStream method or property setter increments this value when it changes the CharStream state. 27 | Backtracking to an old state also restores the old value of the StateTag. 28 | 29 | 30 | IndexOfFirstChar - IndexBegin 31 | 32 | 33 | The low trust version of the CharStream class implements the IDisposable 34 | interface only for API compatibility. The Dispose method does not need to be called on 35 | low trust CharStream instances, because the instances hold no resources that need to be disposed. 36 | 37 | 38 | Indicates whether the Iterator points to the beginning of the CharStream. 39 | If the CharStream is empty, this property is always true. 40 | 41 | 42 | Indicates whether the Iterator points to the end of the CharStream, 43 | i.e. whether it points to one char beyond the last char in the CharStream. 44 | 45 | 46 | The UTF‐16 column number of the next char, i.e. Index ‐ LineBegin + 1. 47 | 48 | 49 | Provides read‐access to a sequence of UTF‐16 chars. 50 | 51 | 52 | For reference types it's faster to call Instance.Equals directly 53 | (due to limitations of the inliner of the .NET JIT.) 54 | 55 | 56 | Forwards all work to F#'s GenericEqualityERComparer. 57 | 58 | 59 | Returns the normalized string, or null in case an invalid identifier 60 | character is found. If an invalid character is found, the string index of the 61 | invalid character is assigned to the out parameter, otherwise -1. 62 | 63 | 64 | The length of LhsOps and RhsOps. Must be a power of 2. 65 | 66 | 67 | ParsePrefixOp returns this value to signal that it backtracked and we should try to parse a term. 68 | 69 | 70 | Can not be readonly because it is passed as as a ref (for performance reasons), but it is never mutated. 71 | 72 | 73 | Parses the following prefix operators, plus the expression the operators apply to. 74 | 75 | 76 | Parses (higher-precedence) infix and postfix operators after the first term, together with the argument expressions. 77 | 78 | 79 | Detects the presence of an encoding preamble in the first count bytes of the byte buffer. 80 | If detectEncoding is false, this function only searches for the preamble of the given default encoding, 81 | otherwise also for any of the standard unicode byte order marks (UTF-8, UTF-16 LE/BE, UTF-32 LE/BE). 82 | If an encoding different from the given default encoding is detected, the new encoding 83 | is assigned to the encoding reference. 84 | Returns the number of bytes in the detected preamble, or 0 if no preamble is detected. 85 | 86 | 87 | 88 | Returns a case-folded copy of the string argument. All chars are mapped 89 | using the (non-Turkic) 1-to-1 case folding mappings (v. 6.0) for Unicode code 90 | points in the Basic Multilingual Plane, i.e. code points below 0x10000. 91 | If the argument is null, null is returned. 92 | 93 | 94 | Returns the given string with all occurrences of "\r\n" and "\r" replaced 95 | by "\n". If the argument is null, null is returned. 96 | 97 | 98 | A faster implementation of System.Globalization.StringInfo(str).LengthInTextElements. 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /UserSimulation/SimulationStep.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Diagnostics; 6 | using Excel = Microsoft.Office.Interop.Excel; 7 | using DataDebugMethods; 8 | using CellDict = System.Collections.Generic.Dictionary; 9 | using TreeScore = System.Collections.Generic.Dictionary; 10 | using ErrorDict = System.Collections.Generic.Dictionary; 11 | 12 | namespace UserSimulation 13 | { 14 | public static class SimulationStep 15 | { 16 | // this function returns an address but also updates 17 | // the filtered_high_scores list 18 | public static AST.Address CheckCell_Step(UserResults o, 19 | double significance, 20 | CutoffKind ck, 21 | int nboots, 22 | DAG dag, 23 | Excel.Application app, 24 | bool weighted, 25 | bool all_outputs, 26 | bool run_bootstrap, 27 | HashSet known_good, 28 | ref List> filtered_high_scores, 29 | long max_duration_in_ms, 30 | Stopwatch sw, 31 | ProgBar pb) 32 | { 33 | // Get bootstraps 34 | // The bootstrap should only re-run if there is a correction made, 35 | // not when something is marked as OK (isn't one of the introduced errors) 36 | // The list of suspected cells doesn't change when we mark something as OK, 37 | // we just move on to the next thing in the list 38 | if (run_bootstrap) 39 | { 40 | TreeScore scores = Analysis.DataDebug(nboots, dag, app, weighted, all_outputs, max_duration_in_ms, sw, significance, pb); 41 | 42 | // apply a threshold to the scores 43 | filtered_high_scores = ck.applyCutoff(scores, known_good); 44 | } 45 | else //if no corrections were made (a cell was marked as OK, not corrected) 46 | { 47 | //re-filter out cells marked as OK 48 | filtered_high_scores = filtered_high_scores.Where(kvp => !known_good.Contains(kvp.Key)).ToList(); 49 | } 50 | 51 | if (filtered_high_scores.Count() != 0) 52 | { 53 | // get AST.Address corresponding to most unusual score 54 | return filtered_high_scores[0].Key; 55 | } 56 | else 57 | { 58 | return null; 59 | } 60 | } 61 | 62 | public static AST.Address NormalPerRange_Step(DAG dag, 63 | Excel.Workbook wb, 64 | HashSet known_good, 65 | long max_duration_in_ms, 66 | Stopwatch sw) 67 | { 68 | AST.Address flagged_cell = null; 69 | 70 | //Generate normal distributions for every input range until an error is found 71 | //Then break out of the loop and report it. 72 | foreach (var vect_addr in dag.allVectors()) 73 | { 74 | var normal_dist = new DataDebugMethods.NormalDistribution(dag.getCOMRefForRange(vect_addr).Range); 75 | 76 | // Get top outlier which has not been inspected already 77 | if (normal_dist.getErrorsCount() > 0) 78 | { 79 | for (int i = 0; i < normal_dist.getErrorsCount(); i++) 80 | { 81 | // check for timeout 82 | if (sw.ElapsedMilliseconds > max_duration_in_ms) 83 | { 84 | throw new TimeoutException("Timeout exception in NormalPerRange_Step."); 85 | } 86 | 87 | var flagged_com = normal_dist.getErrorAtPosition(i); 88 | flagged_cell = AST.Address.AddressFromCOMObject(flagged_com, wb); 89 | if (known_good.Contains(flagged_cell)) 90 | { 91 | flagged_cell = null; 92 | } 93 | else 94 | { 95 | break; 96 | } 97 | } 98 | } 99 | //If a cell is flagged, do not move on to the next range (if you do, you'll overwrite the flagged_cell 100 | if (flagged_cell != null) 101 | { 102 | break; 103 | } 104 | } 105 | 106 | return flagged_cell; 107 | } 108 | 109 | public static AST.Address NormalAllOutputs_Step(DAG dag, 110 | Excel.Application app, 111 | Excel.Workbook wb, 112 | HashSet known_good, 113 | long max_duration_in_ms, 114 | Stopwatch sw) 115 | { 116 | AST.Address flagged_cell = null; 117 | 118 | //Generate a normal distribution for the entire set of inputs 119 | var normal_dist = new DataDebugMethods.NormalDistribution(dag.terminalInputVectors(), app); 120 | 121 | // Get top outlier 122 | if (normal_dist.getErrorsCount() > 0) 123 | { 124 | for (int i = 0; i < normal_dist.getErrorsCount(); i++) 125 | { 126 | // check for timeout 127 | if (sw.ElapsedMilliseconds > max_duration_in_ms) 128 | { 129 | throw new TimeoutException("Timeout exception in NormalAllOutputs_Step."); 130 | } 131 | 132 | var flagged_com = normal_dist.getErrorAtPosition(i); 133 | flagged_cell = AST.Address.AddressFromCOMObject(flagged_com, wb); 134 | if (known_good.Contains(flagged_cell)) 135 | { 136 | flagged_cell = null; 137 | } 138 | else 139 | { 140 | break; 141 | } 142 | } 143 | } 144 | 145 | return flagged_cell; 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /UserSimulation/CutoffKind.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using TreeScore = System.Collections.Generic.Dictionary; 6 | 7 | 8 | namespace UserSimulation 9 | { 10 | public abstract class CutoffKind { 11 | public abstract List> applyCutoff(TreeScore scores, HashSet known_good); 12 | public abstract double Threshold 13 | { 14 | get; 15 | } 16 | public virtual bool isCountBased 17 | { 18 | get { return false; } 19 | } 20 | } 21 | 22 | public class NormalCutoff : CutoffKind 23 | { 24 | double _t; 25 | public NormalCutoff(double pct_threshold) 26 | { 27 | _t = pct_threshold; 28 | } 29 | override public double Threshold 30 | { 31 | get { return _t; } 32 | } 33 | override public List> applyCutoff(TreeScore scores, HashSet known_good) 34 | { 35 | //Using an outlier test for highlighting 36 | //scores that fall outside of two standard deviations from the others 37 | //The one-sided 5% cutoff for the normal distribution is 1.6448. 38 | 39 | var scores_list = scores.OrderByDescending(pair => pair.Value).ToList(); 40 | 41 | List> filtered_high_scores = null; 42 | 43 | //Code for doing normal outlier analysis on the scores: 44 | //find mean: 45 | double sum = 0.0; 46 | foreach (double d in scores.Values) 47 | { 48 | sum += d; 49 | } 50 | double mean = sum / scores.Values.Count; 51 | //find variance 52 | double distance_sum_sq = 0.0; 53 | foreach (double d in scores.Values) 54 | { 55 | distance_sum_sq += Math.Pow(mean - d, 2); 56 | } 57 | double variance = distance_sum_sq / scores.Values.Count; 58 | 59 | //find std. deviation 60 | double std_deviation = Math.Sqrt(variance); 61 | 62 | if (_t == 0.05) 63 | { 64 | filtered_high_scores = scores_list.Where(kvp => kvp.Value > mean + std_deviation * 1.6448).ToList(); 65 | } 66 | else if (_t == 0.1) //10% cutoff 1.2815 67 | { 68 | filtered_high_scores = scores_list.Where(kvp => kvp.Value > mean + std_deviation * 1.2815).ToList(); 69 | } 70 | else if (_t == 0.025) //2.5% cutoff 1.9599 71 | { 72 | filtered_high_scores = scores_list.Where(kvp => kvp.Value > mean + std_deviation * 1.9599).ToList(); 73 | } 74 | else if (_t == 0.075) //7.5% cutoff 1.4395 75 | { 76 | filtered_high_scores = scores_list.Where(kvp => kvp.Value > mean + std_deviation * 1.4395).ToList(); 77 | } 78 | else 79 | { 80 | throw new Exception("Uhhh.... What's my cutoff?"); 81 | } 82 | 83 | return filtered_high_scores; 84 | } 85 | } 86 | 87 | public class QuantileCutoff : CutoffKind 88 | { 89 | double _t; 90 | public QuantileCutoff(double pct_threshold) 91 | { 92 | _t = pct_threshold; 93 | } 94 | override public double Threshold 95 | { 96 | get { return _t; } 97 | } 98 | override public List> applyCutoff(TreeScore scores, HashSet known_good) 99 | { 100 | var scores_list = scores.OrderByDescending(pair => pair.Value).ToList(); 101 | 102 | int start_ptr = 0; 103 | int end_ptr = 0; 104 | 105 | List> high_scores = new List>(); 106 | 107 | while ((double)start_ptr / scores_list.Count < _t) //the start of this score region is before the cutoff 108 | { 109 | // make sure that we don't go off the end of the list 110 | if (start_ptr >= scores_list.Count) 111 | { 112 | break; 113 | } 114 | 115 | //while the scores at the start and end pointers are the same, bump the end pointer 116 | while (end_ptr < scores_list.Count && scores_list[start_ptr].Value == scores_list[end_ptr].Value) 117 | { 118 | end_ptr++; 119 | } 120 | //Now the end_pointer points to the first index with a lower score 121 | //If the number of entries with the current value is fewer than the significance cutoff, add all values of this score to the high_scores list; the number of entries is equal to the end_ptr since end_ptr is zero-based 122 | //There is some added "wiggle room" to the cutoff, so that the last entry is allowed to straddle the cutoff bound. 123 | // To do this, we add (1 / total number of entries) to the cutoff 124 | //The purpose of the wiggle room is to allow us to deal with small ranges (less than 20 entries), since a single entry accounts 125 | //for more than 5% of the total. 126 | if ((double)end_ptr / scores_list.Count < _t + (double)1.0 / scores_list.Count) 127 | { 128 | //add all values of the current score to high_scores list 129 | for (; start_ptr < end_ptr; start_ptr++) 130 | { 131 | high_scores.Add(scores_list[start_ptr]); 132 | } 133 | //Increment the start pointer to the start of the next score region 134 | start_ptr++; 135 | } 136 | else //if this score region extends past the cutoff, we don't add any of its values to the high_scores list, and stop 137 | { 138 | break; 139 | } 140 | } 141 | // filter out cells marked as OK 142 | return high_scores.Where(kvp => !known_good.Contains(kvp.Key)).ToList(); 143 | } 144 | } 145 | 146 | public class NumberCutoff : CutoffKind 147 | { 148 | int _n; 149 | public NumberCutoff(int count) 150 | { 151 | _n = count; 152 | } 153 | override public double Threshold 154 | { 155 | get { return _n; } 156 | } 157 | override public bool isCountBased 158 | { 159 | get { return true; } 160 | } 161 | override public List> applyCutoff(TreeScore scores, HashSet known_good) 162 | { 163 | // sort scores, biggest first 164 | var scores_list = scores.OrderByDescending(pair => pair.Value).ToList(); 165 | 166 | // return the n largest (and force eager evaluation) 167 | // excluding cells marked as OK 168 | return scores_list.Take(_n).Where(kvp => !known_good.Contains(kvp.Key)).ToList(); 169 | } 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\analyze_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\clear_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\Resources\correct_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | 131 | ..\Resources\mark_as_ok_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | -------------------------------------------------------------------------------- /CheckCell/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\about.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\analyze_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\Resources\clear_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | 131 | ..\Resources\correct_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | 134 | ..\Resources\mark_as_ok_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 135 | 136 | -------------------------------------------------------------------------------- /DataDebugMethods/NormalDistribution.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | using Excel = Microsoft.Office.Interop.Excel; 7 | 8 | 9 | namespace DataDebugMethods 10 | { 11 | public class NormalDistribution 12 | { 13 | private readonly Excel.Range _cells; 14 | private readonly int _size; 15 | private readonly Double _mean; 16 | private readonly Double _variance; 17 | private readonly Double _standard_deviation; 18 | private Dictionary _error; 19 | public List _ranked_errors; 20 | private int numeric_count = 0; 21 | 22 | private Dictionary __error() 23 | { 24 | Dictionary error_dict = new Dictionary(); 25 | foreach (Excel.Range cell in _cells) 26 | { 27 | if (cell.Value2 != null) 28 | { 29 | try 30 | { 31 | var val = System.Convert.ToDouble(cell.Value2); 32 | if (Math.Abs(_mean - val) / _standard_deviation > 2.0) 33 | { 34 | error_dict.Add(cell, (double)Math.Abs(_mean - val) / _standard_deviation); 35 | } 36 | } 37 | catch { } 38 | } 39 | } 40 | return error_dict; 41 | } 42 | 43 | private Double __mean() 44 | { 45 | double sum = 0.0; 46 | foreach (Excel.Range cell in _cells) 47 | { 48 | if (cell.Value2 != null) 49 | { 50 | try 51 | { 52 | var val = System.Convert.ToDouble(cell.Value2); 53 | sum += val; 54 | numeric_count++; 55 | } catch { } 56 | } 57 | } 58 | return sum / numeric_count; 59 | } 60 | 61 | private List __rank_errors() 62 | { 63 | List rs = _error.OrderBy(pair => pair.Value).Select(pair => pair.Key).ToList(); 64 | rs.Reverse(); 65 | return rs; 66 | } 67 | 68 | private Double __standard_deviation() 69 | { 70 | return Math.Sqrt(_variance); 71 | } 72 | 73 | private Double __variance() 74 | { 75 | Double distance_sum_sq = 0; 76 | Double mymean = Mean(); 77 | foreach (Excel.Range cell in _cells) 78 | { 79 | if (cell.Value2 != null) 80 | { 81 | try 82 | { 83 | var val = System.Convert.ToDouble(cell.Value2); 84 | distance_sum_sq += Math.Pow(mymean - val, 2); 85 | } catch { } 86 | } 87 | } 88 | return distance_sum_sq / numeric_count; 89 | } 90 | 91 | public Double Mean() 92 | { 93 | return _mean; 94 | } 95 | 96 | //Constructor that takes an Excel range as an argument 97 | //The data is stored in the cells of the range 98 | public NormalDistribution(Excel.Range r) 99 | { 100 | _cells = r; 101 | _size = r.Count; 102 | _mean = __mean(); 103 | _variance = __variance(); 104 | _standard_deviation = __standard_deviation(); 105 | _error = __error(); 106 | _ranked_errors = __rank_errors(); 107 | } 108 | 109 | //Constructor that takes an array of TreeNodes as an argument 110 | public NormalDistribution(AST.Range[] range_nodes, Excel.Application app) 111 | { 112 | //turn the dictionary into an Excel.Range 113 | Excel.Range r1 = range_nodes[0].GetCOMObject(app); 114 | foreach (AST.Range range_node in range_nodes) 115 | { 116 | try //in a try-catch because Union malfunctioned in one observed case 117 | { 118 | r1 = app.Union(r1, range_node.GetCOMObject(app)); 119 | } catch { } 120 | } 121 | _cells = r1; 122 | _size = r1.Count; 123 | _mean = __mean(); 124 | _variance = __variance(); 125 | _standard_deviation = __standard_deviation(); 126 | _error = __error(); 127 | _ranked_errors = __rank_errors(); 128 | } 129 | 130 | public Double getStandardDeviation() 131 | { 132 | return _standard_deviation; 133 | } 134 | 135 | public Double getVariance() 136 | { 137 | return _variance; 138 | } 139 | 140 | public Excel.Range getWorstError() 141 | { 142 | return _ranked_errors.First(); 143 | } 144 | 145 | //Error function (erf) 146 | public static double erf(double x) 147 | { 148 | //Save the sign of x 149 | int sign; 150 | if (x >= 0) sign = 1; 151 | else sign = -1; 152 | x = Math.Abs(x); 153 | //Constants 154 | double a1 = 0.254829592; 155 | double a2 = -0.284496736; 156 | double a3 = 1.421413741; 157 | double a4 = -1.453152027; 158 | double a5 = 1.061405429; 159 | double p = 0.3275911; 160 | 161 | double t = 1.0 / (1.0 + p * x); 162 | double y = 1.0 - (a1 * t + a2 * Math.Pow(t, 2.0) + a3 * Math.Pow(t, 3.0) + a4 * Math.Pow(t, 4.0) + a5 * Math.Pow(t, 5.0)) * Math.Exp(-x * x); 163 | //double y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*Math.Exp(-x*x); 164 | 165 | return sign * y; //erf(-x) = -erf(x) 166 | } 167 | 168 | //Complementary error function (erfc) 169 | public static double erfc(double x) 170 | { 171 | return (1.0 - erf(x)); 172 | } 173 | 174 | //Computes the phi function given a z-score. 175 | //This is the CDF for the normal distribution, 176 | //or area under the curve to the left of the given z-score. 177 | //The normal distribution function Phi(z) gives the probability that a standard normal variate assumes a value in the interval [0,z]. 178 | public static double __phi(double x) 179 | { 180 | // constants 181 | double a1 = 0.254829592; 182 | double a2 = -0.284496736; 183 | double a3 = 1.421413741; 184 | double a4 = -1.453152027; 185 | double a5 = 1.061405429; 186 | double p = 0.3275911; 187 | 188 | // Save the sign of x 189 | int sign = 1; 190 | if (x < 0) 191 | { 192 | sign = -1; 193 | } 194 | x = Math.Abs(x) / Math.Sqrt(2.0); 195 | 196 | // A&S formula 7.1.26 197 | double t = 1.0 / (1.0 + p * x); 198 | double y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.Exp(-x * x); 199 | 200 | return 0.5 * (1.0 + sign * y); 201 | } 202 | 203 | public List getRankedErrors() 204 | { 205 | return _ranked_errors; 206 | } 207 | 208 | public Excel.Range getErrorAtPosition(int rank) 209 | { 210 | return _ranked_errors[rank]; 211 | } 212 | 213 | public int getErrorsCount() 214 | { 215 | return _ranked_errors.Count; 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /CheckCellTests/CheckCellTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections; 4 | using System.Linq; 5 | using System.Reflection; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Excel = Microsoft.Office.Interop.Excel; 8 | using System.Windows.Forms; 9 | using DataDebugMethods; 10 | using System.Runtime.InteropServices; 11 | 12 | namespace CheckCellTests 13 | { 14 | [TestClass] 15 | public class CheckCellTests 16 | { 17 | public class MockWorkbook 18 | { 19 | Excel.Application app; 20 | Excel.Workbook wb; 21 | Excel.Sheets ws; 22 | 23 | public MockWorkbook() 24 | { 25 | // worksheet indices; watch out! the second index here is the NUMBER of elements, NOT the max value! 26 | var e = Enumerable.Range(1, 10); 27 | 28 | // new Excel instance 29 | app = new Excel.Application(); 30 | 31 | // create new workbook 32 | wb = app.Workbooks.Add(); 33 | 34 | // get a reference to the worksheet array 35 | // By default, workbooks have three blank worksheets. 36 | ws = wb.Worksheets; 37 | 38 | // add some worksheets 39 | foreach (int i in e) 40 | { 41 | ws.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value); 42 | } 43 | } 44 | public Excel.Application GetApplication() { return app; } 45 | public Excel.Workbook GetWorkbook() { return wb; } 46 | public Excel.Sheets GetWorksheets() { return ws; } 47 | public Excel.Worksheet GetWorksheet(int idx) { return (Excel.Worksheet)ws[idx]; } 48 | public static int TestGetRanges(string formula) 49 | { 50 | // mock workbook object 51 | var mwb = new MockWorkbook(); 52 | Excel.Workbook wb = mwb.GetWorkbook(); 53 | Excel.Worksheet ws = mwb.GetWorksheet(1); 54 | var path = Microsoft.FSharp.Core.FSharpOption.None; 55 | 56 | var ranges = ExcelParserUtility.GetRangeReferencesFromFormulaRaw(formula, path, wb, ws, ignore_parse_errors: false); 57 | 58 | return ranges.Count(); 59 | } 60 | ~MockWorkbook() 61 | { 62 | try 63 | { 64 | wb.Close(false, Type.Missing, Type.Missing); 65 | app.Quit(); 66 | Marshal.ReleaseComObject(ws); 67 | Marshal.ReleaseComObject(wb); 68 | Marshal.ReleaseComObject(app); 69 | ws = null; 70 | wb = null; 71 | app = null; 72 | } 73 | catch 74 | { 75 | } 76 | } 77 | } 78 | 79 | [TestMethod] 80 | public void TestGetFormulaRanges() 81 | { 82 | var mwb = new MockWorkbook(); 83 | 84 | // rnd, for random formulae assignment 85 | Random rand = new Random(); 86 | 87 | // gin up some formulae 88 | Tuple[] fs = {new Tuple("B4", "=COUNT(A1:A5)"), 89 | new Tuple("A6", "=SUM(B5:B40)"), 90 | new Tuple("Z2", "=AVERAGE(A1:E1)"), 91 | new Tuple("B44", "=MEDIAN(D4:D9)")}; 92 | 93 | // to keep track of what we did 94 | var d = new System.Collections.Generic.Dictionary>>(); 95 | 96 | // add the formulae to the worksheets, randomly 97 | foreach (Excel.Worksheet w in mwb.GetWorksheets()) 98 | { 99 | // init list for each worksheet 100 | d[w] = new System.Collections.Generic.List>(); 101 | 102 | // add the formulae, randomly 103 | foreach (var f in fs) 104 | { 105 | if (rand.Next(0, 2) == 0) 106 | { 107 | w.Range[f.Item1, f.Item1].Formula = f.Item2; 108 | // keep track of what we did 109 | d[w].Add(f); 110 | } 111 | } 112 | // we need at least one formula, so add one if the above procedure did not 113 | if (d[w].Count() == 0) 114 | { 115 | w.Range[fs[0].Item1, fs[0].Item1].Formula = fs[0].Item2; 116 | d[w].Add(fs[0]); 117 | } 118 | } 119 | 120 | // init DAG 121 | var dag = new DAG(mwb.GetWorkbook(), mwb.GetApplication(), false); 122 | 123 | // get the formulas; 1 formula per worksheet 124 | var formulas = dag.getAllFormulaAddrs(); 125 | 126 | // there should be e.Count + 3 entries 127 | // don't forget: workbooks have 3 blank worksheets by default 128 | var expected = d.Values.Select(v => v.Count).Aggregate((acc, c) => acc + c); 129 | if (formulas.Length != expected) 130 | { 131 | throw new Exception("DAG.getAllFormulaAddrs() should return " + expected + " elements but instead returns " + formulas.Length + "."); 132 | } 133 | 134 | bool all_ok = true; 135 | 136 | // make sure that each worksheet's range has the formulas that it should 137 | var f_wsgroups = formulas.GroupBy(f => f.GetCOMObject(mwb.GetApplication()).Worksheet); 138 | 139 | foreach (var pair in f_wsgroups) 140 | { 141 | // get formulas in this worksheet 142 | var r = pair.Key.UsedRange.SpecialCells(Excel.XlCellType.xlCellTypeFormulas); 143 | 144 | // check that all formulae for this worksheet are accounted for 145 | bool r_ok = d[r.Worksheet].Aggregate(true, (bool acc, Tuple f) => 146 | { 147 | bool found = false; 148 | foreach (Excel.Range cell in r) 149 | { 150 | if (String.Equals((string)cell.Formula, f.Item2)) 151 | { 152 | found = true; 153 | } 154 | } 155 | return acc && found; 156 | }); 157 | 158 | all_ok = all_ok && r_ok; 159 | } 160 | 161 | if (!all_ok) 162 | { 163 | throw new Exception("ConstructTree.GetFormulaRanges() failed to return all of the formulae that were added."); 164 | } 165 | } // end test 166 | 167 | [TestMethod] 168 | public void TestGetRanges1() 169 | { 170 | var f = "=A1"; 171 | if (MockWorkbook.TestGetRanges(f) != 0) 172 | { 173 | throw new Exception("GetReferencesFromFormula should return no ranges for " + f); 174 | } 175 | } 176 | 177 | [TestMethod] 178 | public void TestGetRanges2() 179 | { 180 | var f = "=A1:B3"; 181 | if (MockWorkbook.TestGetRanges(f) != 1) 182 | { 183 | throw new Exception("GetReferencesFromFormula should return 1 range for " + f); 184 | } 185 | } 186 | 187 | [TestMethod] 188 | public void TestGetRanges3() 189 | { 190 | var f = "=SUM(A1:B3)+AVERAGE(C2:C8)"; 191 | if (MockWorkbook.TestGetRanges(f) != 2) 192 | { 193 | throw new Exception("GetReferencesFromFormula should return 2 ranges for " + f); 194 | } 195 | } 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /CheckCell/Ribbon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Office.Tools.Ribbon; 4 | using Microsoft.Office.Tools.Excel; 5 | using Excel = Microsoft.Office.Interop.Excel; 6 | using DataDebugMethods; 7 | using TreeScore = System.Collections.Generic.Dictionary; 8 | using TreeDict = System.Collections.Generic.Dictionary; 9 | using Microsoft.FSharp.Core; 10 | using System.IO; 11 | using System.Linq; 12 | using OptTuple = Microsoft.FSharp.Core.FSharpOption>; 13 | 14 | namespace CheckCell 15 | { 16 | public partial class Ribbon 17 | { 18 | Dictionary wbstates = new Dictionary(); 19 | WorkbookState current_workbook; 20 | 21 | // simulation files 22 | string classification_file; 23 | String benchmark_dir; 24 | String simulation_output_dir; 25 | String simulation_classification_file; 26 | 27 | private void SetUIState(WorkbookState wbs) 28 | { 29 | this.MarkAsOKButton.Enabled = wbs.MarkAsOK_Enabled; 30 | this.FixErrorButton.Enabled = wbs.FixError_Enabled; 31 | this.StartOverButton.Enabled = wbs.ClearColoringButton_Enabled; 32 | this.AnalyzeButton.Enabled = wbs.Analyze_Enabled; 33 | } 34 | 35 | private void SetUIStateNoWorkbooks() 36 | { 37 | this.MarkAsOKButton.Enabled = false; 38 | this.FixErrorButton.Enabled = false; 39 | this.StartOverButton.Enabled = false; 40 | this.AnalyzeButton.Enabled = false; 41 | } 42 | 43 | private void Ribbon_Load(object sender, RibbonUIEventArgs e) 44 | { 45 | // Callbacks for handling workbook state objects 46 | //WorkbookOpen(Globals.ThisAddIn.Application.ActiveWorkbook); 47 | //((Excel.AppEvents_Event)Globals.ThisAddIn.Application).NewWorkbook += WorkbookOpen; 48 | Globals.ThisAddIn.Application.WorkbookOpen += WorkbookOpen; 49 | Globals.ThisAddIn.Application.WorkbookActivate += WorkbookActivated; 50 | Globals.ThisAddIn.Application.WorkbookDeactivate += WorkbookDeactivated; 51 | Globals.ThisAddIn.Application.WorkbookBeforeClose += WorkbookClose; 52 | 53 | // sometimes the default blank workbook opens *before* the CheckCell 54 | // add-in is loaded so we have to handle sheet state specially. 55 | if (current_workbook == null) 56 | { 57 | var wb = Globals.ThisAddIn.Application.ActiveWorkbook; 58 | if (wb == null) 59 | { 60 | // the plugin loaded first; there's no active workbook 61 | return; 62 | } 63 | WorkbookOpen(wb); 64 | WorkbookActivated(wb); 65 | } 66 | } 67 | 68 | // This event is called when Excel opens a workbook 69 | private void WorkbookOpen(Excel.Workbook workbook) 70 | { 71 | wbstates.Add(workbook, new WorkbookState(Globals.ThisAddIn.Application, workbook)); 72 | } 73 | 74 | // This event is called when Excel brings an opened workbook 75 | // to the foreground 76 | private void WorkbookActivated(Excel.Workbook workbook) 77 | { 78 | // when opening a blank sheet, Excel does not emit 79 | // a WorkbookOpen event, so we need to call it manually 80 | if (!wbstates.ContainsKey(workbook)) { 81 | WorkbookOpen(workbook); 82 | } 83 | current_workbook = wbstates[workbook]; 84 | SetUIState(current_workbook); 85 | } 86 | 87 | // This even it called when Excel sends an opened workbook 88 | // to the background 89 | private void WorkbookDeactivated(Excel.Workbook workbook) 90 | { 91 | current_workbook = null; 92 | // WorkbookBeforeClose event does not fire for default workbooks 93 | // containing no data 94 | var wbs = new List(); 95 | foreach (var wb in Globals.ThisAddIn.Application.Workbooks) 96 | { 97 | if (wb != workbook) 98 | { 99 | wbs.Add((Excel.Workbook)wb); 100 | } 101 | } 102 | 103 | if (wbs.Count == 0) 104 | { 105 | wbstates.Clear(); 106 | SetUIStateNoWorkbooks(); 107 | } 108 | } 109 | 110 | private void WorkbookClose(Excel.Workbook workbook, ref bool Cancel) 111 | { 112 | wbstates.Remove(workbook); 113 | if (wbstates.Count == 0) 114 | { 115 | SetUIStateNoWorkbooks(); 116 | } 117 | } 118 | 119 | #region BUTTON_HANDLERS 120 | private void AnalyzeButton_Click(object sender, RibbonControlEventArgs e) 121 | { 122 | // check for debug easter egg 123 | if ((System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Alt) > 0) 124 | { 125 | current_workbook.DebugMode = true; 126 | } 127 | 128 | var sig = GetSignificance(this.SensitivityTextBox.Text, this.SensitivityTextBox.Label); 129 | if (sig == FSharpOption.None) 130 | { 131 | return; 132 | } 133 | else 134 | { 135 | current_workbook.ToolSignificance = sig.Value; 136 | try 137 | { 138 | current_workbook.Analyze(WorkbookState.MAX_DURATION_IN_MS); 139 | current_workbook.Flag(); 140 | SetUIState(current_workbook); 141 | } 142 | catch (ExcelParserUtility.ParseException ex) 143 | { 144 | System.Windows.Forms.Clipboard.SetText(ex.Message); 145 | System.Windows.Forms.MessageBox.Show("Could not parse the formula string:\n" + ex.Message); 146 | return; 147 | } 148 | catch (System.OutOfMemoryException ex) 149 | { 150 | System.Windows.Forms.MessageBox.Show("Insufficient memory to perform analysis."); 151 | return; 152 | } 153 | } 154 | } 155 | 156 | private void FixErrorButton_Click(object sender, RibbonControlEventArgs e) 157 | { 158 | current_workbook.FixError(SetUIState); 159 | } 160 | 161 | private void MarkAsOKButton_Click(object sender, RibbonControlEventArgs e) 162 | { 163 | current_workbook.MarkAsOK(); 164 | SetUIState(current_workbook); 165 | } 166 | 167 | private void StartOverButton_Click(object sender, RibbonControlEventArgs e) 168 | { 169 | current_workbook.ResetTool(); 170 | SetUIState(current_workbook); 171 | } 172 | 173 | private void ToDOTButton_Click(object sender, RibbonControlEventArgs e) 174 | { 175 | var app = Globals.ThisAddIn.Application; 176 | var dag = new DAG(app.ActiveWorkbook, app, true); 177 | System.Windows.Forms.Clipboard.SetText(dag.ToDOT()); 178 | System.Windows.Forms.MessageBox.Show("In clipboard"); 179 | } 180 | 181 | private void AboutCheckCell_Click(object sender, RibbonControlEventArgs e) 182 | { 183 | var ab = new AboutBox(); 184 | ab.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 185 | ab.Show(); 186 | } 187 | #endregion BUTTON_HANDLERS 188 | 189 | #region UTILITY_FUNCTIONS 190 | private static FSharpOption GetSignificance(string input, string label) 191 | { 192 | var errormsg = label + " must be a value between 0 and 100"; 193 | var significance = 0.95; 194 | 195 | try 196 | { 197 | significance = (100.0 - Double.Parse(input)) / 100.0; 198 | } 199 | catch 200 | { 201 | System.Windows.Forms.MessageBox.Show(errormsg); 202 | } 203 | 204 | if (significance < 0 || significance > 100) 205 | { 206 | System.Windows.Forms.MessageBox.Show(errormsg); 207 | } 208 | 209 | return FSharpOption.Some(significance); 210 | } 211 | #endregion UTILITY_FUNCTIONS 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /CheckCell/Ribbon.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CheckCell 2 | { 3 | partial class Ribbon : Microsoft.Office.Tools.Ribbon.RibbonBase 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | public Ribbon() 11 | : base(Globals.Factory.GetRibbonFactory()) 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | /// 17 | /// Clean up any resources being used. 18 | /// 19 | /// true if managed resources should be disposed; otherwise, false. 20 | protected override void Dispose(bool disposing) 21 | { 22 | if (disposing && (components != null)) 23 | { 24 | components.Dispose(); 25 | } 26 | base.Dispose(disposing); 27 | } 28 | 29 | #region Component Designer generated code 30 | 31 | /// 32 | /// Required method for Designer support - do not modify 33 | /// the contents of this method with the code editor. 34 | /// 35 | private void InitializeComponent() 36 | { 37 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Ribbon)); 38 | this.tab1 = this.Factory.CreateRibbonTab(); 39 | this.CheckCellTab = this.Factory.CreateRibbonTab(); 40 | this.CheckCellGroup = this.Factory.CreateRibbonGroup(); 41 | this.box1 = this.Factory.CreateRibbonBox(); 42 | this.ToDOTButton = this.Factory.CreateRibbonButton(); 43 | this.SensitivityTextBox = this.Factory.CreateRibbonEditBox(); 44 | this.AboutCheckCell = this.Factory.CreateRibbonButton(); 45 | this.AnalyzeButton = this.Factory.CreateRibbonButton(); 46 | this.MarkAsOKButton = this.Factory.CreateRibbonButton(); 47 | this.FixErrorButton = this.Factory.CreateRibbonButton(); 48 | this.StartOverButton = this.Factory.CreateRibbonButton(); 49 | this.tab1.SuspendLayout(); 50 | this.CheckCellTab.SuspendLayout(); 51 | this.CheckCellGroup.SuspendLayout(); 52 | this.box1.SuspendLayout(); 53 | // 54 | // tab1 55 | // 56 | this.tab1.ControlId.ControlIdType = Microsoft.Office.Tools.Ribbon.RibbonControlIdType.Office; 57 | this.tab1.Label = "TabAddIns"; 58 | this.tab1.Name = "tab1"; 59 | // 60 | // CheckCellTab 61 | // 62 | this.CheckCellTab.Groups.Add(this.CheckCellGroup); 63 | this.CheckCellTab.Label = "CheckCell"; 64 | this.CheckCellTab.Name = "CheckCellTab"; 65 | // 66 | // CheckCellGroup 67 | // 68 | this.CheckCellGroup.Items.Add(this.box1); 69 | this.CheckCellGroup.Items.Add(this.SensitivityTextBox); 70 | this.CheckCellGroup.Items.Add(this.AboutCheckCell); 71 | this.CheckCellGroup.Name = "CheckCellGroup"; 72 | // 73 | // box1 74 | // 75 | this.box1.Items.Add(this.AnalyzeButton); 76 | this.box1.Items.Add(this.MarkAsOKButton); 77 | this.box1.Items.Add(this.FixErrorButton); 78 | this.box1.Items.Add(this.StartOverButton); 79 | this.box1.Items.Add(this.ToDOTButton); 80 | this.box1.Name = "box1"; 81 | // 82 | // ToDOTButton 83 | // 84 | this.ToDOTButton.Label = "To DOT"; 85 | this.ToDOTButton.Name = "ToDOTButton"; 86 | this.ToDOTButton.Visible = false; 87 | this.ToDOTButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.ToDOTButton_Click); 88 | // 89 | // SensitivityTextBox 90 | // 91 | this.SensitivityTextBox.Label = "% Most Unusual to Show"; 92 | this.SensitivityTextBox.Name = "SensitivityTextBox"; 93 | this.SensitivityTextBox.SizeString = "100.0"; 94 | this.SensitivityTextBox.Text = "5.0"; 95 | // 96 | // AboutCheckCell 97 | // 98 | this.AboutCheckCell.Image = ((System.Drawing.Image)(resources.GetObject("AboutCheckCell.Image"))); 99 | this.AboutCheckCell.Label = "About"; 100 | this.AboutCheckCell.Name = "AboutCheckCell"; 101 | this.AboutCheckCell.ShowImage = true; 102 | this.AboutCheckCell.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.AboutCheckCell_Click); 103 | // 104 | // AnalyzeButton 105 | // 106 | this.AnalyzeButton.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; 107 | this.AnalyzeButton.Image = global::CheckCell.Properties.Resources.analyze_small; 108 | this.AnalyzeButton.Label = "Analyze"; 109 | this.AnalyzeButton.Name = "AnalyzeButton"; 110 | this.AnalyzeButton.ShowImage = true; 111 | this.AnalyzeButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.AnalyzeButton_Click); 112 | // 113 | // MarkAsOKButton 114 | // 115 | this.MarkAsOKButton.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; 116 | this.MarkAsOKButton.Image = global::CheckCell.Properties.Resources.mark_as_ok_small; 117 | this.MarkAsOKButton.Label = "Mark as OK"; 118 | this.MarkAsOKButton.Name = "MarkAsOKButton"; 119 | this.MarkAsOKButton.ShowImage = true; 120 | this.MarkAsOKButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.MarkAsOKButton_Click); 121 | // 122 | // FixErrorButton 123 | // 124 | this.FixErrorButton.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; 125 | this.FixErrorButton.Image = global::CheckCell.Properties.Resources.correct_small; 126 | this.FixErrorButton.Label = "Fix Error"; 127 | this.FixErrorButton.Name = "FixErrorButton"; 128 | this.FixErrorButton.ShowImage = true; 129 | this.FixErrorButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.FixErrorButton_Click); 130 | // 131 | // StartOverButton 132 | // 133 | this.StartOverButton.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; 134 | this.StartOverButton.Image = global::CheckCell.Properties.Resources.clear_small; 135 | this.StartOverButton.Label = "Start Over"; 136 | this.StartOverButton.Name = "StartOverButton"; 137 | this.StartOverButton.ShowImage = true; 138 | this.StartOverButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.StartOverButton_Click); 139 | // 140 | // Ribbon 141 | // 142 | this.Name = "Ribbon"; 143 | this.RibbonType = "Microsoft.Excel.Workbook"; 144 | this.Tabs.Add(this.tab1); 145 | this.Tabs.Add(this.CheckCellTab); 146 | this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.Ribbon_Load); 147 | this.tab1.ResumeLayout(false); 148 | this.tab1.PerformLayout(); 149 | this.CheckCellTab.ResumeLayout(false); 150 | this.CheckCellTab.PerformLayout(); 151 | this.CheckCellGroup.ResumeLayout(false); 152 | this.CheckCellGroup.PerformLayout(); 153 | this.box1.ResumeLayout(false); 154 | this.box1.PerformLayout(); 155 | 156 | } 157 | 158 | #endregion 159 | 160 | internal Microsoft.Office.Tools.Ribbon.RibbonTab tab1; 161 | private Microsoft.Office.Tools.Ribbon.RibbonTab CheckCellTab; 162 | internal Microsoft.Office.Tools.Ribbon.RibbonGroup CheckCellGroup; 163 | internal Microsoft.Office.Tools.Ribbon.RibbonBox box1; 164 | internal Microsoft.Office.Tools.Ribbon.RibbonButton AnalyzeButton; 165 | internal Microsoft.Office.Tools.Ribbon.RibbonButton MarkAsOKButton; 166 | internal Microsoft.Office.Tools.Ribbon.RibbonButton FixErrorButton; 167 | internal Microsoft.Office.Tools.Ribbon.RibbonButton StartOverButton; 168 | internal Microsoft.Office.Tools.Ribbon.RibbonButton ToDOTButton; 169 | internal Microsoft.Office.Tools.Ribbon.RibbonEditBox SensitivityTextBox; 170 | internal Microsoft.Office.Tools.Ribbon.RibbonButton AboutCheckCell; 171 | } 172 | 173 | partial class ThisRibbonCollection 174 | { 175 | internal Ribbon Ribbon 176 | { 177 | get { return this.GetRibbon(); } 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /DataDebug.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 2013 3 | VisualStudioVersion = 12.0.30723.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2EC7A95C-7017-432F-A22C-7CFA98BBF599}" 6 | ProjectSection(SolutionItems) = preProject 7 | DataDebug.vsmdi = DataDebug.vsmdi 8 | Local.testsettings = Local.testsettings 9 | TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings 10 | EndProjectSection 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataDebugMethods", "DataDebugMethods\DataDebugMethods.csproj", "{64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}" 13 | EndProject 14 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "LongestCommonSubsequence", "LongestCommonSubsequence\LongestCommonSubsequence.fsproj", "{E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}" 15 | EndProject 16 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ExcelParser", "parcel\Parcel\ExcelParser.fsproj", "{6DE2A2B9-C029-4BDB-8992-D16276471D9F}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserSimulation", "UserSimulation\UserSimulation.csproj", "{CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}" 19 | EndProject 20 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MTurkParser", "MTurkParser\MTurkParser.fsproj", "{5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}" 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckCellTests", "CheckCellTests\CheckCellTests.csproj", "{3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}" 23 | EndProject 24 | Project("{6141683F-8A12-4E36-9623-2EB02B2C2303}") = "CheckCellSetup", "CheckCellSetup\CheckCellSetup.isproj", "{8E9D9976-55E1-4C00-8BC1-25AEF49F4973}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC} = {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC} 27 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B} = {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B} 28 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223} = {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223} 29 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A} = {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A} 30 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F} = {6DE2A2B9-C029-4BDB-8992-D16276471D9F} 31 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80} = {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80} 32 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236} = {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236} 33 | EndProjectSection 34 | EndProject 35 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckCell", "CheckCell\CheckCell.csproj", "{7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}" 36 | EndProject 37 | Global 38 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 39 | CD_ROM|Any CPU = CD_ROM|Any CPU 40 | Debug|Any CPU = Debug|Any CPU 41 | DVD-5|Any CPU = DVD-5|Any CPU 42 | Release|Any CPU = Release|Any CPU 43 | SingleImage|Any CPU = SingleImage|Any CPU 44 | EndGlobalSection 45 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 46 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU 47 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.CD_ROM|Any CPU.Build.0 = Release|Any CPU 48 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU 51 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.DVD-5|Any CPU.Build.0 = Debug|Any CPU 52 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU 55 | {64DBF1B4-B0B7-4490-8C7C-2DEEA22CB25A}.SingleImage|Any CPU.Build.0 = Release|Any CPU 56 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU 57 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.CD_ROM|Any CPU.Build.0 = Release|Any CPU 58 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 59 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.Debug|Any CPU.Build.0 = Debug|Any CPU 60 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU 61 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.DVD-5|Any CPU.Build.0 = Debug|Any CPU 62 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.Release|Any CPU.ActiveCfg = Release|Any CPU 63 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.Release|Any CPU.Build.0 = Release|Any CPU 64 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU 65 | {E3B87CAD-521F-41EA-B3E8-ECD0D7D5074B}.SingleImage|Any CPU.Build.0 = Release|Any CPU 66 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU 67 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.CD_ROM|Any CPU.Build.0 = Release|Any CPU 68 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 69 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.Debug|Any CPU.Build.0 = Debug|Any CPU 70 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU 71 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.DVD-5|Any CPU.Build.0 = Debug|Any CPU 72 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.Release|Any CPU.ActiveCfg = Release|Any CPU 73 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.Release|Any CPU.Build.0 = Release|Any CPU 74 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU 75 | {6DE2A2B9-C029-4BDB-8992-D16276471D9F}.SingleImage|Any CPU.Build.0 = Release|Any CPU 76 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU 77 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.CD_ROM|Any CPU.Build.0 = Release|Any CPU 78 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 79 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.Debug|Any CPU.Build.0 = Debug|Any CPU 80 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU 81 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.DVD-5|Any CPU.Build.0 = Debug|Any CPU 82 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.Release|Any CPU.ActiveCfg = Release|Any CPU 83 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.Release|Any CPU.Build.0 = Release|Any CPU 84 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU 85 | {CB1AADE6-AD72-4AE5-AAA8-351CEBC61236}.SingleImage|Any CPU.Build.0 = Release|Any CPU 86 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU 87 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.CD_ROM|Any CPU.Build.0 = Release|Any CPU 88 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 89 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.Debug|Any CPU.Build.0 = Debug|Any CPU 90 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU 91 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.DVD-5|Any CPU.Build.0 = Debug|Any CPU 92 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.Release|Any CPU.ActiveCfg = Release|Any CPU 93 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.Release|Any CPU.Build.0 = Release|Any CPU 94 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU 95 | {5C2DEF3E-A805-49A2-B88A-8EB59F6974DC}.SingleImage|Any CPU.Build.0 = Release|Any CPU 96 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU 97 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.CD_ROM|Any CPU.Build.0 = Release|Any CPU 98 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 99 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.Debug|Any CPU.Build.0 = Debug|Any CPU 100 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU 101 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.DVD-5|Any CPU.Build.0 = Debug|Any CPU 102 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.Release|Any CPU.ActiveCfg = Release|Any CPU 103 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.Release|Any CPU.Build.0 = Release|Any CPU 104 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU 105 | {3FBCC9B4-39BB-4CF3-9C4F-48A74FEA3223}.SingleImage|Any CPU.Build.0 = Release|Any CPU 106 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.CD_ROM|Any CPU.ActiveCfg = CD_ROM 107 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.CD_ROM|Any CPU.Build.0 = CD_ROM 108 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.Debug|Any CPU.ActiveCfg = SingleImage 109 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.DVD-5|Any CPU.ActiveCfg = DVD-5 110 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.DVD-5|Any CPU.Build.0 = DVD-5 111 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.Release|Any CPU.ActiveCfg = SingleImage 112 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.SingleImage|Any CPU.ActiveCfg = SingleImage 113 | {8E9D9976-55E1-4C00-8BC1-25AEF49F4973}.SingleImage|Any CPU.Build.0 = SingleImage 114 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU 115 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.CD_ROM|Any CPU.Build.0 = Release|Any CPU 116 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 117 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.Debug|Any CPU.Build.0 = Debug|Any CPU 118 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU 119 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.DVD-5|Any CPU.Build.0 = Debug|Any CPU 120 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.Release|Any CPU.ActiveCfg = Release|Any CPU 121 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.Release|Any CPU.Build.0 = Release|Any CPU 122 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU 123 | {7E0E09D4-1A64-4827-8D63-FACD5D9D9C80}.SingleImage|Any CPU.Build.0 = Release|Any CPU 124 | EndGlobalSection 125 | GlobalSection(SolutionProperties) = preSolution 126 | HideSolutionNode = FALSE 127 | EndGlobalSection 128 | GlobalSection(TestCaseManagementSettings) = postSolution 129 | CategoryFile = DataDebug.vsmdi 130 | EndGlobalSection 131 | EndGlobal 132 | --------------------------------------------------------------------------------