Posts by Inkeliz • 20,671 points
671 posts
-
2
votes3
answers46
viewsA: Code to open new tab link with counter
To open in a new tab (or pop-up) use the window.open: window.open("https://google.com"); More information can be found at https://developer.mozilla.org/en-US/docs/Web/API/Window/open. In your case…
-
0
votes0
answers9
viewsQ: How to open a file-dialog on Linux? What is the equivalent of Nsopenpanel (macOS), Getopenfilename (Win), Intent.ACTION_GET_CONTENT (android) on Linux?
I am creating a small library to show "save as..." and "open as..." function. I am developing only for JS, Android and Windows. But, implementing for macOS (and iOS) also seems to be easy and so…
-
0
votes2
answers31
viewsA: How to remove lateral white space from div’s
I believe the problem is itself width exceeding 100%: .strainberry-logo { width: 120%; // << AQUI left: 9%; top: 19%; transition: all 0.5s; } Switch to 100% or 100vw and see if it solves the…
-
0
votes1
answer48
viewsA: Calculating dates (Discord.js)
Just create a array, since you say there are only three possibilities. Then use the solutions already mentioned in the comments. let r = { "semana": 0, "mes": 0, "sempre": 0 }; let now = new Date();…
-
2
votes1
answer58
viewsA: Why are strings that contain [ or ] coming from $_POST transformed into an array?
This is because you are using application/x-www-form-urlencoded. The application/x-www-form-urlencoded should be: var=valor&var2=valor2 (...) In this case PHP also understands how to array…
-
2
votes2
answers65
viewsA: How do local modules work in Go?
To create a module, just use: go mod init github.com/seunome/seumodulo This will create the go.mod. I suppose I make a push of that package against the github.com/seunome/seumodulo, you can take…
-
0
votes1
answer127
viewsA: How can I improve the security of my system to keep the user connected?
There is no way to improve the security of a system without assuming what the problems would be. You need to define what the problems would be, so you can define what to do for each of the…
-
3
votes3
answers65
viewsA: How to decrease the amount of if/Else for the same validation of different object properties?
If you’re going to use something like @placementw mentioned, but want to get the boolean result, you could use the OR function. This would also show more than one message in case of multiple errors.…
-
2
votes4
answers254
viewsA: Set Golang Standard Timezone
You can set to váriavél time.Local. According to the documentation: var Local *Location = &localLoc Local represents the system’s local time zone. On Unix systems, Local > consults the TZ…
-
1
votes1
answer29
viewsA: Why does the`fullscreenchange` not work when pressing F11? How do I detect if you changed to fullscreen in the browser?
I don’t know why you can’t use the fullscreenchange, but it has how to make a gambiarra using resize. The resize works by going to the fullscreen, even when you click F11. To find out if you are in…
javascriptanswered Inkeliz 20,671 -
1
votes1
answer29
viewsQ: Why does the`fullscreenchange` not work when pressing F11? How do I detect if you changed to fullscreen in the browser?
I was trying to find some way to detect if the page entered "full screen" mode, for example tight F11. I saw there was an event fullscreenchange Event, but it appears not to work when pressing F11.…
javascriptasked Inkeliz 20,671 -
2
votes4
answers12426
viewsA: How do I detect a mobile device in Javascript?
All previous answers are old, from 2017. Today, in 2021, there are other techniques to identify if the browser is being used by a mobile device. If the browser supports UA-Client-Hint, you can…
-
1
votes1
answer35
viewsA: Pull image from database
I believe I can use the INNER JOIN: SELECT * FROM Receita INNER JOIN arquivo ON arquivo.id = Receita.idReceita WHERE nome_receita = '" . $receita . "'; So in the end: <div class="col-sm-6"…
-
1
votes1
answer41
viewsA: Is it safe to trust the values of $_SERVER["HTTP_CF_CONNECTING_IP"]?
This is safe only if you are using Cloudflare, and in addition, are only exposing your connection to Cloudflare. In general, you must recur any connection, from anywhere except for the Ips mentioned…
-
3
votes1
answer51
viewsQ: Is there a way to specify a hash, version, or signature when running `npx` (from npm)?
I am creating a generator to generate some static HTML pages. However, I came across the situation of having to use the NPX to use the AMP Optimizer. I can execute the command as follows:…
-
1
votes1
answer30
viewsA: What is the right way to do this in Curl PHP?
Let’s go in pieces: // O site alvo: $ch = curl_init('https://sitealvo.com.br'); // O usuário e senha (o formato é usuario:senha): curl_setopt($ch, CURLOPT_USERPWD, '{client_id}:{client_secret}'); //…
-
1
votes2
answers50
viewsA: Connect 3 sql tables to each other using INSERT
The @Samuel Verissimo answer already solves the question. You need a "link" between a table and another, and this is done using Foreign Key. If you know how Foreign key works, which @Samuel…
-
0
votes2
answers284
viewsA: Password encryption in Javascript
Once you are in the browser, you can use PBKDF2. Dr.Helsing’s reply is completely useless for the purpose of "protecting the password". PBKDF2 is supported by Webcrypto in any modern browser. In…
-
2
votes1
answer48
viewsA: Doubt regarding the existence of an "if" in the code
There are two for, one inside the other: // For do `string1` for (let i = 0; i < string1.length; i++) { let caractereString1 = string1.charAt(i).toLowerCase() // For do `string2` for(let j = 0; j…
-
2
votes1
answer47
viewsQ: How to verify if object has specific property without the operator "in"?
Some browsers do not support inputMode, like Safari. So to then mitigate the situation, I would have another behavior if the inputMode existed or not. Searching I found the operator in: if…
-
2
votes5
answers145
viewsA: Check if a string is composed only of '0' and '1'
You can use the parseInt. He will return NaN if the input is not valid. window.document.querySelector('input#b-input').addEventListener("input", function(e) { if (isNaN(parseInt(e.data, 2))) {…
-
1
votes2
answers76
viewsA: How to mount this query
You should have a better performance solution (maybe with JOIN + IS NULL), but the easiest is to use a NOT IN: Select what you want: SELECT ... WHERE cs.anocobranca = $ano and cs.mescobranca = $mes…
-
-1
votes1
answer43
viewsA: hashlib.md5(b""). Digest() equivalent in PHP
I believe what you are looking for is to convert Hex to binary. Assuming that hashlib.md5(b"55M5033B556EUU53").hexdigest() has the same result as PHP. You can use the hex2bin (or pack/unpack) or set…
-
1
votes3
answers82
viewsA: How do I use Javascript to check if my input has any written text?
Your code has two tags one p and a input: If you want to get the text inside the <p> (an Htmlelement) you can use the innerText: let txt =…
-
0
votes1
answer23
viewsA: How to get information from an option with Jquery/Javascript
If you want to just take the data-id of option which is selected, just do (without Jquery): window.document.querySelector("#listaAtributo").selectedOptions[0].dataset.id; The .selectedOptions…
-
1
votes1
answer36
viewsA: Doubt Function / Callback Golang
In general, it makes sense to treat the answer. But if you don’t want to use the _. That is, considering it has a function: func SuaFuncao() (string, int, error) { return "texto", 42, nil } This…
-
2
votes2
answers84
views -
2
votes2
answers93
viewsA: How to make a function accept a Slice parameter of any kind?
There is no way, you have to specify the type of input and output. Has two solutions: Create a function for each type, which is preferable. Utilize interface{}. If you want to go to the second case,…
-
0
votes1
answer81
viewsA: How to insert data into two tables related to each other by foreign key at the same time?
You are inserting cod_grupos_sistema with the value of $grupos_estudo, and your relationship is between FOREIGN KEY(cod_grupos_sistema) REFERENCES grupos_estudo_inscricoes(codigo) $query = "INSERT…
sql-insertanswered Inkeliz 20,671 -
1
votes1
answer44
viewsA: How to verify an encrypted php password?
Just look at the documentation, at https://www.php.net/manual/en/function.password-verify.php: password_verify ( string $password , string $hash ) : bool Verifies that the Given hash Matches the…
-
5
votes1
answer81
viewsA: Why doesn’t getElementsByClassName work without for?
The getElementsByClassName returns a list, this is in the documentation: The getElementsByClassName(classNames) method, when Invoked, must Return the list of Elements with class Names classNames for…
-
2
votes1
answer39
viewsA: Go function with parameters instead of name?
The question is a little confusing, but I think I’ve come to understand it. Your doubt seems to consist of: type AlgumTipo struct { } func (t *AlgumTipo) UmaFuncao(argumento int) { } The function…
-
0
votes1
answer118
viewsA: Request on the localhost working correctly and on the server returning 302 code
The "reason" is in the comments, but in short: The only difference between the two requests is that one already includes cookies and the other not. Note that "the only one that works" and "on the…
-
2
votes1
answer150
viewsA: Change Ip when making a Curl request in php
The CURLOPT_PROXY sets the IP of the proxy you want to use. The proxy can be http (pattern), socks4 or socks5. This is indicated in the documentation: https://curl.se/libcurl/c/CURLOPT_PROXY.html.…
-
0
votes2
answers57
viewsA: How do I randomly generate a name by clicking on the button?
Each item of the array can be accessed via nomes[0], nomes[1], nomes[2] (...). So if you want to choose one of them, you can use nomes[um_numero_aleatorio]. The only thing you have to ensure is that…
javascriptanswered Inkeliz 20,671 -
4
votes1
answer49
viewsQ: How to know if the "Windows animations" option is disabled in Win32?
In the CSS there is the prefers-reduced-motion. This media-query says that the user prefers reduced animations (off) or not, it respects the configuration that the user chose in the Windows settings…
-
2
votes4
answers2442
viewsA: In PHP how to calculate a random number?
The best option, in PHP 7 (or higher), is to use random_int: random_int($menor_numero , $maior_numero); Both $menor_numero and $maior_numero include themselves, so use: random_int(0 , 1); Will…
-
1
votes3
answers401
viewsA: Identify a <optgroup> with jQuery
I haven’t used Jquery for thousands of years, so the code is "closer to JS vanilla" than anything else... Your question is confusing, and at the same time kind of obvious. There are only two places…
-
1
votes2
answers38
views -
0
votes0
answers18
viewsQ: How to get the CA certificate on android.net.http.Sslerror, in Java?
I am trying to replicate an implementation, which is in another language (Golang). In it it is possible to do the following: client := http.Client{Transport: &http.Transport{TLSClientConfig:…
-
5
votes2
answers171
viewsA: Is there a way to execute a single command as an administrator (other than the entire program)?
I found a solution based on @Augusto Vasques, that is to use Powershell. It is possible to use the Start-Process combined with the -Verb RunAs, to run as administrator. But, there is a, you can’t…
-
8
votes2
answers171
viewsQ: Is there a way to execute a single command as an administrator (other than the entire program)?
Did not want to run the entire program with administrator privilege, for security reasons and for convenience. However I need to execute a command: exec.Command(`cmd`, `/c`, `CheckNetIsolation.exe`,…
-
0
votes1
answer269
viewsA: PHP RANDOM NUMBERS EXCLUDING A NUMBER FROM THE LIST
There are several ways to do this, one would be by building a dictionary that ignores invalid ones and another would be by making a loop, discarding invalid ones. I will do the first one, which…
-
2
votes3
answers444
viewsA: hide id passed in url
but if the user passes another id manually in the url is displayed to him the data of that other complaint I think to prevent this would have to use non-sequential Ids (as mentioned by @Guilherme…
-
1
votes1
answer61
viewsA: Replace PHP print correctly
I don’t know if I understood the doubt correctly, but I think a better REGEX would be something like: /\d{3}.\d{3}.\d{3}\/\d{2}/ This would be: {3 Digits}. {3 Digits}. {3 Digits}/{2 Digits}, which…
-
1
votes1
answer25
viewsA: Create a function full of elements and that returns two values in php
PHP cannot return multiple values directly (which is possible in Golang and Vlang, for example). You should use an "array" for this, it would be the easiest way, you can use the list() to simplify…
-
1
votes1
answer78
viewsA: Golang Web: Head function
Whereas you’re using the html/template, you can wow the {{template "nome do template"}} for it to be inserted. All "commands" can be viewed at https://golang.org/pkg/text/template/: {{template…
-
2
votes1
answer159
viewsQ: Why do classes with underline ("_") in Java become "_1"?
I’m using JNI, using C and Golang, by default we use something like arquivo_windows.go or arquivo_android.go, so I preferred to also call the Java files the same way. So I created a class named…
-
0
votes2
answers310
viewsA: Curl request using nodejs returns an empty body
The code 302 represents a redirect, the new URL must be present in the Location in the response header. You have two solutions: 1. Add the followAllRedirects: true: request = request.defaults({…
-
2
votes1
answer174
viewsA: Format conversion 0001-01-01T00:00:00Z from time field. Time
If he’s already one time.Time you can "change it" by using your own .Format(). You will only change when displaying the date, in case. Whereas: type SeuStruct struct { Data time.Time } Then just use…