add overload of HttpSerialiser#Create

add overload of HttpSerialiser#Create

Adds an HttpRequest parameter and calls HttpSerialiser#Configure on the
serialiser it creates before returning it to the caller.

--- Net/Serialisation/HttpSerialiser.cs
+++ Net/Serialisation/HttpSerialiser.cs
@@ -165,6 +165,45 @@
                     "There is no serialiser for the specified version."
                     );
             }
+        }
+        /// <summary>
+        /// Creates an HttpSerialiser instance based on the provided
+        /// version and configures it using the provided HttpRequest.
+        /// </summary>
+        /// <param name="httpVersion">
+        /// The version of HTTP to create a serialiser for. Only the
+        /// major and minor versions are considered.
+        /// </param>
+        /// <param name="request">
+        /// The HttpRequest to use when configuring the serialiser.
+        /// </param>
+        /// <param name="response">
+        /// The HttpResponse to be serialised.
+        /// </param>
+        /// <param name="output">
+        /// The Stream to write the serialised data to.
+        /// </param>
+        /// <returns>
+        /// An HttpSerialiser instance for the specified HTTP version.
+        /// </returns>
+        /// <exception cref="System.NotSupportedException">
+        /// Thrown when no serialiser exists for the specified HTTP
+        /// version.
+        /// </exception>
+        public static HttpSerialiser Create(
+            Version httpVersion,
+            HttpRequest request, HttpResponse response,
+            Stream output
+            )
+        {
+            // Create a serialiser using the version/etc that was
+            // passed to the method.
+            var httpSer = HttpSerialiser.Create(httpVersion, response, output);
+            // Configure the created serialiser using the provided
+            // HttpRequest.
+            httpSer.Configure(request);
+            // Return the created+configured serialiser.
+            return httpSer;
         }

         /// <summary>


updated pagination on events page

updated pagination on events page

--- Source/Applications/openXDA/openXDA/wwwroot/WorkBench/Events.cshtml
+++ Source/Applications/openXDA/openXDA/wwwroot/WorkBench/Events.cshtml
@@ -114,19 +114,33 @@

-

+

-                First
-
+                <<
+

+

+                 5" ng-click="minusPage()"><

-                 1 && n < count" ng-click="setPage(n)" ng-bind="n">
+                 0 && n <= count && getAbsDiff(n, currentPage) <= 5 " ng-click="setPage(n)" ng-bind="n">
+

+

+                 5" ng-click="plusPage()">>

-                Last
-
+                >>

+

+            Rows:
+

+                    <button class="btn btn-default" ng-click="setPageSize(10)">10</button>
+                    <button class="btn btn-default" ng-click="setPageSize(25)">25</button>
+                    <button class="btn btn-default" ng-click="setPageSize(50)">50</button>
+                    <button class="btn btn-default" ng-click="setPageSize(100)">100</button>
+

+

+

@@ -154,7 +168,8 @@
              $scope.sortDirection = true;  // true for ascending and false for descending
              $scope.Header = ['glyphicon glyphicon-chevron-up', '', '', '', '', ''];
              $scope.searchText = '';
-             $scope.pageSize = 50;
+             $scope.pageSize = 10;
+             $scope.currentPage = 1;

              $(window).one('globalFilterDone', function (event) {
                  dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, 1, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
@@ -185,11 +200,12 @@
              $scope.search = function () {
                  dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, 1, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
                      $scope.events = data;
+                     $scope.currentPage = 1;
                      $scope.$apply();

                  });
                  dataHub.getEventCounts($('#globalFilter').val(), ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (count) {
-                     $scope.count = Math.ceil(count / 50);
+                     $scope.count = Math.ceil(count / $scope.pageSize);
                      $scope.$apply();
                  });

@@ -201,6 +217,7 @@
              $scope.setPage = function (pageNumber) {
                  dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, pageNumber, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
                      $scope.events = data;
+                     $scope.currentPage = pageNumber;
                      $scope.$apply();

                  });
@@ -209,6 +226,7 @@
              $scope.firstPage = function () {
                  dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, 1, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
                      $scope.events = data;
+                     $scope.currentPage = 1;
                      $scope.$apply();

                  });
@@ -217,10 +235,18 @@
              $scope.lastPage = function () {
                  dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, $scope.count, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
                      $scope.events = data;
-                     $scope.$apply();
-
-                 });
-             };
+                     $scope.currentPage = $scope.count;
+                     $scope.$apply();
+
+                 });
+             };
+
+             $scope.plusPage = function () {
+                 $scope.currentPage++;
+             }
+             $scope.minusPage = function () {
+                 $scope.currentPage--;
+             }

              $scope.sort = function (sortBy) {
                  if (sortBy === $scope.sortBy) {
@@ -251,13 +277,16 @@
                  }
                  dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, 1, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
                      $scope.events = data;
-                     $scope.$apply();
-
-                 });
-
-
-             };
-             $('#globalFilter').on('change', function (event) {
+                     $scope.currentPage = 1;
+                     $scope.$apply();
+
+                 });
+
+
+             };
+
+             $scope.setPageSize = function (size) {
+                 $scope.pageSize = size;
                  dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, 1, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
                      $scope.events = data;
                      $scope.$apply();
@@ -268,6 +297,24 @@
                      $scope.count = Math.ceil(count / $scope.pageSize);
                      $scope.$apply();
                  });
+             };
+
+             $scope.getAbsDiff = function (a, b) {
+                 return Math.abs(a - b);
+             };
+
+             $('#globalFilter').on('change', function (event) {
+                 dataHub.getFilteredEvents($('#globalFilter').val(), $scope.sortBy, $scope.sortDirection, 1, $scope.pageSize, ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (data) {
+                     $scope.events = data;
+                     $scope.currentPage = 1;
+                     $scope.$apply();
+
+                 });
+
+                 dataHub.getEventCounts($('#globalFilter').val(), ($scope.searchText === '' ? '%' : '%' + $scope.searchText + '%')).done(function (count) {
+                     $scope.count = Math.ceil(count / $scope.pageSize);
+                     $scope.$apply();
+                 });

              });


GSF.TimeSeries: Fixed NullReferenceException that sometimes occurs when calculating performance statistics.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/gsf/Main;C88359

--- Source/Libraries/GSF.TimeSeries/Statistics/PerformanceStatistics.cs
+++ Source/Libraries/GSF.TimeSeries/Statistics/PerformanceStatistics.cs
@@ -33,22 +33,28 @@

         private static double GetSystemStatistic_CPUUsage(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.CPUUsage.LastValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.CPUUsage != null)
+                    statistic = perfMon.CPUUsage.LastValue;
+            }

             return statistic;
         }

         private static double GetSystemStatistic_AverageCPUUsage(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.CPUUsage.AverageValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.CPUUsage != null)
+                    statistic = perfMon.CPUUsage.AverageValue;
+            }

             return statistic;
         }
@@ -59,22 +65,28 @@

         private static double GetSystemStatistic_MemoryUsage(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.MemoryUsage.LastValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.MemoryUsage != null)
+                    statistic = perfMon.MemoryUsage.LastValue;
+            }

             return statistic;
         }

         private static double GetSystemStatistic_AverageMemoryUsage(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.MemoryUsage.AverageValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.MemoryUsage != null)
+                    statistic = perfMon.MemoryUsage.AverageValue;
+            }

             return statistic;
         }
@@ -85,22 +97,28 @@

         private static double GetSystemStatistic_ThreadCount(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.ThreadCount.LastValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.ThreadCount != null)
+                    statistic = perfMon.ThreadCount.LastValue;
+            }

             return statistic;
         }

         private static double GetSystemStatistic_AverageThreadCount(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.ThreadCount.AverageValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.ThreadCount != null)
+                    statistic = perfMon.ThreadCount.AverageValue;
+            }

             return statistic;
         }
@@ -111,22 +129,28 @@

         private static double GetSystemStatistic_ThreadingContentionRate(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.ThreadingContentionRate.LastValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.ThreadingContentionRate != null)
+                    statistic = perfMon.ThreadingContentionRate.LastValue;
+            }

             return statistic;
         }

         private static double GetSystemStatistic_AverageThreadingContentionRate(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.ThreadingContentionRate.AverageValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.ThreadingContentionRate != null)
+                    statistic = perfMon.ThreadingContentionRate.AverageValue;
+            }

             return statistic;
         }
@@ -137,22 +161,28 @@

         private static double GetSystemStatistic_IOUsage(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.IOUsage.LastValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.IOUsage != null)
+                    statistic = perfMon.IOUsage.LastValue;
+            }

             return statistic;
         }

         private static double GetSystemStatistic_AverageIOUsage(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.IOUsage.AverageValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.IOUsage != null)
+                    statistic = perfMon.IOUsage.AverageValue;
+            }

             return statistic;
         }
@@ -163,22 +193,28 @@

         private static double GetSystemStatistic_DatagramSendRate(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.DatagramSendRate.LastValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.DatagramSendRate != null)
+                    statistic = perfMon.DatagramSendRate.LastValue;
+            }

             return statistic;
         }

         private static double GetSystemStatistic_AverageDatagramSendRate(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.DatagramSendRate.AverageValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if (perfMon.DatagramSendRate != null)
+                    statistic = perfMon.DatagramSendRate.AverageValue;
+            }

             return statistic;
         }
@@ -189,22 +225,28 @@

         private static double GetSystemStatistic_DatagramReceiveRate(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.DatagramReceiveRate.LastValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.DatagramReceiveRate != null)
+                    statistic = perfMon.DatagramReceiveRate.LastValue;
+            }

             return statistic;
         }

         private static double GetSystemStatistic_AverageDatagramReceiveRate(object source, string arguments)
         {
-            double statistic = 0.0;
-            PerformanceMonitor perfMon = source as PerformanceMonitor;
-
-            if ((object)perfMon != null)
-                statistic = perfMon.DatagramReceiveRate.AverageValue;
+            double statistic = double.NaN;
+            PerformanceMonitor perfMon = source as PerformanceMonitor;
+
+            if ((object)perfMon != null)
+            {
+                if ((object)perfMon.DatagramReceiveRate != null)
+                    statistic = perfMon.DatagramReceiveRate.AverageValue;
+            }

             return statistic;
         }


Fix FakeFile reference.

Fix FakeFile reference.

--- Nitra.Visualizer/MainWindow.xaml.cs
+++ Nitra.Visualizer/MainWindow.xaml.cs
@@ -428,7 +428,7 @@
       var root = _parseTree as IMappedParseTree<IAst>;
       if (root != null)
       {
-        var file = new FakeFile(_parseResult.OriginalSource);
+        var file = new ProjectSystem.FakeFile(_parseResult.OriginalSource);
         var declarationRoot = DeclarationRoot<IAst>.Create(file, root);
         UpdateDeclarations(declarationRoot);
       }


Fix sync context to throw exceptions

