Set the heights of buried deployements, don't freeze regtest

--- NBitcoin/Network.cs
+++ NBitcoin/Network.cs
@@ -413,11 +413,9 @@

 			_SegNet = new Network();
 			_SegNet.InitSegnet();
-			_SegNet.Consensus.Freeze();

 			_RegTest = new Network();
 			_RegTest.InitReg();
-			_RegTest.Consensus.Freeze();
 		}

 		static Network _Main;
@@ -467,6 +465,8 @@
 			consensus.MajorityRejectBlockOutdated = 950;
 			consensus.MajorityWindow = 1000;
 			consensus.BuriedDeployments[BuriedDeployments.BIP34] = 227931;
+			consensus.BuriedDeployments[BuriedDeployments.BIP65] = 388381;
+			consensus.BuriedDeployments[BuriedDeployments.BIP66] = 363725;
 			consensus.BIP34Hash = new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
 			consensus.PowLimit = new Target(new uint256("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
 			consensus.SegWitHeight = 2000000000;
@@ -537,6 +537,8 @@
 			consensus.MajorityRejectBlockOutdated = 75;
 			consensus.MajorityWindow = 100;
 			consensus.BuriedDeployments[BuriedDeployments.BIP34] = 21111;
+			consensus.BuriedDeployments[BuriedDeployments.BIP65] = 581885;
+			consensus.BuriedDeployments[BuriedDeployments.BIP66] = 330776;
 			consensus.BIP34Hash = new uint256("0x0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8");
 			consensus.PowLimit = new Target(new uint256("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
 			consensus.SegWitHeight = 2000000000;
@@ -642,7 +644,9 @@
 			consensus.MajorityEnforceBlockUpgrade = 750;
 			consensus.MajorityRejectBlockOutdated = 950;
 			consensus.MajorityWindow = 1000;
-			consensus.BuriedDeployments[BuriedDeployments.BIP34] = -1; // BIP34 has not necessarily activated on regtest
+			consensus.BuriedDeployments[BuriedDeployments.BIP34] = 100000000;
+			consensus.BuriedDeployments[BuriedDeployments.BIP65] = 100000000;
+			consensus.BuriedDeployments[BuriedDeployments.BIP66] = 100000000;
 			consensus.BIP34Hash = new uint256();
 			consensus.PowLimit = new Target(new uint256("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
 			consensus.SegWitHeight = 0;


Update Form1.cs

Update Form1.cs

--- LeapFrog/Form1.cs
+++ LeapFrog/Form1.cs
@@ -65,7 +65,7 @@
 			Invalidate(true);
 		}

-		//fix scene draw here
+		//scene draw here
 		private void Form1_Paint(object sender, PaintEventArgs e) {
 			//e.Graphics.Clear(Color.Transparent);

@@ -73,7 +73,7 @@
 		}

-		//fix scene call to frog here
+		//scene call to frog here
 		private void Form1_KeyPress(object sender, KeyPressEventArgs e) {
 			scene.frog.Jump(e.KeyChar, this.Width, this.Height);
 			Invalidate(true);
@@ -96,14 +96,6 @@
 					Close();
 				}
 			}
-		}
-		//fix this later
-		private void Form1_ResizeEnd(object sender, EventArgs e) {
-			Invalidate(true);
-		}
-
-		private void Form1_ResizeBegin(object sender, EventArgs e) {
-			Invalidate(true);
 		}

 		private void lblStatus_Paint(object sender, PaintEventArgs e) {


Use yield return instead of allocating new list.

--- WalletWasabi.Gui/ViewModels/ViewModelBase.cs
+++ WalletWasabi.Gui/ViewModels/ViewModelBase.cs
@@ -31,11 +31,10 @@
 		{
 			var error = Validator.ValidateProperty(this, propertyName, ValidationMethodCache);

-			if (!error.HasErrors) return null;
-
 			// HACK: Need to serialize this in order to pass through IndeiValidationPlugin on Avalonia 0.8.2.
 			//		 Should be removed when Avalonia has the hotfix update.
-			return new List<string>() { JsonConvert.SerializeObject(error) };
+			if (error.HasErrors)
+				yield return JsonConvert.SerializeObject(error);
 		}

 		protected void NotifyErrorsChanged(string propertyName)


fixed renaming within Total Commander WebDAV plugin

--- WebDavMailRuCloudStore/Mailru/MoveHandler.cs
+++ WebDavMailRuCloudStore/Mailru/MoveHandler.cs
@@ -45,7 +45,8 @@
             }

             // Obtain the destination
-            var destinationUri = request.GetDestinationUri();
+            //var destinationUri = request.GetDestinationUri();
+            var destinationUri = GetDestinationUri(request);
             if (destinationUri == null)
             {
                 // Bad request
@@ -100,6 +101,24 @@
             return true;
         }

+        private static Uri GetDestinationUri(IHttpRequest request)
+        {
+            // Obtain the destination
+            string destinationHeader = request.GetHeaderValue("Destination");
+
+            if (destinationHeader == null)
+                return null;
+
+            // Create the destination URI
+            var uri = destinationHeader.StartsWith("/")
+                ? new Uri(request.Url, destinationHeader)
+                : new Uri(destinationHeader);
+
+            return uri;
+        }
+
+
+
         private async Task MoveAsync(IStoreCollection sourceCollection, string sourceName, IStoreCollection destinationCollection, string destinationName, bool overwrite, IHttpContext httpContext, Uri baseUri, UriResultCollection errors)
         {
             // Determine the new base URI


DNN-4213 SI: Profile field screen not appearing after New User resets password

--- Website/admin/Security/PasswordReset.ascx.cs
+++ Website/admin/Security/PasswordReset.ascx.cs
@@ -162,11 +162,23 @@
             }
             else
             {
-                //Log user in to site
-                LogSuccess();
-                var loginStatus = UserLoginStatus.LOGIN_FAILURE;
-                UserController.UserLogin(PortalSettings.PortalId, username, txtPassword.Text, "", "", "", ref loginStatus, false);
-                RedirectAfterLogin();
+                //check user has a valid profile
+                var user = UserController.GetUserByName(PortalSettings.PortalId, username);
+                var validStatus = UserController.ValidateUser(user, PortalSettings.PortalId, false);
+                if (validStatus == UserValidStatus.UPDATEPROFILE)
+                {
+                    LogSuccess();
+                    ViewState.Add("PageNo", 3);
+                    Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Login"));
+                }
+                else
+                {
+                    //Log user in to site
+                    LogSuccess();
+                    var loginStatus = UserLoginStatus.LOGIN_FAILURE;
+                    UserController.UserLogin(PortalSettings.PortalId, username, txtPassword.Text, "", "", "", ref loginStatus, false);
+                    RedirectAfterLogin();
+                }
             }
         }


Update the PoolHasGFS2SR class to inherit from HostPostLivenessCheck

Signed-off-by: Mihaela Stoica <be95049f8e30d921fc7e2579c00c48bd84c40606@citrix.com>

--- XenAdmin/Diagnostics/Checks/PoolHasGFS2SR.cs
+++ XenAdmin/Diagnostics/Checks/PoolHasGFS2SR.cs
@@ -33,27 +33,24 @@
 using XenAdmin.Core;
 using XenAPI;
 using XenAdmin.Diagnostics.Problems;
-using XenAdmin.Diagnostics.Problems.HostProblem;
+using XenAdmin.Diagnostics.Problems.PoolProblem;

 namespace XenAdmin.Diagnostics.Checks
 {
-    class PoolHasGFS2SR : Check
+    class PoolHasGFS2SR : HostPostLivenessCheck
     {
         public PoolHasGFS2SR(Host host)
             : base(host)
         {
         }

-        protected override Problem RunCheck()
+        protected override Problem RunHostCheck()
         {
-            if (!Host.IsLive())
-                return new HostNotLiveWarning(this, Host);
-
             var clusteringEnabled = Host.Connection.Cache.Cluster_hosts.Any(cluster => cluster.enabled);
             var hasGfs2Sr = Host.Connection.Cache.SRs.Any(sr => sr.GetSRType(true) == SR.SRTypes.gfs2);

             if (clusteringEnabled || hasGfs2Sr)
-                return new Problems.PoolProblem.PoolHasGFS2SRProblem(this, Helpers.GetPoolOfOne(Host.Connection), clusteringEnabled, hasGfs2Sr);
+                return new PoolHasGFS2SRProblem(this, Helpers.GetPoolOfOne(Host.Connection), clusteringEnabled, hasGfs2Sr);

             return null;


[Windows] Fix AlertDialogBackend on Windows

The result of working WPF backend was wrong and looked bad. I changed it
to use Text as Title and SecondaryText as a base message of resulting
dialog.

--- Xwt.WPF/Xwt.WPFBackend/AlertDialogBackend.cs
+++ Xwt.WPF/Xwt.WPFBackend/AlertDialogBackend.cs
@@ -61,17 +61,13 @@
 				// Use a system message box
 				if (message.SecondaryText == null)
 					message.SecondaryText = String.Empty;
-				else {
-					message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
-					message.SecondaryText = String.Empty;
-				}
 				var parent =  context.Toolkit.GetNativeWindow(transientFor) as System.Windows.Window;
 				if (parent != null) {
-					this.dialogResult = MessageBox.Show (parent, message.Text, message.SecondaryText,
-														this.buttons, this.icon, this.defaultResult, this.options);
+					this.dialogResult = MessageBox.Show (parent, message.SecondaryText, message.Text,
+                                                        this.buttons, this.icon, this.defaultResult, this.options);
 				}
 				else {
-					this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
+					this.dialogResult = MessageBox.Show (message.SecondaryText, message.Text, this.buttons,
 														this.icon, this.defaultResult, this.options);
 				}
 				return ConvertResultToCommand (this.dialogResult);
@@ -81,6 +77,7 @@
 				Dialog dlg = new Dialog ();
 				dlg.Resizable = false;
 				dlg.Padding = 0;
+				dlg.Title = message.Text ?? String.Empty;
 				HBox mainBox = new HBox { Margin = 25 };

 				if (message.Icon != null) {
@@ -89,11 +86,7 @@
 				}
 				VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
 				mainBox.PackStart (box, true);
-				var text = new Label {
-					Text = message.Text ?? ""
-				};
 				Label stext = null;
-				box.PackStart (text);
 				if (!string.IsNullOrEmpty (message.SecondaryText)) {
 					stext = new Label {
 						Text = message.SecondaryText
@@ -110,7 +103,6 @@
 				if (message.DefaultButton >= 0 && message.DefaultButton < message.Buttons.Count)
 					dlg.DefaultCommand = message.Buttons[message.DefaultButton];
 				if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
-					text.Wrap = WrapMode.Word;
 					if (stext != null)
 						stext.Wrap = WrapMode.Word;
 					mainBox.WidthRequest = 480;


preliminary Basic authentication implementation (#30)

--- Net/HttpResponse.cs
+++ Net/HttpResponse.cs
@@ -246,13 +246,20 @@
             HDR_SERVER          = "Server",
             HDR_CONTENTTYPE     = "Content-Type",
             HDR_DATE            = "Date",
+            HDR_CLAUTH          = "Authorization",
+            HDR_SVAUTH          = "WWW-Authenticate",

             HDRF_CHUNKEDXFER    = "Chunked",
             HDRF_SERVER         = "Zener/{0}",
             HDRF_CONTENTTYPE    = "text/html",
+            HDRF_SVAUTH_BASIC   = "Basic realm=\"{0}\"",
+            HDRF_CLAUTH_STBSC   = "Basic ",

             HTTP_VERSION        = "1.1",
-            HTTP_NEWLINE        = "\r\n"
+            HTTP_NEWLINE        = "\r\n",
+            // Invalid characters in Basic authentication
+            // "realm" field values.
+            HTTP_SVBASIC_RLMINV = "\"\r\n"
             ;
         internal const int
             TX_BUFFER_SIZE      = 16384
@@ -756,6 +763,135 @@
         }

         /// <summary>
+        /// Authenticates the client using HTTP Basic authentication.
+        /// If authentication fails, responds to the client requesting
+        /// credentials and closes the response.
+        /// </summary>
+        /// <param name="username">
+        ///     The username to be required for successful authentication.
+        /// </param>
+        /// <param name="password">
+        ///     The password to be required for successful authentication.
+        /// </param>
+        /// <param name="realm">
+        ///     The name of the protection space these credentials are
+        ///     used in.
+        /// </param>
+        /// <returns>
+        ///     True if the authentication was successful. If the method
+        ///     returns False, the HttpResponse has been closed.
+        /// </returns>
+        /// <exception cref="System.InvalidOperationException">
+        ///     Thrown when the method is called after the headers or
+        ///     sent, or when it is called after the connection has been
+        ///     closed.
+        /// </exception>
+        public bool BasicAuthenticate(
+            string username, string password,
+            string realm = null
+            )
+        {
+            _CheckClosed();
+            _CheckResponding();
+
+            this.BufferOutput = true;
+
+            var hdr = _request.Headers[HDR_CLAUTH].DefaultIfEmpty(null).First();
+            // If hdr is null, it means that the client hasn't sent an
+            // Authorization header. This means we now need to respond with
+            // a 401 and request authorization.
+            if (hdr == null)
+            {
+                if (String.IsNullOrEmpty(realm))
+                {
+                    realm = _request.Path;
+                }
+
+                realm = new string(realm
+                    .Where(c => !HTTP_SVBASIC_RLMINV.Contains(c))
+                    .ToArray()
+                    );
+
+                this.StatusCode = HttpStatus.Unauthorized;
+                this.Headers.Add(
+                    fieldName:  HDR_SVAUTH,
+                    fieldValue: String.Format(HDRF_SVAUTH_BASIC, realm)
+                    );
+
+                // We've sent out WWW-Authentication header, and we don't
+                // want user code to be able to send any data. Close the
+                // response.
+                this.Close();
+                // Authentication of the client did not succeed. Return false.
+                return false;
+            }
+            else
+            {
+                if (!hdr.Value.StartsWith(HDRF_CLAUTH_STBSC))
+                {
+                    // If the Authorization header doesn't start
+                    // with the string "Basic ", it is invalid. We
+                    // remove the Authorization header and recurse.
+                    // This results in the above branch being executed
+                    // and the sending of a WWW-Authenticate header to
+                    // the client.
+                    _request.Headers.IsReadOnly = false;
+                    _request.Headers.Remove(hdr.Field);
+                    _request.Headers.IsReadOnly = true;
+
+                    this.BasicAuthenticate(username, password, realm);
+                }
+
+                // The remainder of the Authorization header should be the
+                // Base64 string containing the user's authentication details.
+                string authStr = hdr.Value.Substring(HDRF_CLAUTH_STBSC.Length);
+
+                // We'll check that the string is valid Base64. This lets us provide
+                // better error messages: 400 for invalid data, 401 for invalid
+                // credentials.
+                try
+                {
+                    Rfc2045.Base64Decode(authStr);
+                }
+                catch (ArgumentException aex)
+                {
+                    throw new HttpRequestException(
+                        _request,
+                        "The client's Authorization header contains an invalid Base64 string.",
+                        aex
+                        );
+                }
+                catch (InvalidOperationException ioex)
+                {
+                    throw new HttpRequestException(
+                        _request,
+                        "The client's Authorization header contains an invalid Base64 string.",
+                        ioex
+                        );
+                }
+
+                string creds = Rfc2045.Base64Encode(String.Format("{0}:{1}", username, password));
+                if (!creds.Equals(authStr))
+                {
+                    // If the Authorization header doesn't contain
+                    // valid credentials, it cannot authorise the client.
+                    // We remove the Authorization header and recurse.
+                    // This results in the above branch being executed
+                    // and the sending of a WWW-Authenticate header to
+                    // the client.
+                    _request.Headers.IsReadOnly = false;
+                    _request.Headers.Remove(hdr.Field);
+                    _request.Headers.IsReadOnly = true;
+
+                    this.BasicAuthenticate(username, password, realm);
+                }
+            }
+
+            // Authentication of the client succeeded. Return true.
+            return true;
+        }
+
+        /// <summary>
         /// Closes the connection between the server and the client.
         /// </summary>
         public void Close()


clean up field comments in HttpResponse

clean up field comments in HttpResponse

--- Net/HttpResponse.cs
+++ Net/HttpResponse.cs
@@ -246,10 +246,15 @@
         private HttpCookieCollection _cookies;
         private Action _closeCallback;
         private StreamWriter _nsw;
+        private MemoryStream _oBuffer;
         // Set to true when the first write is made. When this is
         // true, it indicates that the response headers have been
         // sent to the client.
-        private bool _beginRespond, _closed, _bufferOutput;
+        private bool _beginRespond,
+            // True when the Close() method has been called.
+            _closed,
+            // Whether output buffering is enabled.
+            _bufferOutput;

         /// <summary>
         /// Writes the headers to the StreamWriter if they have not
@@ -413,6 +418,11 @@
             {
                 _CheckResponding();

+                if (value && _oBuffer != null)
+                {
+                    _oBuffer = new MemoryStream();
+                }
+
                 _bufferOutput = value;
             }
         }


added entity-less support for the Stage

added entity-less support for the Stage

--- Nez-PCL/UI/Stage.cs
+++ Nez-PCL/UI/Stage.cs
@@ -134,7 +134,7 @@
 		{
 			updateKeyboardState();

-			var currentMousePosition = Input.scaledMousePosition;
+			var currentMousePosition = entity != null ? Input.scaledMousePosition : Input.rawMousePosition.ToVector2();
 			var didMouseMove = false;
 			if( _lastMousePosition != currentMousePosition )
 			{
@@ -316,7 +316,9 @@
 		/// <returns>The width.</returns>
 		public float getWidth()
 		{
-			return entity.scene.sceneRenderTargetSize.X;
+			if( entity != null )
+				return entity.scene.sceneRenderTargetSize.X;
+			return Screen.width;
 		}

@@ -326,8 +328,9 @@
 		/// <returns>The height.</returns>
 		public float getHeight()
 		{
-
-			return entity.scene.sceneRenderTargetSize.Y;
+			if( entity != null )
+				return entity.scene.sceneRenderTargetSize.Y;
+			return Screen.height;
 		}


Not implemented check

Not implemented check

--- Lua.NET/LuaAPI.cs
+++ Lua.NET/LuaAPI.cs
@@ -1,9 +1,15 @@
-#undef lua51 // Done
-#undef lua52 // Not implemented
-#undef lua53 // Not implemented
-#undef luajit // Done
+#undef lua51
+#undef lua52
+#undef lua53
+#undef luajit
 /////////////
 #define lua51
+
+#if lua51
+#elif luajit
+#else
+#error "Not implemented"
+#endif

 using System;
 using System.Collections.Generic;
@@ -815,4 +821,4 @@
 		[DllImport(Settings.DllName, CharSet = Settings.CSet, CallingConvention = Settings.CConv)]
 		public static extern void luaL_openlibs(lua_StatePtr L);
 	}
-}+}


More porting.

More porting.

--- Samples/TableTopTennis.cs
+++ Samples/TableTopTennis.cs
@@ -53,7 +53,11 @@

 		public static void Main()
 		{
-		Initialize:
+			Initialize();
+		}
+
+		public static void Initialize()
+		{
 			ColuBk = BGColor;
 			ColuPf = PFColor;
 			ColuP0 = P0Color;
@@ -61,14 +65,27 @@
 			AudV0 = 0b00001111; // Crank the volume up.
 			AudV1 = 0b00001111;
 			AudF1 = 0b0000_0110;
-		PositionPaddles:
+			PositionPaddles:
 			WSync();
 			// ~22 Machine cycles of horizontal blank.
 			// First we do P0's paddle.
 			Timing.ConsumeCycles(21);
 			ResP0();
+			// Now for P1's paddle...
 			Timing.ConsumeCycles(42);
 			ResP1();
+			// Now for more fine-tuned adjustments...
+			HMP1 = 0b0111_0000;
+			WSync();
+			HMove(); // Shift it 7 to the left...
+			HMP1 = 0b0001_0000;
+			WSync();
+			HMove(); // And 1 more to the left and perfect!
+			HmClr();
+			// This could probably be cleaned up without HMOVE, but never touch again. // TODO - Touch again.
+			YPosP0 = BallStartY;
+			YPosP1 = BallStartY;
+			YPosBall = BallStartY;
 		}
     }
 }


Edited labels slightly.

Edited labels slightly.

--- Sensus.Shared/Protocol.cs
+++ Sensus.Shared/Protocol.cs
@@ -1318,9 +1318,8 @@
                 consent.Add(new LabelOnlyInput(_description));

             consent.Add(new LabelOnlyInput("This study will start " + (_startImmediately || DateTime.Now >= _startTimestamp ? "immediately" : "on " + _startTimestamp.ToShortDateString() + " at " + _startTimestamp.ToShortTimeString()) +
-                                           " and " + (_continueIndefinitely ? "continue indefinitely." : "stop on " + _endTimestamp.ToShortDateString() + " at " + _endTimestamp.ToShortTimeString() + ".")));
-
-            consent.Add(new LabelOnlyInput("This study would like to collect the following data from your device:"));
+                                           " and " + (_continueIndefinitely ? "continue indefinitely." : "stop on " + _endTimestamp.ToShortDateString() + " at " + _endTimestamp.ToShortTimeString() + ". ") +
+                                           "The following data will be collected:"));

             LabelOnlyInput collectionDescriptionLabel = null;
             int collectionDescriptionFontSize = 15;
@@ -1337,7 +1336,7 @@
             consent.Add(collectionDescriptionLabel);

             // the name in the following text input is used to grab the UI element when UI testing
-            consent.Add(new SingleLineTextInput("ConsentCode", "To participate in this study as described above, please indicate your consent by entering the following code:  " + consentCode, Keyboard.Numeric)
+            consent.Add(new SingleLineTextInput("ConsentCode", "To participate in this study as described above, please enter the following code:  " + consentCode, Keyboard.Numeric)
             {
                 DisplayNumber = false
             });


Added messages to clarify behavior of loading already-loaded protocols. Closes #287.

--- Sensus.Shared/Protocol.cs
+++ Sensus.Shared/Protocol.cs
@@ -85,8 +85,7 @@
                         SensusServiceHelper.Get().Logger.Log(errorMessage, LoggingLevel.Normal, typeof(Protocol));
                         SensusServiceHelper.Get().FlashNotificationAsync(errorMessage);

-                        if (callback != null)
-                            callback(null);
+                        callback?.Invoke(null);
                     }
                 };
 #elif WINDOWS_PHONE
