Add CreateTicTacToeTrainer

Add CreateTicTacToeTrainer

--- Sigma.Tests.Internals.WPF/Program.cs
+++ Sigma.Tests.Internals.WPF/Program.cs
@@ -43,6 +43,8 @@
 using Sigma.Core.Monitors;
 using Sigma.Core.Monitors.WPF.Panels.Games.TicTacToe;
 using Sigma.Core.Monitors.WPF.Utils.Defaults.MNIST;
+using Sigma.Core.Training.Hooks;
+using Sigma.Core.Training.Hooks.Saviors;

 namespace Sigma.Tests.Internals.WPF
 {
@@ -389,6 +391,36 @@
 			return trainer;
 		}

+		public static ITrainer CreateTicTacToeTrainer(SigmaEnvironment sigma)
+		{
+			IDataset dataset = Defaults.Datasets.TicTacToe();
+
+			ITrainer trainer = sigma.CreateTrainer("tictactoe-trainer");
+
+			trainer.Network = new Network();
+			trainer.Network.Architecture = InputLayer.Construct(9)
+											+ FullyConnectedLayer.Construct(72, "tanh")
+											+ FullyConnectedLayer.Construct(99, "tanh")
+											+ FullyConnectedLayer.Construct(3, "tanh")
+											+ OutputLayer.Construct(3)
+											+ SoftMaxCrossEntropyCostLayer.Construct();
+
+			trainer.TrainingDataIterator = new MinibatchIterator(21, dataset);
+			trainer.AddNamedDataIterator("validation", new UndividedIterator(dataset));
+			trainer.Optimiser = new MomentumGradientOptimiser(learningRate: 0.01, momentum: 0.9);
+			trainer.Operator = new CpuSinglethreadedOperator();
+
+			trainer.AddInitialiser("*.*", new GaussianInitialiser(standardDeviation: 0.1));
+
+			trainer.AddLocalHook(new AccumulatedValueReporter("optimiser.cost_total", TimeStep.Every(1, TimeScale.Epoch)));
+			trainer.AddHook(new MultiClassificationAccuracyReporter("validation", TimeStep.Every(1, TimeScale.Epoch), tops: new[] { 1, 2 }));
+
+			trainer.AddGlobalHook(new DiskSaviorHook<INetwork>(TimeStep.Every(1, TimeScale.Epoch), "network.self", Namers.Static("tictactoe.sgnet"), verbose: true)
+				.On(new ExtremaCriteria("shared.classification_accuracy_top1", ExtremaTarget.Max)));
+
+			return trainer;
+		}
+
 		private static TrainerChartPanel<TChart, TSeries, TChartValues, TData> CreateChartPanel<TChart, TSeries, TChartValues, TData>(string title, ITrainer trainer, string hookedValue, ITimeStep timestep, bool averageMode = false) where TChart : Chart, new() where TSeries : Series, new() where TChartValues : IList<TData>, IChartValues, new()
 		{
 			var panel = new TrainerChartPanel<TChart, TSeries, TChartValues, TData>(title, trainer, hookedValue, timestep, averageMode);


add SynchronizeProgressForeach

add SynchronizeProgressForeach

--- Signum.Engine/Engine/Synchronizer.cs
+++ Signum.Engine/Engine/Synchronizer.cs
@@ -47,6 +47,41 @@
             }
         }

