Write online game starter

Write online game starter

--- Tron/Application/Application/Program.cs
+++ Tron/Application/Application/Program.cs
@@ -1,6 +1,9 @@
 // Program.cs
 // <copyright file="Program.cs"> This code is protected under the MIT License. </copyright>
 using System;
+using System.Net;
+using System.Threading;
+using Networking;
 using Tron;

 namespace Application
@@ -24,6 +27,7 @@
         {
             Console.Title = "Tron";
             Game = new Game();
+            GameData.Client = new Client();
             Help();
             GetCommand();
         }
@@ -51,6 +55,7 @@
             Console.WriteLine("I, J, K, L to change direction");
             Console.WriteLine("B for boost.\n\n");
             Console.WriteLine("To play local multiplayer type 'local'");
+            Console.WriteLine("To play online multiplayer type 'online'");
             Console.WriteLine("To display this message again type 'help'");
             Console.WriteLine("To quit the game type 'quit'");
         }
@@ -69,6 +74,10 @@
                 if (inp.ToLower() == "local")
                 {
                     StartLocalGame();
+                }
+                else if (inp.ToLower() == "online")
+                {
+                    StartOnlineGame();
                 }
                 else if (inp.ToLower() == "help")
                 {
@@ -154,6 +163,90 @@
         }

         /// <summary>
+        /// Starts an online game of tron.
+        /// </summary>
+        public static void StartOnlineGame()
+        {
+            // Get ip
+            IPAddress hostIP;
+            while (true)
+            {
+                hostIP = GetIpFromUser();
+                if (hostIP == null)
+                {
+                    // Exit method if user does not wish to play online
+                    return;
+                }
+
+                // Connect
+                Console.WriteLine("Connecting...");
+                bool? connected = GameData.Client.Connect(hostIP);
+                if (connected == null)
+                {
+                    Console.WriteLine("Host not found!");
+                }
+                else if (connected == false)
+                {
+                    Console.WriteLine("Server is full!");
+                }
+                else
+                {
+                    break;
+                }
+            }
+
+            Console.WriteLine("Connected!");
+            Console.Write("Waiting for new round to start...\nPress any key to disconnect... ");
+
+            // Wait for new round
+            while (true)
+            {
+                if (Console.KeyAvailable == true)
+                {
+                    // Exit method if key was pressed
+                    Console.ReadKey(true);
+                    Console.WriteLine();
+                    break;
+                }
+                else if (TronData.Tron.TimeTillAction > 0)
+                {
+                    // Start game if new round is commencing
+                    StartGame();
+                    break;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Gets an ip address from the user.
+        /// </summary>
+        /// <remarks> If null is returned the user wishes to go back. </remarks>
+        public static IPAddress GetIpFromUser()
+        {
+            while (true)
+            {
+                Console.Write("Enter the IP address of the server of b to go back... ");
+
+                // Get the input
+                string inp = Console.ReadLine();
+                IPAddress ip;
+
+                if (inp == "b")
+                {
+                    return null;
+                }
+                else if (IPAddress.TryParse(inp, out ip))
+                {
+                    return ip;
+                }
+                else
+                {
+                    Console.WriteLine("Invalid IP address!");
+                }
+            }
+        }
+
+        /// <summary>
         /// Starts the game.
         /// </summary>
         public static void StartGame()


Add Update Method to TwitterAdapter and Format

--- TwitterMonkey.Android/TwitterAdapter.cs
+++ TwitterMonkey.Android/TwitterAdapter.cs
@@ -7,6 +7,7 @@

 namespace TwitterMonkey {
   public class TwitterAdapter : BaseAdapter<Tweet> {
+
     private List<Tweet> tweets;
     private Activity context;

@@ -14,31 +15,35 @@
       this.context = context;
       this.tweets = tweets;
     }
-    public override long GetItemId(int position)
-    {
+
+    public override long GetItemId(int position) {
       return position;
     }
-    public override Tweet this[int position]
-    {
+
+    public override Tweet this[int position] {
       get { return tweets[position]; }
     }
-    public override int Count
-    {
+
+    public override int Count {
       get { return tweets.Count; }
     }
-    public override View GetView(int position, View convertView, ViewGroup parent)
-    {
+
+    public override View GetView(int position, View convertView, ViewGroup parent) {
       var item = tweets[position];
       View view = convertView;
-      if (view == null) // no view to re-use, create new
-        view = context.LayoutInflater.Inflate(Resource.Layout.TweetView, null);
+      // no view to re-use, create new
+      if (view == null) view = context.LayoutInflater.Inflate(Resource.Layout.TweetView, null);
       view.FindViewById<TextView>(Resource.Id.TweetUserName).Text = item.User.Name;
       view.FindViewById<TextView>(Resource.Id.TweetMessage).Text = item.Message;
       Picasso.With(context).Load(item.User.ProfileImageUrl).Into(view.FindViewById<ImageView>(Resource.Id.TweetUserImage));
       return view;
     }

-
+    public void Update(List<Tweet> tweets){
+      this.tweets.Clear();
+      this.tweets.AddRange(tweets);
+      NotifyDataSetChanged();
+    }
   }
 }


Improve code

Improve code

--- KLibrary3/UnitTest/Linq/Lab/RecursiveHelperTest.cs
+++ KLibrary3/UnitTest/Linq/Lab/RecursiveHelperTest.cs
@@ -44,9 +44,7 @@
                 .EnumerateRecursively(p => Directory.EnumerateDirectories(p));

             foreach (var path in query)
-            {
                 Console.WriteLine(path);
-            }
         }

         [TestMethod]
@@ -57,9 +55,7 @@
                     .Select(p => new { Index = _.Index + 1, Path = p }));

             foreach (var item in query)
-            {
-                Console.WriteLine("{0}: {1}", item.Index, item.Path);
-            }
+                Console.WriteLine($"{item.Index}: {item.Path}");
         }

         [TestMethod]
@@ -70,9 +66,7 @@
                     .Select(p => new { Index = _.Index + 1, Path = p }));

             foreach (var item in query)
-            {
-                Console.WriteLine("{0}: {1}", item.Index, item.Path);
-            }
+                Console.WriteLine($"{item.Index}: {item.Path}");
         }
     }
 }


fix Read8 in AtaPio

fix Read8 in AtaPio

--- source2/Kernel/System/Hardware/Cosmos.Hardware/BlockDevice/AtaPio.cs
+++ source2/Kernel/System/Hardware/Cosmos.Hardware/BlockDevice/AtaPio.cs
@@ -204,7 +204,7 @@
       CheckDataSize(aData, aBlockCount);
       SelectSector(aBlockNo, aBlockCount);
       SendCmd(Cmd.ReadPio);
