// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, seed seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddApplicationError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); // app.UseHsts(); } // seeder.SeedUsers(); // app.UseHttpsRedirection(); app.UseCors(x => x.WithOrigins("http://localhost:4200").AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); app.UseAuthentication(); app.UseDefaultFiles(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new { Controller = "FallBack", action = "Index" } ); }); }
public async Task <IActionResult> Putseed(int id, seed seed) { if (id != seed.SeedID) { return(BadRequest()); } _context.Entry(seed).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!seedExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, seed seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddApplicationError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. //app.UseHsts(); } // app.UseHttpsRedirection(); //seeder.SeedUsers(); app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); app.UseAuthentication(); app.UseMvc(); }
public CodeGen() { _codeString = ""; _seed = new seed(""); _template = new CodeTemplate(); _worker = new InsertWorker(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, seed seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddApplicationError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); } // seeder.SeedUser(); //migraciones app.UseCors(x => x.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials()); app.UseAuthentication();//usar autenticacion user app.UseMvc(); }
public async Task <ActionResult <seed> > Postseed(seed seed) { _context.Seeds.Add(seed); await _context.SaveChangesAsync(); return(CreatedAtAction("Getseed", new { id = seed.SeedID }, seed)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, seed seeder) // el seeder es un metodo para agregar registros base de datos { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // Este app useexceptionhandler sirve para el manejo de errores, en lugar de usar mucho try catch este funciona globalmente // Solo funciona cuando el proyecto esta en produccion desde el launchSettings.json de properties app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddApplicationError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); //app.UseHsts(); } //app.UseHttpsRedirection(); //seeder.SeedUsers(); // metodo que utiliza un archivo json para cargar 10 usuarios con foto app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); //siempre va antes que el de mvc app.UseAuthentication(); //para aplicar la autorizacion y codigo app.UseMvc(); }
public static void run() { var para = new List<KeyValuePair<string,string>>(); KeyValuePair<string, string> p1 = new KeyValuePair<string, string>("id","int"); KeyValuePair<string, string> p2 = new KeyValuePair<string, string>("uid", "string"); para.Add(p1); para.Add(p2); var product = new BasicSeed { ReturnType= "ContactEmail", FuncName="Validate", Params = para }; string cls = JsonConvert.SerializeObject(product); seed test = new seed(cls); var basic = test.getBasicSeed(); CodeTemplate codet = new CodeTemplate(basic); var v1 = codet.gen(); codet.writeFile(v1); }
public async Task <ActionResult <seed> > Postseed(seed seed) { var request = HttpContext.Request; var postedFile = request.Form.Files["image"]; if (postedFile != null) { var filePath = Path.GetTempFileName(); var inputStream = new FileStream(filePath, FileMode.Create); await postedFile.CopyToAsync(inputStream); seed.Image = new byte[inputStream.Length]; inputStream.Seek(0, SeekOrigin.Begin); inputStream.Read(seed.Image, 0, seed.Image.Length); } _context.Seeds.Add(seed); await _context.SaveChangesAsync(); return(CreatedAtAction("Getseed", new { id = seed.SeedID }, seed)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, seed seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddApplicationError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); } // app.UseHttpsRedirection(); // seeder.seedUser(); app.UseRouting(); app.UseAuthentication(); app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// Update is called once per frame void Update() { if (Input.GetButtonDown("Interact") && range) { if (planted) { //water method here watered = true; cs.water(); } else if (wither) { planted = false; sd = null; watered = false; } else { convertArray(); bool result = false; for (int i = 0; i < inventoryCopy.Length; i++) { if (inventoryCopy[i] != null && inventoryCopy[i].Contains("Seed")) { firstPos = i; break; } } host = inventory.inventory.GetValue(firstPos) as GameObject; sd = host.GetComponent <seed>(); Remove(firstPos); planted = true; } } }
public WorldZone(int seed, int xDislocation) => Generate(seed, xDislocation);
=> new PcgAvx32Rng(seed, inc);
/// <summary> /// Align two sequence and return align result /// </summary> /// <param name="seq1">sequence 1 as string (case sensitive)</param> /// <param name="seq2">sequence 2 as string (case sensitive)</param> /// <returns>align result array of all highest score entry point</returns> public AlignResult[] Align(string seq1, string seq2, string mType = "Advance DNA") { #region component int l1 = seq1.Length; int l2 = seq2.Length; int[,] dpMatrix = new int[l2 + 1, l1 + 1]; //dynamic program matrix char[,] pointerMatrix = new char[l2 + 1, l1 + 1]; //pointer matrix #endregion #region fill dynamic program char[] seq_1 = seq1.ToCharArray(); char[] seq_2 = seq2.ToCharArray(); // inital dynamic matrix with zero this.dpm_init(dpMatrix, pointerMatrix, l1, l2); // fill dpMatrix and pointer matrix as Needleman Wunsch algorithmn // two different point are marked below int fU, fD, fL; //Create match object MatrixMatch m = new MatrixMatch(mType); for (int i = 1; i <= l2; i++) { for (int j = 1; j <= l1; j++) { int match = (seq_1[j - 1] == seq_2[i - 1]) ? matchScore : misMatchScore; fU = dpMatrix[i - 1, j] - gapPenalty; fD = dpMatrix[i - 1, j - 1] + ((m.Match(seq_1[j - 1], seq_2[i - 1]) >= 1) ? matchScore : misMatchScore); fL = dpMatrix[i, j - 1] - gapPenalty; int max = 0; char ptr; if (fD >= fU && fD >= fL) { max = fD; ptr = '\\'; } else if (fU > fL) { max = fU; ptr = '|'; } else { max = fL; ptr = '-'; } dpMatrix[i, j] = (max < 0) ? 0 : max; //S.W. method score will be not smaller than Zero; pointerMatrix[i, j] = (dpMatrix[i, j] == 0) ? '.' : ptr; //S.W. method trace back will stop at cell with zero score (marked with "."); } } #endregion /* Debug code for present dynamic program ad pointer matrix * * Console.WriteLine("DynamicMatrix"); * print_matrix(dpMatrix, seq1, seq2); * Console.WriteLine("PointerMatrix"); * print_traceback(pointerMatrix,seq1,seq2); */ // S.W method walk from the high score entry point (seed) // The high score cell might be not unique. #region find highest score seed List <seed> highList = new List <seed>(); int listNumber = 10; for (int i = 0; i <= l2; i++) { for (int j = 0; j <= l1; j++) { if (highList.Count < listNumber) { seed newEntry = new seed(i, j); newEntry.Score = dpMatrix[i, j]; highList.Add(newEntry); } else { int insertPoint = listNumber; for (int k = 4; k >= 0; k--) { if (dpMatrix[i, j] >= highList[k].Score) { insertPoint = k; } } if (insertPoint < listNumber) { seed newEntry = new seed(i, j); newEntry.Score = dpMatrix[i, j]; highList.Insert(insertPoint, newEntry); highList.RemoveAt(listNumber); } } } } #endregion //One seed will have one align result // All aligned result will return as a AlignResult array #region track back to zero List <AlignResult> align = new List <AlignResult>(); foreach (seed s in highList) { align.Add(traceBack(pointerMatrix, seq1, seq2, s.X, s.Y)); } return(align.ToArray()); #endregion }
public CodeGen(seed pseed, CodeTemplate pcodetemplate, InsertWorker pworker) { this._seed = pseed; this._template = pcodetemplate; this._worker = pworker; }
public CodeTemplate(seed seed) { this._seed = seed; }
return new Random(seed);