use caculated score for sys plugin item

use caculated score for sys plugin item

--- Plugins/Wox.Plugin.Sys/Sys.cs
+++ Plugins/Wox.Plugin.Sys/Sys.cs
@@ -39,8 +39,11 @@
             List<Result> results = new List<Result>();
             foreach (Result availableResult in availableResults)
             {
-                if (StringMatcher.IsMatch(availableResult.Title, query.Search) || StringMatcher.IsMatch(availableResult.SubTitle, query.Search))
+                int titleScore = StringMatcher.Match(availableResult.Title, query.Search);
+                int subTitleScore = StringMatcher.Match(availableResult.SubTitle, query.Search);
+                if (titleScore > 0 || subTitleScore > 0)
                 {
+                    availableResult.Score = titleScore > 0 ? titleScore : subTitleScore;
                     results.Add(availableResult);
                 }
             }
@@ -55,92 +58,85 @@

         private void LoadCommands()
         {
-            availableResults.AddRange(new Result[] {
-				new Result
-				{
-					Title = "Shutdown",
-					SubTitle = context.API.GetTranslation("wox_plugin_sys_shutdown_computer"),
-					Score = 100,
-					IcoPath = "Images\\exit.png",
-					Action = (c) =>
-					{
-						if (MessageBox.Show("Are you sure you want to shut the computer down?","Shutdown Computer?",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes) {
-							Process.Start("shutdown", "/s /t 0");
-						}
-					    return true;
-					}
-				},
-				new Result
-				{
-				    Title = "Log off",
+            availableResults.AddRange(new Result[] {
+                new Result
+                {
+                    Title = "Shutdown",
+                    SubTitle = context.API.GetTranslation("wox_plugin_sys_shutdown_computer"),
+                    IcoPath = "Images\\exit.png",
+                    Action = (c) =>
+                    {
+                        if (MessageBox.Show("Are you sure you want to shut the computer down?","Shutdown Computer?",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes) {
+                            Process.Start("shutdown", "/s /t 0");
+                        }
+                        return true;
+                    }
+                },
+                new Result
+                {
+                    Title = "Log off",
                     SubTitle = context.API.GetTranslation("wox_plugin_sys_log_off"),
-				    Score = 100,
-				    IcoPath = "Images\\logoff.png",
-				    Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
-				},
-				new Result
-				{
-				    Title = "Lock",
+                    IcoPath = "Images\\logoff.png",
+                    Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
+                },
+                new Result
+                {
+                    Title = "Lock",
                     SubTitle = context.API.GetTranslation("wox_plugin_sys_lock"),
-				    Score = 100,
-				    IcoPath = "Images\\lock.png",
-				    Action = (c) =>
-				    {
-				        LockWorkStation();
-				        return true;
-				    }
-				},
+                    IcoPath = "Images\\lock.png",
+                    Action = (c) =>
+                    {
+                        LockWorkStation();
+                        return true;
+                    }
+                },
                 new Result
                 {
                     Title = "Sleep",
                     SubTitle = context.API.GetTranslation("wox_plugin_sys_sleep"),
-                    Score = 100,
                     IcoPath = "Images\\sleep.png",
                     Action = (c) => Application.SetSuspendState(PowerState.Suspend, false, false)
                 },
                 new Result
-				{
-				    Title = "Exit",
+                {
+                    Title = "Exit",
                     SubTitle = context.API.GetTranslation("wox_plugin_sys_exit"),
-				    Score = 110,
-				    IcoPath = "Images\\app.png",
-				    Action = (c) =>
-				    {
-				        context.API.CloseApp();
-				        return true;
-				    }
-				},
-				new Result
-				{
-				    Title = "Restart Wox",
+                    IcoPath = "Images\\app.png",
+                    Action = (c) =>
+                    {
+                        context.API.CloseApp();
+                        return true;
+                    }
+                },
+                new Result
+                {
+                    Title = "Restart Wox",
                     SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"),
-				    Score = 110,
-				    IcoPath = "Images\\restart.png",
-				    Action = (c) =>
-				    {
-				        ProcessStartInfo Info = new ProcessStartInfo();
-				        Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\"";
-				        Info.WindowStyle = ProcessWindowStyle.Hidden;
-				        Info.CreateNoWindow = true;
-				        Info.FileName = "cmd.exe";
-				        Process.Start(Info);
-				        context.API.CloseApp();
-				        return true;
-				    }
-				},
-				new Result
-				{
-				    Title = "Settings",
+                    IcoPath = "Images\\restart.png",
+                    Action = (c) =>
+                    {
+                        ProcessStartInfo Info = new ProcessStartInfo();
+                        Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\"";
+                        Info.WindowStyle = ProcessWindowStyle.Hidden;
+                        Info.CreateNoWindow = true;
+                        Info.FileName = "cmd.exe";
+                        Process.Start(Info);
+                        context.API.CloseApp();
+                        return true;
+                    }
+                },
+                new Result
+                {
+                    Title = "Settings",
                     SubTitle = context.API.GetTranslation("wox_plugin_sys_setting"),
-				    Score = 100,
-				    IcoPath = "Images\\app.png",
-				    Action = (c) =>
-				    {
-				        context.API.OpenSettingDialog();
-				        return true;
-				    }
-				}
-			});
+                    IcoPath = "Images\\app.png",
+                    Action = (c) =>
+                    {
+                        context.API.OpenSettingDialog();
+                        return true;
+                    }
+                }
+            });
         }

         public string GetLanguagesFolder()


Update Base62CorrelationService.cs

Update Base62CorrelationService.cs

--- TIKSN.Core/Integration/Correlation/Base62CorrelationService.cs
+++ TIKSN.Core/Integration/Correlation/Base62CorrelationService.cs
@@ -31,7 +31,8 @@

         public CorrelationID Create(string stringRepresentation)
         {
-            var number = BigInteger.Parse(_base62Converter.Decode(stringRepresentation), CultureInfo.InvariantCulture);
+            var numberToParse = _base62Converter.Decode(stringRepresentation);
+            var number = BigInteger.Parse(numberToParse, CultureInfo.InvariantCulture);
             byte[] byteArrayRepresentation = _bigIntegerBinarySerializer.Serialize(number);
             return new CorrelationID(stringRepresentation, byteArrayRepresentation);
         }


Update CompactBinaryBondDeserializer.cs

Update CompactBinaryBondDeserializer.cs

--- TIKSN.Core/Serialization/Bond/CompactBinaryBondDeserializer.cs
+++ TIKSN.Core/Serialization/Bond/CompactBinaryBondDeserializer.cs
@@ -1,15 +1,10 @@
 using Bond.IO.Safe;
 using Bond.Protocols;
-using TIKSN.Analytics.Telemetry;

 namespace TIKSN.Serialization.Bond
 {
     public class CompactBinaryBondDeserializer : DeserializerBase<byte[]>
     {
-        public CompactBinaryBondDeserializer(IExceptionTelemeter exceptionTelemeter) : base(exceptionTelemeter)
-        {
-        }
-
         protected override T DeserializeInternal<T>(byte[] serial)
         {
             var input = new InputBuffer(serial);


trying to clean up Pricilla.MoveTo(...) a bit

--- Pricilla/Pricilla/Pricilla.cs
+++ Pricilla/Pricilla/Pricilla.cs
@@ -50,8 +50,10 @@

             //calculate the distance to drag as a double to avoid rounding errors later when converting to int
             var startPosition = this.mouse.FindCursor();
-            var dX = Convert.ToDouble(targetWithOffset.X) - Convert.ToDouble(startPosition.X);
-            var dY = Convert.ToDouble(targetWithOffset.Y) - Convert.ToDouble(startPosition.Y);
+            var startX = Convert.ToDouble(startPosition.X);
+            var startY = Convert.ToDouble(startPosition.Y);
+            var dX = Convert.ToDouble(targetWithOffset.X) - startX;
+            var dY = Convert.ToDouble(targetWithOffset.Y) - startY;
             var distance = this.Hypotenuse(dX, dY);

             //calculate number of steps needed to perform the move operation
@@ -65,18 +67,16 @@

             //we need to compensate for int rounding so save the fractions for the next round
             var xRemainingFraction = 0.0d;
-            var yRemainingFraction = 0.0d;
-            var startX = Convert.ToDouble(startPosition.X);
-            var startY = Convert.ToDouble(startPosition.Y);
-            for (var i = 1; i < Convert.ToInt32(steps); ++i)
+            var yRemainingFraction = 0.0d;
+            for (var i = 1; i < steps; ++i)
             {
                 //apply the fraction part saved from the last loop
-                var targetDX = incrementX + xRemainingFraction;
-                var targetDY = incrementY + yRemainingFraction;
+                var targetDx = incrementX + xRemainingFraction;
+                var targetDy = incrementY + yRemainingFraction;

                 //save the fraction for the next loop
-                xRemainingFraction = targetDX - (int)targetDX;
-                yRemainingFraction = targetDY - (int)targetDY;
+                xRemainingFraction = targetDx - (int)targetDx;
+                yRemainingFraction = targetDy - (int)targetDy;

                 //position cursor to the int part of the coordinates
                 var x = (int)((incrementX) * i + startX);
@@ -106,13 +106,13 @@
             return Math.Sqrt(a * a + b * b);
         }

-        private double CalculateNumberOfMovementSteps(int pixelsPerSecond, int sectionMovementDurationMs, double distance)
+        private int CalculateNumberOfMovementSteps(int pixelsPerSecond, int sectionMovementDurationMs, double distance)
         {
             var pps = Convert.ToDouble(pixelsPerSecond);
             var smd = Convert.ToDouble(sectionMovementDurationMs);
             var ticks = 1000d;

-            return (ticks / smd) / (pps / distance);
+            return Convert.ToInt32((ticks / smd) / (pps / distance));
         }
     }
 }


ServiceServerLink: force response to be non-null (in spite of the caller passing a ref to a null response), and remove a couple unused variables in CallInfo

--- ROS_Comm/ServiceServerLink.cs
+++ ROS_Comm/ServiceServerLink.cs
@@ -288,14 +288,18 @@

         public bool call(IRosMessage req, ref IRosMessage resp)
         {
-            CallInfo info = new CallInfo {req = req, resp = resp, success = false, finished = false, call_finished = false, caller_thread_id = ROS.getPID()};
+            if (resp == null)
+            {
+                //instantiate null response IN CASE this call succeeds
+                resp = IRosMessage.generate((MsgTypes) Enum.Parse(typeof (MsgTypes), req.msgtype.ToString().Replace("Request", "Response")));
+            }
+            CallInfo info = new CallInfo {req = req, resp = resp, success = false, finished = false};

             bool immediate = false;
             lock (call_queue_mutex)
             {
                 if (connection.dropped)
                 {
-                    info.call_finished = true;
                     return false;
                 }
                 if (call_queue.Count == 0 && header_written && header_read)
@@ -309,11 +313,6 @@
             while (!info.finished)
             {
                 info.finished_condition.WaitOne();
-            }
-
-            lock (info.finished_mutex)
-            {
-                info.call_finished = true;
             }

             resp.Deserialize(resp.Serialized);
@@ -342,7 +341,7 @@
             IRosMessage iresp = resp;
             bool r = call(req, ref iresp);
             if (iresp != null)
-                resp = (MRes) iresp; //.Deserialize(iresp.Serialized);
+                resp = (MRes) iresp;
             return r;
         }
     }
@@ -364,15 +363,13 @@
             if (iresp != null)
                 srv.ResponseMessage.Deserialize(iresp.Serialized);
             else
-                srv.ResponseMessage = null; //std_servs.Empty, I hope?
+                srv.ResponseMessage = null;
             return r;
         }
     }

     internal class CallInfo
     {
-        internal bool call_finished;
-        internal UInt64 caller_thread_id;
         internal string exception = "";
         internal bool finished;
         internal Semaphore finished_condition = new Semaphore(0, int.MaxValue);


Add SentUTC to PrivateMessage

Add SentUTC to PrivateMessage

--- RedditSharp/PrivateMessage.cs
+++ RedditSharp/PrivateMessage.cs
@@ -24,6 +24,9 @@
         [JsonProperty("created")]
         [JsonConverter(typeof(UnixTimestampConverter))]
         public DateTime Sent { get; set; }
+        [JsonProperty("created_utc")]
+        [JsonConverter(typeof(UnixTimestampConverter))]
+        public DateTime SentUTC { get; set; }
         [JsonProperty("dest")]
         public string Destination { get; set; }
         [JsonProperty("author")]


Manual merge from Simone

Manual merge from Simone

--- SQLXEtoEventHub/Program.cs
+++ SQLXEtoEventHub/Program.cs
@@ -22,9 +22,12 @@
             cmd.CommandType = System.Data.CommandType.Text;
             cmd.CommandText = "SELECT type, data FROM sys.fn_MSxe_read_event_stream ('GetEvents', 0)";
             var reader = cmd.ExecuteReader();
-            while(reader.Read())
+            while (reader.Read())
             {
-                Console.WriteLine(reader[1].ToString());
+                var b = reader[1] as byte[];
+                var s = System.Text.Encoding.Unicode.GetString(b);
+                Console.WriteLine(s);
+
             }
         }
     }


