Posts by Michael Pacheco • 1,657 points
51 posts
-
-2
votes2
answers1129
viewsA: What is the purpose and how to use the "display: Contents" of the CSS?
A very interesting use case that can be applied with the Vue.js is when you are building an item Checklist and you want the content of li be a slot (for the content to be customizable) and you want…
-
2
votes1
answer41
viewsQ: Typescript is not checking map types with spread operator
The following code compiles without any type of Warning. It is some configuration that is wrong/missing? interface CategoryInfo { name: { portuguese: string english: string spanish: string } icon:…
typescriptasked Michael Pacheco 1,657 -
7
votes2
answers641
viewsQ: When "Return" is different from "Return await" in an asynchronous function in Javascript?
I was doing a review of MR and saw a test similar to this: it('...', async () => { return await new Promise((resolve, reject) => { request(app.getHttpServer()) .get('...') .send({ /* ... */ })…
-
-2
votes2
answers303
viewsQ: How to assign the result of an object breakdown to a variable that contains all unstructured fields?
Given an object x: const x = { a: 1, b: 2, c: 3 }; and a breakdown: const { a, b } = x; How do I save these unstructured fields in an object that brings them together without having to: const y =…
-
1
votes0
answers21
viewsQ: How to load modules concatenated with Gulp in Requirejs?
My project has several AMD modules being loaded into the browser by Requirejs. However, I am migrating from Javascript to Typescript and also want to use Gulp to transpose to Javascript and generate…
-
1
votes1
answer69
viewsQ: How to make an ssh connection auto-reconnect after a Broken pipe error?
In my work I need to be connected all the time to a remote machine via ssh, but lately the connection has dropped every 5 minutes and it is a very boring task to stay reconnecting. There is a way to…
-
5
votes3
answers232
viewsQ: How to overlay a superclass method using a polymorphic parameter?
I have an abstract superclass Service with an abstract method onExecute(ServiceData data) that is superimposed in the subclass EchoService. However, in this overlaid method, I need the parameter to…
-
0
votes2
answers65
viewsQ: How do I deploy to Kubernetes programmatically?
I have a flask application - A1 - running in a Kubernetes cluster. This application is responsible for receiving HTTP requests and starting another application - A2 - that is also run in this…
-
2
votes3
answers110
viewsA: Take an object from within an array and send it to another array?
let cartasNaMesa = [ { id: 1, valor: 2, naipe: 'Paus' }, { id: 2, valor: 2, naipe: 'Copas' }, { id: 3, valor: 3, naipe: 'Espadas' }, { id: 4, valor: 2, naipe: 'Ouros' }, { id: 5, valor: 3, naipe:…
-
6
votes2
answers53582
viewsA: Access to Xmlhttprequest has been blocked by CORS policy
I found the answer. It was simply because the field data was a javascript object. In documentation says that data can be a PlainObject or String or Array, so I don’t know why it didn’t work. That…
-
3
votes2
answers53582
viewsQ: Access to Xmlhttprequest has been blocked by CORS policy
I have two Flask applications running locally on my machine. One is running on port 5000 and the other on port 5050. I need to make a 5000 app call to 5050. But I’m having this problem: Access to…
-
0
votes0
answers33
viewsQ: How to control CSSS loading using Javascript?
The Requirejs plugin is able to control the import of scripts without the need to spell them out in html with the tag <script>. This brings advantages like dependency control and import order.…
-
0
votes1
answer46
viewsQ: Python cluster application deploy
I need to deploy a python application in a cluster kubernetes. This application is using the venv and I don’t know if it’s right to generate a container image with the venv directory. What is the…
-
-1
votes2
answers47
viewsQ: How to filter an object by the name of the property?
I have the following object: obj = { "storySummaries": { "featuredStories": [], "trendingStories": [ { "image": { "newsUrl": "...", "source": "...", "imgUrl": "..." }, "entityNames": [ "A", "B", "C"…
javascriptasked Michael Pacheco 1,657 -
0
votes1
answer430
viewsQ: How to use Cmake to compile a project with multiple libraries
I’m trying to develop a game in OpenGL, but the IDE I use makes use of the CMake and I’m not getting to set up the project. I’m totally lost. I searched several tutorials of Cmake on the internet,…
-
1
votes1
answer83
viewsA: What is the need of a while in a producer-consumer?
I found the answer to the question. Basically it was answered in the course itself in this video. The while is necessary because there may be more than one Consumer. When a thread consumer T1 which…
-
4
votes1
answer83
viewsQ: What is the need of a while in a producer-consumer?
I’m used to programming using this while in problems involving synchronization of threds because that’s how API’s usually ask you to do it, but I’ve never wondered why it is. I am taking a course of…
-
0
votes0
answers148
viewsQ: How to map Java classes to a specific XML format?
I’m developing a framework that manages system calls and needs to save/load the state of the instance variables in a specific XML format. I looked for tools on the Internet and found the JAXB 2.…
-
3
votes1
answer62
viewsQ: How do I publish my library to a linux repository?
I have developed a C library and I want to make it available to other developers. I wish this library could be installed using the command apt-get, for example: sudo apt-get install minhalib and in…
-
0
votes2
answers47
viewsQ: Socket does not receive or send message to the server
I am implementing a Java multi thread server that receives messages from clients and broadcasts them to others. But I’m having problems. The server only receives messages sent to users when the…
-
0
votes2
answers218
viewsA: How to break an infinite loop using Ctrl-C in Java
I got a temporary solution while others do not appear. What I did was just replace the ShutdownHook by a Thread normal and within the method run I made an infinite loop that reads the user input and…
javaanswered Michael Pacheco 1,657 -
1
votes2
answers218
viewsQ: How to break an infinite loop using Ctrl-C in Java
I have a multithreaded server that sits in an infinite loop waiting for new connections and I want to be able to stop this loop when I press Ctrl-C (or something similar). I tried to use that one…
javaasked Michael Pacheco 1,657 -
0
votes1
answer258
viewsQ: Error while removing table in Postgresql
I am trying to install and configure Postgresql on my machine, however I am having some doubts and some problems. I followed the following steps of the installation tutorial on official website. I…
postgresqlasked Michael Pacheco 1,657 -
2
votes1
answer37
viewsQ: Failed to read formatted file via incoming redirect
I am trying to read the following file via input redirect, but the program is going into infinite loop and with totally wrong readings. When I manually enter the data the program executes as…
-
1
votes0
answers65
viewsQ: How to use glVertexAttribPointer() function correctly for repeated attributes
Hello! I’m trying to render a cube all red, but did not want to specify the color for all vertices in order to save space. For example, we would do so in the traditional way: GLfloat vertices[] = {…
-
1
votes0
answers24
viewsQ: Layout manager for OLED displays
I’m working on a project involving technologies Python3.x, Raspberry pi and dysplays OLED. But there are several displays each with different resolutions and color range and I don’t want to…
-
2
votes1
answer125
viewsQ: Why in Opengl do we need to transform all objects to render them?
I’m a beginner in Openggl and I’m having some difficulties to assimilate some concepts. I’m reading the book Mathematics for 3D Game Programming and Computer Graphics 3ª Ed., in the part where the…
openglasked Michael Pacheco 1,657 -
1
votes2
answers167
viewsQ: How to limit a function parameter so that it is an element of a set?
My intention is to define a function that allows to simulate the execution of a deterministic finite automaton (DFA) datum. According to the formal definition a DFA is the 5-upla M = (Q, Σ, δ, q0,…
-
1
votes0
answers51
viewsQ: Always On Top Style SFML Application
I play an FPS game with the sniper class, but the sniper does not appear as the other weapons, which hinders me when targeting the enemy. I made a program that draws a sight on the screen. It is…
-
3
votes1
answer169
viewsQ: How to rotate a set of vertices around a pivot
I have a set of vertices that I need to rotate at an angle Θ around a pivot, but when I apply the transformation the vertices distort. What’s wrong? I got the answer formula for a similar question…
-
1
votes1
answer58
viewsQ: Google App Engine Python project works on localhost but gives server error
My project is running perfectly on the localhost but when I deploy and access it gives the following error: Here is my code: import os import jinja2 import webapp2 import json from…
-
2
votes1
answer2495
viewsQ: Bubble Sort in Assembly (MIPS)
My teacher asked us to implement Bubble Sort in the MARS environment but I’m not getting it. There is some error in the code. Can anyone find the error? The way out should be {1, 2, 3, 4, 5, 6, 7,…
-
1
votes1
answer436
viewsQ: Implementation of C strcpy function in MIPS using MARS simulator
Why the code below does not work? Error in strcpy.asm line 9: Runtime Exception at 0x00400014: fetch address not Aligned on word Boundary 0x00000001 .text .globl main main: lw $a0, destino # Carrega…
-
13
votes2
answers1435
viewsQ: A game-specific programming language
Is there any programming language specific for the development of video games? A language that is high-performance optimized to use media processing instructions, which is linked to GPU? I know a…
-
46
votes2
answers3637
viewsQ: The first programming language
Until the time when computers were purely mechanics and were programmed by punch cards I understand how it works. Later, when the first "digital" computers operated with valves and relays appeared,…
-
2
votes1
answer144
viewsQ: Skyrim style item system
I am developing a 2D RPG in C# Skyrim style, and I am on the part of implementing the game items, but with many difficulties. I wanted to do a mechanics similar to Skyrim in which you have a range…
-
3
votes1
answer554
viewsQ: Class or the Enum?
I am designing a C# RPG game and found a design decision problem and need help to find the most flexible way to implement the desired. I’ll explain a little bit about the project: There are some…
-
0
votes1
answer244
viewsQ: How do I bump my player with a Tile on Unity 5?
I need to put bumps on some static tiles so the player can’t get past them. I tried to put a Box Collider 2D on player and Tile but it’s not working. How I solve this in the best way possible, in a…
-
1
votes2
answers317
viewsQ: How to make a Transform. Smoothed translate() in unity5?
I need to move one GameObject to any destination, but the transition must be smooth at a constant speed such that it lasts the time that is passed by parameter. For example: void Move(GameObject…
-
0
votes1
answer513
viewsQ: How to use Tiles in Unity 5?
I’m in big trouble. I’m doing a role-playing game and using tilesets with the 32x32-dimensional Tiles for all of the game’s graphics, but Unity doesn’t support tilemaps. I’ve looked for plugins and…
-
1
votes1
answer48
viewsQ: The tab is going through the reset button
I wanted the tab to stop just below the FREE THROW buttons, not at the bottom of the screen. How Do I Fix So Design Is Responsive? Because the content gets messy when the screen is in Landscape…
-
1
votes0
answers279
viewsQ: Attribute drawableTint is only used in API level 23 and Higher
I’m trying to put a colorful icon on EditText but the Android Studio is warning that the attribute that colors the icon (android:drawableTint) is only supported in API's >= 23. What do I do to…
-
2
votes2
answers148
viewsA: Why doesn’t the pointer increase the value?
*p = (*p)++; does not generate undefined behavior, as @Maniero said. This is a command with perfectly understandable and predictable behavior. The problem here is that the command (*p)++, in itself,…
-
1
votes1
answer40
viewsA: `System.Nullreferenceexception` in C
#include <stdio.h> #include <stdlib.h> #include <string.h> void SubString (char *ls_retorno, char *as_origem, int an_inicio, int an_quantidade ) { int ln = 0, ln_cotador = 0; if…
-
3
votes1
answer827
viewsQ: How to adjust the gun so it always shoots where the aim is
I have a gun that is positioned on the screen manually and I need to create a script in such a way that when I fire, the bullet will reach the point where the sight is aiming, which in this case is…
-
4
votes1
answer90
viewsQ: Pass lambda expression on command line
I created a program to calculate the defined integral of a function, but I want to be able to run it through the terminal. #include <iostream> #include <functional> #include…
-
2
votes1
answer493
viewsA: Store value in an Arraylist
ArrayList<ArrayList<String>> valorMatriz = new ArrayList<>(); String v; int linha = jTable2.getRowCount(); int coluna = jTable2.getColumnCount(); for(int i = 0; i < linha; i++){…
-
8
votes1
answer150
viewsQ: What it means to infix on Haskell
What is and what this infixr 3 is for &&? infixr 3 && (&&) :: Bool -> Bool -> Bool True && True = True _ && _ = False
-
3
votes2
answers178
viewsA: How to define a method that receives a lamppost expression?
I found the solution. She was like this: class T { private: double (*expression)(); public: T(double (*exp)()) : expression(exp) {} double execute() { return this->expression(); } }; int main() {…
-
4
votes2
answers178
viewsQ: How to define a method that receives a lamppost expression?
I have a class similar to this one and I wanted the code she executed to be passed as a blank expression. class T { public: double execute(); }; For example: T t; int a = 0, b = 1;…