Posts by Andrei Coelho • 6,196 points
249 posts
-
4
votes2
answers103
viewsA: How to search multiple data in mysql without losing performance
From what I understand of your question, is that with each result of the first SELECT you make a new query by always picking a single record with a date less than or equal to each record returned by…
-
1
votes2
answers402
viewsQ: Change the FORM border when the internal INPUT is in focus
It may be something kind of stupid or even a double question, but like everything I know about css is tested and I have no idea how to google, I decided to ask this question. The thing is, I have…
cssasked Andrei Coelho 6,196 -
2
votes1
answer251
viewsA: How to search for relevance in Mysql (prioritize whole word)
I managed using mysql regexp. I created the following regular expression: (^|\s)mac($|\s) The expression evaluates the text by following the rules: (^|\s) - Before the word there must be one or more…
-
1
votes1
answer306
viewsA: How to display the contents of a div with PHP parameters
According to the conversations we had, I created a script that should work. But first it will be necessary to create 2 files in the same directory of index1.php: 1 - shell_test.php if(isset(…
-
2
votes1
answer181
viewsA: How to configure the GTAG User Id in external JS file by picking PHP variable?
As the file containing the HTML is .php you can do this: <script>const USER_ID = '<?php echo $userId; ?>';</script> <!-- aqui é declarada a constante --> <script async…
-
3
votes1
answer60
viewsA: How to recover an interval of months between two dates?
You can’t compare months directly in different years because php rounds the value. For example, if the difference is 13 months, it will generate 1 year and 1 month. So when you filter through format…
-
2
votes2
answers187
viewsA: How to remove characters q, ç and g from the HTML <u> tag in Regex?
I believe you want this: $texto = "<u>Administração</u>"; echo preg_replace('/([qpç]+)/u', '</u>$1<u>', $texto); That one REGEX will work if you have the characters mentioned…
-
4
votes1
answer293
viewsA: What is and how does CSS Post-processing work?
A CSS post-processor is nothing more than a program to help in the development of CSS codes. Like the SASS? Not. preprocessing vs post-processing Unlike code preprocessing (Sass, Lass, and Stylus),…
-
2
votes1
answer48
viewsA: Ways to remove with Sparsearray
Well, the removeis just an alias for delete. Then we must compare: delete vs removeAt And there’s not much difference. The only difference is that the delete does a key check with binarySearchbefore…
-
0
votes1
answer35
viewsA: Multidimensional array how to remove a character from a given index?
The way it is, you just use the str_replace: $array = [ ['Nome/Razão Social', 'Nome Fantasia', 'Tel.', 'Cel.'], ['XXX XXXXX XXXXXXXX','', '9123-4321', '7123-4312'] ]; $array[1] = str_replace("-",…
-
2
votes1
answer93
viewsA: Hidden Friend with PHP
When you create a variable in php or in any other language, this is stored in memory with a reference so that you can use when needed. Most variables in php have local scope, which means if you do…
phpanswered Andrei Coelho 6,196 -
1
votes1
answer52
viewsA: Preg replace in textarea links
I created this regex that meets in this case you made: (http:\/\/\w+\.\w+\/)(\w+)\/(\w+)\/(.+)? ^ .... grupo do link ^.... grupo do código Then take the elements of each group that will be used and…
phpanswered Andrei Coelho 6,196 -
0
votes1
answer141
viewsA: Register button for the application
The problem is in the creation of the table. Error says there is no column username at the bank no such column: user name Your String is being concatenated wrong here: public static final String…
-
2
votes1
answer111
viewsA: Efficient method to lower array order in PHP
I created a solution using the Chiò. For example, I used the following array: $matriz = [ [1,2,5,3,2], [1,3,7,3,4], [0,5,2,2,1], [1,3,0,1,2], [0,6,7,4,7] ]; In order to follow this rule, I used the…
-
0
votes1
answer878
viewsA: Internal Storage - open failed: ENOENT (No such file or directory)
Android uses the linux kernel. When you try to read a file on the linux system, it is necessary to escape the spaces to be understood correctly. String str = "diretorio/do/arquivo/arquivo a.txt";…
-
1
votes1
answer114
viewsA: Insert method does not save data
The error I noticed is in the table creation. The string concatenated (queryCriarTabela) of the method criarTabela() returns this value: CREATE TABLE financas ( id INTEGER PRIMARY KEY AUTOINCREMENT,…
-
1
votes2
answers2385
viewsA: How to call a method of one class in another class
You have the list (vector) of everything inside the ContaTel. To access these functions you first need to access each element of the Ligacao[]. public class ContaTel { private int mes, ano,…
-
1
votes1
answer38
viewsA: Doesn’t just open the post by id
The solution found by OP itself was that in select there was no id field. Use the variable that was created in the loop $linha_categoria, starting with him: <div class="blog-post"> <?php…
-
2
votes1
answer1091
viewsA: Generate a pdf of a table in html and php?
The problem is that you are using the file_get_contents. This function, takes what is written inside the content, it means that in this case it takes a lot of codes php that are written. It does not…
-
1
votes1
answer62
viewsA: Set time variable on Back button
Option 1 You can use a volatile as an attribute for control. private volatile boolean run = true; ... private void timeGame() { ... if (timeCounter > 0 && run){ // <-- atributo de…
-
2
votes1
answer808
viewsA: How to clean the data stored in memory, in cache or then reset an application (App) in android studio?
The onDestroy does not serve to destroy a Activity. It runs whenever an Activity is finished. To finish an Activity, you use the finish(). Independent of Activity that you use, onDestroy of Activity…
-
4
votes1
answer226
viewsA: Java - what is the <?> and GENERIC TYPES for?
That one <?> is known as wildcard type (Wild Card). It is part of the generic types. With it you can receive a generic of any type. For example: List<?> curinga = null;…
javaanswered Andrei Coelho 6,196 -
2
votes2
answers160
viewsA: How to change the size of an Edittext contained in a Alertdialog?
You need to set the gravity to align the text and the TextSize to change the font size: EditText editText = new EditText(getApplicationContext()); editText.setGravity(Gravity.CENTER); // alinhado ao…
-
1
votes1
answer54
viewsA: How to release function only when left-clicking div
It is impossible to do this because the click event is never triggered in an iframe. It can be "simulated" this way: He identifies that there is a focus. When you click the focus is lost and as the…
-
1
votes1
answer92
viewsA: Group SQL PHP data with sum of records
Just enter the sum at the beginning of your select by grouping by the product code. See: SELECT `tbl_order_details`.`product_name`, sum(`tbl_order_details`.`product_quantity`) as unidades, # soma de…
-
1
votes1
answer73
viewsA: Picking array values from a form with PHP
The problem is that you are generating the array in the wrong way than you intend. Here.. Licenca[".$c."] .. in all the checkbox, no matter which will be chosen, will always be the same! What you…
phpanswered Andrei Coelho 6,196 -
1
votes1
answer402
viewsA: Accessing objects from a JSON
In this specific case just use the key native of php that it will return the first key of your json. foreach ($files as $file) { $data = $this->getFileContent($file); $key = key($data); // <--…
-
2
votes3
answers839
viewsA: how to select zero Count
You can use the clause NOT EXISTS to do this. So: SELECT mun.id, mun.nome FROM municipio as mun WHERE NOT EXISTS ( SELECT cidade FROM cliente WHERE cidade = mun.id ) see working And if you want the…
-
0
votes1
answer63
viewsA: How to change the color of 1 string
You can do so (commented code): $color = "color: "; switch($rs->groups){ case "Diretor": $color."orange;"; break; // se for diretor case "Ajudante": $color."yellow;"; break; // se for ajudante…
-
1
votes1
answer56
viewsA: Search String Random in Sqlite and then show the Result on the Screen with button
Just wear it inside the Cursor that one query that will work and you can use the cursor: Cursor cursor = bancoDados.rawQuery("" + "SELECT perguntas " + "FROM questions " + "ORDER BY RANDOM() " +…
-
2
votes2
answers637
viewsA: How to arrange JSON without quotation marks in index
You can replace it with a regex. So: $jsonEstranho = 'options: [ { value: "120", id: "40", title: "1400g", name: "Tamanho" }, { value: "336", id: "60", title: "Chocolate", name: "Sabor" } ]'; //…
-
0
votes2
answers41
viewsA: Showing preloader when 'Enter' is pressed
The problem is that your .preloaderis a id and not a class. you need to insert jquery to work: Your code has it kind of like this: <script…
-
2
votes1
answer9093
viewsA: How to resolve Syntaxerror error: Unexpected token E in JSON at position 1
According to the console error message, there is a syntax error in json. When trying to convert the string, there is an unexpected token E. This is because your code is "dying" on query of INSERT.…
-
1
votes1
answer119
viewsA: Take values from an Array and implement within Json using php
From what I understand you want to change all the values ofjsonusing the values of the array. So I created a solution that goes through all the elements of json and checks whether the 'type'…
-
4
votes2
answers148
viewsA: Split into whois using regular expression
If it’s only the values that have the : (two points) as: person: Ana Flavia Miziara You can catch them using this REGEX: <br \/>([\w-]+:\s*.+) What does this REGEX mean: Beginning: <br…
-
1
votes2
answers260
viewsA: How do I edit a JSON within my database?
You can use the array_map to browse the array created with json_decode and apply the change wherever you want: $string =…
-
1
votes3
answers203
viewsA: sort array by date
I had to redo the answer. To do what you need I created two functions. One to change date values recursively. And the other to get the first date found in the array to be able to sort. Are these…
-
1
votes1
answer119
viewsA: Event that performs a database query when clicking on a <tr> table
I already made an ajax code to do it, only it’s not working. I think that’s why they’re filled dynamically in the table That’s one of the problems. 1) This event is wrong: $('div#espaco-detalhes tr…
-
1
votes1
answer158
viewsA: I’m unable to fill the <td> dynamically with AJAX and PHP
After a long chat discussion, we identified that the code did not pass through if(isset($_POST["enviar"])). This happens because this value is not sent by ajax when it is serialized, because it…
-
0
votes1
answer118
viewsA: Calling a PHP function with the Xmlhttprequest object( )
You can send the functions you want to perform by request: xhttp.send("fld_busca="+fld_busca+"&functions=query1,query2,query3"); // ^ execute as funções query1, query2, query3 In the php you can…
-
0
votes1
answer75
viewsA: Grafico Google Charts
It is right to treat this error. You can use a block tryfor that reason: try { var data = google.visualization.arrayToDataTable([ ['Year', 'Sales', 'Expenses'], ['2004', 1000, ], ['2005', 1170,…
javascriptanswered Andrei Coelho 6,196 -
5
votes2
answers238
viewsA: How to search MYSQL search for word in title and then in text and sort by title first
I would make it look like what Arthur did, just by assigning the importance of the result to a value. For example: If there is result in the title assigns the result 2 If there is result in content…
-
0
votes1
answer98
viewsA: Long-running PHP script not completing until the end
You can use paging each request and give one refresh in the script every 1 second. Take an example: $pg = isset($_GET['pagina']) ? (int)$_GET['pagina'] + 1 : 1; $limit = ($pg - 1) * 10 .",10"; //…
-
1
votes1
answer98
viewsA: Deliver PHP array from ajax to HTML field
Look, I think the best way for you to repurpose the input information would be like this: php $html .= " <input type='hidden' name='dados' id='dados' value='" . json_encode($relatoriosGr). "'…
-
2
votes1
answer68
viewsA: Android + Volley + PHP Connector Does not insert data into SQL Server database
You cannot insert as you just created a string concatenated with posted values. I created a solution with commented code: if(!empty($username) && !empty($password) &&…
-
0
votes2
answers58
viewsA: Android + Volley with PHP connector returns error!
The device (emulator) can not connect because you need to insert the IP instead of "localhost" because in "localhost" the command will try to make an internal connection in "mobile" (emulator) and…
-
2
votes2
answers98
viewsA: Conversion of Dateinterval to int in PHP
Simple mistake: The variable $interval is an object and not an entire. You are comparing two different things, php tries to convert the object into an integer to make the comparison with number 1…
phpanswered Andrei Coelho 6,196 -
1
votes1
answer32
viewsA: Send ID of each respective while pass
As you work with multiple forms, place the Submit button inside the form and insert the type Submit into it. So: echo '<form id="envia" method="POST" action="envia.php">'; // <-- aqui echo…
phpanswered Andrei Coelho 6,196 -
1
votes2
answers1248
viewsA: Expression to treat URL with parameter
Based on what you put as examples, I created this commented code: $url = "animacao/!?page))/!@2?s*!="; // pega todas as palavras que contenham caracteres de az, AZ, 0-9, incluindo o caractere _…
-
3
votes2
answers3202
viewsA: Regular expression for repeated characters
You can use the count_chars to count characters and then check if there is more than 1 element and if this element has more than 1 character. $str = "tttttt"; $chars = count_chars($str, 1);…