Posts by Marlysson • 905 points
46 posts
- 
		0 votes1 answer156 viewsA: Reportbuilder report sorting errorTry it that way: case when par_ordenacao = 'C' then codigo when par_ordenacao = 'D' then descricao end asc 
- 
		0 votes2 answers528 viewsA: Swap String Values from a Dataset to'Float' valuesAnd the error is that numpy is trying to convert numbers to float as you defined but there is a string "tcp" in the first line, with this causing the exception. ALTERNATIVE You could use the library… 
- 
		1 votes3 answers340 viewsA: How to add values of a json request in python?Assuming you have a list of dictionaries returning in this api we have: amounts = [ {"amount": 0.1}, {"amount": 2}, {"amount": 145}, {"amount": 5.84} ] You could iterate over that list by summing up… 
- 
		0 votes0 answers20 viewsQ: When I update a non-jsf component ( normal html ) the element disappears from the rendering and loses its contentsI’m using an element <span> that is using a javascript library on it. Remember that JSF features only work on your elements When I run an "update = id_component" (this id_component is a… 
- 
		1 votes2 answers1067 viewsA: How to detect a certain sequence of numbers in javascript?I first created a function to check for duplicates in the string, which works as follows: check the string passed if the numbers contain the repetition ( using the previous reference ) for the 2… javascriptanswered Marlysson 905
- 
		2 votes3 answers551 viewsA: if and Else with almost equal blocksIt could also return the value in one case , and if it does not occur return the other, functioning as an "if/Else" . def func(x): if j % 2 == 0: return x/2 return x… 
- 
		1 votes3 answers2240 viewsA: Python libraries to check if a number is primeYes there is. There is the python library repository, where developers put useful libraries for the developer, among them, for involving prime numbers. Libraries involving prime numbers… 
- 
		1 votes3 answers149 viewsA: Find a certain number inside a mysql stringTry as follows using the FIND_IN_SET Supposing your field assets be composed of relationship id’s I took the liberty of using an adapted sql where you get a id. Anything alerts in the comments… 
- 
		0 votes2 answers174 viewsA: Vector receiving a function that returns integersThere is a "subtle" difference between the two forms you used; The first was the creation of a vector, at that moment, for the creation, it is necessary to declare the number of positions, because… 
- 
		1 votes2 answers3726 viewsA: Turn columns into rows into a dataframeTried to transpose the dataframe? It does the inversion between rows and columns. pd = pd.T 
- 
		0 votes2 answers758 viewsA: Nullpointerexception error when using JSF ELYou’re probably using this syntax inside a datatable , with it there is an attribute called var containing the current object used. You must use the attribute value var as an attribute value value… 
- 
		0 votes2 answers4733 viewsA: Open and close multiple tabs in Python browserYou can try it this way: while True: num_current_tabs = len(browser.window_handles) # Fechar todas - 1 abas, deixando uma aberta para não fechar o navegador. for i in range(1, num_current_tabs):… 
- 
		1 votes1 answer535 viewsA: can only concatenate list (not "str") to listUse regex on own name3 thus: re.sub(r"\D","",name3) This will remove anything that is not a string number. 
- 
		1 votes1 answer752 views
- 
		1 votes2 answers323 viewsA: problem with uppercase in DjangoWhy don’t you try using just one save and go treating these Fields in that save? Here’s a possible solution, using a single save to treat Fields: def save(self, *args, **kwargs): self.nubente =… 
- 
		2 votes3 answers2116 viewsA: Create table csv in pythonMove that line: escrevelinha.writerow([alinhado]) Which is outside the while, into the same, so every interaction and search of the element , already being made the recording in csv.… 
- 
		0 votes3 answers7670 viewsA: Check if element exists inside another element with JavascriptYou can use the search in the gift through the father div, for example: js pai = document.querySelector('.pai'): possui_div_filho = pai.querySelector('.filho') != null; javascriptanswered Marlysson 905
- 
		2 votes1 answer1939 viewsA: How to open, read the file and save in a list of lists the contents of the file using PythonFirst, you can open all 3 files simultaneously using the with , thus: with open('a.txt') as a, open('b.txt') as b, open('c.txt') as c: #faca_algo_aqui Then you can use the method .readlines() to… 
- 
		0 votes2 answers233 viewsA: How to extract all td names in order?From what I saw in the table, the names themselves there are not ordered.. Then you can capture them normally, and at the end, with the whole captured list sort them via python, using the command… 
- 
		1 votes2 answers61 viewsA: Error in PHP codeAt the time you pass the table name you pass only its name, without involving it with single quotes.. "SELECT * FROM ".$this->tabela." WHERE email_log = ? AND senha_log = ?"; And here too.… 
- 
		0 votes1 answer128 viewsA: How to isolate metadata with pdfminer?As you can already recover the PDF content becomes easier.. this returned structure is a dictionary, where each key points to a value, and its syntax is as follows:… 
- 
		2 votes1 answer91 viewsA: How to call the id of the previous selectWell, your problem as discussed in the comments is how to put the value of id that you are already able to capture from html. For this you can make a "hack" creating a url of Django in simple string… 
- 
		0 votes4 answers1753 viewsA: Comparing list indexes in python?In addition to the answers given you can also receive the input values in a single row. For example: entradas = input("Por favor, informe o valor de cada lado, seguidamente:" ).split() lateral =… 
- 
		5 votes2 answers339 viewsA: Text suggestionThe name of it is autocomplete where there is an event detecting the writing , so it is done a search in a set of data already searched from the database or other place. This creates a component to… 
- 
		1 votes2 answers22 viewsA: Create a one-size-fits-all box with scroll barIn the add element class: overflow-x : scroll; 
- 
		3 votes1 answer677 viewsA: Is using "if/Elif/Else" with Return good programming practice?The only problem I see would be readability , that in the case can even understand quiet , but if there are more levels there begins to complicate. But if you are in the sense of blocks I don’t see… 
- 
		1 votes2 answers137 viewsA: Prevent classes from changing the state of objectsThese are immutable objects where after being created, the object has no way to change its internal state, and this is obtained through deprivation of attribute definition forms such as access… 
- 
		2 votes1 answer518 viewsA: Compare dates in an array?In your variable menor_data tries to put the method .date() to return the same type you are creating within the while. They must be of the same type, or datetime or date.… 
- 
		0 votes1 answer185 viewsA: Packages from ScapyHere he speaks a little. http://www.secdev.org/projects/scapy/docusage.html#Stacking-layers 1. For the guy tries to give a print(type(pkt)) But in doc when instance an IP it returns an <IP ...… 
- 
		2 votes1 answer949 viewsA: How do I remove this warning?Add the SQLALCHEMY_TRACK_MODIFICATIONS configuration key to the flask app. app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False With this at the time of instantiating the application at the instance… 
- 
		1 votes1 answer384 viewsA: How to select multiple checkboxes from Array ?Javascript native foreach solution. First observation You may have mistaken the order of the values within the callback function, I tested it here and the signature of the foreach method ( native to… 
- 
		2 votes1 answer1390 viewsA: Django, recover selected value on pageIn html changes the name of select to use quotes: <select name="id_vendedor"> And in your view take the data through the request object. def novo_orcamento(request): id_vendedor =… 
- 
		0 votes1 answer83 viewsA: Doubt use of GITYou’re right in parts. The mode of decentralization is what is recommended, but with respect to the code could be like this: You put an application on the server that works like a github of life,… 
- 
		5 votes7 answers185 viewsA: Capture year outside the regexAs it is something punctual to look for in the sublime I believe that the problem is only to find the part of the year valid or invalid , so the part after the year would be the date that for what… 
- 
		3 votes1 answer1336 viewsA: Python data extraction and automatic email sending with information obtainedAnswer 1: String formatting You could use a format string and leave only spaces for variables along with line breaks. For example. string_envio = "Prezados devotos, " string_envio += "\n"… 
- 
		4 votes3 answers2721 viewsA: How to join several Python dictionaries?You can use the method update to update a particular existing dictionary or create a new one and update it. >>> a = {"A" : 1} >>> b = {"B" : 2} >>> c = {"C": 3}… 
- 
		0 votes1 answer34 viewsA: Given of the variable identSuited in the URL. How to resolve?You have to take the input value that the user type , and no longer assign the field name, try so: Add an identifier in the field you want: <input type="text" name="identUsuario"… 
- 
		0 votes1 answer190 viewsA: How to transform a JSON that contains an object array into an object list?php has a specific function for this: json_decode(string_json,boolean) The second parameter concerns whether in the conversion you want to return an associative array or not. Your example would be:… 
- 
		3 votes1 answer6899 viewsA: Python: How to correctly import one method that depends on another?Functions within classes are called methods, and they must have the value as their first parameter self and after it the parameter that will be passed to the method. All your methods within the… 
- 
		0 votes3 answers1209 viewsA: Extract numbers from a list using RegexYou don’t need to use regular expressions for this, only if what you’re looking for is in a large string, then the regex would look for a pattern and return the ones that would marry it.. But if you… 
- 
		1 votes2 answers699 viewsA: Regex Python Searching datesNote: Regular expression is not validating the date format if want the regex to validate the format : dd/mm/dddd Regex for dd/mm/yyyy But if you just want to take it To capture elements within a… 
- 
		0 votes2 answers1365 viewsA: How to add the result that is inside the Split function in python?Whereas you will always receive either numeric characters or mathematical operations. First you will separate the data from the string that arrives for you: >>> string = "6+5".split("+")… 
- 
		2 votes1 answer940 viewsA: What is the correct way to import functions from other packages in python?This case is related to the normal use of Python packages. As your package has dependencies they will be installed with a normal package, so they will have their normal import mode as if you were… 
- 
		3 votes2 answers599 viewsA: How to request input data N times, and concatenate this dataYou could use the for because in case after the user type the amount of times he wants to insert the links you will know how many times you have to repeat the loop, then just use lists to store the… 
- 
		0 votes2 answers856 viewsA: Remove duplicate lines in a Mysql queryPuts a date and/or time field in the messages table , and puts a LIMIT 1 when making a SELECT in the messages 
- 
		3 votes2 answers14161 viewsQ: What is the shortcut for code execution in Sublime Text?How do I make the shortcut Ctrl(Cmd)+B in Sublime Text, run Python codes on the same screen as the code?