Fix fade effect not cloning autoreverse prop

--- SadConsole/Effects/Fade.cs
+++ SadConsole/Effects/Fade.cs
@@ -200,12 +200,14 @@
             Repeat = Repeat,
             UseCellDestinationReverse = UseCellDestinationReverse,

+            AutoReverse = AutoReverse,
             IsFinished = IsFinished,
             StartDelay = StartDelay,
             CloneOnAdd = CloneOnAdd,
             RemoveOnFinished = RemoveOnFinished,
             RestoreCellOnRemoved = RestoreCellOnRemoved,
             _timeElapsed = _timeElapsed,
+
         };

         //public override bool Equals(ICellEffect effect)


Fix compilation errors in AutomationApp

Fix compilation errors in AutomationApp

--- automation/AutomationApp/AutomationApp/AuthenticationHelper.cs
+++ automation/AutomationApp/AutomationApp/AuthenticationHelper.cs
@@ -11,18 +11,18 @@
 {
     internal static class AuthenticationHelper
     {
-        public static async Task<string> AcquireToken(Dictionary<string, string> input)
+        public static string AcquireToken(Dictionary<string, string> input)
         {
             return null;
         }

-        public static async Task<string> AcquireTokenSilent(Dictionary<string, string> input)
+        public static string AcquireTokenSilent(Dictionary<string, string> input)
         {
             AuthenticationContext ctx = new AuthenticationContext("");
             string output = string.Empty;
             try
             {
-                AuthenticationResult result = await ctx.AcquireTokenSilentAsync("", "");
+                AuthenticationResult result = ctx.AcquireTokenSilentAsync("", "").Result;
                 output = result.ToJson();
             }
             catch (Exception exc)


script drop and (re)create for table types that diff when comparing

--- model/Database.cs
+++ model/Database.cs
@@ -1441,13 +1441,15 @@
 				text.AppendLine("GO");
 			}

-			//add tables
-			if (TablesAdded.Count > 0) {
-				foreach (Table t in TablesAdded) {
-					text.Append(t.ScriptCreate());
-				}
-				text.AppendLine("GO");
-			}
+			//delete tables
+			if (TablesDeleted.Count + TableTypesDiff.Count > 0) {
+				foreach (Table t in TablesDeleted.Concat(TableTypesDiff)) {
+					text.AppendLine(t.ScriptDrop());
+				}
+				text.AppendLine("GO");
+			}
+			// TODO: table types drop will fail if anything references them... try to find a workaround?
+

 			//modify tables
 			if (TablesDiff.Count > 0) {
@@ -1456,12 +1458,11 @@
 				}
 				text.AppendLine("GO");
 			}
-			// TODO: table types... need to drop and recreate... but will fail if anything references them...
-
-			//delete tables
-			if (TablesDeleted.Count > 0) {
-				foreach (Table t in TablesDeleted) {
-					text.AppendLine(t.ScriptDrop());
+
+			//add tables
+			if (TablesAdded.Count + TableTypesDiff.Count > 0) {
+				foreach (Table t in TablesAdded.Concat(TableTypesDiff)) {
+					text.Append(t.ScriptCreate());
 				}
 				text.AppendLine("GO");
 			}


fixes #5 fix creating dependent objects out of order

--- model/Database.cs
+++ model/Database.cs
@@ -4,6 +4,7 @@
 using System.Data;
 using System.Data.SqlClient;
 using System.IO;
+using System.Linq;

 namespace model {
 	using System.Text.RegularExpressions;
@@ -664,20 +665,31 @@
                 // so clear the pool so we get a new connection
                 DBHelper.ClearPool(Connection);
             }
-			foreach (string dir in dirs) {
-				if ("foreign_keys" == dir) { continue; }
-				var dirPath = Dir + "/" + dir;
-				if (!Directory.Exists(dirPath)) { continue; }
-
-				foreach (string f in Directory.GetFiles(dirPath, "*.sql")) {
+
+			// create db objects
+			// resolve dependencies by trying over and over
+			// if the number of failures stops decreasing then give up
+			var scripts = GetScripts();
+			var errors = new List<SqlFileException>();
+			var prevCount = Int32.MaxValue;
+			while(scripts.Count > 0 && errors.Count < prevCount){
+				if (errors.Count > 0){
+					prevCount = errors.Count;
+					Console.WriteLine(
+					  "{0} errors occurred, retrying...", errors.Count);
+				}
+				errors.Clear();
+				foreach(var f in scripts.ToArray()){
 					try {
 						DBHelper.ExecBatchSql(Connection, File.ReadAllText(f));
+						scripts.Remove(f);
 					} catch (SqlBatchException ex) {
-						throw new SqlFileException(f, ex);
-					}
-				}
-			}
-
+						errors.Add(new SqlFileException(f, ex));
+					}
+				}
+			}
+			if (errors.Count > 0){ throw errors[0]; }
+
 			Load();			// load the schema first so we can import data
 			ImportData();	// load data

@@ -691,6 +703,17 @@
 					}
 				}
 			}
