Manage index for peak pairs

Manage index for peak pairs

--- AudioAlign/AudioAlign.Audio/Matching/Wang2003/FingerprintGenerator.cs
+++ AudioAlign/AudioAlign.Audio/Matching/Wang2003/FingerprintGenerator.cs
@@ -14,7 +14,7 @@
         private int windowSize = 512;
         private int hopSize = 256;

-        private float spectrumMinThreshold = -200; // dB
+        private float spectrumMinThreshold = -200; // dB volume
         private float spectrumTemporalSmoothingCoefficient = 0.05f;

         private int spectrumSmoothingLength = 3; // the width in samples of the FFT spectrum to average over
@@ -39,6 +39,7 @@
             STFT stft = new STFT(audioStream, windowSize, hopSize, WindowType.Hann);
             int index = 0;
             int indices = stft.WindowCount;
+            int processedFrames = 0;

             float[] spectrum = new float[windowSize / 2];
             //float[] smoothedSpectrum = new float[frameBuffer.Length - frameSmoothingLength + 1]; // the smooved frequency spectrum of the current frame
@@ -47,10 +48,7 @@
             float[] spectrumResidual = new float[spectrum.Length]; // the difference between the current spectrum and the moving average spectrum

             //var peaks = new List<Peak>(spectrum.Length / 2); // keep a single instance of the list to avoid instantiation overhead
-            var peakHistory = new RingBuffer<List<Peak>>(1 + targetZoneDistance + targetZoneLength); // a FIFO list of peak lists
-            for (int i = 0; i < peakHistory.Length; i++) {
-                peakHistory.Add(new List<Peak>(spectrum.Length / 2)); // instantiate peak lists for later reuse
-            }
+            var peakHistory = new PeakHistory(1 + targetZoneDistance + targetZoneLength, spectrum.Length / 2);
             var peakPairs = new List<PeakPair>(peaksPerFrame * peakFanout); // keep a single instance of the list to avoid instantiation overhead

             while (stft.HasNext()) {
@@ -70,11 +68,12 @@
                 // This skips silent frames (zero samples) that only contain very low noise from the FFT
                 // and that would screw up the temporal spectrum average below for the following frames.
                 if (spectrum.Average() < spectrumMinThreshold) {
+                    index++;
                     continue;
                 }

                 // Update the temporal moving bin average
-                if (index == 0) {
+                if (processedFrames == 0) {
                     // Init averages on first frame
                     for (int i = 0; i < spectrum.Length; i++) {
                         spectrumTemporalAverage[i] = spectrum[i];
@@ -99,7 +98,7 @@
                 // The advantage of finding peaks in the residual instead of the spectrum is that spectrum energy is usually
                 // concentrated in the low frequencies, resulting in a clustering if the highest peaks in the lows. Getting
                 // peaks from the residual distributes the peaks more evenly across the spectrum.
-                var peaks = peakHistory[0]; // take oldest list,
+                var peaks = peakHistory.List; // take oldest list,
                 peaks.Clear(); // clear it, and
                 FindLocalMaxima(spectrumResidual, peaks); // refill with new peaks

@@ -113,7 +112,7 @@
                     peaks.Sort((p1, p2) => p1.Index == p2.Index ? 0 : p1.Index < p2.Index ? -1 : 1); // sort peaks by index (not really necessary)
                 }

-                peakHistory.Add(peaks);
+                peakHistory.Add(index, peaks);

                 // Mark peaks as 0dB for spectrogram display purposes
                 foreach (var peak in peaks) {
@@ -128,19 +127,24 @@
                     });
                 }

+                processedFrames++;
+                index++;
+
+                if (processedFrames >= peakHistory.Length) {
+                    peakPairs.Clear();
+                    FindPairs(peakHistory, peakPairs);
+                    var peakPairsIndex = peakHistory.Index;
+                }
+            }
+
+            // Flush the remaining peaks of the last frames from the history to get all remaining pairs
+            for (int i = 0; i < targetZoneLength; i++) {
+                var peaks = peakHistory.List;
+                peaks.Clear();
+                peakHistory.Add(-1, peaks);
                 peakPairs.Clear();
                 FindPairs(peakHistory, peakPairs);
-
-                index++;
-            }
-
-            // Flush the remaining peaks of the last frames from the history to get all remaining pairs
-            for (int i = 0; i < targetZoneLength; i++) {
-                var peaks = peakHistory[0];
-                peaks.Clear();
-                peakHistory.Add(peaks);
-                peakPairs.Clear();
-                FindPairs(peakHistory, peakPairs);
+                var peakPairsIndex = peakHistory.Index;
             }
         }

@@ -190,7 +194,7 @@
             //Debug.WriteLine("{0} local maxima found", maxima.Count);
         }