Fix sync context to throw exceptions

--- Source/SpicyPixel.Threading/FiberSchedulerSynchronizationContext.cs
+++ Source/SpicyPixel.Threading/FiberSchedulerSynchronizationContext.cs
@@ -37,7 +37,7 @@
 	public class FiberSchedulerSynchronizationContext : SynchronizationContext
 	{
 		FiberScheduler scheduler;
-
+
 		/// <summary>
 		/// Initializes a new instance of the <see cref="SpicyPixel.Threading.FiberSchedulerSynchronizationContext"/> class.
 		/// </summary>
@@ -48,7 +48,7 @@
 		{
 			this.scheduler = scheduler;
 		}
-
+
 		/// <summary>
 		/// Dispatches an asynchronous message to a synchronization context (the <see cref="FiberScheduler"/>).
 		/// </summary>
@@ -75,9 +75,9 @@
 		/// Dispatches an synchronous message to a synchronization context (the <see cref="FiberScheduler"/>).
 		/// </summary>
 		/// <remarks>
-		/// The callback is always inlined if Send is executed from the
+		/// The callback is always inlined if Send is executed from the
 		/// scheduler thread regardless of any scheduler specific inline settings.
-		/// Because inlining always occurs when on the scheduler thread, the
+		/// Because inlining always occurs when on the scheduler thread, the
 		/// caller must manage stack depth.
 		/// </remarks>
 		/// <param name='d'>
@@ -94,20 +94,24 @@
 				d(state);
 				return;
 			}
-
+
 			// FIXME: This could block indefinitely if the scheduler goes down
 			// before executing the task. Need another wait handle here or
 			// better approach. Maybe add a WaitHandle to the fiber itself or
             // add Join().
-
+
 			// The threads don't match, so queue the action
 			// and wait for it to complete.
 			ManualResetEvent wait = new ManualResetEvent(false);
-			Fiber.Factory.StartNew(() => {
-				d(state);
-				wait.Set();
-			}, scheduler);
+            var fiber = Fiber.Factory.StartNew (() => {
+                try {
+                    d (state);
+                } finally {
+                    wait.Set ();
+                }
+            }, scheduler);
 			wait.WaitOne();
+            fiber.ThrowIfCanceledOrFaulted ();
 		}
 	}
 }


added fake season information

added fake season information

--- NoSqlKickoff.Tests/DataGenerator.cs
+++ NoSqlKickoff.Tests/DataGenerator.cs
@@ -322,65 +322,65 @@

         private static readonly List<Employment> EmploymentsFromBayern = new List<Employment>
         {
-            new Employment {Id = "Employments/100", PlayerId = "Players/100", TeamId = "Teams/15" },
-            new Employment {Id = "Employments/101", PlayerId = "Players/101", TeamId = "Teams/15" },
-            new Employment {Id = "Employments/102", PlayerId = "Players/102", TeamId = "Teams/15" },
-            new Employment {Id = "Employments/103", PlayerId = "Players/103", TeamId = "Teams/15" },
-            new Employment {Id = "Employments/104", PlayerId = "Players/104", TeamId = "Teams/15" }
+            new Employment {Id = "Employments/100", PlayerId = "Players/100", TeamId = "Teams/15", Season = "2014-2015" },
+            new Employment {Id = "Employments/101", PlayerId = "Players/101", TeamId = "Teams/15", Season = "2014-2015" },
+            new Employment {Id = "Employments/102", PlayerId = "Players/102", TeamId = "Teams/15", Season = "2014-2015" },
+            new Employment {Id = "Employments/103", PlayerId = "Players/103", TeamId = "Teams/15", Season = "2014-2015" },
+            new Employment {Id = "Employments/104", PlayerId = "Players/104", TeamId = "Teams/15", Season = "2014-2015" }
         };

         private static readonly List<Employment> EmploymentsFromReal = new List<Employment>
         {
-            new Employment { Id = "Employments/110", PlayerId = "Players/110", TeamId = "Teams/10" },
-            new Employment { Id = "Employments/111", PlayerId = "Players/111", TeamId = "Teams/10" },
-            new Employment { Id = "Employments/112", PlayerId = "Players/112", TeamId = "Teams/10" },
-            new Employment { Id = "Employments/113", PlayerId = "Players/113", TeamId = "Teams/10" },
-            new Employment { Id = "Employments/114", PlayerId = "Players/114", TeamId = "Teams/10" }
+            new Employment { Id = "Employments/110", PlayerId = "Players/110", TeamId = "Teams/10", Season = "2007-2008" },
+            new Employment { Id = "Employments/111", PlayerId = "Players/111", TeamId = "Teams/10", Season = "2007-2008" },
+            new Employment { Id = "Employments/112", PlayerId = "Players/112", TeamId = "Teams/10", Season = "2007-2008" },
+            new Employment { Id = "Employments/113", PlayerId = "Players/113", TeamId = "Teams/10", Season = "2007-2008" },
+            new Employment { Id = "Employments/114", PlayerId = "Players/114", TeamId = "Teams/10", Season = "2007-2008" }
         };

         private static readonly List<Employment> EmploymentsFromBarcelona = new List<Employment>
         {
-            new Employment { Id = "Employments/121", PlayerId = "Players/121", TeamId = "Teams/20" },
-            new Employment { Id = "Employments/122", PlayerId = "Players/122", TeamId = "Teams/20" },
-            new Employment { Id = "Employments/123", PlayerId = "Players/123", TeamId = "Teams/20" },
-            new Employment { Id = "Employments/124", PlayerId = "Players/124", TeamId = "Teams/20" },
-            new Employment { Id = "Employments/125", PlayerId = "Players/125", TeamId = "Teams/20" }
+            new Employment { Id = "Employments/121", PlayerId = "Players/121", TeamId = "Teams/20", Season = "2008-2009" },
+            new Employment { Id = "Employments/122", PlayerId = "Players/122", TeamId = "Teams/20", Season = "2008-2009" },
+            new Employment { Id = "Employments/123", PlayerId = "Players/123", TeamId = "Teams/20", Season = "2008-2009" },
+            new Employment { Id = "Employments/124", PlayerId = "Players/124", TeamId = "Teams/20", Season = "2008-2009" },
+            new Employment { Id = "Employments/125", PlayerId = "Players/125", TeamId = "Teams/20", Season = "2008-2009" }
         };

         private static readonly List<Employment> EmploymentsFromMilan = new List<Employment>
         {
-            new Employment { Id = "Employments/131", PlayerId = "Players/131", TeamId = "Teams/50" },
-            new Employment { Id = "Employments/132", PlayerId = "Players/132", TeamId = "Teams/50" },
-            new Employment { Id = "Employments/133", PlayerId = "Players/133", TeamId = "Teams/50" },
-            new Employment { Id = "Employments/134", PlayerId = "Players/134", TeamId = "Teams/50" },
-            new Employment { Id = "Employments/135", PlayerId = "Players/135", TeamId = "Teams/50" }
+            new Employment { Id = "Employments/131", PlayerId = "Players/131", TeamId = "Teams/50", Season = "2009-2010" },
+            new Employment { Id = "Employments/132", PlayerId = "Players/132", TeamId = "Teams/50", Season = "2009-2010" },
+            new Employment { Id = "Employments/133", PlayerId = "Players/133", TeamId = "Teams/50", Season = "2009-2010" },
+            new Employment { Id = "Employments/134", PlayerId = "Players/134", TeamId = "Teams/50", Season = "2009-2010" },
+            new Employment { Id = "Employments/135", PlayerId = "Players/135", TeamId = "Teams/50", Season = "2009-2010" }
         };

         private static readonly List<Employment> EmploymentsFromJuve = new List<Employment>
         {
-            new Employment { Id = "Employments/141", PlayerId = "Players/141", TeamId = "Teams/55" },
-            new Employment { Id = "Employments/142", PlayerId = "Players/142", TeamId = "Teams/55" },
-            new Employment { Id = "Employments/143", PlayerId = "Players/143", TeamId = "Teams/55" },
-            new Employment { Id = "Employments/144", PlayerId = "Players/144", TeamId = "Teams/55" },
-            new Employment { Id = "Employments/145", PlayerId = "Players/145", TeamId = "Teams/55" }
+            new Employment { Id = "Employments/141", PlayerId = "Players/141", TeamId = "Teams/55", Season = "2010-2011" },
+            new Employment { Id = "Employments/142", PlayerId = "Players/142", TeamId = "Teams/55", Season = "2010-2011" },
+            new Employment { Id = "Employments/143", PlayerId = "Players/143", TeamId = "Teams/55", Season = "2010-2011" },
+            new Employment { Id = "Employments/144", PlayerId = "Players/144", TeamId = "Teams/55", Season = "2010-2011" },
+            new Employment { Id = "Employments/145", PlayerId = "Players/145", TeamId = "Teams/55", Season = "2010-2011" }
         };

         private static readonly List<Employment> EmploymentsFromSantos = new List<Employment>
         {
-            new Employment { Id = "Employments/151", PlayerId = "Players/151", TeamId = "Teams/40" },
-            new Employment { Id = "Employments/152", PlayerId = "Players/152", TeamId = "Teams/40" },
-            new Employment { Id = "Employments/153", PlayerId = "Players/153", TeamId = "Teams/40" },
-            new Employment { Id = "Employments/154", PlayerId = "Players/154", TeamId = "Teams/40" },
-            new Employment { Id = "Employments/155", PlayerId = "Players/155", TeamId = "Teams/40" }
+            new Employment { Id = "Employments/151", PlayerId = "Players/151", TeamId = "Teams/40", Season = "2010-2011" },
+            new Employment { Id = "Employments/152", PlayerId = "Players/152", TeamId = "Teams/40", Season = "2010-2011" },
+            new Employment { Id = "Employments/153", PlayerId = "Players/153", TeamId = "Teams/40", Season = "2010-2011" },
+            new Employment { Id = "Employments/154", PlayerId = "Players/154", TeamId = "Teams/40", Season = "2010-2011" },
+            new Employment { Id = "Employments/155", PlayerId = "Players/155", TeamId = "Teams/40", Season = "2010-2011" }
         };

         private static readonly List<Employment> EmploymentsFromRoma = new List<Employment>
         {
-            new Employment { Id = "Employments/161", PlayerId = "Players/161", TeamId = "Teams/60" },
-            new Employment { Id = "Employments/162", PlayerId = "Players/162", TeamId = "Teams/60" },
-            new Employment { Id = "Employments/163", PlayerId = "Players/163", TeamId = "Teams/60" },
-            new Employment { Id = "Employments/164", PlayerId = "Players/164", TeamId = "Teams/60" },
-            new Employment { Id = "Employments/165", PlayerId = "Players/165", TeamId = "Teams/60" }
+            new Employment { Id = "Employments/161", PlayerId = "Players/161", TeamId = "Teams/60", Season = "2011-2012" },
+            new Employment { Id = "Employments/162", PlayerId = "Players/162", TeamId = "Teams/60", Season = "2011-2012" },
+            new Employment { Id = "Employments/163", PlayerId = "Players/163", TeamId = "Teams/60", Season = "2011-2012" },
+            new Employment { Id = "Employments/164", PlayerId = "Players/164", TeamId = "Teams/60", Season = "2011-2012" },
+            new Employment { Id = "Employments/165", PlayerId = "Players/165", TeamId = "Teams/60", Season = "2011-2012" }
         };

         private static readonly List<Employment> EmploymentsFromDortmund = new List<Employment>