+		}
+
+		private List<string> GetScripts(){
+			var scripts = new List<string>();
+			foreach (string dir in dirs) {
+				if ("foreign_keys" == dir) { continue; }
+				var dirPath = Dir + "/" + dir;
+				if (!Directory.Exists(dirPath)) { continue; }
+				scripts.AddRange(Directory.GetFiles(dirPath, "*.sql"));
+			}
+			return scripts;
 		}

 		public void ExecCreate(bool dropIfExists) {


Update equality test

Update equality test

--- Samples/Records/Program.cs
+++ Samples/Records/Program.cs
@@ -11,21 +11,22 @@
         static void Main(string[] args)
         {
             var opt1 = Maybe.Just(100);
-            var opt2 = Maybe.Nothing<int>();
+            var opt2 = Maybe.Just(100);
+            var optN = Maybe.Nothing<int>();

             var res1 = opt1.Match(
                            Just: x => x * 2,
                            Nothing: () => 0);

-            var res2 = opt2.Match(
+            var res2 = optN.Match(
                            Just: x => x * 2,
                            Nothing: () => 0);

-            var eqA = opt1 == opt2;
-            var eqB = opt1 != opt2;
+            var eqA = opt1.Equals(optN);
+            var eqB = opt1.Equals(opt2);

             Console.WriteLine($"opt1: {opt1}");
-            Console.WriteLine($"opt2: {opt2}");
+            Console.WriteLine($"optN: {optN}");
             Console.WriteLine($"res1: {res1}");
             Console.WriteLine($"res2: {res2}");
             Console.ReadKey();


Made GetService throw a KeyNotFoundException instead of InvalidOperationException.

--- Servicer/ServiceLocator.cs
+++ Servicer/ServiceLocator.cs
@@ -141,7 +141,7 @@
     /// </summary>
     /// <typeparam name="T">The type of service to get.</typeparam>
     /// <returns>The instance of type T registered with the Service Locator.</returns>
-    /// <exception cref="InvalidOperationException">Thrown when the Service Locator cannot find an un-keyed service of the requested type and Explicit is true, or when the Service Locator cannot find an un-keyed service of the requested type or any type that can be assigned to the requested type and Explicit is false.</exception>
+    /// <exception cref="KeyNotFoundException">Thrown when the Service Locator cannot find an un-keyed service of the requested type and Explicit is true, or when the Service Locator cannot find an un-keyed service of the requested type or any type that can be assigned to the requested type and Explicit is false.</exception>
     public static T GetService<T>() where T : class
     {
         return GetService<T>(null);
@@ -153,7 +153,7 @@
     /// <typeparam name="T">The type of service to get.</typeparam>
     /// <param name="key">The key to filter multiple services of the same type by.</param>
     /// <returns>The instance of type T registered with the provided key in the Service Locator.</returns>
-    /// <exception cref="System.InvalidOperationException">Thrown when the Service Locator cannot find an a service of the requested type with a matching key and Explicit is true, or when the Service Locator cannot find a service of the requested type or any type that can be assigned to the requested type with the matching key and Explicit is false.</exception>
+    /// <exception cref="System.KeyNotFoundException">Thrown when the Service Locator cannot find an a service of the requested type with a matching key and Explicit is true, or when the Service Locator cannot find a service of the requested type or any type that can be assigned to the requested type with the matching key and Explicit is false.</exception>
     public static T GetService<T>(object key) where T : class
     {
         var type = typeof(T);
@@ -163,7 +163,9 @@
         {
             if (!Explicit)
             {
-                var subTypeKey = Instance.services.Keys.FirstOrDefault(x => x.Item2.Equals(key) && type.IsAssignableFrom(x.Item1));
+                var subTypeKey = Instance.services.Keys.FirstOrDefault(x =>
+                    (key == null ? x.Item2 == null : key.Equals(x.Item2))
+                    && type.IsAssignableFrom(x.Item1));

                 if (subTypeKey != null)
                 {
@@ -171,7 +173,7 @@
                 }
             }

-            throw new InvalidOperationException(string.Format("Cannot get a value for type: {0} and key: {1}. That type has not been registered yet.", type, key));
+            throw new KeyNotFoundException(string.Format("Cannot get a value for type: {0} and key: {1}. That type has not been registered yet.", type, key));
         }

         return (T)Instance.services[dictKey];


Documentation

Documentation

--- SharpGMad/RealtimeAddon.cs
+++ SharpGMad/RealtimeAddon.cs
@@ -29,15 +29,47 @@
         public FileSystemWatcher Watcher;
     }

+    /// <summary>
+    /// Encapsulates an Addon and provides the extended "realtime" functionality over it.
+    /// </summary>
     class RealtimeAddon
     {
+        /// <summary>
+        /// The addon handled by the current RealtimeAddon instance.
+        /// </summary>
         public Addon OpenAddon { get; private set; }
+        /// <summary>
+        /// The file handle of the current open addon.
+        /// </summary>
         private FileStream AddonStream;
-        public string AddonPath { get { return AddonStream.Name;}}
-        public bool Modified;
-        public bool Pullable;
+        /// <summary>
+        /// Gets the file path of the addon on the local filesystem.
+        /// </summary>
+        public string AddonPath { get { return AddonStream.Name; } }
+        /// <summary>
+        /// Gets whether the current addon is modified (the state in memory differs from the state of the filestream).
+        /// </summary>
+        public bool Modified { get; private set; }
+        /// <summary>
+        /// Gets whether there are changed exported files.
+        /// </summary>
+        public bool Pullable { get; private set; }
+        /// <summary>
+        /// Contains the exported files.
+        /// </summary>
         public List<FileWatch> WatchedFiles { get; private set; }

+        /// <summary>
+        /// Loads the specified addon from the local filesystem and encapsulates it within a realtime instance.
+        /// </summary>
+        /// <param name="filename">The path to the file on the local filesystem.</param>
+        /// <returns>A RealtimeAddon instance.</returns>
+        /// <exception cref="FileNotFoundException">Happens if the specified file does not exist.</exception>
+        /// <exception cref="IOException">Thrown if there is a problem opening the specified file.</exception>
+        /// <exception cref="ReaderException">Thrown if the addon reader and parser encounters an error.</exception>
+        /// <exception cref="ArgumentException">Happens if a file with the same path is already added.</exception>
+        /// <exception cref="WhitelistException">There is a file prohibited from storing by the global whitelist.</exception>
+        /// <exception cref="IgnoredException">There is a file prohibited from storing by the addon's ignore list.</exception>
         static public RealtimeAddon Load(string filename)
         {
             if (!File.Exists(filename))
@@ -91,6 +123,13 @@
             return realtime;
         }

+        /// <summary>
+        /// Creates a new, empty addon and encapsulates it within a realtime instance.
+        /// </summary>
+        /// <param name="filename">The path of the addon file to create.</param>
+        /// <returns>A RealtimeAddon instance.</returns>
+        /// <exception cref="UnauthorizedAccessException">The specified file already exists on the local filesystem.</exception>
+        /// <exception cref="IOException">There was an error creating a specified file.</exception>
         static public RealtimeAddon New(string filename)
         {
             if (File.Exists(filename))
@@ -120,6 +159,9 @@
             return realtime;
         }

+        /// <summary>
+        /// Private constructor setting up references and default values.
+        /// </summary>
         private RealtimeAddon()
         {
             WatchedFiles = new List<FileWatch>();
@@ -127,6 +169,12 @@
             Pullable = false;
         }

+        /// <summary>
+        /// Creates the RealtimeAddon instance with the specified Addon to encapsulate and the FileStream pointing to the
+        /// local filesystem. This method cannot be called externally.
+        /// </summary>
+        /// <param name="addon">The addon to encapsulate.</param>
+        /// <param name="stream">The FileStream pointing to the GMA file on the local filesystem.</param>
         protected RealtimeAddon(Addon addon, FileStream stream)
             : this()
         {
@@ -134,6 +182,15 @@
             AddonStream = stream;
         }

+        /// <summary>
+        /// Adds the specified file from the local filesystem to the encapsulated addon.
+        /// </summary>
+        /// <param name="filename">The path of the file to add.</param>
+        /// <exception cref="FileNotFoundException">Thrown if the specified file does not exist.</exception>
+        /// <exception cref="IOException">Thrown if a problem happens with opening the file.</exception>
+        /// <exception cref="ArgumentException">Happens if a file with the same path is already added.</exception>
+        /// <exception cref="WhitelistException">The file is prohibited from storing by the global whitelist.</exception>
+        /// <exception cref="IgnoredException">The file is prohibited from storing by the addon's ignore list.</exception>
         public void AddFile(string filename)
         {
             if (!File.Exists(filename))
@@ -159,6 +216,14 @@
             AddFile(Whitelist.GetMatchingString(filename), bytes);
         }

+        /// <summary>
+        /// Adds an array of bytes to the encapsulated addon using the specified internal path.
+        /// </summary>
+        /// <param name="path">The path which the file should be added as.</param>
+        /// <param name="content">The array of bytes containing the actual content.</param>
+        /// <exception cref="ArgumentException">Happens if a file with the same path is already added.</exception>
+        /// <exception cref="WhitelistException">The file is prohibited from storing by the global whitelist.</exception>
+        /// <exception cref="IgnoredException">The file is prohibited from storing by the addon's ignore list.</exception>
         public void AddFile(string path, byte[] content)
         {
             try
@@ -181,6 +246,11 @@
             Modified = true;
         }

+        /// <summary>
+        /// Removes the specified file from the encapsulated addon.
+        /// </summary>
+        /// <param name="path">The path of the file.</param>
+        /// <exception cref="FileNotFoundException">Thrown if the specified file does not exist.</exception>
         public void RemoveFile(string path)
         {
             try
@@ -195,7 +265,16 @@
             Modified = true;
         }

-        public void ExtractFile(string path, string to)
+        /// <summary>
+        /// Extracts a file from the encapsulated addon and saves it on the local filesystem.
+        /// </summary>
+        /// <param name="path">The path of the file within the addon to extract.</param>
+        /// <param name="to">The path on the local filesystem where the file should be saved. If omitted,
+        /// the file will be extracted to the application's current working directory.</param>
+        /// <exception cref="FileNotFoundException">Thrown if the specified file does not exist within the addon.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown if a file already exists at the specified extract location.</exception>
+        /// <exception cref="IOException">Thrown if there was a problem creating the extracted file.</exception>
+        public void ExtractFile(string path, string to = null)
         {
             if (to == null || to == String.Empty)
             {
@@ -241,6 +320,16 @@
             extract.Dispose();
         }

+        /// <summary>
+        /// Saves the specified file on the local filesystem and sets up a notifier FileWatch object
+        /// to let the application keep track of the changes in the saved file.
+        /// </summary>
+        /// <param name="path">The path of the file within the addon to extract.</param>
+        /// <param name="to">The path on the local filesystem where the file should be saved. If omitted,
+        /// the file will be extracted to the application's current working directory.</param>
+        /// <exception cref="FileNotFoundException">Thrown if the specified file does not exist within the addon.</exception>
+        /// <exception cref="UnauthorizedAccessException">Thrown if a file already exists at the specified extract location.</exception>
+        /// <exception cref="IOException">Thrown if there was a problem creating the extracted file.</exception>
         public void ExportFile(string path, string to)
         {
             if (to == null || to == String.Empty)
@@ -287,6 +376,9 @@
             WatchedFiles.Add(watch);
         }

+        /// <summary>
+        /// Fires if an exported file is changed on the local filesystem.
+        /// </summary>
         private void fsw_Changed(object sender, FileSystemEventArgs e)
         {
             FileWatch watch = null;
@@ -314,6 +406,12 @@
             }
         }

+        /// <summary>
+        /// Deletes the export of the specified file from the local filesystem and stops watching the changes.
+        /// </summary>
+        /// <param name="filename">The path of the file within the addon to be dropped.</param>
+        /// <exception cref="FileNotFoundException">Thrown if the file does not exist within the addon.</exception>
+        /// <exception cref="IOException">Thrown if there was a problem deleting the file from the local filesystem.</exception>
         public void DropExport(string path)
         {
             FileWatch watch;
@@ -339,6 +437,12 @@
             }
         }

+        /// <summary>
+        /// Updates the encapsulated addon object's file entry with the changes of a previously exported file.
+        /// </summary>
+        /// <param name="path">The path of the file within the addon to pull the changes for.</param>
+        /// <exception cref="FileNotFoundException">Thrown if the specified path does not correspond to an export.</exception>
+        /// <exception cref="IOException">Thrown if there was a problem opening the exported file.</exception>
         public void Pull(string path)
         {
             FileWatch search = null;
@@ -392,6 +496,21 @@
             Modified = true; // But the addon itself is
         }

+        /// <summary>
+        /// Saves the changes of the encapsulated addon to its file stream.
+        /// </summary>
+        public void Save()
+        {
+            OpenAddon.Sort();
+            Writer.Create(OpenAddon, AddonStream);
+
+            Modified = false;
+        }
+
+        /// <summary>
+        /// Closes all connections of the current RealtimeAddon instance.
+        /// This does NOT save the changes of the encapsulated addon!
+        /// </summary>
         public void Close()
         {
             foreach (FileWatch watch in WatchedFiles)
@@ -407,12 +526,13 @@
             OpenAddon = null;
         }

-        public void Save()
-        {
-            OpenAddon.Sort();
-            Writer.Create(OpenAddon, AddonStream);
-
-            Modified = false;
+        /// <summary>
+        /// Helps the garbage collector free all resources managed by this instance.
+        /// Identical to calling Close();
+        /// </summary>
+        ~RealtimeAddon()
+        {
+            Close();
         }
     }
 }


Updates summary comments.

Updates summary comments.

Former-commit-id: 6792eca7cb217a67482bc083e65b38b6781123bc

--- Sharpy/Enums/StringType.cs
+++ Sharpy/Enums/StringType.cs
@@ -3,6 +3,7 @@
     ///     Is used as argument when filtering names
     /// </summary>
     public enum StringType {
+
         /// <summary>
         ///     Will give you back a random female first name.
         /// </summary>
@@ -14,7 +15,7 @@
         MaleFirstName,

         /// <summary>
-        ///     Will give you back a random male last name.
+        ///     Will give you back a random last name.
         /// </summary>
         LastName,

@@ -35,6 +36,7 @@

         /// <summary>
         ///     Will give a random string number. Based on the configuration of numbergenerator.
+        ///     Could be used as a phone number generator for example.
         /// </summary>
         Number
     }


Mac: Prevent NRE by falling back to executing assembly when detecting platform

--- Source/Eto.Mac/Platform.cs
+++ Source/Eto.Mac/Platform.cs
@@ -184,7 +184,8 @@
 		{
 			get
 			{
-				return Assembly.GetEntryAssembly().Location.StartsWith(NSBundle.MainBundle.BundlePath, StringComparison.Ordinal);
+				var assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
+				return assembly.Location.StartsWith(NSBundle.MainBundle.BundlePath, StringComparison.Ordinal);
 			}
 		}


This commit was pushed to a branch instead of master: This is good practice! This branch can be merged to master later on.

--- SouthSaxon/ProjectEuler.cs
+++ SouthSaxon/ProjectEuler.cs
@@ -6,7 +6,6 @@

 namespace SouthSaxon
 {
-    //TODO Add a git repository: See the solution browser on the write? Below it are these little tabs.
     public class ProjectEuler
     {
         /// <summary>
@@ -39,5 +38,7 @@
                 i++;
             }
         }
+
+        //Add more functions here.
     }
 }


regular backup

regular backup

--- SteamBot/KeyUserHandler.cs
+++ SteamBot/KeyUserHandler.cs
@@ -18,8 +18,8 @@
 	{
 		private const string BotVersion = "3.2.5";
 		public TF2Value UserMetalAdded, NonTradeInventoryMetal, InventoryMetal, BotMetalAdded, ExcessRefined, KeysToScrap, AdditionalRefined, ChangeAdded, LeftoverMetal;
-		public static TF2Value SellPricePerKey = TF2Value.FromRef(20.55); //high
-		public static TF2Value BuyPricePerKey = TF2Value.FromRef(20.11); //low
+		public static TF2Value SellPricePerKey = TF2Value.FromRef(20.77); //high
+		public static TF2Value BuyPricePerKey = TF2Value.FromRef(20.33); //low

         int KeysCanBuy, NonTradeKeysCanBuy, ValidateMetaltoKey, PreviousKeys, UserKeysAdded, BotKeysAdded, InventoryKeys, NonTradeInventoryKeys, IgnoringBot, PayAttention, ScamAttempt, NonTradeScrap, Scrap, Crates, KeyNumber, ScrapAdded, NonTradeReclaimed, Reclaimed, ReclaimedAdded, NonTradeRefined, Refined, RefinedAdded, InvalidItem, NumKeys, TradeFrequency;
         double Item;


regular backup

regular backup

--- SteamBot/KeyUserHandler.cs
+++ SteamBot/KeyUserHandler.cs
@@ -18,8 +18,8 @@
 	{
 		private const string BotVersion = "3.2.4";
 		public TF2Value UserMetalAdded, NonTradeInventoryMetal, InventoryMetal, BotMetalAdded, ExcessRefined, KeysToScrap, AdditionalRefined, ChangeAdded, LeftoverMetal;
-		public static TF2Value SellPricePerKey = TF2Value.FromRef(18.77); //high
-		public static TF2Value BuyPricePerKey = TF2Value.FromRef(18.33); //low
+		public static TF2Value SellPricePerKey = TF2Value.FromRef(18.88); //high
+		public static TF2Value BuyPricePerKey = TF2Value.FromRef(18.44); //low

         int KeysCanBuy, NonTradeKeysCanBuy, ValidateMetaltoKey, PreviousKeys, UserKeysAdded, BotKeysAdded, InventoryKeys, NonTradeInventoryKeys, IgnoringBot, ScamAttempt, NonTradeScrap, Scrap, Crates, KeyNumber, ScrapAdded, NonTradeReclaimed, Reclaimed, ReclaimedAdded, NonTradeRefined, Refined, RefinedAdded, InvalidItem, NumKeys, TradeFrequency;
         double Item;


Peer pressure.

Peer pressure.

--- SteamIrcBot/Steam/Steam.cs
+++ SteamIrcBot/Steam/Steam.cs
@@ -100,9 +100,20 @@
         {
             JobManager.Start();

-            Log.WriteInfo( "Steam", "Connecting..." );
-
-            nextConnect = DateTime.Now;
+            Log.WriteInfo( "Steam", "Retrieving servers..." );
+
+            // zzz
+            SteamDirectory.Initialize().ContinueWith( t =>
+            {
+                if (t.IsFaulted)
+                {
+                    Log.WriteInfo( "Steam", "Unable to retrieve servers: {0}", t.Exception );
+                }
+
+                Log.WriteInfo( "Steam", "Connecting..." );
+
+                nextConnect = DateTime.Now;
+            } );
         }

         public void Disconnect()


more debuggin help to bootstrap :-)

more debuggin help to bootstrap :-)

--- Oak/BootStrap.cs
+++ Oak/BootStrap.cs
@@ -4,6 +4,8 @@
 using System.Web;
 using System.Web.Mvc;
 using System.Threading;
+using System.Data.SqlClient;
+using System.Configuration;

 namespace Oak
 {
@@ -20,45 +22,121 @@
         [ThreadStatic]
         public static List<SqlQueryLog> SqlQueries = new List<SqlQueryLog>();

+        public static List<Recommendation> Recommendations = new List<Recommendation>();
+
         public static void Init(HttpApplication mvcApplication)
         {
-            mvcApplication.EndRequest += new EventHandler(mvcApplication_EndRequest);
-
-            if (IsInDebugMode())
+            if (!IsInDebugMode()) return;
+
+            Recommendations = new List<Recommendation>
             {
-                Massive.DynamicRepository.WriteDevLog = true;
-
-                Massive.DynamicRepository.LogSql = (sender, query, args) =>
-                {
-                    lock (Massive.DynamicRepository.ConsoleLogLock)
-                    {
-                        if (SqlQueries == null) SqlQueries = new List<SqlQueryLog>();
-
-                        SqlQueries.Add(
-                            new SqlQueryLog(sender,
-                                query,
-                                Environment.StackTrace,
-                                Thread.CurrentThread.ManagedThreadId,
-                                args));
-                    }
-                };
-            }
-
-            mvcApplication.Error += (sender, e) =>
+                new CreateDbRecommendation(),
+                new CreateTableRecommendation(),
+                new FirstTimeRecommendation(),
+                new NoDefinitionOnGeminiRecommendation(),
+                new NoDefinitionOnDerivedGeminiRecommendation(),
+                new InvalidColumnRecommendation()
+            };
+
+            mvcApplication.EndRequest += PrintInefficientQueries;
+
+            Massive.DynamicRepository.WriteDevLog = true;
+
+            Massive.DynamicRepository.LogSql = (sender, query, args) =>
             {
                 lock (Massive.DynamicRepository.ConsoleLogLock)
                 {
-                    var error = mvcApplication.Server.GetLastError().ToString();
-                    Console.ForegroundColor = ConsoleColor.Red;
-                    Console.Out.WriteLine("======== Exception Occurred ==========");
-                    Console.Out.WriteLine(Bullet.ScrubStackTrace(error));
-                    Console.Out.WriteLine("====================================\n\n");
-                    Console.ResetColor();
+                    if (SqlQueries == null) SqlQueries = new List<SqlQueryLog>();
+
+                    SqlQueries.Add(
+                        new SqlQueryLog(sender,
+                            query,
+                            Environment.StackTrace,
+                            Thread.CurrentThread.ManagedThreadId,
+                            args));
                 }
             };
-        }
-
-        static void mvcApplication_EndRequest(object sender, EventArgs e)
+
+            mvcApplication.Error += WriteHelpfulError(mvcApplication);
+        }
+
+        private static EventHandler WriteHelpfulError(HttpApplication mvcApplication)
+        {
+            return (sender, e) =>
+            {
+                lock (Massive.DynamicRepository.ConsoleLogLock)
+                {
+                    var lastError = mvcApplication.Server.GetLastError();
+                    var errorText = lastError.ToString();
+                    WriteToIISExpressConsole(errorText);
+                    ReplaceExceptionWithRecommendationIfApplicable(mvcApplication, lastError);
+                }
+            };
+        }
+
+        private static void WriteToIISExpressConsole(string errorText)
+        {
+            Console.ForegroundColor = ConsoleColor.Red;
+            Console.Out.WriteLine("======== Exception Occurred ==========");
+            Console.Out.WriteLine(Bullet.ScrubStackTrace(errorText));
+            Console.Out.WriteLine("====================================\n\n");
+            Console.ResetColor();
+        }
+
+        private static void ReplaceExceptionWithRecommendationIfApplicable(HttpApplication mvcApplication, Exception error)
+        {
+            var applicable = Recommendations.Where(s => s.CanRecommend(error));
+
+            List<string> recos = new List<string>();
+
+            foreach (var reco in applicable)
+            {
+                recos.Add(OriginalStackTrace(error));
+
+                recos.Add(reco.GetRecommendation(error));
+            }
+
+            if (recos.Any()) WriteRecommendation(mvcApplication, recos);
+        }
+
+        private static void WriteRecommendation(HttpApplication mvcApplication, List<string> applicatableRecommendations)
+        {
+            var recommendationString = @"
+
+
+    <title>Oak Help</title>
+
+
+
+
+
An error was thrown and Oak has a recommendation:

+
+    {recommendations}
+
+    recommendations are brought to you by Oak\Boostrap.cs.
+
+";
+            mvcApplication.Server.ClearError();
+            mvcApplication.Response.Write(
+                recommendationString
+                    .Replace("{recommendations}", string.Join("", applicatableRecommendations)));
+        }
+
+        private static string OriginalStackTrace(Exception error)
+        {
+            return @"
+

+    Here is original error was with some noise taken out (you can also see this error in the IISExpress console):
+
{message}

+    stacktrace:
+
{scrubbedStackTrace}

+
".Replace("{message}", error.Message)
+       .Replace("{scrubbedStackTrace}", Bullet.ScrubStackTrace(error.ToString()));
+        }
+
+        static void PrintInefficientQueries(object sender, EventArgs e)
         {
             SqlQueries = SqlQueries ?? new List<SqlQueryLog>();

@@ -76,7 +154,7 @@

                     Console.ForegroundColor = ConsoleColor.DarkGreen;
                     Console.Out.WriteLine("====================================\n\n");
-                    Console.ResetColor();
+                    Console.ResetColor();
                 }

                 var queries = Bullet.InefficientQueries(SqlQueries);