@@ -127,11 +126,13 @@
                         // a match from an randomized experimental design perspective.
                         Protocol registeredProtocol = null;
                         foreach (Protocol p in SensusServiceHelper.Get().RegisteredProtocols)
+                        {
                             if (p.Equals(protocol) || p.GroupedProtocols.Contains(protocol) || protocol.GroupedProtocols.Contains(p))
                             {
                                 registeredProtocol = p;
                                 break;
                             }
+                        }

                         // if we haven't yet registered the protocol, then set it up and register it
                         if (registeredProtocol == null)
@@ -191,7 +192,10 @@
                             SensusServiceHelper.Get().RegisterProtocol(protocol);
                         }
                         else
+                        {
+                            SensusServiceHelper.Get().FlashNotificationAsync("The study that you just opened has already been loaded into Sensus.");
                             protocol = registeredProtocol;
+                        }

                         // protocols deserialized upon receipt (i.e., those here) are never groupable for experimental integrity reasons. we
                         // do not want the user to be able to group the newly deserialized protocol with other protocols and then share the
@@ -213,8 +217,7 @@
                     }
                     finally
                     {
-                        if (callback != null)
-                            callback(protocol);
+                        callback?.Invoke(protocol);
                     }
                 });
             }
@@ -222,9 +225,7 @@
             {
                 SensusServiceHelper.Get().Logger.Log("Failed to decrypt/convert/deserialize protocol from bytes:  " + ex.Message, LoggingLevel.Normal, typeof(Protocol));
                 SensusServiceHelper.Get().FlashNotificationAsync("Failed to unpack protocol.");
-
-                if (callback != null)
-                    callback(null);
+                callback?.Invoke(null);
             }
         }

