public async Task <IActionResult> Edit(int id, [Bind("IdExperiment,IdSample,Dates,StartTime,EndTime,SupposeMass,ReceiveMass,IdLaboratory,IdWorker")] Experiments experiments)
        {
            if (id != experiments.IdExperiment)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(experiments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExperimentsExists(experiments.IdExperiment))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdLaboratory"] = new SelectList(_context.Laboratories, "IdLaboratory", "IdLaboratory", experiments.IdLaboratory);
            ViewData["IdSample"]     = new SelectList(_context.Samples, "IdSample", "IdSample", experiments.IdSample);
            ViewData["IdWorker"]     = new SelectList(_context.Workers, "IdWorker", "IdWorker", experiments.IdWorker);
            return(View(experiments));
        }
Beispiel #2
0
        public string GetJsonTime(string exId)
        {
            if (string.IsNullOrEmpty(exId))
            {
                return("error");
            }
            long id = Convert.ToInt64(exId);
            List <Experiment> exs = new Experiments().Search(j => j.experiment_id == id);
            StringBuilder     sb  = new StringBuilder();
            string            s   = "{\"total\":" + exs.Count + ",\"rows\":[";

            sb.Append(s);
            int index = 0;

            foreach (Experiment e in exs)
            {
                string timeID = e.experiment_week;
                long   count  = new ChooseOperation().SearchCount(k => k.choose_ownExperimentId == id);
                s = "{\"id\":\"" + e.experiment_id + "\",\"week\":\"" + e.experiment_week + "\",\"num\":\"" + count + "\",\"max\":\"" + e.experiment_peopleNum + "\",\"timebtn\":\"<button name=" + (index++) + "  class='timebtn' value='" + e.experiment_id + "'>选择 </button>\"},";
                sb.Append(s);
            }
            if (exs.Count != 0)
            {
                s = sb.ToString();
                s = s.Substring(0, (s.Length - 1));
            }
            return(s + "]}");
        }
Beispiel #3
0
        static void DefineDelegates(Experiments Ex)
        {
            Operation = EratosfenClassic;
            switch (Ex)
            {
            case Experiments.EratosfenModifyRange:
                Console.WriteLine("Модифицированный последовательный алгоритм поиска: декомпозиция по данным");

                ParallelOperation = ParallelOperationRange;
                ThreadOperation   = ThreadEratosfenModify;
                break;

            case Experiments.EratosfenBasicRange:
                Console.WriteLine("Модифицированный последовательный алгоритм поиска: применение пула потоков");

                ParallelOperation = ParallelOperationBasicRange;
                ThreadOperation   = ThreadEratosfenBasicModify;
                break;

            case Experiments.EratosfenThreadPool:
                Console.WriteLine("Модифицированный последовательный алгоритм поиска: декомпозиция по данным");

                ParallelOperation = ParallelOperationThreadPool;
                ThreadOperation   = ThreadPoolOperation;
                break;

            case Experiments.EratosfenBasicSeq:
                Console.WriteLine("Последовательный перебор простых чисел");

                ParallelOperation = ParallelOperationBasicSeq;
                ThreadOperation   = ThreadOperationBasicSeq;
                break;
            }
        }
Beispiel #4
0
    protected void btnExperiment_Click(object sender, EventArgs e)
    {
        int experimentResourceId = int.Parse(Request["experimentResourceId"]);
        UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
        DalOperationAboutExperiment DalOperationAboutExperiment = new DalOperationAboutExperiment();

        Experiments experiment = new Experiments
        {
            studentNo = UserCookiesInfo.userNo,
            experimentResourceId = experimentResourceId,
            updateTime = DateTime.Now,
        };
        if (hidAttachmentId.Value.CompareTo(string.Empty) != 0)
        {
            experiment.attachmentId = hidAttachmentId.Value;
        }
        else
        {
            Javascript.Alert("请上传附件!", Page);
            return;
        }

        DalOperationAboutExperiment.SubmitExperiment(experiment);

        Javascript.AlertAndRedirect("提交成功!", "CInfoExperiment.aspx?experimentResourceId=" + experiment.experimentResourceId + "&courseNo=" + Request["courseNo"] + "&classID=" + Server.UrlEncode(Server.UrlDecode(Request["classID"])) + "&termtag=" + Request["termtag"], Page);
    }