@@ -402,75 +402,58 @@

         private static readonly List<Employment> EmploymentsFromAjax = new List<Employment>
         {
-            new Employment { Id = "Employments/191", PlayerId = "Players/191", TeamId = "Teams/70" },
-            new Employment { Id = "Employments/192", PlayerId = "Players/192", TeamId = "Teams/70" },
-            new Employment { Id = "Employments/193", PlayerId = "Players/193", TeamId = "Teams/70" },
-            new Employment { Id = "Employments/194", PlayerId = "Players/194", TeamId = "Teams/70" },
-            new Employment { Id = "Employments/195", PlayerId = "Players/195", TeamId = "Teams/70" }
+            new Employment { Id = "Employments/191", PlayerId = "Players/191", TeamId = "Teams/70", Season = "1995-1996" },
+            new Employment { Id = "Employments/192", PlayerId = "Players/192", TeamId = "Teams/70", Season = "1995-1996" },
+            new Employment { Id = "Employments/193", PlayerId = "Players/193", TeamId = "Teams/70", Season = "1995-1996" },
+            new Employment { Id = "Employments/194", PlayerId = "Players/194", TeamId = "Teams/70", Season = "1995-1996" },
+            new Employment { Id = "Employments/195", PlayerId = "Players/195", TeamId = "Teams/70", Season = "1995-1996" }
         };

         private static readonly List<Employment> EmploymentsFromManchester = new List<Employment>
         {
-            new Employment { Id = "Employments/201", PlayerId = "Players/201", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/202", PlayerId = "Players/202", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/203", PlayerId = "Players/203", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/204", PlayerId = "Players/204", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/205", PlayerId = "Players/205", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/206", PlayerId = "Players/206", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/207", PlayerId = "Players/207", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/208", PlayerId = "Players/208", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/209", PlayerId = "Players/209", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/210", PlayerId = "Players/210", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/211", PlayerId = "Players/211", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/212", PlayerId = "Players/212", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/213", PlayerId = "Players/213", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/214", PlayerId = "Players/214", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/215", PlayerId = "Players/215", TeamId = "Teams/30" },
-            new Employment { Id = "Employments/216", PlayerId = "Players/216", TeamId = "Teams/30" }
+            new Employment { Id = "Employments/201", PlayerId = "Players/201", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/202", PlayerId = "Players/202", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/203", PlayerId = "Players/203", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/204", PlayerId = "Players/204", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/205", PlayerId = "Players/205", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/206", PlayerId = "Players/206", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/207", PlayerId = "Players/207", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/208", PlayerId = "Players/208", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/209", PlayerId = "Players/209", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/210", PlayerId = "Players/210", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/211", PlayerId = "Players/211", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/212", PlayerId = "Players/212", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/213", PlayerId = "Players/213", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/214", PlayerId = "Players/214", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/215", PlayerId = "Players/215", TeamId = "Teams/30", Season = "2004-2005" },
+            new Employment { Id = "Employments/216", PlayerId = "Players/216", TeamId = "Teams/30", Season = "2004-2005" }
         };

         private static readonly List<Employment> EmploymentsFromLiverpool = new List<Employment>
         {
-            new Employment { Id = "Employments/221", PlayerId = "Players/221", TeamId = "Teams/35" },
-            new Employment { Id = "Employments/222", PlayerId = "Players/222", TeamId = "Teams/35" },
-            new Employment { Id = "Employments/223", PlayerId = "Players/223", TeamId = "Teams/35" },
-            new Employment { Id = "Employments/224", PlayerId = "Players/224", TeamId = "Teams/35" },
-            new Employment { Id = "Employments/225", PlayerId = "Players/225", TeamId = "Teams/35" }
+            new Employment { Id = "Employments/221", PlayerId = "Players/221", TeamId = "Teams/35", Season = "2003-2004" },
+            new Employment { Id = "Employments/222", PlayerId = "Players/222", TeamId = "Teams/35", Season = "2003-2004" },
+            new Employment { Id = "Employments/223", PlayerId = "Players/223", TeamId = "Teams/35", Season = "2003-2004" },
+            new Employment { Id = "Employments/224", PlayerId = "Players/224", TeamId = "Teams/35", Season = "2003-2004" },
+            new Employment { Id = "Employments/225", PlayerId = "Players/225", TeamId = "Teams/35", Season = "2003-2004" }
         };

         private static readonly List<Employment> EmploymentsFromChelsea = new List<Employment>
         {
-            new Employment { Id = "Employments/231", PlayerId = "Players/231", TeamId = "Teams/65" },
-            new Employment { Id = "Employments/232", PlayerId = "Players/232", TeamId = "Teams/65" },
-            new Employment { Id = "Employments/233", PlayerId = "Players/233", TeamId = "Teams/65" },
-            new Employment { Id = "Employments/234", PlayerId = "Players/234", TeamId = "Teams/65" },
-            new Employment { Id = "Employments/235", PlayerId = "Players/235", TeamId = "Teams/65" }
+            new Employment { Id = "Employments/231", PlayerId = "Players/231", TeamId = "Teams/65", Season = "2002-2003" },
+            new Employment { Id = "Employments/232", PlayerId = "Players/232", TeamId = "Teams/65", Season = "2002-2003" },
+            new Employment { Id = "Employments/233", PlayerId = "Players/233", TeamId = "Teams/65", Season = "2002-2003" },
+            new Employment { Id = "Employments/234", PlayerId = "Players/234", TeamId = "Teams/65", Season = "2002-2003" },
+            new Employment { Id = "Employments/235", PlayerId = "Players/235", TeamId = "Teams/65", Season = "2002-2003" }
         };

         private static readonly List<Employment> EmploymentsFromNapoli = new List<Employment>
         {
-            new Employment { Id = "Employments/241", PlayerId = "Players/241", TeamId = "Teams/45" },
-            new Employment { Id = "Employments/242", PlayerId = "Players/242", TeamId = "Teams/45" },
-            new Employment { Id = "Employments/243", PlayerId = "Players/243", TeamId = "Teams/45" },
-            new Employment { Id = "Employments/244", PlayerId = "Players/244", TeamId = "Teams/45" },
-            new Employment { Id = "Employments/245", PlayerId = "Players/245", TeamId = "Teams/45" }
-        };
-
-        private static readonly Dictionary<string, List<Employment>> EmploymentDictionary = new Dictionary<string, List<Employment>>
-        {
-            {"Real Madrid", EmploymentsFromReal},
-            {"Bayern München", EmploymentsFromBayern},
-            {"FC Barcelona", EmploymentsFromBarcelona},
-            {"Borussia Dortmund", EmploymentsFromDortmund},
-            {"Manchester United", EmploymentsFromManchester},
-            {"FC Liverpool", EmploymentsFromLiverpool},
-            {"FC Santos", EmploymentsFromSantos},
-            {"SSC Neapel", EmploymentsFromNapoli},
-            {"AC Milan", EmploymentsFromMilan},
-            {"Juventus Turin", EmploymentsFromJuve},
-            {"AS Rom", EmploymentsFromRoma},
-            {"FC Chelsea", EmploymentsFromChelsea},
-            {"Ajax Amsterdam", EmploymentsFromAjax}
+            new Employment { Id = "Employments/241", PlayerId = "Players/241", TeamId = "Teams/45", Season = "2000-2001" },
+            new Employment { Id = "Employments/242", PlayerId = "Players/242", TeamId = "Teams/45", Season = "2000-2001" },
+            new Employment { Id = "Employments/243", PlayerId = "Players/243", TeamId = "Teams/45", Season = "2000-2001" },
+            new Employment { Id = "Employments/244", PlayerId = "Players/244", TeamId = "Teams/45", Season = "2000-2001" },
+            new Employment { Id = "Employments/245", PlayerId = "Players/245", TeamId = "Teams/45", Season = "2000-2001" }
         };

         #endregion


Fixed a problem with conn string format when there is a trusted connection

--- SubtextSystem/SubtextSolution/Subtext.Scripting/ConnectionString.cs
+++ SubtextSystem/SubtextSolution/Subtext.Scripting/ConnectionString.cs
@@ -12,8 +12,9 @@
 		private static ConnectionString _emptyConnectionString = new ConnectionString();

 		string _connectionFormatString = "{0}={1};{2}={3};User ID={4};Password={5};{6}";
-		string _databaseFieldName;
-		string _serverFieldName;
+		string _trustedConnectionFormatString = "{0}={1};{2}={3};{4}";
+		string _databaseFieldName="Database";
+		string _serverFieldName="Server";
 		string _securityType;
 		string _securityTypeText;

@@ -112,7 +113,7 @@
 					_securityType="true";
 					_securityTypeText="Trusted_Connection=true";
 				}
-				else _securityType=String.Empty;
+				else _securityType=_securityTypeText=String.Empty;
 			}
 		}

@@ -124,7 +125,10 @@
 		/// </returns>
 		public override string ToString()
 		{
-			return string.Format(_connectionFormatString, _serverFieldName, _server, _databaseFieldName, _database, _userId, _password, _securityTypeText);
+			if(TrustedConnection)
+				return string.Format(_trustedConnectionFormatString, _serverFieldName, _server, _databaseFieldName, _database, _securityTypeText);
+			else
+				return string.Format(_connectionFormatString, _serverFieldName, _server, _databaseFieldName, _database, _userId, _password, _securityTypeText);
 		}

 		private ConnectionString(string connectionString)


Update BankOfCanadaTests.cs

Update BankOfCanadaTests.cs