@@ -283,7 +284,7 @@

         public static void DisplayAndStartAsync(Protocol protocol)
         {
-            new Thread(() =>
+            Task.Run(() =>
             {
                 if (protocol == null)
                     SensusServiceHelper.Get().FlashNotificationAsync("Protocol is empty. Cannot display or start it.");
@@ -293,7 +294,7 @@
                     // intent will contain a protocol in cases where the user originally launched the activity by opening the protocol from URL, attachment, etc.
                     // if we save the below flash for later, then when the user opens the activity at a later time they'll be confused by the message. so, don't store
                     // the flash below.
-                    SensusServiceHelper.Get().FlashNotificationAsync("You are already participating in \"" + protocol.Name + "\".", false);
+                    SensusServiceHelper.Get().FlashNotificationAsync("The following study is currently running:  \"" + protocol.Name + "\".", false);
                 }
                 else
                 {
@@ -320,8 +321,7 @@
                         });
                     });
                 }
-
-            }).Start();
+            });
         }

         public static void RunUnitTestingProtocol(Stream unitTestingProtocolFile)
@@ -337,36 +337,36 @@
                     unitTestingProtocolFile.CopyTo(protocolStream);
                     string protocolJSON = SensusServiceHelper.Get().ConvertJsonForCrossPlatform(SensusContext.Current.Encryption.Decrypt(protocolStream.ToArray()));
                     DeserializeAsync(protocolJSON, protocol =>
-                        {
-                            if (protocol == null)
-                                throw new Exception("Failed to deserialize unit testing protocol.");
-
-                            foreach (Probe probe in protocol.Probes)
-                            {
-                                // unit testing is problematic with probes that take us away from Sensus, since it's difficult to automate UI
-                                // interaction outside of Sensus. disable any probes that might take us away from Sensus.
-
-                                if (probe is FacebookProbe)
-                                    probe.Enabled = false;
+                    {
+                        if (protocol == null)
+                            throw new Exception("Failed to deserialize unit testing protocol.");
+
+                        foreach (Probe probe in protocol.Probes)
+                        {
+                            // unit testing is problematic with probes that take us away from Sensus, since it's difficult to automate UI
+                            // interaction outside of Sensus. disable any probes that might take us away from Sensus.
+
+                            if (probe is FacebookProbe)
+                                probe.Enabled = false;

 #if __IOS__
                                 if (probe is iOSHealthKitProbe)
                                     probe.Enabled = false;
 #endif

-                                // clear the run-times collection from any script runners. need a clean start, just in case we have one-shot scripts
-                                // that need to run every unit testing execution.
-                                if (probe is ScriptProbe)
-                                    foreach (ScriptRunner scriptRunner in (probe as ScriptProbe).ScriptRunners)
-                                        scriptRunner.RunTimes.Clear();
-
-                                // disable the accelerometer probe, since we use it to trigger a test script that can interrupt UI scripting.
-                                if (probe is AccelerometerProbe)
-                                    probe.Enabled = false;
-                            }
-
-                            DisplayAndStartAsync(protocol);
-                        });
+                            // clear the run-times collection from any script runners. need a clean start, just in case we have one-shot scripts
+                            // that need to run every unit testing execution.
+                            if (probe is ScriptProbe)
+                                foreach (ScriptRunner scriptRunner in (probe as ScriptProbe).ScriptRunners)
+                                    scriptRunner.RunTimes.Clear();
+
+                            // disable the accelerometer probe, since we use it to trigger a test script that can interrupt UI scripting.
+                            if (probe is AccelerometerProbe)
+                                probe.Enabled = false;
+                        }
+
+                        DisplayAndStartAsync(protocol);
+                    });
                 }
             }
             catch (Exception ex)
@@ -976,27 +976,23 @@
         public void CopyAsync(bool resetId, bool register, Action<Protocol> callback = null)
         {
             DeserializeAsync(JsonConvert.SerializeObject(this, SensusServiceHelper.JSON_SERIALIZER_SETTINGS), protocol =>
-                {
-                    protocol.Reset(resetId);
-
-                    if (register)
-                        SensusServiceHelper.Get().RegisterProtocol(protocol);
-
-                    if (callback != null)
-                        callback(protocol);
-                });
+            {
+                protocol.Reset(resetId);
+
+                if (register)
+                    SensusServiceHelper.Get().RegisterProtocol(protocol);
+
+                callback?.Invoke(protocol);
+            });
         }

         public void StartAsync(Action callback = null)
         {
-            new Thread(() =>
-                {
-                    Start();
-
-                    if (callback != null)
-                        callback();
-
-                }).Start();
+            Task.Run(() =>
+            {
+                Start();
+                callback?.Invoke();
+            });
         }

         private void StartInternal()


add ExecuteChunks

add ExecuteChunks

--- Signum.Engine/Database.cs
+++ Signum.Engine/Database.cs
@@ -924,6 +924,19 @@
             }
         }

+        public static int ExecuteChunks(this IUpdateable update, int chunkSize = 10000, int maxQueries = int.MaxValue)
+        {
+            int total = 0;
+            for (int i = 0; i < maxQueries; i++)
+            {
+                int num = update.Take(chunkSize).Execute();
+                total += num;
+                if (num < chunkSize)
+                    break;
+            }
+            return total;
+        }
+
         static string UnsafeMessage(IUpdateable update)
         {
             if (update.PartSelector == null)
@@ -1025,6 +1038,8 @@
         Type EntityType { get; }

         IQueryable<E> EntityQuery<E>() where E : Entity;
+
+        IUpdateable Take(int count);
     }

     //E -> E
@@ -1070,6 +1085,11 @@

             return UpdateableConverter.Convert<T, E>(result);
         }
+
+        public IUpdateable Take(int count)
+        {
+            return new UpdateablePart<A, T>(this.query.Take(count), this.partSelector, this.settersExpressions);
+        }
     }

     internal class UpdateableConverter
@@ -1127,6 +1147,11 @@
         {
             return UpdateableConverter.Convert<T, E>(query);
         }
+
+        public IUpdateable Take(int count)
+        {
+            return new Updateable<T>(this.query.Take(count), this.settersExpressions);
+        }
     }

     public class SetterExpressions


remove unused variables that are no longer needed since moving to static constructor for initialization

--- MimeSharp/Mime.cs
+++ MimeSharp/Mime.cs
@@ -9,10 +9,7 @@
     public static class Mime
     {
         static readonly Dictionary<string, List<string>> ApacheMimes = new Dictionary<string, List<string>>();
-
         private static readonly string defaultType = "application/octet-stream";
-        private static bool isInitialized = false;
-        private static object padLock = new object();

         static Mime()
         {


默认为当前目录

默认为当前目录

--- ChromeAutoUpdate/FrmMain.cs
+++ ChromeAutoUpdate/FrmMain.cs
@@ -292,6 +292,7 @@
                     config.Writue("config", "version", "6");
                     config.Writue("server", "app_update_url", app_update_url);
                     config.Writue("app", "user_agent", "");
+                    config.Writue("app", "path", "");
                 }

                 string ini_app_update_url = config.ReadValue("server", "app_update_url");


fixed bad rename in MicStreamDemo

fixed bad rename in MicStreamDemo

--- Assets/HoloToolkit/Input/Tests/Scripts/MicStreamDemo.cs
+++ Assets/HoloToolkit/Input/Tests/Scripts/MicStreamDemo.cs
@@ -151,7 +151,7 @@
 #if !UNITY_EDITOR
         private void OnApplicationFocus(bool focused)
         {
-            if (isInitialized)
+            if (isRunning)
             {
                 ToggleMicStream(!focused);
             }


cosmetic fix of async WaitUntil

cosmetic fix of async WaitUntil

--- Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs
+++ Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs
@@ -24,10 +24,10 @@
             return promise.Task;
         }

-        public static UniTask<U> WaitUntilValueChanged<T, U>(T target, Func<T, U> monitorFunction, PlayerLoopTiming monitorTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
+        public static UniTask<U> WaitUntilValueChanged<T, U>(T target, Func<T, U> monitorFunction, PlayerLoopTiming monitorTiming = PlayerLoopTiming.Update, IEqualityComparer<U> equalityComparer = null, CancellationToken cancellationToken = default(CancellationToken))
           where T : class
         {
-            var promise = new WaitUntilValueChangedAwaiter<T, U>(target, monitorFunction, null);
+            var promise = new WaitUntilValueChangedPromise<T, U>(target, monitorFunction, equalityComparer, cancellationToken);
             PlayerLoopHelper.AddAction(monitorTiming, promise);
             return promise.Task;
         }
@@ -117,7 +117,7 @@
             }
         }