-        private List<PeakPair> FindPairs(RingBuffer<List<Peak>> peakHistory, List<PeakPair> peakPairs) {
+        private List<PeakPair> FindPairs(PeakHistory peakHistory, List<PeakPair> peakPairs) {
             var halfWidth = targetZoneWidth / 2;

             // Get pairs from peaks
@@ -198,10 +202,10 @@
             // which would result in a list of the most prominent peak pairs.
             // For now, this just iterates linearly through frames and their peaks and generates a pair if the
             // constraints of the target area permit, until the max number of pairs has been generated.
-            foreach (var peak in peakHistory[0]) {
+            foreach (var peak in peakHistory.Lists[0]) {
                 int count = 0;
                 for (int distance = targetZoneDistance; distance < peakHistory.Length; distance++) {
-                    foreach (var targetPeak in peakHistory[distance]) {
+                    foreach (var targetPeak in peakHistory.Lists[distance]) {
                         if (peak.Index >= targetPeak.Index - halfWidth && peak.Index <= targetPeak.Index + halfWidth) {
                             peakPairs.Add(new PeakPair { Peak1 = peak, Peak2 = targetPeak, Distance = distance });
                             if (++count >= peakFanout) {
@@ -238,5 +242,88 @@
             public Peak Peak2 { get; set; }
             public int Distance { get; set; }
         }
+
+        /// <summary>
+        /// Helper class to encapsulate the management of the two FIFOs for building a
+        /// peak history over time which is needed to calculate peak pairs. This history
+        /// needs to contain the whole target zone of each peak.
+        /// The first history entry, which is the oldest, is always the one for which
+        /// pairs are calculated. After calculation, the oldest entries can be taken
+        /// through the Index/List properties, updated with new data and readded to the history,
+        /// which moves the second oldest entry to the first position (thus, it becomes the oldest),
+        /// and the oldest entry gets reused and added as the most recent to the end.
+        /// </summary>
+        private class PeakHistory {
+
+            private RingBuffer<int> indexHistory; // a FIFO list of peak list indices
+            private RingBuffer<List<Peak>> peakHistory; // a FIFO list of peak lists
+
+            public PeakHistory(int length, int maxPeaksPerFrame) {
+                indexHistory = new RingBuffer<int>(length);
+                peakHistory = new RingBuffer<List<Peak>>(length);
+
+                // Instantiate peak lists for later reuse
+                for (int i = 0; i < length; i++) {
+                    indexHistory.Add(-1);
+                    peakHistory.Add(new List<Peak>(maxPeaksPerFrame));
+                }
+            }
+
+            /// <summary>
+            /// The capacity of the history.
+            /// </summary>
+            public int Length {
+                get { return peakHistory.Length; }
+            }
+
+            /// <summary>
+            /// The number of elements in the history.
+            /// This always equals to the Length because it gets pre-filled
+            /// at construction time.
+            /// </summary>
+            public int Count {
+                get { return peakHistory.Count; }
+            }
+
+            /// <summary>
+            /// The current (oldest) index.
+            /// This is the index of the peak list that pairs are calculated for.
+            /// </summary>
+            public int Index {
+                get { return indexHistory[0]; }
+            }
+
+            /// <summary>
+            /// The current (oldest) peak list.
+            /// This is the peak list that pairs are calculated for.
+            /// </summary>
+            public List<Peak> List {
+                get { return peakHistory[0]; }
+            }
+
+            /// <summary>
+            /// Gets the FIFO queue of the indices.
+            /// </summary>
+            public RingBuffer<int> Indices {
+                get { return indexHistory; }
+            }
+
+            /// <summary>
+            /// Gets the FIFO queue of the peak lists.
+            /// </summary>
+            public RingBuffer<List<Peak>> Lists {
+                get { return peakHistory; }
+            }
+
+            /// <summary>
+            /// Adds an indexed list to the top (most recent position) of the FIFO queue.
+            /// </summary>
+            /// <param name="index"></param>
+            /// <param name="list"></param>
+            public void Add(int index, List<Peak> list) {
+                indexHistory.Add(index);
+                peakHistory.Add(list);
+            }
+        }
     }
 }


Remove unused helper class

Remove unused helper class

--- Azuria/Helpers/Extensions/TypeExtensions.cs
+++ Azuria/Helpers/Extensions/TypeExtensions.cs
@@ -1,11 +0,0 @@
-using System;
-using System.Reflection;
-
-namespace Azuria.Helpers.Extensions
-{
-    internal static class TypeExtensions
-    {
-        public static bool CanBeNullAssigned(this Type info) =>
-            !info.GetTypeInfo().IsValueType || Nullable.GetUnderlyingType(info) != null;
-    }
-}


Fix S2of5 checksum

Fix S2of5 checksum

--- BarcodeStandard/Symbologies/Standard2of5.cs
+++ BarcodeStandard/Symbologies/Standard2of5.cs
@@ -45,11 +45,13 @@
             var even = true;
             for (var i = Raw_Data.Length - 1; i >= 0; --i)
             {
-                sum += Raw_Data[i] * (even ? 3 : 1);
+                //convert numeric in char format to integer and
+                //multiply by 3 or 1 based on if an even index from the end
+                sum += (Raw_Data[i] - '0') * (even ? 3 : 1);
                 even = !even;
             }

-            return sum % 10;
+            return (10 - sum % 10) % 10;
         }

         #region IBarcode Members


assembly attributes correction

assembly attributes correction

--- BigQueryProvider/Properties/AssemblyInfo.cs
+++ BigQueryProvider/Properties/AssemblyInfo.cs
@@ -1,36 +1,17 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System;
+using System.Reflection;
 using System.Runtime.InteropServices;

-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ConsoleApplication5")]
+[assembly: AssemblyTitle("DevExpress.DataAccess.BigQuery")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ConsoleApplication5")]
+[assembly: AssemblyProduct("DevExpress.DataAccess.BigQuery")]
 [assembly: AssemblyCopyright("Copyright ©  2015")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]

-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("cc549adb-af17-4070-8a34-0edae0bc2233")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]


Improved contract resolver for serialization

--- ESAPIX/Facade/Serialization/ESAPIContractResolver.cs
+++ ESAPIX/Facade/Serialization/ESAPIContractResolver.cs
@@ -39,6 +39,24 @@
                   case nameof(IScriptContext.IonPlanSetup):
                     excludingNames.Add(nameof(IonPlanSetup.Course));
                     break;
+                case nameof(BeamCalculationLog):
+                    excludingNames.Add(nameof(Beam));
+                    break;
+                case nameof(EstimatedDVH):
+                    excludingNames.Add(nameof(EstimatedDVH.PlanSetup));
+                    excludingNames.Add(nameof(EstimatedDVH.Structure));
+                    break;
+                case nameof(OptimizationObjective):
+                    excludingNames.Add(nameof(OptimizationObjective.Structure));
+                    break;
+#endif
+#if (VMS155)
+                case nameof(PlanTreatmentSession):
+                    excludingNames.Add(nameof(PlanTreatmentSession.PlanSetup));
+                    break;
+                case nameof(TreatmentSession):
+                    excludingNames.Add(nameof(TreatmentSession.SessionPlans));
+                    break;
 #endif
                 case nameof(IScriptContext.PlanSetup):
                     excludingNames.Add(nameof(PlanSetup.Course));


Improved property cleanup...some test sites had 10000+ properties causing "request uses too many resources" errors

--- Core/OfficeDevPnP.Core.Tests/AppModelExtensions/WebExtensionsTests.cs
+++ Core/OfficeDevPnP.Core.Tests/AppModelExtensions/WebExtensionsTests.cs
@@ -49,15 +49,32 @@
             clientContext.Load(props);
             clientContext.ExecuteQueryRetry();

-            if (props.FieldValues.ContainsKey(_key))
-            {
-                props[_key] = null;
-                props.FieldValues.Remove(_key);
-            }
-            if (props.FieldValues.ContainsKey(INDEXED_PROPERTY_KEY))
-            {
-                props[INDEXED_PROPERTY_KEY] = null;
-                props.FieldValues.Remove(INDEXED_PROPERTY_KEY);
+            // Implement cleanup mechanism that cleans test stranglers + also cleans up the NoMobileMapping key that's generated per created sub site
+            List<string> keysToDelete = new List<string>(10);
+            foreach(var prop in props.FieldValues)
+            {
+                if (prop.Key.StartsWith("TEST_KEY_", StringComparison.InvariantCultureIgnoreCase) ||
+                    prop.Key.StartsWith("TEST_VALUE_", StringComparison.InvariantCultureIgnoreCase) ||
+                    prop.Key.StartsWith("__NoMobileMapping", StringComparison.InvariantCultureIgnoreCase))
+                {
+                    keysToDelete.Add(prop.Key);
+                }
+            }
+
+            int batch = 0;
+            foreach (string key in keysToDelete)
+            {
+                props[key] = null;
+                props.FieldValues.Remove(key);
+                batch++;
+
+                // send cleanup in batches of 50 to the server
+                if (batch >= 50)
+                {
+                    clientContext.Web.Update();
+                    clientContext.ExecuteQueryRetry();
+                    batch = 0;
+                }
             }
             clientContext.Web.Update();
             clientContext.ExecuteQueryRetry();


update filter sinlge rescore

update filter sinlge rescore

--- EngineLayer/CrosslinkSearch/CrosslinkSearchEngine.cs
+++ EngineLayer/CrosslinkSearch/CrosslinkSearchEngine.cs
@@ -143,8 +143,6 @@

                         foreach (int id in idsOfPeptidesPossiblyObserved.OrderByDescending(p => scoringTable[p]))
                         {
-                            idsOfPeptidesTopN.Add(id);
-
                             peptideCount++;
                             // Whenever the count exceeds the TopN that we want to keep, we removed everything with a score lower than the score of the TopN-th peptide in the ids list
                             if (peptideCount == TopN)
@@ -156,8 +154,7 @@
                             {
                                 break;
                             }
-
-
+                            idsOfPeptidesTopN.Add(id);
                         }

                         //peptide candidates in idsOfPeptidesTopN are treated as alpha peptides. Then the mass of the beta peptides are calculated and searched from massTable.
@@ -218,13 +215,16 @@
                     var matchedFragmentIons = MatchFragmentIons(scan, products, CommonParameters);
                     double score = CalculatePeptideScore(scan.TheScan, matchedFragmentIons);

-                    var psmCrossSingle = new CrosslinkSpectralMatch(PeptideIndex[id], 0, score, scanIndex, scan, CommonParameters.DigestionParams, matchedFragmentIons)
-                    {
-                        CrossType = PsmCrossType.Single,
-                        //XlRank = new List<int> { alphaIndex }
-                    };
-
-                    possibleMatches.Add(psmCrossSingle);
+                    if (score > (double)byteScoreCutoff)
+                    {
+                        var psmCrossSingle = new CrosslinkSpectralMatch(PeptideIndex[id], 0, score, scanIndex, scan, CommonParameters.DigestionParams, matchedFragmentIons)
+                        {
+                            CrossType = PsmCrossType.Single,
+                            //XlRank = new List<int> { alphaIndex }
+                        };
+
+                        possibleMatches.Add(psmCrossSingle);
+                    }
                 }
                 else if (QuenchTris && XLPrecusorSearchMode.Accepts(scan.PrecursorMass, massTable[id] + Crosslinker.DeadendMassTris) >= 0)
                 {


Replaced a bit of Expression building with Reflection because it didn't work on WinRT.

--- FluentAssertions.Core/Equivalency/GenericEnumerableEquivalencyStep.cs
+++ FluentAssertions.Core/Equivalency/GenericEnumerableEquivalencyStep.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq.Expressions;
+using System.Reflection;

 using FluentAssertions.Execution;

@@ -60,16 +61,16 @@

                 Type typeOfEnumeration = GetTypeOfEnumeration(subjectType);

-                Expression subjectToArray = ToArray(context.Subject, typeOfEnumeration);
-                Expression expectationToArray =
-                    Expression.Constant(EnumerableEquivalencyStep.ToArray(context.Expectation));
+                object subjectToArray = ToArray(context.Subject, typeOfEnumeration);
+                object[] expectationToArray =
+                    EnumerableEquivalencyStep.ToArray(context.Expectation);

                 MethodCallExpression executeExpression = Expression.Call(
                     Expression.Constant(validator),
                     "Execute",
                     new Type[] { typeOfEnumeration },
-                    subjectToArray,
-                    expectationToArray);
+                    Expression.Constant(subjectToArray),
+                    Expression.Constant(expectationToArray));

                 Expression.Lambda(executeExpression).Compile().DynamicInvoke();
             }
@@ -112,13 +113,11 @@
             return interfaceType.GetGenericArguments().Single();
         }

-        private static Expression ToArray(object value, Type typeOfEnumeration)
+        private static object ToArray(object value, Type typeOfEnumeration)
         {
-            return Expression.Call(
-                typeof(Enumerable),
-                "ToArray",
-                new Type[] { typeOfEnumeration },
-                Expression.Constant(value));
+            MethodInfo toArray = typeof(Enumerable).GetMethod("ToArray").MakeGenericMethod(typeOfEnumeration);
+
+            return toArray.Invoke(null, new [] {value});
         }
     }
 }


Code clean up

Code clean up

Implemented suggestions by tugberkugurlu

--- BitToGithub/Program.cs
+++ BitToGithub/Program.cs
@@ -25,9 +25,7 @@
             var isAllDefined = new[] { bbUsername, bbPassword, bbRepoName, githubUsername, githubPassword, githubRepoName, githubRepoOwnerName }.All(param => string.IsNullOrEmpty(param) == false);
             if (isAllDefined)
             {
-                //string bbRepoIssuesUrl = "https://api.bitbucket.org/1.0/repositories/\{bbUsername}/\{bbRepoName}/issues";
                 string bbRepoIssuesUrl = string.Format("https://api.bitbucket.org/1.0/repositories/{0}/{1}/issues", bbRepoOwnerName, bbRepoName);
-

                 var github = new GitHubClient(new Octokit.ProductHeaderValue("MyAmazingApp"));
                 github.Credentials = new Credentials(githubUsername, githubPassword);
@@ -54,8 +52,6 @@
                     int startIndex = 1;
                     while (true)
                     {
-                        System.Threading.Thread.Sleep(3000);
-                        //var response = client.GetAsync(bbRepoIssuesUrl + "?start=\{startIndex}").Result;
                         var response = client.GetAsync(bbRepoIssuesUrl + "?start=" + startIndex.ToString()).Result;
                         response.EnsureSuccessStatusCode();
                         var result = response.Content.ReadAsAsync<BitBuckect.Rootobject>().Result;
@@ -67,7 +63,7 @@
                                 Console.WriteLine("found issue {0}", issue.local_id);
                                 var newIssue = new NewIssue(issue.title);
                                 newIssue.Labels.Add(migratedLabel);
-                                //newIssue.Body = issue.content +  "\{Environment.NewLine}\{Environment.NewLine}> Originally created at \{issue.utc_created_on} (UTC) by \{issue.reported_by.username} as a(n) \{issue.priority} issue.";
+
                                 newIssue.Body =
                                     issue.content +
                                     Environment.NewLine +


Untabify

Untabify

--- CefSharp/Internals/CommandLineArgsParser.cs
+++ CefSharp/Internals/CommandLineArgsParser.cs
@@ -7,14 +7,14 @@

 namespace CefSharp.Internals
 {
-	/// <summary>
-	/// Simple helper class used for checking/parsing command line arguments
-	/// </summary>
-	public static class CommandLineArgsParser
-	{
-		public static bool HasArgument(this IEnumerable<string> args, string arg)
-		{
-			return args.Any(a => a.StartsWith(arg));
-		}
-	}
+    /// <summary>
+    /// Simple helper class used for checking/parsing command line arguments
+    /// </summary>
+    public static class CommandLineArgsParser
+    {
+        public static bool HasArgument(this IEnumerable<string> args, string arg)
+        {
+            return args.Any(a => a.StartsWith(arg));
+        }
+    }
 }


Corrected initial state of psg because some game use it

--- ChipTuna/Emulation/SN76489/PsgOscillator.cs
+++ ChipTuna/Emulation/SN76489/PsgOscillator.cs
@@ -23,6 +23,14 @@
         private PsgChannel _latchChannel = PsgChannel.Zero;
         private int _prevNoiseSign = 1;
         private bool _lastLfsrValue = false;
+
+        public PsgOscillator()
+        {
+            UpdateFrequencyAndVolume(PsgChannel.Zero);
+            UpdateFrequencyAndVolume(PsgChannel.One);
+            UpdateFrequencyAndVolume(PsgChannel.Two);
+            UpdateFrequencyAndVolume(PsgChannel.Three);
+        }

         public void ApplyCommand(byte commandCode)
         {
@@ -152,8 +160,10 @@
             }
         }

-        private bool IsLatchToneChannel() =>
-            _latchChannel == PsgChannel.Zero || _latchChannel == PsgChannel.One || _latchChannel == PsgChannel.Two;
+        private bool IsLatchToneChannel() => IsToneChannel(_latchChannel);
+
+        private static bool IsToneChannel(PsgChannel channel) =>
+            channel == PsgChannel.Zero || channel == PsgChannel.One || channel == PsgChannel.Two;

         private int[] _volumeTable =
         {
@@ -163,22 +173,29 @@

         private void UpdateLatchFrequencyAndVolume()
         {
-            var ch = (int)_latchChannel;
-
+            UpdateFrequencyAndVolume(_latchChannel);
+        }
+
+        private void UpdateFrequencyAndVolume(PsgChannel channel)
+        {
+            var ch = (int)channel;
             const int clock = 3579545;
             const int divider = 16;
-            var _halfWaveCounter = _tones[ch];
+            var halfWaveCounter = _tones[ch];
+
+            if (halfWaveCounter == 0)
+                halfWaveCounter = 1;

             var frequency = 0f;

-            if (_halfWaveCounter != 0)
-                frequency = (float)((double)clock / (2 * divider * _halfWaveCounter));
+            if (halfWaveCounter != 0)
+                frequency = (float) ((double) clock / (2 * divider * halfWaveCounter));

             var volume = _volumeTable[_volumes[ch]] / 32767f;

             _oscillators[ch].Amplitude = volume;

-            if (IsLatchToneChannel())
+            if (IsToneChannel(channel))
             {
                 _oscillators[ch].Frequency = frequency;
             }
@@ -186,7 +203,6 @@
             {
                 _oscillators[ch].Frequency = frequency / 2;
             }
-
         }

         public float Step()


for empty contribs, reset the div

for empty contribs, reset the div

--- RepoStats/HtmlTemplates.cs
+++ RepoStats/HtmlTemplates.cs
@@ -182,12 +182,7 @@
                                 var svgObj = mouseEvt.target;
                                 var date = svgObj.getAttribute('data-date');
                                 var num = parseInt(svgObj.getAttribute('data-count'));
-                                if (num <= 0) {
-                                    dataUrl = '';
-                                }
-                                else {
-                                    dataUrl = 'commitsByDate/' + date + '.html';
-                                }
+                                var contribDiv = document.getElementById('contributionsHolder');

                                 // reset the older cell value
                                 if (currentHighlightCell != null) {
@@ -198,13 +193,22 @@
                                 // highlight the highlighted cell
                                 currentHighlightCell.setAttribute('class', 'selected');

+
+                                if (num <= 0) {
+                                    contribDiv.innerHTML = "";
+                                    return;
+                                }
+                                else {
+                                    dataUrl = 'commitsByDate/' + date + '.html';
+                                }
+
                                 $.ajax({
                                     type: 'GET',
                                     url: dataUrl,
                                     dataType: 'html',   //expect html to be returned
                                     success: function(response)
                                     {
-                                        document.getElementById('contributionsHolder').innerHTML = response;
+                                        contribDiv.innerHTML = response;
                                     }
                                 });
                             }


フォーマット

フォーマット

--- Browser/FormBrowser.cs
+++ Browser/FormBrowser.cs
@@ -28,7 +28,7 @@
 		private readonly Size KanColleSize = new Size( 800, 480 );

-		private readonly string StyleClassID = Guid.NewGuid().ToString().Substring(0, 8);
+		private readonly string StyleClassID = Guid.NewGuid().ToString().Substring( 0, 8 );
 		private readonly string RestoreScript = @"var node = document.getElementById('{0}'); if (node) document.head.removeChild(node);";
 		private bool RestoreStyleSheet = false;

@@ -95,7 +95,7 @@
 		/// <param name="serverUri">ホストプロセスとの通信用URL</param>
 		public FormBrowser( string serverUri ) {
 			InitializeComponent();
-			CoInternetSetFeatureEnabled(21, 0x00000002, true);
+			CoInternetSetFeatureEnabled( 21, 0x00000002, true );

 			ServerUri = serverUri;
 			StyleSheetApplied = false;
@@ -247,7 +247,7 @@
 		}

 		private void CenteringBrowser() {
-			if (SizeAdjuster.Width == 0 || SizeAdjuster.Height == 0) return;
+			if ( SizeAdjuster.Width == 0 || SizeAdjuster.Height == 0 ) return;
 			int x = Browser.Location.X, y = Browser.Location.Y;
 			bool isScrollable = Configuration.IsScrollable;

@@ -285,7 +285,7 @@
 		/// </summary>
 		public void ApplyStyleSheet() {

-			if (!Configuration.AppliesStyleSheet && !RestoreStyleSheet)
+			if ( !Configuration.AppliesStyleSheet && !RestoreStyleSheet )
 				return;

 			try {
@@ -295,22 +295,22 @@

 				if ( document.Url.ToString().Contains( ".swf?" ) ) {

-					document.InvokeScript("eval", new object[] {"document.body.style.margin=0;"});
+					document.InvokeScript( "eval", new object[] { "document.body.style.margin=0;" } );

 				} else {
 					var swf = getFrameElementById( document, "externalswf" );
 					if ( swf == null ) return;

-					if (RestoreStyleSheet) {
-						document.InvokeScript( "eval", new object[] { string.Format(RestoreScript, StyleClassID) } );
-						swf.Document.InvokeScript( "eval", new object[] { string.Format(RestoreScript, StyleClassID) } );
+					if ( RestoreStyleSheet ) {
+						document.InvokeScript( "eval", new object[] { string.Format( RestoreScript, StyleClassID ) } );
+						swf.Document.InvokeScript( "eval", new object[] { string.Format( RestoreScript, StyleClassID ) } );
 						StyleSheetApplied = false;
 						RestoreStyleSheet = false;
 						return;
 					}
 					// InvokeScriptは関数しか呼べないようなので、スクリプトをevalで渡す
-					document.InvokeScript( "eval", new object[] { string.Format(Properties.Resources.PageScript, StyleClassID) } );
-					swf.Document.InvokeScript( "eval", new object[] { string.Format(Properties.Resources.FrameScript, StyleClassID) } );
+					document.InvokeScript( "eval", new object[] { string.Format( Properties.Resources.PageScript, StyleClassID ) } );
+					swf.Document.InvokeScript( "eval", new object[] { string.Format( Properties.Resources.FrameScript, StyleClassID ) } );
 				}

 				StyleSheetApplied = true;
@@ -327,7 +327,7 @@
 		/// 指定した URL のページを開きます。
 		/// </summary>
 		public void Navigate( string url ) {
-			if (url != Configuration.LogInPageURL || !Configuration.AppliesStyleSheet)
+			if ( url != Configuration.LogInPageURL || !Configuration.AppliesStyleSheet )
 				StyleSheetApplied = false;
 			Browser.Navigate( url );
 		}
@@ -336,7 +336,7 @@
 		/// ブラウザを再読み込みします。
 		/// </summary>
 		public void RefreshBrowser() {
-			if (!Configuration.AppliesStyleSheet)
+			if ( !Configuration.AppliesStyleSheet )
 				StyleSheetApplied = false;
 			Browser.Refresh( WebBrowserRefreshOption.Completely );
 		}
@@ -832,7 +832,7 @@

 		private void ToolMenu_Other_AppliesStyleSheet_Click( object sender, EventArgs e ) {
 			Configuration.AppliesStyleSheet = ToolMenu_Other_AppliesStyleSheet.Checked;
-			if (!Configuration.AppliesStyleSheet)
+			if ( !Configuration.AppliesStyleSheet )
 				RestoreStyleSheet = true;
 			ApplyStyleSheet();
 			ApplyZoom();
@@ -1013,10 +1013,10 @@

 		#region 呪文

-		[DllImport("urlmon.dll")]
+		[DllImport( "urlmon.dll" )]
 		[PreserveSig]
-		[return: MarshalAs(UnmanagedType.Error)]
-		static extern int CoInternetSetFeatureEnabled(int FeatureEntry, [MarshalAs(UnmanagedType.U4)] int dwFlags, bool fEnable);
+		[return: MarshalAs( UnmanagedType.Error )]
+		static extern int CoInternetSetFeatureEnabled( int FeatureEntry, [MarshalAs( UnmanagedType.U4 )] int dwFlags, bool fEnable );

 		[DllImport( "user32.dll", EntryPoint = "GetWindowLongA", SetLastError = true )]
 		private static extern uint GetWindowLong( IntPtr hwnd, int nIndex );


adding valid url

adding valid url

--- Famoser.Bookmarked.View/ViewModels/LoginViewModel.cs
+++ Famoser.Bookmarked.View/ViewModels/LoginViewModel.cs
@@ -59,6 +59,7 @@
             if (await _passwordService.TryPasswordAsync(hash))
             {
                 _navigationService.NavigateTo(Pages.Navigation.ToString());
+                IsFirstTime = false;
             }
             else
             {


Added property CityId to POCO class City

--- FancyTravellerApp/FancyTraveller.Domain/POCO/City.cs
+++ FancyTravellerApp/FancyTraveller.Domain/POCO/City.cs
@@ -2,6 +2,7 @@
 {
     public class City
     {
+        public int CityId { get; set; }
         public string Name { get; set; }
         public Location Location { get; set; }
     }


Fix V2 result file to show elapsed time in seconds

--HG--
extra : convert_revision : charlie%40nunit.org-20130922190856-ikwyhh2moezcju7v

--- NUnitConsole/src/nunit-console/OutputWriters/NUnit2XmlOutputWriter.cs
+++ NUnitConsole/src/nunit-console/OutputWriters/NUnit2XmlOutputWriter.cs
@@ -196,8 +196,9 @@
             string resultState = XmlHelper.GetAttribute(result, "result");
             string label = XmlHelper.GetAttribute(result, "label");
             string executed = resultState == "Skipped" ? "False" : "True";
-            string success = resultState == "Passed" ? "True" : "False";
-            string time = XmlHelper.GetAttribute(result, "time");
+            string success = resultState == "Passed" ? "True" : "False";
+            var seconds = TimeSpan.Parse(XmlHelper.GetAttribute(result, "time")).TotalSeconds;
+            string time = seconds.ToString("#####0.000", NumberFormatInfo.InvariantInfo);
             string asserts = XmlHelper.GetAttribute(result, "asserts");

             if (label != null && label != string.Empty)


debug on mrt

debug on mrt

--- Nodes/VVVV.DX11.Nodes/Nodes/Renderers/Graphics/DX11MRTRendererNode.cs
+++ Nodes/VVVV.DX11.Nodes/Nodes/Renderers/Graphics/DX11MRTRendererNode.cs
@@ -125,6 +125,10 @@
                     DX11RenderTarget2D rt = new DX11RenderTarget2D(context, this.width, this.height,
                     this.sd, DeviceFormatHelper.GetFormat(this.FInFormat[i].Name), this.genmipmap, this.mipmaplevel);

+                    #if DEBUG
+                    rt.Resource.DebugName = "MRTRenderTexture";
+                    #endif
+
                     this.FOutBuffers[i][context] = rt;
                 }
             }


TaskFactory nullability

TaskFactory nullability

--- Framework.Core/System/Threading/Tasks/TaskFactory.cs
+++ Framework.Core/System/Threading/Tasks/TaskFactory.cs
@@ -376,28 +376,28 @@
             return result;
         }

-        public Task StartNew(Action<object> action, object state)
+        public Task StartNew(Action<object?> action, object? state)
         {
             var result = new Task(action, state, null, CancellationToken.None, TaskCreationOptions.None, InternalTaskOptions.None, _scheduler);
             result.InternalStart(_scheduler, false, true);
             return result;
         }

-        public Task StartNew(Action<object> action, object state, CancellationToken cancellationToken)
+        public Task StartNew(Action<object?> action, object? state, CancellationToken cancellationToken)
         {
             var result = new Task(action, state, null, cancellationToken, TaskCreationOptions.None, InternalTaskOptions.None, _scheduler);
             result.InternalStart(_scheduler, false, true);
             return result;
         }

-        public Task StartNew(Action<object> action, object state, TaskCreationOptions creationOptions)
+        public Task StartNew(Action<object?> action, object? state, TaskCreationOptions creationOptions)
         {
             var result = new Task(action, state, Task.InternalCurrentIfAttached(creationOptions), CancellationToken.None, creationOptions, InternalTaskOptions.None, _scheduler);
             result.InternalStart(_scheduler, false, true);
             return result;
         }

-        public Task StartNew(Action<object> action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
+        public Task StartNew(Action<object?> action, object? state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
         {
             // Should not be static
             var result = new Task(action, state, Task.InternalCurrentIfAttached(creationOptions), cancellationToken, creationOptions, InternalTaskOptions.None, scheduler);
@@ -434,28 +434,28 @@
             return result;
         }

-        public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state)
+        public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state)
         {
             var result = new Task<TResult>(function, state, CancellationToken.None, TaskCreationOptions.None, _scheduler);
             result.InternalStart(_scheduler, false, true);
             return result;
         }

-        public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state, CancellationToken cancellationToken)
+        public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state, CancellationToken cancellationToken)
         {
             var result = new Task<TResult>(function, state, cancellationToken, TaskCreationOptions.None, _scheduler);
             result.InternalStart(_scheduler, false, true);
             return result;
         }

-        public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state, TaskCreationOptions creationOptions)
+        public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state, TaskCreationOptions creationOptions)
         {
             var result = new Task<TResult>(function, state, CancellationToken.None, creationOptions, _scheduler);
             result.InternalStart(_scheduler, false, true);
             return result;
         }

-        public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
+        public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
         {
             // Should not be static
             var result = new Task<TResult>(function, state, cancellationToken, creationOptions, scheduler);
@@ -534,7 +534,7 @@
             );
         }

-        public Task FromAsync<TArg1>(Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, object state)
+        public Task FromAsync<TArg1>(Func<TArg1, AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, object? state)
         {
             if (beginMethod == null)
             {
@@ -559,7 +559,7 @@
             );
         }

-        public Task FromAsync<TArg1>(Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, object state, TaskCreationOptions creationOptions)
+        public Task FromAsync<TArg1>(Func<TArg1, AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -584,7 +584,7 @@
             );
         }

-        public Task<TResult> FromAsync<TArg1, TResult>(Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object state)
+        public Task<TResult> FromAsync<TArg1, TResult>(Func<TArg1, AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object? state)
         {
             if (beginMethod == null)
             {
@@ -599,7 +599,7 @@
             return FromAsyncCore((callback, obj) => beginMethod(arg1, callback, obj), endMethod, state, default);
         }

-        public Task<TResult> FromAsync<TArg1, TResult>(Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object state, TaskCreationOptions creationOptions)
+        public Task<TResult> FromAsync<TArg1, TResult>(Func<TArg1, AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -614,7 +614,7 @@
             return FromAsyncCore((callback, obj) => beginMethod(arg1, callback, obj), endMethod, state, creationOptions);
         }

-        public Task FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object state)
+        public Task FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object? state)
         {
             if (beginMethod == null)
             {
@@ -639,7 +639,7 @@
             );
         }

