Posts by Christian Luã Lemos • 431 points
15 posts
-
0
votes1
answer349
viewsA: How to use helpers in Node.js to load settings?
You create a configuration file .js, this file containing module.exports of the data you intend to use. As an example: app.config.js module.exports = { webPort: 80, database: { url :…
node.jsanswered Christian Luã Lemos 431 -
0
votes2
answers227
viewsA: Error in creating Rest api in Javascript
You’re picking up the attributes title, description and tasks of the object req.body in this line: const { title, description, tasks } = req.body; The error that is occurring in the project is…
-
1
votes3
answers71
viewsA: Because when I click the button, you don’t calculate?
This is happening because input1.value and input2.value are strings, so what you’re doing is adding two strings. To solve this problem, it is necessary to convert the value for number. So:…
javascriptanswered Christian Luã Lemos 431 -
2
votes3
answers57
viewsA: Map two arrays and delete item not found
You can use Array.filter and Array.indexOf together to check the permissions of the logged-in user p is already in up. Thus: let p = usuarioLogado.permissions; // permissões do usuário logado let up…
-
0
votes2
answers142
viewsA: Error summing each row of a 5x3 matrix
I believe in your role int conta, vet[i] needs to be incremented by i + j. The complete function stays this way: int conta(int * matriz[5][3], int *vet) { for (int i = 0 ; i<5; i++) { for (int j…
-
3
votes1
answer1276
viewsA: How to change the color of a console line in C?
You can check the ANSI exhaust codes, then use these codes in the printf. Thus: #include <stdio.h> #define VERMELHO "\x1b[31m" #define VERDE "\x1b[32m" #define AZUL "\x1b[34m" #define RESET…
-
9
votes2
answers240
viewsA: How to return a literal object in an Arrow Function?
You can place the object in parentheses. Thus: var items = [1, 2, 3].map( i => ({valor: i, data: new Date()})) console.log(items)…
-
0
votes3
answers963
viewsA: store the value of a query in a php variable
You are storing mysqli_result in the array. The correct code looks like this: function totalEspumas(){ $banco = abrirBanco(); $quantidade_pedidos = "SELECT SUM(quantidade) as total from pedidos";…
-
0
votes1
answer40
viewsA: Doubt about Encryption in passwords
Both are hashing algorithms, because MD5 is currently considered broken, that is, its use is not recommended. SHA256 is a little safer than MD5 and SHA1 (also considered broken), but it is also not…
-
0
votes0
answers96
viewsQ: Implement CSRF token but without affecting navigation
I’m developing a web application written in PHP7. In this application, I developed a module in which CSRF token automatically generates when the user "enters" any application page. This is the…
-
1
votes2
answers5173
viewsA: Check if you returned records in select PHP
<?php $total = mysqli_num_rows($sql); if($total === 0) { echo 'Ainda não existe registro cadastrado'; exit(); } ?>
-
2
votes1
answer498
viewsA: Ajax request does not work
I believe you are missing a header in your search.php and the result needs fetch <?php header('Content-Type: application/json'); include 'conexao.php'; $result = mysqli_query($con, "select * from…
-
1
votes2
answers91
viewsA: Create associative array with other PHP arrays to use as JSON return
I believe this is your answer: <?php header('Content-Type: application/json'); $S1 = [[0,100], [1,200], [2,700]]; $S2 = [[0,700], [1,300], [2,400]]; $Label = [[0,'SPI'], [1,'MVA'], [2,'ITB']];…
-
1
votes1
answer133
viewsA: Table with variable size in HTML
Considering the few data you provided, I believe your solution is something similar to this: <?php $con = new PDO("mysql: host=localhost;dbname=stackoverflow;charset=utf8", "root", "");…
-
1
votes1
answer125
viewsA: Import data in mysql from a layout
Whereas your txt file is something like this: 1 ; ATIVO 2 ; INATIVO 3 ; INATIVO 4 ; INATIVO 5 ; ATIVO If I understand the question correctly, your PHP code will look like this: <?php function…