Posts by Costamilam • 9,556 points
509 posts
-
1
votes1
answer96
viewsQ: Procedures after errors should stay in the services/validations or in the controller?
In a backend that has separate validation functions to check the validity of the data, if this data is invalid the procedure (return a 400 or print something on the screen, for example) must occur…
-
1
votes1
answer109
viewsA: Nodejs multiple url in app.get Express
Express lets you pass a regular expression as the first parameter: app.get(/(urlA|urlB)/, (req, res) => { ... }); Or: app.get(/url(A|B)/, (req, res) => { ... }); Another option, a little more…
-
0
votes0
answers60
viewsQ: Events in three.js and CSS do not work in some languages
The idea is to make a 3d prediction and when you click on an apartment to open on the side (each occupying half the screen) a card with some information, in Vices with width of up to 650px, the card…
-
0
votes1
answer62
viewsA: What code do I use to create a Validate class on Androidstudio?
When a function with the same class name is defined, that function shall be the constructor of that class, and shall be invoked through the operator new As you are creating a validation class, I…
-
0
votes1
answer35
viewsA: Cubes colored on the outside but not on the inside
There is a property in the object passed in MeshBasicMaterial calling for side, defining it with the value THREE.DoubleSide the created object will have stylization on both sides: new…
-
3
votes1
answer99
viewsA: Can I call a class that only does a controller’s record?
The amount of operations a class performs does not define what it is or its behavior, a class that registers 5 different objects does not change its behavior because now only registers 3 The…
-
0
votes1
answer35
viewsQ: Cubes colored on the outside but not on the inside
I made a cube, painted the sides (left, right, top and bottom) and put a border, it was very similar, however, as it does not have the front and the back is possible to see what is behind the edge…
-
0
votes0
answers41
viewsQ: 3d effect on building windows
How to make this effect of windows more outward and others more inward? A Gambi que eu tenho até o momento: body { padding: 0; margin: 0; perspective: 900px; perspective-origin: 100% 100%; }…
-
0
votes2
answers47
viewsA: How to execute function when a <p> tag is filled?
Using Mutationobserver: //Elementos var p = document.querySelector('p'); var input = document.querySelector('input'); var button = document.querySelector('button'); //Quando clicar o botão muda…
-
2
votes1
answer307
viewsA: What is the purpose of the Reflect object in Javascript?
The Reflect brought nothing new, just joined similar characteristics. It is a union of operators like in and delete, functions of Object as defineProperty and getPrototypeOf (with some improvements)…
-
1
votes1
answer142
viewsA: How to instantiate objects using literal object syntax?
Like you said you don’t want to use class javascript will have to do a constructor function, to instantiate has some options: Use the operator new: function Bala(x, y, speed) { this.x = x; this.y =…
-
0
votes1
answer95
viewsA: Problem in javascript variable declaration
As already stated in the comments, name, as well as others, it is a variable that already exists in the object window of Javascript, therefore, the problem, however, when creating it in a different…
-
0
votes1
answer39
viewsQ: PATH_INFO does not show "extra" bars
I’m using the $_SERVER["PATH_INFO"] to pass values to the backend through the url, not in the format ?chave=valor, instead, /:valor/ (identify the colon and return a variable with that name),…
-
3
votes1
answer327
viewsA: Best way to find out if the user is online/offline
Having this kind of thing depending on a user interaction is not a good idea, if the computer shuts down suddenly (power out, force shut down because it has crashed, etc) the data in the database…
-
2
votes2
answers8439
viewsQ: How does the Grid System work in Angular Material Design?
In the documentation of Angular Material Design has a component called Grid List, which, I imagine, is the structuring part of the layout, but it only has two very simple examples and I couldn’t…
-
0
votes3
answers1699
viewsA: What HTTP status returns to an expired token?
I believe the status 400 - Bad request is correct, since the request has an invalid token, so it is also invalid. The status 401 - Unauthorized can be an option if you want something more specific,…
-
1
votes1
answer73
viewsA: Method prompt JS - 'if' 'Else if'
You can use the function match to validate the input by passing a regex. To repeat whenever the input is not valid encapsulate the code in a function call it (function ask() { var name =…
javascriptanswered Costamilam 9,556 -
1
votes1
answer109
viewsQ: Select Multiple with Material Design Lite
How to make a <select multiple> with the CDM? I looked at the website but found nothing. I saw that the Angularjs has it but not the use in the project…
-
5
votes1
answer1303
viewsQ: What are the scenarios in which C# has an advantage over other languages?
Here on the site have some similar questions, for example, What are the ideal use scenarios for Node.js? and Why choose C instead of C++ or C++ instead of C? I would like something in this sense but…
-
3
votes1
answer717
viewsQ: How the Node thread pool works
Assuming that Javascript, both in browser and Node, is single thread (correct me if I’m wrong), like thread pool works? If, for now, my server does not receive many requests or is in development (it…
-
6
votes1
answer1139
viewsQ: What is the usefulness of :host, :host() and :host-context()
What is the usefulness of pseudo classes :host, :host() and :host-context()? If possible with some practical example
-
10
votes4
answers1629
viewsA: Use color, RGB or hexa names?
I will make a few points in favour of both: 1. Ease of maintenance and modifications during development: Changing the tone of a color to darker or lighter or even applying an opacity is simpler with…
cssanswered Costamilam 9,556 -
-2
votes1
answer924
viewsQ: Angular or Angularjs
I saw some questions here on the site related to this but it was more related to update from one to the other and others were closed... What are the main differences between the two? Even being an…
-
3
votes1
answer2946
viewsQ: Angular with Typescript or Javascript?
Researching a little about Angular (v 2+) saw that in many places it is commented that Angular has support for Typescript and that its use is more common than pure Javascript, so what are the…
-
1
votes1
answer60
viewsA: Display rest of BD mysqli data in new PHP window
You can open a new tab using <a target="_blank" ... passing the id through the url and recovering with $_GET: <a href="detalhes.php?id=<?php echo $f["idEmulador"]; ?>"…
-
1
votes2
answers220
viewsA: Item within comment in PHP
All content within /* */ is a comment and all comments will be ignored when running the application, that is, they will never interfere with the end result of any application So yes you can delete,…
-
1
votes2
answers693
viewsA: Save content from a div to a file. html With php or javascript
There are several forms, one of them is with the function fwrite php native: $fp = fopen('data.html', 'w'); fwrite($fp, '<div>texto'); fwrite($fp, '<br>mais texto</div>');…
-
1
votes1
answer153
viewsA: Winning percentage in PHP
You can use the function rand() passing a minimum and maximum value: echo mt_rand(1, 10000); // Mostra um número entre 1 e 10000, por exemplo, 2634 If I’m not mistaken 0.01% is 1 chance every 10000,…
-
0
votes2
answers1255
viewsA: TRANSPARENT NAVBAR
Using jQuery, create a scroll event and in the function you can get the distance between where you are on the page and top with $(window).scrollTop(), check that this value is zero, if it is, put a…
-
1
votes3
answers57
viewsA: How do I get this page error with this code?
You can do something like this: if ($_SERVER["REQUEST_METHOD"]==="POST" && isset($_FILES["file"])){ //Se o método for post e houver um arquivo atribui o arquivo à variável $file =…
phpanswered Costamilam 9,556 -
0
votes2
answers84
viewsA: Validation of 2 fields in a table
You can set multiple columns as your primary key, for example: CREATE TABLE Persons ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int, CONSTRAINT PK_Person PRIMARY…
-
1
votes1
answer27
viewsA: Calculation of dynamic tag values
Yes the problem was the id, you already knew the solution, just do the same thing you did to remove the line, use the x to create unique id I also arranged the insertion of new lines, which…
-
1
votes1
answer77
viewsQ: Is it possible to add an event listener to the url?
The idea is that when there is a change in the url, run a function that will do something with that url, for example, the user is on the page exemplo.com/#/algumacoisa/2 which is a table with…
-
4
votes1
answer117
viewsQ: recharge design material effects
I have a site with material design, but when I update the html of the page with XHR the new content loses the effect of javascript as I could to reload mdl? To make the change between the view, I…
-
2
votes3
answers66
viewsA: By which means one can remove the dynamic cell inserted in the HTML table
You can do it like this: var opt = document; function inserirLinha(id) { var newRow = opt.createElement('tr'); newRow.insertCell(0).innerHTML = '<input type="button" value="X"…
-
2
votes1
answer34
viewsA: Difference in Javascript attribute creation
There’s a difference because the two things are different In the second the name variable is declared as a global variable and in the console the new person instance is an empty object, the keyword…
-
10
votes3
answers1210
viewsQ: How to organize a project in Ode
I would like some idea of how I could organize a project in Node.js, currently the files are this way: - router.js - controller L controllerUser.js L controllerAuth.js L ... - service L…
-
1
votes2
answers50
viewsA: Problems working with Flexbox
The code you put in is not enough to reproduce the problem, I’ll leave a code for you to base This site explains well the use of flexbox header, header * { display: flex; flex: 1 1 auto; margin: 0;…
-
1
votes2
answers480
viewsA: Increase div height with animation using CSS
Just an idea from which they have already made, which of course can be improved: body{ background: #000; } .wrap { overflow: hidden; width: 100px; margin: 0 auto; position: relative; } .glass{…
cssanswered Costamilam 9,556 -
2
votes1
answer81
viewsA: How to make a javascript function run correctly with <option> and <select> tag?
In a comparison it should be used == and not = = - Attribution, a = 'b', assigns the variable to the value b == - Comparison, a == 'b', compares variable a with value b Their if else are terrible*,…
-
4
votes1
answer134
viewsQ: Pass a method on all routes of all http methods except two
Basically I want to make all the routes that come from any http method (get, post, put, ...) pass, first, by a method that will make the verification if the user is authenticated, however, this…
-
1
votes1
answer2145
viewsQ: How does bcrypt work?
I don’t quite understand the workings of salt of bcrypt, in a javascript code (Node): const bcrypt = require('bcrypt'); const saltRounds = 10; async function init(plainPassword) { let salt = await…
-
3
votes1
answer755
viewsQ: How to focus an element
In CSS it would be something like this: div { display: none; } div:active { display: block; } And some user action would give focus to this div by javascript I know I can do adding and removing a…
-
2
votes1
answer814
viewsQ: Content overwrites fixed menu when scrolling page
I’ve tried to put z-index: 2 in the <header></header>, but it didn’t work @charset "UTF-8"; body { display: flex; min-height: 100vh; width: 100%; margin: 0; padding: 0; align-items:…
-
1
votes1
answer184
viewsQ: Submenu the same width as the menu
The submenu is the size of the text, I would like it to be the size of the menu header { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px…
-
0
votes2
answers551
viewsA: ". read" firebase security rules
I was able to solve the problem by changing the structure of the bank, dividing the data access information and the data itself Bank structure: { "receita" : { "acesso" : { "-L92JgTg4xIDCymtq26h" :…
-
0
votes1
answer145
viewsA: Angular asynchronous ng-repeat
Angular has its own implementation for API consumption, the $http: angular.module('httpExample', []) .controller('FetchController', ['$scope', '$http', '$templateCache', function($scope, $http,…
-
0
votes1
answer30
viewsA: Do not adjust menu when submenu appears
Just add the property flex in menus. To keep word alignment in the center add text-align: center;: /* Navigation - menu style */ nav ul { padding: 0; } nav ul li { list-style: none; flex-direction:…
-
0
votes1
answer30
viewsQ: Do not adjust menu when submenu appears
I’m starting with flexbox, I would like to make a menu that does not adjust the width when submenus appear: /* Navigation - menu style */ nav ul { padding: 0; } nav ul li { list-style: none;…
-
0
votes1
answer39
viewsQ: Use element attributes in function of controller scope
I have a form that calls a function when being submitted through the attribute, for example: ng-submit="submit('POST', 'example.com')" I would like this attribute to be just called the function, and…