Beispiel #5
0
        /// <summary>
        /// Returns a Dictionary whose Keys are the Index of Queued Experiments and whose Value is their Reward Factor
        /// </summary>
        /// <param name="weighted">Whether or not to weight reward based on existing rewards</param>
        /// <param name="experiments">The Player's list of Experiments</param>
        /// <param name="alreadyFrozen">This allow you to assume the passed Experiment's rewards when calculating weights.
        /// Used for calculating weights when freezing multiple experiments.</param>
        /// <returns></returns>
        public static Dictionary <int, double> GetQueueIndexToRewardFactor(
            bool weighted,
            Experiments experiments,
            IEnumerable <Experiment> alreadyFrozen = null)
        {
            var queueIndexToRewardFactor = new Dictionary <int, double>();

            int queueIndex = 0;

            if (weighted)
            {
                var resourcesClone = experiments.resources.Select(r => r).ToList();
                if (experiments.activeExperiments != null)
                {
                    foreach (var exp in experiments.activeExperiments)
                    {
                        int rewardIndex = 0;
                        exp.rewards.ForEach(reward =>
                                            resourcesClone[rewardIndex++] += reward);
                    }
                }

                if (alreadyFrozen != null)
                {
                    foreach (var exp in alreadyFrozen)
                    {
                        int rewardIndex = 0;
                        exp.rewards.ForEach(reward =>
                                            resourcesClone[rewardIndex++] += reward);
                    }
                }

                int experimentIndex = 0;
                experiments.queuedExperiments.ForEach(experiment =>
                {
                    double weightedRewardSum = 0;
                    int resourceIndex        = 0;
                    foreach (double resource in resourcesClone)
                    {
                        weightedRewardSum += (experiment.rewards[resourceIndex++] / resource);
                    }

                    var weight = weightedRewardSum / (experiment.totalEffortCost / 1000000);
                    if (alreadyFrozen?.Contains(experiment) ?? false)
                    {
                        Main.Debug($"Assuming weight 0 for Experiment {experimentIndex} since it's already frozen");
                        weight = 0;
                    }
                    experimentIndex++;
                    queueIndexToRewardFactor[queueIndex++] = weight;
                });
            }
            else
            {
                experiments.queuedExperiments.ForEach(experiment =>
                                                      queueIndexToRewardFactor[queueIndex++] = experiment.rewards.Sum() / experiment.totalEffortCost);
            }

            return(queueIndexToRewardFactor);
        }
Beispiel #6
0
    protected void commit_Click(object sender, EventArgs e)
    {
        UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

        Experiments experiments = new Experiments
        {
            experimentId = experimentId,
            updateTime=DateTime.Now,
            experimentResourceId = experimentResourcesIdt,
            studentNo=UserCookiesInfo.userNo,
            isCheck=false,
            isExcellent=false,
            remark="",
            checkTime=DateTime.Now,
            excellentTime=DateTime.Now

        };

        if (hidAttachmentId.Value.Length != 0)
        {
            experiments.attachmentId = hidAttachmentId.Value;
        }
        else
        {
            Javascript.Alert("请上传附件!", Page);
            return;
        }
        DalOperationAboutExperiment dalOperationAboutExperiment=new DalOperationAboutExperiment();

        dalOperationAboutExperiment.UpdateExperiment(experiments);
        Javascript.RefreshParentWindow("修改成功!", "CInfoExperiment.aspx?experimentResourceId=" + experiments.experimentResourceId + "courseNo=" + Request["courseNo"], Page);
    }
Beispiel #7
0
        public bool WriteVariable(string expName, int varId, double newValue, int userPermissionLevel = 0)
        {
            Experiment exp;

            if (!Experiments.TryGetValue(expName, out exp))
            {
                throw new InvalidOperationException(string.Format("Unknown experiment: {0}", expName));
            }

            var variable = Experiments[expName][varId];

            if (userPermissionLevel < variable.MinUserLevelToWrite)
            {
                return(false);
            }

            var driver = variable.Driver;

            if (driver == null)
            {
                throw new InvalidOperationException(string.Format("Variable [{0}] has no driver", varId));
            }

            driver.WriteValue(varId, newValue);
            return(true);
        }