@@ -85,7 +163,7 @@
                 {
                     Console.ForegroundColor = ConsoleColor.Yellow;

-                    if(s.Reason.Contains("may not be inefficient")) Console.ForegroundColor = ConsoleColor.DarkYellow;
+                    if (s.Reason.Contains("may not be inefficient")) Console.ForegroundColor = ConsoleColor.DarkYellow;

                     Console.Out.WriteLine("==== Possible Inefficient Query ====");
                     Console.Out.WriteLine("For thread: " + s.ThreadId);
@@ -109,5 +187,459 @@
             return System.Diagnostics.Process.GetCurrentProcess().ProcessName == "iisexpress";
         }
     }
-}
-
+
+    public class Recommendation
+    {
+        public virtual bool CanRecommend(Exception e) { return false; }
+
+        public virtual string GetRecommendation(Exception e) { return ""; }
+    }
+
+    public class CreateDbRecommendation : Recommendation
+    {
+        public override bool CanRecommend(Exception e)
+        {
+            return e is SqlException && e.ToString().Contains("Cannot open database");
+        }
+
+        public override string GetRecommendation(Exception e)
+        {
+            var text = e.ToString();
+
+            return @"
+
Create a database

+    You need to create the database that will work with this connection string:
+
{connectionString}

+
+
+".Replace("{connectionString}", new ConnectionProfile().ConnectionString)
+ .Replace("{scrubbedStackTrace}", Bullet.ScrubStackTrace(text));
+        }
+    }
+
+    public class CreateTableRecommendation : Recommendation
+    {
+        public override bool CanRecommend(Exception e)
+        {
+            return e is SqlException && e.ToString().Contains("Invalid object name");
+        }
+
+        public override string GetRecommendation(Exception e)
+        {
+            return @"
+
Use SeedController to create table

+It looks like you are trying to access an object in the database that doesn't exist.
+Go to Controller\SeedController.cs and add a method to the Schema class to generate your table (keep in mind
+that the default convention for Oak is a pluralized table name).

+Here is an example of creating this schema (let's say I want to create a table called Blogs):
+

+    public class Schema //this class exists in SeedController.cs
+    {
+        public IEnumerable<Func<dynamic>> Scripts()
+        {
+            //this is just an example, your table name may be different
+            yield return CreateBlogsTable; //return just the pointer to the function
+        }
+
+        public string CreateBlogsTable() //here is the function definition
+        {
+            //this is an example, your table name may be different
+            //for more information on schema generation check out the Oak wiki
+            return Seed.CreateTable(""Blogs"",
+                Seed.Id(),
+                new { Name = ""nvarchar(255)"" },
+                new { Body = ""nvarchar(max)"" }
+            );
+        }
+    }
+
+

+
+After adding the function to create your table.  Run this command to execute the script:
rake reset

+
+You can see what the script looks like by running this command:
rake export

+
+
Use SeedController to create Sample Entries too

+
+I would also recommend looking at the SampleEntries() method in Schema.  You can use that to generate sample data.  For example:
+

+public void SampleEntries()
+{
+    //here are a few sample entries
+    //for more information on sample entries check out the Oak wiki
+    new
+    {
+        Name = ""Hello World"",
+        Body = ""Lorem Ipsum""
+    }.InsertInto(""Blogs"");
+
+    new
+    {
+        Name = ""Hello World 2"",
+        Body = ""Lorem Ipsum 2""
+    }.InsertInto(""Blogs"");
+}
+

+
+You can then run this command to purge your database and regen it with sample data:
rake sample
";
+        }
+    }
+
+    public class FirstTimeRecommendation : Recommendation
+    {
+        public override bool CanRecommend(Exception e)
+        {
+            return e.ToString().Contains("Views/Home/Index");
+        }
+
+        public override string GetRecommendation(Exception e)
+        {
+            return @"
+
Hello World from Oak

+This is probably the first time you've run Oak for this solution. Be sure to visit
+the website at some point and take a look at the screencasts and sample apps (STRONGLY recommended):
+Oak's Github Page.
+Here is something you can put in your Home/Index controller action and view (a simple ""Hello World""):
+

+========== inside HomeController.cs ===========
+//add the following using statements
+using Massive;
+using Oak;
+
+//here is the hello world implementation
+public class Blogs : DynamicRepository { }
+
+public class Blog : DynamicModel
+{
+    public Blog() { }
+
+    public Blog(object dto) : base(dto) { }
+}
+
+public class HomeController : Controller
+{
+    Blogs blogs = new Blogs();
+
+    public ActionResult Index()
+    {
+        ViewBag.Blogs = blogs.All();
+        return View();
+    }
+
+    [HttpPost]
+    public ActionResult Index(dynamic @params)
+    {
+        dynamic blog = new Blog(@params);
+
+        if(!blog.IsValid())
+        {
+            ViewBag.Flash = blog.FirstError();
+            return Index();
+        }
+
+        blogs.Insert(blog);
+        return RedirectToAction(""Index"");
+    }
+
+    [HttpPost]
+    public ActionResult Comments(dynamic @params)
+    {
+        dynamic blog = blogs.Single(@params.BlogId);
+
+        blog.AddComment(@params);
+
+        return RedirectToAction(""Index"");
+    }
+}
+
+//========== inside Home/Index.cshtml ==========
+@{
+    ViewBag.Title = ""Index"";
+}
+
+<h2>Hello World</h2>
+@if (ViewBag.Flash != null)
+{
+    <div style=""color:Red"">@ViewBag.Flash</div>
+}
+
+@using (Html.BeginForm())
+{
+    @Html.TextBox(""Name"")
+    <input type=""submit"" value=""create"" />
+}
+
+@foreach (var blog in ViewBag.Blogs)
+{
+    <div>
+        <pre>@blog</pre>
+        <br />
+        @using (Html.BeginForm(""Comments"", ""Home"", FormMethod.Post))
+        {
+            @Html.Hidden(""BlogId"", blog.Id.ToString() as string)
+            @Html.TextBox(""Body"")
+            <input type=""submit"" value=""post comment"" />
+        }
+        <br />
+        <pre>@blog.Comments()</pre>
+    </div>
+}
+
";
+        }
+    }
+
+    public class NoDefinitionOnGeminiRecommendation : Recommendation
+    {
+        public override bool CanRecommend(Exception e)
+        {
+            return e.ToString().Contains("'Oak.Gemini' does not contain a definition for");
+        }
+
+        public override string GetRecommendation(Exception e)
+        {
+            return @"
+
Inspect the object or setup a database Projection

+
+
To inspect the object

+The gemini object has quite a few introspection methods
+to help determine what's inside a dynamic object.  Calling the ToString() method will give you a
+nicely formatted string.  In the Immediate Window (Ctrl + Alt + i) you can type the follow to get
+the nicely formatted output (using our Blog example):
ViewBag.Blogs.ToString(),nq
 If you are running this
+through specwatchr/sidekick, you'll need to attach the debugger to use the Immediate Window.
+You can do so by add the following line in any controller action and refreshing the page:
+

+public class HomeController : Controller
+{
+    Blogs blogs = new Blogs();
+
+    public ActionResult Index()
+    {
+        ViewBag.Blogs = blogs.All();
+
+        //add this line to hook up the debugger
+        //and then you can use type ViewBag.Blogs.ToString(),nq
+        //in the Immediate Window (Ctrl + Alt + i)...
+        //a Visual Studio dialog will pop up (it may pop up
+        //behind the this window, so keep a look out for it in
+        //the task bar).  You can also just manually attach to the
+        //IISExpress process using the Tools->Attach To Process menu item.
+        System.Diagnostics.Debugger.Launch();
+
+        return View();
+    }
+}
+

+
+
Adding a database projection

+By default dynamic repository returns a ""typeless"" dynamic object (called gemini).  You can return
+a dynamic type by doing the following (again using our Blog example):
+

+//our Hello World example
+public class Blogs : DynamicRepository
+{
+    public Blogs()
+    {
+        Projection = dto => new Blog(dto); //this is a projection
+    }
+}
+
+public class Blog : DynamicModel
+{
+    public Blog() { }
+
+    public Blog(object dto) : base(dto) { }
+}
+

+
+With the projection in place, you will now get back a typed object (as opposed to just a Gemini). Any query
+that is executed from a projected dynamic repository (in this case Blogs) will go through this mapping.
+";
+        }
+    }
+
+    public class NoDefinitionOnDerivedGeminiRecommendation : Recommendation
+    {
+        public override bool CanRecommend(Exception e)
+        {
+            if (!e.Message.Contains("does not contain a definition for")) return false;
+
+            if (e.Message.Contains("Gemini")) return false;
+
+            return true;
+        }
+
+        public override string GetRecommendation(Exception e)
+        {
+            var tokens = e.Message.Split(new[] { "'" }, StringSplitOptions.RemoveEmptyEntries);
+
+            var type = tokens.First();
+
+            var method = tokens.Last();
+
+            return @"
+
Declare a method

+It looks like you are trying to access a method [{method}] on type [{type}] that doesn't exist.
+Here are a few ways methods are added to a dynamic object.
+

+
Declaring a method through Associations

+
Declaring a method through Validations

+
Declaring a method on class directly

+

+
+
Declaring a method through Associations

+If you are attempting to retrieve a relationship on an object from the database.  You need to
+define an Association.  Here is an example of an association, a Blog has many Comments:
+
+

+//our Hello World example
+public class Blogs : DynamicRepository
+{
+    public Blogs()
+    {
+        Projection = dto => new Blog(dto); //this is a projection
+    }
+}
+
+//declare the comments repository
+public class Comments : DynamicRepository { }
+
+public class Blog : DynamicModel
+{
+    //initialize comments
+    Comments comments = new Comments();
+
+    public Blog() { }
+
+    public Blog(object dto) : base(dto) { }
+
+    //add an Associates method to add the Comments() method
+    IEnumerable<dynamic> Associates()
+    {
+        //and define the association
+        //for othere examples of associations check out the Oak wiki
+        yield return new HasMany(comments);
+    }
+}
+

+
+In the case of the Hello World code base, this is how you would access Comments();
+
+
Declaring a method through Validations

+If you are performing validations on your objects you can add validation methods through
+Oak.  Here is an example of a validation, Blog names must be unique:
+

+public class Blog : DynamicModel
+{
+    //initialize blogs
+    Blogs blogs = new Blogs();
+
+    public Blog() { }
+
+    public Blog(object dto) : base(dto) { }
+
+    //add a Validates method to add the IsValid() method
+    IEnumerable<dynamic> Validates()
+    {
+        //and define the association
+        //for othere examples of validations check out the Oak wiki
+        yield return new Uniqueness(""Name"", blogs);
+    }
+}
+

+
+
Declaring a method on class directly

+These classes can be treated as any other classes.  You can add methods on them directly.  The cool thing however
+is you can add methods on these classes as implicitly private methods and they will be accessible publicly. Methods
+that have any of the following signatures are considered public automatically:
+

+
void SomeMethod()

+
void SomeMethodWithParam(dynamic args)

+
dynamic SomeFunction()

+
dynamic SomeFunctionWithParam(dynamic args)

+

+Here is an example of a method where a blog can add a comment to itself
+

+public class Blog : DynamicModel
+{
+    Comments comments = new Comments();
+
+    public Blog() { }
+
+    public Blog(object dto) : base(dto) { }
+
+    //notice that the method is defined implicitly
+    void AddComment(dynamic comment)
+    {
+        //ignore addition if the body is empty
+        if(string.IsNullOrEmpty(comment.Body)) return;
+
+        //any dynamic property on this instance can be accessed through the ""_"" property
+        var commentToSave = _.Comments().New(comment);
+
+        comments.Insert(commentToSave);
+    }
+}
+

+
Side Note: Testing

+The nifty thing about defining dynamic methods implicitly is that they an be redefined in testing like so:
+

+bool commentAdded = false;
+dynamic blog = new Blog(new { Name = ""Some Name"" });
+blog.AddComment =
+    new DynamicFunction(d =>
+    {
+        commentAdded = true;
+        return null;
+    });
+
+blog.AddComment();
+
+Assert.IsTrue(commentAdded);
+

+".Replace("{method}", method)
+ .Replace("{type}", type);
+        }
+
+    }
+
+    public class InvalidColumnRecommendation : Recommendation
+    {
+        public override bool CanRecommend(Exception e)
+        {
+            return e.Message.Contains("Invalid column name");
+        }
+
+        public override string GetRecommendation(Exception e)
+        {
+            return @"
+
Use SeedController to add a column

+Seed controller can also be used to add columns.  It's important to not change existing SeedController methods.  Just
+add new ones.  Here is an example of adding a BlogId column to a Comments table:
+

+    public class Schema //this class exists in SeedController.cs
+    {
+        public IEnumerable<Func<dynamic>> Scripts()
+        {
+            [.... other methods .....]
+            yield return AddBlogIdToComments; //return just the pointer to the function
+        }
+
+        public string AddBlogIdToComments() //here is the function definition
+        {
+            //this is an example, your table name may be different
+            //for more information on schema generation check out the Oak wiki
+            return Seed.AddColumns(""Comments"",
+                new { BlogId = ""int"", ForeignKey = ""Blogs(Id)"" }
+            );
+        }
+    }
+

+
+After adding the function to create your table.  Run this command to execute the script:
rake reset

+
+You can see what the script looks like by running this command:
rake export

+
+";
+        }
+    }
+}


