Posts by Wictor Chaves • 8,445 points
320 posts
-
5
votes1
answer203
viewsA: What is the importance of specifying the size of a field in the field?
In general, for a field VARCHAR, the amount of data stored in each field determines its footprint on the disk instead of the maximum size (as opposed to a field CHAR that always has the same…
-
2
votes3
answers126
viewsA: Variable declared in main is not accessed inside another function
This example is similar to your problem, where I declare the variable "number" within the function "main", and then call the function "showNumer", but the variable "number" is not in the scope of…
canswered Wictor Chaves 8,445 -
0
votes3
answers587
viewsA: How can I sort a result in Laravel with a custom attribution from my model?
Had a datatable and needed to sort it, but there were some formatted fields. All my formatted fields I left with the default "fieldname", IE, it was always the original name plus the "_Formatted" at…
-
0
votes1
answer599
viewsA: Keyword "use" in php
Use for anonymous function scope We are using an anonymous function here $push->on('incoming', function (\InstagramAPI\Push\Notification $push) use ($ig, $socket) { ... }); When we use the words…
phpanswered Wictor Chaves 8,445 -
0
votes1
answer198
viewsA: Sub query between two mysql tables, for each row a set
Separating via query How it works SELECT ano, GROUP_CONCAT(nome SEPARATOR ', ') FROM alunos GROUP BY ano; Group by year using the GROUP BY and concatenate the result by separating by comma with the…
-
1
votes2
answers162
viewsA: How to insert an element only once with jQuery event
An interesting solution This way just put data-required="Preencha seu nome!" in the input text you want putting the error message and so you will no longer need to modify the javascript for the new…
-
1
votes3
answers40
viewsA: I am producing a kind of form, but in age people put (age + "years")
You can do this way, the code is commenting explaining its operation. using System; public class Program { public static void Main() { int idade; // Console e Write são iniciados com letras…
c#answered Wictor Chaves 8,445 -
0
votes2
answers434
viewsA: How to check the number of characters in a password field with jquery?
You can do this way, the code is commented for better understanding. //Deixei a mensagem de erro em uma função separada para que possa ser reaproveitada em outros trechos, e caso seja alterada ela…
jqueryanswered Wictor Chaves 8,445 -
4
votes4
answers1049
viewsA: String list + . Split()
To use this feature you need to import the following package, since the ToList is a method of Linq using System.Linq; Just put the method ToList after the method Split, as in the example below:…
-
2
votes3
answers275
viewsA: How to configure pygame in English?
Try specifying a font instead of the one you are using (are you using the default?) - it is more likely to be a problem in the source. Words of the original author It worked for me with all the…
-
1
votes2
answers746
viewsA: Compare value of two fields with jquery
You can do this way, I changed a few things, for example, there are two elements with equal id, there can be on a page two elements with the same id, and I changed the ids to be more suggestive.…
-
3
votes1
answer1310
viewsA: In Sql server does "GO" have the same point and comma function?
SQL Server - GO utility instructions SQL Server provides commands that are not Transact-SQL statements, but are recognized by the sqlcmd and osql utilities and the SQL Server Management Studio Code…
-
4
votes2
answers2429
viewsA: What is the logic behind the "days * 24* 60* 60* 1000"?
I will use a practical example of the site W3schools We have the following function, in which we receive the name, value and time in days for the cookie to expire. function setCookie(cname, cvalue,…
-
10
votes1
answer630
viewsA: Difference from Angular Production and Development Build
Developing ng build or ng build --dev "maps" files are generated, files with the .js.map extension The code is not minified and uglification It does not make a "Tree Shaking", where it is cleaned…
-
7
votes3
answers1165
viewsA: Pass a variable from one function to another
Pass as parameter You can put the variable "mts_squares" as parameter in the function "prog_main" and then pass the function "Prog" as parameter to "prog_main" and put the return of "Prog" to the…
-
1
votes1
answer37
viewsA: How to change a variable value only when radio buton is checked
As spoken via chat, this is the code that solves your problem. Just put "checked" on one of the radio input, so you will always be selecting one of the front, so there is no need to hide or show the…
-
4
votes2
answers289
viewsA: Email and password validation using Keyup
You can do this way, the code has been explained through the comments. //Iniciar script somente depois de carregar todo o html(dom) $(function(){ $('#validator').prop('disabled', true); //Separa a…
-
4
votes4
answers242
viewsA: What’s behind the "go"?
I believe you "bugged" to interpret this new code suggested by another forum user since the variable "phrase" is just a string, but a string is a string (char), then when you use the for (which in…
-
6
votes2
answers3679
viewsA: How can I add a character to each element of a Python string?
You can make a simple for So you scroll through each index by concatenating the "opa" lista=["oi","meu","nome","é","Gustavo"] nova_lista = [] for item in lista: nova_lista.append("opa" + item)…
-
2
votes2
answers33
viewsA: Unwanted space on an edge with Hover event
The problem is why you put the effect on div external image, so is applied the scale in the div, but the image does not follow, putting the effect on the image itself the problem is solved, as in…
-
10
votes2
answers1259
viewsA: How to get the month or day of the week in Portuguese on C#?
You can do it this way: DateTime now = DateTime.Now; Console.WriteLine(now.ToString(@"d MMMM", new CultureInfo("PT-pt"))); Upshot 16 January Example First you take the current date DateTime now =…
c#answered Wictor Chaves 8,445 -
1
votes1
answer52
viewsA: Get value selects form_dropdown
I did the answer as discussed in the comments, all the code is commented for better understanding. $(function() { // Copio os campos var cpf = $("#input-group-cpf").clone(); var cnpj =…
-
0
votes4
answers307
viewsA: Div hover change color in other elements
Just remove the ">" which means it would be the immediate child element, as the elements are inside another div the ">" causes the rule not apply, see the result below: .icone_verde {…
-
6
votes3
answers89
viewsA: Add values to total - SQL
You can do it this way: SELECT tbl_purchase_product.sub_total + tbl_purchase_product.others_price as sub_total FROM (`tbl_purchase_product`) WHERE `tbl_purchase_product`.`purchase_id` = '3' As you…
sqlanswered Wictor Chaves 8,445 -
3
votes3
answers155
viewsA: Why does print() print outputs one below the other and not the other?
You can do this way using the Python 2 print "Seu texto", And in this way using the Python 3 print("Seu texto", end="", flush=True) The function print has a final parameter whose default is "n". Set…
-
2
votes1
answer64
viewsA: Merge or combine PHP Array
You can do it this way: $array1 = array("laranja", "morango"); $array2 = array("s1", "s2"); $new = array(); for ($i=0; $i<count($array1); $i++) { $new[] = $array1[$i]; $new[] = $array2[$i]; }…
-
2
votes2
answers461
viewsA: Disable button while request is performed
You can do it this way: $('form#{$model->formname()}').on('beforeSubmit', function(e) { var \$form = $(this); var botao = $('#id_do_seu_botao'); botao.prop('disabled', true); $.post(…
-
0
votes1
answer415
viewsA: Pass select Multiple values by ajax
To send the string concatenated with comma just make a small change in your javascrip: $('#salvar').click(function () { admissional = $('#admissionais').val(); $.ajax({ url: "insere_cod.php", type:…
-
2
votes2
answers855
viewsA: How to break line in Pseudo Content element ::after or ::before?
Use " A" to break the line in conjunction with "white-space: pre;" .z::after { white-space: pre; content: "::after \A quebra?"; color: red; } .z.x::after { white-space: pre; content: "::after \A…
-
2
votes3
answers53
viewsA: Code Duplication in Laravel ORM
You can do it this way: $calculaPorcentagem = Utils::calculaPorcentagem($porcentagem, $credito); $query = Produto::orderBy('credito', 'DESC') ->where('id_subcategoria', $subcategoria)…
-
1
votes1
answer78
viewsA: Display qrcode in an alert
You can simulate an Alert, I used the jquery ui to create a modal to present the Qr Code, but you can also create a custom according to your preference, see the example below:…
-
1
votes1
answer36
viewsA: How do I use today’s date as column title in Mysql
You can do it this way: SET @curdate = CURDATE(); SET @sql = CONCAT('SELECT hora, CASE WHEN data = CURDATE() THEN tarefa ELSE NULL END AS "', @curdate, '" FROM tabela WHERE data BETWEEN CURDATE()…
-
6
votes3
answers419
viewsA: What are evolutionary algorithms?
In evolutionary programming, each individual in the population is represented by a finite state machine (MEF) which processes a sequence of symbols. During the evaluation, individuals are analyzed…
-
1
votes2
answers9712
viewsA: What does the npm build command do?
npm build Executes what is specified in the file package.json. Source.
-
10
votes1
answer2652
viewsA: Command "TRIM" SQL Server
Problem The command TRIM is only recognized from the 2017 version, so its Sql Server Managemente recognizes you, but if you are connecting to an old version of Sql Server you will need to utilize…
-
1
votes1
answer89
viewsA: getElementById returning null if declaring the script inside the head
I used the following instruction: document.addEventListener("DOMContentLoaded", function(event) { }); This way, all the code inside the keys will only be executed after all the html is already…
javascriptanswered Wictor Chaves 8,445 -
-1
votes2
answers82
viewsQ: Create an object reference in your own method
Problem I want to get the last digits of this string, then I used the method Substring(), however I had to use the variable "number" again within the method Substring(). string numero = "123456789";…
-
3
votes1
answer152
viewsA: Group By SQL Server function
There are some functions like COUNT, MAX, MIN, SUM and AVG, in which they group some results, let’s assume you do: select COUNT(nome) from pessoa This will group all the names in a result,…
-
3
votes2
answers59
viewsA: Run this function from a button
You just need to create an event on the close button, and as you are using the "page" class in the content you want to close, then use the "fadeOut" method to give the same effect as when it was…
jqueryanswered Wictor Chaves 8,445 -
1
votes3
answers1204
viewsA: How to change the image of a button like Javascript?
I made a small example, in which he takes a background and replaces it for "fundoX.jpeg", using the url that is in your code. When you click on the button element it grabs your img and arrow the…
-
8
votes4
answers1051
viewsA: Is it possible to change Placeholder in Focus with CSS?
First method You can use javascript, I took the Focus and Seto event the value in the placeholder and onblur to return to the previous value, and you choose which element you want to do this effect…
-
5
votes1
answer448
viewsA: Find the largest sequence using Python
You can do it like this: max(binario.split('1'), key=len) This way I create a array separating by 1, then use the function max to catch the biggest len, resulting in the largest sequence of zeroes.…
-
1
votes2
answers937
viewsA: How to save a chart to a PNG image?
You can use the method savefig, as in the example: pylab.savefig('foo.png') Of itself pyplot Source…
-
0
votes1
answer26
viewsA: Unidentified syntax error
Syntax errors First $output.="<p>Adicionado com Sucesso" .$serial[$key].; A concatenation point before the dot and comma without a string to concatenate. According to if (!$insert) { echo…
-
6
votes1
answer98
viewsA: Problem with the conditional IF structure
How Python Works In the Python one string empty in a condition the return is false, however a string with some value is returning true, see an example: Example 1 if "uma string qualquer" :…
pythonanswered Wictor Chaves 8,445 -
2
votes4
answers1922
viewsA: How to browse a list using each JQUERY
Only trade data[i] for element $(document).ready(function(){ $.ajax({ type: "GET", url: "http://localhost:8080/SemanaEngenharia/webresources/services.evento/", data: "", /* redundante */ dataType:…
-
1
votes2
answers54
viewsA: how to render Unicode correctly
I used another code to put the arrow .teste::before{ content: "\2191"; } <div class="teste"> </div> I used this list, If you don’t want this arrow just check the list and change your…
-
11
votes3
answers512
viewsA: What is the difference between the <del> and <s> tag?
Visually speaking the result is the same, but the intention is different, the html tags serve for markup, as the name suggests, ie, it delimits the content, html serves to separate the parts.…
-
3
votes3
answers8133
viewsA: Count number of elements from a python list
Just take the index and add up to 1, since the first index is 0. lista = ['A','B','C','D'] print lista.index('C') + 1; To pick the index of the array use the method "index".…
pythonanswered Wictor Chaves 8,445 -
1
votes1
answer86
viewsA: AJAX/jQuery call running only once
Since the links are dynamic, using jquery this way it cannot identify the click, so select a parent. I created a "parent" id, since you should use these classes of your html example in other places…