-        public Task FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
+        public Task FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -664,7 +664,7 @@
             );
         }

-        public Task<TResult> FromAsync<TArg1, TArg2, TResult>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state)
+        public Task<TResult> FromAsync<TArg1, TArg2, TResult>(Func<TArg1, TArg2, AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state)
         {
             if (beginMethod == null)
             {
@@ -679,7 +679,7 @@
             return FromAsyncCore((callback, obj) => beginMethod(arg1, arg2, callback, obj), endMethod, state, default);
         }

-        public Task<TResult> FromAsync<TArg1, TArg2, TResult>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
+        public Task<TResult> FromAsync<TArg1, TArg2, TResult>(Func<TArg1, TArg2, AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -694,7 +694,7 @@
             return FromAsyncCore((callback, obj) => beginMethod(arg1, arg2, callback, obj), endMethod, state, creationOptions);
         }

-        public Task FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
+        public Task FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state)
         {
             if (beginMethod == null)
             {
@@ -719,7 +719,7 @@
             );
         }

-        public Task FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
+        public Task FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -744,7 +744,7 @@
             );
         }

-        public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
+        public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(Func<TArg1, TArg2, TArg3, AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state)
         {
             if (beginMethod == null)
             {
@@ -759,7 +759,7 @@
             return FromAsyncCore((callback, obj) => beginMethod(arg1, arg2, arg3, callback, obj), endMethod, state, default);
         }

-        public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
+        public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(Func<TArg1, TArg2, TArg3, AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -857,7 +857,7 @@
             );
         }