Add function to render an html form for  Ogone

--- Ogone/Request.cs
+++ Ogone/Request.cs
@@ -366,6 +366,23 @@
             return result;
         }

+        public string RenderHtmlForm(string submitButtonText)
+        {
+            var result = new StringBuilder();
+
+            result.AppendLine("<form action=\"" + this.OgoneUrl + "\" method=\"post\">");
+
+            foreach (var item in this.GetAllParameters())
+            {
+                result.AppendLine("\t<input type=\"hidden\" name=\"" + item.Key + "\" value=\"" + item.Value + "\" />");
+            }
+
+            result.AppendLine("\t<input type=\"submit\" value=\"" + submitButtonText + "\" />");
+            result.AppendLine("</form>");
+
+
+            return result.ToString();
+        }
     }

 }


no longer a confirm on this page

no longer a confirm on this page


Formatting.

Formatting.


Update color palette and drawing style for trajectory chart


Fixed icon generation so that it's really unlikely that a puzzle will be unsolvable


Fixed issue with multiple do work when user clicked on the Export button again

--- RepairShoprApps/MainForm.cs
+++ RepairShoprApps/MainForm.cs
@@ -168,6 +168,11 @@
             if (bgw == null)
             {
                 bgw = new BackgroundWorker();
+                bgw.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
+                bgw.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
+                bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
+                bgw.WorkerReportsProgress = true;
+                bgw.WorkerSupportsCancellation = true;
             }
             _exportTicket = checkBoxExportTicket.Checked;
             _exportCustomer = checkBoxExportCustomer.Checked;