Beispiel #8
0
        public async Task <IActionResult> Edit(int id, [Bind("ExperimentId,Name,Metadata")] Experiments experiment)
        {
            if (id != experiment.ExperimentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Update(experiment);
                    await db.SaveChangesAsync().ConfigureAwait(true);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExperimentsExists(experiment.ExperimentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(experiment));
        }
        public IActionResult AntColonyPost([FromBody] List <Data> data)
        {
            var exp    = new Experiments();
            var result = exp.GetExperimentResults(new AntColonyOptimizationAlgorithms(), data);

            return(new JsonResult(result));
        }
        public IActionResult GreedyPost([FromBody] List <Data> data)
        {
            var exp    = new Experiments();
            var result = exp.GetExperimentResults(new GreedyAlgorithm(), data);

            return(new JsonResult(result));
        }
 static void DefineDelegates(Experiments Ex)
 {
     switch (Ex)
     {
     case Experiments.LSDsort:
         Console.WriteLine("Медленный");
         Operation         = RadixLSDSortSeq;
         ParallelOperation = ParallelLSDSort;
         break;
     }
 }
Beispiel #12
0
 public static void Register()
 {
     Experiments.Register(
         name: "Jokes on link",
         description: "Testing to prove that more people will click the link if there's a joke on it.",
         metrics: new [] { "Button clicks" },                             // Associates ticks against the "Button clicks" counter with this experiment
         alternatives: new object[] { false, true },                      // Typed experiment alternatives ; default is common "A/B" binary case
         conclude: experiment => experiment.Participants.Count() == 10,   // Optional criteria for automatically concluding an experiment; default is never
         score: null, /* ... */                                           // Optional criteria for choosing best performer by index; default is best converting alternative
         splitOn: null /* ... */                                          // Optional criteria for splitting a cohort by the number of alternatives; default is a simple hash split
         );
 }
Beispiel #13
0
 public Experiment this[string expName]
 {
     get
     {
         Experiment exp;
         if (!Experiments.TryGetValue(expName, out exp))
         {
             throw new InvalidOperationException(string.Format("Cannot access unexistent experiment [{0}]",
                                                               expName));
         }
         return(Experiments[expName]);
     }
 }
Beispiel #14
0
        private static void Main(string[] args)
        {
            // generate dict mapping for all nodes
            //DictGenerator.GenerateDict();

            // generate dict mapped trip row structs with prior vectors
            //RowParser.Read();

            //load road network
            var e = new Experiments();

            e.Execute();
        }
        public async Task <IActionResult> Create([Bind("IdExperiment,IdSample,Dates,StartTime,EndTime,SupposeMass,ReceiveMass,IdLaboratory,IdWorker")] Experiments experiments)
        {
            if (ModelState.IsValid)
            {
                _context.Add(experiments);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdLaboratory"] = new SelectList(_context.Laboratories, "IdLaboratory", "IdLaboratory", experiments.IdLaboratory);
            ViewData["IdSample"]     = new SelectList(_context.Samples, "IdSample", "IdSample", experiments.IdSample);
            ViewData["IdWorker"]     = new SelectList(_context.Workers, "IdWorker", "IdWorker", experiments.IdWorker);
            return(View(experiments));
        }
Beispiel #16
0
 public bool RequestVariables(string expName, Action <Dictionary <int, double> > callback,
                              int userPermissionLevel = 0)
 {
     if (!Started)
     {
         return(false);
     }
     if (!Experiments.ContainsKey(expName))
     {
         throw new InvalidOperationException(string.Format("Unknown experiment: {0}", expName));
     }
     variableRequests.Enqueue(new VariablesRequest(expName, callback, userPermissionLevel));
     return(true);
 }
Beispiel #17
0
        public void SamplingVsGridExperiment()
        {
            Program.Config = new ConfigParams("");
            var vN  = new int[] { 40, 60, 100 };
            var vNu = new int[] { 10, 20, 30 };
            var res = new Dictionary <Tuple <int, int>, List <double> >();

            foreach (var N in vN)
            {
                foreach (var nu in vNu)
                {
                    res.Add(new Tuple <int, int>(N, nu), Experiments.CompareExahustiveWithSubsamplingInput(N, nu, 50));
                }
            }
        }
Beispiel #18
0
        public void SaveExperimentDetails(ExperimentModel experiment)
        {
            var toUpdate = Experiments.FirstOrDefault(x => x.Id == experiment.Id);

            if (toUpdate == null)
            {
                Experiments.Add(experiment);
            }
            else
            {
                toUpdate.Save(experiment);
            }

            OnExperimentsChanged();
            OnPlatesChanged();
        }
Beispiel #19
0
 private void AddExperiment(Experiment experiment)
 {
     if (dataGridViewExperiment.InvokeRequired)
     {
         var      d       = new AddExperimentDeligate(AddExperiment);
         object[] objects = { experiment };
         Invoke(d, objects);
     }
     else
     {
         Experiments.Add(experiment);
         dataGridViewExperiment.DataSource = null;
         dataGridViewExperiment.DataSource = Experiments;
         dataGridViewExperiment.Refresh();
     }
 }
Beispiel #20
0
 public void RemoveExperiment(string experimentName, int userPermissionLevel = 0)
 {
     #region Preconditions
     if (userPermissionLevel < MinUserLevelToAdmin)
     {
         throw new SecurityException("Cannot remove experiment with current user permission");
     }
     if (Started)
     {
         throw new InvalidOperationException("Cannot remove experiment to running server");
     }
     if (!Experiments.ContainsKey(experimentName))
     {
         throw new InvalidOperationException("Cannot remove unexisting experiment");
     }
     #endregion
     Experiments.Remove(experimentName);
 }
        static void DefineDelegates(Experiments Ex)
        {
            switch (Ex)
            {
            case Experiments.SimpleRange:
                Console.WriteLine("Простые вычисления при равномерной сложности на диапазоне");
                Operation         = OperationSimple;
                ParallelOperation = ParallelOperationRange;
                ThreadOperation   = ThreadOperationSimple;
                break;

            case Experiments.HardRange:
                Console.WriteLine("Сложные вычисления при равномерной сложности на диапазоне");
                Operation         = OperationHard;
                ParallelOperation = ParallelOperationRange;
                ThreadOperation   = ThreadOrepationHard;
                break;

            case Experiments.SimpleCircular:
                Console.WriteLine("Простые вычисления при равномерной сложности и круговом разделении");
                Operation         = OperationSimple;
                ParallelOperation = ParralelOperationCircular;
                ThreadOperation   = ThreadOperationRegularCircular;
                break;

            case Experiments.SimpleIrregularRange:
                Console.WriteLine("Вычисления при неравномерной сложности на диапазоне");
                cN                = 1;
                ReplayCount       = 1;
                Operation         = OperationIrregular;
                ParallelOperation = ParallelOperationRange;
                ThreadOperation   = ThreadOperationIrregularRange;
                break;

            case Experiments.SimpleIrregularCircular:
                cN          = 1;
                ReplayCount = 1;
                Console.WriteLine("Вычисления при неравномерной сложности и круговом разделении");
                Operation         = OperationIrregular;
                ParallelOperation = ParralelOperationCircular;
                ThreadOperation   = ThreadOperationIrregularCircular;
                break;
            }
        }
Beispiel #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["courseNo"] == null)
     {
         Javascript.GoHistory(-1, Page);
         return;
     }
         experimentId = 0;
         if (CommonUtility.SafeCheckByParams<string>(Request["experimentId"], ref experimentId))
         {
             DalOperationAboutExperiment dalOperationAboutExperiment = new DalOperationAboutExperiment();
             experiment = dalOperationAboutExperiment.GetExperimentById(experimentId);
             experimentResourcesIdt = experiment.experimentResourceId;
         }
         else
         {
             Javascript.GoHistory(-1, Page);
         }
 }
Beispiel #23
0
        public async Task <IActionResult> Create([Bind("Name,Metadata,SensorId")] ExperimentCreateViewModel experimentVm)
        {
            if (ModelState.IsValid)
            {
                Experiments experiment = new Experiments
                {
                    Name      = experimentVm.Name,
                    Metadata  = experimentVm.Metadata,
                    CreatedAt = DateTime.Now
                };

                db.Add(experiment);
                await db.SaveChangesAsync().ConfigureAwait(true);

                ExperimentSensors experimentSensor = new ExperimentSensors
                {
                    ExperimentId = experiment.ExperimentId,
                    SensorId     = experimentVm.SensorId
                };

                db.Add(experimentSensor);
                await db.SaveChangesAsync().ConfigureAwait(true);

                UserExperiments userExperiment = new UserExperiments
                {
                    UserId       = GetCurrUserId(),
                    ExperimentId = experiment.ExperimentId
                };

                db.Add(userExperiment);
                await db.SaveChangesAsync().ConfigureAwait(true);

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["SensorId"] = new SelectList(
                db.Sensors,
                "SensorId",
                "Name",
                experimentVm.SensorId);

            return(View(experimentVm));
        }
        public void clearAllTables()
        {
            Groups.RemoveRange(Groups);
            AnswersByPhone.RemoveRange(AnswersByPhone);
            //Rooms.RemoveRange(Rooms);
            //Teachers.RemoveRange(Teachers);
            MeasureInstructionsData.RemoveRange(MeasureInstructionsData);
            OneMeasuresEvalData.RemoveRange(OneMeasuresEvalData);
            OneMeasuresByGroupId.RemoveRange(OneMeasuresByGroupId);
            MeasurementsByGroupId.RemoveRange(MeasurementsByGroupId);
            Measurements.RemoveRange(Measurements);
            ActiveExperiments.RemoveRange(ActiveExperiments);
            Experiments.RemoveRange(Experiments);
            Activities.RemoveRange(Activities);
            ActivityLogs.RemoveRange(ActivityLogs);
            //Students.RemoveRange(Students);

            SaveChanges();
        }
        private async void resetButton_Click(object sender, RoutedEventArgs e)
        {
            Settings.Reset();
            Experiments.Reset();

            foreach (TabItem each in tabControl.Items)
            {
                each.Tag = null;
            }

            await LoadSettings();

            UpdateTheme         = false;
            UpdateBackground    = false;
            UpdateHours         = false;
            UpdateTimeFormat    = false;
            UpdateAutoSave      = false;
            UpdateWeatherMetric = false;
            BackstageEvents.StaticUpdater.InvokeForceUpdate(this, new ForceUpdateEventArgs(true, true, true, true, true, true));
        }
        public void UpdateExperiment()
        {
            SetUp();

            db             = new InMemoryDatabase();
            experimentsDAO = new Experiments(db);

            experimentsDAO.Add(e);

            e.Summary = "summary";
            experimentsDAO.Update(e);

            d["summary"] = "summary";

            Assert.IsTrue(db.Experiments.Count() == 1);

            var e2 = db.Experiments[0];

            Assert.IsTrue(e2.Count == d.Count);
            Assert.IsFalse(e2.Except(d).Any());
        }
Beispiel #27
0
 public void AddExperiment(Experiment experiment, int userPermissionLevel = 0)
 {
     #region Preconditions
     if (string.IsNullOrEmpty(experiment.Name))
     {
         throw new InvalidOperationException("Cannot add experiment with empty Name");
     }
     if (userPermissionLevel < MinUserLevelToAdmin)
     {
         throw new SecurityException("Cannot add experiment with current user permission");
     }
     if (Started)
     {
         throw new InvalidOperationException("Cannot add experiment to running server");
     }
     if (Experiments.Values.Any(x => x.Name == experiment.Name))
     {
         throw new InvalidOperationException(string.Format("Cannot add experiment with dupplicate name: {0}",
                                                           experiment.Name));
     }
     #endregion
     Experiments.Add(experiment.Name, experiment);
 }
Beispiel #28
0
    protected void submitExpriment_Click(object sender, EventArgs e)
    {
        UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
        DalOperationAboutExperiment DalOperationAboutExperiment = new DalOperationAboutExperiment();

        Experiments experiment = new Experiments
        {
            studentNo = UserCookiesInfo.userNo,
            experimentResourceId = experimentResourceId,
            updateTime = DateTime.Now,
        };
        if (hidAttachmentId.Value.CompareTo(string.Empty) != 0)
        {
            experiment.attachmentId = hidAttachmentId.Value;
        }
        else
        {
            Javascript.Alert("请上传附件!", Page);
            return;
        }

        DalOperationAboutExperiment.SubmitExperiment(experiment);
        Javascript.RefreshParentWindow("提交成功!","haha", Page);
    }
Beispiel #29
0
        /// <inheritdoc />
        public override void Reset()
        {
            entityIdSelf    = default(long);
            runtimeEntityId = default(long);
            playerGamemode  = default(int);
            spawn           = default(Vector3);
            rotation        = default(Vector2);
            seed            = default(int);
            biomeType       = default(short);
            biomeName       = default(string);
            dimension       = default(int);
            generator       = default(int);
            gamemode        = default(int);
            difficulty      = default(int);
            x = default(int);
            y = default(int);
            z = default(int);
            hasAchievementsDisabled = default(bool);
            time     = default(int);
            eduOffer = default(int);
            hasEduFeaturesEnabled             = default(bool);
            eduProductUuid                    = default(string);
            rainLevel                         = default(float);
            lightningLevel                    = default(float);
            hasConfirmedPlatformLockedContent = default(bool);
            isMultiplayer                     = default(bool);
            broadcastToLan                    = default(bool);
            xboxLiveBroadcastMode             = default(int);
            platformBroadcastMode             = default(int);
            enableCommands                    = default(bool);
            isTexturepacksRequired            = default(bool);
            gamerules                         = default(GameRules);
            experiments                       = default(Experiments);
            bonusChest                        = default(bool);
            mapEnabled                        = default(bool);
            permissionLevel                   = default(int);
            serverChunkTickRange              = default(int);
            hasLockedBehaviorPack             = default(bool);
            hasLockedResourcePack             = default(bool);
            isFromLockedWorldTemplate         = default(bool);
            useMsaGamertagsOnly               = default(bool);
            isFromWorldTemplate               = default(bool);
            isWorldTemplateOptionLocked       = default(bool);
            onlySpawnV1Villagers              = default(bool);
            gameVersion                       = default(string);
            limitedWorldWidth                 = default(int);
            limitedWorldLength                = default(int);
            isNewNether                       = default(bool);
            experimentalGameplayOverride      = default(bool);
            levelId   = default(string);
            worldName = default(string);
            premiumWorldTemplateId = default(string);
            isTrial      = default(bool);
            movementType = default(int);
            movementRewindHistorySize = default(int);
            enableNewBlockBreakSystem = default(bool);
            currentTick              = default(long);
            enchantmentSeed          = default(int);
            blockPalette             = default(BlockPalette);
            itemstates               = default(Itemstates);
            multiplayerCorrelationId = default(string);
            enableNewInventorySystem = default(bool);
            serverVersion            = default(string);

            base.Reset();
        }
 internal SiteConfigAutoGeneratedData(ResourceIdentifier id, string name, ResourceType type, string kind, int?numberOfWorkers, IList <string> defaultDocuments, string netFrameworkVersion, string phpVersion, string pythonVersion, string nodeVersion, string powerShellVersion, string linuxFxVersion, string windowsFxVersion, bool?requestTracingEnabled, DateTimeOffset?requestTracingExpirationTime, bool?remoteDebuggingEnabled, string remoteDebuggingVersion, bool?httpLoggingEnabled, bool?acrUseManagedIdentityCreds, string acrUserManagedIdentityID, int?logsDirectorySizeLimit, bool?detailedErrorLoggingEnabled, string publishingUsername, IList <NameValuePair> appSettings, IList <ConnStringInfo> connectionStrings, SiteMachineKey machineKey, IList <HandlerMapping> handlerMappings, string documentRoot, ScmType?scmType, bool?use32BitWorkerProcess, bool?webSocketsEnabled, bool?alwaysOn, string javaVersion, string javaContainer, string javaContainerVersion, string appCommandLine, ManagedPipelineMode?managedPipelineMode, IList <VirtualApplication> virtualApplications, SiteLoadBalancing?loadBalancing, Experiments experiments, SiteLimits limits, bool?autoHealEnabled, AutoHealRules autoHealRules, string tracingOptions, string vnetName, bool?vnetRouteAllEnabled, int?vnetPrivatePortsCount, CorsSettings cors, PushSettings push, ApiDefinitionInfo apiDefinition, ApiManagementConfig apiManagementConfig, string autoSwapSlotName, bool?localMySqlEnabled, int?managedServiceIdentityId, int?xManagedServiceIdentityId, string keyVaultReferenceIdentity, IList <IpSecurityRestriction> ipSecurityRestrictions, IList <IpSecurityRestriction> scmIpSecurityRestrictions, bool?scmIpSecurityRestrictionsUseMain, bool?http20Enabled, FtpsState?ftpsState, int?preWarmedInstanceCount, int?functionAppScaleLimit, string healthCheckPath, bool?functionsRuntimeScaleMonitoringEnabled, string websiteTimeZone, int?minimumElasticInstanceCount, IDictionary <string, AzureStorageInfoValue> azureStorageAccounts, string publicNetworkAccess) : base(id, name, type, kind)
 {
     NumberOfWorkers              = numberOfWorkers;
     DefaultDocuments             = defaultDocuments;
     NetFrameworkVersion          = netFrameworkVersion;
     PhpVersion                   = phpVersion;
     PythonVersion                = pythonVersion;
     NodeVersion                  = nodeVersion;
     PowerShellVersion            = powerShellVersion;
     LinuxFxVersion               = linuxFxVersion;
     WindowsFxVersion             = windowsFxVersion;
     RequestTracingEnabled        = requestTracingEnabled;
     RequestTracingExpirationTime = requestTracingExpirationTime;
     RemoteDebuggingEnabled       = remoteDebuggingEnabled;
     RemoteDebuggingVersion       = remoteDebuggingVersion;
     HttpLoggingEnabled           = httpLoggingEnabled;
     AcrUseManagedIdentityCreds   = acrUseManagedIdentityCreds;
     AcrUserManagedIdentityID     = acrUserManagedIdentityID;
     LogsDirectorySizeLimit       = logsDirectorySizeLimit;
     DetailedErrorLoggingEnabled  = detailedErrorLoggingEnabled;
     PublishingUsername           = publishingUsername;
     AppSettings                  = appSettings;
     ConnectionStrings            = connectionStrings;
     MachineKey                   = machineKey;
     HandlerMappings              = handlerMappings;
     DocumentRoot                 = documentRoot;
     ScmType = scmType;
     Use32BitWorkerProcess = use32BitWorkerProcess;
     WebSocketsEnabled     = webSocketsEnabled;
     AlwaysOn             = alwaysOn;
     JavaVersion          = javaVersion;
     JavaContainer        = javaContainer;
     JavaContainerVersion = javaContainerVersion;
     AppCommandLine       = appCommandLine;
     ManagedPipelineMode  = managedPipelineMode;
     VirtualApplications  = virtualApplications;
     LoadBalancing        = loadBalancing;
     Experiments          = experiments;
     Limits                = limits;
     AutoHealEnabled       = autoHealEnabled;
     AutoHealRules         = autoHealRules;
     TracingOptions        = tracingOptions;
     VnetName              = vnetName;
     VnetRouteAllEnabled   = vnetRouteAllEnabled;
     VnetPrivatePortsCount = vnetPrivatePortsCount;
     Cors                                   = cors;
     Push                                   = push;
     ApiDefinition                          = apiDefinition;
     ApiManagementConfig                    = apiManagementConfig;
     AutoSwapSlotName                       = autoSwapSlotName;
     LocalMySqlEnabled                      = localMySqlEnabled;
     ManagedServiceIdentityId               = managedServiceIdentityId;
     XManagedServiceIdentityId              = xManagedServiceIdentityId;
     KeyVaultReferenceIdentity              = keyVaultReferenceIdentity;
     IpSecurityRestrictions                 = ipSecurityRestrictions;
     ScmIpSecurityRestrictions              = scmIpSecurityRestrictions;
     ScmIpSecurityRestrictionsUseMain       = scmIpSecurityRestrictionsUseMain;
     Http20Enabled                          = http20Enabled;
     FtpsState                              = ftpsState;
     PreWarmedInstanceCount                 = preWarmedInstanceCount;
     FunctionAppScaleLimit                  = functionAppScaleLimit;
     HealthCheckPath                        = healthCheckPath;
     FunctionsRuntimeScaleMonitoringEnabled = functionsRuntimeScaleMonitoringEnabled;
     WebsiteTimeZone                        = websiteTimeZone;
     MinimumElasticInstanceCount            = minimumElasticInstanceCount;
     AzureStorageAccounts                   = azureStorageAccounts;
     PublicNetworkAccess                    = publicNetworkAccess;
 }
Beispiel #31
0
        partial void AfterDecode()
        {
            entityIdSelf    = ReadSignedVarLong();
            runtimeEntityId = ReadUnsignedVarLong();
            playerGamemode  = ReadSignedVarInt();
            spawn           = ReadVector3();
            rotation        = ReadVector2();

            //Level Settings
            seed       = ReadSignedVarInt();
            biomeType  = ReadShort();
            biomeName  = ReadString();
            dimension  = ReadSignedVarInt();
            generator  = ReadSignedVarInt();
            gamemode   = ReadSignedVarInt();
            difficulty = ReadSignedVarInt();

            x = ReadSignedVarInt();
            y = ReadVarInt();
            z = ReadSignedVarInt();

            hasAchievementsDisabled = ReadBool();
            time     = ReadSignedVarInt();
            eduOffer = ReadSignedVarInt();
            hasEduFeaturesEnabled             = ReadBool();
            eduProductUuid                    = ReadString();
            rainLevel                         = ReadFloat();
            lightningLevel                    = ReadFloat();
            hasConfirmedPlatformLockedContent = ReadBool();
            isMultiplayer                     = ReadBool();
            broadcastToLan                    = ReadBool();
            xboxLiveBroadcastMode             = ReadVarInt();
            platformBroadcastMode             = ReadVarInt();
            enableCommands                    = ReadBool();
            isTexturepacksRequired            = ReadBool();
            gamerules                         = ReadGameRules();
            experiments                       = ReadExperiments();
            ReadBool();
            bonusChest                  = ReadBool();
            mapEnabled                  = ReadBool();
            permissionLevel             = ReadSignedVarInt();
            serverChunkTickRange        = ReadInt();
            hasLockedBehaviorPack       = ReadBool();
            hasLockedResourcePack       = ReadBool();
            isFromLockedWorldTemplate   = ReadBool();
            useMsaGamertagsOnly         = ReadBool();
            isFromWorldTemplate         = ReadBool();
            isWorldTemplateOptionLocked = ReadBool();
            onlySpawnV1Villagers        = ReadBool();
            gameVersion                 = ReadString();
            limitedWorldWidth           = ReadInt();
            limitedWorldLength          = ReadInt();
            isNewNether                 = ReadBool();
            if (ReadBool())
            {
                experimentalGameplayOverride = ReadBool();
            }
            else
            {
                experimentalGameplayOverride = false;
            }
            //End of level settings.

            levelId   = ReadString();
            worldName = ReadString();
            premiumWorldTemplateId = ReadString();
            isTrial = ReadBool();

            //Player movement settings
            movementType = ReadSignedVarInt();
            movementRewindHistorySize = ReadSignedVarInt();
            enableNewBlockBreakSystem = ReadBool();

            currentTick     = ReadLong();
            enchantmentSeed = ReadSignedVarInt();

            try
            {
                blockPalette = ReadBlockPalette();
            }
            catch (Exception ex)
            {
                Log.Warn($"Failed to read complete blockpallete", ex);
                return;
            }

            itemstates = ReadItemstates();

            multiplayerCorrelationId = ReadString();
            enableNewInventorySystem = ReadBool();
            serverVersion            = ReadString();
        }
    protected void btnAddExperimentResource_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim().Length != 0)
        {
            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
            DateTime deadline_t = Convert.ToDateTime(datepicker.Value);
            if (deadline_t.CompareTo(DateTime.Now) > 0)
            {
                ExperimentResources ExperimentResources = new ExperimentResources
                {
                    courseNo = Request["courseNo"].Trim(),
                    classID = Server.UrlDecode(Request["classID"].Trim()),
                    termTag = Request["termtag"].Trim(),
                    experimentResourceTitle = CommonUtility.JavascriptStringFilter(txtTitle.Text),
                    experimentResourceContent = Textarea1.Value,
                    deadLine = deadline_t,
                    updateTime = DateTime.Now,
                    attachmentIds = hidAttachmentId.Value
                };
                //添加课程实验并返回作业的自增长主键

                using (TransactionScope scope = new TransactionScope())
                {
                    DalOperationAboutExperimentResources DalOperationAboutExperimentResources = new DalOperationAboutExperimentResources();
                    ExperimentResources = DalOperationAboutExperimentResources.InsertExperimentResources(ExperimentResources);

                    //添加了课程实验以后,往提交表中添加记录

                    //查询出选课学生记录
                    DalOperationAboutExperiment doae = new DalOperationAboutExperiment();
                    DalOperationAboutCourses dalOperationAboutCourses = new DalOperationAboutCourses();
                    DataTable dt = dalOperationAboutCourses.FindStudentInfoByCourseNo(Request["courseNo"].ToString().Trim(),Server.UrlDecode(Request["classID"]),Request["termtag"]).Tables[0];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Experiments experiment = new Experiments
                        {
                            experimentResourceId = ExperimentResources.experimentResourceId,
                            studentNo = dt.Rows[i]["studentNo"].ToString().Trim(),
                            updateTime = DateTime.Now,
                            checkTime = DateTime.Now,
                            isExcellent = false,
                            remark = "",
                            excellentTime = DateTime.Now,
                            attachmentId = "0"
                        };
                        doae.InsertExperiment(experiment);
                    }
                    scope.Complete();
                }
                Javascript.RefreshParentWindow("添加成功!", "CInfoExperimentResource.aspx?courseNo=" + Request["courseNo"]+"&classID="+Server.UrlEncode(Server.UrlDecode(Request["classID"]))+"&termtag="+Request["termtag"], Page);

            }
            else
            {
                Javascript.Alert("截止时间不能在当前时间之前", Page);
            }
        }
        else
        {
            Javascript.Alert("标题不能为空!", Page);
        }
    }