-        class WaitUntilValueChangedAwaiter<T, U> : Promise<U>, IPlayerLoopItem
+        class WaitUntilValueChangedPromise<T, U> : Promise<U>, IPlayerLoopItem
           where T : class
         {
             readonly T target;
@@ -128,12 +128,13 @@

             public UniTask<U> Task => new UniTask<U>(this);

-            public WaitUntilValueChangedAwaiter(T target, Func<T, U> monitorFunction, IEqualityComparer<U> equalityComparer)
+            public WaitUntilValueChangedPromise(T target, Func<T, U> monitorFunction, IEqualityComparer<U> equalityComparer, CancellationToken cancellation)
             {
                 this.target = target;
                 this.monitorFunction = monitorFunction;
                 this.equalityComparer = equalityComparer ?? UniRxAsyncDefaultEqualityComparer.GetDefault<U>();
                 this.initialValue = monitorFunction(target);
+                this.cancellation = cancellation;
             }

             public bool MoveNext()


Graphics Backend Bugfixes #FIX: Fixed texture binding API always using texUnit zero for certain overloads.

--- Backend/DefaultOpenTK/Backend/Graphics/NativeTexture.cs
+++ Backend/DefaultOpenTK/Backend/Graphics/NativeTexture.cs
@@ -42,7 +42,7 @@
 		}
 		public static void Bind(ContentRef<Duality.Resources.Texture> target, int texUnit = 0)
 		{
-			Bind((target.Res != null ? target.Res.Native : null) as NativeTexture);
+			Bind((target.Res != null ? target.Res.Native : null) as NativeTexture, texUnit);
 		}
 		public static void Bind(NativeTexture tex, int texUnit = 0)
 		{


Switch to IEnumerable

Switch to IEnumerable

--- Battery-Commander.Web/Models/SoldierDetailsViewModel.cs
+++ Battery-Commander.Web/Models/SoldierDetailsViewModel.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;

 namespace BatteryCommander.Web.Models
 {
@@ -7,9 +8,9 @@
     {
         public virtual Soldier Soldier { get; set; }

-        public ICollection<EvaluationViewModel> Evaluations { get; set; } = new List<EvaluationViewModel>();
+        public IEnumerable<EvaluationViewModel> Evaluations { get; set; } = Enumerable.Empty<EvaluationViewModel>();

-        public ICollection<Soldier> Subordinates { get; set; } = new List<Soldier>();
+        public IEnumerable<Soldier> Subordinates { get; set; } = Enumerable.Empty<Soldier>();

         public class EvaluationViewModel
         {


Address code review comments

Address code review comments

--- CSharp/Samples/SimpleFacebookAuthBot/FacebookHelpers.cs
+++ CSharp/Samples/SimpleFacebookAuthBot/FacebookHelpers.cs
@@ -85,11 +85,6 @@

         private static string GetOAuthCallBack(ResumptionCookie resumptionCookie, string facebookOauthCallback)
         {
-            // because of a limitation on the characters in Facebook redirect_uri, we don't use the serialization of the cookie.
-            // http://stackoverflow.com/questions/4386691/facebook-error-error-validating-verification-code
-
-
-
             var uri = GetUri(facebookOauthCallback,
                 Tuple.Create("userId", TokenEncoder(resumptionCookie.UserId)),
                 Tuple.Create("botId", TokenEncoder(resumptionCookie.BotId)),
@@ -101,6 +96,8 @@
             return uri.ToString();
         }

+        // because of a limitation on the characters in Facebook redirect_uri, we don't use the serialization of the cookie.
+        // http://stackoverflow.com/questions/4386691/facebook-error-error-validating-verification-code
         public static string TokenEncoder(string token)
         {
             return HttpServerUtility.UrlTokenEncode(Encoding.UTF8.GetBytes(token));


Rather than marking Batch obsolete, adding note to its remarks that is (nearly) identical to Parition

--- MoreLinq/Batch.cs
+++ MoreLinq/Batch.cs
@@ -31,9 +31,11 @@
         /// <param name="source">The source sequence.</param>
         /// <param name="size">Size of buckets.</param>
         /// <returns>A sequence of equally sized buckets containing elements of the source collection.</returns>
-        /// <remarks> This operator uses deferred execution and streams its results (buckets and bucket content).</remarks>
+        /// <remarks>
+        /// This operator uses deferred execution and streams its results (buckets and bucket content).
+        /// It is also identical to <see cref="Partition{TSource}(System.Collections.Generic.IEnumerable{TSource},int)"/>.
+        /// </remarks>

-        [Obsolete("Use Partition instead.")]
         public static IEnumerable<IEnumerable<TSource>> Batch<TSource>(this IEnumerable<TSource> source, int size)
         {
             return Batch(source, size, x => x);
@@ -48,9 +50,11 @@
         /// <param name="size">Size of buckets.</param>
         /// <param name="resultSelector">The projection to apply to each bucket.</param>
         /// <returns>A sequence of projections on equally sized buckets containing elements of the source collection.</returns>
-        /// <remarks> This operator uses deferred execution and streams its results (buckets and bucket content).</remarks>
+        /// <remarks>
+        /// This operator uses deferred execution and streams its results (buckets and bucket content).
+        /// It is also identical to <see cref="Partition{TSource}(System.Collections.Generic.IEnumerable{TSource},int)"/>.
+        /// </remarks>

-        [Obsolete("Use Partition instead.")]
         public static IEnumerable<TResult> Batch<TSource, TResult>(this IEnumerable<TSource> source, int size,
             Func<IEnumerable<TSource>, TResult> resultSelector)
         {


Implemented Juniper's QOS handling

Implemented Juniper's QOS handling

--- Necrow/PEProbe.cs
+++ Necrow/PEProbe.cs
@@ -1210,6 +1210,53 @@
                         }
                     }
                     #endregion
+                }
+
+                #endregion
+            }
+            else if (nodeManufacture == jun)
+            {
+                #region jun
+                if (Request("show configuration firewall | match \"policer|if-exceeding|bandwidth-limit\"", out lines)) return;
+
+                string name = null;
+                bool ifExceeding = false;
+                string bl = null;
+
+                foreach (string line in lines)
+                {
+                    string lineTrim = line.Trim();
+                    //policer Limit_Rate_10M {
+                    //012345678
+                    if (line.StartsWith("policer ") && line.EndsWith("{"))
+                    {
+                        if (name != null)
+                        {
+                            PEQOSToDatabase li = new PEQOSToDatabase();
+                            li.Name = name;
+                            li.Bandwidth = (int)Math.Round(QOS.ParseBandwidth(bl, 1));
+                            qoslive.Add(name, li);
+                        }
+
+                        name = line.Substring(8, line.IndexOf('{') - 9);
+                        ifExceeding = false;
+                        bl = null;
+                    }
+                    else if (lineTrim.StartsWith("if-exceeding") && line.EndsWith("{")) ifExceeding = true;
+                    else if (ifExceeding)
+                    {
+                        //bandwidth-limit 20480000;
+                        //burst-size-limit 3840000;
+                        //0123456789012345678
+                        if (lineTrim.StartsWith("bandwidth-limit")) bl = lineTrim.Substring(16, lineTrim.IndexOf(';') - 16);
+                    }
+                }
+                if (name != null)
+                {
+                    PEQOSToDatabase li = new PEQOSToDatabase();
+                    li.Name = name;
+                    li.Bandwidth = (int)Math.Round(QOS.ParseBandwidth(bl, 1));
+                    qoslive.Add(name, li);
                 }

                 #endregion


Shorten an API name BringWindowToTop to BringToTop

--- CreviceApp/WinAPI.Window.cs
+++ CreviceApp/WinAPI.Window.cs
@@ -203,7 +203,7 @@
             });
         }

-        public bool BringWindowToTop()
+        public bool BringToTop()
         {
             return Window.BringWindowToTop(Handle);
         }


Small improvement

Small improvement

--- SudokuValidator/Sudoku.cs
+++ SudokuValidator/Sudoku.cs
@@ -272,7 +272,7 @@
         /// <param name="y">The y position to solve from</param>
         /// <returns>True if the sudoku can be solved from the specified position, false otherwise</returns>
         private bool SolveInternal(int x, int y) {
-
+
             if (x >= size) {
                 x = 0;
                 y++;
@@ -302,14 +302,27 @@
                     cols[y] ^= i;
                     squares[squarePos] ^= i;

+                    // Check if values are still possible
+                    for(int x2 = 0; x2 < size; x2++) {
+                        for (int y2 = 0; y2 < size; y2++) {
+                            if (sudokuValues[x2, y2] == 0x0) { // Value no set
+                                if ((lines[x2] & cols[y2] & squares[((x2 / squareSize) * squareSize) + (y2 / squareSize)]) == 0x0) {
+                                    goto Revert;
+
+                                }
+                            }
+                        }
+                    }
+
                     if (SolveInternal(x + 1, y)) {
                         return true; // Solution working, quit
-                    } else {
+                    }
+
+                    Revert:
                         // Revert
                         lines[x] |= i;
                         cols[y] |= i;
                         squares[squarePos] |= i;
-                    }
                 }
             }


updating version to 1.7.1

updating version to 1.7.1

--- DocuSign.Integrations.Client/Properties/AssemblyInfo.cs
+++ DocuSign.Integrations.Client/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.7.0.0")]
-[assembly: AssemblyFileVersion("1.7.0.0")]
+[assembly: AssemblyVersion("1.7.1.0")]
+[assembly: AssemblyFileVersion("1.7.1.0")]


Fixed SaveImageToOnebitPerPixel example

Fixed SaveImageToOnebitPerPixel example

--- Examples/CSharp/Rendering-Printing/ImageColorFilters.cs
+++ Examples/CSharp/Rendering-Printing/ImageColorFilters.cs
@@ -160,7 +160,6 @@
         private static void SaveImageToOnebitPerPixel(Document doc, string dataDir)
         {
             // ExStart:SaveImageToOnebitPerPixel
-
             ImageSaveOptions opt = new ImageSaveOptions(SaveFormat.Png);
             opt.PageIndex = 1;
             opt.ImageColorMode = ImageColorMode.BlackAndWhite;


fixed test case for nunitxmltransformer

fixed test case for nunitxmltransformer

--- Facts/Library/Transformers/NUnit2XmlTransformerFacts.cs
+++ Facts/Library/Transformers/NUnit2XmlTransformerFacts.cs
@@ -106,12 +106,12 @@
             Assert.Equal("False", suites["path1"].Attribute("success").Value);
             Assert.Equal(1.5.ToString(), suites["path1"].Attribute("time").Value);
             Assert.Equal("True", suites["path1"].Attribute("executed").Value);
-            Assert.Equal("Failed", suites["path1"].Attribute("result").Value);
+            Assert.Equal("Failure", suites["path1"].Attribute("result").Value);

             Assert.Equal("False", suites["path>2"].Attribute("success").Value);
             Assert.Equal(2.ToString(), suites["path>2"].Attribute("time").Value);
             Assert.Equal("True", suites["path>2"].Attribute("executed").Value);
-            Assert.Equal("Failed", suites["path>2"].Attribute("result").Value);
+            Assert.Equal("Failure", suites["path>2"].Attribute("result").Value);
         }

         [Fact]


Write Checks

Write Checks

--- FileHelpers.Tests/Tests/Converters/DateFormatCulture.cs
+++ FileHelpers.Tests/Tests/Converters/DateFormatCulture.cs
@@ -54,9 +54,12 @@

             dynamic record = res[0];

-            Check.That(record.Fecha).Equals(new DateTime(1996, 7, 16));
+            Check.That((DateTime) record.Fecha).IsEqualTo(new DateTime(1996, 7, 16));
             record = res[5];
-            Check.That(record.Fecha).Equals(new DateTime(1996, 8, 16));
+            Check.That((DateTime) record.Fecha).IsEqualTo(new DateTime(1996, 8, 16));
+
+            var toString = engine.WriteString(res);
+            Check.That(toString.ToLower()).IsEqualTo(dates.ToLower());
         }


Fix checkbox change not raising settings update

--- osu!StreamCompanion/Code/Modules/MapDataGetters/TcpSocket/TcpSocketSettings.cs
+++ osu!StreamCompanion/Code/Modules/MapDataGetters/TcpSocket/TcpSocketSettings.cs
@@ -29,7 +29,7 @@

         private void checkBox_EnableTcpOutput_CheckedChanged(object sender, EventArgs e)
         {
-            _settings.Add(_names.tcpSocketEnabled.Name, checkBox_EnableTcpOutput.Checked);
+            _settings.Add(_names.tcpSocketEnabled.Name, checkBox_EnableTcpOutput.Checked, true);
         }
     }
 }


Pull request 107, to fix GCed tensorhandledelegates, https://github.com/migueldeicaza/TensorFlowSharp/pull/107

--- TensorFlowSharp/Tensor.cs
+++ TensorFlowSharp/Tensor.cs
@@ -50,6 +50,7 @@
 		internal TFTensor (IntPtr handle) : base (handle) { }

 		static Deallocator FreeTensorDataDelegate = FreeTensorData;
+		static Deallocator FreeTensorHandleDelegate = FreeTensorHandle;

 		[MonoPInvokeCallback (typeof (Deallocator))]
 		internal static void FreeTensorData (IntPtr data, IntPtr len, IntPtr closure)
@@ -512,9 +513,9 @@
 			var dataHandle = GCHandle.Alloc (data, GCHandleType.Pinned);

 			if (dims == null)
-				return TF_NewTensor (dt, IntPtr.Zero, 0, dataHandle.AddrOfPinnedObject () + start * size, (UIntPtr)(count * size), FreeTensorHandle, GCHandle.ToIntPtr (dataHandle));
+				return TF_NewTensor (dt, IntPtr.Zero, 0, dataHandle.AddrOfPinnedObject () + start * size, (UIntPtr)(count * size), FreeTensorHandleDelegate, GCHandle.ToIntPtr (dataHandle));
 			else
-				return TF_NewTensor (dt, dims, dims.Length, dataHandle.AddrOfPinnedObject () + start * size, (UIntPtr)(count * size), FreeTensorHandle, GCHandle.ToIntPtr (dataHandle));
+				return TF_NewTensor (dt, dims, dims.Length, dataHandle.AddrOfPinnedObject () + start * size, (UIntPtr)(count * size), FreeTensorHandleDelegate, GCHandle.ToIntPtr (dataHandle));
 		}

 		// Use for multiple dimension arrays
@@ -523,9 +524,9 @@
 			var dataHandle = GCHandle.Alloc (data, GCHandleType.Pinned);

 			if (dims == null)