-        public Task FromAsync(Func<AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object state)
+        public Task FromAsync(Func<AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object? state)
         {
             if (beginMethod == null)
             {
@@ -882,7 +882,7 @@
             );
         }

-        public Task FromAsync(Func<AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object state, TaskCreationOptions creationOptions)
+        public Task FromAsync(Func<AsyncCallback, object?, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -907,7 +907,7 @@
             );
         }

-        public Task<TResult> FromAsync<TResult>(Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object state)
+        public Task<TResult> FromAsync<TResult>(Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object? state)
         {
             if (beginMethod == null)
             {
@@ -922,7 +922,7 @@
             return FromAsyncCore(beginMethod, endMethod, state, default);
         }

-        public Task<TResult> FromAsync<TResult>(Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object state, TaskCreationOptions creationOptions)
+        public Task<TResult> FromAsync<TResult>(Func<AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object? state, TaskCreationOptions creationOptions)
         {
             if (beginMethod == null)
             {
@@ -958,12 +958,12 @@
             return result;
         }

-        private static async Task<TResult> FromAsyncCore<TResult>(Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object state, TaskCreationOptions creationOptions)
+        private static async Task<TResult> FromAsyncCore<TResult>(Func<AsyncCallback, object?, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object? state, TaskCreationOptions creationOptions)
         {
             return endMethod(await FromBeginMethod(beginMethod, state, creationOptions).ConfigureAwait(false));
         }

-        private static Task<IAsyncResult> FromBeginMethod(Func<AsyncCallback, object, IAsyncResult> beginMethod, object state, TaskCreationOptions creationOptions)
+        private static Task<IAsyncResult> FromBeginMethod(Func<AsyncCallback, object?, IAsyncResult> beginMethod, object? state, TaskCreationOptions creationOptions)
         {
             var source = new TaskCompletionSource<IAsyncResult>(creationOptions);
             var canInvokeEnd = new[] { 0 };


Better handling of empty lines in HTML.

Better handling of empty lines in HTML.

--- CRR/Util/HtmlToText.cs
+++ CRR/Util/HtmlToText.cs
@@ -69,7 +69,6 @@
           return;
       }

-
       string html;
       switch (node.NodeType)
       {
@@ -97,13 +96,18 @@
           // check the text is meaningful and not a bunch of whitespaces
           if (html.Trim().Length > 0)
           {
+            foreach (var c in trimChars)
+            {
+              html = html.Replace(c, ' ');
+            }
+
             outText.Write(HtmlEntity.DeEntitize(html).Trim(trimChars));
           }
           break;

         case HtmlNodeType.Element:
           bool skip = false;
-          switch (node.Name)
+          switch (node.Name.ToLower())
           {
             //handle headers
             case "h1":
@@ -122,6 +126,8 @@
             case "p":
             case "ul":
             case "ol":
+            case "div":
+            case "br":
               // treat paragraphs as crlf
               outText.Write(Environment.NewLine);
               break;


Use correct tokens.

Use correct tokens.

--- Gu.Localization.Analyzers/Fixes/RenameResourceFix.cs
+++ Gu.Localization.Analyzers/Fixes/RenameResourceFix.cs
@@ -110,9 +110,7 @@
                 if (token.Parent is PropertyDeclarationSyntax propertyDeclaration &&
                     propertyDeclaration.Identifier == token)
                 {
-                    return SyntaxFactory.ParseToken(this.newValue)
-                                        .WithLeadingTrivia(token.LeadingTrivia)
-                                        .WithTrailingTrivia(token.TrailingTrivia);
+                    return SyntaxFactory.Identifier(token.LeadingTrivia, this.newValue, token.TrailingTrivia);
                 }

                 return base.VisitToken(token);
@@ -127,7 +125,7 @@
                     invocation.TryGetMethodName(out var method) &&
                     method == "GetString")
                 {
-                    return node.WithToken(SyntaxFactory.ParseToken($"\"{this.newValue}\""));
+                    return node.WithToken(SyntaxFactory.Literal(this.newValue));
                 }

                 return base.VisitLiteralExpression(node);


Bugfix: Erstellen von neuen Listeneinträgen unmöglich

--- ILK-Protokoll/Areas/Session/Models/Lists/BaseItem.cs
+++ ILK-Protokoll/Areas/Session/Models/Lists/BaseItem.cs
@@ -9,6 +9,7 @@
 		protected BaseItem()
 		{
 			Created = DateTime.Now;
+			LockTime = new DateTime(2000, 1, 1);
 		}

 		public int ID { get; set; }


Fix initial value.

Fix initial value.

--- Applications/Rss/Reader/Models/Settings/Settings.cs
+++ Applications/Rss/Reader/Models/Settings/Settings.cs
@@ -159,7 +159,7 @@
         private int _primary = 60 * 60;
         private int _secondary = 24 * 60 * 60;
         private bool _checkUpdate = true;
-        private DateTime _lastCheckUpdate = DateTime.MinValue;
+        private DateTime _lastCheckUpdate = new DateTime(1970, 1, 1);
         #endregion
     }


 r109@realmforge.tigris.org (orig r121):  arilou | 2006-01-16 07:46:35 -0500
 quick fix for demos

git-svn-id: 53f2a8ff3606f182ef4420064c1f4a5cdcbe6bb1@712 bb9bf1cf-960d-0410-9a3a-baeba60cf407

--- Axiom3D/Axiom/Engine/Collections/AxiomCollection.cs
+++ Axiom3D/Axiom/Engine/Collections/AxiomCollection.cs
@@ -238,13 +238,14 @@
         {
             K key = default( K );

-            if ( key is string )
-            {
-                key = (K)Convert.ChangeType( key.GetType().Name + nextUniqueKeyCounter++, key.GetType() );
+            if ( typeof(K) == typeof(string) )
+            {
+                string stringKey = typeof(T).Name + nextUniqueKeyCounter++;
+                key = (K)Convert.ChangeType( stringKey, typeof(K) );
             }
             else
             {
-                key = (K)Convert.ChangeType( nextUniqueKeyCounter++, key.GetType() );
+                key = (K)Convert.ChangeType( nextUniqueKeyCounter++, typeof(K) );
             }

             base.Add( key, item );


COMMIT

COMMIT

--- BlackJackSolution/BlackJackSolution/DAL/DBAccess.cs
+++ BlackJackSolution/BlackJackSolution/DAL/DBAccess.cs
@@ -195,14 +195,45 @@
             }
         }

-        public int GetMinBet()
-        {
-
-        }
-        public int GetMaxBet()
-        {
-
-        }
+        public string[] GetBlackJackGame(int sessionId)
+        {
+            try
+            {
+                SqlConnection connection = Connect();
+                SqlCommand command = new SqlCommand("EXEC [dbo].[GETBLACKJACKGAME] @USERNAME = '" + aname + "', @PASSWORD = '" + password + "'", connection);
+                command.ExecuteNonQuery();
+                SqlDataReader read = command.ExecuteReader();
+                string[] result = new string[4];
+
+                if (read.HasRows)
+                {
+                    if (read.FieldCount > 1)
+                    {
+                        while (read.Read())
+                        {
+                            result[0] = read.GetString(0);
+                            result[1] = read.GetString(1);
+                            result[2] = read.GetDouble(2).ToString();
+                            result[3] = read.GetString(3);
+                        }
+                    }
+                    else if (read.FieldCount == 1)
+                    {
+                        while (read.Read())
+                        {
+                            result[0] = read.GetString(0);
+                        }
+                    }
+                }
+                return result;
+            }
+            catch (SqlException e) //KOLLA DENNA SEN, VAD DEN SKA RETURNA
+            {
+                string ex = Logic.Utils.SqlExceptionUtility(e);
+                return null;
+            }
+        }
+
         public string CreateGameRound(int bet, int result, string aname, int sessionid) //KLAR ISH, kanske vill förfina koden
         {
             try {


Fixed \par lines end at beyond rightmost bound

--- CSharpMath.Rendering/Text/TextDisplayLineBuilder.cs
+++ CSharpMath.Rendering/Text/TextDisplayLineBuilder.cs
@@ -11,8 +11,7 @@
     public float Descent { get; private set; }
     public float Width { get; private set; }
     public float GapAfterLine { get; private set; }
-    float _widthOffset;
-    public void AddSpace(float width) => _widthOffset += width;
+    public void AddSpace(float width) => Width += width;

     public void Add(Display display, float ascender, float descender, float gapAfterLine) {
       float Max(float x, float y, float z) => x < y ? (y < z ? z : y) : (x < z ? z : x);
@@ -20,8 +19,7 @@
       Descent = Max(Descent, display.Descent, descender);

       GapAfterLine = gapAfterLine > GapAfterLine ? gapAfterLine : GapAfterLine;
-      display.Position =
-        new System.Drawing.PointF(display.Position.X + Width + _widthOffset, display.Position.Y);
+      display.Position = new System.Drawing.PointF(display.Position.X + Width, display.Position.Y);
       Width += display.Width;
       _queue.Enqueue(display);
     }
@@ -36,7 +34,7 @@
       }
       verticalAdvance += Descent;
       if(appendLineGap) verticalAdvance += GapAfterLine + additionalLineSpacing;
-      _widthOffset = Ascent = Descent = Width = GapAfterLine = 0;
+      Ascent = Descent = Width = GapAfterLine = 0;
     }
   }
 }


