Posts by fernandosavio • 9,013 points
290 posts
- 
		2 votes2 answers5334 viewsA: How to check the versions of the modules installed in Python?As a curiosity, I saw in this reply by Soen an alternative to the @nosklo response, where the module is used pkg_resources of setuptools. import pkg_resources… 
- 
		2 votes1 answer60 viewsA: Date value from Jsonresult function 18/11/2018 00:00:00 javascript gets "/Date(1542506400000)/"You would have to see if you can configure how dates are serialized in C#, but you can convert the received value into JS because the integer inside Date is the amount of milliseconds since… 
- 
		2 votes2 answers395 viewsA: Know if at least one checkbox is selected within an array of the LaravelYou can use the method Array.every() that takes a function that will be executed once for each element of the array and returns true only if all function iterations return true. How a jQuery object… 
- 
		12 votes2 answers687 viewsA: How to make an Animation in CSS with drag effect. Place Blur in motionYou can create other balls to be the "Blur" and change only the animation-delay and the opacity. The code below is the same as yours, I just added the elements .blurN and created the rules for these… 
- 
		1 votes2 answers335 viewsA: How to insert space in Camelcase string?I believe the simplest way would be to just use the method String.replace() with a regex that will only be capitalized. If you read this session of the documentation of String.replace(), you will… 
