コード例 #1
0
ファイル: STOClient.cs プロジェクト: TzarIvan/ratel
            public STORunner(int numInstances, int systemId, int start, int?end, bool noKill)
            {
                this.numInstances = numInstances;
                this.systemId     = systemId;
                this.start        = start;
                this.noKill       = noKill;
                details           = SystemDetailsTable.DETAILS.details(systemId);
                this.end          = end.HasValue ? end.Value : details.lastRunNumber();
                writer            = new STOMetricsWriter(details, false);
                STO.populateSymbolsPortfolios(details, out symbols, out portfolios);
                runner = new EC2Runner(systemId + "-" + Dates.yyyyMmDdHhMmSsNoSeparator(Dates.now()));
                LogC.info("checking for completed runs");
                existingRuns = completedRuns();
                var allRunsComplete = true;

                for (var i = this.start; i <= this.end; i++)
                {
                    if (!existingRuns.Contains(i))
                    {
                        allRunsComplete = false;
                        break;
                    }
                }
                if (allRunsComplete)
                {
                    this.numInstances = 0;
                }
                unhandledExceptionProcessor = ((sender, args) => killRun(LogC.errMessage("unhandled exception", (Exception)args.ExceptionObject)));
            }
コード例 #2
0
        public ActionResult CreateRestoran(RESTORAN restoran)
        {
            var restarauntWithSameID = db.RESTORANs.Where(m => m.NAZIV_RESTORANA == restoran.NAZIV_RESTORANA).SingleOrDefault();

            if (ModelState.IsValid)
            {
                if (restarauntWithSameID == null)
                {
                    restoran.BROJ_KOLONA = 1;
                    db.RESTORANs.Add(restoran);


                    for (int i = 1; i <= restoran.BROJ_STOLOVA; i++)
                    {
                        STO sto = new STO();
                        sto.ID_STOLA     = i.ToString();
                        sto.BR_STOLICA   = 4;
                        sto.ID_RESTORANA = restoran.ID_RESTORANA;
                        db.STOes.Add(sto);
                        db.SaveChanges();
                    }

                    db.SaveChanges();
                    return(RedirectToAction("ProfilAdmina"));
                }

                else
                {
                    ViewBag.Message = "Postoji restoran sa ovim nazivom!";
                    return(View(restoran));
                }
            }
            return(View());
        }
コード例 #3
0
ファイル: STOServer.cs プロジェクト: TzarIvan/ratel
        MetricResults metrics(Fields fields)
        {
            var simulator = STO.run(systemId, symbols, portfolios, fields.integer("RunNumber"), loader, false, false);

            simulator.bridge.statistics().writeSTOFiles(false);
            return(simulator.metrics());
        }
コード例 #4
0
ファイル: MainPanel.cs プロジェクト: TzarIvan/ratel
        void populateMarkets(int id)
        {
            List <Symbol>    symbols;
            List <Portfolio> portfolios;

            STO.populateSymbolsPortfolios(details, out symbols, out portfolios);
            var names = O.list(O.convert(portfolios, p => p.name));

            names.AddRange(O.convert(symbols, s => s.name));
            marketBox.populateWithAll(names, false);
        }
コード例 #5
0
ファイル: STOServer.cs プロジェクト: TzarIvan/ratel
 public STOServer(int systemId, int serverIndex)
 {
     this.systemId = systemId;
     details       = SystemDetailsTable.DETAILS.details(systemId);
     STO.populateSymbolsPortfolios(details, out symbols, out portfolios);
     loader = STO.loader(details, symbols);
     heart  = new Heartbeat(Bootstrap.LOCAL_CLOUD_BROKER, "Tornado.heartbeat.server." + systemId + "." + serverIndex, 3000, fields => {
         fields.put("ServerIndex", serverIndex);
         fields.put("SystemId", systemId);
     });
 }
コード例 #6
0
ファイル: CurveFiles.cs プロジェクト: TzarIvan/ratel
        static List <string> allMarkets(SystemDetailsTable.SystemDetails details)
        {
            var              result = new List <String>();
            List <Symbol>    symbols;
            List <Portfolio> portfolios;

            STO.populateSymbolsPortfolios(details, out symbols, out portfolios);
            result.AddRange(convert(symbols, s => s.name));
            result.AddRange(convert(portfolios, p => p.name));
            result.Add("ALL");
            return(result);
        }
コード例 #7
0
        public static void Announce(STO DateCalc, DateTime FinalDay)
        {
            Console.WriteLine("Todays Date: {0}", DateCalc.Now.ToShortDateString());
            Console.WriteLine("Daily Quests will be available on {0} at {1}", DateCalc.Reset.ToShortDateString(), DateCalc.Reset.ToShortTimeString());
            Console.WriteLine("Estimated date of completion: {0}", DateCalc.DateNeeded().ToShortDateString());
            Console.WriteLine("Days needed to complete the event: {0}", DateCalc.DaysNeeded.Days);

            if (FinalDay < DateCalc.Now)
            {
                Console.WriteLine("There is no way to complete this event, sorry.");
            }
            else if (FinalDay.Day == DateCalc.Now.Day)
            {
                Console.WriteLine("You have to do dailies every day to be able to get enough tokens.");
            }
            Console.WriteLine("The last day to start the event is: {0}", FinalDay.ToShortDateString());
            Console.WriteLine("The event ends on {0}", DateCalc.End.ToShortDateString());
        }
