Posts by Alex • 1,654 points
77 posts
-
0
votes2
answers1453
viewsA: How to detect scroll at the beginning and end of a div with jQuery
Usa that one library, it automatically detects when you are scrolling down, but now something you will need to use is the data-aos-offset="pixels". There is another library that I used, I’m just not…
-
0
votes2
answers500
viewsA: Javascript does not work on Nodejs
Use the express.static const express = require('express') const app = express() app.use(express.static("public")) app.get("/", (req, res) => { res.sendFile(__dirname+"/public/index.html") })…
-
0
votes1
answer220
viewsA: How to enable HTTP Keep Alive
PHP is not meant to keep the connection active, even if it is possible, I think it would be easier with Nodejs. But you can set up Apache like this: httpd.conf KeepAlive: on/off # :)…
-
0
votes1
answer61
viewsA: Monitor user time on site
can you put an example script as an answer? - Ricardo Gonçalves I haven’t touched Mysql for a while. But the query would look like this. UPDATE table SET field = field + 1 WHERE id = {ID_DO_USUARIO}…
-
2
votes2
answers19646
viewsA: How to redirect to a route using onClick and React Router
Exchange the BrowserRouter for Router, uses a manual history, just to do that: import { createBrowserHistory } from "history" const history = createBrowserHistory({ basename: "/" }) window.redirect…
-
0
votes2
answers197
viewsA: Regex able to ignore the prefixes of a word
With this regex you get something similar: (autos?)|((?<!\w)arquiva(dos)?|(\-se)?) Here you can run The secret here is the look behind, here explains well. (?<!\w) means: look back and see if…
-
5
votes1
answer661
viewsA: How to map json entities?
Using the package deep-map-Keys you can change all keys of an object recursively so: import deepMapKeys from "deep-map-keys"; let response = { data: { lastUpdate: { name: "Lala" }, dob: "01/01/2001"…
-
2
votes1
answer837
viewsA: Setstate with onChange, Reactjs
One should not rely on the "synchronicity" of setState no React, to show on the console, you should do something like: onChange = e => { this.setState( {[e.target.name]: e.target.value}, () =>…
-
0
votes1
answer62
viewsA: Component update in React via websocket
I think your application is crashing because you have one setState within a loop, this: jsonData.map(....., instead of setting the state all the time(in the loop), put in a variable for now(in the…
-
0
votes1
answer68
viewsA: Load scss from js file
I bet your problem is with the packages you’re installing wrong, you installed scss-lodaer actually should be sass-loader, and you need to use the style-loader along.…
-
1
votes2
answers219
viewsA: Encrypt variables in the URL
Use the package Crypto-js Just uncork the first var search to take the parametres //var search = window.location.search; var search =…
javascriptanswered Alex 1,654 -
0
votes2
answers486
viewsA: How to delete an element from an Array with Onclick? Javascript?
Each time a name is deleted, the show(); var ul = document.querySelector(".root"); var max = 2; //limite de pessoas a ser inserida no HTML var names = [ "Marcelo", "Fulanin", "Jubisclaudia",…
-
0
votes2
answers39
viewsA: Entering register in data group - error
You forgot to pass the connection before the query. $con = mysql_connect("localhost","marcelo","9090","banco_de_dados"); $query = "SELECT * from users"; mysqli_query($con, $query);…
-
3
votes2
answers980
viewsA: Insert Image with CSS Without Line Break
Take the trace off -. I put the blue background just to get a feel for the container Using display: flex;... #vote { background: dodgerblue; display: flex; justify-content: center; align-items:…
-
2
votes1
answer565
viewsA: Nodejs, express, browser does not find files
Using express app.use(express.static("public")); Suppose I have these folders / /server.js /public /css /style.css /js /index.js /index.html Within /index.html do this <link rel="stylesheet"…
-
0
votes2
answers1964
viewsA: How to delete an element by Key in React?
It depends on how you want to delete, whether it is by onClick or by some other means... //import React from 'react'; class Formulario extends React.Component { constructor(props){ super(props)…
-
2
votes1
answer2053
viewsA: Picking up input number text in Reactjs
Don’t forget that React JS is javascript //import React from 'react'; class Formulario extends React.Component { //fat arrow functions não precisam de dar o .bind handlePesquisar = () => { //se…
-
1
votes3
answers2526
viewsA: How to add HTML with onClick event in React
Here in my case I created a Component App and a call Hello, what I’ve done here is: -When the user clicks <h1>Welcome...</h1>, will be rendered with ReactDOM.render the component Hello…
-
1
votes2
answers263
viewsA: How to activate a function by an attribute?
function funcao() { alert("Dolly guaraná"); } var dc = document.getElementById("teste").getAttribute("data-conteudo"); eval(dc); <div id='teste' data-conteudo="funcao()"></div> XSS…
-
1
votes1
answer142
viewsA: Include Sass in angular 5
npm install node-sass package json. "scripts": { "node-sass": "node_modules/.bin/node-sass src/shared/css/style.scss -o src/shared/css/" }, Here in case I got it: src/ shared/ style.scss When I run…
-
1
votes2
answers412
viewsA: React onChange is not firing
I like to make methods within a class with fat arrows, then I never need to put the .bind() You can remove the function within your render() I put: constructor and variables within the render to…
-
0
votes1
answer133
viewsA: Pick up internal website form content (POST)
If you create a file index.php and paste that content inside and run, the tibia page will appear. Until then ok, but if you go to the Google Inspector and go to the console a message will appear...…
-
0
votes1
answer71
viewsA: Auto Complete (PHP) Searching in Txt File
You have to study the functions of PHP guy, for example, instead of asking here, you can go on Google and type: "how to split a string" which is "how to split/cut a string", will come the function…
-
2
votes2
answers55
viewsA: Settimeout not working, what’s wrong?
function openWin() { setTimeout(function(){ var divText = document.getElementById("div-janela").textContent = "Abriu :D"; }, 1000); } <div id="div-janela">conteudo da div</div> <input…
-
2
votes1
answer60
viewsA: Problems with Rewrite PHP / Apache
This is my /etc/apache2/sites-available/000-default.conf <VirtualHost *:80> ServerAdmin webmaster@localhost #DocumentRoot /var/www/html # << ANTIGO DocumentRoot…
-
0
votes1
answer850
viewsA: Receive and send value with Nodejs
How to receive inputs with nodejs ? ... Using GET request: //requisição: http://localhost/entry/?name=Marcelo&peso=70 let url = require("url"); let params = url.parse(req.url, true); let name =…
-
1
votes1
answer197
viewsA: Mysql return JSON
According to the documentation: "Two Aggregate functions generating JSON values are available (Mysql 5.7.22 and later)" You can check the version of your mysql with this query: show variables like…
-
2
votes1
answer886
viewsA: How do I import data from a spreadsheet in excel (csv) to an HTML table?
Send an ajax to your file .csv and place inside the variable resp that in my case is within the function popular() function popular(){ var resp = 'nome,sexo,peso\nmarcelo,M,70'; //"deveria" vir do…
-
4
votes2
answers413
viewsA: How to add css to all elements whose id contains "..."?
Just use this selector: [id*="elem"] { height: 100px; width: 100px; background: black; } <div id="opa-elem-ops"></div> You can take a full look at:…
-
0
votes1
answer546
viewsA: Render components according to route
You must use ReactDOM.render() not only to render the Root element, but for all insertion of components, except if Voce is using Server Side Rendering. import React from 'react'; import ReactDOM…
-
1
votes2
answers77
views -
2
votes1
answer91
viewsA: How to pause and continue after an event a For?
var current = 0; var array1 = [1,2,3,4,5,6,8,9,10]; function aparecer(){ //verifica se o current é maior do que o array if ( (array1.length - 1) < current ) { alert("oi"); //isso deveria parar a…
-
1
votes2
answers441
viewsA: How to make an image fit the size of the div by the background-image: url(') using javascript or css.
This would be the easiest way .place { width: 300px; height: 200px; background-image: url('http://lounge.obviousmag.org/tanto_mar/assets_c/2015/07/Blue-Water-thumb-920x575-115076.jpg');…
-
0
votes2
answers1102
viewsA: Return only some JSON fields in the request response (Nodejs + Mongoose)
Here I want to take only the names: var prof = [ {"nome":"Jao","cep":"123"}, {"nome":"Maria","cep":"122"}, {"nome":"Pedro","cep":"124"}, ]; var newProf = []; prof.forEach(function(obj, k){…
-
0
votes2
answers1221
viewsA: What is the link command in npm for?
My environment: ~/pega-usuarios ~/pega-usuarios/index.js #retorna um array de usuarios ~/pega-usuarios/package.json #"name":"pega" #pega será usado para npm link pega. if I give a npm link within…
-
1
votes3
answers585
viewsA: How to use Rewrite to include subdirectory and Slug?
Your problem is that Voce is not putting the second part of RewriteRule that is, the target, the site Voce wants to go, and also put this regular expression. .htaccess RewriteEngine On #este é meu…
-
0
votes2
answers323
views -
3
votes1
answer2043
viewsA: Event when user closed tab/page
You should wear this: window.onbeforeunload = function(){ return "Hello" } A window’s onbeforeunload Property may be set to a Function that Returns a string that is Shown to the user in a dialog box…
-
1
votes1
answer153
viewsA: I’m having a code problem in the json request generated from php
I ran your code here that’s what I did: / /index.js #tem a função "bustarItems()" /consulta.php #retorna o suposto "JSON" /index.html #chama os arquivos e coloca o resultado nas divs Your problem is…
-
1
votes1
answer43
viewsA: Treat mysql query when ids are repeated
//INDEX.PHP <?php $array = [ "one", "two", "three", "three", "four", "five", "five" ]; foreach ($array as $value) { echo "<p>$value</p>"; } ?> //JAVASCRIPT <script…
-
1
votes2
answers1708
viewsA: Configure stylesheet with PHP
Yeah, man, make a file, nome_que_quiser.php then you pull what you have to pull on it +/- like this: //arquivo.php <?php header("Content-Type: text/css; charset=UTF-8"); ?> //note <<…
-
2
votes2
answers41
viewsA: How to make connection alert?
When you click the button you can do this if (navigator.onLine) { console.log('online'); //mas voce coloca seu algoritmo } else { console.log('offline'); } source:…
-
10
votes9
answers12451
viewsA: How to prevent SQL code injection into my PHP code?
Can be used together with prepared statements the function filter_var(). But calm, filter_var has several utilities, for example: filter_var('[email protected]', FILTER_VALIDATE_EMAIL);//retorna boolean…
-
0
votes1
answer89
views -
1
votes1
answer1669
viewsA: PHP code inside Jquery, is it possible?
You’re using a file .js that is, only javascript can be executed inside, if you want to run PHP and javascript, you would have to do something like: //arquivo script.php <script> ...código…
-
1
votes1
answer39
viewsA: boquear directories and files with . htaccess
It depends on why this, if you do not want the leak of someone’s photo can be useful. Removing security(img) would not be removing security(from the application), in my view, would only remove…
-
0
votes1
answer101
views -
2
votes2
answers1617
viewsA: Grab a css property with jquery
var display = document.querySelector('.sua_classe').style.display; if(display == 'block') { alert('block'); }
-
1
votes1
answer66
viewsA: How do code to look an if just after you have changed the prop of an object?
EDITION You had ordered async so I was confused. In that issue I removed the Component with asynchronous method that had nothing to do with the question. Now let’s get down to business //Cabeçalho…
-
1
votes1
answer56
viewsA: How to generate query and add new input?
With PHP it will not be possible to do this "dynamically" you will have to launch the data through an AJAX request and each time this request returns some value, ie return the HTML, you insert it…