+        public static void SynchronizeProgressForeach<K, N, O>(
+          Dictionary<K, N> newDictionary,
+          Dictionary<K, O> oldDictionary,
+          Action<K, N> createNew,
+          Action<K, O> removeOld,
+          Action<K, N, O> merge)
+            where O : class
+            where N : class
+        {
+            HashSet<K> keys = new HashSet<K>();
+            keys.UnionWith(oldDictionary.Keys);
+            keys.UnionWith(newDictionary.Keys);
+            keys.ProgressForeach(key => key.ToString(), key =>
+            {
+                var oldVal = oldDictionary.TryGetC(key);
+                var newVal = newDictionary.TryGetC(key);
+
+                if (oldVal == null)
+                {
+                    if (createNew != null)
+                        createNew(key, newVal);
+                }
+                else if (newVal == null)
+                {
+                    if (removeOld != null)
+                        removeOld(key, oldVal);
+                }
+                else
+                {
+                    if (merge != null)
+                        merge(key, newVal, oldVal);
+                }
+            });
+        }
+
         public static void SynchronizeReplacing<N, O>(
           Replacements replacements,
           string replacementsKey,


Notificaciones

Notificaciones

--- Signum.Web/HtmlHelpers/MenuHelper.cs
+++ Signum.Web/HtmlHelpers/MenuHelper.cs
@@ -119,11 +119,16 @@
                     {
                         if (Link != null)
                         {
-                            sb.AddLine(new HtmlTag("a")
+                            HtmlTag htA = new HtmlTag("a")
                                              .Attrs(new { onmouseover = "", title = Title, href = Link.ToString(), id = Id })
-                                             .Class(Class)
-                                             .SetInnerText(Text)
-                                             .ToHtml());
+                                             .Class(Class);
+
+                            if (!MvcHtmlString.IsNullOrEmpty(html))
+                                htA.InnerHtml(html);
+                            else
+                                htA.SetInnerText(Text);
+
+                            sb.AddLine(htA.ToHtml());
                         }
                         else
                         {


Corrected documentation for HandleModelShutdown.

--- src/Brokers/RabbitMQ/RestBus.RabbitMQ/Consumer/ConcurrentQueueingConsumer.cs
+++ src/Brokers/RabbitMQ/RestBus.RabbitMQ/Consumer/ConcurrentQueueingConsumer.cs
@@ -98,6 +98,14 @@
             IsRunning = true;
         }

+        /// <summary>
+        /// Called each time a message arrives for this consumer.
+        /// </summary>
+        /// <remarks>
+        /// Does nothing with the passed in information.
+        /// Note that in particular, some delivered messages may require acknowledgement via <see cref="IModel.BasicAck"/>.
+        /// The implementation of this method in this class does NOT acknowledge such messages.
+        /// </remarks>
         public void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, byte[] body)
         {
             if (_isClosed) return;
@@ -115,14 +123,12 @@
             _queue.Enqueue(eventArgs);
         }

+
         /// <summary>
-        /// Called each time a message arrives for this consumer.
-        /// </summary>
-        /// <remarks>
-        /// Does nothing with the passed in information.
-        /// Note that in particular, some delivered messages may require acknowledgement via <see cref="IModel.BasicAck"/>.
-        /// The implementation of this method in this class does NOT acknowledge such messages.
-        /// </remarks>
+        ///  Called when the model shuts down.
+        ///  </summary>
+        ///  <param name="model"> Common AMQP model.</param>
+        /// <param name="reason"> Information about the reason why a particular model, session, or connection was destroyed.</param>///
         public void HandleModelShutdown(object model, ShutdownEventArgs reason)
         {
             ShutdownReason = reason;


Use static logs, reformat whitespace, change to use FromJson<T> convenience method

--- src/DiscourseAutoApprove/DiscourseAutoApprove.ServiceInterface/MyServices.cs
+++ src/DiscourseAutoApprove/DiscourseAutoApprove.ServiceInterface/MyServices.cs
@@ -14,6 +14,8 @@
 {
     public class MyServices : Service
     {
+        private static ILog log = LogManager.GetLogger(typeof(MyServices));
+
         public IAppSettings AppSettings { get; set; }
         public IDiscourseClient DiscourseClient { get; set; }
         public IServiceStackAccountClient ServiceStackAccountClient { get; set; }
@@ -34,61 +36,60 @@

         public object Any(SyncServiceStackCustomers request)
         {
-                var log = LogManager.GetLogger(GetType());
-                var users = DiscourseClient.AdminGetUsers();
-                foreach (var user in users)
-                {
-                    //Don't process discourse administrators
-                    if (user.Admin)
-                    {
-                        continue;
-                    }
-
-                    UserServiceResponse existingCustomerSubscription;
+            var users = DiscourseClient.AdminGetUsers();
+            foreach (var user in users)
+            {
+                //Don't process discourse administrators
+                if (user.Admin)
+                {
+                    continue;
+                }
+
+                UserServiceResponse existingCustomerSubscription;
+                try
+                {
+                    existingCustomerSubscription = ServiceStackAccountClient.GetUserSubscription(user.Email);
+                }
+                catch (Exception e)
+                {
+                    log.Error("Failed to check user's subscription. Retrying... - {0}".Fmt(e.Message));
                     try
                     {
                         existingCustomerSubscription = ServiceStackAccountClient.GetUserSubscription(user.Email);
                     }
-                    catch (Exception e)
-                    {
-                        log.Error("Failed to check user's subscription. Retrying... - {0}".Fmt(e.Message));
-                        try
-                        {
-                            existingCustomerSubscription = ServiceStackAccountClient.GetUserSubscription(user.Email);
-                        }
-                        catch (Exception ex)
-                        {
-                            log.Error("Failed to check user's subscription. Cancelling sync. - {0}".Fmt(ex.Message));
-                            break;
-                        }
-                    }
-
-                    try
-                    {
-                        Thread.Sleep(2000);
-                        if (UserNeedsApproval(user) && UserHasValidSubscription(existingCustomerSubscription))
-                        {
-                            log.Info("Approving user '{0}'.".Fmt(user.Email));
-                            ApproveUser(user);
-                        }
-
-                        if (!UserNeedsApproval(user) && !UserHasValidSubscription(existingCustomerSubscription))
-                        {
-                            log.Info("Suspending user '{0}'.".Fmt(user.Email));
-                            SuspendUser(user);
-                        }
-
-                        if (!UserNeedsApproval(user) && user.Suspended == true)
-                        {
-                            log.Info("Unsuspending user '{0}'.".Fmt(user.Email));
-                            UnsuspendUser(user);
-                        }
-                    }
-                    catch (Exception e)
-                    {
-                        log.Error("Failed to update Discourse for user '{0}'. - {1}".Fmt(user.Email, e.Message));
-                    }
-                }
+                    catch (Exception ex)
+                    {
+                        log.Error("Failed to check user's subscription. Cancelling sync. - {0}".Fmt(ex.Message));
+                        break;
+                    }
+                }
+
+                try
+                {
+                    Thread.Sleep(2000);
+                    if (UserNeedsApproval(user) && UserHasValidSubscription(existingCustomerSubscription))
+                    {
+                        log.Info("Approving user '{0}'.".Fmt(user.Email));
+                        ApproveUser(user);
+                    }
+
+                    if (!UserNeedsApproval(user) && !UserHasValidSubscription(existingCustomerSubscription))
+                    {
+                        log.Info("Suspending user '{0}'.".Fmt(user.Email));
+                        SuspendUser(user);
+                    }
+
+                    if (!UserNeedsApproval(user) && user.Suspended == true)
+                    {
+                        log.Info("Unsuspending user '{0}'.".Fmt(user.Email));
+                        UnsuspendUser(user);
+                    }
+                }
+                catch (Exception e)
+                {
+                    log.Error("Failed to update Discourse for user '{0}'. - {1}".Fmt(user.Email, e.Message));
+                }
+            }
             return null;
         }

@@ -107,8 +108,6 @@

         public object Post(UserCreatedDiscourseWebHook request)
         {
-            ILog log = LogManager.GetLogger(GetType());
-
             var rawString = request.RequestStream.ToUtf8String();
             log.Info("User registered hook fired. \r\n\r\n" + rawString);
             string apiKey = GetApiKeyFromRequest(rawString);
@@ -137,14 +136,13 @@
         {
             Thread.Sleep(3000);
             var discourseUser = user as DiscourseUser;
-
+
             try
             {
                 ApproveUser(discourseUser);
             }
             catch (Exception e)
             {
-                ILog log = LogManager.GetLogger(GetType());
                 log.Error(discourseUser != null
                     ? "Error approving user {0} \r\n\r\n {1}".Fmt(discourseUser.Email, e.Message)
                     : "Error approving user {0} \r\n\r\n Discourse user null");
@@ -227,6 +225,8 @@

     public class ServiceStackAccountClient : IServiceStackAccountClient
     {
+        private static ILog log = LogManager.GetLogger(typeof(ServiceStackAccountClient));
+
         private readonly string serviceUrl;
         public ServiceStackAccountClient(string url)
         {
@@ -238,12 +238,11 @@
             UserServiceResponse result = null;
             try
             {
-                result = JsonSerializer.DeserializeFromString<UserServiceResponse>(
-                                serviceUrl.Fmt(emailAddress).GetJsonFromUrl());
+                result = serviceUrl.Fmt(emailAddress).GetJsonFromUrl()
+                    .FromJson<UserServiceResponse>();
             }
             catch (Exception e)
             {
-                ILog log = LogManager.GetLogger(GetType());
                 log.Error(e.Message);
             }


Add greater than expiry

Add greater than expiry

--- src/DiscourseAutoApprove/DiscourseAutoApprove.ServiceInterface/MyServices.cs
+++ src/DiscourseAutoApprove/DiscourseAutoApprove.ServiceInterface/MyServices.cs
@@ -47,7 +47,8 @@
                 log.Info("User email: {0}".Fmt(discourseUser.Email));
                 var existingCustomerSubscription = ServiceStackAccountClient.GetUserSubscription(discourseUser.Email);
                 if (existingCustomerSubscription != null &&
-                    existingCustomerSubscription.Expiry != null)
+                    existingCustomerSubscription.Expiry != null &&
+                    existingCustomerSubscription.Expiry > DateTime.Now)
                 {
                     log.Info("User {0} with email {1} did have a valid subscription. Approving.".Fmt(discourseUser.Id, discourseUser.Email));
                     try


Clean up more code.

Clean up more code.

--- src/EditorFeatures/Core/Implementation/Suggestions/SuggestedActionsSource.cs
+++ src/EditorFeatures/Core/Implementation/Suggestions/SuggestedActionsSource.cs
@@ -42,6 +42,8 @@
             private Workspace _workspace;
             private int _lastSolutionVersionReported;

+            public event EventHandler<EventArgs> SuggestedActionsChanged;
+
             public SuggestedActionsSource(SuggestedActionsSourceProvider owner, ITextView textView, ITextBuffer textBuffer)
             {
                 _owner = owner;
@@ -64,7 +66,37 @@
                 _registration.WorkspaceChanged += OnWorkspaceChanged;
             }

-            public event EventHandler<EventArgs> SuggestedActionsChanged;
+            public void Dispose()
+            {
+                if (_owner != null)
+                {
+                    var updateSource = (IDiagnosticUpdateSource)_owner._diagnosticService;
+                    updateSource.DiagnosticsUpdated -= OnDiagnosticsUpdated;
+                }
+
+                if (_workspace != null)
+                {
+                    _workspace.DocumentActiveContextChanged -= OnActiveContextChanged;
+                }
+
+                if (_registration != null)
+                {
+                    _registration.WorkspaceChanged -= OnWorkspaceChanged;
+                }
+
+                if (_textView != null)
+                {
+                    _textView.Closed -= OnTextViewClosed;
+                }
+
+                _owner = null;
+                _workspace = null;
+                _registration = null;
+                _textView = null;
+                _subjectBuffer = null;
+            }
+
+            private bool IsDisposed => _subjectBuffer == null;

             public bool TryGetTelemetryId(out Guid telemetryId)
             {
@@ -110,6 +142,11 @@
                 CancellationToken cancellationToken)
             {
                 AssertIsForeground();
+
+                if (IsDisposed)
+                {
+                    return null;
+                }

                 using (Logger.LogBlock(FunctionId.SuggestedActions_GetSuggestedActions, cancellationToken))
                 {
@@ -529,7 +566,7 @@
                     requestedActionCategories.Contains(PredefinedSuggestedActionCategoryNames.Refactoring))
                 {
                     // Get the selection while on the UI thread.
-                    var selection = TryGetCodeRefactoringSelection(_subjectBuffer, _textView, range);
+                    var selection = TryGetCodeRefactoringSelection(range);
                     if (!selection.HasValue)
                     {
                         // this is here to fail test and see why it is failed.
@@ -590,36 +627,38 @@

             public async Task<bool> HasSuggestedActionsAsync(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, CancellationToken cancellationToken)
             {
-                // Explicitly hold onto below fields in locals and use these locals throughout this code path to avoid crashes
-                // if these fields happen to be cleared by Dispose() below. This is required since this code path involves
-                // code that can run asynchronously from background thread.
-                var view = _textView;
-                var buffer = _subjectBuffer;
                 var provider = _owner;

-                if (view == null || buffer == null || provider == null)
-                {
+                if (IsDisposed)
+                {
+                    // We've already been disposed.  No point in continuing.
                     return false;
                 }

-                using (var asyncToken = provider.OperationListener.BeginAsyncOperation("HasSuggestedActionsAsync"))
+                using (var asyncToken = _owner.OperationListener.BeginAsyncOperation("HasSuggestedActionsAsync"))
                 {
                     // Acquire the user's selection up front, before we do any async work, so that we can
                     // directly grab it when we're on the UI thread.  That way we don't have any reentrancy
                     // blocking concerns if VS wants to block on this call (for example, if the user
                     // explicitly invokes the 'show smart tag' command).
+                    //
+                    // This work must happen on the UI thread as it needs to access the _textView's mutable
+                    // state.
                     TextSpan? selection = null;
                     if (IsForeground())
                     {
-                        // This operation needs to happen on UI thread because it needs to access textView.Selection.
-                        selection = TryGetCodeRefactoringSelection(buffer, view, range);
+                        selection = TryGetCodeRefactoringSelection(range);
                     }
                     else
                     {
                         await InvokeBelowInputPriority(() =>
                         {
-                            // This operation needs to happen on UI thread because it needs to access textView.Selection.
-                            selection = TryGetCodeRefactoringSelection(buffer, view, range);
+                            if (IsDisposed)
+                            {
+                                return;
+                            }
+
+                            selection = TryGetCodeRefactoringSelection(range);
                         }).ConfigureAwait(false);
                     }

@@ -700,11 +739,14 @@
                 return false;
             }

-            private static TextSpan? TryGetCodeRefactoringSelection(ITextBuffer buffer, ITextView view, SnapshotSpan range)
-            {
-                var selectedSpans = view.Selection.SelectedSpans
-                    .SelectMany(ss => view.BufferGraph.MapDownToBuffer(ss, SpanTrackingMode.EdgeExclusive, buffer))
-                    .Where(ss => !view.IsReadOnlyOnSurfaceBuffer(ss))
+            private TextSpan? TryGetCodeRefactoringSelection(SnapshotSpan range)
+            {
+                this.AssertIsForeground();
+                Debug.Assert(!this.IsDisposed);
+
+                var selectedSpans = _textView.Selection.SelectedSpans
+                    .SelectMany(ss => _textView.BufferGraph.MapDownToBuffer(ss, SpanTrackingMode.EdgeExclusive, _subjectBuffer))
+                    .Where(ss => !_textView.IsReadOnlyOnSurfaceBuffer(ss))
                     .ToList();

                 // We only support refactorings when there is a single selection in the document.
@@ -833,39 +875,6 @@

                 Volatile.Write(ref _lastSolutionVersionReported, solutionVersion);
             }
-
-            public void Dispose()
-            {
-                if (_owner != null)
-                {
-                    var updateSource = (IDiagnosticUpdateSource)_owner._diagnosticService;
-                    updateSource.DiagnosticsUpdated -= OnDiagnosticsUpdated;
-                    _owner = null;
-                }
-
-                if (_workspace != null)
-                {
-                    _workspace.DocumentActiveContextChanged -= OnActiveContextChanged;
-                    _workspace = null;
-                }
-
-                if (_registration != null)
-                {
-                    _registration.WorkspaceChanged -= OnWorkspaceChanged;
-                    _registration = null;
-                }
-
-                if (_textView != null)
-                {
-                    _textView.Closed -= OnTextViewClosed;
-                    _textView = null;
-                }
-
-                if (_subjectBuffer != null)
-                {
-                    _subjectBuffer = null;
-                }
-            }
         }
     }
 }


Fix: IQueryProcessor as transient instance

--- Source/EventFlow/EventFlowOptions.cs
+++ Source/EventFlow/EventFlowOptions.cs
@@ -203,7 +203,7 @@
             serviceRegistration.Register<IReadModelPopulator, ReadModelPopulator>();
             serviceRegistration.Register<IEventJsonSerializer, EventJsonSerializer>();
             serviceRegistration.Register<IEventDefinitionService, EventDefinitionService>(Lifetime.Singleton);
-            serviceRegistration.Register<IQueryProcessor, QueryProcessor>(Lifetime.Singleton);
+            serviceRegistration.Register<IQueryProcessor, QueryProcessor>();
             serviceRegistration.Register<IJsonSerializer, JsonSerializer>();
             serviceRegistration.Register<IJobScheduler, InstantJobScheduler>();
             serviceRegistration.Register<IJobRunner, JobRunner>();


Allowed to pass lifetime on registrations during configuration

--- Source/EventFlow/EventFlowOptions.cs
+++ Source/EventFlow/EventFlowOptions.cs
@@ -53,16 +53,16 @@
             return this;
         }

-        public EventFlowOptions UseEventStore(Func<IResolver, IEventStore> eventStoreResolver)
+        public EventFlowOptions UseEventStore(Func<IResolver, IEventStore> eventStoreResolver, Lifetime lifetime = Lifetime.AlwaysUnique)
         {
-            AddRegistration(new Registration<IEventStore>(eventStoreResolver));
+            AddRegistration(new Registration<IEventStore>(eventStoreResolver, lifetime));
             return this;
         }

-        public EventFlowOptions UseEventStore<TEventStore>()
+        public EventFlowOptions UseEventStore<TEventStore>(Lifetime lifetime = Lifetime.AlwaysUnique)
             where TEventStore : class, IEventStore
         {
-            AddRegistration(new Registration<IEventStore, TEventStore>());
+            AddRegistration(new Registration<IEventStore, TEventStore>(lifetime));
             return this;
         }

@@ -75,24 +75,24 @@
             return this;
         }

-        public EventFlowOptions AddMetadataProvider<TMetadataProvider>()
+        public EventFlowOptions AddMetadataProvider<TMetadataProvider>(Lifetime lifetime = Lifetime.AlwaysUnique)
             where TMetadataProvider : class, IMetadataProvider
         {
-            AddRegistration(new Registration<IMetadataProvider, TMetadataProvider>());
+            AddRegistration(new Registration<IMetadataProvider, TMetadataProvider>(lifetime));
             return this;
         }

-        public EventFlowOptions AddReadModelStore<TAggregate, TReadModelStore>()
+        public EventFlowOptions AddReadModelStore<TAggregate, TReadModelStore>(Lifetime lifetime = Lifetime.AlwaysUnique)
             where TAggregate : IAggregateRoot
             where TReadModelStore : class, IReadModelStore<TAggregate>
         {
-            if (typeof (TReadModelStore).IsInterface)
+            if (typeof(TReadModelStore).IsInterface)
             {
-                AddRegistration(new Registration<IReadModelStore<TAggregate>>(r => r.Resolve<TReadModelStore>()));
+                AddRegistration(new Registration<IReadModelStore<TAggregate>>(r => r.Resolve<TReadModelStore>(), lifetime));
             }
             else
             {
-                AddRegistration(new Registration<IReadModelStore<TAggregate>, TReadModelStore>());
+                AddRegistration(new Registration<IReadModelStore<TAggregate>, TReadModelStore>(lifetime));
             }

             return this;
@@ -109,7 +109,7 @@

         public EventFlowOptions AddEvents(params Type[] aggregateEventTypes)
         {
-            AddEvents((IEnumerable<Type>) aggregateEventTypes);
+            AddEvents((IEnumerable<Type>)aggregateEventTypes);
             return this;
         }

@@ -117,7 +117,7 @@
         {
             foreach (var aggregateEventType in aggregateEventTypes)
             {
-                if (!typeof (IAggregateEvent).IsAssignableFrom(aggregateEventType))
+                if (!typeof(IAggregateEvent).IsAssignableFrom(aggregateEventType))
                 {
                     throw new ArgumentException(string.Format(
                         "Type {0} is not a {1}",
@@ -137,7 +137,7 @@

         public bool HasRegistration<TService>()
         {
-            var serviceType = typeof (TService);
+            var serviceType = typeof(TService);
             return _registrations.Any(r => r.ServiceType == serviceType);
         }


Filter out some very problematic types for now (non-templated inheriting from templates, weird)

--- src/generator/Main.cs
+++ src/generator/Main.cs
@@ -226,8 +226,16 @@

 		List<Entry> PreprocessClasses (List<Entry> entries)
 		{
+			List<string> filter = new List<string>() {
+				"QItemSelection"
+			};
+
+
 			List<Entry> removed = new List<Entry> (entries.Where (o => (o.type == "Class" || o.type == "Struct") && (o.IsTrue ("incomplete") || !o.HasValue ("name") || (Entry.idlist[o["file"]].name.StartsWith ("/")))));
+			removed.AddRange (entries.Where (o => filter.Contains (o.name)).ToList ());
 			entries.RemoveAll (o => (o.type == "Class" || o.type == "Struct") && (o.IsTrue ("incomplete") || !o.HasValue ("name") || (Entry.idlist[o["file"]].name.StartsWith ("/"))));
+			entries.RemoveAll (o => filter.Contains (o.name));
+

 			foreach (Entry clas in entries.Where (o => o.type == "Class" || o.type == "Struct")) {
 				clas.computedName = clas.name;


Don't need the unit

Don't need the unit

--- Battery-Commander.Web/Events/SUTARequestChanged.cs
+++ Battery-Commander.Web/Events/SUTARequestChanged.cs
@@ -50,7 +50,7 @@
                     .Create()
                     .To(recipients)
                     .BCC("SUTAs@RedLeg.app")
-                    .Subject($"{suta.Soldier.Unit.Name} | SUTA Request {suta.Soldier} - {notification.Event}")
+                    .Subject($"SUTA Request {suta.Soldier} - {notification.Event}")
                     .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Views/SUTA/Email.html", suta)
                     .SendWithErrorCheck();
             }


Fix report reference

Fix report reference

--- Battery-Commander.Web/Jobs/SensitiveItemsReport.cs
+++ Battery-Commander.Web/Jobs/SensitiveItemsReport.cs
@@ -43,8 +43,8 @@
                 emailSvc
                     .To(Recipients)
                     .SetFrom(FROM.EmailAddress, FROM.Name)
-                    .Subject($"{unit.Name} | GREEN 3 1 Sensitive Items | { unit.SensitiveItems.Status}")
-                    .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Views/Reports/Red1_Perstat.cshtml", unit)
+                    .Subject($"{unit.Name} | GREEN 3 Report | { unit.SensitiveItems.Status}")
+                    .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Views/Reports/Green3_SensitiveItems.cshtml", unit)
                     .Send();
             }
         }


[Audiobook] In Dispose, stop listening to event

--- src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
+++ src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookLibrarySource.cs
@@ -305,12 +305,13 @@

         public override void Dispose ()
         {
+            ServiceManager.PlaybackController.SourceChanged -= OnPlaybackSourceChanged;
+            ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
+
             if (Actions != null) {
                 Actions.Dispose ();
                 Actions = null;
             }
-
-            ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);

             base.Dispose ();
         }


Pass around a Document instead of SemanticModel+Workspace again

--- src/Features/Core/Portable/ChangeSignature/AbstractChangeSignatureService.cs
+++ src/Features/Core/Portable/ChangeSignature/AbstractChangeSignatureService.cs
@@ -812,8 +812,7 @@
                         }

                         var expression = await GenerateInferredCallsiteExpressionAsync(
-                                await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false),
-                                document.Project.Solution.Workspace,
+                                document,
                                 position,
                                 addedParameter,
                                 cancellationToken).ConfigureAwait(false);
@@ -919,8 +918,7 @@
         }

         private async Task<SyntaxNode> GenerateInferredCallsiteExpressionAsync(
-            SemanticModel semanticModel,
-            Workspace workspace,
+            Document document,
             int position,
             AddedParameter addedParameter,
             CancellationToken cancellationToken)
@@ -930,8 +928,10 @@
                 return null;
             }

+            var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
+
             var recommendations = await Recommender.GetImmutableRecommendedSymbolsAtPositionAsync(
-                semanticModel, position, workspace, cancellationToken: cancellationToken).ConfigureAwait(false);
+                semanticModel, position, document.Project.Solution.Workspace, cancellationToken: cancellationToken).ConfigureAwait(false);

             var sourceSymbols = recommendations.Where(r => r.IsNonImplicitAndFromSource());
             var orderedLocalAndParameterSymbols = sourceSymbols


Obsolete MockingBuilderFactory

Obsolete MockingBuilderFactory

--- Source/Mock/MockingBuilderFactory.cs
+++ Source/Mock/MockingBuilderFactory.cs
@@ -1,13 +1,17 @@
-namespace LeanTest.Mock
+using System;
+
+namespace LeanTest.Mock
 {
     /// <summary>
     /// Instantiate and initialize a mocking builder to handle IMockForData-based mocks
     /// </summary>
+    [Obsolete]
     public static class MockingBuilderFactory
     {
         /// <summary>
         /// This method is here for backwards compatibility - you can safely call it or not, it will do nothing at all.
         /// </summary>
+        [Obsolete("This method is here for backwards compatibility - you can safely call it or not, it will do nothing at all.")]
         public static void Initialize() {}
     }
 }


Create method PrintLogo()

Create method PrintLogo()

--- C#Development/BashSoft/BashSoft/IO/OutputWriter.cs
+++ C#Development/BashSoft/BashSoft/IO/OutputWriter.cs
@@ -8,6 +8,32 @@
     /// </summary>
     public static class OutputWriter
     {
+        /// <summary>
+        /// Print logo in console.
+        /// </summary>
+        public static void PrintLogo()
+        {
+            var newLine = Environment.NewLine;
+            var logo = new[]
+            {
+                @" ____            _      _____        __ _ ",
+                @"|  _ \          | |    / ____|      / _| |",
+                @"| |_) | ____ ___| |__ | (___   ___ | |_| |_",
+                @"|  _ < / _` / __| '_ \ \___ \ / _ \|  _| __|",
+                @"| |_) | (_| \__ \ | | |____) | (_) | | | |",
+                @"|____/ \__,_|___/_| |_|_____/ \___/|_|  \__|"
+            };
+
+            Console.WindowWidth = 100;
+
+            foreach (var line in logo)
+            {
+                Console.WriteLine(line);
+            }
+
+            Console.WriteLine(newLine, newLine);
+        }
+
         /// <summary>
         /// Print message on line.
         /// </summary>


support converter parameter in compiled binding should fix #5030

--- src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindingExtension.cs
+++ src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindingExtension.cs
@@ -26,6 +26,8 @@
             {
                 Path = Path,
                 Converter = Converter,
+                ConverterParameter = ConverterParameter,
+                TargetNullValue = TargetNullValue,
                 FallbackValue = FallbackValue,
                 Mode = Mode,
                 Priority = Priority,


Create target folder if not exist when moving media

Fixes #6856

--- src/Orchard.Web/Modules/Orchard.MediaLibrary/Services/MediaLibraryService.cs
+++ src/Orchard.Web/Modules/Orchard.MediaLibrary/Services/MediaLibraryService.cs
@@ -379,6 +379,8 @@
             Argument.ThrowIfNullOrEmpty(filename, "filename");
             Argument.ThrowIfNullOrEmpty(newFilename, "newFilename");

+            if (!_storageProvider.FolderExists(newPath))
+                _storageProvider.TryCreateFolder(newPath);
             _storageProvider.RenameFile(_storageProvider.Combine(currentPath, filename), _storageProvider.Combine(newPath, newFilename));
         }


No need to use a Monobehaviour for the static anomaly class

--- Source/Scenario/DMScienceScenario.cs
+++ Source/Scenario/DMScienceScenario.cs
@@ -45,7 +45,7 @@
 		}

 		//Anomaly tracking object
-		internal DMAnomalyList anomalyList;
+		//internal DMAnomalyList anomalyList;

 		//Master List for saved asteroid science data
 		private Dictionary<string, DMScienceData> recoveredDMScience = new Dictionary<string,DMScienceData>();
@@ -130,16 +130,16 @@
 		{
 			if (HighLogic.LoadedSceneIsFlight)
 			{
-				anomalyList = gameObject.AddComponent<DMAnomalyList>();
+				//anomalyList = gameObject.AddComponent<DMAnomalyList>();
 				updateRemainingData();
 			}
 		}

-		private void OnDestroy()
-		{
-			if (anomalyList != null)
-				Destroy(anomalyList);
-		}
+		//private void OnDestroy()
+		//{
+		//	if (anomalyList != null)
+		//		Destroy(anomalyList);
+		//}

 		private void addDMScience(DMScienceData data)
 		{


update

update

--- CSharpGL4/Scene/ILegacyPickable/ILegacyPickable.cs
+++ CSharpGL4/Scene/ILegacyPickable/ILegacyPickable.cs
@@ -6,12 +6,12 @@
 namespace CSharpGL
 {
     /// <summary>
-    ///
+    /// Supports picking in legacy OpenGL.
     /// </summary>
     public interface ILegacyPickable
     {
         /// <summary>
-        ///
+        /// Render this model in legacy OpenGL.
         /// </summary>
         /// <param name="arg"></param>
         void RenderForLegacyPicking(LegacyPickEventArgs arg);


Code analysis issue updates

Code analysis issue updates

--- Calabonga.Portal.Config/DefaultConfigSerializer.cs
+++ Calabonga.Portal.Config/DefaultConfigSerializer.cs
@@ -19,29 +19,31 @@
                 try {
                     return (T)formatter.Deserialize(st);
                 }
-
-                finally {
-                    st.Close();
+
+                catch {
                 }
             }
+            return default(T);
         }

         public string SerializeObject<T>(T config) where T : class {

-            var ms = new MemoryStream();
-            var formatter = new XmlSerializer(typeof(T));
-            try {
-                formatter.Serialize(ms, config);
-                ms.Position = 0;
-                string result;
-                using (var sr = new StreamReader(ms)) {
-                    result = sr.ReadToEnd();
+            using (var ms = new MemoryStream()) {
+
+                var formatter = new XmlSerializer(typeof(T));
+                try {
+                    formatter.Serialize(ms, config);
+                    ms.Position = 0;
+                    string result;
+                    using (var sr = new StreamReader(ms)) {
+                        result = sr.ReadToEnd();
+                    }
+                    return result;
                 }
-                return result;
+                catch {
+                }
             }
-            finally {
-                ms.Close();
-            }
+            return null;
         }
     }
 }


178.1

--- src/PixelFarm/PixelFarm.MiniAgg.Complements/2_SpanGenerators/SpanGradient.cs
+++ src/PixelFarm/PixelFarm.MiniAgg.Complements/2_SpanGenerators/SpanGradient.cs
@@ -38,13 +38,13 @@
         int _yoffset;
         //--------------------------------------------------------------------
         public SpanGenGradient() { }
-        public SpanGenGradient(ISpanInterpolator inter,
-                      IGradientValueCalculator gvc,
-                      IGradientColorsProvider m_colorsProvider,
-                      double d1, double d2)
-        {
-            Reset(inter, gvc, m_colorsProvider, d1, d2);
-        }
+        //public SpanGenGradient(ISpanInterpolator inter,
+        //              IGradientValueCalculator gvc,
+        //              IGradientColorsProvider m_colorsProvider,
+        //              double d1, double d2)
+        //{
+        //    Reset(inter, gvc, m_colorsProvider, d1, d2);
+        //}
         public void SetOffset(int x, int y)
         {
             _xoffset = x;


Fix Chinese IME character Composition issue (#3163)

--- CefSharp.Wpf/Experimental/WpfIMEKeyboardHandler.cs
+++ CefSharp.Wpf/Experimental/WpfIMEKeyboardHandler.cs
@@ -245,7 +245,7 @@
             if (ImeHandler.GetResult(hwnd, (uint)lParam, out text))
             {
                 owner.GetBrowserHost().ImeCommitText(text, new Range(int.MaxValue, int.MaxValue), 0);
-                if (languageCodeId == ImeNative.LANG_KOREAN)
+                if (languageCodeId == ImeNative.LANG_KOREAN || languageCodeId == ImeNative.LANG_CHINESE)
                 {
                     owner.GetBrowserHost().ImeSetComposition(text, new CompositionUnderline[0], new Range(int.MaxValue, int.MaxValue), new Range(0, 0));
                     owner.GetBrowserHost().ImeFinishComposingText(false);


Minor tidy up, remove about and contact actions

--- src/SFA.DAS.EmployerApprenticeshipsService.Web/Controllers/HomeController.cs
+++ src/SFA.DAS.EmployerApprenticeshipsService.Web/Controllers/HomeController.cs
@@ -27,22 +27,7 @@

             return View(accounts);
         }
-
-        public ActionResult About()
-        {
-            ViewBag.Message = "Your application description page.";
-
-            return View();
-        }
-
-        [Authorize]
-        public ActionResult Contact()
-        {
-            ViewBag.Message = "Your contact page.";
-
-            return View();
-        }
-
+
         [HttpPost]
         public ActionResult SignInUser(string selectedUserId, SignInUserViewModel model)
         {
@@ -80,7 +65,6 @@
         public ActionResult SignOut()
         {
             return _owinWrapper.SignOutUser();
-

         }
     }


Update FunctionsTests.cs

Update FunctionsTests.cs

Added comments to more clearly show operation and added rounding of a negative fractional number.

--- ClosedXML_Tests/Excel/CalcEngine/FunctionsTests.cs
+++ ClosedXML_Tests/Excel/CalcEngine/FunctionsTests.cs
@@ -380,8 +380,11 @@
             actual = XLWorkbook.EvaluateExpr("Round(-50.55, -2)");
             Assert.AreEqual(-100.0, actual);

-            actual = XLWorkbook.EvaluateExpr("ROUND(59*0.535, 2)");
+            actual = XLWorkbook.EvaluateExpr("ROUND(59 * 0.535, 2)"); // (59 * 0.535) = 31.565
             Assert.AreEqual(31.57, actual);
+
+            actual = XLWorkbook.EvaluateExpr("ROUND(59 * -0.535, 2)"); // (59 * -0.535) = -31.565
+            Assert.AreEqual(-31.57, actual);
         }

         [Test]


Add NuGetPackageResolverTest

Add NuGetPackageResolverTest


Refactored EmailSender

Refactored EmailSender

--- CmsEngine.Application/Helpers/Email/EmailSender.cs
+++ CmsEngine.Application/Helpers/Email/EmailSender.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Net;
 using System.Net.Mail;
+using System.Text;
 using System.Threading.Tasks;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
@@ -18,53 +19,58 @@
             _logger = logger;
         }

-        public async Task SendEmailAsync(ContactForm mailEditModel)
+        public async Task SendEmailAsync(ContactForm contactForm)
         {
-            await Execute(mailEditModel);
+            await Execute(contactForm);
         }

-        private async Task Execute(ContactForm mailEditModel)
+        private async Task Execute(ContactForm contactForm)
         {
-            _logger.LogInformation(mailEditModel.ToString());
+            _logger.LogInformation("SendEmailAsync(contactForm: {0})", contactForm.ToString());
+
+            string from = contactForm.From ?? _emailSettings.Username;
+            string body = $"From: {from}\r\nTo: {contactForm.To}\r\n-----\r\n\r\n{contactForm.Message}";

             try
             {
-                string from = mailEditModel.From ?? _emailSettings.Username;

-                MailMessage mail = new MailMessage
+                MailMessage message = new MailMessage
                 {
                     From = new MailAddress(from),
-                    Subject = $"🌐 CmsEngine - {mailEditModel.Subject}",
-                    Body = mailEditModel.Message,
+                    Subject = $"🌐 CmsEngine - {contactForm.Subject}",
+                    SubjectEncoding = Encoding.UTF8,
                     IsBodyHtml = false,
+                    Body = body,
+                    BodyEncoding = Encoding.UTF8,
                     Priority = MailPriority.Normal
                 };

-                if (!string.IsNullOrWhiteSpace(mailEditModel.To))
+                if (!string.IsNullOrWhiteSpace(contactForm.To))
                 {
-                    mail.To.Add(mailEditModel.To);
+                    message.To.Add(contactForm.To);
                 }

                 if (!string.IsNullOrWhiteSpace(_emailSettings.CcEmail))
                 {
-                    mail.CC.Add(_emailSettings.CcEmail);
+                    message.CC.Add(_emailSettings.CcEmail);
                 }

                 if (!string.IsNullOrWhiteSpace(_emailSettings.BccEmail))
                 {
-                    mail.Bcc.Add(_emailSettings.BccEmail);
+                    message.Bcc.Add(_emailSettings.BccEmail);
                 }

                 using (var smtp = new SmtpClient(_emailSettings.Domain, _emailSettings.Port))
                 {
                     smtp.EnableSsl = true;
-                    smtp.Timeout = 10000;
                     smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                     smtp.UseDefaultCredentials = false;
                     smtp.Credentials = new NetworkCredential(_emailSettings.Username, _emailSettings.Password);

-                    await smtp.SendMailAsync(mail);
+                    await smtp.SendMailAsync(message);
                 }
+
+                _logger.LogInformation("Email sent from {0} to {1}", message.From, message.To[0]);
             }
             catch (Exception ex)
             {


fixed DebugType ArgumentNullException

fixed DebugType ArgumentNullException

in the situation where DebugType is mising and the DebugSymbols property is set to true, the TryGetValue method of the s_debugTypeValues dictionary would throw an exception

--- src/Workspaces/Core/MSBuild/MSBuild/ProjectFile/CommandLineArgumentReader.cs
+++ src/Workspaces/Core/MSBuild/MSBuild/ProjectFile/CommandLineArgumentReader.cs
@@ -167,8 +167,7 @@
             if (emitDebugInfo)
             {
                 var debugType = Project.ReadPropertyString(PropertyNames.DebugType);
-
-                if (s_debugTypeValues.TryGetValue(debugType, out var value))
+                if (debugType != null && s_debugTypeValues.TryGetValue(debugType, out var value))
                 {
                     Add("debug", value);
                 }


refactor(Erro): alterar estilização da pagina de erro.

--- src/modulo-05-.NET/LojaNinja.MVC/LojaNinja.MVC/Views/Shared/Erro.cshtml
+++ src/modulo-05-.NET/LojaNinja.MVC/LojaNinja.MVC/Views/Shared/Erro.cshtml
@@ -4,5 +4,7 @@
     Layout = "~/Views/Shared/_Layout.cshtml";
 }

-
Nossos ninjas preveram seus movimentos!

-
@ViewBag.ErroIDPedido
+

+
Nossos ninjas preveram seus movimentos!

+
@ViewBag.ErroIDPedido

+


feat(CavaleiroRepositorioEF): deletar localNascimento e localTreinamento na mao.

--- src/modulo-06-ajax/CdZ/src/CdZ.Repositorio.EF/CavaleiroRepositorioEF.cs
+++ src/modulo-06-ajax/CdZ/src/CdZ.Repositorio.EF/CavaleiroRepositorioEF.cs
@@ -51,8 +51,12 @@
             using (var db = new ContextoDeDados())
             {
                 //TODO: arrumar, ta deixando restos no banco sem key, possivel soluçao como comentario no contextoDeDados.
-                Cavaleiro cavaleiroASerExcluido = Buscar(id);
+                var cavaleiroASerExcluido = db.Cavaleiro.Find(id);
+                var localNascimento = db.Cavaleiro.Include(_ => _.LocalNascimento).Single(_ => _.Id == id).LocalNascimento;
+                var localTreinamento = db.Cavaleiro.Include(_ => _.LocalTreinamento).Single(_ => _.Id == id).LocalTreinamento;
                 db.Entry<Cavaleiro>(cavaleiroASerExcluido).State = EntityState.Deleted;
+                db.Entry<Local>(localNascimento).State = EntityState.Deleted;
+                db.Entry<Local>(localTreinamento).State = EntityState.Deleted;
                 db.SaveChanges();
             }
         }


Fixed warning in NET 4.0 y 4.5

Fixed warning in NET 4.0 y 4.5

NewOperationCancelledException will have no code in .NET 4.0 and .NET
4.5 because there OperationCancelledException already has the
CancellationToken.

--- Core/Theraot/Core/NewOperationCanceledException.cs
+++ Core/Theraot/Core/NewOperationCanceledException.cs
@@ -6,6 +6,7 @@
     [Serializable]
     public class NewOperationCanceledException : OperationCanceledException
     {
+#if NET20 || NET30 || NET35
         [NonSerialized]
         private CancellationToken? _token;

@@ -41,5 +42,6 @@
                 }
             }
         }
+#endif
     }
 }


[UDP] Add pending ack after SAEA setup

[UDP] Add pending ack after SAEA setup

--- Desktop/Tempest/Providers/Network/UdpConnection.cs
+++ Desktop/Tempest/Providers/Network/UdpConnection.cs
@@ -338,15 +338,15 @@
 			}
 			else
 			{
+				e.SetBuffer (0, length);
+				e.RemoteEndPoint = endPoint;
+				e.Completed += OnSendCompleted;
+				e.UserToken = tcs;
+
 				if (message.PreferReliable || message.MustBeReliable) {
 					lock (this.pendingAck)
 						this.pendingAck.Add (message.Header.MessageId, new Tuple<DateTime, Message> (DateTime.UtcNow, message));
 				}
-
-				e.SetBuffer (0, length);
-				e.RemoteEndPoint = endPoint;
-				e.Completed += OnSendCompleted;
-				e.UserToken = tcs;

 				try {
 					this.lastSendActivity = DateTime.Now;


Maybe don't log http requests on Travis. That's a lot of output.

--- Difi.SikkerDigitalPost.Klient.Tester/SmokeTests.cs
+++ Difi.SikkerDigitalPost.Klient.Tester/SmokeTests.cs
@@ -13,7 +13,7 @@
             var miljø = Miljø.FunksjoneltTestmiljø;
             //var miljø = Miljø.LokalMFMiljø;

-            _t = new SmokeTestsHelper(miljø, loggHttp: true);
+            _t = new SmokeTestsHelper(miljø);
         }

         [Fact]


Changes description of `Message.SenderId` to be more descriptive

--- Digipost.Api.Client.Domain/SendMessage/IMessage.cs
+++ Digipost.Api.Client.Domain/SendMessage/IMessage.cs
@@ -44,8 +44,8 @@
         List<IDocument> Attachments { get; set; }

         /// <summary>
-        ///     The id of the sender, created by Digipost.  If you are delivering a
-        ///     message on behalf of an organization, and permission to do so is set, this is the parameter to set.
+        ///     The id of the sender, created by Digipost. If you are delivering a message on behalf of an organization
+        ///     with id 5555, set this property to 5555.
         /// </summary>
         string SenderId { get; set; }


from 2 generic tables to 3 generic classes/tables in MultiJoin

--- db-test-new/Program.cs
+++ db-test-new/Program.cs
@@ -105,10 +105,21 @@
 //		}
 		#endregion
 	}
-
-
-
-	public class MyContext : LinqToDB.Data.DataConnection
+
+    [Table(Name = "qux")]
+    public class Qux
+    {
+        [PrimaryKey, Column(Name = "id"), NotNull]
+        public int id { get; set; }
+
+        [Column(Name = "success"), NotNull]
+        public bool Success { get; set; }
+
+    }
+
+
+
+    public class MyContext : LinqToDB.Data.DataConnection
 	{
 		public MyContext() : base("SQLite","Data Source=mydb.s3db") { }

@@ -385,9 +396,66 @@
 				return w;
 			//}
 		}
-
-
-		public static void Main(string[] args)
+        public class JoinClass<T1, T2, T3>
+        {
+            public T1 t1;
+            public T2 t2;
+            public T3 t3;
+        }
+        public static IQueryable<JoinClass<T1, T2, T3>> MultiJoin<T1, T2, T3>(
+            MyContext db,
+            Expression<Func<JoinClass<T1, T2, T3>, bool>> JoinCond
+        )
+            where T3 : class
+            where T2 : class
+            where T1 : class
+        {
+            var jfb = Expression.Parameter(typeof(JoinClass<T1, T2, T3>), "jfb");
+
+            FieldInfo ItemT1 = typeof(JoinClass<T1, T2, T3>).GetField("t1");
+            FieldInfo ItemT2 = typeof(JoinClass<T1, T2, T3>).GetField("t2");
+            FieldInfo ItemT3 = typeof(JoinClass<T1, T2, T3>).GetField("t3");
+
+            var pb = Expression.Field(jfb, ItemT1);//
+            var pf = Expression.Field(jfb, ItemT2);//
+            var pq = Expression.Field(jfb, ItemT3);//
+
+            var old_expr = JoinCond;
+            var map = old_expr.Parameters.ToDictionary(p => p, p => jfb);
+            var reboundBody = ParameterRebinder.ReplaceParameters(map, old_expr.Body);
+            var newCond = Expression.Lambda<Func<JoinClass<T1, T2, T3>, bool>>(reboundBody, jfb).Body;
+
+            var WhereExpr = Expression.Lambda<Func<JoinClass<T1, T2, T3>, bool>>(newCond, jfb);
+
+            //using (var db = new MyContext()) {
+
+            var qx = db.GetTable<T1>()
+                    .SelectMany(
+                    b => db.GetTable<T2>(), (b, f) => new JoinClass<T1, T2>() { t1 = b, t2 = f })
+                    .SelectMany(
+                    q => db.GetTable<T3>()
+                        , (j, q) => new JoinClass<T1, T2, T3>() { t1 = j.t1, t2 = j.t2, t3 = q });
+
+            //Translated Above from Query (or Query Expression) to Method Chaining (or Fluent)
+            //var qxExe = qx.ToArray();
+            //Console.WriteLine(String.Format("Last QX: {0}", db.LastQuery));
+
+            //var q = from b in db.GetTable<T1>()
+            //        from f in db.GetTable<T2>()
+            //        select new JoinClass<T1, T2>() { t1 = b, t2 = f };
+
+            var w = qx.Where(WhereExpr);
+
+            #region only for debugging purposes - to be deleted
+            //w.ToArray();
+            //Console.WriteLine(String.Format("Last Query: {0}",db.LastQuery));
+            #endregion
+
+            return w;
+            //}
+        }
+
+        public static void Main(string[] args)
 		{
 			Console.WriteLine("Hello World!");

@@ -418,7 +486,30 @@
                 );
             Console.WriteLine(String.Format("Last Query: {0}", db.LastQuery));
             ConsoleOut(w); //.Select(j => new Tuple<Bar,Foo>(j.t1,j.t2))
+
+                var test = MultiJoin<Bar, Qux>(db,
+                                j => j.t1.id == j.t2.id && !j.t2.Success
+                                );
+
+                Console.WriteLine(String.Join(",",
+                        test.Select(t => t.t1.Name)
+                    )
+                    );
+                Console.WriteLine(String.Format("Last Query: {0}", db.LastQuery));
+
+                var complex = MultiJoin<Bar, Foo, Qux>(db,
+                    j => j.t2.ColFoo.StartsWith( j.t1.ColBar) && j.t2.id == j.t3.id && j.t3.Success
+                    );
+                Console.WriteLine(String.Join(",",
+                        complex.Select(t => t.t1.Name + "@" + t.t2.FromDate.ToShortDateString())
+                    )
+                    );
+                Console.WriteLine(String.Format("Last Query: {0}", db.LastQuery));
+
             }
+
+
+
             #region SO try to generalize the Equal Expr into LambdaExpr in the generic JoinCond
             //I have this expression
             Expression<Func<Bar,bool>> old_expr = x => x.Name == x.ColBar;


import mappings to associations

import mappings to associations

--- EAAddinFramework/Mapping/AssociationMappingNode.cs
+++ EAAddinFramework/Mapping/AssociationMappingNode.cs
@@ -140,6 +140,11 @@
                         break;
                     }
                 }
+                //if the end class of the association is not loaded as a node, we check the target class name
+                if (this.sourceAssociation.targetElement.name == mappingPathNames[0])
+                {
+                    foundNode = this;
+                }
             }
             return foundNode;
         }


Update LiveSplit AutoSplitters URL

Update LiveSplit AutoSplitters URL


change code

change code

--- Seed.BarCodeCore/Models/Scan.cs
+++ Seed.BarCodeCore/Models/Scan.cs
@@ -16,15 +16,15 @@
         public ListBox SmlCodeList;
         public RichTextBox Info;
         public int Count { get; set; }
-        private int _bigCodeLen=10;
-        private int _smlCodeLen=12;
-        private int _specification = 30;
-        private string _codeType = "1";
-        private string _soundType = "0";
+        private readonly int _bigCodeLen=10;
+        private readonly int _smlCodeLen=12;
+        private readonly int _specification = 30;
+        private readonly string _codeType = "1";
+        private readonly string _soundType = "0";
         private readonly SoundPlayer _player = new SoundPlayer();
         public IResposity Resposity;
-        private Product CurProduct;
-        private SystemConfig CurConfig;
+        private readonly Product CurProduct;
+        private readonly SystemConfig CurConfig;

         public Scan(ListBox list,int productCount,RichTextBox info,Product product,SystemConfig config)
         {
@@ -187,7 +187,6 @@
         /// <param name="code"></param>
         private void InsertCode(string code)
         {
-
             if (CurConfig.StoreType== "1")
             {              ;
                 Resposity.InsertList(BarCodeTist<Product>(code));


Add url for windows

Add url for windows

--- Assets/Scripts/RestClient/Fitbit/FitbitRestClient.cs
+++ Assets/Scripts/RestClient/Fitbit/FitbitRestClient.cs
@@ -108,6 +108,8 @@
 					GetActiviesLifeTimeState();

 					mIsLogin = true;
+					url = WIN_URL;
+                    Application.OpenURL(url);
 				}
 			}
 			Debug.Log("Login...");


clean

clean

--- CSharpGL/Renderers/Renderer/Renderer.DoInitialize.cs
+++ CSharpGL/Renderers/Renderer/Renderer.DoInitialize.cs
@@ -14,7 +14,7 @@
         protected override void DoInitialize()
         {
             // init shader program
-            ShaderProgram program = new ShaderProgram();
+            var program = new ShaderProgram();
             var shaders = (from item in shaderCodes select item.CreateShader()).ToArray();
             program.Create(shaders);
             this.Program = program;
@@ -27,7 +27,7 @@
             {
                 PropertyBufferPtr bufferPtr = this.bufferable.GetProperty(
                     item.nameInIBufferable, item.VarNameInShader);
-                if (bufferPtr == null) { throw new Exception(); }
+                if (bufferPtr == null) { throw new Exception(string.Format("[{0}] returns null buffer pointer!", this.bufferable)); }
                 propertyBufferPtrs[index++] = bufferPtr;
             }


Support getting all supported typography for a single character

--- CharacterMap/CharacterMap/Core/TypographyAnalyzer.cs
+++ CharacterMap/CharacterMap/Core/TypographyAnalyzer.cs
@@ -19,6 +19,33 @@
             var list = features.Select(f => new TypographyFeatureInfo((CanvasTypographyFeatureName)f)).OrderBy(f => f.DisplayName).ToList();
             return list;
         }
+
+        /// <summary>
+        /// Returns a list of Typographic Variants for a character supported by the font.
+        /// </summary>
+        /// <param name="font"></param>
+        /// <param name="character">A single string character. If more characters are present, they are ignored.</param>
+        public static List<TypographyFeatureInfo> GetCharacterVariants(FontVariant font, Models.Character character)
+        {
+            var textAnalyzer = new CanvasTextAnalyzer(character.Char, CanvasTextDirection.TopToBottomThenLeftToRight);
+            KeyValuePair<CanvasCharacterRange, CanvasAnalyzedScript> analyzed = textAnalyzer.GetScript().First();
+
+            List<TypographyFeatureInfo> supported = new List<TypographyFeatureInfo>();
+
+            foreach (var feature in font.TypographyFeatures)
+            {
+                if (feature == TypographyFeatureInfo.None)
+                    continue;
+
+                var glyphs = textAnalyzer.GetGlyphs(analyzed.Key, font.FontFace, 24, false, false, analyzed.Value);
+                bool[] results = font.FontFace.GetTypographicFeatureGlyphSupport(analyzed.Value, feature.Feature, glyphs);
+
+                if (results.Any(r => r))
+                    supported.Add(feature);
+            }
+
+            return supported;
+        }
     }

     public class TypographyHandler : ICanvasTextRenderer


Replaced implementation of IsNullOrEmpty string extension method with string.IsNullOrWhitespace

--- Code/Foundation/ExtensionMethods/StringExtensions.cs
+++ Code/Foundation/ExtensionMethods/StringExtensions.cs
@@ -60,10 +60,7 @@
         [DebuggerStepThrough]
         public static bool IsNullOrEmpty(this string value)
         {
-// ReSharper disable ReplaceWithStringIsNullOrEmpty
-            if (value == null || value.Length == 0) return true;
-// ReSharper restore ReplaceWithStringIsNullOrEmpty
-            return value.All(character => char.IsWhiteSpace(character));
+            return string.IsNullOrWhiteSpace(value);
         }

         /// <summary>


update file list feature

update file list feature

--- DBLike/Client/LocalFileSysAccess/FileListMaintain.cs
+++ DBLike/Client/LocalFileSysAccess/FileListMaintain.cs
@@ -14,8 +14,39 @@
     public class FileListMaintain
     {

+        // update single file to fileList
+        public void updateSingleFileToFileList(string fullFilePath, DateTime dt, string hashValue)
+        {
+            try
+            {
+                Client.LocalFileSysAccess.FileList.fileInfoDic[fullFilePath].md5r = hashValue;
+                Client.LocalFileSysAccess.FileList.fileInfoDic[fullFilePath].time = dt;
+            }
+            catch (System.IO.IOException e)
+            {
+                System.Windows.Forms.MessageBox.Show("FileListMaintain <-" + e.Message);
+            }
+        }

+
+        // add single file to file list
+        public void addSingleFileToFileList(string filePath)
+        {
+
+            Client.LocalFileSysAccess.FileInfo tmp = null;
+
+            // get file attributes
+            Client.LocalFileSysAccess.getFileAttributes getFileAttr = new Client.LocalFileSysAccess.getFileAttributes(filePath);
+
+            tmp = new Client.LocalFileSysAccess.FileInfo();
+            tmp.time = getFileAttr.lastModified;
+            tmp.md5r = getFileAttr.md5Value;
+
+            // add to fileList
+            Client.LocalFileSysAccess.FileList.fileInfoDic[filePath] = tmp;
+
+        }

         public void scanAllFilesAttributes()
         {


Modified the interception emitter to skip modifying methods that do not contain any method call instructions

--- Deflector/Deflector/MethodCallInterceptionEmitter.cs
+++ Deflector/Deflector/MethodCallInterceptionEmitter.cs
@@ -80,71 +80,75 @@
             body.Instructions.Clear();

             var callInstructions = oldInstructions.Where(instruction => instruction.OpCode == OpCodes.Call ||
-                                                                        instruction.OpCode == OpCodes.Callvirt);
-
-            var il = body.GetILProcessor();
-            var targetMethods = callInstructions.Select(instruction => instruction.Operand as MethodReference);
-
-            // Precalculate all method call interceptors
-            var addMethod = module.ImportMethod<IDictionary<MethodBase, IMethodCall>>("Add", typeof(MethodBase),
-                typeof(IMethodCall));
-
-            var provider = method.AddLocal<IMethodCallProvider>();
-            var getProvider = module.ImportMethod("GetProvider", typeof(MethodCallProviderRegistry));
-
-            // Create the stack that will hold the method arguments
-            il.Emit(OpCodes.Newobj, _stackCtor);
-            il.Emit(OpCodes.Stloc, _currentArguments);
-
-            // Obtain the method call provider instance
-            il.Emit(method.HasThis ? OpCodes.Ldarg_0 : OpCodes.Ldnull);
-            il.PushType(method.DeclaringType, module);
-            il.PushStackTrace(module);
-            il.Emit(OpCodes.Call, getProvider);
-
-            il.Emit(OpCodes.Stloc, provider);
-
-            // Instantiate the map
-            var mapCtor = module.ImportConstructor<ConcurrentDictionary<MethodBase, IMethodCall>>(new Type[0]);
-            il.Emit(OpCodes.Newobj, mapCtor);
-            il.Emit(OpCodes.Stloc, _callMap);
-
-            var getMethodCallFor = module.ImportMethod<IMethodCallProvider>("GetMethodCallFor");
-
-            var skipCallMapConstruction = il.Create(OpCodes.Nop);
-
-            il.Emit(OpCodes.Ldloc, provider);
-            il.Emit(OpCodes.Brfalse, skipCallMapConstruction);
-
-            // if (provider != null) {
-            foreach (var targetMethod in targetMethods)
-            {
-                // callMap.Add(targetMethod, provider.GetMethodCallFor(targetMethod))
-                il.Emit(OpCodes.Ldloc, _callMap);
-                il.PushMethod(targetMethod, module);
+                                                                        instruction.OpCode == OpCodes.Callvirt).ToArray();
+
+            // Skip the method if there are no calls to intercept
+            if (callInstructions.Any())
+            {
+                var il = body.GetILProcessor();
+                var targetMethods = callInstructions.Select(instruction => instruction.Operand as MethodReference);
+
+                // Precalculate all method call interceptors
+                var addMethod = module.ImportMethod<IDictionary<MethodBase, IMethodCall>>("Add", typeof (MethodBase),
+                    typeof (IMethodCall));
+
+                var provider = method.AddLocal<IMethodCallProvider>();
+                var getProvider = module.ImportMethod("GetProvider", typeof (MethodCallProviderRegistry));
+
+                // Create the stack that will hold the method arguments
+                il.Emit(OpCodes.Newobj, _stackCtor);
+                il.Emit(OpCodes.Stloc, _currentArguments);
+
+                // Obtain the method call provider instance
+                il.Emit(method.HasThis ? OpCodes.Ldarg_0 : OpCodes.Ldnull);
+                il.PushType(method.DeclaringType, module);
+                il.PushStackTrace(module);
+                il.Emit(OpCodes.Call, getProvider);
+
+                il.Emit(OpCodes.Stloc, provider);
+
+                // Instantiate the map
+                var mapCtor = module.ImportConstructor<ConcurrentDictionary<MethodBase, IMethodCall>>(new Type[0]);
+                il.Emit(OpCodes.Newobj, mapCtor);
+                il.Emit(OpCodes.Stloc, _callMap);
+
+                var getMethodCallFor = module.ImportMethod<IMethodCallProvider>("GetMethodCallFor");
+
+                var skipCallMapConstruction = il.Create(OpCodes.Nop);

                 il.Emit(OpCodes.Ldloc, provider);
-                il.PushMethod(targetMethod, module);
-                il.PushStackTrace(module);
-                il.Emit(OpCodes.Callvirt, getMethodCallFor);
-
-                il.Emit(OpCodes.Callvirt, addMethod);
-            }
-
-            // }
-
-            il.Append(skipCallMapConstruction);
-
-            foreach (var instruction in oldInstructions)
-            {
-                var opCode = instruction.OpCode;
-                if (opCode != OpCodes.Call && opCode != OpCodes.Callvirt)
+                il.Emit(OpCodes.Brfalse, skipCallMapConstruction);
+
+                // if (provider != null) {
+                foreach (var targetMethod in targetMethods)
                 {
-                    il.Append(instruction);
-                    continue;
+                    // callMap.Add(targetMethod, provider.GetMethodCallFor(targetMethod))
+                    il.Emit(OpCodes.Ldloc, _callMap);
+                    il.PushMethod(targetMethod, module);
+
+                    il.Emit(OpCodes.Ldloc, provider);
+                    il.PushMethod(targetMethod, module);
+                    il.PushStackTrace(module);
+                    il.Emit(OpCodes.Callvirt, getMethodCallFor);
+
+                    il.Emit(OpCodes.Callvirt, addMethod);
                 }

-                ReplaceMethodCallInstruction(instruction, method, il);
+                // }
+
+                il.Append(skipCallMapConstruction);
+
+                foreach (var instruction in oldInstructions)
+                {
+                    var opCode = instruction.OpCode;
+                    if (opCode != OpCodes.Call && opCode != OpCodes.Callvirt)
+                    {
+                        il.Append(instruction);
+                        continue;
+                    }
+
+                    ReplaceMethodCallInstruction(instruction, method, il);
+                }
             }

             // Add the attribute marker so that this method is only modified once


Detects VS 2010 runtime so it won't even try to load C++ assemblies if it doesn't exist (prevent ugly exception on application close)

--- source/LZ4/LZ4Codec.cs
+++ source/LZ4/LZ4Codec.cs
@@ -29,6 +29,7 @@
 using System.Runtime.CompilerServices;
 using System.Text;
 using LZ4.Services;
+using Microsoft.Win32;

 namespace LZ4
 {
@@ -79,8 +80,11 @@
 			// are needed so we can safely try load and handle if not loaded
 			// I may change in future versions of .NET

-			Try(InitializeLZ4mm);
-			Try(InitializeLZ4cc);
+			if (HasVs2010Runtime())
+			{
+				Try(InitializeLZ4mm);
+				Try(InitializeLZ4cc);
+			}
 			Try(InitializeLZ4n);
 			Try(InitializeLZ4s);

@@ -156,6 +160,35 @@
 			}
 		}

+		/// Determines whether VS2010 runtime is installed.
+		/// <returns><c>true</c> it VS2010 runtime is installed, <c>false</c> otherwise.</returns>
+		private static bool HasVs2010Runtime()
+		{
+			var keyName =
+				IntPtr.Size == 4 ? @"SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" :
+				IntPtr.Size == 8 ? @"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x64" :
+				null;
+			if (keyName == null)
+				return false;
+
+			var key = Registry.LocalMachine.OpenSubKey(keyName, false);
+			if (key == null)
+				return false;
+
+			var value = key.GetValue(@"Installed");
+			if (value == null)
+				return false;
+
+			try
+			{
+				return Convert.ToUInt32(value) != 0;
+			}
+			catch
+			{
+				return false;
+			}
+		}
+
 		/// Tries to execute specified action. Ignores exception if it failed.
 		/// <param name="method">The method.</param>
 		private static void Try(Action method)