Set and Reset tweak

Set and Reset tweak

Will return faster if there is no need to change the state of the wait handle

--- Core/System/Threading/ManualResetEventSlim.net35.cs
+++ Core/System/Threading/ManualResetEventSlim.net35.cs
@@ -64,13 +64,13 @@
                             // SpinWait
                             break;

+                        case Status.HandleReadyNotSet:
+                            // NotSet
+                            return false;
+
                         case Status.HandleReadySet:
                             // Set
                             return true;
-
-                        case Status.HandleReadyNotSet:
-                            // NotSet
-                            return false;

                         default:
                             // Should not happen
@@ -139,16 +139,30 @@
                         // SpinWait
                         break;

+                    case Status.HandleReadyNotSet:
+                        // Nothing to do
+                        return;
+
                     case Status.HandleReadySet:
-                    case Status.HandleReadyNotSet:
-                        // The wait handle that is already created
-                        var handle = Volatile.Read(ref _handle);
-                        if (handle != null)
-                        {
-                            // Reset it
-                            Interlocked.CompareExchange(ref _status, (int)Status.HandleReadyNotSet, (int)status);
-                            handle.Reset();
-                            // Done
+                        // Reset if Set
+                        status = (Status)Interlocked.CompareExchange(ref _status, (int)Status.HandleReadyNotSet, (int)Status.HandleReadySet);
+                        if (status == Status.HandleReadySet)
+                        {
+                            // We reset it
+                            // Update the wait handle
+                            var handle = Volatile.Read(ref _handle);
+                            if (handle != null)
+                            {
+                                // Reset it
+                                handle.Reset();
+                                // Done
+                                return;
+                            }
+                        }
+                        if (status == Status.HandleReadyNotSet)
+                        {
+                            // Another thread reset it
+                            // we are done
                             return;
                         }
                         // Probably Disposed
@@ -197,28 +211,33 @@
                         break;

                     case Status.HandleReadySet:
-                    case Status.HandleReadyNotSet:
-                        // The wait handle that is already created
-                        var handle = Volatile.Read(ref _handle);
-                        if (handle != null)
-                        {
-                            try
+                        // Set if Reset
+                        status = (Status)Interlocked.CompareExchange(ref _status, (int)Status.HandleReadySet, (int)Status.HandleReadyNotSet);
+                        if (status == Status.HandleReadyNotSet)
+                        {
+                            // We set it
+                            // Update the wait handle
+                            var handle = Volatile.Read(ref _handle);
+                            if (handle != null)
                             {
-                                // Set it
-                                Interlocked.CompareExchange(ref _status, (int)Status.HandleReadySet, (int)status);
+                                // Reset it
                                 handle.Set();
                                 // Done
                                 return;
                             }
-                            catch (ObjectDisposedException exception)
-                            {
-                                GC.KeepAlive(exception);
-                                // Fail silently
-                                return;
-                            }
+                        }
+                        if (status == Status.HandleReadySet)
+                        {
+                            // Another thread set it
+                            // we are done
+                            return;
                         }
                         // Probably Disposed
                         break;
+
+                    case Status.HandleReadyNotSet:
+                        // Nothing to do
+                        return;

                     default:
                         // Should not happen


"strings" > "descriptions"

"strings" > "descriptions"

--- CronExpressionDescriptor/Properties/AssemblyInfo.cs
+++ CronExpressionDescriptor/Properties/AssemblyInfo.cs
@@ -1,19 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 using System.Reflection;
 using System.Runtime.InteropServices;

@@ -21,7 +5,7 @@
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 [assembly: AssemblyTitle("Cron Expression Descriptor")]
-[assembly: AssemblyDescription("A library that converts cron expressions into human readable strings.  Supports 14 languages: English, Brazillian, Spanish, Norwgian, Turkish, Dutch, Chinese Simplified, Russian, French, German, Ukrainian, Polish, Romanian and Italian.")]
+[assembly: AssemblyDescription("A library that converts cron expressions into human readable descriptions.  Supports 14 languages: English, Brazillian, Spanish, Norwgian, Turkish, Dutch, Chinese Simplified, Russian, French, German, Ukrainian, Polish, Romanian and Italian.")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("Brady Holt")]
 [assembly: AssemblyProduct("CronExpressionDescriptor")]


Clean up

Clean up

--- ShopifySharp/Infrastructure/Policies/LeakyBucketPolicy/LeakyBucket.cs
+++ ShopifySharp/Infrastructure/Policies/LeakyBucketPolicy/LeakyBucket.cs
@@ -33,7 +33,7 @@

         private Func<DateTime> _getTime;

-        private Queue<Request> _pendingRequests = new Queue<Request>();
+        private Queue<Request> _waitingRequests = new Queue<Request>();

         private object _lock = new object();

@@ -46,8 +46,14 @@

         internal LeakyBucket(int maximumAvailable, int restoreRatePerSecond, Func<DateTime> getTime)
         {
+            if (maximumAvailable <= 0 || restoreRatePerSecond <= 0)
+                throw new ArgumentOutOfRangeException();
+
             _getTime = getTime;
-            SetState(maximumAvailable, restoreRatePerSecond, maximumAvailable);
+            MaximumAvailable = maximumAvailable;
+            RestoreRatePerSecond = restoreRatePerSecond;
+            LastCurrentlyAvailable = maximumAvailable;
+            LastUpdatedAt = _getTime();
         }

         public void SetState(int maximumAvailable, int restoreRatePerSecond, int currentlyAvailable)
@@ -57,20 +63,20 @@

             lock (_lock)
             {
-                this.MaximumAvailable = maximumAvailable;
-                this.RestoreRatePerSecond = restoreRatePerSecond;
-                this.LastCurrentlyAvailable = currentlyAvailable;
-                this.LastUpdatedAt = _getTime();
+                MaximumAvailable = maximumAvailable;
+                RestoreRatePerSecond = restoreRatePerSecond;
+                LastCurrentlyAvailable = currentlyAvailable;
+                LastUpdatedAt = _getTime();
             }
-            this.TryGrantNextPendingRequest();
+            TryGrantNextPendingRequest();
         }

         private void ConsumeAvailable(Request r)
         {
             lock (_lock)
             {
-                this.LastCurrentlyAvailable = this.ComputedCurrentlyAvailable - r.cost;
-                this.LastUpdatedAt = _getTime();
+                LastCurrentlyAvailable = this.ComputedCurrentlyAvailable - r.cost;
+                LastUpdatedAt = _getTime();
             }
         }

@@ -83,15 +89,15 @@

             lock (_lock)
             {
-                if (ComputedCurrentlyAvailable > requestCost && _pendingRequests.Count == 0)
+                if (ComputedCurrentlyAvailable > requestCost && _waitingRequests.Count == 0)
                 {
                     ConsumeAvailable(r);
                     return;
                 }

-                _pendingRequests.Enqueue(r);
+                _waitingRequests.Enqueue(r);

-                if (_pendingRequests.Count == 1)
+                if (_waitingRequests.Count == 1)
                     ScheduleTryGrantNextPendingRequest(r);
             }
             await r.semaphore.WaitAsync(cancellationToken);
@@ -110,19 +116,19 @@
         {
             lock (_lock)
             {
-                while (_pendingRequests.Count > 0 &&
-                       (_pendingRequests.Peek().cancelToken.IsCancellationRequested || ComputedCurrentlyAvailable >= _pendingRequests.Peek().cost))
+                while (_waitingRequests.Count > 0 &&
+                       (_waitingRequests.Peek().cancelToken.IsCancellationRequested || ComputedCurrentlyAvailable >= _waitingRequests.Peek().cost))
                 {
-                    var r = _pendingRequests.Dequeue();
+                    var r = _waitingRequests.Dequeue();
                     if (!r.cancelToken.IsCancellationRequested)
                     {
                         r.semaphore.Release();
-                        this.ConsumeAvailable(r);
+                        ConsumeAvailable(r);
                     }
                 }

-                if (_pendingRequests.Count > 0)
-                    ScheduleTryGrantNextPendingRequest(_pendingRequests.Peek());
+                if (_waitingRequests.Count > 0)
+                    ScheduleTryGrantNextPendingRequest(_waitingRequests.Peek());
             }
         }
     }


Add the PubSub gRPC changes back in

Add the PubSub gRPC changes back in

