Posts by Maury Developer • 787 points
37 posts
-
0
votes3
answers48
viewsA: Problem with target identification
String type data does not receive reference from a value, but only a copy that was received. Example: var t = "2"; var c = t; t = "3" console.log(`t: ${t},c: ${c}`) Some data types have reference as…
javascriptanswered Maury Developer 787 -
-1
votes4
answers405
viewsA: Search a specific line in a . txt file and change the content
Hello Gabriel Barbosa and fellow programmers. Solution: print("Hello! Type the CPF number:") search = input() print("Searching...") file = open("teste.txt", "r") def result(search, file): resultado…
-
2
votes1
answer47
viewsA: How to capture the onRendered event from a canvas?
Hello Ivan and for other programmers. Reading the event documentation on the Fabric.js website will understand everything. Before using a new javascript library read the documentation to use…
-
0
votes2
answers489
viewsA: Recursive algorithm to check if an element belongs to a list
Make a comparison if the list size is greater than 0 and then another comparison to check if the list size is greater than 1. Another thing is the comparison that results in error restante == alvo,…
-
1
votes2
answers104
viewsA: Replace multiple word Ivs
Solution: Foreach each element with method each. Save in a Let the values that was returned from the method replace Put the value in the HTML with the method text. function…
-
3
votes2
answers2803
viewsA: Power Calculator in Javascript
Solution: Use the method Math.pow for power calculations. When you compared if it is undefined, you used !== which is the type and value negation operator, switch to ==. The comparison if it is…
javascriptanswered Maury Developer 787 -
1
votes1
answer54
viewsA: function for not repeating loop
Hello. You are using print method inside the for and each loop is showing the current value of the tens, use when the is finished. Solution: deze = [] df = {"1_Dezena": [0,1,2,1,21,3,4,8,4,34]}…
pythonanswered Maury Developer 787 -
1
votes1
answer128
viewsA: Start video from where you left off - resume video from where you left off - website
Hello. Solution: var temp = 0; var vid = document.getElementById('myvideo'); vid.onloadstart = function() { /* if ( typeof localStorage.get('temp') == 'number') { temp =…
-
0
votes3
answers562
viewsA: Math library
In this code shows the trunc, Ceil and floor methods: import math print(math.floor(23.91)); print(math.ceil(23.91)); print(math.trunc(23.91)); On the console shows the result: 23,24,23 Floor:…
-
-5
votes1
answer112
viewsA: How to manage Jquery processing or pure Javascript?
Use this method to calculate the speed of your code: function doSomething() { for (var i = 0; i < 10; i++) { window.document.getElementById('resultado').innerHTML = i; } } var t0 =…
-
3
votes2
answers57
viewsA: Print Value of an array
Use the method implode to convert into text. <?php class Imovel { private $title; private $id; private $location; function __construct($title, $id, $location) { $this->title = $title;…
-
-3
votes2
answers230
viewsA: How can I create a Javascript function for the prompt?
Hello. The function num() will continue when it is different from 1 ou 2. When you go 1 ou 2,a message will appear on the screen. Solution function num() { var call = prompt(); var ret =…
-
1
votes1
answer46
viewsA: Assosiative and value order
Hello. Use the method strpos to compare if it is similar. Solution <?php $product = ['Arroz branco' => 36,'Arroz parborizado' => 10, 'Arroz Integral' => 1, 'Açúcar' => 547, 'Açúcar…
-
0
votes1
answer246
viewsA: What is the addListener function for?
Hello. Mediaquerylist.addListener() The method addListener() of the Mediaquerylist interface adds a listener to the Mediaquerylistener who will perform a custom callback function in response to…
javascriptanswered Maury Developer 787 -
1
votes2
answers93
viewsA: Help validate results separately Javascript
Hello. In the question itself is saying that it has two parameters in the function eMaior. Then do it: function eMaior (numA,numB){ return Math.max(numA,numB); } var test = (eMaior(10,9) == 10); //…
-
1
votes1
answer111
viewsA: Help Solving Two Javascript Issues
Hello. In the first code there is an error that is showing on the console: 8,14,0. The error is in the fourth line: var dobroC = 8+-8; Solution: function dobroDoNumero(){ var dobroA = 4*2; var…
-
3
votes1
answer39
viewsA: Get the name of the month if the day of the event is the following month
Hello. You forgot the method: date('m', strtotime("next Thursday")) ; Solution: <?php $data = date("w"); if($data == 4) { echo "hoje"; } else { $mes =…
phpanswered Maury Developer 787 -
0
votes2
answers170
viewsA: Making Javascript function accounts
Hello. The comma operator evaluates the value of its operands (from left to right) and returns the value of the last operand. Use + instead of the ,. Solution:…
-
0
votes1
answer33
viewsA: Return of an array’s Indice value
On the php website itself you have this answer: is_numeric: https://www.php.net/manual/en/function.is-numeric.php is_string: https://www.php.net/manual/en/function.is-string.php Examples: // valores…
-
-2
votes2
answers67
viewsA: Doubt code in Perl
Hello. You missed those lines: for ($j=1; $j<15; $j = $j + 1;) and for ($i=1; $i<15; $i = $i + 1;) The solution: # # Perl # for ($i=1; $i<15;$i++){ for ($j=1; $j<15;$j++){ $multi = $i *…
perlanswered Maury Developer 787 -
1
votes1
answer101
viewsA: Where is the error in this method?
Everything within a project must be contained in a class. Seen, maybe that’s the problem. Involve your methods, properties and variables all in one class. From: Augusto Henrique The following…
c#answered Maury Developer 787 -
1
votes2
answers259
viewsA: Get the position in a for loop in java?
Hello yes there is a way to get position and value. Take an example: public class MyClass { public static void main(String args[]) { int index = 0; int[] abc = {2,5}; for (int ho : abc) {…
-
2
votes1
answer77
viewsA: How to add a specific year to the current year in Javascript?
Hello. To find difference of seconds, years,. You calculate vf - vi. vf = Final value. vi = Initial value. Solution: <script> var ano_inicio = 1993; var data = new Date(); var ano_atual =…
-
1
votes2
answers439
viewsA: Size of type int with short and long prefixes in C
Hello. Here’s an example of the real world. For the following code: #include <stdio.h> int main () { printf("sizeof(long) = %zu\n", sizeof(long)); return 0; } Output on Debian 7 i686:…
-
1
votes1
answer111
viewsA: Problem in creating a stored Procedure
What you forgot was to declare the variable, the console itself showed this: Msg 1087, Nível 16, Estado 1, Procedimento spConsulta, Linha 6 [Linha de Início do Lote 0] É necessário declarar a…
-
-1
votes2
answers2685
viewsA: How to delete HTML elements using Javascript?
Hello, use method use remove(). Have different ids. Change function name to _click function _click(){ document.getELementById('avo1').remove(); document.getElementById('avo2').remove(); } Some…
-
2
votes2
answers348
viewsA: Using radio input and doing real-time operations with javascript
Hello I have full answer. Create a function that update the price. <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> </head> <body>…
-
0
votes2
answers198
viewsA: Problems with multiple IF conditions - Javascript
My answer is low quality sorry. Cell phone usage. Suggestions: Create age group function and returns a value. Create a gender function and returns whether it is male or female. Solution: Change date…
-
2
votes1
answer1248
viewsA: Convert hours and minutes into javascript minutes
Solution to the problem: <!DOCTYPE html> <html> <body> <input type="time" id="data"> <button onclick="minutes()">Result</button> <p id="value"></p>…
javascriptanswered Maury Developer 787 -
0
votes1
answer564
viewsA: How can I create a pause and resume function setTimeout()?
You could create a class timer. Example: function mytimer() { this.time = 0; this.pause = false; this.update = function() { if (!this.pause) {this.time += 1}; slide(); } this.intervalo =…
-
2
votes3
answers92
viewsA: Beginner Language Error C Code Blocks
You didn’t use { correctly. While ta out of main function. You put int main(); That’s why the function gave error and did not execute. Solution to the problem. #include <stdio.h> #include…
canswered Maury Developer 787 -
-1
votes1
answer57
viewsA: How could I mark a text in html format without deleting the content?
function getSelectedText() { t = (document.all) ? document.selection.createRange().text : document.getSelection(); return t; } $(document).bind('mouseup','#container',function(){ var selection =…
javascriptanswered Maury Developer 787 -
0
votes1
answer311
viewsA: Calculate difference in days between two dates excluding weekends
F1 = difference and returns when it is over. param = initial date; param2 = final date; param3 = day of the week of the first parameter. var hoje = new Date(); var limite = 14; var data =…
-
3
votes1
answer105
viewsA: How to redirect one site to another while maintaining the rest of the url
You could use replace method. Example: var url = location.href; location.href = url.replace("meusite.net","meusite.com.br"); I hope to help you.…
-
3
votes2
answers1047
viewsA: compute hours with javascript
function formatar_segundos(h,min,s) { return (h*3600)+(min*60)+(s); } var data = formatar_segundos(23,14,32); var data2 = formatar_segundos(22,55,27); var diferenca = data_format(data-data2);…
javascriptanswered Maury Developer 787 -
-3
votes2
answers164
viewsQ: How do I create a theme for the same textarea as VS Code?
I wanted to make the textarea in html that it had different color with each character. But when I use color css everything is the same. How can I get out of this problem? <textarea style='color:…
-
-1
votes1
answer73
viewsA: Take last result and increment with php, javascript and mysql
You could remove the input using javascript when clicking. Element.prototype.remove = function() { this.parentElement.removeChild(this); } NodeList.prototype.remove = HTMLCollection.prototype.remove…