Posts by fernandosavio • 9,013 points
290 posts
-
1
votes3
answers55
viewsA: Session variable does not exist
$_SESSION is a superglobal then, theoretically, it will always be set. It makes no sense to use isset in it because it would always return true. Then your if: if (!isset($_SESSION)) session_start();…
-
0
votes1
answer22
viewsA: Comparison between dates is not working
The function strtotime recognizes American date formats (usually MM/DD/YYYY) so converting directly from DD/MM/YYYY can cause problems. What you can do is compare two date objects that are returned…
phpanswered fernandosavio 9,013 -
4
votes3
answers62
viewsA: Best way to apply a Pattern to the acronym
The following regex solves your problem simply and without creating unnecessary groups. /^[A-Z][A-Z0-9]?$/ Explanation: ^ indicates that the occurrence must be at the beginning of the string,…
-
9
votes2
answers11353
viewsA: How to format dates in python?
The method datetime.strptime serves to make the Parsing (probably why the P) of a date in a given format. That is, it takes a string, does Parsing and returns an object datime. To transform an…
pythonanswered fernandosavio 9,013 -
2
votes1
answer306
viewsQ: <fieldset> flex-wrap does not work properly in Chrome
I’m using the CSS property flex-wrap in some <div> so that I can show them or hide them without breaking the fluidity of the layout. However I noticed that when my container is a…
-
1
votes1
answer30
viewsA: Error executing Python3 script (with Symfony/Process) in an Laravel Controller
Your error seems yes, to be related to installing libs on the server. Take a look in this reply by Soen, apparently the lib nltk did not find the resource stopwords and threw the error. According to…
-
3
votes1
answer31
viewsA: Paste numbers without formatting
You can use regular expression and String.replace() to replace every character that is not a number by ''. "000.000.000".replace(/\D+/g, ''); // "000000000" The \D causes Regex to marry any…
-
19
votes2
answers319
viewsA: How do CSS ignore if the attribute is capitalized or lowercase?
The attribute CSS selector follows the pattern: [atributo operador valor i] Where: atributo: is the HTML attribute of the element operador: is the operator used to compare valor and the content of…
-
3
votes2
answers997
viewsA: Django + Python, show modal using {% if %} in template
Apparently all that remains is to expose the variable show_modal for the template. Just add to that show_modal at the render. return render(request, 'student-form-registration.html', { 'form': form,…
-
3
votes1
answer620
viewsA: How to place the scroll bar on the table
This response from the SOEN uses a very interesting hack. The hack consists of having a <div> involving the table, so just use CSS Rotate to turn the <div> 180° and also rotate the table…
-
1
votes2
answers83
viewsA: What does each signal mean in this assignment in C#?
This is the ternary operator (Docs). It’s a shortened version with a slightly different behavior than if. Example of a conditional: if (mainSize < 0) mainSize = 20; else mainSize = mainSize; Is…
c#answered fernandosavio 9,013 -
8
votes3
answers412
viewsA: How to make a DIV with a crossed text. Type a text passing through a DIV
Playing a little with the example of @Andersoncarloswoss and making some modifications I got a result that seems to me "acceptable". The only difference is I created one ::after to overlap the right…
-
0
votes3
answers185
viewsA: Use Jquery to swap text
The problem may be in the selector you are using. Because $("service") makes jQuery look for an element <service> in DOM, which I find unlikely to happen. See: $('service'); // Procura por…
-
3
votes3
answers616
viewsA: First leave selected select item
The section Basic Usage > Select the documentation addresses this subject: If the initial value of your v-model Expression does not match any of the options, the element will render in an…
-
0
votes2
answers147
viewsA: onChange texfield javascript
If the returned object does not have the method change means that this object is not a jQuery object. To check if the variable $ is really the jQuery you can check the content of $.fn.jquery. If you…
javascriptanswered fernandosavio 9,013 -
3
votes3
answers10794
viewsA: store an array of objects in a Storage location with JS
Your code is almost working, just get the people who are already saved with Storage.getItem(), add the new person to the array (Array.push()) and save back (Storage.setItem()). I changed your code:…
-
0
votes1
answer37
viewsA: Convert dictionaries to class
The problem lies within the for in attributing to nome for name in process_name: processo = Process(process_data[name]) name = processo # <------ The variable name is assigned correctly (although…
-
1
votes3
answers341
viewsA: Doubt in Vue computed method using Vuex
The estate computed of the object Vue is where its Computed Properties. You can think of Computed Properties as properties where only getters (and optionally, setters) are defined for something.…
-
1
votes1
answer270
viewsA: Accent problem when generating txt in php
A solution would be to open the file (wb) in binary mode and output to utf8 no fwrite with utf8_encode as in this reply from Soen. I haven’t tested it on my machine yet, but it would be something…
-
3
votes2
answers54
viewsA: Which event should I associate with select?
You can use the event change of <select> and compare if the selected value (this.value) is what you want. From this you can hide or show your <p>. Example: var $paragrafo =…
jqueryanswered fernandosavio 9,013 -
5
votes5
answers691
viewsA: Method Reverse returns None
The method list.reverse, as well as the list.sort, work in-place, i.e., they change the original list instead of returning an altered copy. If you do not want to change the original list you can use…
-
3
votes1
answer136
viewsA: Redirect fault Laravel
The error is correct, the route clima.consenso.visual.1127 does not exist at all. The existing route is clima.consenso.visual that receives a parameter clima_pesquisa. To redirect a Response for a…
-
2
votes1
answer233
viewsA: Pick selected values from a combobox and show in a div
You can hear the event change of <select> and take the property value. Ex.: meu_combo.addEventListener('change', function () { console.log(this.value); // retorna o value do option selecionado…
javascriptanswered fernandosavio 9,013 -
-1
votes3
answers107
viewsA: How to create the same codes to run in php7?
According to the extension documentation mysql of PHP, these methods were discontinued in PHP 5.5 and removed in PHP 7. The least intrusive way to change your code would be to use the extension…
-
7
votes1
answer509
viewsA: Transform Vue array into Json
A good approach would be to create a computed Property that always returns an object from data converted to JSON. var app = new Vue({ el: '#app', data: { json: { teste: "Valor", um_array: [0, 1, 2,…
-
1
votes2
answers79
viewsA: Phpmailer not taking form value
The names of a input passed in a POST is defined by the attribute name and not by the attribute id. The attribute id is an identifier within the document, but this identifier is not sent in…
-
2
votes3
answers874
viewsA: How to count number of clicks on increase fonts button in accessibility bar?
In my opinion a good approach to the problem would be involving CSS, more specifically relative size units em and rem. When applied to font-size it relates to the font-size of the preceding…
-
1
votes2
answers1198
viewsA: AJAX Javascript loading message axios
Just run the console.log before making the same AJAX request. And then just take advantage that the Axios returns a Promise and add a .then at the end to "cancel" the "Download".…
-
2
votes1
answer678
viewsA: How to delete a record from a table in the view without deleting from the database
The Laravel has a Feature calling for Soft Deleting (logical deletion) that allows one to delete a record logically without deleting it from the database. For Laravel to recognize a record as…
-
1
votes2
answers32
viewsA: Decryption error in request
According to the bottle documentation it is possible to access the parameters received from a POST using request.forms.get('campo'). So your question seems to be solved with the code: wiki =…
-
1
votes2
answers709
viewsA: Counting elements from one matrix, storing information in another
You can take advantage of the class Collections. Counter, who receives a iterable or mapping and count the elements. The only adjustment is to turn the matrix into a list, but this is easily solved…
-
4
votes2
answers58
viewsA: Difference between two dates with time greater than 24 hours?
It is not an optimal solution, but you can take only the minutes and seconds that are already calculated and concatenate with a TIMESTAMPDIFF in hours. Sqlfiddle SQL: SELECT date_ini, NOW(), CONCAT(…
mysqlanswered fernandosavio 9,013 -
8
votes2
answers6030
viewsA: Compare dates in Python
You are converting user input to date but it is not keeping the result. You can save the converted input to a variable. Ex.: from datetime import datetime # Recebendo input do usuário (como string)…
-
3
votes1
answer38
viewsA: Add to select and display on screen
By the class of <ul> I can see that you are using a library to change the native selects. From what I saw is the Nice Select. According to the documentation just call the function update for…
-
1
votes2
answers1277
viewsA: How to manipulate a CSV file column?
I haven’t programmed in Java for a long time but I think I can understand the concept. Within the while, where each CSV line is read, conversions will be made and added to an accumulator. At the end…
-
1
votes1
answer46
viewsA: Massassignmentexception in Model.php line 444: users_id
Mistakes of MassAssignment usually occur because the entered field is not in the property $fillable of Model or is protected by the property $guarded of Model. In your case you need to check whether…
laravel-5.6answered fernandosavio 9,013 -
2
votes1
answer488
viewsA: jQuery - How to remove row from dynamically created table?
It is necessary to use Eventdelegation, that is, the Handler of the event is in some parent element of the elements that will be inserted in the future. That way when the element is inserted and an…
jqueryanswered fernandosavio 9,013 -
1
votes1
answer114
viewsA: Export password protected csv from a DB
The quick answer is that there is no way a CSV file can be password protected. But there are methods to get a satisfactory result. One of them would be to compact the .csv and protect the .zip per…
-
1
votes1
answer119
viewsA: Image upload with Imagemagick
Theoretically it’s all about trading $request->img for $request->img->path(). Since $request->img is an instance of Uploadedfile.…
-
0
votes1
answer297
viewsA: Codeigniter 3.1.9 - Database connection
From what I understand in this Issue of PHP Mysql 8 has as default charset the utf8mb4 and according to the last comment these problems were fixed in PHP 7. [2018-05-02 17:37 UTC] macleo at outlook…
-
0
votes1
answer167
viewsA: How to write Query using Laravel
The method join() accepts 4 arguments: The table that will be made the Join. In this case: regions as r. The field of the clause ON. In this case: a.regions The operator of the clause ON. In this…
laravelanswered fernandosavio 9,013 -
0
votes1
answer38
viewsA: Problem with assign,
You can create a dictionary and use the generated string as a key: cache = dict() def send(from_key, to_key, SN): if SN in from_key.parts: key = str(from_key) + str(to_key) + str(SN) cache[key] =…
pythonanswered fernandosavio 9,013 -
2
votes3
answers1758
viewsA: Display comma separated results with Mysql
Then better understand the problem here are my thoughts and possible solutions. Solution 1: The best idea would be to restructure the tables with Foreign Keys. N-1 if areas can only have one…
-
2
votes1
answer3335
viewsA: Read multiple sets xlsx file with PHP - Phpspreadsheet
The problem is on the line: $sheet = $spreadsheet->getActiveSheet(); That way you are only taking the active spreadsheet and processing the data, without taking the other spreadsheets from the…
-
2
votes1
answer506
viewsA: Create random classes and ids
If you look at the javascript that has just above this, soon you will see that your an excerpt in the code like this: letters = "abcdefghijklmnopqrstuvwxyz", plat_id =…
-
1
votes1
answer407
viewsA: Update console line
Uses the car return character \r. import time print('=== Executando ===') for i in range(1, 11): print('- Processo:', i, end='\r') time.sleep(1) # só para dar tempo de ver a mudança no console…
-
1
votes4
answers1960
viewsA: Back position in data JSON format or list with Python
It seems your main question is not in converting data to JSON, but in extracting data from HTML with Beautifulsoup. I’m not so familiar with Beautifulsoup, but from what I saw on documentation you…
-
2
votes2
answers71
viewsA: How to clear special characters from the expression Document.getElementById("Humidity"). value;
The attribute value of an HTML element is always string. All you need to do is convert to float or int according to your need. Example: var input_int = document.getElementById('int').value; var…
javascriptanswered fernandosavio 9,013 -
0
votes3
answers2295
viewsA: Doubt when using ON DUPLICATE KEY UPDATE
if (isset($_POST["submit"])) { $id = $_GET[id]; $cod_produto = $_POST['cod_produto']; $dsc_produto = $_POST['dsc_produto']; $preco_produto = $_POST['preco_produto']; $qtd_estoque =…
-
1
votes1
answer229
viewsA: Push of the same file with different parameter in Git
Laravel uses the library Dotenv to configure the environment. The recommended is to have a file called .env with your machine connection data. That file should not be versioned, because each machine…