Posts by Augusto Vasques • 15,321 points
571 posts
-
0
votes3
answers69
viewsA: Select by varchar position
SELECT * FROM test WHERE test.id RLIKE '^[0-9]{2}.[0-9]*$' To find matches between the values of a column and a specified regular expression use the operator RLIKE. In the case the pattern specified…
mysqlanswered Augusto Vasques 15,321 -
1
votes1
answer181
viewsA: Sort object list with PHP
To sort what you want, sort the values of the file .csv in order to be in order from the highest speed to the lowest (descending order), I had to initially create two functions. 1 -…
-
5
votes2
answers96
viewsA: Deserializing JSON in PHP
Your JSON is poorly formed and are two possibilities of repair for it. 1 - [{"id":"1","cpf":"09871204922","score":"400"}] 2 - {"id":"1","cpf":"09871204922","score":"400"} In the first case the JSON…
-
2
votes1
answer53
viewsA: False return on a real number entry?
Basically the problem lies in this line : VetorNumeros[i] = str(input("Elemento do vetor posição " + str (i+1) + " ? ")) Which makes your number vector a string vector and consequently that line: if…
-
2
votes3
answers4032
viewsA: Python, even and odd number counting
They are two problems and both happen within the function contaPares. A problem is the recoil of your code. Most programming languages such as C, C++ and Java uses keys {} to define a code block.…
-
0
votes1
answer153
viewsA: SVG path commands in Javascript
There were some errors in the code. The variable dx was being initialized worthless and then you increased it by 20 which resulted in NaN: let dx; dx += 20; // dx é igual a NaN Missing spaces…
-
2
votes4
answers5284
viewsA: How to center the elements within a div?
I was going to dismiss that answer because I was wondering if the <div> also had to stay or not centered on the page. But I ended up leaving in the same way as in the question, I hope it’s…
-
2
votes1
answer64
viewsA: Error picking up a json element with php
You’re giving trouble because your object is a array the first element of which is a array. An example with a structure object similar to yours: <?php //Aqui o JSON é um array cujo o dois…
-
3
votes2
answers246
viewsA: Add index value of the same name to the PHP array
<?php $vendas = array( [ "Produto" => "chocolate", "Quantidade" => 300 ], [ "Produto" => "morango" , "Quantidade" => 150 ], [ "Produto" => "chocolate", "Quantidade" => 400 ], […
phpanswered Augusto Vasques 15,321 -
0
votes2
answers289
viewsA: Create a new object with the type received by parameter
With the desired syntax it is not possible, as the types generics in Typescript are just an abstraction about the type Any to facilitate inference about properties, parameters and method returns.…
-
0
votes1
answer104
viewsA: Using a prop of an object as a key on another object in TS
The problem is you’re declaring SortValues as an online object and is trying to use its properties as types. I think what you’re looking for is an enumeration, documented here and here. In the…
-
2
votes1
answer57
viewsA: Javapcript Proxy running . get() instead of . set()
I don’t know if I understand the question correctly, but before anything I’m going to make a modification in your code, to visualize the best what’s happening to it. What I will do is a modification…
javascriptanswered Augusto Vasques 15,321 -
2
votes1
answer72
viewsA: foreach does not run full, only runs 1 time
The noose 'foreach' is not used to iterate over a scalar. The foreach is used to take each element of a simple associative matrix. To iterate over scalars use simple loop for: {for $pg=1 to $pag}…
-
2
votes6
answers1947
viewsA: Use switch to test if a value is between a range of values
When checking whether a value or variable is contained within a range, or multiple tracks, it is best to use the conditional operator if. console.log(determinarGeracao(prompt("Entre com o ano de…
-
5
votes1
answer1353
viewsA: How to overload methods in Typescript?
Collection of information In the repository of project of Microsoft Typescript the language is defined as a superset of Javascript, adding optional types to Javascript and its code is compiled for…
-
9
votes1
answer1353
viewsQ: How to overload methods in Typescript?
I’m having trouble overloading methods in Typescript. The method to be overloaded is a Object Factory rect() one signature has four numerical parameters and the other signature has only one…
-
1
votes2
answers72
viewsA: Filter two values in a text type variable
If input is a url and the goal is to read the query parameters use the interface URL for the analysis. The estate Searchparams access the query parameters individually. var url = new…
-
0
votes1
answer197
viewsA: how to make a password generator without using multiple loops?
It would not be the case to use a recursive function? char = [chr(i) for i in range(33, 123)] #print(char) tinha usado essa linha num teste e esqueci de tirar def attk(senha, n): if (n > 0): for…
pythonanswered Augusto Vasques 15,321 -
2
votes2
answers402
viewsA: Changing lines of an array - Python Pandas
Change the lines directly: arr[[0, 1]] = arr[[1, 0]] import numpy as np arr = np.arange(25) arr = arr.reshape(5,5) print('array inicial:') print(arr) #Troca a posição das linhas 0 e 1 arr[[0, 1]] =…
-
3
votes4
answers60
viewsA: Array assigned to another does not hold the same value
If it is a composite list, have nested lists, use deepcopy. The difference between shallow and deep copy is relevant only to composite objects (objects containing other objects such as lists or…
-
4
votes2
answers1559
viewsA: CS0029 Error - Cannot implicitly convert "int" to "bool" as a function of C#
The C# is statically typed at compile time, after a variable is declared, it cannot be declared again or assigned to a value of another type, unless that type can be converted implicitly into the…
-
3
votes1
answer341
viewsA: Express with Typescript: "Element implicitly has an 'any' type"
You are getting this message because your code is compiled with the option --noImplicitAny what force the Typescript to trigger an exception in statements and expressions where the type any is…
-
2
votes2
answers71
viewsA: Replicate code with JS
To duplicate an element use the method cloneNode();. This method has a Boolean argument where true the copy is complete and when it is false the copy is only superficial. To add the already…
javascriptanswered Augusto Vasques 15,321 -
0
votes2
answers297
viewsA: Can you use if for the addresses of an array?
As suggested by Anderson Carlos Woss in the comments, the function: array_filter ( array $array \[, callable $callback \[, int $flag = 0 \]\] ) : array Filter elements of an array using a callback…
phpanswered Augusto Vasques 15,321 -
4
votes3
answers1637
viewsA: How to iterate with two-dimensional array?
Two-dimensional arrays use nested iteration loops. It is common to use the mathematical matrix definition for two-dimensional arrays: Matrices are information organizations in a table rectangular…
-
2
votes2
answers75
viewsA: beginner with doubt in code
The problem is that you are using the function parseInt(string), that parses a string argument and returns an integer, to parse two entries belonging to the domain of the real numbers. If you take…
-
1
votes3
answers99
viewsA: My code does not recognize the SCRIPT
Have trouble with your code. you are searching for the library directly from the repository. all your inputs are with the same id. your startup code is running before the page is loaded. The problem…
-
3
votes2
answers102
viewsA: How to create an Animation in Javascript using For
To make animation in Javascript, with modern browsers, one must use the method window.requestAnimationFrame() which informs the browser that an animation is desired and asks the browser to call a…
-
3
votes1
answer45
viewsA: Error converting integer in JS from an HTML input
You added the elements <input> obtained by document.getElementById() what was missing was adding up the values of the attributes value of each <input>. <body> <h1>Somando 2…
-
3
votes3
answers103
viewsA: Individual average does not return value and the number of student situations does not count in C#
There are two errors and a bug with your code. Mistakes: On the line for (i = 0; i <= alunos.Length; i++) the counter will end the iteration in a unit beyond the capacity of its array,…
c#answered Augusto Vasques 15,321 -
1
votes1
answer89
viewsA: PHP to Service by CURL
The function urlencode(string):string returns a string in which all non-alphanumeric characters except -, _ and , are replaced with a percent sign (%) followed by two hexadecimal digits and coded…
-
1
votes2
answers820
viewsA: Accept only numbers in the C#console app
You can implement a method that reads exclusively numbers pressed within the Console. For this you will have to start a loop and have to test each iteration if a key was pressed with…
-
3
votes1
answer138
viewsA: Untreated POO code exception (Get and Set) from C#
The problem is because in the fragment: public double Raio { get => Raio; set => Raio = value; } You are instructing the compiler that when using the advisory method get it returns itself…
-
1
votes1
answer119
viewsA: How to use str_replace to replace multiple words?
Use the constructor of the class 'Datetime' to obtain a 'Datetime' object from a format-compliant string UTC and method 'Datetime::format' to format the date to your liking. Table for characters for…
phpanswered Augusto Vasques 15,321 -
2
votes2
answers135
viewsA: Add and Multiply values without refresh from button and input
First thing I did was replicate your example: var xazul = 0; function buttonazul1() { document.getElementById('output-azul').innerHTML = ++xazul; } function buttonazul2() {…
javascriptanswered Augusto Vasques 15,321 -
0
votes3
answers83
viewsA: Enable button only when two selects are different from 0
You can do it like this: function eventoChange() { $("#comprar").prop('disabled', ($('#select-1').val() == 0 || $('#select-2').val() == 0) ); } $("#select-1, #select-2").change(eventoChange);…
-
1
votes1
answer82
viewsA: How to find an ordinary sequence of Keys in an Array?
<?php $myArray = array( 'item_1', 'item_2', 'item_3', 'item_4', 'item_5', 'item_6', 'item_7', 'item_8', 'item_9', 'item_10', 'item_11' ); unset($myArray[2]); unset($myArray[3]); // Cria um array…
-
1
votes1
answer211
viewsA: Remove an item from the list of a php array?
The problem is with this comparison: if ($chave = array_search($r, $appont)) In this expression PHP will convert the value of $chave for booleano and when converting to boolean, the following values…
phpanswered Augusto Vasques 15,321 -
1
votes1
answer81
viewsA: How to open 4 sequential Selects, the last 2 not related to items?
Problem. The initial step towards understanding the problem was better the endentation. There was an attempt to nest unrelated structures and this made it difficult to read the code. Solved this…
-
5
votes1
answer753
viewsA: With CSS is it possible to make a triangle with curved edges?
The idea is really simple: you first apply a series of transformations to your element .triangle (with the attribute overflow: hidden that you can remove it to see what is happening) to get a…
-
0
votes1
answer78
viewsA: Saving a text in Mysql
Exchange the foreach and its content by implode that joins elements of a matrix into a string. <?php set_time_limit(6000); include_once ("conexao.php"); ini_set('default_charset', 'UTF8');…
phpanswered Augusto Vasques 15,321 -
2
votes2
answers179
viewsA: Validating form in Javascript
Form validation is a validation that occurs in the browser before data is sent to the server. You enter data and the application checks if the data is correct. If the information is correct, the…
javascriptanswered Augusto Vasques 15,321 -
0
votes1
answer770
viewsA: Code error: The server committed a protocol breach. Section=Responsestatusline
This error occurs because the server is delivering a poorly formed HTTP header. In the HTTP documentation 1.1 section 6.1 is written: 6.1 Status line The first line of a reply message is the status…
c#answered Augusto Vasques 15,321 -
1
votes1
answer49
viewsA: How do I gain access to a variable from another scope?
Just move the variable declaration b from within the scope of the function setup() for the scope of the function sketch() tornado b so visible to setup() and draw(). let sketch = () => { class…
javascriptanswered Augusto Vasques 15,321 -
6
votes1
answer230
viewsA: simplexml_load with xmlns problem
Before anything else I suggest you read the class documentation SoapClient and see if it is not the most suitable way for your project. Case SoapClient Do not fit your project you can have in hand…
-
2
votes2
answers1373
viewsA: Program to read 4 values and show in ascending order
And I don’t believe that using only if else is the best way to sort numbers. This is because the combination of checks to meet all situations where a set of numbers can be arranged exponentially…
-
0
votes2
answers138
viewsA: Session check problem in PHP
Use session_status(), to check the session status. Use if(session_status() === PHP_SESSION_NONE) session_start(); Never use if(!isset($_SESSION)) session_start(); or if(session_id() === "")…
phpanswered Augusto Vasques 15,321 -
0
votes3
answers76
viewsA: I can’t get the algorithm to ask for a certain range of values
You can sort out what is data collection and what is processing. In the question code this was a bit confusing. At first, the algorithm collects the four notes and stores them in the array notas…
-
5
votes1
answer1507
viewsA: How to simulate a search (CTRL+F)?
You can use the library Mark.js. Mark.js is a text marker written in Javascript. It can be used to dynamically mark custom search terms or regular expressions and offers integrated options such as…
-
1
votes1
answer96
viewsA: Unable to create an instance of the android studio class
That information: Caused by: java.lang.InstantiationException: java.lang.Class<com.example.grillo.ui.home.HomeViewModel> has no zero argument constructor Added to this information: at…
androidanswered Augusto Vasques 15,321