static void Main(string[] args) { Console.WriteLine($"Startup state is {Caffe.InitCaptcha("./deploy.prototxt", ConfigurationManager.AppSettings["Caffemodel"], "./label-map.txt", -1, 32)}"); // Bind unity container UnityConfig.Configure(); FillUnityContainer(); // Bind message source MessageSourceConfig.Configure(LocalDiscernService, LzRemoteDiscernService, RkRemoteDiscernService); //MessageSourceConfig.Configure(LocalReportMessageService, LzReportMessageService, RkReportMessageService); // Bind receive messsages callback method QueueConfig.StartupMessageReceive(MultiQueue.Captcha, ReceiveMessageService.OnMessage); // Bind report error messsages callback method //QueueConfig.StartupMessageReceive(MultiQueue.Report, ReportMessageService.OnMessage); #region print some messages Console.WriteLine("Please enter \"exit\" to exit the system safely."); var cmdLine = string.Empty; do { cmdLine = Console.ReadLine(); } while (cmdLine != "exit"); QueueConfig.Close(); #endregion }
private unsafe void btnTrain_Click(object sender, EventArgs e) { this.btnTrain.Enabled = false; Caffe.TraindEventCallback func = new Caffe.TraindEventCallback(trainCallback); Caffe.setTraindEventCallback(func); new Thread(new ThreadStart(() => { try { Caffe.train_network("train --solver=solver.prototxt"); } catch (Exception ex) { WriteLog2(ex.ToString()); this.Invoke(new Action(() => { if (this.checkBox1.Checked) { Process.Start("shutdown.exe", "-s");//关机 } else { MessageBox.Show(ex.Message); } })); } })).Start(); }
public void Post([FromBody] Caffe customer) { if (ModelState.IsValid) { repository.Add(customer); } }
public void Put(int id, [FromBody] Caffe customer) { customer.IDCaffe = id; if (ModelState.IsValid) { repository.Update(customer); } }
private void helpDeleteCaffe(Caffe c) { List <Event> caffeEvents = c.OrganizedEvents.ToList(); foreach (Event e in caffeEvents) { helpDeleteEvent(e); } vinylContext.Caffes.Remove(c); }
public override void OnNority(Captcha captcha, byte[] binary, Action <string> call) { if (!captcha.Channel.ToUpper().StartsWith("T")) { call(null); return; } string code = Caffe.GetCaptcha(binary); if (code.Length == 0) { code = null; } call(code); }
public IActionResult PostAddCaffe([FromBody] Caffe c) { string role = User.Claims.SingleOrDefault(u => u.Type == ClaimsRole).Value; if (role != Constants._RoleOwner && role != Constants._RoleAdminOwner) { return(Unauthorized()); } if (!ModelState.IsValid) { return(BadRequest("Model is not valid.")); } vinylContext.Caffes.Add(c); vinylContext.SaveChanges(); return(Ok()); }
public static void AddNewBar(string NameShop, Vector3 position) { const int eCola = 50; const int Sprunk = 50; const int Schokoriegel = 50; const int Wasser = 50; const int Chips = 50; const int Repair_Kit = 50; const int Bottle = 50; const int Flashlight = 50; const int Beer = 50; const int Caffe = 50; const int Benzin_Kanister = 50; const int Tabak = 50; const int Gamburger = 50; const int Viske = 50; switch (NameShop) { case "Bar": Dictionary <string, string> parametersBar = new Dictionary <string, string> { { "@NameShop", NameShop }, { "@Position", JsonConvert.SerializeObject(position) }, { "@eCola", eCola.ToString() }, { "@Sprunk", Sprunk.ToString() }, { "@Schokoriegel", Schokoriegel.ToString() }, { "@Wasser", Wasser.ToString() }, { "@Chips", Chips.ToString() }, { "@Repair_Kit", Repair_Kit.ToString() }, { "@Bottle", Bottle.ToString() }, { "@Flashlight", Flashlight.ToString() }, { "@Beer", Beer.ToString() }, { "@Caffe", Caffe.ToString() }, { "@Benzin_Kanister", Benzin_Kanister.ToString() }, { "@Tabak", Tabak.ToString() }, { "@Gamburger", Gamburger.ToString() }, { "@Viske", Viske.ToString() } }; DataTable resultBar = Database.ExecutePreparedStatement("INSERT INTO bar_storages (NameShop, Position, eCola, Sprunk, Schokoriegel, Wasser, Chips, Repair_Kit, Bottle, Flashlight, Beer, Caffe, Benzin_Kanister, Tabak, Gamburger, Viske) " + "VALUES (@NameShop, @Position, @eCola, @Sprunk, @Schokoriegel, @Wasser, @Chips, @Repair_Kit, @Bottle, @Flashlight, @Beer, @Caffe, @Benzin_Kanister, @Tabak, @Gamburger, @Viske)", parametersBar); break; } }
public List <Caffe> CreateTestCaffes() { var chemodanCaffe = new Caffe() { Description = "«Чемодан» на Железной - оригинальный ресторан Днепропетровска", LinkToImage = "@TestLink", Name = "Чемодан", Notes = "", Rating = 5, IsFreeBeverages = false, Latitude = (long)(48.466869), Longitude = (long)(35.048002), Lunch2Price = 110, Lunch3Price = 120, DistanceFromOffice = 800 }; var banzaiCaffe = new Caffe() { Description = " С первого посещения этот японский ресторанчик «Банзай» станет Вашим любимым заведением!", LinkToImage = "@TestLink", Name = "Банзай", Latitude = (long)48.466910, Longitude = (long)35.048974, Lunch2Price = 95, Lunch3Price = 105, DistanceFromOffice = 750 }; using (var context = CreateLazyPhytonsContext()) { context.Caffes.AddRange(new List <Caffe> { chemodanCaffe, banzaiCaffe }); context.SaveChanges(); return(context.Caffes.ToList()); } }
public IActionResult PutUpdateCaffe([FromBody] Caffe c) { if (!ModelState.IsValid) { return(BadRequest("Model is not valid")); } Caffe caffe; if ((caffe = vinylContext.Caffes.Find(c.Id)) == null) { return(NotFound("Element not found")); } if (caffe.OwnerRef != User.Claims.SingleOrDefault(u => u.Type == ClaimsIdentifier).Value) { return(Unauthorized()); } caffe.Name = c.Name; caffe.City = c.City; caffe.Address = c.Address; caffe.Info = c.Info; vinylContext.SaveChanges(); return(Ok()); }
public unsafe void ConvertImageSet() { Caffe.ConvertImageset("./ label-train.txt train_lmdb --shuffle=true --gray=true --resize_width=160 --resize_height=60", new Caffe.ConvertImageSetEventCallback(ConvertImageSetCallback)); Caffe.ConvertImageset("./ label-val.txt val_lmdb --shuffle=true --gray=true --resize_width=160 --resize_height=60", new Caffe.ConvertImageSetEventCallback(ConvertImageSetCallback)); }