@@ -182,12 +187,8 @@
             // int.TryParse(textBoxTicketNo.Text.Trim(),out globalTicketNumber);
             progressBar1.Value = 0;
             progressBar1.Visible = true;
-            progressBar1.Enabled = true;
-            bgw.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
-            bgw.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
-            bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
-            bgw.WorkerReportsProgress = true;
-            bgw.WorkerSupportsCancellation = true;
+            progressBar1.Enabled = true;
+
             bgw.RunWorkerAsync();
             buttonStop.Enabled = true;
         }


Added static keyword to the clear database class declaration.


Cleaned up the UI

Cleaned up the UI

, printing time period in center of screen

--- PendulumTrack.cs
+++ PendulumTrack.cs
@@ -1,8 +1,6 @@
 // This script has to be attached to image target that we want to track.

-
-using UnityEngine;
-using System.Collections;
+sing System.Collections;

 public class TargetImageCoords : MonoBehaviour {

@@ -16,6 +14,7 @@
 	private float oldTime = 0f;
 	public float period = 0f;
 	private float newXAbs = 0f;
+	public float midpointX = 0f;

 	// Use this for initialization
 	void Start () {
@@ -28,71 +27,86 @@
 		{
 			Debug.Log ("ImageTargetBehaviour not found ");
 		}
-		// adding co-routine here so that it doesn't get called multiple times, do not put this in update function
 		StartCoroutine (TimeKeep());

 	}

-	// Update is called once per frame
-	//FixedUpdate makes sure that the loop takes fixed amount of time to run, this is to make sure that we get
-	//reliable period value every time fixedupdate runs.
-	void FixedUpdate () {
+	// Update is called once per frame
+	void FixedUpdate ()
+	{
 				if (mImageTargetBehaviour == null) {
 						Debug.Log ("ImageTargetBehaviour not found");
 						return;
-				}
+				}
+
+						Vector2 targetSize = mImageTargetBehaviour.GetSize ();
+						float targetAspect = targetSize.x / targetSize.y;

-				Vector2 targetSize = mImageTargetBehaviour.GetSize ();
-				float targetAspect = targetSize.x / targetSize.y;
+						// We define a point in the target local reference
+						// we take the bottom-left corner of the target,
+						// just as an example
+						// Note: the target reference plane in Unity is X-Z,
+						// while Y is the normal direction to the target plane
+						Vector3 pointOnTarget = new Vector3 (-0.5f, 0, -0.5f / targetAspect);

-				// We define a point in the target local reference
-				// we take the bottom-left corner of the target,
-				// just as an example
-				// Note: the target reference plane in Unity is X-Z,
-				// while Y is the normal direction to the target plane
-				Vector3 pointOnTarget = new Vector3 (-0.5f, 0, -0.5f / targetAspect);
+						// We convert the local point to world coordinates
+						Vector3 targetPointInWorldRef = transform.TransformPoint (pointOnTarget);

-				// We convert the local point to world coordinates
-				Vector3 targetPointInWorldRef = transform.TransformPoint (pointOnTarget);
-
-				// We project the world coordinates to screen coords (pixels)
-				Vector3 screenPoint = Camera.main.WorldToScreenPoint (targetPointInWorldRef);
-
-				//Debug.Log ("target point in screen coords: " + screenPoint.x + ", " + screenPoint.y);
-				newXAbs = XAbs;
-				XAbs = Mathf.Abs (screenPoint.x);
-				YAbs = Mathf.Abs (screenPoint.y);
-				if (XAbs > newXAbs) {
-						TimeKeep ();
-				}
+						// We project the world coordinates to screen coords (pixels)
+						Vector3 screenPoint = Camera.main.WorldToScreenPoint (targetPointInWorldRef);
+
+						newXAbs = XAbs;
+						XAbs = Mathf.Abs (screenPoint.x);
+						YAbs = Mathf.Abs (screenPoint.y);
+

-				//Debug.Log("Abs Value is:" + XAbs + "," + YAbs);
-        // Calculate maximum X
-				XMax = Mathf.Max (XAbs, XMax);
+						//Debug.Log("Abs Value is:" + XAbs + "," + YAbs);

-				XMin = Mathf.Min (XAbs, XMin);
-				Vector3 ScreenPointMax = new Vector3 (XMax, 0f, YMax);
-				YMax = Mathf.Max (YAbs, YMax);
+						XMax = Mathf.Max (XAbs, XMax);
+						//midpointX = Screen.width / 2;

-		}
+
+
+						XMin = Mathf.Min (XAbs, XMin);
+						Vector3 ScreenPointMax = new Vector3 (XMax, 0f, YMax);
+						YMax = Mathf.Max (YAbs, YMax);
+
+
+
+
+
+						//Debug.Log ("Maximum between x and y " + XMax + "," + YMax + " Min X is: " + XMin);
+						//GameObject sphere = GameObject.CreatePrimitive (PrimitiveType.Sphere);
+						//sphere.transform.position = new Vector3 (XMax, 1F, YMax);
+						//sphere.transform.localScale = new Vector3(
+
+
+	}

 	void OnGUI()
 	{
-	// outputting the variables on screen
-		GUI.backgroundColor = Color.blue;
+
+		GUIStyle style = new GUIStyle ();
+		style.fontSize = 30;
+		GUI.color = Color.green;
+		//style.font.material.color = Color.green;
+		//GUI.contentColor = Color.green;
+
+
 		GUI.Label(new Rect(10, 70, 100, 80), "Maximum X:" +XMax.ToString());
 		GUI.Label (new Rect (10, 100, 100, 80), "Minimum X:" + XMin.ToString ());
 		GUI.Label (new Rect (10, 130, 100, 80), "Maximum Y:" + YMax.ToString ());
 		GUI.Label (new Rect (10, 180, 100, 80), "timestart: " + newTime.ToString ());
-		GUI.Label (new Rect (10, 220, 100, 80), "Time Period " + period.ToString ());
+		GUI.Box (new Rect (100, 70, 100, 80), "Time Period:  " + period.ToString (), style);
 		GUI.Label (new Rect (10, 250, 100, 80), "oldtime: " + oldTime.ToString ());
 		GUI.Label (new Rect (10, 10, 100, 80), "Current Position X:" + XAbs.ToString ());
 		GUI.Label (new Rect (10, 40, 100, 80), "Current Position Y:" + YAbs.ToString ());

 	}
