Posts by Valdeir Psr • 10,804 points
433 posts
-
2
votes4
answers244
viewsA: Set a range in the execution of each for loop
In addition to the methods already mentioned, you can also use the operator await. This operator is used to "wait" the result of a Promise. To use it, simply create an asynchronous function, for…
-
0
votes1
answer50
viewsA: Import from . txt using php + mysql
You can use transaction. If you do not know what this is, I recommend reading the question below. What is a Mysql Transaction for? In the extension mysqli_*, we can initiate a transaction using the…
-
0
votes1
answer87
viewsA: localStorage - Object Htmltablerowelement
Use the attribute outerHTML. It will return the code HTML of the element. localStorage.setItem("resposta", document.querySelector("#tabela-anagrama").outerHTML); Downside: This has a downside, in…
-
1
votes1
answer1030
viewsA: How to make a POST request on the browser console?
Let’s look at the code first. When we accessed the URL responsible for creating these functions, we get the following code: eval(function(p,a,c,k,e,d){e=function(c){return…
-
2
votes3
answers260
viewsA: Block link in . php
You can use regex to verify the URL. if ( preg_match("/\.(?:gif|png|jpe?g)(?:\?.*)?$/", $img) ) { die("É uma imagem válida. Pode atualizar no seu banco de dados"); } else { die("Ops! Não me parece…
phpanswered Valdeir Psr 10,804 -
3
votes1
answer147
viewsA: How to increment +1h between two dates using php?
The code is correct, the problem is that you are capturing the month m, instead of minutes i. The mistake is in: $dtEnd = $dtTemp->format('Y-m-d H:m:s'); The correct is: $dtEnd =…
-
0
votes2
answers80
viewsA: I can’t see the error (PHP and HTML)
The server Mysql can operate in different modes SQL and can apply these modes differently to different clients, depending on the value of the variable sql_mode of the system. The mistake…
-
1
votes1
answer731
viewsA: How to select a specific HTML tag when there is no id or name and (rarely has a class) using jQuery?
It’s possible, but the way it is, it’s terribly complicated. That’s because <tr>TITULO DO BOX</tr> is invalid. The browser will remove this text and add it before the table. First, it is…
-
1
votes2
answers37
viewsA: How do I send an email form and change the DIV to another one with a message?
Your code won’t work because e.preventDefault(); is invalid. At the moment you attempt to perform this function, the browser will error and stop the execution of the rest of the code. Another…
-
1
votes3
answers1320
viewsA: save IMG from external site
There are two ways to do this with PHP. Using file_get_contents Using Curl Example with file_get_contents: This function will access the page and download all its content, to save, we can use fopen…
-
2
votes1
answer564
viewsA: Pass image array in Formdata()
If you want to submit all (possible) form fields, just use: let dados = new FormData(this); If you just want to send some data, you can do it as follows: let formData = new FormData();…
-
4
votes2
answers2528
viewsA: Find Sqlite Database on Android
In case you do not find the file through the "Device File Explorer" window, you can use the code below: try { /* Captura o arquivo original */ File src = new File(Environment.getDataDirectory(),…
-
1
votes2
answers66
viewsA: How to generate HTML at a specific point in the page?
When the elements do not have an identification (ID or Classes), it becomes laborious as you will need to know the position of the element on the screen. Knowing the position (which goes from 0…
-
1
votes1
answer52
viewsA: Error while doing image update
The jQuery. serves to transform the data to the standard application/form-urlencoded, that is, it is not suitable for file uploads. For file uploads, you can use Formdata, for example: let formDados…
-
2
votes2
answers1546
viewsA: Picking input values from a given form
The ideal is to save the form in a check (example below) and then go using the method find of jQuery to search and disable items within this form. So you can use, for example:…
-
0
votes1
answer28
viewsA: Error In php variables
The error is because you are redirecting the user (through the tag <a>, instead of sending the form data. There are 3 ways to send form data: Knob <button…
-
0
votes1
answer257
viewsA: Install Magento Community Edition in PHP 7.2.1
You’ll have to do the downgrade PHP. Magento uses the functions mcrypt which were plundered in the PHP 7+ and became obsolete in PHP 7.2+, but you can still install via PECL and try to execute. To…
-
1
votes1
answer273
viewsA: Generate JSON array by PHP
You are only getting a result because you are overwriting the others, with the code below: $return_arr['codigo_intervencao'] = $intervencao2['intervencao']; $return_arr['tempo'] = $r['tempo']; To…
-
0
votes3
answers399
viewsA: Capture Form - More Correct Way
Both work, both are correct (the way to use) and both return HTMLCollection. This return value is an interface similar to a array, may use collection[0] or collection.getItem(0) and to a object, may…
-
1
votes1
answer42
viewsA: Scheduler Laravel 5.2
The problem is that the code is trying to capture the image "https://intranet.goesnicoladelli.net/imagens/assinatura_intranet.png", but her address is invalid. curl -I…
-
0
votes1
answer209
viewsA: Export Sqlite Android Database
In fact DATABASE you can put the complete path where you want to save your database. Example: private static final String DATABASE = Environment.getExternalStorageDirectory().getPath() +…
-
1
votes2
answers112
viewsA: How to avoid that page click when I click Calculate in the form with Javascript
This happens because you are not defining the attribute type on the button <button class="botaoCalcular" onclick="calcular_media()">Calcular</button>. This causes the browser to…
-
0
votes1
answer93
viewsA: HTTP(200) verification in PHP
To use the fsockopen, you need to remove the schema (http://) and the bar at the end. Example: $host = 'pt.stackoverflow.com'; $conectado = fsockopen($host, 80); if (is_resource($conectado)) { print…
-
0
votes2
answers16136
viewsA: Print a Javascript variable in Input html
Utilize document.getElementById('id-do-campo').value = suma1; Thus the value of the variable suma1 will be added to the attribute value of input To create dynamically, just use…
-
4
votes2
answers278
viewsA: Sending form without reloading page
Use the jQuery.ajax, jQuery.post, XMLHttpRequest or Fetch for this functionality. jQuery.Ajax The jQuery.Ajax is a function based on XMLHttpRequest. It is used for sending requests like GET, POST,…
-
3
votes1
answer770
viewsA: Do not allow change in source code
Can’t block this. What you can do is store all the code in one variable and use the function setInterval to check if the content has been modified, but this may cause conflicts with some plugins,…
-
1
votes2
answers993
viewsA: How do I use Google’s reCAPTCHA to block a particular part of a page?
You need to use a request to send the response up to his back-end, validate it and return one HTML with the value to be displayed. The first step is to create a function AJAX. Let’s use the function…
-
1
votes1
answer59
viewsA: What is the utility of using Basecolumns. _ID to define a contract class in Sqlite?
In the structure of your tables, there is no utility at all and you can simply define public static final String _ID = "_id"; But why is there this constant in Android? This constant serves for you…
-
3
votes1
answer190
viewsA: How to check if a Sqlite3 Database is valid?
How can you read on FAQ, this is a feature and not a BUG of Sqlite. Different from other databases, such as Mysql for example, the Sqlite does not use rigid typing. Instead, a generic typing system…
-
1
votes2
answers78
viewsA: How to simplify clicks on buttons in Java for Android?
Taking into account that its structure is similar to this: You can use the attribute tag in its element Button and then use Reflection. With this you can capture the class, just passing as…
-
2
votes4
answers751
viewsA: How to create a <a> link without refreshing
Use the method preventDefault or stopPropagation. It serves to cancel a determination action. The difference between the two is that preventDefault it will cancel only the event "of that" element…
-
1
votes1
answer235
viewsA: Select best selling products from each category
I want the first of each category to appear Answering the above question.... Taking into account that your table is similar to the table described below:…
mysqlanswered Valdeir Psr 10,804 -
1
votes1
answer66
viewsA: How to divide items with each X items
Just use a foreach, divide the count value by 7 and capture the rest of the division. If 0, close the tag. You can capture this value using $count % 7 === 0. Example: <?php $arr =…
phpanswered Valdeir Psr 10,804 -
2
votes1
answer103
viewsA: Várias Textview
To do this simply create an object of the type Textview. When creating this object, we need to pass the parameter Context TextView textView = new TextView(this); Now it is necessary to define the…
-
3
votes1
answer123
viewsA: Filter numbers in PHP
Yes. You can use the function preg_replace. It will use regular expressions to remove, change certain characters. Example: preg_replace("/\D/", "", "(45) 9 9874-4700"); In regular expressions, the…
phpanswered Valdeir Psr 10,804 -
1
votes1
answer846
viewsA: Show popup on close tab
You can use the event mouseleave in the object document. This event is triggered every time a user leaves an area, in this case the site area. new…
-
1
votes1
answer93
viewsA: How to ignore a specific file in directory?
Use the one if or unset to ignore or remove, respectively, the index array. Example: foreach (glob ("*.*") as $file){ if ($file != "index.php") { $a[] = $file; } } echo count($a); In case you want…
phpanswered Valdeir Psr 10,804 -
1
votes2
answers974
viewsA: How to capture date value with Datepicker
No need to add new. That way you would be creating a class with the interface DatePicker.OnDateChangedListener. The correct thing is for you to capture through findViewById or similar and add that…
-
2
votes1
answer495
viewsA: Android Studio set a string in various textview
Use the attribute android:setTag="sua-tag" in the XML or the method textView.setTag("sua-tag"). Example: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout…
-
1
votes1
answer210
viewsA: How to change the location of the database
Just pass the complete path (in class SQLiteOpenHelper) instead of passing only the database name. abstract class DatabaseManager extends SQLiteOpenHelper { private static final String DATABASE_NAME…
-
1
votes2
answers271
viewsA: Undefined when trying to use the received valid JSON
It turns out that Javascript does not return the size of the object, only of arrays. That’s why you’re making the mistake Undefined. Remembering that every time you return (observe the brackets in…
-
0
votes1
answer26
viewsA: Count Amount of Uploads in a Certain Period
Could I perform the count in a query only of users IDS ? Yes, it is possible to count how many uploads the user has made. Just use COUNT and group by id. Example: SELECT `id`, COUNT(`id`) AS total…
-
1
votes1
answer181
viewsA: Error accessing JSON with Ajax jquery
You’re getting a JSON Array, so it is not possible to access the property crs_id directly, this requires using a loop loop or using the index: Example with Index: $.ajax({ url:…
-
1
votes1
answer277
viewsA: Preg_match c/ Regular expression
You can use the following expression: href=(.*?)& That way he’ll capture everything in between href, until the first &. Example: <?php preg_match("/href=(.*?)&/", $link, $result);…
-
0
votes1
answer188
viewsA: Proxy to access Webservice
You can use the API of http://gimmeproxy.com/. It has the free version and the version. The way to capture for both versions is the same thing and only changes one parameter in the URL. To capture a…
phpanswered Valdeir Psr 10,804 -
0
votes1
answer112
viewsA: Loop wordpress in list with classes
You can use Wp_query to make the searches and when to print on the screen, just capture the first post with $posts->the_post() and create the li.destaque. With the method the_post, the WP will…
-
1
votes2
answers102
viewsA: I want to change the size of my slideshow as the device size changes;
When you use for..in, it will only interact with listed properties, such as getElementsByClassName returns a Htmlcollection inheriting unnumbered properties of Object.prototype and String.prototype.…
javascriptanswered Valdeir Psr 10,804 -
2
votes2
answers374
viewsA: Error in Workbench database, birth date, error 0000-00-00
In addition to the quotes that are missing when reporting the date, you are also creating a field (altura) with no more than 2 numbers, being 2 of precision (is after the point). Mathematically…
mysqlanswered Valdeir Psr 10,804 -
2
votes4
answers1878
viewsA: Updating an element with Javascript
Use a for simple and within the for utilize if (!numeros[inicial]) break;. This way the repetition will be stopped if you do not find a valid value. let inicial = 0; const numeros = [1, 2, 3, 4, 5,…
-
0
votes2
answers205
viewsA: Release save button with permission
Since you - probably - are using Bootstrap, so when opening the modal, you can use the callback show.bs.modal. Every time you open the modal, the Bootstrap will invoke this function. Example: const…