We'll continue to need to do this - or just check the changes when
regenerating and not commit PubsubGrpc.cs - until the gRPC code gen
emits partial classes.

--- apis/Google.Pubsub.V1/Google.Pubsub.V1/PubsubGrpc.cs
+++ apis/Google.Pubsub.V1/Google.Pubsub.V1/PubsubGrpc.cs
@@ -21,6 +21,7 @@
 using System.Threading;
 using System.Threading.Tasks;
 using Grpc.Core;
+using static Google.Iam.V1.IAMPolicy;

 namespace Google.Pubsub.V1 {
   /// <summary>
@@ -225,6 +226,15 @@
       {
       }

+      // IMPLEMENTATION NOTE: This will be in a partial class eventually.
+
+      /// <summary>
+      /// Creates a new instance of <see cref="IAMPolicyClient"/> using the same call invoker
+      /// as this client.
+      /// </summary>
+      /// <returns>A new IAM client for the same target as this client.</returns>
+      public virtual IAMPolicyClient CreateIAMPolicyClient() => new IAMPolicyClient(CallInvoker);
+
       /// <summary>
       ///  Creates a subscription to a given topic.
       ///  If the subscription already exists, returns `ALREADY_EXISTS`.
@@ -731,6 +741,15 @@
       {
       }

+      // IMPLEMENTATION NOTE: This will be in a partial class eventually.
+
+      /// <summary>
+      /// Creates a new instance of <see cref="IAMPolicyClient"/> using the same call invoker
+      /// as this client.
+      /// </summary>
+      /// <returns>A new IAM client for the same target as this client.</returns>
+      public virtual IAMPolicyClient CreateIAMPolicyClient() => new IAMPolicyClient(CallInvoker);
+
       /// <summary>
       ///  Creates the given topic with the given name.
       /// </summary>


De-use local variable.

De-use local variable.

--- ChamberLib/Renderer.cs
+++ ChamberLib/Renderer.cs
@@ -59,8 +59,7 @@
             _drawLineEffect.World = Matrix.Identity;
             _drawLineEffect.View = Matrix.Identity;

-            Viewport vp = this.Viewport;
-            Matrix projection = Matrix.CreateOrthographicOffCenter(0, vp.Width, vp.Height, 0, 0, 1);
+            Matrix projection = Matrix.CreateOrthographicOffCenter(0, _device.Viewport.Width, _device.Viewport.Height, 0, 0, 1);
             Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);
             Matrix transform = (halfPixelOffset * projection);


up link name

up link name

--- Terradue.Tep/Terradue/Tep/Controller/Service/WpsProcessOfferingTep.cs
+++ Terradue.Tep/Terradue/Tep/Controller/Service/WpsProcessOfferingTep.cs
@@ -205,10 +205,10 @@
             var appIconLink = entry.Links.FirstOrDefault(l => l.RelationshipType == "icon");
             if (appIconLink != null) wps.IconUrl = appIconLink.Uri.AbsoluteUri;

-            var tutorialLink = entry.Links.FirstOrDefault(l => l.RelationshipType == "alternate" && l.Title == "tutorial");
+            var tutorialLink = entry.Links.FirstOrDefault(l => l.RelationshipType == "alternate" && l.Title == "Service tutorial");
             if (tutorialLink != null) wps.TutorialUrl = tutorialLink.Uri.AbsoluteUri;

-            var specLink = entry.Links.FirstOrDefault(l => l.RelationshipType == "alternate" && l.Title == "specification");
+            var specLink = entry.Links.FirstOrDefault(l => l.RelationshipType == "alternate" && l.Title == "Service specification");
             if (specLink != null) wps.SpecUrl = specLink.Uri.AbsoluteUri;

             var operation = wpsOffering.Operations.FirstOrDefault(o => o.Code == "ProcessDescription");


Killed of BorderStyle

Killed of BorderStyle

Can't really think of a reason why TabListPage needs a border

--- Cyotek.Windows.Forms.TabList/TabListPage.cs
+++ Cyotek.Windows.Forms.TabList/TabListPage.cs
@@ -21,15 +21,6 @@
   [DefaultProperty("Text")]
   public class TabListPage : Panel
   {
-    #region Constructors
-
-    public TabListPage()
-    {
-
-    }
-
-    #endregion
-
     #region Events

     [Browsable(false)]
@@ -131,10 +122,19 @@
     [EditorBrowsable(EditorBrowsableState.Never)]
     [Browsable(false)]
     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+    public new BorderStyle BorderStyle
+    {
+      get { return base.BorderStyle; }
+      set { base.BorderStyle = value; }
+    }
+
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    [Browsable(false)]
+    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
     public override DockStyle Dock
     {
       get { return DockStyle.None; }
-      set {  }
+      set { }
     }

     [EditorBrowsable(EditorBrowsableState.Never)]


changed TextureMerge to a scriptableObject


Minor patch to ChangeType

Minor patch to ChangeType

--- DNX.Helpers/Converters/ConvertExtensions.cs
+++ DNX.Helpers/Converters/ConvertExtensions.cs
@@ -15,7 +15,7 @@
         /// <returns>T.</returns>
         public static T ChangeType<T>(this object value)
         {
-            return (T)Convert.ChangeType(value, typeof(T));
+            return (T)ChangeType(value, typeof(T));
         }

         /// <summary>


Fix implementation of UpdateContent.

Fix implementation of UpdateContent.

Added TODO about future improvement to do partial updates.

--- DanTup.DartVS.Vsix/DartFileChangeTracker.cs
+++ DanTup.DartVS.Vsix/DartFileChangeTracker.cs
@@ -42,16 +42,11 @@
 			var textDoc = document.Object("") as TextDocument;
 			var fileContents = textDoc.CreateEditPoint().GetText(textDoc.EndPoint);

-			var change = new ChangeContentOverlay
+			// TODO: Optimise this to use ChangeContentOverlay on subsequent updates.
+			var change = new AddContentOverlay
 			{
-				Type = "change",
-				Edits = new[] {
-					new SourceEdit {
-						Offset = 0,
-						Length = int.MaxValue,
-						Replacement = fileContents
-					}
-				}
+				Type = "add",
+				Content = fileContents
 			};

 			analysisService.UpdateContent(path, change);


redirect / to LOB SPA

redirect / to LOB SPA

--- DemoAngularJS/Controllers/HomeController.cs
+++ DemoAngularJS/Controllers/HomeController.cs
@@ -10,6 +10,7 @@
     {
         public ActionResult Index()
         {
+            Response.Redirect("SPA/LOBApp/lob.html", true);
             return View();
         }


Termination

Termination

--- DragonSpark/Model/Operations/Termination.cs
+++ DragonSpark/Model/Operations/Termination.cs
@@ -1,11 +1,34 @@
-using System.Threading.Tasks;
+using DragonSpark.Compose;
+using System.Threading.Tasks;

 namespace DragonSpark.Model.Operations
 {
+	public class Termination<TIn, TNext> : IOperation<TIn>
+	{
+		readonly Await<TIn, TNext> _first;
+		readonly Await<TNext>      _second;
+
+		public Termination(ISelecting<TIn, TNext> first, IOperation<TNext> second) : this(first.Await, second.Await) {}
+
+		public Termination(Await<TIn, TNext> first, Await<TNext> second)
+		{
+			_first  = first;
+			_second = second;
+		}
+
+		public async ValueTask Get(TIn parameter)
+		{
+			var first = await _first(parameter);
+			await _second(first);
+		}
+	}
+
 	public class Termination<T> : IOperation<T>
 	{
 		readonly Await<T> _first;
 		readonly Await    _second;
+
+		public Termination(IOperation<T> first, IOperation second) : this(first.Await, second.Await) {}

 		public Termination(Await<T> first, Await second)
 		{


Return upon ObjectDisposedException inside IOException

--- Dx.Runtime/DefaultMessageNetworkReceiver.cs
+++ Dx.Runtime/DefaultMessageNetworkReceiver.cs
@@ -155,6 +155,14 @@
                             }
                         }

+                        // Try and convert the inner exception to an object disposed exception;
+                        // if it is, then the client has been disposed and we should return.
+                        var objectDisposedException = innerException as ObjectDisposedException;
+                        if (objectDisposedException != null)
+                        {
+                            return;
+                        }
+
                         throw;
                     }


Common: Modify to use Array.AsReadOnly()

--- Common/ThReplayData.cs
+++ Common/ThReplayData.cs
@@ -191,7 +191,7 @@
             /// </summary>
             public ReadOnlyCollection<byte> Signature
             {
-                get { return new ReadOnlyCollection<byte>(this.signature); }
+                get { return Array.AsReadOnly(this.signature); }
             }

             /// <summary>
@@ -199,7 +199,7 @@
             /// </summary>
             public ReadOnlyCollection<byte> Unknown1
             {
-                get { return new ReadOnlyCollection<byte>(this.unknown1); }
+                get { return Array.AsReadOnly(this.unknown1); }
             }

             /// <summary>
@@ -216,7 +216,7 @@
             /// </summary>
             public ReadOnlyCollection<byte> Unknown2
             {
-                get { return new ReadOnlyCollection<byte>(this.unknown2); }
+                get { return Array.AsReadOnly(this.unknown2); }
             }

             /// <summary>
@@ -224,7 +224,7 @@
             /// </summary>
             public ReadOnlyCollection<byte> Unknown3
             {
-                get { return new ReadOnlyCollection<byte>(this.unknown3); }
+                get { return Array.AsReadOnly(this.unknown3); }
             }

             /// <summary>
@@ -232,7 +232,7 @@
             /// </summary>
             public ReadOnlyCollection<byte> Data
             {
-                get { return new ReadOnlyCollection<byte>(this.data); }
+                get { return Array.AsReadOnly(this.data); }
             }

             /// <summary>
@@ -299,7 +299,7 @@
             /// </summary>
             public ReadOnlyCollection<byte> Signature
             {
-                get { return new ReadOnlyCollection<byte>(this.signature); }
+                get { return Array.AsReadOnly(this.signature); }
             }

             /// <summary>
@@ -312,7 +312,7 @@
             /// </summary>
             public ReadOnlyCollection<byte> Data
             {
-                get { return new ReadOnlyCollection<byte>(this.data); }
+                get { return Array.AsReadOnly(this.data); }
             }

             /// <summary>


bolded text

bolded text

--- MLPAutoCompleteTextField/MLPAutoCompleteTextField.cs
+++ MLPAutoCompleteTextField/MLPAutoCompleteTextField.cs
@@ -10,19 +10,8 @@

 namespace MLPAutoComplete
 {
-	interface IMLPAutoCompleteSortOperation
-	{
-		void AutoCompleteTermsDidSort(string[] completions);
-		int MaximumEditDistanceForAutoCompleteTerms(); //not sure
-	}
-
-	interface IMLPAutoCompleteFetchOperation
-	{
-		void AutoCompleteTermsDidFetch(Dictionary<string, bool> fetchInfo);
-	}
-
 	[Register("MLPAutoCompleteTextField")]
-	public class MLPAutoCompleteTextField : UITextField, IUITableViewDataSource, IUITableViewDelegate, IMLPAutoCompleteFetchOperation, IMLPAutoCompleteSortOperation
+	public class MLPAutoCompleteTextField : UITextField, IUITableViewDataSource, IUITableViewDelegate
 	{
 		private IMLPAutoCompleteTextFieldDataSource autoCompleteDataSource;
 		private IMLPAutoCompleteTextFieldDelegate autoCompleteDelegate;
@@ -69,8 +58,7 @@
 			}
 		}

-		public string IncompleteString {get;set;}
-		private string[] possibleCompletions{ get; set; }
+		public string IncompleteString { get; internal set; }

 		public bool SortAutoCompleteSuggestionsByClosestMatch = false;
 		public bool ApplyBoldEffectToAutoCompleteSuggestions = false;
@@ -88,8 +76,6 @@
 		public NSTimer AutoCompleteFetchRequestDelay;
 		public IList AutoCompleteSuggestions = new List<Object>();

-		public NSOperation AutoCompleteSortQueue,AutoCompleteFetchQueue;
-
 		public CGRect AutoCompleteTableFrame;
 		public CGSize AutoCompleteTableOriginOffset;
 		public CGSize AutoCompleteTableSizeOffset;
@@ -101,7 +87,6 @@
 		public UIColor AutoCompleteTableBackgroundColor;
 		public UIColor AutoCompleteTableCellTextColor;

-
 		private CGColor originalShadowColor;
 		private CGSize originalShadowOffset;
 		private float originalShadowOpacity;
@@ -138,7 +123,6 @@
 			this.beginObservingKeyPathsAndNotifications ();
 			this.setDefaultValuesForVariables ();

-
 			fetchOperation = new MLPAutoCompleteFetchOperation (this);
 		}

@@ -167,9 +151,7 @@
 			saveCurrentShadowProperties ();

 			if (AutoCompleteTableAppearsAsKeyboardAccessory)
-			{
 				this.fetchOperation.Fetch(autoCompleteDataSource);
-			}

 			return base.BecomeFirstResponder();
 		}