+	//float x = 0f;

 	IEnumerator TimeKeep()
 	{
@@ -103,16 +117,18 @@
 			Debug.Log (" NEW: " + newTime);
 			//Debug.Log ("old period:" + period);
 			period = (newTime - oldTime);
+			//XMax = 0f;

 		//Debug.Log ("new period:" + period);

 		}
-		//delay is important to reject noisy values around XMax
-		yield return new WaitForSeconds (2F);
-		//To call start co routine again, hence timekeep() is looped.
+
+		yield return new WaitForSeconds (1F);
 		StartCoroutine (TimeKeep());
+		//XMax = Mathf.NegativeInfinity;
+
 	}


added elaborate comments

added elaborate comments

--- PendulumTrack.cs
+++ PendulumTrack.cs
@@ -1,3 +1,6 @@
+// This script has to be attached to image target that we want to track.
+
+
 using UnityEngine;
 using System.Collections;


Made BitSet.Clone virtual.

Made BitSet.Clone virtual.


Add methods:ToReadOnlyCollection,ToReadOnlyList


Fix regression in CCLabelBMFont where labels were not showing up correctly.

--- src/label_nodes/CCLabelBMFont.cs
+++ src/label_nodes/CCLabelBMFont.cs
@@ -20,15 +20,9 @@
         protected string labelText = string.Empty;
         protected CCPoint ImageOffset { get; set; }
         protected CCSize labelDimensions;
