Posts by Valdeir Psr • 10,804 points
433 posts
-
0
votes2
answers336
viewsA: Javascript - Scoring
Just use the properties and method below: fillStyle to set the color of the text (otherwise the text will turn green; font to set the font size, type and style (optional); and fillText to write…
javascriptanswered Valdeir Psr 10,804 -
1
votes1
answer2777
viewsA: Save Json to a mysql database
Since you are sending a JSON, it is not possible to capture the values with $_POST. This is only for type requests x-www-form-urlencoded and multipart/form-data. To capture sending JSON, you can use…
-
1
votes1
answer1198
viewsA: Change route (road) color from google maps
To change the color, it is necessary to use google.maps.DirectionsRenderer. With it you can define some characteristics of the line, for example: var directionsService = new…
-
2
votes1
answer103
viewsA: Read Json Object with PHP
Since you only want to display data from a record, it is not necessary to use the foreach, just go through the JSON using the indices, for example: <?php $url = "link da api"; $streamSSL =…
-
2
votes1
answer993
viewsA: How does an Arraylist of Arraylist work? How to resort to an Arraylist of Arraylist?
The working doesn’t change. It’s just an object storing another object of the same type (roughly). To go through the lists and sublists just use two (or one of each): for while forEach do..while…
javaanswered Valdeir Psr 10,804 -
1
votes2
answers67
viewsA: How to execute a function whose name was passed as a parameter of another function, à la callback?
Just use nome_da_funcao(), for example: function exec( fun ) { fun("World") //Passando parâmetros } exec( function() { console.log("Success") } ) exec( function(res) { console.log(`Hello ${res}`) }…
-
1
votes1
answer97
viewsA: Slide show errors
We go by part and at the end put an example of the modification. 1 ) If we reduce the height browser by changing the resolution, the div.slider does not follow the height of div.slide I made some…
-
1
votes3
answers3989
viewsA: How to Generate random numbers without repeating in Random?
Below is a commented example. I did it based on your code, but you could replace it Integer[] for List<Integer> and adapt your code. It is very easy and if you want I can put later. Common…
-
1
votes2
answers125
viewsA: How to disable an option when creating it with jquery
Just do a check (with if..else or ternary) and then concatenate the value disabled in the option. Following example commented: vetorAux = ["CARROS","Ferrari","Porshe"];…
-
2
votes1
answer81
viewsA: How to run Shell With PHP using bash compiler
It is necessary to use #! (with exclamation). This way you will be defining the software that will interpret the written code, for example: #!/usr/bin/php At the time of execution it is necessary to…
-
2
votes1
answer1654
viewsA: Copy content button, and display a message right after you click it to copy
You can use the library Clipboardjs to copy or cut out some text. Example #1: const clipboard = new ClipboardJS('.btn') clipboard.on('success', function(e) { alert("Texto copiado") });…
-
2
votes1
answer236
viewsA: Create and store MD5 hash of existing value after INSERT
To encrypt a value in MD5, just use the same name function, for example: SELECT MD5('Psr'); -> '0dd833a62f068acadd6604eec8daf236' With this you can use the trigger_time BEFORE with the…
mysqlanswered Valdeir Psr 10,804 -
1
votes1
answer648
viewsA: Sed - delete text from a position until the beginning of the file
Just use sed -i '1,/destino/d' *.txt Explanation: sed -i '1,/Enviar mailBlogThis/d' arquivo.txt └┬┘└┬┘ └────────┬────────┘└┬┘ └────┬────┘ │ │ │ │ └─ Arquivo(s) │ │ │ └───────── Deleta as linhas…
sedanswered Valdeir Psr 10,804 -
1
votes1
answer501
viewsA: automatic zoom in the image
To prevent animation from returning to its initial state, simply add .zoom img the code animation-fill-mode: forwards;. This way the animation will be executed only once (without returning to the…
-
2
votes1
answer549
viewsA: Change the color of the <Progress> element
You can change the colors by changing the value of background-color in the pseudo-elements below: ::-moz-progress-bar ::-ms-fill ::-webkit-progress-bar ::-webkit-progress-value…
-
0
votes3
answers121
viewsA: List value of checkbox items
Follow an alternative with the Vanillajs (Javascript Pure) /* Captura todos os elementos do tipo checkbox */ const cb = document.querySelectorAll("input[type=\"checkbox\"]") /* Adiciona o evento…
-
3
votes2
answers417
viewsA: Dynamic background URL
Yes possible. Just create a variable to store the values (photo link) and then use for to go through these values, for example: /* Gradiente padrão */ const gradient = "linear-gradient(rgba(0, 0, 0,…
-
3
votes4
answers745
viewsA: Sort Divs by date in dd/mm/yyyy format
You can use the function sort to compare which higher value and organize them. Following example commented: /* Captura todos os elementos data */ let $datesElement =…
-
5
votes3
answers268
viewsA: Generate randomly in XXXX-0000 format
You do not need to use repeat structures to generate alphanumeric values. Just use a base in the function toString, for example: let first = Math.random() // Gera um valor randômico .toString(36) //…
javascriptanswered Valdeir Psr 10,804 -
2
votes1
answer755
viewsA: PHP link protector to capture and encrypt and add a URL before
To convert a value to Base64, in the Javascript, just use the function window.btoa, for example: btoa($(this).attr("href") Example: /** * Executa a função após criação. Isso dispensará o uso do…
-
2
votes1
answer577
viewsA: Return PHP Error to Ajax
Store the function return mysqli_query. She will return false in case of error, for example: $pesquisa = $_POST["pesquisa"]; $dia = $_POST["dia"]; $mes = $_POST["mes"]; $ano = $_POST["ano"]; $conn =…
-
1
votes1
answer131
viewsA: .gitignore for multi projects - Visual Studio
You can remove the cache of the archives and thus the gitignore will begin to ignore files that have already been comitados. As a basis, I will use this test project: For this just run the command…
-
2
votes1
answer34
viewsA: PHP - Delete multi files
Both the function file_exists as to function glob, must receive a string. How are you passing one array, the error is being shown. An alternative is to use a foreach, for example: <?php…
phpanswered Valdeir Psr 10,804 -
1
votes1
answer53
viewsA: Doubt with Iframe
It is possible yes. Below I show two ways to do. Example #1 - Commented: { let pageTop, pageBottom, elementTop, elementBottom let iframe = document.querySelector("iframe")…
iframeanswered Valdeir Psr 10,804 -
3
votes3
answers3324
viewsA: Removing Accents and Transforming Spaces into PHP strokes
Like the ereg_replace has been deprecated, it is necessary to replace by another function. Instead of this function, you can use preg_replace, the working is very similar and the rules - practically…
-
1
votes2
answers627
viewsA: Effect on css image
To create this effect, just use transform: skewX(-18deg); in the element you want to create the tilt effect. Example: * { padding: 0; margin: 0 } .container { background:blue; background-size:…
-
1
votes1
answer478
viewsA: Open HTML via Asset
There are two very simple ways. First of all, we need to create the element Webview in the XML, for example: <WebView android:id="@+id/webView" android:layout_width="match_parent"…
-
0
votes1
answer21
viewsA: Display jquery code in an ID
To add a code in the text format within an element, it is necessary to convert it to String or use Template String: To use the Template String, just wrap the code with the grave accent `, for…
-
2
votes2
answers86
viewsA: How do <?php echo $i ? > be random between Y and X?
In addition to the form cited, there is another way also that is by checking whether a certain number is even or odd, for example: PHP: <?php for ($i = 0; $i < 10; $i++) { /** * Caso o número…
-
2
votes1
answer1572
viewsA: Problem with Mascara Currency and I calculate
It is necessary to remove some characters such as letters and commas in order to perform calculations on Javascript. How you’re using the library jquery.maskMoney.min.js, just use the event unmask.…
-
1
votes1
answer45
viewsA: Mysql syntax problem generated by Phpmyadmin
There are some problems in your code: You are passing only one value to double. In this type you need to enter the size and number of decimals. DOUBLE(20,10) NOT NULL You are passing the primary key…
-
1
votes1
answer280
viewsA: CURL is not working locally
This happens when we use two services on the same door, usually the door 80. This creates a conflict and the code ends up not being processed by any of them. To correct we need to change their port,…
-
4
votes3
answers1191
viewsA: How to add one element inside another
There are a few ways to add an HTML element/code inside, outside, before or after an element. One of them is with the method insertAdjacentHTML. With it you can use an HTML code, without the need…
javascriptanswered Valdeir Psr 10,804 -
0
votes1
answer123
viewsA: how to send an image to php through a hidden input='file'
You can use the jQuery to create a input hidden (using CSS) and then use a setInterval to check if the file has been selected. Following example commented: <body> <button>Enviar…
-
1
votes1
answer75
viewsA: Unset a variable after clicking a link
Unable to change a PHP variable/session via Javascript (without AJAX). What you can do is add a parameter to URL and check the user’s action in the file, for example. <?php session_start(); /** *…
-
1
votes2
answers2443
viewsA: 100VH height however page contains scroll bar
This happens because you add some default values to your website, such as padding and the margin. To correct, simply reset these values, for example: * { margin: 0; padding: 0; } Full example: * {…
-
1
votes1
answer143
viewsA: Search system with charging on demand
Create a global variable to store the letter you searched for at any given time, then just compare the letter that was saved with the letter clicked, and if it was different, clear the div using…
-
1
votes1
answer35
viewsA: HTML <TEMPLATE> Tag for code blocks repeats
You can use a Heredoc to store a chunk in a variable. With it you can easily save multiple lines. Just use: <<<[IDENTIFICADOR] Texto Aqui [IDENTIFICADOR]; To use label and placeholder…
-
1
votes1
answer154
viewsA: Search for the post ID
To change the mode with Wordpress works with the darlings, it is necessary to use actions for that reason. Those actions acts as a trigger that will be activated in a certain place, by a certain…
-
3
votes2
answers2073
viewsA: While inside While (While principal stops)
Your while -> while is working. He is correct. The problem is that the condition of the second while (b<=10) will always be fake after the first loop, That’s because you’re adding 1 to the…
-
0
votes1
answer179
viewsA: Error Uncaught Domexception:
The problem is that you are calling the function make_base() before the image is loaded. As the image loading process is asynchronous, you must call this function, only after full loading, for…
javascriptanswered Valdeir Psr 10,804 -
0
votes3
answers169
viewsA: 2 Arrays in foreach from a form
You can also do as follows: foreach($alimento as $key => $value){ echo "Alimento: {$value}"; echo "Quantidade: {$quantidade[$key]}"; }
phpanswered Valdeir Psr 10,804 -
0
votes1
answer559
viewsA: Pick variable from another page
Replace the section below in your PHP <li class="list-group-item"> <a href="<?php echo $channel["link"] ?>"> <img src="<?php echo $channel["logo"]?>"/> <div…
-
1
votes1
answer77
viewsA: After git reset, can you see git log before the reset?
Yes, it is possible to see the log after the git reset, just use the command git reflog The git keeps a file of log which record all modifications (commit) of the Code, irrespective of reset or not…
-
2
votes2
answers340
viewsA: Difference between Java Arrays
They all have a fixed value. When I use the code below, I make explicit the amount of indexes that the array must have in case 99 strings. String[] array1 = new String[99]; That’s how the Java works…
-
0
votes1
answer246
viewsA: How to filter a dynamic multidimensional array?
You can use the function array_filter. Just pass the array that you want to filter and a function to perform the condition. In this function you can return true to the array be returned (a array…
phpanswered Valdeir Psr 10,804 -
1
votes3
answers1440
viewsA: Javascript - How to pass parameters to a function of an Event Attribute
When you use minhaFuncao(num1, num2);, the Javascript interprets that you are calling the function and want it to be executed, so it does not work that way. In your case, you need to create an…
javascriptanswered Valdeir Psr 10,804 -
0
votes1
answer480
viewsA: Delete Image from Folder
Just you add one anchor with a parameter and then check if the parameter was passed, if it was, you use the function unlink to remove. Example: <?php /* Verifica se o parâmetro `remove` foi…
phpanswered Valdeir Psr 10,804 -
1
votes1
answer411
viewsA: Google Drive API to search only images
Since I don’t know what your code is, I’ll leave a snippet of how you can do it. As I said in my comment, just add the property q and use one of the operators below followed by the amount you want.…
-
0
votes1
answer404
viewsA: How to take data from an object returned by Selenium with php?
According to the "documentation", the object Facebook\WebDriver\WebDriverDimension has two methods to capture the value of properties: getHeight() to return the height getWidth() Parap returns width…