--- TIKSN.UnitTests.Shared/Finance/ForeignExchange/BankOfCanadaTests.cs
+++ TIKSN.UnitTests.Shared/Finance/ForeignExchange/BankOfCanadaTests.cs
@@ -164,7 +164,6 @@
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/INR");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/IDR");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/JPY");
-            Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/MYR");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/MXN");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/NZD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/NOK");
@@ -176,10 +175,8 @@
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/SEK");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/CHF");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/TWD");
-            Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/THB");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/TRY");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/GBP");
-            Assert.Contains(CurrencyPairs, C => C.ToString() == "CAD/VND");

             Assert.Contains(CurrencyPairs, C => C.ToString() == "USD/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "AUD/CAD");
@@ -190,7 +187,6 @@
             Assert.Contains(CurrencyPairs, C => C.ToString() == "INR/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "IDR/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "JPY/CAD");
-            Assert.Contains(CurrencyPairs, C => C.ToString() == "MYR/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "MXN/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "NZD/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "NOK/CAD");
@@ -202,10 +198,8 @@
             Assert.Contains(CurrencyPairs, C => C.ToString() == "SEK/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "CHF/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "TWD/CAD");
-            Assert.Contains(CurrencyPairs, C => C.ToString() == "THB/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "TRY/CAD");
             Assert.Contains(CurrencyPairs, C => C.ToString() == "GBP/CAD");
-            Assert.Contains(CurrencyPairs, C => C.ToString() == "VND/CAD");
         }

         [Fact]


as lines

as lines

--- Jasily.Core/StringExtensions.cs
+++ Jasily.Core/StringExtensions.cs
@@ -168,8 +168,8 @@
         /// </summary>
         /// <param name="text"></param>
         /// <returns></returns>
-        public static IEnumerable<string> AsLines(this string text)
-            => text?.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
+        public static IEnumerable<string> AsLines(this string text, StringSplitOptions options = StringSplitOptions.None)
+            => text?.Split(new[] { "\r\n", "\n" }, options);

         /// <summary>
         /// use Environment.NewLine to join texts.


moved out getting text from element into separate method

--- Joyride/Support/EntryCreator.cs
+++ Joyride/Support/EntryCreator.cs
@@ -35,9 +35,14 @@
             ProcessValue = processText;
         }

+        protected string GetElementText(int index, string xpath)
+        {
+            return Component.GetTextFromElementWithinCollection(CollectionName, index, xpath);
+        }
+
         protected virtual IDictionary<string, object> AddProperty(IDictionary<string, object> dictonary, int index, string xpath, string key)
         {
-            var text = Component.GetTextFromElementWithinCollection(CollectionName, index, xpath);
+            var text = GetElementText(index, xpath);
             if (text != null)
             {
                 Trace.WriteLine("Found property, " + key + ", with value: " + text);


Code to fix URLs by changing + to %20 outside the query string

--- LR_Import/BaseDataController.cs
+++ LR_Import/BaseDataController.cs
@@ -1,14 +1,14 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Configuration;
 using System.Data;
+using System.Data.SqlClient;
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading;
 using System.Xml;
 using LRWarehouse.Business;
-using LRWarehouse.DAL;
 using LearningRegistryCache2.App_Code.Classes;
 using Isle.BizServices;

@@ -16,27 +16,21 @@
 {
     public class BaseDataController
     {
-        AuditReportingManager auditReportingManager;
-        ResourceKeywordManager resourceKeywordManager;
-        ResourceClusterManager clusterManager;
-        public ResourceV2Services searchManager;
+        private List<ProhibitedKeyword> prohibitedKeywords;
+        protected ImportServices importManager;
         public ResourceBizService resourceBizService;
-        private Regex[] prohibitedKeywords;
+        private AuditReportingServices auditReportingManager;

         public static List<ManualResetEvent> doneEvents = new List<ManualResetEvent>(1000);

         public BaseDataController()
         {
-            auditReportingManager = new AuditReportingManager();
-            resourceKeywordManager=new ResourceKeywordManager();
-            clusterManager = new ResourceClusterManager();
-            searchManager = new ResourceV2Services();
+            importManager = new ImportServices();
             resourceBizService = new ResourceBizService();
-            prohibitedKeywords = new Regex[2]
-            {
-                new Regex("^NSDL_",RegexOptions.IgnoreCase),
-                new Regex("^oai:nsdl\\.org",RegexOptions.IgnoreCase)
-            };
+            auditReportingManager = new AuditReportingServices();
+
+            string status = "successful";
+            prohibitedKeywords = importManager.GetProhibitedKeywordRules(ref status);

         }

@@ -54,32 +48,40 @@
             int maxKeywords = int.Parse(ConfigurationManager.AppSettings["maxKeywordsToProcess"].ToString()); // Speed processing - some people are submitting hundreds of keywords!!!
             bool isProhibitedKeyword = false;
             XmlNodeList list = record.GetElementsByTagName(tagName);
+            List<string> keywordSubstrings = prohibitedKeywords.Where(x => x.IsRegex == false).Select(x => x.Keyword).ToList();
+            List<string> keywordExpressionStrings = prohibitedKeywords.Where(x => x.IsRegex == true).Select(x => x.Keyword).ToList();
+
             foreach (XmlNode node in list)
             {
                 string keyword = node.InnerText.Trim();
-                if (keyword.Length > 1) // Ignore single character keywords
-                {
-                    isProhibitedKeyword = false;
-                    foreach (Regex rex in prohibitedKeywords)
+
+                if (keywordSubstrings.Any(x => keyword.IndexOf(x) > -1))
+                {
+                    isProhibitedKeyword = true;
+                }
+                if (!isProhibitedKeyword)
+                {
+                    foreach (string keywordExpression in keywordExpressionStrings)
                     {
+                        Regex rex = new Regex(keywordExpression, RegexOptions.IgnoreCase);
                         if (rex.IsMatch(keyword))
                         {
                             isProhibitedKeyword = true;
                             break;
                         }
                     }
-
-                    if (!isProhibitedKeyword)
+                }
+
+                if (!isProhibitedKeyword)
+                {
+                    nbrKeywords++;
+                    if (maxKeywords > 0 && nbrKeywords > maxKeywords)
                     {
-                        nbrKeywords++;
-                        if (maxKeywords > 0 && nbrKeywords > maxKeywords)
-                        {
-                            message += string.Format("Number of keywords exceeds {0}.  First {0}/{1} keywords processed, remainder ignored. ", maxKeywords, list.Count);
-                            break;
-                        }
-
-                        AddKeyword(resource, keyword);
+                        message += string.Format("Number of keywords exceeds {0}.  First {0}/{1} keywords processed, remainder ignored. ", maxKeywords, list.Count);
+                        break;
                     }
+
+                    AddKeyword(resource, keyword);
                 }
             }
         }
@@ -107,7 +109,7 @@
                         //keys.ResourceId = resource.RowId;
                         keys.ResourceIntId = resource.Id;
                         keys.OriginalValue = key;
-                        resourceKeywordManager.Create(keys, ref status);
+                        importManager.CreateKeyword(keys, ref status);
                         if (status != "successful")
                         {
                             auditReportingManager.LogMessage(LearningRegistry.reportId, "", resource.Version.LRDocId, resource.ResourceUrl, ErrorType.Error, ErrorRouting.Technical, status);
@@ -122,7 +124,7 @@
                 //keys.ResourceId = resource.RowId;
                 keys.ResourceIntId = resource.Id;
                 keys.OriginalValue = keyword;
-                resourceKeywordManager.Create(keys, ref status);
+                importManager.CreateKeyword(keys, ref status);
                 if (status != "successful")
                 {
                     auditReportingManager.LogMessage(LearningRegistry.reportId, "", resource.Version.LRDocId, resource.ResourceUrl, ErrorType.Error, ErrorRouting.Technical, status);
@@ -209,7 +211,7 @@
                 cluster.ResourceIntId = resource.Id;
                 cluster.ClusterId = 0;
                 cluster.Title = TrimWhitespace(node.InnerText);
-                status = clusterManager.Import(cluster);
+                status = importManager.ImportCluster(cluster);
                 if (status != "successful")
                 {
                     auditReportingManager.LogMessage(LearningRegistry.reportId, LearningRegistry.fileName, resource.Version.LRDocId, resource.ResourceUrl, ErrorType.Error,
@@ -219,6 +221,7 @@
         } //AddCareerClusters

         #endregion
+
         #region Helper Methods

         private bool IsNumeric(string param)
@@ -326,7 +329,142 @@
         }

-
+        public static bool DoesDataSetHaveRows(DataSet ds)
+        {
+            if (ds == null)
+                return false;
+            if (ds.Tables == null || ds.Tables.Count == 0)
+                return false;
+            if (ds.Tables[0].Rows == null || ds.Tables[0].Rows.Count == 0)
+                return false;
+
+            return true;
+        }
+
+        public static int GetRowColumn(DataRow dr, string columnName, int defaultValue)
+        {
+            int retVal = defaultValue;
+            try
+            {
+                retVal = int.Parse(dr[columnName].ToString());
+            }
+            catch
+            {
+                // do nothing
+            }
+
+            return retVal;
+        }
+
+        public static int GetRowColumn(SqlDataReader dr, string columnName, int defaultValue)
+        {
+            int retVal = defaultValue;
+            try
+            {
+                retVal = int.Parse(dr[columnName].ToString());
+            }
+            catch
+            {
+                // do nothing
+            }
+
+            return retVal;
+        }
+
+        public static DateTime GetRowColumn(SqlDataReader dr, string columnName, DateTime defaultValue)
+        {
+            DateTime retVal = defaultValue;
+            try
+            {
+                retVal = DateTime.Parse(dr[columnName].ToString());
+            }
+            catch
+            {
+                // do nothing
+            }
+
+            return retVal;
+        }
+
+        public static DateTime GetRowColumn(DataRow dr, string columnName, DateTime defaultValue)
+        {
+            DateTime retVal = defaultValue;
+            try
+            {
+                retVal = DateTime.Parse(dr[columnName].ToString());
+            }
+            catch
+            {
+                // do nothing
+            }
+
+            return retVal;
+        }
+
+        public static string GetRowColumn(DataRow dr, string columnName, string defaultValue)
+        {
+            string retVal = defaultValue;
+            try
+            {
+                retVal = dr[columnName].ToString();
+            }
+            catch
+            {
+                // do nothing
+            }
+
+            return retVal;
+        }
+
+        public static string GetRowColumn(SqlDataReader dr, string columnName, string defaultValue)
+        {
+            string retVal = defaultValue;
+            try
+            {
+                retVal = dr[columnName].ToString();
+            }
+            catch
+            {
+                // do nothing
+            }
+
+            return retVal;
+        }
+
+        protected string StripTrailingPeriod(string input)
+        {
+            Regex trailingPeriod = new Regex(@"\.+$"); // backslash escapes the period so that it is interpreted as an actual period, + makes it greedy, $ asserts end of string
+            if (input == null)
+            {
+                return null;
+            }
+            string output = trailingPeriod.Replace(input, "");
+
+            return output;
+        }
+
+        protected string FixPlusesInUrl(string input)
+        {
+            string retVal = "";
+            if (input.IndexOf("+") == -1)
+            {
+                // There are no + signs, return what was input
+                return input;
+            }
+            int posQuestionMark = input.IndexOf("?");
+            if (posQuestionMark == -1)
+            {
+                retVal = input.Replace("+", "%20");
+            }
+            else
+            {
+                string originalPage = input.Substring(0, posQuestionMark);
+                string newPage = originalPage.Replace("+", "%20");
+                retVal = input.Replace(originalPage, newPage);
+            }
+
+            return retVal;
+        }

 #endregion
     }


refactoring

refactoring

--- LatencyCollectorCore/Program.cs
+++ LatencyCollectorCore/Program.cs
@@ -45,15 +45,7 @@
 			{
 				lock (Sync)
 				{
-					foreach (var monitor in _monitors)
-					{
-						monitor.Interrupt();
-					}
-
-					foreach (var monitor in _monitors)
-					{
-						monitor.WaitForFinish();
-					}
+					StopPolling();

 					AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
 				}
@@ -86,6 +78,22 @@
 			foreach (var monitor in monitors)
 			{
 				monitor.Start();
+			}
+		}
+
+		static void StopPolling()
+		{
+			lock (Sync)
+			{
+				foreach (var monitor in _monitors)
+				{
+					monitor.Interrupt();
+				}
+
+				foreach (var monitor in _monitors)
+				{
+					monitor.WaitForFinish();
+				}
 			}
 		}


Allow VoiceGateway to run from unmanaged code

--- OpenMetaverse/Voice/VoiceControl.cs
+++ OpenMetaverse/Voice/VoiceControl.cs
@@ -293,8 +293,10 @@

         internal string GetVoiceDaemonPath()
         {
-            string myDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
-
+            string myDir =
+                Path.GetDirectoryName(
+                    (System.Reflection.Assembly.GetEntryAssembly() ?? typeof (VoiceGateway).Assembly).Location);
+
             if (Environment.OSVersion.Platform != PlatformID.MacOSX &&
                 Environment.OSVersion.Platform != PlatformID.Unix)
             {


Refine optimization.

Refine optimization.

--- Code2Xml.Learner.Core/Learning/Classifier.cs
+++ Code2Xml.Learner.Core/Learning/Classifier.cs
@@ -57,8 +57,10 @@
             foreach (var rejectedVector in rejectedVectors) {
                 var groupIndex = groupCache.GetGroupIndex(rejectedVector);
                 var acceptingClassifier = Units[groupIndex].Accepting;
+                var rejectingClassifier = Units[groupIndex].Rejecting;
                 var accepted = (rejectedVector & acceptingClassifier) == acceptingClassifier;
-                if (!accepted) {
+                var rejected = (rejectedVector & rejectingClassifier) != BigInteger.Zero;
+                if (!accepted /*&& !rejected*/) {
                     groupIndex2RejectedVectors[groupIndex].Add(rejectedVector);
                 }
             }


EDIT: service usage

EDIT: service usage

--- CollAction/Controllers/ProjectsController.cs
+++ CollAction/Controllers/ProjectsController.cs
@@ -162,7 +162,7 @@
         [Authorize]
         public IActionResult ThankYouCreate(string name, int? id)
         {
-            var project = await _context.Projects.SingleOrDefaultAsync(m => m.Id == id.Value);
+            var project = _context.Projects.SingleOrDefault(m => m.Id == id.Value);
             if (project == null)
             {
                 return NotFound();
@@ -283,7 +283,7 @@
         [HttpGet]
         public IActionResult ThankYouCommit(int id, string name)
         {
-            var project = await _context.Projects.SingleOrDefaultAsync(m => m.Id == id.Value);
+            var project = _context.Projects.SingleOrDefault(m => m.Id == id);
             if (project == null)
             {
                 return NotFound();


updated projects endpoint

updated projects endpoint

--- CollAction/Controllers/ProjectsController.cs
+++ CollAction/Controllers/ProjectsController.cs
@@ -365,17 +365,17 @@
         }

         [HttpGet]
-        public async Task<JsonResult> GetTileProjects(int? categoryId, int? locationId, string statusId)
+        public async Task<JsonResult> GetTileProjects(int? categoryId, string statusId)
         {
             Expression<Func<Project, bool>> projectExpression = (p => p.Status != ProjectStatus.Hidden && p.Status != ProjectStatus.Deleted
-            && (categoryId != null ? p.CategoryId == categoryId : true) && (locationId != null ? p.LocationId == locationId : true));
+            && (categoryId != null ? p.CategoryId == categoryId : true));

             Expression<Func<Project, bool>> statusExpression;
-            switch (String.IsNullOrEmpty(statusId) ? String.Empty : statusId.ToLower())
-            {
-                case "open": statusExpression = (p => p.IsActive == true); break;
-                case "closed": statusExpression = (p => p.IsClosed || p.Status == ProjectStatus.Successful || p.Status == ProjectStatus.Failed); break;
-                case "comingsoon": statusExpression = (p => p.IsComingSoon == true); break;
+            switch (statusId)
+            {
+                case "open": statusExpression = (p => p.Status == ProjectStatus.Running && p.Start <= DateTime.UtcNow && p.End >= DateTime.UtcNow); break;
+                case "closed": statusExpression = (p => (p.Status == ProjectStatus.Running && p.End < DateTime.UtcNow) || p.Status == ProjectStatus.Successful || p.Status == ProjectStatus.Failed); break;
+                case "comingSoon": statusExpression = (p => p.Status == ProjectStatus.Running && p.Start > DateTime.UtcNow); break;
                 default: statusExpression = (p => true); break;
             }


Fix Wires having the wrong quality for opening the panel. Fixes #4795

--- Content.Server/WireHacking/WiresComponent.cs
+++ Content.Server/WireHacking/WiresComponent.cs
@@ -41,7 +41,7 @@
         private bool _isPanelOpen;

         [DataField("screwingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
-        private string _screwingQuality = "Pulsing";
+        private string _screwingQuality = "Screwing";

         [DataField("cuttingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
         private string _cuttingQuality = "Cutting";


Add helpers for converting to and from Fahrenheit

--- Content.Shared/Utility/TemperatureHelpers.cs
+++ Content.Shared/Utility/TemperatureHelpers.cs
@@ -9,9 +9,31 @@
             return celsius + PhysicalConstants.ZERO_CELCIUS;
         }

+        public static float CelsiusToFahrenheit(float celsius)
+        {
+            return celsius * 9 / 5 + 32;
+        }
+
         public static float KelvinToCelsius(float kelvin)
         {
             return kelvin - PhysicalConstants.ZERO_CELCIUS;
         }
+
+        public static float KelvinToFahrenheit(float kelvin)
+        {
+            var celsius = KelvinToCelsius(kelvin);
+            return CelsiusToFahrenheit(celsius);
+        }
+
+        public static float FahrenheitToCelsius(float fahrenheit)
+        {
+            return (fahrenheit - 32) * 5 / 9;
+        }
+
+        public static float FahrenheitToKelvin(float fahrenheit)
+        {
+            var celsius = FahrenheitToCelsius(fahrenheit);
+            return CelsiusToKelvin(celsius);
+        }
     }
 }


Avoiding multiple enumeration

Avoiding multiple enumeration

--- Core/Theraot/Collections/Extensions.extra.cs
+++ Core/Theraot/Collections/Extensions.extra.cs
@@ -24,9 +24,10 @@
             {
                 throw new ArgumentNullException("source");
             }
+            var progressive = new ProgressiveCollection<T>(source);
             while (true)
             {
-                foreach (var item in source)
+                foreach (var item in progressive)
                 {
                     yield return item;
                 }


Removed Unnecessary calls to DisposedConditional

--- Core/Theraot/Threading/Needles/WeakNeedle.cs
+++ Core/Theraot/Threading/Needles/WeakNeedle.cs
@@ -38,7 +38,7 @@
         {
             _trackResurrection = trackResurrection;
             Allocate(target, _trackResurrection);
-            if (IsAliveExtracted())
+            if (IsAlive)
             {
                 _hashCode = target.GetHashCode();
             }
@@ -52,17 +52,21 @@
         {
             get
             {
-                return DisposedConditional
-                    (
-                        () =>
-                        {
-                            return false;
-                        },
-                        () =>
-                        {
-                            return IsAliveExtracted();
-                        }
-                    );
+                if (!_handle.IsAllocated)
+                {
+                    return false;
+                }
+                else
+                {
+                    try
+                    {
+                        return !ReferenceEquals(_handle.Target, null);
+                    }
+                    catch (InvalidOperationException)
+                    {
+                        return false;
+                    }
+                }
             }
         }

@@ -78,32 +82,29 @@
         {
             get
             {
-                return DisposedConditional<T>
-                    (
-                        () =>
+                if (!_handle.IsAllocated)
+                {
+                    return default(T);
+                }
+                else
+                {
+                    try
+                    {
+                        object obj = _handle.Target;
+                        if (obj == null)
                         {
                             return default(T);
-                        },
-                        () =>
-                        {
-                            try
-                            {
-                                object obj = _handle.Target;
-                                if (obj == null)
-                                {
-                                    return default(T);
-                                }
-                                else
-                                {
-                                    return (T)obj;
-                                }
-                            }
-                            catch (InvalidOperationException)
-                            {
-                                return default(T);
-                            }
-                        }
-                    );
+                        }
+                        else
+                        {
+                            return (T)obj;
+                        }
+                    }
+                    catch (InvalidOperationException)
+                    {
+                        return default(T);
+                    }
+                }
             }
             [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
             set
@@ -259,18 +260,6 @@
             }
         }

-        private bool IsAliveExtracted()
-        {
-            if (!_handle.IsAllocated)
-            {
-                return false;
-            }
-            else
-            {
-                return !ReferenceEquals(_handle.Target, null);
-            }
-        }
-
         [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
         private void ReleaseExtracted()
         {


Argument null exception created for SqlCommand


Update PBU-Main-Future.cs

Update PBU-Main-Future.cs

--- ProcessBlockUtil/PBU-Main-Future.cs
+++ ProcessBlockUtil/PBU-Main-Future.cs
@@ -67,6 +67,7 @@
 				    ar.Add(tempLine);
 			    }
 		    }
+                    sr.Close();
 		    list = ar.ToArray();
 	    }
 	    else{


The Link element should be able to display a ReactElement (not just NonBlankTrimmedString) - this was a uncommited push from somewhe

--- ProductiveRage.ReactRouting/Link.cs
+++ ProductiveRage.ReactRouting/Link.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Linq;
+using Bridge;
 using Bridge.React;
 using ProductiveRage.Immutable;

@@ -20,6 +21,20 @@
 		public Link(
 			UrlDetails url,
 			NonBlankTrimmedString text,
+			bool caseSensitiveUrlMatching = false,
+			Optional<NonBlankTrimmedString> name = new Optional<NonBlankTrimmedString>(),
+			Optional<NonBlankTrimmedString> target = new Optional<NonBlankTrimmedString>(),
+			Optional<ClassName> className = new Optional<ClassName>(),
+			Optional<ClassName> ancestorClassName = new Optional<ClassName>(),
+			Optional<ClassName> selectedClassName = new Optional<ClassName>(),
+			Optional<Action<MouseEvent<Bridge.Html5.HTMLAnchorElement>>> onClick = new Optional<Action<MouseEvent<Bridge.Html5.HTMLAnchorElement>>>(),
+			Optional<IInteractWithBrowserRouting> historyHandlerOverride = new Optional<IInteractWithBrowserRouting>())
+			: base(new Props(url, text, caseSensitiveUrlMatching, name, target, className, ancestorClassName, selectedClassName, onClick, historyHandlerOverride))
+		{ }
+
+		public Link(
+			UrlDetails url,
+			ReactElement text,
 			bool caseSensitiveUrlMatching = false,
 			Optional<NonBlankTrimmedString> name = new Optional<NonBlankTrimmedString>(),
 			Optional<NonBlankTrimmedString> target = new Optional<NonBlankTrimmedString>(),
@@ -88,7 +103,7 @@
 		{
 			public Props(
 				UrlDetails url,
-				NonBlankTrimmedString text,
+				Union<ReactElement, string> text,
 				bool caseSensitiveUrlMatching,
 				Optional<NonBlankTrimmedString> name,
 				Optional<NonBlankTrimmedString> target,
@@ -109,16 +124,16 @@
 				this.CtorSet(_ => _.OnClick, onClick);
 				this.CtorSet(_ => _.HistoryHandlerOverride, historyHandlerOverride);
 			}
-			public UrlDetails Url { get; private set; }
-			public NonBlankTrimmedString Text { get; private set; }
-			public bool CaseSensitiveUrlMatching { get; private set; }
-			public Optional<NonBlankTrimmedString> Name { get; private set; }
-			public Optional<NonBlankTrimmedString> Target { get; private set; }
-			public Optional<ClassName> ClassName { get; private set; }
-			public Optional<ClassName> AncestorClassName { get; private set; }
-			public Optional<ClassName> SelectedClassName { get; private set; }
-			public Optional<Action<MouseEvent<Bridge.Html5.HTMLAnchorElement>>> OnClick { get; private set; }
-			public Optional<IInteractWithBrowserRouting> HistoryHandlerOverride { get; private set; }
+			public UrlDetails Url { get; }
+			public Union<ReactElement, string> Text { get; }
+			public bool CaseSensitiveUrlMatching { get; }
+			public Optional<NonBlankTrimmedString> Name { get; }
+			public Optional<NonBlankTrimmedString> Target { get; }
+			public Optional<ClassName> ClassName { get; }
+			public Optional<ClassName> AncestorClassName { get; }
+			public Optional<ClassName> SelectedClassName { get; }
+			public Optional<Action<MouseEvent<Bridge.Html5.HTMLAnchorElement>>> OnClick { get; }
+			public Optional<IInteractWithBrowserRouting> HistoryHandlerOverride { get; }
 		}
 	}
 }


Fix for bug #125, Qt libs not found

Fix for bug #125, Qt libs not found

Visual Studio project file 'myproject.vcxproj.user' gets messed so
that correct path for debugging session is not set. This can happen
if opening existing project with 1.1.11 vs-addin. One that is created
using vs-addin 1.1.10 or older.

This change fixes the problem by checking if there is 'QTDIR' property
in wrong place in 'myproject.vcxproj.user' file indicating that also
debugging path property 'LocalDebuggerEnvironment' may be corrupt.
Property values are removed and rewritten with correct ones.

Task-number: QTVSADDINBUG-125
Change-Id: I83654d0c76dada8da970ce970d4274367fc195db
Reviewed-by: Joerg Bornemann <47777b9406dbddd02a3fdca8341789a013805a11@digia.com>

--- Qt4VS2003/QtProjectLib/QtProject.cs
+++ Qt4VS2003/QtProjectLib/QtProject.cs
@@ -3627,7 +3627,18 @@
                 // Remove old property if one exists
                 // This is set incorrectly for projects by version 1.1.10:
                 // propertyAccess.SetPropertyValue("QTDIR", null, "UserFile", qtDir);
-                propertyAccess.RemoveProperty("QTDIR", null, "UserFile");
+                VCProject vcprj = envPro.Object as VCProject;
+                if (!string.IsNullOrEmpty(propertyAccess.GetPropertyValue("QTDIR", null, "UserFile")))
+                {
+                    propertyAccess.RemoveProperty("QTDIR", null, "UserFile");
+                    // Also remove all debugger paths cause those may be invalid
+                    foreach (VCConfiguration conf in vcprj.Configurations as IVCCollection)
+                    {
+                        VCPlatform cur_platform = conf.Platform as VCPlatform;
+                        string cur_solution = conf.ConfigurationName + "|" + cur_platform.Name;
+                        propertyAccess.RemoveProperty("LocalDebuggerEnvironment", cur_solution, "UserFile");
+                    }
+                }

                 // Get platform name from given solution configuration
                 // or if not available take the active configuration
@@ -3647,7 +3658,6 @@
                 // Find all configurations for platform and set property for all of them
                 // This is to get QTDIR property set for all configurations same time so
                 // we can be sure it is set and is equal between debug and release
-                VCProject vcprj = envPro.Object as VCProject;
                 foreach (VCConfiguration conf in vcprj.Configurations as IVCCollection)
                 {
                     VCPlatform cur_platform = conf.Platform as VCPlatform;


Minor fixes

Minor fixes

--- LiteDB.Studio/Forms/MainForm.cs
+++ LiteDB.Studio/Forms/MainForm.cs
@@ -74,6 +74,8 @@

             this.LoadTreeView();
             this.AddNewTab("");
+
+            txtSql.Focus();
         }

         private void Disconnect()
@@ -102,6 +104,7 @@
             txtParameters.Clear();

             tvwDatabase.Nodes.Clear();
+            tvwDatabase.Focus();
         }

         private void UIState(bool enabled)


Update RegExCatchAll.cs

Update RegExCatchAll.cs

--- RegExCatchAllAgent/RegExCatchAll.cs
+++ RegExCatchAllAgent/RegExCatchAll.cs
@@ -1,5 +1,5 @@
 /*
- * An Exchange 2007, 2010 and 2013 Transport Protocol agent that implements catch
+ * An Exchange 2007 and 2010 Transport Protocol agent that implements catch
  * all for multiple addresses via regular expressions and also includes a recipient
  * ban list.
  *
@@ -333,4 +333,4 @@
             }
         }
     }
-}+}


#BREAKING minor change in LineString:  IList => List

--- Mapsui.Geometries/LineString.cs
+++ Mapsui.Geometries/LineString.cs
@@ -28,13 +28,13 @@
     /// </summary>
     public class LineString : Curve
     {
-        private IList<Point> _vertices;
+        private List<Point> _vertices;

         /// <summary>
         /// Initializes an instance of a LineString from a set of vertices
         /// </summary>
         /// <param name="vertices"></param>
-        public LineString(IList<Point> vertices)
+        public LineString(List<Point> vertices)
         {
             _vertices = vertices;
         }
@@ -42,7 +42,7 @@
         /// <summary>
         /// Initializes an instance of a LineString
         /// </summary>
-        public LineString() : this(new Collection<Point>())
+        public LineString() : this(new List<Point>())
         {
         }

@@ -54,13 +54,13 @@
         {
             var vertices = new Collection<Point>();
             foreach (var point in points) vertices.Add(new Point(point));
-            _vertices = vertices;
+            _vertices = vertices.ToList();
         }

         /// <summary>
         /// Gets or sets the collection of vertices in this Geometry
         /// </summary>
-        public IList<Point> Vertices
+        public List<Point> Vertices
         {
             get { return _vertices; }
             set { _vertices = value; }


MeidoCommon: TriggerHelp filters RelatedTriggers

Allow to internally set the ParentTrigger that will be filtered out of
RelatedTriggers.

--- MeidoCommon/Help/TriggerHelp.cs
+++ MeidoCommon/Help/TriggerHelp.cs
@@ -1,6 +1,8 @@
 using System;
+using System.Linq;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using MeidoCommon.ExtensionMethods;

 namespace MeidoCommon
@@ -9,7 +11,18 @@
     {
         public readonly string Parameters;
         public readonly ReadOnlyCollection<CommandHelp> Commands;
-        public IEnumerable<Trigger> RelatedTriggers { get; set; }
+
+        IEnumerable<Trigger> _related;
+        public IEnumerable<Trigger> RelatedTriggers
+        {
+            get
+            {
+                return _related.NoNull()
+                               .Where(tr => tr != ParentTrigger);
+            }
+            set { _related = value; }
+        }
+        public Trigger ParentTrigger { get; internal set; }

         // Shared field initialization.


(refactor) use DateTime.UtcNow instead of .Now for performance (see http://benhall.io/net-performance-tip-benchmarking/)

--- MumbleSharp/MumbleConnection.cs
+++ MumbleSharp/MumbleConnection.cs
@@ -18,6 +18,8 @@
     /// </summary>
     public class MumbleConnection
     {
+        private static double PING_DELAY_MILLISECONDS = 5000;
+
         public float? TcpPingAverage { get; set; }
         public float? TcpPingVariance { get; set; }
         public uint? TcpPingPackets { get; set; }
@@ -94,14 +96,14 @@

         public void Process()
         {
-            if ((DateTime.Now - _lastSentPing).TotalSeconds > 5)
+            if ((DateTime.UtcNow - _lastSentPing).TotalMilliseconds > PING_DELAY_MILLISECONDS)
             {
                 _tcp.SendPing();

                 if (_udp.IsConnected)
                     _udp.SendPing();

-                _lastSentPing = DateTime.Now;
+                _lastSentPing = DateTime.UtcNow;
             }
             _tcp.Process();
             _udp.Process();
@@ -234,7 +236,7 @@
             if (ping.ShouldSerializeTimestamp() && ping.Timestamp != 0)
             {
                 var mostRecentPingtime =
-                    (float)TimeSpan.FromTicks(DateTime.Now.Ticks - (long)ping.Timestamp).TotalMilliseconds;
+                    (float)TimeSpan.FromTicks(DateTime.UtcNow.Ticks - (long)ping.Timestamp).TotalMilliseconds;

                 //The ping time is the one-way transit time.
                 mostRecentPingtime /= 2;
@@ -295,10 +297,10 @@
                 _reader = new BinaryReader(_ssl);
                 _writer = new BinaryWriter(_ssl);

-                DateTime startWait = DateTime.Now;
+                DateTime startWait = DateTime.UtcNow;
                 while (!_ssl.IsAuthenticated)
                 {
-                    if (DateTime.Now - startWait > TimeSpan.FromSeconds(2))
+                    if (DateTime.UtcNow - startWait > TimeSpan.FromSeconds(2))
                         throw new TimeoutException("Timed out waiting for ssl authentication");

                     System.Threading.Thread.Sleep(10);
@@ -402,7 +404,7 @@
                 //  otherwise the stats will be throw off by the time it takes to connect.
                 if (_connection._shouldSetTimestampWhenPinging)
                 {
-                    ping.Timestamp = (ulong) DateTime.Now.Ticks;
+                    ping.Timestamp = (ulong)DateTime.UtcNow.Ticks;
                 }

                 if (_connection.TcpPingAverage.HasValue)
@@ -435,7 +437,9 @@
                 lock (_ssl)
                 {
                     PacketType type = (PacketType)IPAddress.NetworkToHostOrder(_reader.ReadInt16());
+#if DEBUG
                     Console.WriteLine("{0:HH:mm:ss}: {1}", DateTime.Now, type.ToString());
+#endif

                     switch (type)
                     {
@@ -564,7 +568,7 @@

             public void SendPing()
             {
-                long timestamp = DateTime.Now.Ticks;
+                long timestamp = DateTime.UtcNow.Ticks;

                 byte[] buffer = new byte[9];
                 buffer[0] = 1 << 5;


Move useful RandomString function into Utilities

--- NET/API/Treehopper/Utilities.cs
+++ NET/API/Treehopper/Utilities.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Linq;

 namespace Treehopper
 {
@@ -77,5 +78,13 @@
             }
             return retVal;
         }
+
+        static Random random = new Random();
+        public static string RandomString(int length)
+        {
+            const string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
+            return new string(Enumerable.Repeat(chars, length)
+              .Select(s => s[random.Next(s.Length)]).ToArray());
+        }
     }
 }


release 1.1.1

release 1.1.1

--- RptToXml/Properties/AssemblyInfo.cs
+++ RptToXml/Properties/AssemblyInfo.cs
@@ -12,4 +12,4 @@

 [assembly: ComVisible(false)]

-[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.1.1")]


Fix broken tests

Fix broken tests

--- Nancy.Pile.Tests/SampleTests.cs
+++ Nancy.Pile.Tests/SampleTests.cs
@@ -15,7 +15,7 @@
             var browser = new Browser(bootstrapper);
             var result = browser.Get("/styles.css", with => with.HttpRequest());
             result.StatusCode.Should().Be(HttpStatusCode.OK);
-            result.Body.ToArray().Length.Should().Be(35356);
+            result.Body.ToArray().Length.Should().Be(35358);
         }

         [TestMethod]
@@ -25,7 +25,7 @@
             var browser = new Browser(bootstrapper);
             var result = browser.Get("/scripts.js", with => with.HttpRequest());
             result.StatusCode.Should().Be(HttpStatusCode.OK);
-            result.Body.ToArray().Length.Should().Be(133498);
+            result.Body.ToArray().Length.Should().Be(133503);
         }
     }
 }


lol stacktraces are strings you dummy

lol stacktraces are strings you dummy

--- RxSpy.Server/Events/OnErrorEvent.cs
+++ RxSpy.Server/Events/OnErrorEvent.cs
@@ -21,11 +21,7 @@
             OperatorId = operatorInfo.Id;
             ErrorType = new TypeInfo(error.GetType());
             Message = error.Message;
-
-            if (error.StackTrace != null && error.StackTrace.Length > 0)
-            {
-                StackTrace = error.StackTrace.ToString();
-            }
+            StackTrace = error.StackTrace;
         }

     }


Conflicts fixed

Conflicts fixed

--- backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs
+++ backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs
@@ -77,14 +77,9 @@
         {
             switch (@event.Payload)
             {
-<<<<<<< HEAD
-                case ContentCreated contentCreated:
-                    contentIdsBySchemaId.GetOrAddNew(contentCreated.SchemaId.Id).Add(@event.Headers.AggregateId());
-=======
                 case AppCreated appCreated:
                     assetsUrlNew = GetUrls(appCreated.Name);
                     assetsUrlOld = await ReadUrlsAsync(context.Reader);
->>>>>>> release/4.x
                     break;
                 case SchemaDeleted schemaDeleted:
                     contentIdsBySchemaId.Remove(schemaDeleted.SchemaId.Id);


BL-2787 Give nicer message when we get the mystery paste failure

--- src/BloomExe/Browser.cs
+++ src/BloomExe/Browser.cs
@@ -379,20 +379,34 @@

 		private void PasteFilteredText(bool removeSingleLineBreaks)
 		{
-			Debug.Assert(!InvokeRequired);
-
-			//Remove everything from the clipboard except the unicode text (e.g. remove messy html from ms word)
-			var text = BloomClipboard.GetText(TextDataFormat.UnicodeText);
-
-			if (!string.IsNullOrEmpty(text))
-			{
-				if (removeSingleLineBreaks)
-				{
-					text = text.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ");
-				}
-				//setting clears other formats that might be on the clipboard, such as html
-				BloomClipboard.SetText(text, TextDataFormat.UnicodeText);
-				_browser.Paste();
+			//this prone to dying in System.Windows.Forms.Clipboard.SetText. E.g. bl-2787
+			try
+			{
+
+				Debug.Assert(!InvokeRequired);
+
+				//Remove everything from the clipboard except the unicode text (e.g. remove messy html from ms word)
+				var text = BloomClipboard.GetText(TextDataFormat.UnicodeText);
+
+				if (!string.IsNullOrEmpty(text))
+				{
+					if (removeSingleLineBreaks)
+					{
+						text = text.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ");
+					}
+					//setting clears other formats that might be on the clipboard, such as html
+					BloomClipboard.SetText(text, TextDataFormat.UnicodeText);
+					_browser.Paste();
+				}
+
+			}
+			catch (Exception error)
+			{
+				Logger.WriteEvent("***Failed to paste in Browser.PasteFilteredText()");
+#if DEBUG
+				throw error;
+#endif
+				Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error, "There was a problem pasting from the clipboard.");
 			}
 		}


feat(DataService): 将原来的 XXXCore(...) 方法更名为 OnXXX(...)，并修复一些参数处理的错误。 :red_car:

--- src/Data/DataService.cs
+++ src/Data/DataService.cs
@@ -295,7 +295,7 @@
 				return args.Result;

 			//执行数据获取操作方法
-			var items = this.GetCore(args.Condition, args.Scope, args.Paging, args.Sortings);
+			var items = this.OnGet(args.Condition, args.Scope, args.Paging, args.Sortings);

 			//进一步处理数据结果
 			args.Result = resultThunk != null ? resultThunk(items) : items;
@@ -304,7 +304,7 @@
 			return this.OnGetted(args.Condition, args.Scope, args.Paging, args.Sortings, args.Result);
 		}

-		protected virtual IEnumerable<TEntity> GetCore(ICondition condition, string scope, Paging paging, params Sorting[] sortings)
+		protected virtual IEnumerable<TEntity> OnGet(ICondition condition, string scope, Paging paging, params Sorting[] sortings)
 		{
 			return this.DataAccess.Select<TEntity>(this.Name, condition, scope, paging, sortings);
 		}
@@ -353,7 +353,7 @@
 				return args.Result as IEnumerable<TEntity>;

 			//执行数据查询操作
-			args.Result = this.SelectCore(args.Condition, args.Grouping, args.Scope, args.Paging, args.Sortings);
+			args.Result = this.OnSelect(args.Condition, args.Grouping, args.Scope, args.Paging, args.Sortings);

 			//激发“Selected”事件
 			return this.OnSelected(typeof(TEntity), args.Condition, args.Grouping, args.Scope, args.Paging, args.Sortings, (IEnumerable<TEntity>)args.Result);
@@ -369,7 +369,7 @@
 			return this.Select(condition, grouping, scope, paging, sortings);
 		}

-		protected virtual IEnumerable<TEntity> SelectCore(ICondition condition, Grouping grouping, string scope, Paging paging, params Sorting[] sortings)
+		protected virtual IEnumerable<TEntity> OnSelect(ICondition condition, Grouping grouping, string scope, Paging paging, params Sorting[] sortings)
 		{
 			return this.DataAccess.Select<TEntity>(this.Name, condition, grouping, scope, paging, sortings);
 		}
@@ -400,13 +400,13 @@
 				return args.Result;

 			//执行数据删除操作
-			args.Result = this.DeleteCore(args.Condition, args.Cascades);
+			args.Result = this.OnDelete(args.Condition, args.Cascades);

 			//激发“Deleted”事件
 			return this.OnDeleted(args.Condition, args.Cascades, args.Result);
 		}

-		protected virtual int DeleteCore(ICondition condition, string[] cascades)
+		protected virtual int OnDelete(ICondition condition, string[] cascades)
 		{
 			if(condition == null)
 				throw new NotSupportedException("The condition cann't is null on delete operation.");
@@ -425,7 +425,7 @@
 				return args.Result;

 			//执行数据插入操作
-			args.Result = this.InsertCore(DataDictionary<TEntity>.GetDataDictionary(args.Data), args.Scope);
+			args.Result = this.OnInsert(DataDictionary<TEntity>.GetDataDictionary(args.Data), args.Scope);

 			//激发“Inserted”事件
 			return this.OnInserted(args.Data, args.Scope, args.Result);
@@ -439,43 +439,37 @@
 			if(args.Cancel)
 				return args.Result;

-			//创建数据包裹器列表
-			var items = new List<DataDictionary<TEntity>>();
-
-			//设置数据包裹器列表的内容
-			if(args.Data is IEnumerable)
-			{
-				foreach(var item in (IEnumerable)args.Data)
-				{
-					items.Add(DataDictionary<TEntity>.GetDataDictionary(item));
-				}
-			}
-			else
-			{
-				items.Add(DataDictionary<TEntity>.GetDataDictionary(data));
-			}
-
 			//执行数据插入操作
-			args.Result = this.InsertManyCore(items.ToArray(), args.Scope);
+			args.Result = this.OnInsertMany(DataDictionary<TEntity>.GetDataDictionaries(args.Data), args.Scope);

 			//激发“Inserted”事件
 			return this.OnInserted(args.Data, args.Scope, args.Result);
 		}

-		protected virtual int InsertCore(DataDictionary<TEntity> data, string scope)
+		protected virtual int OnInsert(DataDictionary<TEntity> data, string scope)
 		{
 			if(data == null || data.Data == null)
 				return 0;

-			return this.DataAccess.Insert(this.Name, data.Data, scope);
-		}
-
-		protected virtual int InsertManyCore(IEnumerable<DataDictionary<TEntity>> items, string scope)
+			return this.DataAccess.Insert(this.Name, data, scope);
+		}
+
+		protected virtual int OnInsertMany(IEnumerable<DataDictionary<TEntity>> items, string scope)
 		{
 			if(items == null)
 				return 0;

-			return this.DataAccess.InsertMany(this.Name, items.Select(p => p.Data), scope);
+			int count = 0;
+
+			using(var transaction = new Zongsoft.Transactions.Transaction())
+			{
+				foreach(var item in items)
+				{
+					count += this.OnInsert(item, scope);
+				}
+			}
+
+			return count;
 		}
 		#endregion

@@ -519,7 +513,7 @@
 				return args.Result;

 			//执行数据更新操作
-			args.Result = this.UpdateCore(DataDictionary<TEntity>.GetDataDictionary(args.Data), args.Condition, args.Scope);
+			args.Result = this.OnUpdate(DataDictionary<TEntity>.GetDataDictionary(args.Data), args.Condition, args.Scope);

 			//激发“Updated”事件
 			return this.OnUpdated(args.Data, args.Condition, args.Scope, args.Result);
@@ -538,24 +532,8 @@
 			if(args.Cancel)
 				return args.Result;

-			//创建数据包裹器列表
-			var items = new List<DataDictionary<TEntity>>();
-
-			//设置数据包裹器列表的内容
-			if(args.Data is IEnumerable)
-			{
-				foreach(var item in (IEnumerable)args.Data)
-				{
-					items.Add(DataDictionary<TEntity>.GetDataDictionary(item));
-				}
-			}
-			else
-			{
-				items.Add(DataDictionary<TEntity>.GetDataDictionary(data));
-			}
-
 			//执行数据更新操作
-			args.Result = this.UpdateManyCore(items.ToArray(), args.Condition, args.Scope);
+			args.Result = this.OnUpdateMany(DataDictionary<TEntity>.GetDataDictionaries(args.Data), args.Condition, args.Scope);

 			//激发“Updated”事件
 			return this.OnUpdated(args.Data, args.Condition, args.Scope, args.Result);
@@ -566,20 +544,30 @@
 			return this.UpdateMany(data, condition, scope);
 		}

-		protected virtual int UpdateCore(DataDictionary<TEntity> data, ICondition condition, string scope)
+		protected virtual int OnUpdate(DataDictionary<TEntity> data, ICondition condition, string scope)
 		{
 			if(data == null || data.Data == null)
 				return 0;

-			return this.DataAccess.Update(this.Name, data.Data, condition, scope);
-		}
-
-		protected virtual int UpdateManyCore(IEnumerable<DataDictionary<TEntity>> items, ICondition condition, string scope)
+			return this.DataAccess.Update(this.Name, data, condition, scope);
+		}
+
+		protected virtual int OnUpdateMany(IEnumerable<DataDictionary<TEntity>> items, ICondition condition, string scope)
 		{
 			if(items == null)
 				return 0;

-			return this.DataAccess.UpdateMany(this.Name, items.Select(p => p.Data), condition, scope);
+			int count = 0;
+
+			using(var transaction = new Zongsoft.Transactions.Transaction())
+			{
+				foreach(var item in items)
+				{
+					count += this.OnUpdate(item, condition, scope);
+				}
+			}
+
+			return count;
 		}
 		#endregion


minor refactoring

minor refactoring

--- Sailthru/Sailthru/SailthruClient.cs
+++ Sailthru/Sailthru/SailthruClient.cs
@@ -463,9 +463,6 @@
         */
         protected SailthruResponse HttpRequest(string strURI, string strData, string strMethod)
         {
-
-            WebResponse response;
-            WebRequest request;
             HttpWebRequest httpWebRequest;
             try
             {
@@ -494,9 +491,6 @@
                     httpWebRequest.SendChunked = false;
                     httpWebRequest.UserAgent = "Sailthru API C# Client";
                     httpWebRequest.Method = strMethod;
-
-                    request = WebRequest.Create(strURI + "?" + strData);
-                    request.Method = strMethod;
                 }

                 return new SailthruResponse((HttpWebResponse)httpWebRequest.GetResponse());
@@ -505,8 +499,7 @@
             {
                 using (HttpWebResponse errorResponse = (HttpWebResponse)e.Response)
                 {
-                    response = errorResponse;
-                    return new SailthruResponse((HttpWebResponse)response);
+                    return new SailthruResponse((HttpWebResponse)errorResponse);
                 }
             }


* Added timeout value to the request so we can override the timeout's for very long requests like file upload/downloading.

--- Scripts/Connection/RESTConnector.cs
+++ Scripts/Connection/RESTConnector.cs
@@ -487,7 +487,7 @@
                             url, string.IsNullOrEmpty( www.error ) ? "Timeout" : www.error );
                     }

-                    resp.ElapsedTime = Time.time - startTime;
+                    resp.ElapsedTime = (float)(DateTime.Now - startTime).TotalSeconds;
                     if ( req.OnResponse != null )
                         req.OnResponse( req, resp );

@@ -496,13 +496,15 @@
                 else
                 {
 #if UNITY_EDITOR
+                    float timeout = Mathf.Max( Config.Instance.TimeOut, req.Timeout );
+
                     DeleteRequest deleteReq = new DeleteRequest();
                     deleteReq.Send( url, req.Headers );
                     while(! deleteReq.IsComplete )
                     {
                         if ( req.Cancel )
                             break;
-                        if ( Time.time > (startTime + Config.Instance.TimeOut) )
+                        if ( (DateTime.Now - startTime).TotalSeconds > timeout )
                             break;
                         yield return null;
                     }
@@ -515,7 +517,7 @@
                     Log.Warning( "RESTConnector", "DELETE method is supported in the editor only." );
                     resp.Success = false;
 #endif
-                    resp.ElapsedTime = Time.time - startTime;
+                    resp.ElapsedTime = (float)(DateTime.Now - startTime).TotalSeconds;
                     if ( req.OnResponse != null )
                         req.OnResponse( req, resp );
                 }


Add Windows 8 to the OS's we detect.

Add Windows 8 to the OS's we detect.

--- Palaso/Reporting/ErrorReport.cs
+++ Palaso/Reporting/ErrorReport.cs
@@ -380,6 +380,7 @@
 			list.Add(new Version(System.PlatformID.Win32NT, 1, 5, "Windows XP"));
 			list.Add(new Version(System.PlatformID.Win32NT, 0, 6, "Vista"));
 			list.Add(new Version(System.PlatformID.Win32NT, 1, 6, "Windows 7"));
+			list.Add(new Version(System.PlatformID.Win32NT, 2, 6, "Windows 8"));
 			foreach (var version in list)
 			{
 				if(version.Match(System.Environment.OSVersion))


Fix showing projects under incorrect workspace.

Closes #95

--- Phoebe/Data/Models/UserModel.cs
+++ Phoebe/Data/Models/UserModel.cs
@@ -80,7 +80,7 @@

                 IEnumerable<ProjectModel> projects;
                 projects = workspace.Projects.NotDeleted ().Where ((m) => m.IsActive && m.IsPrivate != true);
-                projects = projects.Union (Projects.Select ((m) => m.From).Where ((m) => m.IsActive));
+                projects = projects.Union (Projects.Select ((m) => m.From).Where ((m) => m.IsActive && m.WorkspaceId == workspace.Id));
                 return projects.OrderBy ((m) => m.Name).ToList ();
             }
         }


Small sora guardian change

Small sora guardian change

--- SoraBot/SoraBot.Guardian/Program.cs
+++ SoraBot/SoraBot.Guardian/Program.cs
@@ -19,7 +19,7 @@
         // ReSharper disable once NotAccessedField.Local
         private static Timer _timer;
         private const int _OVERWATCH_COOLDOWN_MINS = 5;
-        private const float _FREE_THRESHOLD = 0.15f;
+        private const float _FREE_THRESHOLD = 0.25f;

         private static int _count = 0;
         private const int _MAX_COUNT = 4;
@@ -111,8 +111,8 @@
                 _count = 0;

                 Log.Information("Available Memory below threshold and count exceeded. Restarting Sora services.");
-                var soraProd = RestartSoraService("sora-oct-prod@{0..2}");
-                var soraBeta = RestartSoraService("sora-oct");
+                var soraProd = RestartSoraService("sora@{0..2}");
+                var soraBeta = RestartSoraService("sora");
                 soraProd.Start();
                 soraBeta.Start();


Update Startup.cs

Update Startup.cs

--- src/HelloWeb/Startup.cs
+++ src/HelloWeb/Startup.cs
@@ -7,9 +7,9 @@
     {
         public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
         {
-            loggerFactory.AddConsole()
+            loggerFactory.AddConsole();
             app.UseStaticFiles();
             app.UseWelcomePage();
-
+        }
     }
 }


removed unused method

removed unused method

--- src/core/Akka/IO/TcpConnection.cs
+++ src/core/Akka/IO/TcpConnection.cs
@@ -859,11 +859,6 @@
             }

             public override void Release() { }
-
-            public PendingWrite Copy(ByteString newData)
-            {
-                return new PendingBufferWrite(_connection, _sendArgs, _self, Commander, newData, Ack, _tail);
-            }
         }
     }
 }


Fix broken log message.

Fix broken log message.

--- Source/MQTTnet/Client/MqttClient.cs
+++ Source/MQTTnet/Client/MqttClient.cs
@@ -325,7 +325,7 @@
                 }
                 catch (MqttCommunicationTimedOutException)
                 {
-                    _logger.Warning(null, "Timeout while waiting for packet of type '{0}'.", typeof(TResponsePacket).Namespace);
+                    _logger.Warning(null, "Timeout while waiting for packet of type '{0}'.", typeof(TResponsePacket).Name);
                     throw;
                 }
             }


Offer to resend messages in case of failure

Default is not to. If RequeueMessageAfterFailure is true, messages might
be send twice. When false they might be lost when failure occurs.

--- RabbitMQHare/RabbitPublisher.cs
+++ RabbitMQHare/RabbitPublisher.cs
@@ -36,6 +36,12 @@
         /// Interval between two retries when connecting to rabbitmq. Default is 5 seconds
         /// </summary>
         public TimeSpan IntervalConnectionTries { get; set; }
+
+        /// <summary>
+        /// Prefer to send a message twice than loosing it
+        /// Order is not garanteed
+        /// </summary>
+        public bool RequeueMessageAfterFailure { get; set; }

         public static HarePublisherSettings GetDefaultSettings()
         {
@@ -198,6 +204,8 @@
                             }
                             catch (RabbitMQ.Client.Exceptions.AlreadyClosedException e)
                             {
+                                if (MySettings.RequeueMessageAfterFailure)
+                                    _internalQueue.Enqueue(res);
                                 switch (e.ShutdownReason.ReplyCode)
                                 {
                                     case RabbitMQ.Client.Framing.v0_9_1.Constants.AccessRefused:
@@ -211,6 +219,8 @@
                             }
                             catch
                             {
+                                if (MySettings.RequeueMessageAfterFailure)
+                                    _internalQueue.Enqueue(res);
                                 //No need to offer any event handler since reconnection will probably fail at the first time and the standard handlers will be called
                                 Start();
                             }


Fix registry write access

Fix registry write access

--- SteamAccountSwitcher/SteamClient.cs
+++ SteamAccountSwitcher/SteamClient.cs
@@ -87,7 +87,7 @@

             try
             {
-                using var registryKey = Registry.CurrentUser.OpenSubKey(Resources.SteamRegistryDirectoryPath);
+                using var registryKey = Registry.CurrentUser.OpenSubKey(Resources.SteamRegistryDirectoryPath, true);
                 registryKey?.SetValue("AutoLoginUser", user);
                 return true;
             }