-      IO.Data.Read16(aData);
+      IO.Data.Read8(aData);
     }

     public override void WriteBlock(UInt64 aBlockNo, UInt32 aBlockCount, byte[] aData) {


Fix Register EndPoint

Fix Register EndPoint

--- WhatsAppApi/Register/WhatsRegisterV2.cs
+++ WhatsAppApi/Register/WhatsRegisterV2.cs
@@ -74,7 +74,7 @@
                 RequestHttpHeaders.Add("User-Agent", WhatsConstants.UserAgent);
                 RequestHttpHeaders.Add("Accept", "text/json");

-                response = GetResponse("https://" + WhatsConstants.WhatsAppRequestHost, QueryStringParameters, RequestHttpHeaders);
+                response = GetResponse("https://" + WhatsConstants.WhatsAppCheckHost, QueryStringParameters, RequestHttpHeaders);
                 if (!response.GetJsonValue("status").Equals("ok"))
                 {
                     /*
@@ -231,7 +231,7 @@
                 RequestHttpHeaders.Add("User-Agent", WhatsConstants.UserAgent);
                 RequestHttpHeaders.Add("Accept", "text/json");

-                response = GetResponse("https://" + WhatsConstants.WhatsAppRequestHost, QueryStringParameters, RequestHttpHeaders);
+                response = GetResponse("https://" + WhatsConstants.WhatsAppRegisterHost, QueryStringParameters, RequestHttpHeaders);
                 if (response.GetJsonValue("status") == "ok")
                 {
                     return response.GetJsonValue("pw");
@@ -287,7 +287,7 @@
                 RequestHttpHeaders.Add("User-Agent", WhatsConstants.UserAgent);
                 RequestHttpHeaders.Add("Accept", "text/json");

-                response = GetResponse("https://" + WhatsConstants.WhatsAppRequestHost, QueryStringParameters, RequestHttpHeaders);
+                response = GetResponse("https://" + WhatsConstants.WhatsAppCheckHost, QueryStringParameters, RequestHttpHeaders);
                 if (response.GetJsonValue("status") == "ok")
                 {
                     return response.GetJsonValue("pw");


Added Enumerable.AsReplayable

Added Enumerable.AsReplayable

--- KitchenSink.Lib/Extensions/EnumerableExtensions.cs
+++ KitchenSink.Lib/Extensions/EnumerableExtensions.cs
@@ -367,5 +367,70 @@

             return array;
         }
+
+        ///
+        /// Returns enumerable that can be re-enumerated even if given enumerable can't be.
+        ///
+        public static IReplayableEnumerable Replayable(this IEnumerable seq) =>
+            new ReplayableEnumerable(seq);
+    }
+
+    public interface IReplayableEnumerable : IEnumerable { }
+
+    internal class ReplayableEnumerable : IReplayableEnumerable
+    {
+        private readonly Lazy<IEnumerator> source;
+        private readonly Atom<(bool, List)> items = Atom.Of((false, ListOf()));
+
+        public ReplayableEnumerable(IEnumerable source) =>
+            this.source = new Lazy<IEnumerator>(() => source.GetEnumerator());
+
+        public IEnumerator GetEnumerator() => new Etor(this);
+
+        private class Etor : IEnumerator
+        {
+            private readonly ReplayableEnumerable seq;
+            private int index;
+            private Maybe current = None();
+
+            public Etor(ReplayableEnumerable seq) => this.seq = seq;
+
+            public A Current => current.OrElseThrow(new InvalidOperationException());
+
+            public bool MoveNext() => seq.items.Update(t =>
+            {
+                var (done, list) = t;
+
+                if (done)
+                {
+                    return (false, list);
+                }
+
+                if (index < list.Count)
+                {
+                    current = Some(list[index++]);
+                    return (true, list);
+                }
+
+                if (seq.source.Value.MoveNext())
+                {
+                    done = false;
+                    var val = seq.source.Value.Current;
+                    list.Add(val);
+                    current = Some(val);
+                    return (true, list);
+                }
+
+                return (false, list);
+            }).Item1;
+
+            public void Reset() => index = 0;
+
+            public void Dispose() { }
+
+            object IEnumerator.Current => Current;
+        }
+
+        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
     }
 }


Add add_particle

Add add_particle

--- WorldScripter/Assets/ConsoleInputMan.cs
+++ WorldScripter/Assets/ConsoleInputMan.cs
@@ -500,6 +500,49 @@
                 ParseCommand("create " + Args[1] + " " + hit.point.x + " " + y + " " + hit.point.z + " " + Args[2] + " " + Args[3] + " " + Args[4] + " " + Args[5]);
         }
     }
+    [Command("add_particle")]
+    public void AddParticle(string[] Args)
+    {
+        GameObject[] Objs;
+        ParticleSystem Emitter;
+        ParticleSystemRenderer Renderer;
+        ParticleSystem.ShapeModule ShapeModule;
+        ParticleSystem.MainModule Emission;
+        var FilePath = PathToTextureFolder + "/";
+        foreach (string Arg in Args)
+        {
+            //Just if you have files in the name.
+            if (Arg == "add_particle") { }
+            else if (Arg == Args[1]) { }
+            else
+                FilePath = FilePath + Arg;
+        }
+        Objs = GameObject.FindGameObjectsWithTag("ConsoleCreated"); // Make sure we aren't doing something stupid here
+        foreach (GameObject Obj in Objs)
+        {
+            if (Obj.name == Args[1])
+            {
+                if (System.IO.File.Exists(FilePath))
+                {
+                    Emitter = Obj.AddComponent<ParticleSystem>(); // Actually get the type
+                    Renderer = Obj.GetComponent<ParticleSystemRenderer>();
+                    var Bytes = System.IO.File.ReadAllBytes(FilePath);
+                    var Tex = new Texture2D(1, 1); //Load the texture onto a texture
+                    ShapeModule = Emitter.shape;
+                    Tex.LoadImage(Bytes);
+                    Renderer.material.mainTexture = Tex;
+                    ShapeModule.shapeType = ParticleSystemShapeType.Sphere;
+                    Renderer.material.shader = Shader.Find("Particles/Alpha Blended");
+                    Emission = Emitter.main;
+                    Emission.maxParticles = 20;
+                    Emission.startLifetime = 0.7F;
+                    Emitter.Play();
+                    Debug.Log("7");
+                    SendMSG("Added particle to " + Args[1]);
+                }
+            }
+        }
+    }

     public string GetName(string FileName)


(TFS CS 3540)

(TFS CS 3540)

--- Signum.Test/Assert2.cs
+++ Signum.Test/Assert2.cs
@@ -23,5 +23,23 @@

             throw new AssertFailedException("No {0} has been thrown".Formato(typeof(T).Name));
         }
+
+        public static void Throws<T>(Action action, string messageToContain)
+           where T : Exception
+        {
+            try
+            {
+                action();
+            }
+            catch (T ex)
+            {
+                if(!ex.Message.Contains(messageToContain))
+                    throw new AssertFailedException("Exception thrown does not contain message '{0}'".Formato(ex.Message));
+
+                return;
+            }
+
+            throw new AssertFailedException("No {0} has been thrown".Formato(typeof(T).Name));
+        }
     }
 }


WuLocation shouldn't be writeable

WuLocation shouldn't be writeable

--- XWeather/Shared/Domain/Wu/WuLocation.cs
+++ XWeather/Shared/Domain/Wu/WuLocation.cs
@@ -29,7 +29,7 @@
 		public WuAcLocation Location { get; set; }

-		public bool Current { get { return Location.Current; } set { Location.Current = value; } }
+		public bool Current => Location.Current;

 		public bool Selected { get { return Location.Selected; } set { Location.Selected = value; } }


issue #41 fixed

issue #41 fixed

--- Xamarin.Forms.DataGrid/DataGrid.xaml.cs
+++ Xamarin.Forms.DataGrid/DataGrid.xaml.cs
@@ -501,7 +501,10 @@
 			{
 				if (i != sData.Index)
 				{
-					Columns[i].SortingIcon.Source = null;
+					if (Columns[i].SortingIcon.Style != null)
+						Columns[i].SortingIcon.Style = null;
+					if (Columns[i].SortingIcon.Source != null)
+						Columns[i].SortingIcon.Source = null;
 					_sortingOrders[i] = SortingOrder.None;
 				}
 			}


Adding last tutorial query

Adding last tutorial query

--- LINQToAQL.Test/QueryBuilding/AdbTutorialQueries.cs
+++ LINQToAQL.Test/QueryBuilding/AdbTutorialQueries.cs
@@ -101,7 +101,14 @@
                 GetQueryString(query.Expression));
         }

-        //skipped queries 4 and 5 for now.
+        [Test]
+        public void FuzzyJoin5()
+        {
+            var query = dv.FacebookUsers.Select(fbu => new {id = fbu.id, name = fbu.name, similarUsers = dv.TweetMessages.Where(t => t.user.name.EditDistanceCheck(fbu.name, 3)).Select(t => new {twitterScreenname = t.user.ScreenName, twitterName = t.user.name})});
+            Assert.AreEqual(
+                "for $fbu in dataset FacebookUsers return { \"id\": $fbu.id, \"name\": $fbu.name, \"similarUsers\": (for $t in dataset TweetMessages where edit-distance-check($t.user.name, $fbu.name, 3) return { \"twitterScreenname\": $t.user.screen-name, \"twitterName\": $t.user.name }) }",
+                GetQueryString(query.Expression));
+        }

         [Test]
         public void ExistentialQuantification6()


Allow optionals in converter

Allow optionals in converter

--- src/BizTalk.Extended.Core/Utilities/ContextPropertyValueConverter.cs
+++ src/BizTalk.Extended.Core/Utilities/ContextPropertyValueConverter.cs
@@ -14,8 +14,6 @@
         /// <returns></returns>
         public static object SerializeToContextPropertyValue<TContextProperty>(object value) where TContextProperty : MessageContextPropertyBase, new()
         {
-            Guard.NotNull(value, "value");
-
             var contextProperty = new TContextProperty();
             object actualValue = value;

@@ -35,8 +33,6 @@
         /// <returns></returns>
         public static TExpected DeserializeFromContextPropertyValue<TExpected>(object value)
         {
-            Guard.NotNull(value, "value");
-
             if (typeof(TExpected).IsEnum)
             {
                 return (TExpected)Enum.Parse(typeof(TExpected), value as string);


made failing test pass by throwing ValueIsNullException when mapping an option to null #517

--- LanguageExt.Core/ClassInstances/Functor/FOption.cs
+++ LanguageExt.Core/ClassInstances/Functor/FOption.cs
@@ -17,6 +17,6 @@

         [Pure]
         public Option<B> Map(Option<A> ma, Func<A, B> f) =>
-            MOption<A>.Inst.Bind<MOption<B>, Option<B>, B>(ma, a => MOption<B>.Inst.Return(f(a)));
+            MOption<A>.Inst.Bind<MOption<B>, Option<B>, B>(ma, a => Some(f(a)));
     }
 }


Do not run the StackAllocSpanLengthOverflow test on x64 platform

--- src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenReadonlyStructTests.cs
+++ src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenReadonlyStructTests.cs
@@ -1209,7 +1209,7 @@
     }
 }", TestOptions.ReleaseExe);

-            CompileAndVerify(comp, expectedOutput: "overflow", verify: Verification.Fails).VerifyIL("Test.M", @"
+            var expectedIL = @"
 {
   // Code size       22 (0x16)
   .maxstack  2
@@ -1222,7 +1222,19 @@
   IL_000f:  newobj     ""System.Span<int>..ctor(void*, int)""
   IL_0014:  pop
   IL_0015:  ret
-}");
+}";
+
+            var isx86 = (IntPtr.Size == 4);
+            if (isx86)
+            {
+                CompileAndVerify(comp, expectedOutput: "overflow", verify: Verification.Fails).VerifyIL("Test.M", expectedIL);
+            }
+            else
+            {
+                // On 64bit the native int does not overflow, so we get StackOverflow instead
+                // therefore we will just check the IL
+                CompileAndVerify(comp, verify: Verification.Fails).VerifyIL("Test.M", expectedIL);
+            }
         }

         [Fact]


Add some more foo which got forgotten in the last commit.


Cleanup unused namespace

Cleanup unused namespace


GUI: Also create a detailed file log (in TEMP)

--- SimpleDLNA/FormMain.cs
+++ SimpleDLNA/FormMain.cs
@@ -5,15 +5,15 @@
 using System.Linq;
 using System.Reflection;
 using System.Threading;
+using System.Threading.Tasks;
 using System.Windows.Forms;
-using log4net;
 using log4net.Appender;
 using log4net.Config;
 using log4net.Core;
+using log4net.Layout;
 using NMaier.SimpleDlna.FileMediaServer;
 using NMaier.SimpleDlna.Server;
 using NMaier.SimpleDlna.Utilities;
-using System.Threading.Tasks;

 namespace NMaier.SimpleDlna.GUI
 {
@@ -22,6 +22,7 @@
     private readonly Properties.Settings Config = Properties.Settings.Default;
     private HttpServer httpServer;
     private readonly FileInfo cacheFile = new FileInfo(Path.Combine(Path.GetTempPath(), "sdlna.cache"));
+    private readonly FileInfo logFile = new FileInfo(Path.Combine(Path.GetTempPath(), "sdlna.log"));
     private bool canClose = false;

     public FormMain()
@@ -38,8 +39,21 @@

     private void SetupLogging()
     {
-      BasicConfigurator.Configure(this);
-      LogManager.GetRepository().Threshold = Level.Info;
+      var layout = new PatternLayout()
+      {
+        ConversionPattern = "%6level [%3thread] %-14.14logger{1} - %message%newline%exception"
+      };
+      layout.ActivateOptions();
+      var fileAppender = new RollingFileAppender()
+      {
+        File = logFile.FullName,
+        Layout = layout,
+        MaximumFileSize = "10MB",
+        MaxSizeRollBackups = 3,
+        RollingStyle = RollingFileAppender.RollingMode.Size
+      };
+      fileAppender.ActivateOptions();
+      BasicConfigurator.Configure(this, fileAppender);
     }

     private void StartPipeNotification()
@@ -158,21 +172,27 @@
       Thread.Sleep(2000);
     }

-    private delegate void logDelegate(string level, string logger, string msg);
+    private delegate void logDelegate(string level, string logger, string msg, string ex);

     public void DoAppend(LoggingEvent loggingEvent)
     {
+      if (loggingEvent.Level < Level.Info) {
+        return;
+      }
       var cls = loggingEvent.LoggerName;
       cls = cls.Substring(cls.LastIndexOf('.') + 1);
-      BeginInvoke(new logDelegate((lvl, lg, msg) =>
+      BeginInvoke(new logDelegate((lvl, lg, msg, ex) =>
       {
         if (logger.Items.Count >= 300) {
           logger.Items.RemoveAt(0);
         }
         logger.EnsureVisible(logger.Items.Add(new ListViewItem(new string[] { lvl, lg, msg })).Index);
+        if (!string.IsNullOrWhiteSpace(ex)) {
+          logger.EnsureVisible(logger.Items.Add(new ListViewItem(new string[] { lvl, lg, ex })).Index);
+        }
         colLogLogger.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
         colLogMessage.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
-      }), loggingEvent.Level.DisplayName, cls, loggingEvent.RenderedMessage);
+      }), loggingEvent.Level.DisplayName, cls, loggingEvent.RenderedMessage, loggingEvent.GetExceptionString());
     }

     private void notifyIcon_DoubleClick(object sender, EventArgs e)


collect some basic stats

collect some basic stats

--- SimpleScene/SSScene.cs
+++ SimpleScene/SSScene.cs
@@ -15,7 +15,14 @@
 		GL_Lines,
 	};

+	public struct SSRenderStats {
+		public int objectsDrawn;
+		public int objectsCulled;
+	}
+
 	public class SSRenderConfig {
+		public SSRenderStats renderStats;
+
 		public bool drawGLSL = true;
 		public bool useVBO = true;

@@ -75,6 +82,9 @@

 		public void Render ()
 		{
+			// reset stats
+			renderConfig.renderStats = new SSRenderStats();
+
 			// load the projection matrix ..
 			GL.MatrixMode(MatrixMode.Projection);
 			GL.LoadMatrix(ref renderConfig.projectionMatrix);
@@ -87,10 +97,12 @@
 				// frustum test... currently still broken
 				if (renderConfig.frustumCulling &&
 					obj.boundingSphere != null && !fc.isSphereInsideFrustum(obj.Pos,obj.boundingSphere.radius)) {
+					renderConfig.renderStats.objectsCulled++;
 					continue; // skip the object
 				}

 				// finally, render object
+				renderConfig.renderStats.objectsDrawn++;
 				obj.Render (ref renderConfig);
 			}
 		}


Added temporary click handler to _addButton on app bar

--- homework_manager/homework_manager/MainPage.xaml.cs
+++ homework_manager/homework_manager/MainPage.xaml.cs
@@ -25,9 +25,17 @@
 			_addButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/add.png", UriKind.Relative));
 			_addButton.Text = "add task";
 			ApplicationBar.Buttons.Add(_addButton);
+			_addButton.Click += _addButton_Click;
 			//ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem("rate & review");
 			//ApplicationBar.MenuItems.Add(appBarMenuItem);

 		}
+
+		int assignmentItemNumberTEMP = 0;
+		void _addButton_Click(object sender, EventArgs e)
+		{
+			(App.Current as App).AssignmentItems.Add(new AssignmentItem("Item " + assignmentItemNumberTEMP));
+			assignmentItemNumberTEMP++;
+		}
 	}
 }


restarting makes unsaved changes false

restarting makes unsaved changes false

--- dotFlip/dotFlip/Flipbook.cs
+++ dotFlip/dotFlip/Flipbook.cs
@@ -218,7 +218,7 @@
         {
             _pages = new List<Page> { new Page(this) };
             CurrentPage = _pages[0];
-            HasUnsavedChanges = true;
+            HasUnsavedChanges = false;
         }

         public void RefreshPage()


updated tests to use license

updated tests to use license

--- Manatee.Trello.IntegrationTests/TestEnvironment.cs
+++ Manatee.Trello.IntegrationTests/TestEnvironment.cs
@@ -31,6 +31,8 @@

 			Current = this;

+			EnsureLicense();
+
 			TrelloAuthorization.Default.AppKey = TrelloIds.AppKey;
 			TrelloAuthorization.Default.UserToken = _GetUserToken();

@@ -50,6 +52,15 @@

 			await Organization.Refresh();
 			await Board.Refresh();
+		}
+
+		private static void EnsureLicense()
+		{
+			var license = Environment.GetEnvironmentVariable("TRELLO_LICENSE");
+
+			if (license == null) return;
+
+			License.RegisterLicense(license);
 		}

 		private static string _GetUserToken()


Clarify code.

Clarify code.

--- src/Features/CSharp/Portable/CodeCleanup/CSharpCodeCleanupService.cs
+++ src/Features/CSharp/Portable/CodeCleanup/CSharpCodeCleanupService.cs
@@ -109,11 +109,11 @@
             progressTracker.AddItems(1);

             // and one for 'remove/sort usings' if we're going to run that.
-            var organizeUsings = false;
-            if (docOptions.GetOption(CodeCleanupOptions.RemoveUnusedImports) ||
-                docOptions.GetOption(CodeCleanupOptions.SortImports))
-            {
-                organizeUsings = true;
+            var organizeUsings = docOptions.GetOption(CodeCleanupOptions.RemoveUnusedImports) ||
+                                 docOptions.GetOption(CodeCleanupOptions.SortImports);
+
+            if (organizeUsings)
+            {
                 progressTracker.AddItems(1);
             }


MockupSetting typo

MockupSetting typo

--- src/ITCO.SboAddon.Framework/Services/Mockups/MockupSettingService.cs
+++ src/ITCO.SboAddon.Framework/Services/Mockups/MockupSettingService.cs
@@ -7,16 +7,16 @@
     public class MockupSettingService : ISettingService
     {
         private readonly IDictionary<string, object> _settingsRepository;
-        private readonly string _currencyUser;
+        private readonly string _currentUser;
         /// <summary>
         /// MockupSettingService
         /// </summary>
         /// <param name="settingsRepository"></param>
-        /// <param name="currencyUser"></param>
-        public MockupSettingService(IDictionary<string, object> settingsRepository, string currencyUser)
+        /// <param name="currentUser"></param>
+        public MockupSettingService(IDictionary<string, object> settingsRepository, string currentUser)
         {
             _settingsRepository = settingsRepository;
-            _currencyUser = currencyUser;
+            _currentUser = currentUser;
         }
         /// <summary>
         /// Initialize Settigns
@@ -40,7 +40,7 @@
         /// <returns></returns>
         public T GetCurrentUserSettingByKey<T>(string key, T defaultValue = default(T), bool askIfNotFound = false)
         {
-            key = $"{key}[{_currencyUser}]";
+            key = $"{key}[{_currentUser}]";

             if (_settingsRepository.ContainsKey(key))
                 return (T) _settingsRepository[key];
@@ -55,7 +55,7 @@
         /// <param name="value"></param>
         public void SaveCurrentUserSetting<T>(string key, T value)
         {
-            SaveSetting($"{key}[{_currencyUser}]", value);
+            SaveSetting($"{key}[{_currentUser}]", value);
         }
         /// <summary>
         /// Get Setting


Lucene.Net.Core.Search.Similarities.LMJelinekMercerSimilarity refactor: renamed fields camelCase

--- src/Lucene.Net.Core/Search/Similarities/LMJelinekMercerSimilarity.cs
+++ src/Lucene.Net.Core/Search/Similarities/LMJelinekMercerSimilarity.cs
@@ -36,26 +36,26 @@
     {
         /// <summary>
         /// The λ parameter. </summary>
-        private readonly float Lambda_Renamed; // LUCENENET TODO: Rename
+        private readonly float lambda;

         /// <summary>
         /// Instantiates with the specified collectionModel and λ parameter. </summary>
         public LMJelinekMercerSimilarity(CollectionModel collectionModel, float lambda)
             : base(collectionModel)
         {
-            this.Lambda_Renamed = lambda;
+            this.lambda = lambda;
         }

         /// <summary>
         /// Instantiates with the specified λ parameter. </summary>
         public LMJelinekMercerSimilarity(float lambda)
         {
-            this.Lambda_Renamed = lambda;
+            this.lambda = lambda;
         }

         public override float Score(BasicStats stats, float freq, float docLen)
         {
-            return stats.TotalBoost * (float)Math.Log(1 + ((1 - Lambda_Renamed) * freq / docLen) / (Lambda_Renamed * ((LMStats)stats).CollectionProbability));
+            return stats.TotalBoost * (float)Math.Log(1 + ((1 - lambda) * freq / docLen) / (lambda * ((LMStats)stats).CollectionProbability));
         }

         protected internal override void Explain(Explanation expl, BasicStats stats, int doc, float freq, float docLen)
@@ -64,7 +64,7 @@
             {
                 expl.AddDetail(new Explanation(stats.TotalBoost, "boost"));
             }
-            expl.AddDetail(new Explanation(Lambda_Renamed, "lambda"));
+            expl.AddDetail(new Explanation(lambda, "lambda"));
             base.Explain(expl, stats, doc, freq, docLen);
         }

@@ -74,7 +74,7 @@
         {
             get
             {
-                return Lambda_Renamed;
+                return lambda;
             }
         }


reset tracking before configure (#2367)

reset tracking before configure (#2367)

--- src/Microsoft.Azure.WebJobs.Host/Hosting/WebJobsBuilderExtensions.cs
+++ src/Microsoft.Azure.WebJobs.Host/Hosting/WebJobsBuilderExtensions.cs
@@ -102,6 +102,7 @@
             {
                 if (tracker != null)
                 {
+                    tracker.ResetTracking();
                     startup.Configure(builder);
                     StringBuilder sb = new StringBuilder("Services registered by external startup type " + startup.GetType().ToString() + ":");

@@ -126,8 +127,6 @@
                         sb.Append($", Lifetime: {service.Lifetime.ToString()}");
                     }
                     logger.LogDebug(new EventId(500, "ExternalStartupServices"), sb.ToString());
-
-                    tracker.ResetTracking();
                 }
             }
         }


NR Do not modify SelectedItems when SelectionMode == None

--- src/NewsReader/NewsReader.Presentation/Controls/SelectionBehavior.cs
+++ src/NewsReader/NewsReader.Presentation/Controls/SelectionBehavior.cs
@@ -9,6 +9,7 @@

 namespace Jbe.NewsReader.Presentation.Controls
 {
+    // TODO: Crash when deleting multiple feeds
     public static class SelectionBehavior
     {
         private static List<Tuple<IMultiSelector, INotifyCollectionChanged>> multiSelectorWithObservableList = new List<Tuple<IMultiSelector, INotifyCollectionChanged>>();
@@ -78,9 +79,11 @@

         private static void ListCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
         {
-            if (syncListsThatAreUpdating.Contains(sender)) { return; }
+            if (syncListsThatAreUpdating.Contains(sender)) return;

             var multiSelector = multiSelectorWithObservableList.First(x => x.Item2 == sender).Item1;
+            if (multiSelector.SelectionMode == ListViewSelectionMode.None) return;
+
             selectorsThatAreUpdating.Add(multiSelector.Selector);
             try
             {
@@ -155,6 +158,8 @@
             Selector Selector { get; }

             IList<object> SelectedItems { get; }
+
+            ListViewSelectionMode SelectionMode { get; }
         }

         private class ListViewAdapter : IMultiSelector
@@ -169,6 +174,8 @@
             public Selector Selector => listView;

             public IList<object> SelectedItems => listView.SelectedItems;
+
+            public ListViewSelectionMode SelectionMode => listView.SelectionMode;
         }

         private class ListBoxAdapter : IMultiSelector
@@ -183,6 +190,8 @@
             public Selector Selector => listBox;

             public IList<object> SelectedItems => listBox.SelectedItems;
+
+            public ListViewSelectionMode SelectionMode => (ListViewSelectionMode)(listBox.SelectionMode + 1);
         }
     }
 }


Change OnImportCompleted to OnImporting

Change OnImportCompleted to OnImporting

--- src/Orchard.Web/Modules/Orchard.Layouts/Drivers/MenuElementDriver.cs
+++ src/Orchard.Web/Modules/Orchard.Layouts/Drivers/MenuElementDriver.cs
@@ -141,7 +141,7 @@
                 context.ExportableData["MenuId"] = menuIdentity;
         }

-        protected override void OnImportCompleted(Menu element, ImportElementContext context) {
+        protected override void OnImporting(Menu element, ImportElementContext context) {
             var menuIdentity = context.ExportableData.Get("MenuId");
             var menu = menuIdentity != null ? context.Session.GetItemFromSession(menuIdentity) : default(ContentManagement.ContentItem);


#17443: Always showing number of available updates.

--HG--
branch : 1.x

--- src/Orchard.Web/Modules/Orchard.Packaging/AdminMenuGalleryUpdates.cs
+++ src/Orchard.Web/Modules/Orchard.Packaging/AdminMenuGalleryUpdates.cs
@@ -23,8 +23,8 @@
         }

         public void GetNavigation(NavigationBuilder builder) {
-            var modulesCaption = T.Plural("Updates", "Updates ({0})", GetUpdateCount(DefaultExtensionTypes.Module));
-            var themesCaption = T.Plural("Updates", "Updates ({0})", GetUpdateCount(DefaultExtensionTypes.Theme));
+            var modulesCaption = T("Updates ({0})", GetUpdateCount(DefaultExtensionTypes.Module));
+            var themesCaption = T("Updates ({0})", GetUpdateCount(DefaultExtensionTypes.Theme));

             builder
                 .Add(T("Modules"), menu => menu


Let tenants action bar sticky while scrolling (#7390)

--- src/OrchardCore.Modules/OrchardCore.Tenants/Views/Admin/Index.cshtml
+++ src/OrchardCore.Modules/OrchardCore.Tenants/Views/Admin/Index.cshtml
@@ -79,25 +79,25 @@
     <input type="submit" name="submit.BulkAction" class="d-none" />
     <input name="BulkAction" type="hidden" />

-

-

-

-

-                    <button class="btn btn-light btn-sm dropdown-toggle" style="border:1px solid lightgrey" type="button" data-toggle="dropdown" id="filter-dropdown" aria-haspopup="true" aria-expanded="false">
-                        @T["Filters"]
-                    </button>
-

-                        @T["Only running tenants"]
-                        @T["Only disabled tenants"]
-                        @T["Only uninitialized tenants"]
-

-

-                <input id="search-box" asp-for="Options.Search" class="form-control" placeholder="@T["Search"]" type="search" autofocus />
-

-

-

-

-                @T["Add Tenant"]
+

+

+

+

+

+                        <button class="btn btn-secondary btn-sm dropdown-toggle" style="border:1px solid lightgrey" type="button" data-toggle="dropdown" id="filter-dropdown" aria-haspopup="true" aria-expanded="false">
+                            @T["Filters"]
+                        </button>
+

+                            @T["Only running tenants"]
+                            @T["Only disabled tenants"]
+                            @T["Only uninitialized tenants"]
+

+

+                    <input id="search-box" asp-for="Options.Search" class="form-control" placeholder="@T["Search"]" type="search" autofocus />
+

+

+                    @T["Add Tenant"]
+


Quarantine BlazorWasmHostedTemplate_IndividualAuth_Works_WithOutLocalDB (#30821)

--- src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs
+++ src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs
@@ -288,6 +288,7 @@

         [Theory]
         [InlineData(BrowserKind.Chromium)]
+        [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/30820")]
         public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithOutLocalDB(BrowserKind browserKind)
         {
             return BlazorWasmHostedTemplate_IndividualAuth_Works(browserKind, false);


Loading textures without GLUtils to avoid premultiplied alphas

--- Mapsui.Rendering.OpenTK-A/PlatformTextureLoader.cs
+++ Mapsui.Rendering.OpenTK-A/PlatformTextureLoader.cs
@@ -1,6 +1,7 @@
+using System.IO;
 using Android.Graphics;
-using OpenTK.Graphics.ES11;
-using System.IO;
+using OpenTK.Graphics.ES20;
+using PixelFormat = OpenTK.Graphics.ES20.PixelFormat;

 namespace Mapsui.Rendering.OpenTK
 {
@@ -12,11 +13,42 @@
         public static void TexImage2D(Stream data, out int width, out int height)
         {
             data.Position = 0;
+
             var bitmap = BitmapFactory.DecodeStream(data);
             // The texture that is loaded below is attached to the TextureID that was bound in an earlier call with 'GL.BindTexture'
-            Android.Opengl.GLUtils.TexImage2D((int)All.Texture2D, 0, bitmap, 0);
+            bitmap.LockPixels();
+
+            var pixels = new int[bitmap.Width * bitmap.Height];
+            bitmap.GetPixels(pixels, 0, bitmap.Width, 0, 0, bitmap.Width, bitmap.Height);
+
+            // What I would like to do is to pass PixelFormat.Bgra to GL.TexImage2D but this is not available in ES20.
+            // What I do below is convert the bits myself. There must be a really easy way to do this. And probably a
+            // more performing way.
+            FromBgraToRgba(pixels);
+
+            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, bitmap.Width, bitmap.Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, pixels);
+            bitmap.UnlockPixels();
             width = bitmap.Width;
             height = bitmap.Height;
+            bitmap.Dispose();
         }
+
+        private static void FromBgraToRgba(int[] pixels)
+        {
+            for (int i = 0; i < pixels.Length; i++)
+            {
+                pixels[i] = FromBgraToRgba(pixels[i]);
+            }
+        }
+
+        public static int FromBgraToRgba(int pixel)
+        {
+            var b1 = (pixel >> 0) & 0xff;
+            var b2 = (pixel >> 8) & 0xff;
+            var b3 = (pixel >> 16) & 0xff;
+            var b4 = (pixel >> 24) & 0xff;
+
+            return b1 << 16 | b2 << 8 | b3 << 0 | b4 << 24;
+        }
     }
 }


[Debugger] Make catchpoint properties settable

To allow editing of catchpoints after they have been created they need to be
settable

--- Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs
+++ Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs
@@ -68,10 +68,12 @@

 		public string ExceptionName {
 			get { return exceptionName; }
+			set { exceptionName = value; }
 		}

 		public bool IncludeSubclasses {
 			get { return includeSubclasses; }
+			set { includeSubclasses = value; }
 		}

 		public override void CopyFrom (BreakEvent ev)


And more feedback

And more feedback

--- Nodejs/Product/Nodejs/SharedProject/ProjectNode.cs
+++ Nodejs/Product/Nodejs/SharedProject/ProjectNode.cs
@@ -2617,7 +2617,6 @@
             var result = MSBuildResult.Failed;
             const bool designTime = true;

-            var accessor = this.Site.GetService(typeof(SVsBuildManagerAccessor)) as IVsBuildManagerAccessor;
             BuildSubmission submission = null;

             try
@@ -2640,9 +2639,9 @@

                     var requestData = new BuildRequestData(this.currentConfig, targetsToBuild, this.BuildProject.ProjectCollection.HostServices, BuildRequestDataFlags.ReplaceExistingProjectInstance);
                     submission = BuildManager.DefaultBuildManager.PendBuildRequest(requestData);
-                    if (accessor != null)
+                    if (this.buildManagerAccessor != null)
                     {
-                        ErrorHandler.ThrowOnFailure(accessor.RegisterLogger(submission.SubmissionId, this.BuildLogger));
+                        ErrorHandler.ThrowOnFailure(buildManagerAccessor.RegisterLogger(submission.SubmissionId, this.BuildLogger));
                     }

                     var buildResult = submission.Execute();


but buoyancy was missing

but buoyancy was missing

--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4883,6 +4883,7 @@
                 pa.GravModifier = GravityModifier;
                 pa.Friction = Friction;
                 pa.Restitution = Restitution;
+                pa.Buoyancy = Buoyancy;

                 if(LocalId == ParentGroup.RootPart.LocalId)
                 {
@@ -4927,7 +4928,6 @@
                 {
                     Velocity = velocity;
                     AngularVelocity = rotationalVelocity;
-                    pa.RotationalVelocity = rotationalVelocity;

                     // if not vehicle and root part apply force and torque
                     if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE))


BulletSim: many changes to tune vehicles for BulletSim. The problem left is that the vehicle sitting on something needs to press down for gravity and what its sitting on pushes up so the vehicle does not penetrate. The effect is Bullet calculates a lot of random angular motion for the vehicle. Various schemes of damping and zeroing has not resolved the problem.

--- OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -54,9 +54,14 @@
 {
     public sealed class BSDynamics
     {
+        private static string LogHeader = "[BULLETSIM VEHICLE]";
+
         private BSScene PhysicsScene { get; set; }
         // the prim this dynamic controller belongs to
         private BSPrim Prim { get; set; }
+
+        // mass of the vehicle fetched each time we're calles
+        private float m_vehicleMass;

         // Vehicle properties
         public Vehicle Type { get; set; }
@@ -516,7 +521,29 @@
                 // Friction effects are handled by this vehicle code
                 BulletSimAPI.SetFriction2(Prim.PhysBody.ptr, 0f);
                 BulletSimAPI.SetHitFraction2(Prim.PhysBody.ptr, 0f);
-            }
+
+                // BulletSimAPI.SetAngularDamping2(Prim.PhysBody.ptr, 0.8f);
+
+                VDetailLog("{0},BSDynamics.Refresh,zeroingFriction and adding damping", Prim.LocalID);
+            }
+        }
+
+        public bool RemoveBodyDependencies(BSPhysObject prim)
+        {
+            // If active, we need to add our properties back when the body is rebuilt.
+            return IsActive;
+        }
+
+        public void RestoreBodyDependencies(BSPhysObject prim)
+        {
+            if (Prim.LocalID != prim.LocalID)
+            {
+                // The call should be on us by our prim. Error if not.
+                PhysicsScene.Logger.ErrorFormat("{0} RestoreBodyDependencies: called by not my prim. passedLocalID={1}, vehiclePrimLocalID={2}",
+                                LogHeader, prim.LocalID, Prim.LocalID);
+                return;
+            }
+            Refresh();
         }

         // One step of the vehicle properties for the next 'pTimestep' seconds.
@@ -533,16 +560,26 @@
             // m_lastLinearVelocityVector = Prim.ForceVelocity * Quaternion.Inverse(Prim.ForceOrientation);        // DEBUG:
             // END DEBUG

+            m_vehicleMass = Prim.Linkset.LinksetMass;
+
             MoveLinear(pTimestep);
+            // Commented out for debug
             MoveAngular(pTimestep);
+            // Prim.ApplyTorqueImpulse(-Prim.RotationalVelocity * m_vehicleMass, false);    // DEBUG DEBUG
+            // Prim.ForceRotationalVelocity = -Prim.RotationalVelocity;    // DEBUG DEBUG
+
             LimitRotation(pTimestep);
-
-            // DEBUG: Trying to figure out why Bullet goes crazy when the root prim is moved.
-            // BulletSimAPI.SetInterpolationVelocity2(Prim.BSBody.ptr, m_newVelocity, m_lastAngularVelocity); // DEBUG DEBUG DEBUG

             // remember the position so next step we can limit absolute movement effects
             m_lastPositionVector = Prim.ForcePosition;

+            VDetailLog("{0},BSDynamics.Step,frict={1},grav={2},inertia={3},mass={4}",        // DEBUG DEBUG
+                                    Prim.LocalID,
+                                    BulletSimAPI.GetFriction2(Prim.PhysBody.ptr),
+                                    BulletSimAPI.GetGravity2(Prim.PhysBody.ptr),
+                                    Prim.Inertia,
+                                    m_vehicleMass
+                                    );
             VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}",
                     Prim.LocalID, Prim.ForcePosition, Prim.Force, Prim.ForceVelocity, Prim.RotationalVelocity);
         }// end Step
@@ -555,25 +592,26 @@
             // m_lastLinearVelocityVector is the current speed we are moving in that direction
             if (m_linearMotorDirection.LengthSquared() > 0.001f)
             {
-                Vector3 origDir = m_linearMotorDirection;
-                Vector3 origVel = m_lastLinearVelocityVector;
+                Vector3 origDir = m_linearMotorDirection;       // DEBUG
+                Vector3 origVel = m_lastLinearVelocityVector;   // DEBUG
+                // DEBUG: the vehicle velocity rotated to be relative to vehicle coordinates for comparison
                 Vector3 vehicleVelocity = Prim.ForceVelocity * Quaternion.Inverse(Prim.ForceOrientation);   // DEBUG

-                // add drive to body
+                // Add (desiredVelocity - lastAppliedVelocity) / howLongItShouldTakeToComplete
                 Vector3 addAmount = (m_linearMotorDirection - m_lastLinearVelocityVector)/(m_linearMotorTimescale) * pTimestep;
-                // lastLinearVelocityVector is the current body velocity vector
                 m_lastLinearVelocityVector += addAmount;

                 float decayFactor = (1.0f / m_linearMotorDecayTimescale) * pTimestep;
                 m_linearMotorDirection *= (1f - decayFactor);

+                // Rotate new object velocity from vehicle relative to world coordinates
+                m_newVelocity = m_lastLinearVelocityVector * Prim.ForceOrientation;
+
+                // Apply friction for next time
                 Vector3 frictionFactor = (Vector3.One / m_linearFrictionTimescale) * pTimestep;
                 m_lastLinearVelocityVector *= (Vector3.One - frictionFactor);

-                // Rotate new object velocity from vehicle relative to world coordinates
-                m_newVelocity = m_lastLinearVelocityVector * Prim.ForceOrientation;
-
-                VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},vehVel={3},add={4},decay={5},frict={6},lmDir={7},lmVel={8},newVel={9}",
+                VDetailLog("{0},MoveLinear,nonZero,origlmDir={1},origlvVel={2},vehVel={3},add={4},decay={5},frict={6},lmDir={7},lvVec={8},newVel={9}",
                                 Prim.LocalID, origDir, origVel, vehicleVelocity, addAmount, decayFactor, frictionFactor,
                                 m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity);
             }
@@ -607,7 +645,7 @@
             // If below the terrain, move us above the ground a little.
             float terrainHeight = Prim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos);
             // Taking the rotated size doesn't work here because m_prim.Size is the size of the root prim and not the linkset.
-            //     Need to add a m_prim.LinkSet.Size similar to m_prim.LinkSet.Mass.
+            //     TODO: Add a m_prim.LinkSet.Size similar to m_prim.LinkSet.Mass.
             // Vector3 rotatedSize = m_prim.Size * m_prim.ForceOrientation;
             // if (rotatedSize.Z < terrainHeight)
             if (pos.Z < terrainHeight)
@@ -638,13 +676,15 @@

                 if ((m_flags & VehicleFlag.HOVER_UP_ONLY) != 0)
                 {
-                    // If body is aready heigher, use its height as target height
-                    if (pos.Z > m_VhoverTargetHeight) m_VhoverTargetHeight = pos.Z;
+                    // If body is already heigher, use its height as target height
+                    if (pos.Z > m_VhoverTargetHeight)
+                        m_VhoverTargetHeight = pos.Z;
                 }
                 if ((m_flags & VehicleFlag.LOCK_HOVER_HEIGHT) != 0)
                 {
-                    if ((pos.Z - m_VhoverTargetHeight) > .2 || (pos.Z - m_VhoverTargetHeight) < -.2)
+                    if (Math.Abs(pos.Z - m_VhoverTargetHeight) > 0.2f)
                     {
+                        pos.Z = m_VhoverTargetHeight;
                         Prim.ForcePosition = pos;
                     }
                 }
@@ -709,25 +749,28 @@
                 }
             }

-            // Limit absolute vertical change
-            float Zchange = Math.Abs(posChange.Z);
+            #region downForce
+            Vector3 downForce = Vector3.Zero;
+
             if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
             {
-                if (Zchange > .3)
-                    grav.Z = (float)(grav.Z * 3);
-                if (Zchange > .15)
-                    grav.Z = (float)(grav.Z * 2);
-                if (Zchange > .75)
-                    grav.Z = (float)(grav.Z * 1.5);
-                if (Zchange > .05)
-                    grav.Z = (float)(grav.Z * 1.25);
-                if (Zchange > .025)
-                    grav.Z = (float)(grav.Z * 1.125);
-                float postemp = (pos.Z - terrainHeight);
-                if (postemp > 2.5f)
-                    grav.Z = (float)(grav.Z * 1.037125);
-                VDetailLog("{0},MoveLinear,limitMotorUp,grav={1}", Prim.LocalID, grav);
-            }
+                // If the vehicle is motoring into the sky, get it going back down.
+                // Is this an angular force or both linear and angular??
+                float distanceAboveGround = pos.Z - terrainHeight;
+                if (distanceAboveGround > 2f)
+                {
+                    // downForce = new Vector3(0, 0, (-distanceAboveGround / m_bankingTimescale) * pTimestep);
+                    // downForce = new Vector3(0, 0, -distanceAboveGround / m_bankingTimescale);
+                    downForce = new Vector3(0, 0, -distanceAboveGround);
+                }
+                // TODO: this calculation is all wrong. From the description at
+                //     (http://wiki.secondlife.com/wiki/Category:LSL_Vehicle), the downForce
+                //     has a decay factor. This says this force should
+                //     be computed with a motor.
+                VDetailLog("{0},MoveLinear,limitMotorUp,distAbove={1},downForce={2}",
+                                    Prim.LocalID, distanceAboveGround, downForce);
+            }
+            #endregion // downForce

             // If not changing some axis, reduce out velocity
             if ((m_flags & (VehicleFlag.NO_X)) != 0)
@@ -737,13 +780,28 @@
             if ((m_flags & (VehicleFlag.NO_Z)) != 0)
                 m_newVelocity.Z = 0;

-            // Apply velocity
+            // Clamp REALLY high or low velocities
+            if (m_newVelocity.LengthSquared() > 1e6f)
+            {
+                m_newVelocity /= m_newVelocity.Length();
+                m_newVelocity *= 1000f;
+            }
+            else if (m_newVelocity.LengthSquared() < 1e-6f)
+                m_newVelocity = Vector3.Zero;
+
+            // Stuff new linear velocity into the vehicle
             Prim.ForceVelocity = m_newVelocity;
-            // Prim.AddForce(m_newVelocity * Prim.Linkset.LinksetMass, false);
-            Prim.AddForce(grav * Prim.Linkset.LinksetMass, false);
-
-            VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4}",
-                    Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav);
+            // Prim.ApplyForceImpulse((m_newVelocity - Prim.Velocity) * m_vehicleMass, false);    // DEBUG DEBUG
+
+            Vector3 totalDownForce = downForce + grav;
+            if (totalDownForce != Vector3.Zero)
+            {
+                Prim.AddForce(totalDownForce * m_vehicleMass, false);
+                // Prim.ApplyForceImpulse(totalDownForce * m_vehicleMass, false);
+            }
+
+            VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},primVel={4},totalDown={5}",
+                    Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, Prim.Velocity, totalDownForce);

         } // end MoveLinear()

@@ -765,7 +823,7 @@
                 Vector3 origDir = m_angularMotorDirection;

                 //       new velocity    +=                      error                       /  (  time to get there   / step interval)
-                //                             requested speed     -    last motor speed
+                //                           requested direction   - current vehicle direction
                 m_angularMotorVelocity += (m_angularMotorDirection - m_angularMotorVelocity) /  (m_angularMotorTimescale / pTimestep);
                 // decay requested direction
                 m_angularMotorDirection *= (1.0f - (pTimestep * 1.0f/m_angularMotorDecayTimescale));
@@ -784,10 +842,11 @@
             Vector3 deflection = Vector3.Zero;
             Vector3 banking = Vector3.Zero;

+            // If vertical attaction timescale is reasonable and we applied an angular force last time...
             if (m_verticalAttractionTimescale < 300 && m_lastAngularVelocity != Vector3.Zero)
             {
                 float VAservo = pTimestep * 0.2f / m_verticalAttractionTimescale;
-                if (Prim.Linkset.LinksetIsColliding)
+                if (Prim.IsColliding)
                     VAservo = pTimestep * 0.05f / (m_verticalAttractionTimescale);

                 VAservo *= (m_verticalAttractionEfficiency * m_verticalAttractionEfficiency);
@@ -806,7 +865,7 @@
                     verticalError.X = 2.0f - verticalError.X;
                     verticalError.Y = 2.0f - verticalError.Y;
                 }
-                // scale it by VAservo
+                // scale it by VAservo (timestep and timescale)
                 verticalError = verticalError * VAservo;

                 // As the body rotates around the X axis, then verticalError.Y increases; Rotated around Y
@@ -822,25 +881,30 @@
                 vertattr.X += bounce * angularVelocity.X;
                 vertattr.Y += bounce * angularVelocity.Y;

-                VDetailLog("{0},MoveAngular,verticalAttraction,verticalError={1},bounce={2},vertattr={3}",
-                            Prim.LocalID, verticalError, bounce, vertattr);
+                VDetailLog("{0},MoveAngular,verticalAttraction,VAservo={1},effic={2},verticalError={3},bounce={4},vertattr={5}",
+                            Prim.LocalID, VAservo, m_verticalAttractionEfficiency, verticalError, bounce, vertattr);

             }
             #endregion // Vertical attactor

             #region Deflection

-            //Forward is the prefered direction, but if the reference frame has changed, we need to take this into account as well
             if (m_angularDeflectionEfficiency != 0)
             {
-                Vector3 preferredAxisOfMotion =
+                // Compute a scaled vector that points in the preferred axis (X direction)
+                Vector3 scaledDefaultDirection =
                     new Vector3((pTimestep * 10 * (m_angularDeflectionEfficiency / m_angularDeflectionTimescale)), 0, 0);
-                preferredAxisOfMotion *= Quaternion.Add(Prim.ForceOrientation, m_referenceFrame);
-
+                // Adding the current vehicle orientation and reference frame displaces the orientation to the frame.
+                // Rotate the scaled default axix relative to the actual vehicle direction giving where it should point.
+                Vector3 preferredAxisOfMotion = scaledDefaultDirection * Quaternion.Add(Prim.ForceOrientation, m_referenceFrame);
+
+                // Scale by efficiency and timescale
                 deflection = (preferredAxisOfMotion * (m_angularDeflectionEfficiency) / m_angularDeflectionTimescale) * pTimestep;

                 VDetailLog("{0},MoveAngular,Deflection,perfAxis={1},deflection={2}",
                                         Prim.LocalID, preferredAxisOfMotion, deflection);
+                // This deflection computation is not correct.
+                deflection = Vector3.Zero;
             }

             #endregion
@@ -875,7 +939,7 @@
                 }
                 else
                     banking.Z += (effSquared*(mult*mix))*(m_angularMotorVelocity.X) * 4;
-                if (!Prim.Linkset.LinksetIsColliding && Math.Abs(m_angularMotorVelocity.X) > mix)
+                if (!Prim.IsColliding && Math.Abs(m_angularMotorVelocity.X) > mix)
                     //If they are colliding, we probably shouldn't shove the prim around... probably
                 {
                     float angVelZ = m_angularMotorVelocity.X*-1;
@@ -904,6 +968,40 @@
             // Sum velocities
             m_lastAngularVelocity = m_angularMotorVelocity + vertattr + banking + deflection;

+            #region Linear Motor Offset
+
+            //Offset section
+            if (m_linearMotorOffset != Vector3.Zero)
+            {
+                //Offset of linear velocity doesn't change the linear velocity,
+                //   but causes a torque to be applied, for example...
+                //
+                //      IIIII     >>>   IIIII
+                //      IIIII     >>>    IIIII
+                //      IIIII     >>>     IIIII
+                //          ^
+                //          |  Applying a force at the arrow will cause the object to move forward, but also rotate
+                //
+                //
+                // The torque created is the linear velocity crossed with the offset
+
+                // NOTE: this computation does should be in the linear section
+                //    because there we know the impulse being applied.
+                Vector3 torqueFromOffset = Vector3.Zero;
+                // torqueFromOffset = Vector3.Cross(m_linearMotorOffset, appliedImpulse);
+                if (float.IsNaN(torqueFromOffset.X))
+                    torqueFromOffset.X = 0;
+                if (float.IsNaN(torqueFromOffset.Y))
+                    torqueFromOffset.Y = 0;
+                if (float.IsNaN(torqueFromOffset.Z))
+                    torqueFromOffset.Z = 0;
+                torqueFromOffset *= m_vehicleMass;
+                Prim.ApplyTorqueImpulse(torqueFromOffset, true);
+                VDetailLog("{0},BSDynamic.MoveAngular,motorOffset,applyTorqueImpulse={1}", Prim.LocalID, torqueFromOffset);
+            }
+
+            #endregion
+
             if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0)
             {
                 m_lastAngularVelocity.X = 0;
@@ -914,25 +1012,25 @@
             if (m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
             {
                 m_lastAngularVelocity = Vector3.Zero; // Reduce small value to zero.
-                VDetailLog("{0},MoveAngular,zeroSmallValues,lastAngular={1}", Prim.LocalID, m_lastAngularVelocity);
-            }
-
-            // Apply to the body
-            // The above calculates the absolute angular velocity needed
-            // Prim.ForceRotationalVelocity = m_lastAngularVelocity;
-
-            // Apply a force to overcome current angular velocity
-            Vector3 applyAngularForce = (m_lastAngularVelocity - Prim.ForceRotationalVelocity) * Prim.Linkset.LinksetMass;
-            // Vector3 applyAngularForce = (m_lastAngularVelocity - Prim.ForceRotationalVelocity);
-            // Prim.AddAngularForce(applyAngularForce, false);
-            Prim.ApplyTorqueImpulse(applyAngularForce, false);
-
-             // Apply friction for next time
-            Vector3 decayamount = (Vector3.One / m_angularFrictionTimescale) * pTimestep;
-            m_lastAngularVelocity *= Vector3.One - decayamount;
-
-            VDetailLog("{0},MoveAngular,done,applyAForce={1},decay={2},lastAngular={3}",
-                                Prim.LocalID, applyAngularForce, decayamount, m_lastAngularVelocity);
+                Prim.ZeroAngularMotion(true);
+                VDetailLog("{0},MoveAngular,zeroAngularMotion,lastAngular={1}", Prim.LocalID, m_lastAngularVelocity);
+            }
+            else
+            {
+                // Apply to the body.
+                // The above calculates the absolute angular velocity needed. Angular velocity is massless.
+                // Since we are stuffing the angular velocity directly into the object, the computed
+                //     velocity needs to be scaled by the timestep.
+                Vector3 applyAngularForce = ((m_lastAngularVelocity * pTimestep) - Prim.ForceRotationalVelocity);
+                Prim.ForceRotationalVelocity = applyAngularForce;
+
+                // Decay the angular movement for next time
+                Vector3 decayamount = (Vector3.One / m_angularFrictionTimescale) * pTimestep;
+                m_lastAngularVelocity *= Vector3.One - decayamount;
+
+                VDetailLog("{0},MoveAngular,done,newRotVel={1},decay={2},lastAngular={3}",
+                                    Prim.LocalID, applyAngularForce, decayamount, m_lastAngularVelocity);
+            }
         } //end MoveAngular

         internal void LimitRotation(float timestep)


Added number formatting to views

Added number formatting to views

--- PersonalWebsite/Views/Blog/PopularPostsList.cshtml
+++ PersonalWebsite/Views/Blog/PopularPostsList.cshtml
@@ -26,7 +26,7 @@
                 }
                 else
                 {
-
Viewed @post.Views times.

+
Viewed @string.Format("{0:n0}", post.Views) times.

                 }

         }


Refactoring: cleaning up registration method

--- PhoneBook.Domain/Infrastructure/MainUserManager.cs
+++ PhoneBook.Domain/Infrastructure/MainUserManager.cs
@@ -19,7 +19,6 @@

         public async Task<IdentityResult> CreateAsync(string email, string password, bool isConfirmed = false)
         {
-            var r = new Random();
             var u = new User
             {
                 Email = email,
@@ -27,12 +26,7 @@
                 Id = $"{email} {DateTime.Now}".GetHashCode().ToString(),
                 HolidayTime = DateTime.Now,
                 BusinessTrip = false,
-                EmailConfirmed = true,
-                PhoneNumberConfirmed = true,
-                TwoFactorEnabled = true,
-                LockoutEndDateUtc = DateTime.Now,
-                LockoutEnabled = false,
-                AccessFailedCount = 1,
+                EmailConfirmed = isConfirmed,
                 UserName = email
             };
             return await _applicationUserManager.CreateAsync(u, password);


Return mock from setup all properties itself.

--- Source/Mock.Generic.cs
+++ Source/Mock.Generic.cs
@@ -214,9 +214,10 @@

 #if !SILVERLIGHT
 		/// <include file='Mock.Generic.xdoc' path='docs/doc[@for="Mock{T}.SetupAllProperties"]/*'/>
-		public void SetupAllProperties()
+		public Mock<T> SetupAllProperties()
 		{
 			SetupAllProperties(this);
+			return this;
 		}
 #endif


refactor: docs: exception messages and document comments

--- PrivateObjectExtensions/PrivateObjectExtensions.cs
+++ PrivateObjectExtensions/PrivateObjectExtensions.cs
@@ -23,10 +23,10 @@
         /// <summary>
         /// Get from private (and any other) field/property.
         /// If the real type of specified object doesn't contain the specified field/property,
-        /// it will be automatically search from base type.
-        /// </summary>
-        /// <param name="obj">The object to get</param>
-        /// <param name="name">The name of the field/property to get</param>
+        /// base types are searched automatically.
+        /// </summary>
+        /// <param name="obj">The object to get from</param>
+        /// <param name="name">The name of the field/property</param>
         /// <returns>The object got from the field/property</returns>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
@@ -40,11 +40,11 @@
         /// <summary>
         /// Get from private (and any other) field/property.
         /// If the real type of specified object doesn't contain the specified field/property,
-        /// it will be automatically search from base type.
-        /// </summary>
-        /// <typeparam name="T">The type of the field/property to get</typeparam>
-        /// <param name="obj">The object to get</param>
-        /// <param name="name">The name of the field/property to get</param>
+        /// base types are searched automatically.
+        /// </summary>
+        /// <typeparam name="T">The type of the field/property</typeparam>
+        /// <param name="obj">The object to get from</param>
+        /// <param name="name">The name of the field/property</param>
         /// <returns>The object got from the field/property</returns>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
@@ -58,14 +58,14 @@
         /// <summary>
         /// Get from private (and any other) field/property with assuming the specified object as specified type.
         /// If the specified type doesn't contain the specified field/property,
-        /// it will be automatically search from base type.
-        /// </summary>
-        /// <param name="obj">The object to get</param>
-        /// <param name="name">The name of the field/property to get</param>
+        /// base types are searched automatically.
+        /// </summary>
+        /// <param name="obj">The object to get from</param>
+        /// <param name="name">The name of the field/property</param>
         /// <param name="objType">The type of 'obj' for seaching member starting from. Real type of 'obj' is ignored.</param>
         /// <returns>The object got from the field/property</returns>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
-        /// <exception cref="ArgumentException">The type of'obj' is not derived from 'objType'.</exception>
+        /// <exception cref="ArgumentException">'objType' is not assignable from 'obj'.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
         public static object GetPrivate(this object obj, string name, Type objType)
         {
@@ -75,15 +75,15 @@
         /// <summary>
         /// Get from private (and any other) field/property with assuming the specified object as specified type.
         /// If the specified type doesn't contain the specified field/property,
-        /// it will be automatically search from base type.
-        /// </summary>
-        /// <typeparam name="T">The type of the field/property to get</typeparam>
-        /// <param name="obj">The object to get</param>
-        /// <param name="name">The name of the field/property to get</param>
+        /// base types are searched automatically.
+        /// </summary>
+        /// <typeparam name="T">The type of the field/property</typeparam>
+        /// <param name="obj">The object to get from</param>
+        /// <param name="name">The name of the field/property</param>
         /// <param name="objType">The type of 'obj' for seaching member starting from. Real type of 'obj' is ignored.</param>
         /// <returns>The object got from the field/property</returns>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
-        /// <exception cref="ArgumentException">The type of'obj' is not derived from 'objType'.</exception>
+        /// <exception cref="ArgumentException">'objType' is not assignable from 'obj'.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
         public static T GetPrivate<T>(this object obj, string name, Type objType)
         {
@@ -94,9 +94,9 @@
         {
             if (obj == null) { throw new ArgumentNullException("obj"); }
             if (name == null) { throw new ArgumentNullException("name"); }
-            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name has to be not null or white space.", "name"); }
+            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name is empty or white-space.", "name"); }
             if (objType == null) { throw new ArgumentNullException("objType"); }
-            if (!objType.IsAssignableFrom(obj.GetType())) { throw new ArgumentException(objType + " is invalid type for this object", "objType"); }
+            if (!objType.IsAssignableFrom(obj.GetType())) { throw new ArgumentException($"{objType} is not assignable from {obj.GetType()}.", "objType"); }

             bool memberTypeMatching(Type actualType) => actualType == memberType;

@@ -109,14 +109,14 @@
                 return new PrivateType(ownerType).GetStaticFieldOrProperty(name);
             }

-            throw new ArgumentException(((memberType != null) ? memberType + " " : "") + name + " is not found");
+            throw new ArgumentException(((memberType != null) ? memberType + " " : "") + name + " is not found.");
         }

         /// <summary>
         /// Get from private (and any other) static field/property.
         /// </summary>
-        /// <param name="type">The type to get</param>
-        /// <param name="name">The name of the static field/property to get</param>
+        /// <param name="type">The type to get from</param>
+        /// <param name="name">The name of the static field/property</param>
         /// <returns>The object got from the static field/property</returns>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
@@ -128,9 +128,9 @@
         /// <summary>
         /// Get from private (and any other) static field/property.
         /// </summary>
-        /// <typeparam name="T">The type of the field/property to get</typeparam>
-        /// <param name="type">The type to get</param>
-        /// <param name="name">The name of the static field/property to get</param>
+        /// <typeparam name="T">The type of the field/property</typeparam>
+        /// <param name="type">The type to get from</param>
+        /// <param name="name">The name of the static field/property</param>
         /// <returns>The object got from the static field/property</returns>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
@@ -143,7 +143,7 @@
         {
             if (type == null) { throw new ArgumentNullException("type"); }
             if (name == null) { throw new ArgumentNullException("name"); }
-            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name has to be not null or white space.", "name"); }
+            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name is empty or white-space.", "name"); }

             bool memberTypeMatching(Type actualType) => actualType == memberType;

@@ -152,16 +152,16 @@
                 return new PrivateType(type).GetStaticFieldOrProperty(name);
             }

-            throw new ArgumentException(((memberType != null) ? memberType + " " : "") + name + " is not found");
+            throw new ArgumentException(((memberType != null) ? memberType + " " : "") + name + " is not found.");
         }

         /// <summary>
         /// Set to private (and any other) field/property.
         /// If the real type of specified object doesn't contain the specified field/property,
-        /// it will be automatically search from base type.
-        /// </summary>
-        /// <param name="obj">The object to set</param>
-        /// <param name="name">The name of the field/property to set</param>
+        /// base types are searched automatically.
+        /// </summary>
+        /// <param name="obj">The object to set to</param>
+        /// <param name="name">The name of the field/property</param>
         /// <param name="value">The value to set for 'name'</param>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
@@ -175,30 +175,30 @@
         /// <summary>
         /// Set to private (and any other) field/property with assuming the specified object as specified type.
         /// If the specified type doesn't contain the specified field/property,
-        /// it will be automatically search from base type.
-        /// </summary>
-        /// <param name="obj">The object to set</param>
-        /// <param name="name">The name of the field/property to set</param>
+        /// base types are searched automatically.
+        /// </summary>
+        /// <param name="obj">The object to set to</param>
+        /// <param name="name">The name of the field/property</param>
         /// <param name="value">The value to set for 'name'</param>
         /// <param name="objType">The type of 'obj' for seaching member starting from. Real type of 'obj' is ignored.</param>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
-        /// <exception cref="ArgumentException">The type of'obj' is not derived from 'objType'.</exception>
+        /// <exception cref="ArgumentException">'objType' is not assignable from 'obj'.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
         public static void SetPrivate<T>(this object obj, string name, T value, Type objType)
         {
             if (obj == null) { throw new ArgumentNullException("obj"); }
             if (name == null) { throw new ArgumentNullException("name"); }
-            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name has to be not null or white space.", "name"); }
+            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name is empty or white-space.", "name"); }
             if (value == null) { throw new ArgumentNullException("value"); }
             if (objType == null) { throw new ArgumentNullException("objType"); }
-            if (!objType.IsAssignableFrom(obj.GetType())) { throw new ArgumentException(objType + " is invalid type for this object", "objType"); }
+            if (!objType.IsAssignableFrom(obj.GetType())) { throw new ArgumentException($"{objType} is not assignable from {obj.GetType()}.", "objType"); }

             if (TrySetPrivate(obj, name, value, objType)) { return; }

             // retry for the case of getter only property
             if (TrySetPrivate(obj, GetBackingFieldName(name), value, objType)) { return; }

-            throw new ArgumentException(typeof(T) + " " + name + " is not found");
+            throw new ArgumentException($"{typeof(T)} {name} is not found.");
         }

         private static bool TrySetPrivate<T>(object obj, string name, T value, Type objType)
@@ -231,8 +231,8 @@
         /// <summary>
         /// Set to private (and any other) static field/property.
         /// </summary>
-        /// <param name="type">The type to set</param>
-        /// <param name="name">The name of the field/property to set</param>
+        /// <param name="type">The type to set to</param>
+        /// <param name="name">The name of the field/property</param>
         /// <param name="value">The value to set for 'name'</param>
         /// <exception cref="ArgumentException">'name' is not found.</exception>
         /// <exception cref="ArgumentNullException">Arguments contain null.</exception>
@@ -240,14 +240,14 @@
         {
             if (type == null) { throw new ArgumentNullException("type"); }
             if (name == null) { throw new ArgumentNullException("name"); }
-            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name has to be not null or white space.", "name"); }
+            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("name is empty or white-space.", "name"); }

             if (TrySetPrivate(type, name, value)) { return; }

             // retry for the case of getter only property
             if (TrySetPrivate(type, GetBackingFieldName(name), value)) { return; }

-            throw new ArgumentException(typeof(T) + " " + name + " is not found");
+            throw new ArgumentException($"{typeof(T)} {name} is not found.");
         }

         private static bool TrySetPrivate<T>(this Type type, string name, T value)


Fixed small layout bug in DisplayName where label was not at center. Experimenting with adding lines or cross hairs in addition to the rectangle.

--- ProCamCalibration/ProjectorServer/ProjectorForm.cs
+++ ProCamCalibration/ProjectorServer/ProjectorForm.cs
@@ -99,13 +99,38 @@
         public void DisplayName(string name)
         {
             var brush = new SolidColorBrush(renderTarget, Color4.White);
-            var layoutRect = new SharpDX.RectangleF(0, (float) bounds.Height / 2f, bounds.Width, 100f);
-
+            var layoutRect = new SharpDX.RectangleF(0, 0, bounds.Width, bounds.Height);
+
             renderTarget.BeginDraw();
             renderTarget.Clear(Color4.Black);
             renderTarget.DrawRectangle(new SharpDX.RectangleF(0, 0, bounds.Width, bounds.Height), brush, 10f);
+            renderTarget.DrawText(name, textFormat, layoutRect, solidColorBrush);

-            renderTarget.DrawText(name, textFormat, layoutRect, solidColorBrush);
+            //int nx = 4;
+            //int ny = 4;
+            //for (int i = 0; i < nx - 1; i++)
+            //    for (int j = 0; j < ny - 1; j++)
+            //    {
+            //        float x = (float)bounds.Width / (float)nx * (i + 1);
+            //        float y = (float)bounds.Height / (float)ny * (j + 1);
+
+            //        const int w = 10;
+            //        renderTarget.DrawLine(new Vector2(x - w, y), new Vector2(x + w, y), brush, 1);
+            //        renderTarget.DrawLine(new Vector2(x, y - w), new Vector2(x, y + w), brush, 1);
+            //    }
+
+            int nx = 4;
+            int ny = 4;
+            for (int i = 0; i < nx - 1; i++)
+            {
+                float x = (float)bounds.Width / (float)nx * (i + 1);
+                renderTarget.DrawLine(new Vector2(x, 0), new Vector2(x, bounds.Height), brush, 1);
+            }
+            for (int i = 0; i < ny - 1; i++)
+            {
+                float y = (float)bounds.Height / (float)ny * (i + 1);
+                renderTarget.DrawLine(new Vector2(0, y), new Vector2(bounds.Width, y), brush, 1);
+            }
             renderTarget.EndDraw();

             brush.Dispose();


Added some comments

Added some comments

--- R7.University.Employee/ViewEmployeeDetails.ascx.cs
+++ R7.University.Employee/ViewEmployeeDetails.ascx.cs
@@ -315,10 +315,12 @@
 				linkExperience.Visible = false;
 			}

+			// get all empoyee achievements
 			var achievements = EmployeeController.GetObjects<EmployeeAchievementInfo> (
 					CommandType.Text, "SELECT * FROM dbo.vw_University_EmployeeAchievements WHERE [EmployeeID] = @0",
 					employee.EmployeeID);

+			// get only experience-related achievements
 			gridExperience.DataSource = AchievementsDataTable(
 				achievements.Where(ach => ach.AchievementType == AchievementType.Education ||
 					ach.AchievementType == AchievementType.Training ||
@@ -326,6 +328,7 @@
 				.OrderByDescending(ach => ach.YearBegin));
 			gridExperience.DataBind();

+			// get all other achievements
 			gridAchievements.DataSource = AchievementsDataTable(
 				achievements.Where(ach => ach.AchievementType == AchievementType.Achievement)
 				.OrderByDescending(ach => ach.YearBegin));


sql temp fix

sql temp fix

--- RedFrogs/RedFrogs/RedFrogs/Data/RedFrogDatabase.cs
+++ RedFrogs/RedFrogs/RedFrogs/Data/RedFrogDatabase.cs
@@ -12,6 +12,7 @@
         public RedFrogDatabase(string dbPath)
         {
             conn = new SQLiteAsyncConnection(dbPath);
+            conn.CreateTableAsync<Events>();

         }


Added some null checks for player stats so the page doesn't blow up.

--- src/BolfTracker.Web/Views/Player/Details.cshtml
+++ src/BolfTracker.Web/Views/Player/Details.cshtml
@@ -10,9 +10,25 @@
 </fieldset>
 <fieldset>
     <legend>Current Month Statistics</legend>
-    @Html.Partial("_PlayerStatistics", Model.CurrentMonthPlayerStatistics)
+    @if (Model.CurrentMonthPlayerStatistics != null)
+    {
+        @Html.Partial("_PlayerStatistics", Model.CurrentMonthPlayerStatistics)
+    }
+    else
+    {
+

+            Monthly player stats not yet available.

+    }
 </fieldset>
 <fieldset>
     <legend>Current Month Hole Statistics</legend>
-    @Html.Partial("_PlayerHoleStatistics", Model.CurrentMonthPlayerHoleStatistics)
+    @if (Model.CurrentMonthPlayerHoleStatistics != null && Model.CurrentMonthPlayerHoleStatistics.Any())
+    {
+        @Html.Partial("_PlayerHoleStatistics", Model.CurrentMonthPlayerHoleStatistics)
+    }
+    else
+    {
+

+            Monthly player hole stats not yet available.

+    }
 </fieldset>


painless execute api was set not to generate however we implemented this as part of 6.3

(cherry picked from commit 9c212b5e2ad979299fa94672432d8cc5b9980582)

--- src/CodeGeneration/ApiGenerator/ApiGenerator.cs
+++ src/CodeGeneration/ApiGenerator/ApiGenerator.cs
@@ -83,8 +83,6 @@
 			"xpack.sql.query.json",
 			"xpack.sql.translate.json",
 			"xpack.ssl.certificates.json",
-
-			"scripts_painless_execute.json",

 			// 6.4 new  API's


C# implementation: better Stack.Push.

C# implementation: better Stack.Push.

--- csharp/NShovel/Shovel/Vm/Stack.cs
+++ csharp/NShovel/Shovel/Vm/Stack.cs
@@ -2,10 +2,10 @@

 namespace Shovel
 {
-	public class Stack
-	{
-		Value[] storage;
-		int length;
+    public class Stack
+    {
+        Value[] storage;
+        int length;

         public Value[] GetUsedStack ()
         {
@@ -14,22 +14,22 @@
             return result;
         }

-		public Stack ()
-		{
-			this.storage = new Value[1024];
-		}
+        public Stack ()
+        {
+            this.storage = new Value[1024];
+        }

-        public Stack(Value[] existingValues)
+        public Stack (Value[] existingValues)
         {
             this.storage = new Value[existingValues.Length * 2];
             this.length = existingValues.Length;
             Array.Copy (existingValues, this.storage, this.length);
         }

-		public Value Top ()
-		{
-			return this.storage [this.length - 1];
-		}
+        public Value Top ()
+        {
+            return this.storage [this.length - 1];
+        }

         public Value UnderTop (int i)
         {
@@ -41,74 +41,68 @@
             return this.storage [this.length - 2];
         }

-        public void UnderPopOneAndCopyTop()
+        public void UnderPopOneAndCopyTop ()
         {
-            this.storage[this.length - 2] = this.storage[this.length - 1];
+            this.storage [this.length - 2] = this.storage [this.length - 1];
             this.length --;
         }

         public void UnderPopAndCopyTop (int i)
         {
-            this.storage[this.length - i - 1] = this.storage[this.length - 1];
+            this.storage [this.length - i - 1] = this.storage [this.length - 1];
             this.length -= i;
         }

-		public Value PopTop ()
-		{
+        public Value PopTop ()
+        {
             this.length --;
-            return this.storage[length];
-		}
+            return this.storage [length];
+        }

-		public void Pop()
-		{
-			this.length --;
-		}
+        public void Pop ()
+        {
+            this.length --;
+        }

-		public void Push (Value value)
-		{
-			if (this.length < this.storage.Length) {
-				this.storage [this.length] = value;
-				this.length++;
-			} else {
-                // FIXME: use Array.Resize.
-                // Check for other places where Array.Resize may be useful.
-				var newStorage = new Value[this.storage.Length * 2];
-				Array.Copy (this.storage, newStorage, this.length);
-				this.storage = newStorage;
-				this.Push(value);
-			}
-		}
+        public void Push (Value value)
+        {
+            if (this.length == this.storage.Length) {
+                Array.Resize (ref this.storage, this.storage.Length * 2);
+            }
+            this.storage [this.length] = value;
+            this.length++;
+        }

         public int Count {
-			get { return this.length;}
-		}
+            get { return this.length;}
+        }

-		public Value[] Storage {
-			get { return this.storage; }
-		}
+        public Value[] Storage {
+            get { return this.storage; }
+        }

-		public void RemoveRange(int position, int rangeLength)
-		{
-			Array.Copy(this.storage, position + rangeLength, this.storage, position, rangeLength);
-			this.length -= rangeLength;
-		}
+        public void RemoveRange (int position, int rangeLength)
+        {
+            Array.Copy (this.storage, position + rangeLength, this.storage, position, rangeLength);
+            this.length -= rangeLength;
+        }

-		public void PopMany(int n)
-		{
-			this.length -= n;
-		}
+        public void PopMany (int n)
+        {
+            this.length -= n;
+        }

-		public void GetTopRange(int n, out Value[] array, out int start)
-		{
-			array = this.storage;
-			start = this.length - n;
-		}
+        public void GetTopRange (int n, out Value[] array, out int start)
+        {
+            array = this.storage;
+            start = this.length - n;
+        }

         public bool TopIsReturnAddress ()
         {
-            return this.storage[this.length - 1].Kind == Value.Kinds.ReturnAddress;
+            return this.storage [this.length - 1].Kind == Value.Kinds.ReturnAddress;
         }

-	}
+    }
 }


Fix null reference issue.

Fix null reference issue.

--- cslacs/Csla/ApplicationContext.cs
+++ cslacs/Csla/ApplicationContext.cs
@@ -345,10 +345,8 @@
       get
       {
         string result = ConfigurationManager.AppSettings["CslaIsInRoleProvider"];
-        if (result.Length == 0)
-        {
+        if (string.IsNullOrEmpty(result))
           result = string.Empty;
-        }
         return result;
       }
     }


DRY in Group.

DRY in Group.

--- src/ExRam.Gremlinq.Core/Queries/GremlinQuery.cs
+++ src/ExRam.Gremlinq.Core/Queries/GremlinQuery.cs
@@ -12,7 +12,6 @@
 using ExRam.Gremlinq.Core.Projections;
 using ExRam.Gremlinq.Core.Serialization;
 using ExRam.Gremlinq.Core.Steps;
-
 using Gremlin.Net.Process.Traversal;
 using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;
@@ -638,31 +637,34 @@
         private GremlinQuery<IDictionary<TKey, TValue>, object, object, object, object, object> Group<TKey, TValue>(Func<IGroupBuilder<GremlinQuery<TElement, TOutVertex, TInVertex, TScalar, TMeta, TFoldedQuery>>, IGroupBuilderWithKeyAndValue<IGremlinQueryBase, TKey, TValue>> projection)
         {
             var group = projection(new GroupBuilder<object, object>(this));
-            var keyTraversal = group.KeyQuery.ToTraversal();
-            var valueTraversal = group.ValueQuery.ToTraversal();
-
-            return this
+
+            return Group<TKey, TValue>(
+                group.KeyQuery.ToTraversal(),
+                group.ValueQuery.ToTraversal());
+        }
+
+        private GremlinQuery<IDictionary<TKey, object>, object, object, object, object, object> Group<TKey>(Func<IGroupBuilder<GremlinQuery<TElement, TOutVertex, TInVertex, TScalar, TMeta, TFoldedQuery>>, IGroupBuilderWithKey<IGremlinQueryBase, TKey>> projection)
+        {
+            var group = projection(new GroupBuilder<object, object>(this));
+
+            return Group<TKey, object>(
+               group.KeyQuery.ToTraversal(),
+               null);
+        }
+
+        private GremlinQuery<IDictionary<TKey, TValue>, object, object, object, object, object> Group<TKey, TValue>(Traversal keyTraversal, Traversal? maybeValueTraversal)
+        {
+            var ret = this
                 .AddStep<IDictionary<TKey, TValue>, object, object, object, object, object>(
                     GroupStep.Instance,
                     _ => _.Group(
                         keyTraversal.Projection,
-                        valueTraversal.Projection))
-                .AddStep(new GroupStep.ByTraversalStep(keyTraversal))
-                .AddStep(new GroupStep.ByTraversalStep(valueTraversal));
-        }
-
-        private GremlinQuery<IDictionary<TKey, object>, object, object, object, object, object> Group<TKey>(Func<IGroupBuilder<GremlinQuery<TElement, TOutVertex, TInVertex, TScalar, TMeta, TFoldedQuery>>, IGroupBuilderWithKey<IGremlinQueryBase, TKey>> projection)
-        {
-            var group = projection(new GroupBuilder<object, object>(this));
-            var keyTraversal = group.KeyQuery.ToTraversal();
-
-            return this
-                .AddStep<IDictionary<TKey, object>, object, object, object, object, object>(
-                    GroupStep.Instance,
-                    _ => _.Group(
-                        keyTraversal.Projection,
-                        Projection))
+                        maybeValueTraversal?.Projection ?? Projection))
                 .AddStep(new GroupStep.ByTraversalStep(keyTraversal));
+
+            return (maybeValueTraversal is { } valueTraversal)
+                ? ret.AddStep(new GroupStep.ByTraversalStep(valueTraversal))
+                : ret;
         }

         private IEnumerable<string> GetStringKeys(Expression[] projections)


PUT: edit an existing job

PUT: edit an existing job

--- src/Hermes/WebApi/Controllers/JobsController.cs
+++ src/Hermes/WebApi/Controllers/JobsController.cs
@@ -44,5 +44,26 @@
                 return Created($"jobs/{job.JobId}", job);
             }
         }
+
+        public async Task<IHttpActionResult> Put(Job job)
+        {
+            using (var db = new HRContext())
+            {
+                var existingJob = await db.Jobs.FindAsync(job.JobId);
+
+                if (existingJob == null)
+                {
+                    return NotFound();
+                }
+
+                existingJob.JobTitle = job.JobTitle;
+                existingJob.MinSalary = job.MinSalary;
+                existingJob.MaxSalary = job.MaxSalary;
+
+                await db.SaveChangesAsync();
+
+                return Ok(existingJob);
+            }
+        }
     }
 }


Lucene.Net.Core.Search.Spans.SpanOrQuery: Changed clauses from IList<SpanQuery> to ValueList<SpanQuery> to ensure Equals() and GetHashCode() consider all clauses when comparing.

--- src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
+++ src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
@@ -33,7 +33,9 @@
     /// Matches the union of its clauses. </summary>
     public class SpanOrQuery : SpanQuery
     {
-        private readonly IList<SpanQuery> clauses;
+        // LUCENENET NOTE: The hash code needs to be made from the hash codes of all elements.
+        // So, we force all subclasses to use ValueList<SpanQuery> instead of IList<SpanQuery> to ensure that logic is in place.
+        private readonly ValueList<SpanQuery> clauses;
         private string field;

         /// <summary>
@@ -41,7 +43,7 @@
         public SpanOrQuery(params SpanQuery[] clauses)
         {
             // copy clauses array into an ArrayList
-            this.clauses = new List<SpanQuery>(clauses.Length);
+            this.clauses = new ValueList<SpanQuery>(clauses.Length);
             for (int i = 0; i < clauses.Length; i++)
             {
                 AddClause(clauses[i]);
@@ -157,7 +159,7 @@

             SpanOrQuery that = (SpanOrQuery)o;

-            if (!clauses.SequenceEqual(that.clauses))
+            if (!clauses.Equals(that.clauses))
             {
                 return false;
             }
@@ -168,7 +170,7 @@
         public override int GetHashCode()
         {
             //If this doesn't work, hash all elemnts together instead. This version was used to reduce time complexity
-            int h = clauses.Count == 0 ? 0 : HashHelpers.CombineHashCodes(clauses.First().GetHashCode(), clauses.Last().GetHashCode(), clauses.Count);
+            int h = clauses.GetHashCode();
             h ^= (h << 10) | ((int)(((uint)h) >> 23));
             h ^= Number.SingleToRawInt32Bits(Boost);
             return h;


Check clientId against stored clientId on refresh token.

--- src/MVC6BearerToken/Api/v1/AccountController.cs
+++ src/MVC6BearerToken/Api/v1/AccountController.cs
@@ -72,6 +72,11 @@
                     //No refresh token mean's it's invalid or revoked
                     return new HttpUnauthorizedResult();
                 }
+
+                if(existingRefreshToken.ClientId != model.ClientId) {
+                    return new HttpUnauthorizedResult();
+                }
+
                 identity = await authRepo.GetClaimsIdentityByNameAsync(existingRefreshToken.Subject);
                 await authRepo.RemoveRefreshTokenAsync(existingRefreshToken);


Updata _dataToken to _dataTokens in VirtualPathData

--- src/Microsoft.AspNet.Routing/VirtualPathData.cs
+++ src/Microsoft.AspNet.Routing/VirtualPathData.cs
@@ -14,7 +14,7 @@
     /// </summary>
     public class VirtualPathData
     {
-        private readonly IDictionary<string, object> _dataToken;
+        private readonly IDictionary<string, object> _dataTokens;

         /// <summary>
         ///  Initializes a new instance of the <see cref="VirtualPathData"/> class.
@@ -55,12 +55,12 @@
             Router = router;
             VirtualPath = virtualPath;

-            _dataToken = new RouteValueDictionary();
+            _dataTokens = new RouteValueDictionary();
             if (dataTokens != null)
             {
                 foreach (var dataToken in dataTokens)
                 {
-                    _dataToken.Add(dataToken.Key, dataToken.Value);
+                    _dataTokens.Add(dataToken.Key, dataToken.Value);
                 }
             }
         }
@@ -70,7 +70,7 @@
         /// </summary>
         public IDictionary<string, object> DataTokens
         {
-            get { return _dataToken; }
+            get { return _dataTokens; }
         }

         /// <summary>


Skip showing usage help when picking an out of scope template

Skip listing templates when a template's args are wrong

--- src/Microsoft.TemplateEngine.Cli/New3Command.cs
+++ src/Microsoft.TemplateEngine.Cli/New3Command.cs
@@ -281,17 +281,27 @@

         private void DisplayTemplateList(bool showAll = false)
         {
-            IEnumerable<ITemplateInfo> results = null;
+            IReadOnlyCollection<ITemplateInfo> results = null;

             try
             {
                 if (showAll)
                 {
-                    results = PerformAllTemplatesInContextQueryAsync().Result.Where(x => x.IsMatch).Select(x => x.Info);
+                    results = PerformAllTemplatesInContextQueryAsync().Result.Where(x => x.IsMatch).Select(x => x.Info).ToList();
+
+                    if(results.Count == 0)
+                    {
+                        results = PerformAllTemplatesInContextQueryAsync().Result.Select(x => x.Info).ToList();
+                    }
                 }
                 else
                 {
-                    results = _matchedTemplates.Where(x => x.IsMatch).Select(x => x.Info);
+                    results = _matchedTemplates.Where(x => x.IsMatch).Select(x => x.Info).ToList();
+
+                    if (results.Count == 0)
+                    {
+                        results = _matchedTemplates.Select(x => x.Info).ToList();
+                    }
                 }
             }
             catch (TemplateAuthoringException tae)
@@ -345,14 +355,12 @@
             if (!string.IsNullOrEmpty(TemplateName))
             {
                 bool anyPartialMatchesDisplayed = ShowTemplateNameMismatchHelp();
-                ShowUsageHelp();
                 DisplayTemplateList(!anyPartialMatchesDisplayed);
                 return Task.FromResult(CreationResultStatus.NotFound);
             }

             if (!ValidateRemainingParameters())
             {
-                ShowUsageHelp();
                 return Task.FromResult(CreationResultStatus.InvalidParamValues);
             }

@@ -1028,16 +1036,16 @@
                 {
                     if (string.Equals(type, "item"))
                     {
-                        Reporter.Error.WriteLine("\t- " + string.Format(LocalizableStrings.ItemTemplateNotInProjectContext, template.Info.Name));
+                        Reporter.Error.WriteLine("  - " + string.Format(LocalizableStrings.ItemTemplateNotInProjectContext, template.Info.Name));
                     }
                     else
                     {   // project template
-                        Reporter.Error.WriteLine("\t- " + string.Format(LocalizableStrings.ProjectTemplateInProjectContext, template.Info.Name));
+                        Reporter.Error.WriteLine("  - " + string.Format(LocalizableStrings.ProjectTemplateInProjectContext, template.Info.Name));
                     }
                 }
                 else
                 {   // this really shouldn't ever happen. But better to have a generic error than quietly ignore the partial match.
-                    Reporter.Error.WriteLine("\t- " + string.Format(LocalizableStrings.GenericPlaceholderTemplateContextError, template.Info.Name));
+                    Reporter.Error.WriteLine("  - " + string.Format(LocalizableStrings.GenericPlaceholderTemplateContextError, template.Info.Name));
                 }
             }

@@ -1046,7 +1054,7 @@
                 Reporter.Error.WriteLine(LocalizableStrings.TemplateMultiplePartialNameMatches);
                 foreach (IFilteredTemplateInfo template in remainingPartialMatches.Values)
                 {
-                    Reporter.Error.WriteLine($"\t{template.Info.Name}");
+                    Reporter.Error.WriteLine($"  {template.Info.Name}");
                 }
             }