-				return TF_NewTensor (dt, IntPtr.Zero, 0, dataHandle.AddrOfPinnedObject (), (UIntPtr)bytes, FreeTensorHandle, GCHandle.ToIntPtr (dataHandle));
+				return TF_NewTensor (dt, IntPtr.Zero, 0, dataHandle.AddrOfPinnedObject (), (UIntPtr)bytes, FreeTensorHandleDelegate, GCHandle.ToIntPtr (dataHandle));
 			else
-				return TF_NewTensor (dt, dims, dims.Length, dataHandle.AddrOfPinnedObject (), (UIntPtr)bytes, FreeTensorHandle, GCHandle.ToIntPtr (dataHandle));
+				return TF_NewTensor (dt, dims, dims.Length, dataHandle.AddrOfPinnedObject (), (UIntPtr)bytes, FreeTensorHandleDelegate, GCHandle.ToIntPtr (dataHandle));
 		}

 		//


Update sample program to use fonts Update sample program to use Printer Status report

--- ThermalConsole/Program.cs
+++ ThermalConsole/Program.cs
@@ -60,7 +60,17 @@
                 Justification = FontJustification.JustifyCenter,
                 HeightScalar = FontHeighScalar.h1,
                 WidthScalar = FontWidthScalar.w1,
-                Effects = FontEffects.Bold | FontEffects.Underline,
+                Effects = FontEffects.Italic | FontEffects.Underline,
+                Font = Fonts.B,
+                AutoNewline = true,
+            };
+
+            // Print Status is shown as a JSON object
+            var printStatus = new StandardSection()
+            {
+                Justification = FontJustification.JustifyLeft,
+                HeightScalar = FontHeighScalar.h1,
+                WidthScalar = FontWidthScalar.w1,
                 Font = Fonts.C,
                 AutoNewline = true,
             };
@@ -75,6 +85,7 @@
             document.Sections.Add(header);
             document.Sections.Add(new Placeholder());  // Placeholder since we know we'll want an image here
             document.Sections.Add(timestamp);
+            document.Sections.Add(printStatus);

             int count = 1;
             while (true)
@@ -84,12 +95,10 @@
                 // support dynamic images over ESC/POS. Images will only
                 // be transmitted through the print queue but no examples have
                 // been prepared for this.
-                using (var printer = new PhoenixPrinter(phoenixPort))
-                //using (var printer = new ReliancePrinter(reliancePort))
+                //using (var printer = new PhoenixPrinter(phoenixPort))
+                using (var printer = new ReliancePrinter(reliancePort))
                 using(var image = Webcam.GrabPicture())
                 {
-
-                    image.Resize(20, 0, true);

                     var now = DateTime.Now;
                     Console.WriteLine("Image #{0} taken at {1}", count, now);
@@ -105,6 +114,10 @@
                     // Printer the timestamp document
                     timestamp.Content = string.Format("{1}", count++, now);

+                    // Get the latest printer status. Note that reliance and phoenix have
+                    // slightly different args to this get status command
+                    printStatus.Content = printer.GetStatus(StatusTypes.FullStatus).ToJSON(true);
+
                     // Re-assign this image to the middle part of the document
                     printer.SetImage(image, document, 1);


Format display counter

Format display counter

--- DetectCollisions/Program.cs
+++ DetectCollisions/Program.cs
@@ -17,10 +17,10 @@
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
+
 using System;
 using System.Collections.Generic;
 using System.Security.Cryptography;
-using YouTubeVideoName;

 namespace DetectCollisions
 {
@@ -33,7 +33,7 @@
       ulong counter = 0;
       bool collisionfound = false;
       string source = CreateName();
-      for (int i = 0; i < 20; i++)
+      for (int i = 0; i < 5; i++)
       {
         string collision = CreateName();
         display(string.Format("The source {0} has not collided in {1} loops with this one: {2}", source, counter, collision));
@@ -53,7 +53,7 @@
       while (!collisionfound)
       {
         string collision = CreateName();
-        display(string.Format("The source {0} has not collided in {1} loops with this one: {2}", source, counter, collision));
+        display(string.Format("The source {0} has not collided in {1:n0} loops with this one: {2}", source, counter, collision));
         if (collision == source)
         {
           collisionfound = true;


Added unit test for DR-103 to confirm that the current behavior fails.

--- src/tests/DreamMisc/XDoc-Test.cs
+++ src/tests/DreamMisc/XDoc-Test.cs
@@ -363,6 +363,18 @@
         }

         [Test]
+        public void XPost2() {
+            var keyvalues = new[] {
+                new KeyValuePair<string, string>("a/b", "123"),
+                new KeyValuePair<string, string>("a/c", "456"),
+                new KeyValuePair<string, string>("x/a/d", "789"),
+            };
+            var doc = XDocFactory.From(keyvalues, "root");
+            var text = doc.ToString();
+            Assert.AreEqual("<root>123<c>456</c><x><d>789</d></x></root>", text);
+        }
+
+        [Test]
         public void XmlContents() {
             XDoc doc = new XDoc("test");
             doc.Value("<tag>text</tag>");


fix(mapper): return edi infos while parsing

--- EDILibrary/EdiJsonMapper.cs
+++ EDILibrary/EdiJsonMapper.cs
@@ -22,8 +22,19 @@
         {
             _loader = loader;
         }
-
+        public struct JsonResult
+        {
+            public string EDI;
+            public string Format;
+            public string Version;
+            public string Sender;
+            public string Receiver;
+        }
         public async Task<string> ParseToJson(string edi, string packageVersion, string includeEmptyValues = null)
+        {
+            return (await ParseToJsonWithVersion(edi, packageVersion, includeEmptyValues)).EDI;
+        }
+            public async Task<JsonResult> ParseToJsonWithVersion(string edi, string packageVersion, string includeEmptyValues = null)
         {
             var edi_info = EDIHelper.GetEDIFileInfo(edi);
             var edi_string = EDIHelper.NormalizeEDIHeader(edi);
@@ -56,8 +67,13 @@

             var resultDict = resultObject as IDictionary<string, object>;
             ParseObject(jsonResult, resultObject as IDictionary<string, object>, mappings, includeEmptyValues != null);
-
-            return JsonConvert.SerializeObject(resultObject);
+            JsonResult result = new JsonResult();
+            result.EDI = JsonConvert.SerializeObject(resultObject);
+            result.Format = edi_info.Format;
+            result.Version = edi_info.Version;
+            result.Sender = edi_info.Sender.ID;
+            result.Receiver = edi_info.Empfänger.ID;
+            return result;
         }
         public async Task<string> CreateFromJson(string jsonInput, string pid, string formatPackage = null)
         {


fix(mapper): use new json input format

fix(mapper): use new json input format

--- EDILibrary/EdiJsonMapper.cs
+++ EDILibrary/EdiJsonMapper.cs
@@ -71,27 +71,36 @@
             {
                 throw new Exception("FormatPackage must be specified");
             }
-            var json = JsonConvert.DeserializeObject<JArray>(await _loader.LoadJSONTemplate(package, "wim_utilmd.json"));
+            var json = JsonConvert.DeserializeObject<JObject>(await _loader.LoadJSONTemplate(package, $"{pid}.json"));
             var inputJson = JsonConvert.DeserializeObject<JObject>(jsonInput);
             JArray mappings = JsonConvert.DeserializeObject<JArray>(await _loader.LoadJSONTemplate(package, format + version + ".json"));
             //map inputJson via fix values from mapping
-            if (((JObject)json.Where(entry => ((JObject)entry).Property("key").Value.Value<string>() == "utilmd").FirstOrDefault()) != null)
-            {
-                ApplyFix(inputJson, ((JObject)json.Where(entry => ((JObject)entry).Property("key").Value.Value<string>() == "utilmd").FirstOrDefault()));
-            }
-            var processMapping = ((JObject)json.Where(entry => ((JObject)entry).Property("key").Value.Value<string>() == pid).FirstOrDefault());
-            if (processMapping != null)
-            {
-                ApplyFix(inputJson, processMapping);
-            }
-            else
-            {
-                throw new BadPIDException(pid);
-            }
+            // if (((JObject)json.Where(entry => ((JObject)entry).Property("key").Value.Value<string>() == "utilmd").FirstOrDefault()) != null)
+            //{
+            //   ApplyFix(inputJson, ((JObject)json.Where(entry => ((JObject)entry).Property("key").Value.Value<string>() == "utilmd").FirstOrDefault()));
+            // }
+            //  var processMapping =json;// ((JObject)json.Where(entry => ((JObject)entry).Property("key").Value.Value<string>() == pid).FirstOrDefault());
+            //   if (processMapping != null)
+            //  {
+            //       ApplyFix(inputJson, processMapping);
+            //  }
+            //   else
+            //    {
+            //       throw new BadPIDException(pid);
+            //    }
             JArray maskArray = new JArray();
-            foreach (var step in processMapping.Property("steps").Value)
-            {
-                maskArray.Merge((step as JObject)?.Property("fields").Value as JArray, new JsonMergeSettings() { MergeArrayHandling = MergeArrayHandling.Union });
+            foreach (var step in json.Property("steps").Value)
+            {
+                foreach (var prop in ((step as JObject)?.Property("fields").Value as JObject).Properties())
+                {
+                    var newObj = new JObject
+                    {
+                        { "key", prop.Name },
+                        { "type", (prop.Value as JObject).Property("obligType").Value }
+                    };
+                    maskArray.Add(newObj);
+                }
+                //maskArray.Merge(((step as JObject)?.Property("fields").Value as JObject).Properties(), new JsonMergeSettings() { MergeArrayHandling = MergeArrayHandling.Union });
             }
             var outputJson = CreateMsgJSON(inputJson, mappings, maskArray);
             IEdiObject result = IEdiObject.CreateFromJSON(JsonConvert.SerializeObject(outputJson));


maybe there's also a "root" coming round

--- EDILibrary/EdiJsonMapper.cs
+++ EDILibrary/EdiJsonMapper.cs
@@ -335,6 +335,7 @@
                         string sg = foundObj.SelectToken("_meta.sg")?.Value<string>();
                         string key = prop.Name;
                         string virtualKey = foundObj.SelectToken("_meta.virtualKey")?.Value<string>();
+                        var rootLikeSgKeys = new HashSet<string>() { "UNH", "/", "root" };
                         if (virtualKey is not null)
                         {
                             key = virtualKey;
@@ -397,8 +398,7 @@
                                 }
                             }
                         }
-
-                        else if (sg is not null && sg != "/" && sg != "UNH" && (sg == ahb.Discriminator))
+                        else if (sg is not null && rootLikeSgKeys.Contains(sg) && sg == ahb.Discriminator)
                         {
                             continue;
                         }


Validate build settings on plugin builder import.

--- Editor/JavaBuildSettings.cs
+++ Editor/JavaBuildSettings.cs
@@ -3,6 +3,7 @@
 using System.Collections;

+[InitializeOnLoad]
 public class JavaBuildSettings : ScriptableObject
 {
 	const string kBuildSettingsPath = "Assets/JavaBuildSettings.asset";
@@ -35,6 +36,15 @@
 			}

 			return s_Instance;
+		}
+	}
+
+
+	static JavaBuildSettings ()
+	{
+		if (Instance == null)
+		{
+			Debug.LogError ("Failed to create build settings");
 		}
 	}


[HideHoldOut] Fix not compiling, missing import

--- Games/Unity/Oxide.Game.HideHoldOut/HideHoldOutPlugin.cs
+++ Games/Unity/Oxide.Game.HideHoldOut/HideHoldOutPlugin.cs
@@ -1,3 +1,5 @@
+using System.Reflection;
+
 using Oxide.Core;
 using Oxide.Core.Plugins;
 using Oxide.Game.HideHoldOut.Libraries;


Missing UI file.

Missing UI file.

--- client/formsapp2/formsapp2Page.xaml.cs
+++ client/formsapp2/formsapp2Page.xaml.cs
@@ -1,4 +1,5 @@
-using Xamarin.Forms;
+using System.Diagnostics;
+using Xamarin.Forms;

 namespace formsapp2
 {
@@ -10,10 +11,10 @@

 			// Doing this from XAML isn't as well documented,
 			// so let's do this from code.
-			var home = new NavigationPage(new HomePage()) { Title = "Home" }; 		// var is syntactic sugar for type inference.
-			var log 	= new NavigationPage(new TraveloguePage()) { Title = "Log" };
-			var gallery = new NavigationPage(new GalleryPage()) { Title = "Gallery" };
-			var map 	= new NavigationPage(new MapPage()) { Title = "Map" };
+			var home 	= new NavigationPage(new HomePage()) 	   	{ Title = "Home", 	Icon = "home.png" }; 		// var is syntactic sugar for type inference.
+			var log 	= new NavigationPage(new TraveloguePage()) 	{ Title = "Log", 	Icon = "notebook2.png" };
+			var gallery = new NavigationPage(new GalleryPage()) 	{ Title = "Gallery", Icon = "picture.png" };
+			var map 	= new NavigationPage(new MapPage()) 		{ Title = "Map" , 	Icon = "maplocation.png" };

 			Children.Add(home); // Children refers to children of this *Page.
 			Children.Add(log);
@@ -36,6 +37,8 @@
 				iOS: () => { message = "Hello iOS!";},
 				Android: () => { message = "Hello Android";}
 			);
+
+			Debug.WriteLine(message);
 		}
 	}
 }