- 
		3 votes1 answer86 viewsA: VUE: With recovering an array variable filtering by valueYou can create a computed Property which will calculate which category will be selected. new Vue({ el: '#app', data: { selected: null, full_category_list: [ { id: 1, name: 'Sólido', parent : 0 }, {… 
- 
		4 votes1 answer129 viewsA: Filters in Vue only work with interpolation, they don’t work with v-text. Why?In the session on documentation filters talks about it. More specifically in the part that says: Filters are usable in two Places: mustache interpolations and v-bind Expressions. Then the solution… 
- 
		4 votes1 answer1648 viewsA: Knowing if input is focused or not in real timeYou can use the events phocus (when the element receives the focus) and Blur (when the element loses focus). Example: var teste = document.getElementById('teste'); var feedback =… 
- 
		0 votes1 answer20 viewsA: Eloquent returning field and valueHave you ever tried to just take the id of the result instead of using the array? $result = DB::table('participantes') ->select('id') ->orderBy('id','DESC') ->first(); $id = $result->id;… 
- 
		0 votes2 answers690 viewsA: Change an image every clickApparently you’re using the Collapse Bootstrap together with component card. If applicable, Collapse shows/hides elements through classes: In the element that is hidden classes are added: .collapse… 
- 
		3 votes3 answers54 viewsA: Use of property Nth:Child()TL;DR .grade:nth-child(3n+1) { /*AZUL*/ } .grade:nth-child(3n+2) { /*ROSA*/ } .grade:nth-child(3n+0) { /*AMARELO*/ } The functional rating of :nth-child(An + B) is easier to understand if you think… css3answered fernandosavio 9,013
- 
		1 votes1 answer588 viewsA: Javascript variable in Django templateYou can create an element that will only serve to show the error and leave it hidden with CSS. When there is an error just modify your content by JS and show it. I made an example using fetch but… 
- 
		1 votes2 answers1534 viewsA: Event click JqueryThe way the question was asked makes it hard to deduce if you want: The same but know if which button was clicked; The same Handler but knowing the state of the buttons. If this is the first case… 
- 
		4 votes2 answers65 viewsA: How to do the inversion of what is received with comma addition?You will need to follow the following steps: break the full name by spaces (using str.split() for example) separate the last name (list.pop()) and keep unchanged separate the first name… pythonanswered fernandosavio 9,013
- 
		0 votes3 answers50 viewsA: Passing array parameters to arrayAs the keys of variables movies and users are the ids of the same, you can use the profile.userID and profile.favoriteMovieID to search directly on objects. In the example below I walk profiles… javascriptanswered fernandosavio 9,013
- 
		0 votes2 answers529 viewsA: Avoid double quotes in CSV file exported with PHPThe function fputcsv always puts a character of Enclosure (which by default is " --- double quote) the field being treated has spaces. If the field already contains a value equal to the Enclosure it… 
- 
		1 votes1 answer289 viewsA: Function jQuery return validation message instead of AlertSince I don’t understand Asp.Net, a solution with jQuery would be to take the element you want to insert the error message with jQuery and change its HTML. In your case it would change the line:… 
- 
		1 votes2 answers228 viewsA: Allow a list as argumentAccording to the documentation of Flask Restful just configure the URL parameter correctly for the framework to append of the repeated parameters, instead of overwriting existing ones:… 
- 
		10 votes2 answers213 viewsA: Difference between click, bind, live, delegate, Trigger and on functions?All these functions are event-related. So we need to understand some concepts to go forward. Event Phase When an event is issued it has 3 phases, an event Handler can know what stage is through the… 
- 
		3 votes1 answer220 viewsA: How to create a dynamic search box?You can hear the event keyup input and run the search after this. Example: var search = document.getElementById('search'); var log = document.getElementById('log'); /* - keyup é lançado a cada tecla… 
- 
		4 votes2 answers86 viewsA: Problem with @keyframes CSSAn alternative to Sam’s response is to use the CSS property word-break with the value break-all. h3 { position: absolute; font-family: consolas; letter-spacing: 5px; color: transparent; } h3:before… 
- 
		2 votes1 answer400 viewsA: How to extract only JSON values by removing keysYou can use the method Array.map to extract only the ids. Example: let dados = [ { "id": "1" }, { "id": "2" }, { "id": "3" }, { "id": "4" }, { "id": "5" } ]; let ids = dados.map(item => item.id);… 
- 
		2 votes3 answers229 viewsA: Python is not so "smart" for redundant operationsAs philosophies of Python are 19, and none of them says it’s to make life easier for the programmer. One of them says: Explicit is better than implicit. That said, you as a programmer able to notice… 
- 
		3 votes3 answers69 viewsA: Shouldn’t this function return a bool instead of a pizza?This behavior is called Short-Circuit Evaluation or Short Circuit Evaluation (Wikipedia and MDN), which basically means: "If I already know the answer, I won’t even check ahead". Take as an example… javascriptanswered fernandosavio 9,013
- 
		1 votes2 answers102 viewsA: create random number in python starting with the yearTo solve the problem of "concatenate" the numbers just use mathematics, if you are using the year with 4 digits as the basis, just multiply the year by 10,000, ie, you will add 4 zeros to the right… python-3.xanswered fernandosavio 9,013
- 
		0 votes1 answer99 viewsA: Add Elements with JavascriptThe second parameter of the method Node.insertBefore is a reference node for JS to know which part of the element parent will be inserted. By the exception received, it seems to me divSenha is not… 
- 
		0 votes4 answers916 viewsA: Take the selected data in a v-select MultipleAccording to the documentation of Vuetify, you can use the properties item-text and item-value with the object keys to customize this. Follow your modified example. new Vue({ el:"#app", data: {… vue.jsanswered fernandosavio 9,013
- 
		1 votes2 answers106 viewsA: Background image is not replicated on other pages when using onChange functionMiguel, the concept of ID is to be an identifier, something unique that separates one thing from the rest. If you want to have multiple elements with the same ID, then what you want is to identify a… 
- 
		3 votes3 answers187 viewsA: Display record when another table has no referenceAnalyzing the following image: You want to make a LEFT JOIN (the graph to the left, the bottom) eliminating the results where the tables intersect. To do this just use WHERE tabela_b.id IS NULL. In… sqlanswered fernandosavio 9,013
- 
		1 votes1 answer480 viewsA: convert html to excelYou will need to assemble a spreadsheet using the official format, which is nothing more than a ZIP file with the Assets, Xmls and other files inside. You can ride this .xlsx at hand (a madness in… phpanswered fernandosavio 9,013
- 
		4 votes3 answers1090 viewsA: array in a php foreachYou can simply separate the values in the array within your for as follows: <?php $quantidade = []; foreach ($modelo as $k => $v) { $sql_ = "SELECT * FROM pedido WHERE modelo LIKE '%".$v."%'… 
- 
		0 votes3 answers424 viewsA: Block enter if textarea is emptyIf you want to know textarea contains only spaces it is better to just use the function String.trim and check that it is not empty. The trim removes any white space from the beginning and end of a… javascriptanswered fernandosavio 9,013
- 
		1 votes1 answer509 viewsA: Import Vuejs template from external html fileFirst, I believe that rendering external file templates is not recommended, both for performance reasons and for security reasons. However, by learning and if it is really a necessity, I did the… 
- 
		5 votes4 answers683 viewsA: Very slow SQL commandFirst I’d like to introduce EXPLAIN, just put it before your query that Mysql shows various useful data to discover the bottleneck of your query. Secondarily, if you show us the structure of your… 
- 
		2 votes2 answers52 viewsA: Check if file exists at runtimeFirst, your code is redundant. Yeah: while ($teste == true) { $teste = is_file($raiz . '/teste.pid'); if ($teste == false) { continue; } } Is the same as: while ($teste == true) { $teste =… 
- 
		1 votes1 answer93 viewsA: Item relocation in the array keyYou can use the title as the index of the array since they are unique. So it’s easy to test if the title already exists. If it exists add the item to an array, it creates the title. Ex.: <?php… 
- 
		1 votes3 answers56 viewsA: Use prepare statement at a constant value?It must be borne in mind that Prepared Statements do not serve solely to prevent SQL Injection, the other great advantage is that SGBD caches the Statement so you don’t need to rebuild an equal… 
- 
		4 votes3 answers3029 viewsA: How to calculate perfect numbers quickly?Adding to the already published answer, one point to note is that every perfect number is a hexagonal number. So instead of testing one by one of the numbers, you can scroll through only the… 
- 
		3 votes3 answers5803 viewsA: Difference between $.ajax(), $.get() and $.load()?$.ajax is the generic function to send an AJAX request, all other functions use it behind the scenes (code); The following function were created to facilitate programming, but they all call $.ajax… 
- 
		2 votes1 answer98 viewsA: Access data within PHP arrayI didn’t understand if the array keys are also dynamic, but if only the number of array elements are dynamic you can use the method array_map to merge all variables into only one element of the… 
- 
		1 votes2 answers159 viewsA: How to build header with logo in the center and information on the left and rightYou can use a structure similar to: flex-container ├── flex-esquerda ├── flex-centro └── flex-direita Where the left and right part will have the property flex-grow: 0 so that they do not increase… 
- 
		2 votes1 answer299 viewsA: Extract column text from a tableFrom Mysql 5.7.8 you can use columns of the JSON type. Then you could use one of the available functions to make his SELECT, as the function JSON_EXTRACT for example: SELECT *,… mysqlanswered fernandosavio 9,013
- 
		2 votes3 answers173 viewsA: The Hover is not working. Why?I tried to simulate the HTML that you didn’t post, and I could notice that the only thing missing was you initializing the opacity of the element with: opacity: 0; /* Formatação de imagens com… css-hoveranswered fernandosavio 9,013
- 
		4 votes3 answers78 viewsA: How to add class to all read except the one that was clickedYou’re already using the jQuery.not() which does just what you need, it returns a jQuery object by removing the element passed to it from the set. var $items = $(".render-menu li");… jqueryanswered fernandosavio 9,013
- 
		3 votes3 answers1856 viewsA: How do I make the logo disappear when I roll the page?This answer is merely a complement to reply from @hugocsl. When it comes to events like scroll, resize or mousemove It is always important to remember that they are launched several times per second… 
- 
		3 votes2 answers53 viewsA: Run icon "Arrow" with JSThe method jQuery.toggleClass belongs only to jQuery library, the method Element.classList.toggle would be the native JS equivalent. So, either you convert the this to a jQuery object using code:… 
- 
		3 votes1 answer573 viewsA: How to filter an object array using other object array?I tried to play your code in the snippet below. From what I could notice there are two more serious errors that prevent the operation. On the line: searchString.map(searchString =>… 
- 
		0 votes1 answer42 viewsA: Zoom 2 images simultaneouslyNor the documentation nor the code specify that it is necessary for HTML to be a <img>. Then you can simply create a container and apply the plugin to the container instead of the images.… 
- 
		1 votes2 answers1557 viewsA: Making a date set Random with pandasYou could just pick up the values Dataframe and use it as you wish. Ex.: import pandas as pd df = pd.read_csv('teste.csv', sep = ',') mails_random = df.sample(2) for linha in mails_random.values:… 
- 
		2 votes2 answers44 viewsA: I’m trying to make a little picture slideYou can use the operator % (divide remainder) so that the index is always within the length array, is a more mathematical solution and makes it always work because it depends on the size of the… javascriptanswered fernandosavio 9,013