Beispiel #33
0
        public void RunExperiments()
        {
            int numExperiments = 0;

            try
            {
                // this will cause all experiments to be formed
                // sine the experiments contain lazy load objects, this is not a heavy process
                numExperiments = Experiments.Count();
            }
            catch (Exception ex)
            {
                Logger.Current.Error("Error in setuping experiments. Make sure the configuration file is formatted correctly. \nError: {0}\n{1}", ex.Message, ex.StackTrace);
                //Environment.Exit(1);
            }

            Logger.Current.Info("Number of experiment cases to be done: {0}", numExperiments);
            int caseNo = 1;

            int totalRunTime = (int)Wrap.MeasureTime(delegate() {
                if (RunParallel)
                {
                    Logger.Current.Info("\nRunning {0} experiments in parallel...\n----------------------------------------", numExperiments);

                    Parallel.ForEach(Experiments, e => RunSingleExperiment(e));
                }
                else
                {
                    foreach (Experiment e in Experiments)
                    {
                        Logger.Current.Info("\nCase {0} of {1}:\n----------------------------------------", caseNo++, numExperiments);
                        RunSingleExperiment(e);
                    }
                }

                foreach (StreamWriter w in _resultWriters.Values)
                {
                    w.Close();
                }

                foreach (StreamWriter w in _statWriters.Values)
                {
                    w.Close();
                }

                foreach (StreamWriter w in _errorWriters.Values)
                {
                    w.Close();
                }

                try
                {
                    if (!string.IsNullOrEmpty(JointFile))
                    {
                        Logger.Current.Info("Joining the results...");

                        var jr    = new JoinResults();
                        var param = new Dictionary <string, string>();
                        param.Add("sourceFiles", ExperimentIds.Select(eId => eId + ".csv").Aggregate((a, b) => a + "," + b));
                        param.Add("outputFile", JointFile);
                        param.Add("delimiter", ResultSeparator);

                        jr.ExperimentManager = this;
                        jr.SetupParameters   = param;
                        jr.Setup();
                        jr.Run();
                    }
                }
                catch (Exception ex)
                {
                    Logger.Current.Error("Error in joining the results: \n{0}\n{1}", ex.Message, ex.StackTrace);
                }
            }).TotalSeconds;

            Logger.Current.Info("\nExperiments are executed: {0} succeeded, {1} failed.\nResults are stored in {2}",
                                numSuccess, numFails, ResultsFolder);
            Logger.Current.Info("Total running time: {0} seconds.", totalRunTime);
        }
        public void SetUp()
        {
            db             = new InMemoryDatabase();
            experimentsDAO = new Experiments(db);
            e = new Experiment("e")
            {
                Description = "d",
                Result      = 3.14,
                Goal        = "Sky",
                Summary     = "",
                Parameters  = new Dictionary <string, string>
                {
                    { "a", "a" },
                    { "b", "b" }
                }
            };
            e2 = new Experiment("e2")
            {
                Description = "d",
                Result      = 3.14,
                Goal        = "Sky",
                Summary     = "",
                Parameters  = new Dictionary <string, string>
                {
                    { "c", "c" },
                    { "d", "d" }
                }
            };
            d = new Dictionary <string, string>
            {
                { "ID", "1" },
                { "name", e.Name },
                { "description", e.Description },
                { "goal", e.Goal },
                { "result", e.Result.ToString() },
                { "summary", e.Summary }
            };
            var p1 = new Dictionary <string, string>
            {
                { "experiment", e.Id.ToString() },
                { "name", "a" },
                { "value", "a" }
            };
            var p2 = new Dictionary <string, string>
            {
                { "experiment", e.Id.ToString() },
                { "name", "b" },
                { "value", "b" }
            };

            m1 = new Measurement(1)
            {
                Result = 3.14, Beginning = s1, End = s2
            };
            m2 = new Measurement(2)
            {
                Result = 6.28, Beginning = s4, End = s6
            };
            m3 = new Measurement(3)
            {
                Result = 0, Beginning = s7, End = s8
            };

            m1.Add(new List <Sample> {
                s1, s2, s3
            });
            m2.Add(new List <Sample> {
                s4, s5, s6
            });
            m3.Add(new List <Sample> {
                s7, s8
            });

            p = new List <Dictionary <string, string> > {
                p1, p2
            };
            e.AddMeasurements(new List <Measurement> {
                m1, m2
            });
            e2.AddMeasurements(new List <Measurement> {
                m3
            });
        }
        static void DefineDelegates(Experiments Ex)
        {
            switch (Ex)
            {
            case Experiments.FilesLocalBufferWords:
                Console.WriteLine("Локальные буферы, слова");
                Operation          = SequenceWords;
                ThreadOperation    = LocalBuffersWords;
                ParallelOperation  = FileDecomposition;
                ConcatDictionaryes = ConcatDirWords;
                Check = CheckWords;
                break;

            case Experiments.FilesGlobalBufferWords:
                Console.WriteLine("Глобальный буфер, слова");
                Operation          = SequenceWords;
                ThreadOperation    = GlobalBufferWords;
                ParallelOperation  = FileDecomposition;
                ConcatDictionaryes = () => { };
                Check = CheckConWords;
                break;

            case Experiments.FilesLocalBufferSym:
                Console.WriteLine("Локальные буферы, символы");
                Operation = SequenceSymbols;

                ThreadOperation    = LocalBuffersSymbols;
                ParallelOperation  = FileDecomposition;
                ConcatDictionaryes = ConcatDirSym;
                Check = CheckSym;
                break;

            case Experiments.FilesGlobalBufferSym:
                Console.WriteLine("Глобальный буфер, символы");

                Operation          = SequenceSymbols;
                Check              = CheckConSym;
                ThreadOperation    = GlobalBufferSymbols;
                ParallelOperation  = FileDecomposition;
                ConcatDictionaryes = () => { };
                break;

            case Experiments.TaskSym:
                Console.WriteLine("Декомпозиция по задачам, символы");
                Operation          = SequenceSymbols;
                Reader             = ReaderSymbol;
                Check              = CheckSym;
                ParallelOperation  = TaskDecomposition;
                ConcatDictionaryes = ConcatDirSym;
                break;

            case Experiments.TaskWords:
                Console.WriteLine("Декомпозиция по задачам, слова");
                Operation          = SequenceWords;
                Reader             = ReaderWord;
                Check              = CheckWords;
                ParallelOperation  = TaskDecomposition;
                ConcatDictionaryes = ConcatDirWords;
                break;

            case Experiments.FilesLocalNum:
                Console.WriteLine("Локальные буферы, числа");
                Operation          = SeqNumbers;
                ThreadOperation    = LocalNumbers;
                ParallelOperation  = FileDecomposition;
                ConcatDictionaryes = ConcatDirWords;
                Check = CheckWords;
                break;

            case Experiments.FilesGlobalNum:
                Console.WriteLine("Глобальный буфер, числа");
                Operation          = SeqNumbers;
                ThreadOperation    = GlobalNumbers;
                ParallelOperation  = FileDecomposition;
                ConcatDictionaryes = () => { };
                Check = CheckConWords;
                break;

            case Experiments.TaskNum:
                Console.WriteLine("Декомпозиция по задачам, числа");
                Operation          = SeqNumbers;
                Reader             = ReaderNumber;
                Check              = CheckWords;
                ParallelOperation  = TaskDecomposition;
                ConcatDictionaryes = ConcatDirWords;
                break;


            case Experiments.FileLocalBuffSymLinq:
                Console.WriteLine("LINQ Локальные буферы, символы");
                Operation          = SequenceSymbolsLinq;
                ThreadOperation    = LocalBuffersSymbolsLinq;
                ParallelOperation  = FileDecomposition;
                ConcatDictionaryes = ConcatDirSym;
                Check = CheckSym;
                break;
            }
        }