-        protected CCSprite m_pReusedChar;
+        protected CCSprite reusedChar;
         protected bool IsDirty { get; set; }

-        //        protected byte displayedOpacity = 255;
-        //        protected byte realOpacity = 255;
-        //        protected CCColor3B displayedColor = CCColor3B.White;
-        //        protected CCColor3B realColor = CCColor3B.White;
-        //        protected bool isColorCascaded = true;
-        //        protected bool isOpacityCascaded = true;
         protected bool isColorModifiedByOpacity = false;

         public override CCPoint AnchorPoint
@@ -294,9 +288,9 @@

             ImageOffset = imageOffset;

-            m_pReusedChar = new CCSprite(TextureAtlas.Texture);
-            m_pReusedChar.ContentSize = dimensions;
-            m_pReusedChar.BatchNode = this;
+            reusedChar = new CCSprite(TextureAtlas.Texture);
+            reusedChar.ContentSize = dimensions;
+            reusedChar.BatchNode = this;

             SetString(theString, true);
         }
@@ -395,7 +389,7 @@

             if (String.IsNullOrEmpty(labelText))
             {
-                return;
+                return;
             }

             int stringLen = labelText.Length;
@@ -456,8 +450,8 @@
                 fontCharTextureRect.Origin.X += ImageOffset.X;
                 fontCharTextureRect.Origin.Y += ImageOffset.Y;

-                var ccs = ConvertToWorldspace(fontCharTextureRect);
-                fontCharContentSize = ccs.Size; //Layer.ScreenToWorldspace(fontCharTextureRect.Size);
+                var ctwRect = ConvertToWorldspace(fontCharTextureRect);
+                fontCharContentSize = ctwRect.Size;

                 CCSprite fontChar;

@@ -472,6 +466,7 @@
                     fontChar.IsTextureRectRotated = false;
                     fontChar.ContentSize = fontCharContentSize;
                     fontChar.TextureRectInPixels = fontCharTextureRect;
+
                 }
                 else
                 {
@@ -501,6 +496,10 @@
                     fontChar.UpdateDisplayedOpacity(DisplayedOpacity);
                 }

+                // updating previous sprite
+                //fontChar.SetTextureRect(rect, false, rect.Size);
+                //fontChar.ContentSize = fontCharContentSize;
+                //fontChar.TextureRectInPixels = fontCharTextureRect;
                 // See issue 1343. cast( signed short + unsigned integer ) == unsigned integer (sign is lost!)
                 int yOffset = FontConfiguration.CommonHeight - fontDef.YOffset;

@@ -509,9 +508,8 @@
                         (float) nextFontPositionX + fontDef.XOffset + fontDef.Subrect.Size.Width * 0.5f + kerningAmount,
                         (float) nextFontPositionY + yOffset - fontCharTextureRect.Size.Height * 0.5f);

-                var pp = ConvertToWorldspace(fontPos);
-//                var pppp = Layer.ScreenToWorldspace(fontPos);
-                fontChar.Position = pp; // ConvertToWorldspace(fontPos);
+                var ctw = ConvertToWorldspace(fontPos);
+                fontChar.Position = ctw;

                 // update kerning
                 nextFontPositionX += fontDef.XAdvance + kerningAmount;
@@ -534,8 +532,75 @@
             {
                 tmpSize.Width = longestLine;
             }
+
             tmpSize.Height = totalHeight;
             var tmpDimensions = labelDimensions;
+            tmpSize.Height = totalHeight;
+
+            labelDimensions = new CCSize(
+                labelDimensions.Width > 0 ? labelDimensions.Width : tmpSize.Width,
+                labelDimensions.Height > 0 ? labelDimensions.Height : tmpSize.Height
+            );
+
+
+            anchorPointInPoints = new CCPoint(labelDimensions.Width * AnchorPoint.X, labelDimensions.Height * AnchorPoint.Y);
+            labelDimensions = tmpDimensions;
+
+            UpdatePositionTransform();
+        }
+
+
+        private void UpdatePositionTransform()
+        {
+            // Translate values
+            float x = Position.X;
+            float y = Position.Y;
+
+            if (IgnoreAnchorPointForPosition)
+            {
+                x += anchorPointInPoints.X;
+                y += anchorPointInPoints.Y;
+            }
+
+            // Rotation values
+            // Change rotation code to handle X and Y
+            // If we skew with the exact same value for both x and y then we're simply just rotating
+            float cx = 1, sx = 0, cy = 1, sy = 0;
+            if (RotationX != 0 || RotationY != 0)
+            {
+                float radiansX = -CCMacros.CCDegreesToRadians(RotationX);
+                float radiansY = -CCMacros.CCDegreesToRadians(RotationY);
+                cx = (float)Math.Cos(radiansX);
+                sx = (float)Math.Sin(radiansX);
+                cy = (float)Math.Cos(radiansY);
+                sy = (float)Math.Sin(radiansY);
+            }
+
+            bool needsSkewMatrix = (SkewX != 0f || SkewY != 0f);
+
+            // optimization:
+            // inline anchor point calculation if skew is not needed
+            if (!needsSkewMatrix && !anchorPointInPoints.Equals(CCPoint.Zero))
+            {
+                x += cy * -anchorPointInPoints.X * ScaleX + -sx * -anchorPointInPoints.Y * ScaleY;
+                y += sy * -anchorPointInPoints.X * ScaleX + cx * -anchorPointInPoints.Y * ScaleY;
+            }
+
+            if (Children != null && Children.Count != 0)
+            {
+                CCNode[] elements = Children.Elements;
+                for (int i = 0, count = Children.Count; i < count; i++)
+                {
+                    var sprite = elements[i] as CCSprite;
+                    if (sprite.Visible)
+                    {
+                        var pos = ConvertToWorldspace(sprite.Position);
+
+                        sprite.PositionX = pos.X + x;
+                        sprite.PositionY = pos.Y + y;
+                    }
+                }
+            }
         }

         public virtual void SetString(string newString, bool needUpdateLabel)
@@ -847,6 +912,7 @@
                     characterSprite.PositionY += yOffset;
                 }
             }
+
         }

         private float GetLetterPosXLeft(CCSprite sp)
@@ -880,14 +946,6 @@
                 UpdateLabel();
                 IsDirty = false;
             }
-//            if (Children != null && Children.Count != 0)
-//            {
-//                CCNode[] elements = Children.Elements;
-//                for (int i = 0, count = Children.Count; i < count; i++)
-//                {
-//                    ((CCSprite)elements[i]).UpdateTransformedSpriteTextureQuads();
-//                }
-//            }
             base.Draw();
         }
     }


Convenience fn to simplify constructing a base58 type from a string.

--- NBitcoin/Network.cs
+++ NBitcoin/Network.cs
@@ -455,6 +455,16 @@
 			return (T)CreateFromBase58Data(base58, expectedNetwork);
 		}

+		public T Parse<T>(string base58) where T: Base58Data
+		{
+			var type = GetBase58Type(base58);
+			if (type.HasValue)
+			{
+				return (T)CreateBase58Data(type.Value, base58);
+			}
+			throw new FormatException("Invalid base58 data");
+		}
+
 		public Base58Data CreateBase58Data(Base58Type type, string base58)
 		{
 			if(type == Base58Type.EXT_PUBLIC_KEY)