コード例 #8
0
ファイル: STOMetricResults.cs プロジェクト: TzarIvan/ratel
        public static void Main(string[] args)
        {
            var arguments = Arguments.arguments(args, jStrings("id", "addParametersOnly"));
            var id        = arguments.integer("id");
            var details   = SystemDetailsTable.DETAILS.details(id);
            var sto       = new sto.STO(details);

            hamsterfyParametersFile(id, sto.paramsFile());
            if (arguments.get("addParametersOnly", false))
            {
                return;
            }
            List <Symbol>    symbols;
            List <Portfolio> portfolios;

            STO.populateSymbolsPortfolios(details, out symbols, out portfolios);
            hamsterfyMetricsFile(id, sto.metricFile("ALL"));
            each(symbols, s => hamsterfyMetricsFile(id, sto.metricFile(s.name)));
            each(portfolios, p => hamsterfyMetricsFile(id, sto.metricFile(p.name)));
        }
コード例 #9
0
        static void Main(string[] args)
        {
            ParserResult <Options> result  = Parser.Default.ParseArguments <Options>(args);
            STOFactory             Factory = new STOFactory();
            Date     Dates      = new Date();
            DateTime End        = DateTime.Now + TimeSpan.FromDays(20);
            STO      DateCalc   = Factory.Create(End.ToString(), 20.0f, 20u, 20u, 10u);
            bool     UseOptions = new bool();

            Prompts Prompt = new Prompts("Enter the date that the event ends: ",
                                         "Enter the number of hours until dailies reset: ",
                                         "Enter the number of tokens needed to complete the event: ",
                                         "Enter the number of tokens you currently have: ",
                                         "Enter the number of tokens you get on a daily basis: ");

            ExceptionMsgs ExceptMsgs = new ExceptionMsgs("You must enter a date.",
                                                         "You must enter the number of hours until reset.",
                                                         "You must enter the number of tokens needed to complete the event.",
                                                         "You must enter the number of tokens you currently have.",
                                                         "You must enter the number of tokens you get on a daily basis.");

            result.WithParsed(options =>
            {
                if (options.Quiet == true && options.Json == false && options.PrintJSON == false)
                {
                    options.PrintJSON = true;
                    Console.Error.WriteLine("Neither --json or --print-json were specified, activating --print-json\n");
                }
            });

            UseOptions = result.MapResult(options => {
                if (options.DailyTokens == default &&
                    (options.EndDate == default || string.IsNullOrEmpty(options.EndDate)) &&
                    options.Reset == default &&
                    options.TokensClaimed == default &&
                    options.TotalTokens == default)
                {
                    return(false);
                }
コード例 #10
0
ファイル: Parameters.cs プロジェクト: TzarIvan/ratel
 Dictionary <string, string> stoParameters()
 {
     try {
         var result   = new Dictionary <string, string>();
         var cacheKey = stoDir() + stoId();
         if (!paramCache.ContainsKey(cacheKey))
         {
             var sto = new STO(stoDir(), stoId());
             paramCache[cacheKey] = sto.parameters(systemName(), interval(), version());
         }
         var paramMap = (JMap)paramCache[cacheKey].get(new java.lang.Integer(runNumber()));
         foreach (var key in list <string>(paramMap.keySet()))
         {
             result[key] = paramMap.get(key).ToString();
         }
         result["RunNumber"] = getDirect <string>("RunNumber");
         result["RunMode"]   = getDirect <string>("RunMode");
         return(result);
     } catch (java.lang.Throwable e) {
         util.Log.err("exception caught in stoParameters()", e);
         throw Bomb.toss("java exception caught: ", e);
     }
 }
コード例 #11
0
ファイル: TestMetricFiles.cs プロジェクト: TzarIvan/ratel
        public void testCanWriteMetricFile()
        {
            var id = 5203;

            MetricFiles.writeOne(id, "RE.TEST.TY.1C", 1, new Dictionary <string, double> {
                { "value1", 1.0 },
                { "value2", 5.005 },
                { "value3", 0.005 }
            });
            var details = SystemDetailsTable.DETAILS.details(id);
            var sto     = new STO(details);

            checkMetrics(sto, 1.0, 5.005, 0.005, 1);
            IsTrue(Db.explicitlyCommitted());

            MetricFiles.writeOne(id, "RE.TEST.TY.1C", 10, new Dictionary <string, double> {
                { "value1", 2.0 },
                { "value2", 6.005 },
                { "value3", 0.006 }
            });
            checkMetrics(sto, 2.0, 6.005, 0.006, 10);
            IsTrue(Db.explicitlyCommitted());
        }
コード例 #12
0
ファイル: LearRep830.cs プロジェクト: Zaidegroj/EdiApi
        public override string ToString()
        {
            string Ret = string.Empty;

            Ret += ISAO.Ts();
            Ret += GSO.Ts();
            Ret += STO.Ts();
            Ret += BFRO.Ts();
            Ret += LINO.Ts();
            Ret += UITO.Ts();
            Ret += PRSO.Ts();
            Ret += N1O.Ts();
            Ret += N4O.Ts();
            Ret += SDPO.Ts();
            Ret += FSTO.Ts();
            Ret += ATHO.Ts();
            Ret += SHPO.Ts();
            Ret += NTEO.Ts();
            Ret += CTTO.Ts();
            Ret += STO.StTrailerO.Ts();
            Ret += GSO.GSTrailerO.Ts();
            Ret += ISAO.ISATrailerO.Ts();
            return(Ret);
        }
コード例 #13
0
ファイル: TestMetricFiles.cs プロジェクト: TzarIvan/ratel
 static void checkMetrics(STO sto, double value1, double value2, double value3, int run)
 {
     AreEqual(value1, sto.getMetric("value1", "RE.TEST.TY.1C", run));
     AreEqual(value2, sto.getMetric("value2", "RE.TEST.TY.1C", run));
     AreEqual(value3, sto.getMetric("value3", "RE.TEST.TY.1C", run));
 }