@@ -239,7 +221,6 @@
 				this.ResignFirstResponder();
 			}
 		}
-

 		public UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
 		{
@@ -276,11 +257,15 @@

 		void configureCell(UITableViewCell cell, NSIndexPath indexPath, string autoCompleteString)
 		{
-			//NSAttributedString boldedString;
+			NSAttributedString boldedString = null;

 			var attributedTextSupport = cell.TextLabel.RespondsToSelector (new Selector("setAttributedText:"));
 			if (attributedTextSupport && this.ApplyBoldEffectToAutoCompleteSuggestions) {
-				//TODO
+				var boldedAttributes = new UIStringAttributes
+				{
+					Font = UIFont.BoldSystemFontOfSize(UIFont.SystemFontSize)
+				};
+				boldedString = new NSAttributedString(autoCompleteString, boldedAttributes);
 			}

 			var autoCompleteObject = this.AutoCompleteSuggestions [indexPath.Row];
@@ -298,6 +283,18 @@

 			cell.TextLabel.Text = autoCompleteString;

+			if (AutoCompleteTableCellTextColor != null)
+			{
+				cell.TextLabel.TextColor = this.AutoCompleteTableCellTextColor;
+			}
+			if (boldedString != null)
+			{
+				cell.TextLabel.AttributedText = boldedString;
+			}
+			else
+			{
+				cell.TextLabel.Text = autoCompleteString;
+			}
 			//TODO
 			//
 			//			if (AutoCompleteTableCellTextColor) {
@@ -711,31 +708,6 @@
 			fetchOperation.Fetch (autoCompleteDataSource);
 		}

-
-
-		#region IMLPAutoCompleteFetchOperation implementation
-
-		public void AutoCompleteTermsDidFetch (Dictionary<string, bool> fetchInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		#endregion
-
-		#region IMLPAutoCompleteSortOperation implementation
-
-		public void AutoCompleteTermsDidSort (string[] completions)
-		{
-			throw new NotImplementedException ();
-		}
-
-		public int MaximumEditDistanceForAutoCompleteTerms ()
-		{
-			throw new NotImplementedException ();
-		}
-
-		#endregion
-
 		void setDefaultValuesForVariables()
 		{
 			this.ClipsToBounds = false;
@@ -757,12 +729,6 @@
 			this.AutoCompleteBoldFontName = UIFont.BoldSystemFontOfSize (13);

 			this.AutoCompleteSuggestions = new string[]{};
-
-			this.AutoCompleteSortQueue = new NSOperation ();
-			this.AutoCompleteSortQueue.Name = String.Format ("Autocomplete queue{0}", new Random ().Next ());
-
-			this.AutoCompleteFetchQueue = new NSOperation ();
-			this.AutoCompleteSortQueue.Name = String.Format ("Fetch queue{0}", new Random ().Next ());
 		}

 	}


set SnapsToDevicePixels before SizeToContent

known bug, solution taken from http://stackoverflow.com/q/4671633/920384

--- MahApps.Metro/Behaviours/BorderlessWindowBehavior.cs
+++ MahApps.Metro/Behaviours/BorderlessWindowBehavior.cs
@@ -400,8 +400,11 @@

             // handle size to content (thanks @lynnx)
             var sizeToContent = AssociatedObject.SizeToContent;
+            var snapsToDevicePixels = AssociatedObject.SnapsToDevicePixels;
+            AssociatedObject.SnapsToDevicePixels = true;
             AssociatedObject.SizeToContent = sizeToContent == SizeToContent.WidthAndHeight ? SizeToContent.Height : SizeToContent.Manual;
             AssociatedObject.SizeToContent = sizeToContent;
+            AssociatedObject.SnapsToDevicePixels = snapsToDevicePixels;
         }

         private void AssociatedObject_Loaded(object sender, RoutedEventArgs e)


Added documentation to method and property.

--- cocos2d/CCScheduler.cs
+++ cocos2d/CCScheduler.cs
@@ -600,168 +600,11 @@
             }
         }

-		// This would be called after UnscheduleAll has been called to restart the actions
-		public void StartActionManager()
-		{
-			ScheduleUpdateForTarget (CCDirector.SharedDirector.ActionManager, CCScheduler.PrioritySystem, false);
-		}
-
-        public void UnscheduleAll()
-        {
-			// This also stops ActionManger from updating which means all actions are stopped as well.
-			UnscheduleAllWithMinPriority(PrioritySystem);
-        }
-
-        public void UnscheduleAllWithMinPriority(int minPriority)
-        {
-            var count = m_pHashForTimers.Values.Count;
-            if (s_pTmpHashSelectorArray.Length < count)
-            {
-                s_pTmpHashSelectorArray = new HashTimeEntry[s_pTmpHashSelectorArray.Length * 2];
-            }
-
-            m_pHashForTimers.Values.CopyTo(s_pTmpHashSelectorArray, 0);
-
-            for (int i = 0; i < count; i++)
-            {
-                // Element may be removed in unscheduleAllSelectorsForTarget
-                UnscheduleAllForTarget(s_pTmpHashSelectorArray[i].Target);
-            }
-
-            // Updates selectors
-            if (minPriority < 0 && m_pUpdatesNegList.Count > 0)
-            {
-                LinkedList<ListEntry> copy = new LinkedList<ListEntry>(m_pUpdatesNegList);
-                foreach (ListEntry entry in copy)
-                {
-                    if (entry.Priority >= minPriority)
-                    {
-                        UnscheduleAllForTarget(entry.Target);
-                    }
-                }
-            }
-
-            if (minPriority <= 0 && m_pUpdates0List.Count > 0)
-            {
-                LinkedList<ListEntry> copy = new LinkedList<ListEntry>(m_pUpdates0List);
-                foreach (ListEntry entry in copy)
-                {
-                    UnscheduleAllForTarget(entry.Target);
-                }
-            }
-
-            if (m_pUpdatesPosList.Count > 0)
-            {
-                LinkedList<ListEntry> copy = new LinkedList<ListEntry>(m_pUpdatesPosList);
-                foreach (ListEntry entry in copy)
-                {
-                    if (entry.Priority >= minPriority)
-                    {
-                        UnscheduleAllForTarget(entry.Target);
-                    }
-                }
-            }
-        }
-
-        public List<ICCUpdatable> PauseAllTargets()
-        {
-            return PauseAllTargetsWithMinPriority(int.MinValue);
-        }
-
-        public List<ICCUpdatable> PauseAllTargetsWithMinPriority(int minPriority)
-        {
-            var idsWithSelectors = new List<ICCUpdatable>();
-
-            // Custom Selectors
-            foreach (HashTimeEntry element in m_pHashForTimers.Values)
-            {
-                element.Paused = true;
-                idsWithSelectors.Add(element.Target);
-            }
-
-            // Updates selectors
-            if (minPriority < 0)
-            {
-                foreach (ListEntry element in m_pUpdatesNegList)
-                {
-                    if (element.Priority >= minPriority)
-                    {
-                        element.Paused = true;
-                        idsWithSelectors.Add(element.Target);
-                    }
-                }
-            }
-
-            if (minPriority <= 0)
-            {
-                foreach (ListEntry element in m_pUpdates0List)
-                {
-                    element.Paused = true;
-                    idsWithSelectors.Add(element.Target);
-                }
-            }
-
-            if (minPriority < 0)
-            {
-                foreach (ListEntry element in m_pUpdatesPosList)
-                {
-                    if (element.Priority >= minPriority)
-                    {
-                        element.Paused = true;
-                        idsWithSelectors.Add(element.Target);
-                    }
-                }
-            }
-
-            return idsWithSelectors;
-        }
-
-        public void ResumeTargets(List<ICCUpdatable> targetsToResume)
-        {
-            foreach (ICCUpdatable target in targetsToResume)
-            {
-                ResumeTarget(target);
-            }
-        }
-
-        public void PauseTarget(ICCUpdatable target)
-        {
-            Debug.Assert(target != null);
-
-            // custom selectors
-            HashTimeEntry entry;
-            if (m_pHashForTimers.TryGetValue(target, out entry))
-            {
-                entry.Paused = true;
-            }
-
-            // Update selector
-            HashUpdateEntry updateEntry;
-            if (m_pHashForUpdates.TryGetValue(target, out updateEntry))
-            {
-                updateEntry.Entry.Paused = true;
-            }
-        }
-
-        public void ResumeTarget(ICCUpdatable target)
-        {
-            Debug.Assert(target != null);
-
-            // custom selectors
-            HashTimeEntry element;
-            if (m_pHashForTimers.TryGetValue(target, out element))
-            {
-                element.Paused = false;
-            }
-
-            // Update selector
-            HashUpdateEntry elementUpdate;
-            if (m_pHashForUpdates.TryGetValue(target, out elementUpdate))
-            {
-                elementUpdate.Entry.Paused = false;
-            }
-        }
-
+		/// <summary>
+		/// Gets a value indicating whether the ActionManager is active.
+		/// The ActionManager can be stopped from processing actions by calling UnscheduleAll() method.
+		/// </summary>
+		/// <value><c>true</c> if the ActionManager active and ready to process Actions; otherwise, <c>false</c>.</value>
 		public bool IsActionManagerActive
 		{
 			get {
@@ -783,6 +626,172 @@
 			}
 		}