Prepared for auto-help

Prepared for auto-help

--- Okedst.Args/Args.cs
+++ Okedst.Args/Args.cs
@@ -33,7 +33,7 @@

         private class DetectedFlag : DetectedUsage
         {
-            public DetectedFlag(char? shortName, string longName, string description, bool isSet)
+            public DetectedFlag(char? shortName, string longName, string description, bool isSet)
                 : base(shortName, longName, description)
             {
                 this.IsSet = isSet;
@@ -43,15 +43,19 @@
             public override object Value => this.IsSet;
         }

-        private abstract class DetectedParameter : DetectedUsage {
-            protected DetectedParameter(char? shortName, string longName, string description) : base(shortName, longName, description)
-            {
+        private class DetectedArgument<T> : DetectedUsage
+        {
+            public T DefaultValue { get; }
+
+            public DetectedArgument(string description, T defaultValue) : base(null, null, description)
+            {
+                this.DefaultValue = defaultValue;
             }
         }

         private class DetectedParameter<T> : DetectedUsage
         {
-            public DetectedParameter(char? shortName, string longName, string description, T defaultValue, T value)
+            public DetectedParameter(char? shortName, string longName, string description, T defaultValue, T value)
                 : base(shortName, longName, description)
             {
                 this.DefaultValue = defaultValue;
@@ -59,7 +63,8 @@
             }

             public T DefaultValue { get; }
-            public T TypedValue { get;  }
+            public T TypedValue { get; }
+            public override object Value => this.TypedValue;
         }

         private static readonly List<DetectedUsage> DetectedUsages = new List<DetectedUsage>();
@@ -67,7 +72,6 @@
         private static readonly List<string> PureArguments = new List<string>();
         private static readonly string ExeFileName;
         private static readonly HashSet<char> FlagCache = new HashSet<char>();
-        private static readonly HashSet<string> FlagStringCache = new HashSet<string>();

         static Args()
         {
@@ -92,7 +96,6 @@
         {
             DetectedUsages.Clear();
             PureArguments.Clear();
-            FlagStringCache.Clear();
             FlagCache.Clear();
             var doubleDash = Arguments.IndexOf("--");
             if (doubleDash != -1)
@@ -104,7 +107,7 @@
                 }
                 Arguments.RemoveRange(doubleDash, PureArguments.Count);
             }
-            // Find all "multi-flag" options ("-acHe") and parse them
+            // Parse all "multi-flag" options ("-acHe")
             var index = Arguments.FindIndex(a => a.Length > 2 && a[0] == '-' && a[1] != '-');
             while (index != -1)
             {
@@ -123,6 +126,7 @@
         /// <returns> Lazy-loaded value that is evaluated when cast to string </returns>
         public static LazyImplicit<string> Next(string defaultValue = null)
         {
+            DetectedUsages.Add(new DetectedArgument<string>(null, defaultValue));
             // If parameters look like "-f hello" we don't know if the "hello" belongs to the "-f" or not
             // until that flag is used. So we postpone the evaluation of this as long as possible
             return new LazyImplicit<string>(() =>
@@ -189,37 +193,42 @@
             if (index != -1)
             {
                 Arguments.RemoveAt(index);
-                FlagStringCache.Add(flagName);
                 return true;
             }

             return false;
         }

-        public static bool Flag(char flagChar, string flagName)
-        {
-            DetectedFlag foundLong = null;
-            if (DetectedUsages.TryFind(x => x.ShortName == flagChar, out DetectedFlag foundShort)
-                || DetectedUsages.TryFind(x => x.LongName == flagName, out foundLong))
-            {
-                if (foundShort != null && foundLong != null && foundShort != foundLong)
-                {
-                    // TODO: Merge these two if possible
-                }
-
-                return (foundShort?.IsSet ?? false) || foundLong.IsSet;
-            }
-
-            var index = Arguments.FindIndex(x => x == "-" + flagChar || x == "--" + flagName);
-            DetectedUsages.Add(new DetectedFlag(flagChar, flagName, null, index != -1));
-            if (index != -1)
-            {
-                Arguments.RemoveAt(index);
-                FlagStringCache.Add(flagName);
+        public static bool Flag(char? flagChar, string flagName)
+        {
+            if (flagChar.HasValue && DetectedUsages.TryFind(x => x.ShortName == flagChar, out DetectedFlag foundChar))
+                return foundChar.IsSet;
+            if (flagName != null && DetectedUsages.TryFind(x => x.LongName == flagName, out DetectedFlag foundString))
+                return foundString.IsSet;
+
+            if (flagChar.HasValue && FlagCache.Contains(flagChar.Value))
+            {
+                DetectedUsages.Add(new DetectedFlag(flagChar, flagName, null, true));
                 return true;
             }

-            return false;
+            //DetectedFlag foundLong = null;
+            //if (DetectedUsages.TryFind(x => x.ShortName == flagChar, out DetectedFlag foundShort)
+            //    || DetectedUsages.TryFind(x => x.LongName == flagName, out foundLong))
+            //{
+            //    if (foundShort != null && foundLong != null && foundShort != foundLong)
+            //    {
+            //        // TODO: Merge these two if possible
+            //    }
+
+            //    return (foundShort?.IsSet ?? false) || foundLong.IsSet;
+            //}
+
+            var removed = Arguments.RemoveAll(x => (flagChar.HasValue && x == "-" + flagChar) || (flagName != null && x == "--" + flagName));
+            DetectedUsages.Add(new DetectedFlag(flagChar, flagName, null, removed!=0));
+
+
+            return removed != 0;
         }

         /// <summary>
@@ -269,7 +278,7 @@
                     Error($"Missing parameter value after '-{parameterChar}'", Arguments[i]);

                 var converter = TypeDescriptor.GetConverter(typeof(T));
-                result = (T) converter.ConvertFromString(Arguments[i + 1]);
+                result = (T)converter.ConvertFromString(Arguments[i + 1]);

                 Arguments.RemoveRange(i, 2);
             }


rename Settings argument to SettingsFile

--- PS4Macro/Program.cs
+++ PS4Macro/Program.cs
@@ -54,7 +54,7 @@
                     .Add("ShowConsole:", "Open debugging console on launch", v => m_Settings.ShowConsole = v == null ? true : Convert.ToBoolean(v))
                     .Add("StartupFile=", "Absolute or relative path to the file to load on launch (can be xml or dll)", v => m_Settings.StartupFile = v);

-                p.Add("Settings=", "Absolute or relative path to the settings file (will take priority)", v => m_Settings = Settings.Load(v));
+                p.Add("SettingsFile=", "Absolute or relative path to the settings file (will take priority)", v => m_Settings = Settings.Load(v));
                 p.Add("h|?|help", "Displays this help message", v => {
                     p.WriteOptionDescriptions(Console.Out);
                     Environment.Exit(0);


* version incremented

* version incremented

--- Kulman.WPA81.BaseRestService/Properties/AssemblyInfo.cs
+++ Kulman.WPA81.BaseRestService/Properties/AssemblyInfo.cs
@@ -26,5 +26,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.2")]
+[assembly: AssemblyVersion("1.2.3")]
 [assembly: AssemblyFileVersion("1.0.0.0")]


* version incremented

* version incremented

--- Kulman.WPA81.BaseRestService/Properties/AssemblyInfo.cs
+++ Kulman.WPA81.BaseRestService/Properties/AssemblyInfo.cs
@@ -26,5 +26,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.1")]
+[assembly: AssemblyVersion("1.2.2")]
 [assembly: AssemblyFileVersion("1.0.0.0")]


Change layout in Tree

Change layout in Tree

--- src/AhoCorasick.Net/AhoCorasickTree.cs
+++ src/AhoCorasick.Net/AhoCorasickTree.cs
@@ -57,13 +57,6 @@
             return false;
         }

-        private void SetFailureNodes()
-        {
-            var nodes = FailToRootNode();
-            FailUsingBFS(nodes);
-            _rootNode.Failure = _rootNode;
-        }
-
         private void AddPatternToTree(string pattern)
         {
             var latestNode = _rootNode;
@@ -71,7 +64,7 @@
             for (var i = 0; i < length; i++)
             {
                 latestNode = latestNode.GetTransition(pattern[i])
-                       ?? latestNode.AddTransition(pattern[i]);
+                             ?? latestNode.AddTransition(pattern[i]);
             }

             latestNode.IsFinished = true;
@@ -121,5 +114,12 @@
                 nodes = newNodes;
             }
         }
+
+        private void SetFailureNodes()
+        {
+            var nodes = FailToRootNode();
+            FailUsingBFS(nodes);
+            _rootNode.Failure = _rootNode;
+        }
     }
 }


Find min in rotated sorted array

Find min in rotated sorted array

--- LeetCode/remote/find_minimum_in_rotated_sorted_array.cs
+++ LeetCode/remote/find_minimum_in_rotated_sorted_array.cs
@@ -43,6 +43,33 @@
         return nums[low];
     }

+    //  https://leetcode.com/submissions/detail/60246275/
+    //
+    //  Submission Details
+    //  146 / 146 test cases passed.
+    //      Status: Accepted
+    //      Runtime: 188 ms
+    //
+    //          Submitted: 0 minutes ago
+    public int FindMin(int[] nums) {
+        var low = 0;
+        var high = nums.Length - 1;
+        while (low < high)
+        {
+            var mid = low + (high - low) / 2;
+            if (nums[mid] > nums[high])
+            {
+                low = mid + 1;
+            }
+            else
+            {
+                high = mid;
+            }
+        }
+
+        return nums[low];
+    }
+
     static void Main()
     {
         Console.WriteLine(new Solution().FindMin(new [] { 1, 2, 3, 4, 5, 6 }));


Added a ArgumentNullException catch to prevent application crash if import list is empty (Shouldn't be null though)

--- WifiManager/MainWindow.cs
+++ WifiManager/MainWindow.cs
@@ -52,7 +52,15 @@
 			lbAvailableProfileList.Items.Clear();
 			foreach(string s in info.GetStoredProfileList())
 			{
-				lbAvailableProfileList.Items.Add(s);
+				try
+				{
+					lbAvailableProfileList.Items.Add(s);
+				}
+				catch (ArgumentNullException)
+				{
+					// Break if there were no arguments to add
+					break;
+				}
 			}
 		}


PF combo. Insert unknown portfolio.

PF combo. Insert unknown portfolio.

--- Xaml/PortfolioComboBox.cs
+++ Xaml/PortfolioComboBox.cs
@@ -89,6 +89,9 @@
 			var portfolio = (Portfolio)e.NewValue;
 			var cb = (PortfolioComboBox)source;

+			if (portfolio != null && !cb.Portfolios.Contains(portfolio))
+				cb.Portfolios.Add(portfolio);
+
 			cb.SelectedItem = portfolio;
 		}


Added AttachDevTools

Added AttachDevTools

--- src/Core2D.Avalonia/MainWindow.xaml.cs
+++ src/Core2D.Avalonia/MainWindow.xaml.cs
@@ -11,6 +11,7 @@
         public MainWindow()
         {
             this.InitializeComponent();
+            this.AttachDevTools();
         }

         private void InitializeComponent()


Added ellipse circle mode

Added ellipse circle mode

--- src/Core2D/Editor/Tools/ToolEllipse.cs
+++ src/Core2D/Editor/Tools/ToolEllipse.cs
@@ -13,10 +13,14 @@
     public class ToolEllipse : ToolBase
     {
         public enum State { TopLeft, BottomRight }
+        public enum Mode { Rectangle, Circle }
         private readonly IServiceProvider _serviceProvider;
         private State _currentState = State.TopLeft;
+        private Mode _currentMode = Mode.Circle;
         private XEllipse _ellipse;
         private ToolEllipseSelection _selection;
+        private double _centerX;
+        private double _centerY;

         /// <inheritdoc/>
         public override string Name => "Ellipse";
@@ -30,6 +34,17 @@
             _serviceProvider = serviceProvider;
         }

+        private void ConstrainToCircle(double sx, double sy)
+        {
+            double rx = Math.Abs(_centerX - sx);
+            double ry = Math.Abs(_centerY - sy);
+            double r = Math.Max(rx, ry);
+            _ellipse.TopLeft.X = _centerX - r;
+            _ellipse.TopLeft.Y = _centerY - r;
+            _ellipse.BottomRight.X = _centerX + r;
+            _ellipse.BottomRight.Y = _centerY + r;
+        }
+
         /// <inheritdoc/>
         public override void LeftDown(double x, double y)
         {
@@ -41,6 +56,12 @@
             {
                 case State.TopLeft:
                     {
+                        if (_currentMode == Mode.Circle)
+                        {
+                            _centerX = sx;
+                            _centerY = sy;
+                        }
+
                         var style = editor.Project.CurrentStyleLibrary.Selected;
                         _ellipse = XEllipse.Create(
                             sx, sy,
@@ -67,8 +88,15 @@
                     {
                         if (_ellipse != null)
                         {
-                            _ellipse.BottomRight.X = sx;
-                            _ellipse.BottomRight.Y = sy;
+                            if (_currentMode == Mode.Circle)
+                            {
+                                ConstrainToCircle(sx, sy);
+                            }
+                            else
+                            {
+                                _ellipse.BottomRight.X = sx;
+                                _ellipse.BottomRight.Y = sy;
+                            }

                             var result = editor.TryToGetConnectionPoint(sx, sy);
                             if (result != null)
@@ -135,8 +163,16 @@
                             {
                                 editor.TryToHoverShape(sx, sy);
                             }
-                            _ellipse.BottomRight.X = sx;
-                            _ellipse.BottomRight.Y = sy;
+
+                            if (_currentMode == Mode.Circle)
+                            {
+                                ConstrainToCircle(sx, sy);
+                            }
+                            else
+                            {
+                                _ellipse.BottomRight.X = sx;
+                                _ellipse.BottomRight.Y = sy;
+                            }
                             editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                             Move(_ellipse);
                         }


코드 정리 및 수정

코드 정리 및 수정

--- UserClass.cs
+++ UserClass.cs
@@ -1,82 +1,82 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RpsGameForm
-{
-
-    public class RpsGame
-    {
-        // 입력 값(사용자가 선택한 값)
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RpsGameForm
+{
+
+    public class RpsGame
+    {
+        // 입력 값(사용자가 선택한 값)
         public int UserSelect;

         // 처리 값(컴퓨터가 선택한 값)
-        public int ComSelect;
-
-        // 가위바위보 게임의 결과를 구한다.
-        public Results Play(int UserSelect, int ComSelect)
-        {
-            Results GameResult = Results.None;    // 가위바위보 게임 결과
-
-            if (UserSelect == ComSelect)
-            {
-                GameResult = Results.Draw;
-            }
-            else
-            {
-                switch (UserSelect)
-                {
-                    case 0: GameResult = (ComSelect == 2) ? Results.Win : Results.Lose; break;
-                    case 1: GameResult = (ComSelect == 0) ? Results.Win : Results.Lose; break;
-                    case 2: GameResult = (ComSelect == 1) ? Results.Win : Results.Lose; break;
-                }
-            }
-
-            return GameResult;
-        }
-
-        // 가위바위보 게임 이벤트
-        public delegate void GameEventHandler(GameEventArgs GameEventArgs);
-        public event GameEventHandler GameResultEvent;
-        private void FireGameResultEvent(GameEventArgs GameEventArgs)
-        {
-            if (GameResultEvent != null)
-                GameResultEvent(GameEventArgs);
-        }
-
-        // 가위바위보 게임 이벤트를 실행한다.
-        public void Run(GameEventArgs GameEventArgs)
-        {
-            Results GameResult = Play(GameEventArgs.UserSelect, GameEventArgs.ComSelect);
-            GameEventArgs.SetGameResult(GameResult);
-
-            FireGameResultEvent(GameEventArgs);
-        }
-    }
-
+        public int ComSelect;
+
+        // 가위바위보 게임의 결과를 구한다.
+        public Results Play(int UserSelect, int ComSelect)
+        {
+            Results GameResult = Results.None;    // 가위바위보 게임 결과
+
+            if (UserSelect == ComSelect)
+            {
+                GameResult = Results.Draw;
+            }
+            else
+            {
+                switch (UserSelect)
+                {
+                    case 0: GameResult = (ComSelect == 2) ? Results.Win : Results.Lose; break;
+                    case 1: GameResult = (ComSelect == 0) ? Results.Win : Results.Lose; break;
+                    case 2: GameResult = (ComSelect == 1) ? Results.Win : Results.Lose; break;
+                }
+            }
+
+            return GameResult;
+        }
+
+        // 가위바위보 게임 이벤트
+        public delegate void GameEventHandler(GameEventArgs GameEventArgs);
+        public event GameEventHandler GameResultEvent;
+        private void FireGameResultEvent(GameEventArgs GameEventArgs)
+        {
+            if (GameResultEvent != null)
+                GameResultEvent(GameEventArgs);
+        }
+
+        // 가위바위보 게임 이벤트를 실행한다.
+        public void Run(GameEventArgs GameEventArgs)
+        {
+            Results GameResult = Play(GameEventArgs.UserSelect, GameEventArgs.ComSelect);
+            GameEventArgs.SetGameResult(GameResult);
+
+            FireGameResultEvent(GameEventArgs);
+        }
+    }
+
     public class GameEventArgs
     {
         public int UserSelect { get; private set; }
         public int ComSelect { get; private set; }
         public Results GameResult { get; private set; }

-        public GameEventArgs(int m_UserSelect, int m_ComSelect)
+        private GameEventArgs(int m_UserSelect, int m_ComSelect)
         {
            UserSelect = m_UserSelect;
             ComSelect = m_ComSelect;
         }
-        public GameEventArgs(int m_UserSelect, int m_ComSelect, Results m_GameResult)
+        private GameEventArgs(int m_UserSelect, int m_ComSelect, Results m_GameResult)
         {
             UserSelect = m_UserSelect;
             ComSelect = m_ComSelect;
             GameResult = m_GameResult;
         }

-        internal void SetGameResult(Results m_GameResult)
+        public void SetGameResult(Results m_GameResult)
         {
             GameResult = m_GameResult;
         }
-    }
-}
+    }
+}


Fixed init

Fixed init

--- src/Draw2D/Editor/EditContainerView.cs
+++ src/Draw2D/Editor/EditContainerView.cs
@@ -440,9 +440,18 @@

             var containerViews = new ObservableCollection<IContainerView>();

-            containerViews.Add(CreateContainerView("View0"));
-            containerViews.Add(CreateContainerView("View1"));
-            containerViews.Add(CreateContainerView("View2"));
+            var containerView0 = CreateContainerView("View0");
+            InitContainerView(containerView0);
+
+            var containerView1 = CreateContainerView("View1");
+            InitContainerView(containerView1);
+
+            var containerView2 = CreateContainerView("View2");
+            InitContainerView(containerView2);
+
+            containerViews.Add(containerView0);
+            containerViews.Add(containerView1);
+            containerViews.Add(containerView1);

             ContainerViews = containerViews;
             ContainerView = containerViews.FirstOrDefault();
@@ -510,6 +519,20 @@
             }
         }

+        public void AddContainerView(IContainerView containerView)
+        {
+            if (containerView != null)
+            {
+                CurrentTool.Clean(this);
+                ContainerView?.Selection.Selected.Clear();
+
+                ContainerViews.Add(containerView);
+                ContainerView = containerView;
+
+                ContainerView?.InputService?.Redraw?.Invoke();
+            }
+        }
+
         public void CloseContainerView(IContainerView containerView)
         {
             if (containerView != null)
@@ -537,17 +560,6 @@
                 containerView.HitTest = null;
                 containerView.WorkingContainer = null;
             }
-        }
-
-        private void AddContainerView(IContainerView containerView)
-        {
-            CurrentTool.Clean(this);
-            ContainerView?.Selection.Selected.Clear();
-
-            ContainerViews.Add(containerView);
-            ContainerView = containerView;
-
-            ContainerView?.InputService?.Redraw?.Invoke();
         }

         public void NewContainerView()


Util: Add generic SqlCommandToString() method

--- Util/util.cs
+++ Util/util.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Data;
+using System.Data.SqlClient;
 using System.Windows.Forms;
 using System.Collections.Generic;

@@ -91,4 +92,18 @@
     {
         return "D3-" + Part_num.ToString("D7");
     }
+
+    public static string SqlCommandToString(IDbCommand cmd)
+    {
+        string str;
+        if (cmd == null) {
+            str = "null";
+        } else {
+            str = cmd.CommandText;
+            foreach (IDataParameter p in cmd.Parameters) {
+                str = str.Replace(p.ParameterName, p.Value.ToString());
+            }
+        }
+        return str;
+    }
 }


Channel.Joinメソッドの実装を変更

Channel.Joinメソッドの実装を変更

--- src/Channel.cs
+++ src/Channel.cs
@@ -38,12 +38,10 @@

         public static void Join<T>(T[] lch, T[] rch, T[] dest)
         {
-            for (int i = 0; i < dest.Length; i++)
+            for (int i = 0, j = 0; i < dest.Length; j++)
             {
-                if ((i & 1) == 0)
-                    dest[i] = lch[i / 2];
-                else
-                    dest[i] = rch[i / 2];
+                dest[i++] = lch[j];
+                dest[i++] = rch[j];
             }
         }
         #endregion


added calendar heat map to home page

added calendar heat map to home page

--- src/FWServices/Views/Home/Index.cshtml
+++ src/FWServices/Views/Home/Index.cshtml
@@ -9,34 +9,68 @@

 }
+

Active Features

-

-        @foreach (var group in ViewBag.Features.Keys)
-        {
-
@group

-            foreach (var feature in ViewBag.Features[group])
-            {
-

-

-                        @feature.Sparkline
-                        @feature.Name
-                        [Edit]
-

-
@feature.Notes

-

-                        Group:
-                        <input type="text" name="group" id="group_@(feature.Name)" value="@feature.Group"/>
-                        Notes:
-                        <textarea id="notes_@(feature.Name)" name="notes">@feature.Notes</textarea>
-

-                        <button id="close">Close</button>
-                        <button id="save">Save</button>
-

-

+

+

+

+            @foreach (var group in ViewBag.Features.Keys)
+            {
+
@group

+                foreach (var feature in ViewBag.Features[group])
+                {
+

+

+                            @feature.Sparkline
+                            @feature.Name
+                            [Edit]
+

+
@feature.Notes

+

+                            Group:
+                            <input type="text" name="group" id="group_@(feature.Name)" value="@feature.Group"/>
+                            Notes:
+                            <textarea id="notes_@(feature.Name)" name="notes">@feature.Notes</textarea>
+

+                            <button id="close">Close</button>
+                            <button id="save">Save</button>
+

+

+                }
             }
-        }
-

-
+

+

+

+

+

+

 @section scripts {

 }


update code to latest version

update code to latest version

update code to latest version

--- src/HtmlAgilityPack.Shared/HtmlNode.cs
+++ src/HtmlAgilityPack.Shared/HtmlNode.cs
@@ -978,7 +978,7 @@
             // child nodes
             foreach (HtmlNode child in _childnodes)
             {
-                HtmlNode newchild = child.Clone();
+                HtmlNode newchild = child.CloneNode(deep);
                 node.AppendChild(newchild);
             }

@@ -1774,6 +1774,10 @@
                             {
                                 outText.Write("></" + name + ">");
                             }
+                            else
+                            {
+                                outText.Write(">");
+                            }
                         }
                     }

@@ -2300,7 +2304,7 @@

             foreach (var att in classAttributes)
             {
-                var classNames = att.Value.Split(new string[] {" "}, StringSplitOptions.RemoveEmptyEntries);
+                var classNames = att.Value.Split(null as char[], StringSplitOptions.RemoveEmptyEntries);

                 foreach (var className in classNames)
                 {
@@ -2318,7 +2322,7 @@

             foreach (var @class in classes)
             {
-                var classNames = @class.Split(' ');
+                var classNames = @class.Split(null as char[], StringSplitOptions.RemoveEmptyEntries);
                 foreach (var theClassName in classNames)
                 {
                     if (theClassName == className)


More realistic ModelMapper

More realistic ModelMapper

--- src/II.Tests/TestsSimpleModelMapper.cs
+++ src/II.Tests/TestsSimpleModelMapper.cs
@@ -29,6 +29,14 @@
             : base(mappingAssemblies)
         {
         }
+
+        /// <inheritdoc />
+        protected override int? ClassBatchSize
+            => 10;
+
+        /// <inheritdoc />
+        protected override int? CollectionBatchSize
+            => ClassBatchSize;

         protected override string DefaultSchemaName
             => @"dbo";


Reduced some message spam

Reduced some message spam

Former-commit-id: 76dc827a41b24e75a52cf1a7362b5e2e9d2dee6c

--- MassTransit.ServiceBus/Internal/MessageQueueReceiver.cs
+++ MassTransit.ServiceBus/Internal/MessageQueueReceiver.cs
@@ -91,25 +91,31 @@

 		private void Start()
 		{
-			_queue = _endpoint.Open(QueueAccessMode.SendAndReceive);
-
-			_monitorThread = new Thread(MonitorQueue);
-			_monitorThread.Start();
+			lock (this)
+			{
+				_queue = _endpoint.Open(QueueAccessMode.SendAndReceive);
+
+				_monitorThread = new Thread(MonitorQueue);
+				_monitorThread.Start();
+			}
 		}

 		private void Stop()
 		{
-			if (_queue != null)
-			{
-				_queue.Close();
-				_queue.Dispose();
-				_queue = null;
-			}
-
-			if (_monitorThread != null)
-			{
-				_monitorThread.Join(TimeSpan.FromSeconds(10));
-				_monitorThread = null;
+			lock (this)
+			{
+				if (_queue != null)
+				{
+					_queue.Close();
+					_queue.Dispose();
+					_queue = null;
+				}
+
+				if (_monitorThread != null)
+				{
+					_monitorThread.Join(TimeSpan.FromSeconds(10));
+					_monitorThread = null;
+				}
 			}
 		}

@@ -159,14 +165,14 @@
 								{
 									IEnvelope e = EnvelopeMessageMapper.MapFrom(msg);

-									if (_messageLog.IsInfoEnabled)
-										_messageLog.InfoFormat("Received message {0} from {1}", e.Messages[0].GetType(), e.ReturnEndpoint.Uri);
-
 									if (_consumer.IsHandled(e))
 									{
 										Message received = enumerator.RemoveCurrent(TimeSpan.FromSeconds(1));
 										if (received.Id == msg.Id)
 										{
+											if (_messageLog.IsInfoEnabled)
+												_messageLog.InfoFormat("Received message {0} from {1}", e.Messages[0].GetType(), e.ReturnEndpoint.Uri);
+
 											ThreadPool.QueueUserWorkItem(ProcessMessage, e);
 											break;
 										}
@@ -189,6 +195,20 @@
 					{
 						//we don't log this because it isn't exceptional
 					}
+					else if (ex.MessageQueueErrorCode == MessageQueueErrorCode.QueueNotFound)
+					{
+						if(_log.IsErrorEnabled)
+							_log.Error("The message queue does not exist", ex);
+
+						ThreadPool.QueueUserWorkItem(delegate { Stop(); });
+					}
+					else if (ex.MessageQueueErrorCode == MessageQueueErrorCode.MessageAlreadyReceived)
+					{
+						// we are competing with another consumer, no reason to report an error since
+						// the message has already been handled.
+						if(_log.IsDebugEnabled)
+							_log.DebugFormat("Message received by another receiver before it could be retrieved");
+					}
 					else
 					{
 						if (_log.IsErrorEnabled)


Better input handling (incorrect function and variable assigment).

--- MathExpressionSolver/MathExpressionSolver/Controller.cs
+++ MathExpressionSolver/MathExpressionSolver/Controller.cs
@@ -30,7 +30,7 @@
         /// </summary>
         /// <param name="expression">Expression whose top <see cref="IToken{T}"/> is wanted.</param>
         /// <exception cref="InvalidOperationException">Some object has not been properly inicialized.</exception>
-        /// <exception cref="TokenizerException">Expression can't be properly tokenized.</exception>
+        /// <exception cref="ControllerException">Expression can't be properly tokenized.</exception>
         /// <exception cref="ExpTreeBuilderException">Expression tree can't be build.</exception>
         /// <returns>Top <see cref="IToken{T}"/> of specified expression.</returns>
         public IToken<T> ReturnExpressionTopToken(string expression)
@@ -55,7 +55,7 @@
         /// </summary>
         /// <param name="expression">Expression whose result is wanted.</param>
         /// <exception cref="InvalidOperationException">Some object has not been properly inicialized.</exception>
-        /// <exception cref="TokenizerException">Expression can't be properly tokenized.</exception>
+        /// <exception cref="ControllerException">Expression can't be properly tokenized.</exception>
         /// <exception cref="ExpTreeBuilderException">Expression tree can't be build.</exception>
         /// <returns>Result of specified expression.</returns>
         public T ReturnResult(string expression)
@@ -70,7 +70,7 @@
         /// <param name="variableName">Custom variable name.</param>
         /// <param name="expression">An expression whose result is to be set as a value of the variable.</param>
         /// <exception cref="InvalidOperationException">Some object has not been properly inicialized.</exception>
-        /// <exception cref="TokenizerException">Expression can't be properly tokenized.</exception>
+        /// <exception cref="ControllerException">Expression can't be properly tokenized.</exception>
         /// <exception cref="ExpTreeBuilderException">Expression tree can't be build.</exception>
         /// <returns>String in a form of "variableName = variableValue".</returns>
         public T SaveVariable(string variableName, string expression)
@@ -90,7 +90,7 @@
         /// <param name="expression">An expression describing what the function will do.</param>
         /// <param name="argumentsNames">An array of argument descriptors (names).</param>
         /// <exception cref="InvalidOperationException">Some object has not been properly inicialized.</exception>
-        /// <exception cref="TokenizerException">Expression can't be properly tokenized.</exception>
+        /// <exception cref="ControllerException">Expression can't be properly tokenized.</exception>
         /// <exception cref="ExpTreeBuilderException">Expression tree can't be build.</exception>
         public void SaveFunction(string funcName, string expression, string[] argumentsNames)
         {
@@ -115,29 +115,35 @@
         /// </summary>
         /// <param name="expression">An expression to be executed.</param>
         /// <exception cref="InvalidOperationException">Some object has not been properly inicialized.</exception>
-        /// <exception cref="TokenizerException">Expression can't be properly tokenized.</exception>
+        /// <exception cref="ControllerException">Expression can't be properly tokenized.</exception>
         /// <exception cref="ExpTreeBuilderException">Expression tree can't be build.</exception>
         /// <returns>String with information about expression result.</returns>
         public string ExecuteExpression(string expression)
         {

+            string possVariableRegex = @"^[^\(\)]+=.*$";
+            string possFuncRegex = @"^.+\(.+=.*$";
+
             string exprRegex = @"\s*=\s*(?<expr>.*)";
             string nameRegex = @"(\p{Ll}|\p{Lu}|\p{Lt}|\p{Lo}|\p{Lm}|_)+";
-            Match custVar = Regex.Match(expression, @"^(?<varName>" + nameRegex + @")" + exprRegex);
-
-            string argumentsRegex = @"((?<argName>" + nameRegex + @")(;)?|(;\s)?)+";
-            Match custFunc = Regex.Match(expression, @"^(?<funcName>" + nameRegex + @")\(" + argumentsRegex + @"\)" + exprRegex);
-
-            if (custVar.Success)
-            {
+
+            if (Regex.IsMatch(expression, possVariableRegex))
+            {
+                Match custVar = Regex.Match(expression, @"^(?<varName>" + nameRegex + @")" + exprRegex + "$");
+                if (!custVar.Success) { throw new ControllerException("Given expression is not a valid variable assigment."); }
+
                 string variableName = custVar.Groups["varName"].Value;
                 string variableExpression = custVar.Groups["expr"].Value;

                 string variableValue = SaveVariable(variableName, variableExpression).ToString();
                 return variableName + " = " + variableValue;
             }
-            else if (custFunc.Success)
-            {
+            else if (Regex.IsMatch(expression, possFuncRegex))
+            {
+                string argumentsRegex = @"((?<argName>" + nameRegex + @")(;)?|(;\s)?)+";
+                Match custFunc = Regex.Match(expression, @"^(?<funcName>" + nameRegex + @")\(" + argumentsRegex + @"\)" + exprRegex + "$");
+                if(!custFunc.Success) { throw new ControllerException("Given expression is not a valid custom function assigment."); }
+
                 string funcName = custFunc.Groups["funcName"].Value;
                 string funcExpression = custFunc.Groups["expr"].Value;
                 string[] argumentsNames = custFunc.Groups["argName"].Captures.ToArray();
@@ -179,4 +185,16 @@
             }
         }
     }
+
+    [System.Serializable]
+    public class ControllerException : ExpressionException
+    {
+        public ControllerException() { }
+        public ControllerException(string message) : base(message) { }
+        public ControllerException(string message, System.Exception inner) : base(message, inner) { }
+        protected ControllerException(
+          System.Runtime.Serialization.SerializationInfo info,
+          System.Runtime.Serialization.StreamingContext context) : base(info, context)
+        { }
+    }
 }


Scale bugfix

Scale bugfix

--- Game1/Game1/Game1Factory.cs
+++ Game1/Game1/Game1Factory.cs
@@ -182,7 +182,7 @@
             sprite.GetComponent<PositionComp>().Position = TTFactory.BuildScreen.Center;
             sprite.GetComponent<SpriteComp>().CenterToMiddle();
             var sc = new ScaleComp();
-            sc.Scale = 12;
+            sc.Scale = 1;
             sprite.AddComponent(sc);
             return sprite;
         }