I was using spritesheets in my game, but I had come to a problem, that I wanted my character to duck (to dodge bullets). I found out that I can use texture atlas. Based on what I have read, I thought, that this approach will resize the sprite, based on its current animation. So when I would duck, the sprite would change its height, because the frame for ducking is less high that the frame for standing. I load the atlas like: game.load.atlasJSONHash('player', '../assets/images/player/player.png', '../assets/images/player/player.json'); I can see that the dimensions in the json are right, that t
We have the following multi match query in Elastic Search { "query": { "bool": { "must": { "multi_match": { "query": "90803", "type": "cross_fields", "fields": [ "POSTAL_CODE^5", "ADDRESS", "CITY" ], "operator": "and" } } } }} How can we pass multiple query parameters. For e.g. we want to pass multiple ID in the query to match against the field Postal Code.
I am trying to map a service model to a view model using Mapster. My service model contains a list of strings. My View Model contains a list of type RolesViewModel. RolesViewModel has a string property named RoleName. Below are my models public class UserViewModel { [Display(Name = "Email address")] [Required(ErrorMessage = "The email address is required")] [EmailAddress(ErrorMessage = "Invalid Email Address")] public string Email { get; set; } public List<RolesViewModel> Roles { get; set; } = new List<RolesViewModel>(); } public class RolesViewModel { public RolesViewModel(string roleName) {
I'm trying to run a maven project using Oxygen.1 a release. I have the cucumber plugin installed. But when I run the default feature file, I'm getting an error Error: Could not find or load main class cucumber.api.cli.Main Please help!
My company distributes an installer to customers via our website. Recently when I download via the website and try to run the installer I get the warning message: Windows protected your PC Windows Defender SmartScreen prevented an unrecognized app from starting. Running this app might put your PC at risk. If I right-click on the installer and choose Properties I note the following: Our installer is signed. How do I find the reason for the Windows Defender SmartScreen warning? I have not managed to find any log file for Windows Defender nor found anything in the Event Viewer.
What would be the simplest way to align a slider with the value of the slider which is on its right? Without using external library. Just using HTML5? Do I need to use CSS for this? How? updateTextInput('0'); function updateTextInput(val) { document.getElementById('amount').value = val; //update current slider value // do other action here } <input type="range" id="rangeInput" name="rangeInput" min="0" max="100" value="0" step="1" oninput="updateTextInput(this.value);"> <output name="amount" id="amount" for="rangeInput">0</output> When running the above, the output (on Chrome on windows looks
Is there a way in python by which I can get contribution of each feature in probability predicted by my gradient boosting classification model for each test observation. Can anyone give actual mathematics behind probability prediction in gradient boosting classification model and how can it be implemented in Python.
TL;DR - how can I nest validation states using a SASS mixin? Long version - I'm having a few difficulties using Bootstrap 4's SASS to generate a dark theme. Some variable replacements are obvious, but others are causing issues. The one I am currently stuck on is form inputs. Bootstrap's SASS will spit out white-background inputs by default. I override this background with a variable I have collected, and set the border to be 50% of the body's text colour (it will have contrast still, but not be stark). At the time of compile (which is a dynamic process handed over to the back end), the compile
I am trying to build a JAR file out of a spring project. When I try to do a maven install, it throws me the following error Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) on project ABC: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to rename 'ABC-0.0.1-SNAPSHOT.jar' to 'ABC-0.0.1-SNAPSHOT.jar.original' -> The 'pom' file is as shown below <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:
I am building a basic react app using create-react-app and react-bootstrap. I am using a table to show information using from react-bootstrap https://react-bootstrap.github.io/components/table/. I am trying to get pagination working for the table and I am not sure how to get around it to work with table. Following is a code snippet of my component, I have added the pagination code-piece from react-bootstrap which just displays the pagination footer at the bottom but doesn't actually paginate the results. App.js import React, { Component } from 'react'; import Table from 'react-bootstrap/lib/Ta
I am receiving this pop up, http://localhost:8080/swagger-ui.html. First i thought it is a password for my database or to my GIT. However non of the above is accepted. package com.gabor.usermanagment.configs; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; impor
I am a new to Laravel. I'm trying to write a login example but it shows "302 Found" error. web.php ( Route file ) : Route::post('login', array( 'uses' => 'UserController@doLogin' )); Route::get('logout', array('uses' => 'UserController@doLogout')); Route::group(['middleware' => 'AuthMiddleWare'], function () { Route::get('/form', function () { return view('form'); }); Route::get('/createUser', function () { return view('users'); }); Route::get('logout', array( 'uses' => 'UserController@doLogout' )); }); "doLogin" function codes which located in UserController: public function doLogin() { $rule
I have a basic plot, with a small number of points on. I would like to label the points with a numeric index, and then have the full description of the point in the legend. These is commonly seen on maps, as shown in the following example: However, there seems to be no built-in function within ggplot to add an index. Here is a MWE of the basic concept: df <- data.frame(x = 6:10, y = 6:10, id = 1:5) df$label <- paste0("Label", df$id) library(ggplot) # Basic plot ggplot(df, aes(x, y)) + geom_point() + geom_label(aes(label = id), nudge_x = 0.2) What I have tried so far is to map the index label t
I'm using NodeJs (expressJs) and archiver module to stream zip file to the client, so the final ZIP file do not existe in server storage (streaming zip serving), but the probleme is that i can't get the size of the output file because the zip process happen in real time. Code : var archiver = require('archiver'); var files = ["file1","file2"]; var zipper = archiver('zip'); zipper.on('error', function(err) { res.status(500).send({ error: err.message }); }); res.attachment('output.zip'); res.setHeader('Content-Type', 'application/zip'); zipper.pipe(res); files.forEach(f => { zipper.file(f, { nam
I try to start simple nodejs server inside Docker container and debug it with chrome://inspect or WebStorm. Debugging port 9229 is binded but inspection not works. On the other hand when I run same code without docker i can inspect it in chrome://inspect and in WebStorm both well. Can anybody explain me why Chrome can't inspect nodejs code in Docker container??? Dockerfile FROM node:8.2.1-alpine WORKDIR /code COPY package.json /code/package.json RUN npm install && npm ls RUN mv /code/node_modules /node_modules COPY . /code EXPOSE 8000 EXPOSE 9229 CMD ["npm", "run", "start"] alexey@home:~/app$
I am trying to write a lambda function that takes information from lex input, and calls a rest api, passing that information as a parameter, returns a string, which i then want to send to lex as a response. It works as expected when run in eclipse, but when i upload the jar to amazon lambda, it is giving no error, but the output string is null. public class LambdaFunctionHandler implements RequestHandler<Map<String,Object>, Object> { @Override public Object handleRequest(Map<String,Object> input, Context context) { ValidationHook.LexRequest lexRequest= LexRequestFactory.createLexRequest(input)
Let's assume that 2 cores are trying to write different values to the same RAM address (1 byte), at the same moment of time (plus-minus eta), and without using any interlocked instructions or memory barriers. What happens in this case and what value will be written to the main RAM? The first one wins? The last one wins? Undetermined behavior?
I am doing quite expensive for the memory parsing of 50000 HTML pages. While parsing, I am writing them to the database which is defined in my docker-compose.yml file. After 25000 pages are parsed parsing stops and I get such an error: AsyncExecutor.default-11" java.lang.OutOfMemoryError: Java heap space How can I change Java heap size in my docker-compose file so all the data could fit into the database? My docker-compose file looks like this: version: '2' services: app: image: "user/app:latest" depends_on: - "db" api: image: "user/=api:latest" ports: - "7070:7070" depends_on: - "db" db: imag
I am trying to run the Amazon app on an iPhone 6 simulator using Xcode. The app is getting installed in the iPhone Simulator, but not able to interact with its elements. Appium version - 1.7.2 Xcode Version 9.2 Platform Mac- 10.12.6 Downloaded the app - i.e. xxx.app.ipa Logs: [Xcode] 2018-02-13 21:23:08.009 xcodebuild[9868:75242] Error Domain=IDEFoundationErrorDomain Code=1 "Cannot launch simulated executable: no file found at /Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner
I have the follow problem: I have differents arrays, each array contain a list of items. I try to insert in database but each item of list result togheter. This is my code: (I use preg_replace to delete <br> between items) $codice = preg_replace('/(<br>)+$/', '', $_POST['jcitemcodice']); $prodotto = preg_replace('/(<br>)+$/', '', $_POST['jcitemname']); $quantita = preg_replace('/(<br>)+$/', '', $_POST['jcitemqty']); $prezzo = preg_replace('/(<br>)+$/', '', $_POST['jcitemprezzo']); $a1 = array("$codice","$prodotto","$quantita","$prezzo"); $res = implode("','" ,$a1); $sql = "INSERT INTO test (co
How can I parse JSON in Kotlin? It gets the entire array from JSON but can not get a particular object from the Array. It worked in Java but not in Kotlin. try { val jsonObject = JSONObject(result) val users = jsonObject.getJSONArray("Users") for (i in 0 until users.length()) { Toast.makeText(applicationContext,"Json Result is----"+result,Toast.LENGTH_LONG).show() val obj = users.getJSONObject(i) val name = obj.get("name").toString() Toast.makeText(applicationContext, "User name: "+name , Toast.LENGTH_LONG).show(); } }catch(e: JSONException){}
I want to pass a value with URL using routerLink and read that value on another page. Like I have Modules and Submodules. On select of first record the id of that record pass to User page. After read that Userid I want to show detail of that User and modules/submodules. So How can I pass and get the Values(object)? Userdetails Component class: import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'userdetail', templateUrl: './userdetail.component.html', styleUrls: ['./userdetail.component.css'] }) export class UserdetailComp
I am new to Tensorflow. Here is the code: def get_batch(image,label,new_height,new_width,batch_size,capacity): image=tf.cast(image,tf.string) label=tf.cast(image,tf.int32) input_queue= tf.train.slice_input_producer([image,label]) label=input_queue[1] image_contents=tf.read_file(input_queue[0]) image=tf.image.decode_jpeg(image_contents,channels=3) image=tf.image.resize_images(image,(new_height,new_width)) image=tf.image.per_image_standardization(image) image_batch,label_batch=tf.train.batch([image,label],batch_size=batch_size,capacity=capacity,num_threads=8) label_batch=tf.reshape(label_batch,[
everyone. I am new to Tensorflow When I wrote the code like this in this part : def get_batch(image,label,new_height,new_width,batch_size,capacity): image=tf.cast(image,tf.string) label=tf.cast(image,tf.int32) input_queue= tf.train.slice_input_producer([image,label]) label=input_queue[1] image_contents=tf.read_file(input_queue[0]) image=tf.image.decode_jpeg(image_contents,channels=3) image=tf.image.resize_images(image,(new_height,new_width)) image=tf.image.per_image_standardization(image) image_batch,label_batch=tf.train.batch([image,label],batch_size=batch_size,capacity=capacity,num_threads=8
I'm using Facebook Messenger to send an audio file to my bot. The webhook call that Facebook sends me includes a URL, which is the audio file and when I download it it's in .mp4 format (weird, since it's supposed to be audio not video). I didn't find any documentation as to why it's .mp4, and whether there is the option to get a different format from Facebook. Anyone knows anything about this?
I have been using AWS for a while now. I always have the difficulty tracking AWS resources and how they are interconnected. Obviously, I am using Terraform but still, there is always ad-hoc operations that cut down my visibility. Since I have been charged multiple times for resources/services that are present but not used by me. Unused services include resources that are not pointing to other services but present in the AWS environment. Tools suggestions are also welcome. Also, posted on DevOps. Posting here since there are fewer people there.
Scenario: ChildComponent - having a lot ngModel binding elements. <input [(ngModel)]="TryToPassDataModel.name">; ParentComponent - btn.onClick = function() { this.bsModalRef = this.modalService.open(ChildComponent, TryToPassDataModel); } This works in ngx-bootstrap, but how to implement this in nb-bootstrap? (it looks like such a simple idea)
I have created a login form with a combo box for the user type (Admin, User) and a text box for the password. The code for the form is as follows. Private Sub txtPassword_AfterUpdate() If IsNull(Me.cboUser) Then MsgBox "You need to select a user!", vbCritical Me.cboUser.SetFocus Else If Me.txtPassword = Me.cboUser.Column(2) Then If Me.cboUser.Column(3) = True Then MsgBox "Password does not match, please re-enter!", vboOkOnly Me.txtPassword = Null Me.txtPassword.SetFocus End If DoCmd.OpenForm "FE1" Me.Visible = False Else MsgBox "Password does not match, please re-enter!", vboOkOnly Me.txtPassw