+		/// <summary>
+		/// Starts the action manager.
+		/// This would be called after UnscheduleAll() method has been called to restart the ActionManager.
+		/// </summary>
+		public void StartActionManager()
+		{
+			if (!IsActionManagerActive)
+				ScheduleUpdateForTarget (CCDirector.SharedDirector.ActionManager, CCScheduler.PrioritySystem, false);
+		}
+
+        public void UnscheduleAll()
+        {
+			// This also stops ActionManger from updating which means all actions are stopped as well.
+			UnscheduleAllWithMinPriority(PrioritySystem);
+        }
+
+        public void UnscheduleAllWithMinPriority(int minPriority)
+        {
+            var count = m_pHashForTimers.Values.Count;
+            if (s_pTmpHashSelectorArray.Length < count)
+            {
+                s_pTmpHashSelectorArray = new HashTimeEntry[s_pTmpHashSelectorArray.Length * 2];
+            }
+
+            m_pHashForTimers.Values.CopyTo(s_pTmpHashSelectorArray, 0);
+
+            for (int i = 0; i < count; i++)
+            {
+                // Element may be removed in unscheduleAllSelectorsForTarget
+                UnscheduleAllForTarget(s_pTmpHashSelectorArray[i].Target);
+            }
+
+            // Updates selectors
+            if (minPriority < 0 && m_pUpdatesNegList.Count > 0)
+            {
+                LinkedList<ListEntry> copy = new LinkedList<ListEntry>(m_pUpdatesNegList);
+                foreach (ListEntry entry in copy)
+                {
+                    if (entry.Priority >= minPriority)
+                    {
+                        UnscheduleAllForTarget(entry.Target);
+                    }
+                }
+            }
+
+            if (minPriority <= 0 && m_pUpdates0List.Count > 0)
+            {
+                LinkedList<ListEntry> copy = new LinkedList<ListEntry>(m_pUpdates0List);
+                foreach (ListEntry entry in copy)
+                {
+                    UnscheduleAllForTarget(entry.Target);
+                }
+            }
+
+            if (m_pUpdatesPosList.Count > 0)
+            {
+                LinkedList<ListEntry> copy = new LinkedList<ListEntry>(m_pUpdatesPosList);
+                foreach (ListEntry entry in copy)
+                {
+                    if (entry.Priority >= minPriority)
+                    {
+                        UnscheduleAllForTarget(entry.Target);
+                    }
+                }
+            }
+        }
+
+        public List<ICCUpdatable> PauseAllTargets()
+        {
+            return PauseAllTargetsWithMinPriority(int.MinValue);
+        }
+
+        public List<ICCUpdatable> PauseAllTargetsWithMinPriority(int minPriority)
+        {
+            var idsWithSelectors = new List<ICCUpdatable>();
+
+            // Custom Selectors
+            foreach (HashTimeEntry element in m_pHashForTimers.Values)
+            {
+                element.Paused = true;
+                idsWithSelectors.Add(element.Target);
+            }
+
+            // Updates selectors
+            if (minPriority < 0)
+            {
+                foreach (ListEntry element in m_pUpdatesNegList)
+                {
+                    if (element.Priority >= minPriority)
+                    {
+                        element.Paused = true;
+                        idsWithSelectors.Add(element.Target);
+                    }
+                }
+            }
+
+            if (minPriority <= 0)
+            {
+                foreach (ListEntry element in m_pUpdates0List)
+                {
+                    element.Paused = true;
+                    idsWithSelectors.Add(element.Target);
+                }
+            }
+
+            if (minPriority < 0)
+            {
+                foreach (ListEntry element in m_pUpdatesPosList)
+                {
+                    if (element.Priority >= minPriority)
+                    {
+                        element.Paused = true;
+                        idsWithSelectors.Add(element.Target);
+                    }
+                }
+            }
+
+            return idsWithSelectors;
+        }
+
+        public void ResumeTargets(List<ICCUpdatable> targetsToResume)
+        {
+            foreach (ICCUpdatable target in targetsToResume)
+            {
+                ResumeTarget(target);
+            }
+        }
+
+        public void PauseTarget(ICCUpdatable target)
+        {
+            Debug.Assert(target != null);
+
+            // custom selectors
+            HashTimeEntry entry;
+            if (m_pHashForTimers.TryGetValue(target, out entry))
+            {
+                entry.Paused = true;
+            }
+
+            // Update selector
+            HashUpdateEntry updateEntry;
+            if (m_pHashForUpdates.TryGetValue(target, out updateEntry))
+            {
+                updateEntry.Entry.Paused = true;
+            }
+        }
+
+        public void ResumeTarget(ICCUpdatable target)
+        {
+            Debug.Assert(target != null);
+
+            // custom selectors
+            HashTimeEntry element;
+            if (m_pHashForTimers.TryGetValue(target, out element))
+            {
+                element.Paused = false;
+            }
+
+            // Update selector
+            HashUpdateEntry elementUpdate;
+            if (m_pHashForUpdates.TryGetValue(target, out elementUpdate))
+            {
+                elementUpdate.Entry.Paused = false;
+            }
+        }
+
         public bool IsTargetPaused(ICCUpdatable target)
         {
             Debug.Assert(target != null, "target must be non nil");


Expand expression because some compiler versions cannot resolve the correct overload (Assert.Throws<T>(Func<Task>) being the conflicting overload).

--- Eutherion/Tests/WorkingCopyTextFileTests.cs
+++ Eutherion/Tests/WorkingCopyTextFileTests.cs
@@ -545,9 +545,9 @@
         {
             using (var wcFile = WorkingCopyTextFile.Open(null, null))
             {
-                Assert.Throws<InvalidOperationException>(wcFile.Save);
-                wcFile.Dispose();
-                Assert.Throws<ObjectDisposedException>(wcFile.Save);
+                Assert.Throws<InvalidOperationException>(() => wcFile.Save());
+                wcFile.Dispose();
+                Assert.Throws<ObjectDisposedException>(() => wcFile.Save());
                 Assert.Throws<ObjectDisposedException>(() => wcFile.UpdateLocalCopyText(string.Empty, false));
             }
         }
@@ -691,7 +691,7 @@
             using (var wcFile = WorkingCopyTextFile.Open(filePath, AutoSaveFiles()))
             {
                 fileFixture.PrepareTargetFile(TargetFile.PrimaryTextFile, FileState.LockedByAnotherProcess);
-                Assert.Throws<IOException>(wcFile.Save);
+                Assert.Throws<IOException>(() => wcFile.Save());

                 wcFile.LoadedTextChanged += (_, __) => ewh.Set();
                 fileFixture.PrepareTargetFile(TargetFile.PrimaryTextFile, newLoadedText);


Add unit tests with assertions on expected exceptions from ReplaceOpenTextFile.

--- Eutherion/Tests/WorkingCopyTextFileTests.cs
+++ Eutherion/Tests/WorkingCopyTextFileTests.cs
@@ -754,5 +754,45 @@
                 Assert.False(wcFile.ContainsChanges);
             }
         }
+
+        private void PrepareForReplaceTest(string primaryLoadedText, string secondaryLoadedText)
+        {
+            fileFixture.PrepareTargetFile(TargetFile.PrimaryTextFile, primaryLoadedText);
+            fileFixture.PrepareTargetFile(TargetFile.SecondaryTextFile, secondaryLoadedText);
+        }
+
+        [Fact]
+        public void ReplaceFailsWhenDisposed()
+        {
+            PrepareForReplaceTest("A", "B");
+
+            var wcFile = WorkingCopyTextFile.Open(fileFixture.GetPath(TargetFile.PrimaryTextFile), null);
+            var liveTextFile = wcFile.OpenTextFile;
+            wcFile.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => wcFile.ReplaceOpenTextFile(fileFixture.GetPath(TargetFile.SecondaryTextFile)));
+            Assert.Same(liveTextFile, wcFile.OpenTextFile);
+        }
+
+        [Fact]
+        public void ReplaceFailsWhenNotOwner()
+        {
+            PrepareForReplaceTest("A", "B");
+
+            using (var textFile = new LiveTextFile(fileFixture.GetPath(TargetFile.PrimaryTextFile)))
+            {
+                string replacePath = fileFixture.GetPath(TargetFile.SecondaryTextFile);
+
+                var wcFile = WorkingCopyTextFile.FromLiveTextFile(textFile, null);
+                using (wcFile)
+                {
+                    Assert.Throws<InvalidOperationException>(() => wcFile.ReplaceOpenTextFile(replacePath));
+                    Assert.Same(textFile, wcFile.OpenTextFile);
+                }
+
+                // Also assert that the ObjectDisposedException has precedence.
+                Assert.Throws<ObjectDisposedException>(() => wcFile.ReplaceOpenTextFile(replacePath));
+            }
+        }
     }
 }


Added 3 new events on the athletics

Added 3 new events on the athletics

--- EvansDiary.Web/Views/Athletics/Index.cshtml
+++ EvansDiary.Web/Views/Athletics/Index.cshtml
@@ -284,7 +284,7 @@
                 2014

-
+

@@ -311,8 +311,8 @@

                         @*@{
-                            image = new AssociatedImage("2015_youtube_sprint_rn9kze", "Sprint Race Video");
-                        }*@
+                                image = new AssociatedImage("2015_youtube_sprint_rn9kze", "Sprint Race Video");
+                            }*@

@@ -324,17 +324,17 @@

                         @*
-
-                        *@
+
+                            *@

                 2015

-
+

@@ -355,8 +355,8 @@

+                an invisible wrapper that butts up against the floated element and then the margins on the paragraph then work as expected
+                against the wrapper div. -->

                         @{ image = new AssociatedImage("2016_aquathlon_ybxjei", "The running stage"); }
@@ -368,6 +368,92 @@

+                2016
+

+

+
+

+

+
+

+
+

+
Year 6 Sports Day

+

+                    Evan's last sports day of primary school, he wanted to go out with a bang. He ran well and the whole school acknowledged how good he is at running by chanting his name at the start of the race.
+                    His house team 'Sharks' overall performed poorly against the other house teams but Evan was pleased with the running race that he won.
+

+

+

+                        @{
+                            image = new AssociatedImage("2015_sprint_skmj84", "Sprint Race");
+                        }
+
+
+
+

+

+

+
+
+
+

+

+

+                2016
+

+

+
+

+

+
+

+
+

+
Sports Person of the Year

+

+                    Evan won the award of 'Sports Person of the Year' voted for by his peers. He has represented his primary school for many sporting activities over the years.
+                    He is very pleased to have been rewarded with this award as he leaves the school to embark on a new chapter at secondary school.
+

+

+                    @{ image = new AssociatedImage("2013_sports_day_xfblzc", "Sports Person of the Year"); }
+
+
+
+

+                2016
+

+

+
+

+

+
+

+
+

+
Personal Best for the 100m

+

+                    On the 11th September 2016, Evan represented Team Bath at an athletics open meet. He ran the 100m and competed in the javelin.
+                    He ran his personal best time of 14.5 seconds for the 100m finishing second in his race.
+

+

+                    @{ image = new AssociatedImage("2013_sports_day_xfblzc", "100m PB"); }
+
+
+
+

                 2016