Posts by Marcelo Junior • 816 points
30 posts
-
1
votes1
answer682
viewsA: Problem with dictionary - Attributeerror: 'int' Object has no attribute 'get'
The error happened because you tried to call a method that does not exist in int. v.get(stuff,0) As you explained later in the comments you just wanted to show the key and value of each element in…
-
4
votes3
answers11852
viewsA: Show a number in 2 decimal places
You must inform the JavasSript what is the accuracy of the variable Number you want, using the toFixed. OBS: toFixed will turn your number into a string. Then it would look like this: function…
javascriptanswered Marcelo Junior 816 -
0
votes2
answers1056
viewsA: Assign link to a modal bootstrap window
Possible solution One option is to use hashtag to inform that the client wants to open a modal, example: www.sitedevendas.com/product#buy That way you would know that the client wants to open the…
-
0
votes1
answer145
viewsA: Catch local time with JS, save to Mysql, show with PHP
Leaves the date the way you want it using the functions split(), slice() and join(). Then send the form with that modified date. Then I’d be like this: var date = new Date(); var dateFormat =…
-
0
votes2
answers487
viewsA: String Sweep in Search of Substrings Ignoring Accent and Case and For Each Match Perform an Action
The Idea To catch all the substring of a string that respect a certain pattern and insert the tag <strong></strong> among the indices that appear such standard, where default is not case…
-
2
votes1
answer305
viewsA: Generate pdf file from a pdf Object
Requests To get the PDF we can use a library called requests, to install do: pip install requests The code will look like this: import requests # Url do PDF url =…
-
12
votes3
answers9942
viewsA: Remove non-numeric characters from a Python string
You can use regex to solve your problem: import re b = "A1B2C3" b = re.sub('[^0-9]', '', b) # 123 print(b) Explanation The function sub(), first receives a pattern in the first parameter, a new…
-
0
votes3
answers1435
viewsA: Call functions for ajax request inside callback
You can call func2 in func1, and the func3 in func2, similarly to a callback. It will be as follows: $('#chamar').bind('click', function () { $('#form').validator().on('submit', function (e) { if…
-
1
votes4
answers1152
viewsA: Javascript function with Nan error
In JavaScript decimal numbers are represented with . (point) and not with , (comma). That part of the code: RTS_TRUE = parseInt(ECG_TRUE) * 0, 9368 + parseInt(BPM_TRUE) * 0, 7326 + parseInt(FR_TRUE)…
-
0
votes1
answer93
viewsA: Get object that was created on the server via Angular
See that this.http.post is asynchronous, so that this.response may not have the value returned by the server when the function create end. A possible solution would be to pass a function of…
-
1
votes1
answer94
viewsA: Modify paging with JS to create link
How do you already own the url, you should just put her inside href tag a : var a = "<a href='" + tag + "' id='link'>Assita o EP via Player Externo</a>";…
javascriptanswered Marcelo Junior 816 -
0
votes3
answers393
viewsA: Generate an iframe from the youtube link with jquery
Suppose we want to show the following video from Youtube, within a iframe: https://www.youtube.com/watch?v=[id_do_video] For this we must convert him to: https://www.youtube.com/embed/[id_do_video]…
-
2
votes1
answer283
viewsA: How to control the event to get out of the page?
To perform this function you need to implement the function confirmaSaida, calling for confirm to check if the user really wants to quit, and in positive case you redirect to the page you want,…
javascriptanswered Marcelo Junior 816 -
1
votes1
answer325
viewsA: Address type Struct for INT
The problem The biggest problem of keeping one ponteiro within a inteiro is that a ponteiro may be greater than a inteiro, so that you may not be able to access the memory region you want, since you…
-
1
votes2
answers386
viewsA: How to check if an object has a string?
In case you’re sure the word postal_code or postal_code_suffix is nowhere else but within the array types, you can use: var jsonStr = JSON.stringify(obj); var postalCode =…
-
1
votes3
answers69
viewsA: Program does not meet expected flow by reading and printing input
You have to pass the variable address when using scanf() and you’re expecting a \n in the scanf(), in case you don’t need. Your code would look the right way: #include <stdio.h> #include…
-
2
votes2
answers1249
viewsA: Returning function string directly and with array
Why is the first right and the second wrong? The first one works because when your program runs it first allocates a space for that constant string, and stores that value in that space. So when it…
-
3
votes1
answer1181
viewsA: Reload de Página Web
You forgot to call the function Refresh(): <a onclick="Refresh()"><i class="fa fa-fw fa-refresh"></i> <p>refresh</p></a>…
-
3
votes2
answers59
viewsQ: What is the usage limit of . push_back()?
I use a lot .push_back(element) when I’m working with vector, but I don’t know what’s the most elements I can add to a vector before it overflows and performs the reallocation of a new space in…
-
2
votes2
answers1764
viewsA: Progress bar plugin with steps
Bootsnipp You can use this code I found on bootsnipp. https://bootsnipp.com/snippets/featured/form-process-steps Note you will only have to make a javascript script to change the classes. There are…
-
2
votes3
answers269
viewsA: What would this Jquery code look like in pure JS?
Firstly, Toggle does not serve to activate a class. What it does is to add a class if it is not already added. And if it’s already added he removes it. To remove you use .remove('nomeDaClasse'), and…
-
2
votes3
answers3374
viewsA: Convert scientific notation to decimal
For exponents not too small or too large, a simple value assignment already solves your problem let num = 2.6274846602703e-6 console.log(num) /* 0.0000026274846602703 */…
javascriptanswered Marcelo Junior 816 -
3
votes2
answers999
viewsQ: Which is more efficient, perform multiple queries or use JOIN?
I have a table X that has my user data, and I need to return to the client the data related to that user in the table Y and Z. I can do it using JOIN or: SELECT attr1, attr2 FROM Y WHERE X_id = id…
-
3
votes1
answer1883
viewsA: How to sort an array of objects using Typescript?
You can use the .Sort() for that reason: arr.sort((a, b) => (a.name < b.name) ? -1 : 1);
typescriptanswered Marcelo Junior 816 -
0
votes2
answers282
viewsA: How to execute a function in ajax when opening the page?
The code snippet below is outside the function Success, and the function Success is spelled wrong. setTimeout(function () { update() }, 50);}
-
1
votes1
answer112
viewsA: Nodejs - Expect for to run all pool.query by the end
The Problem First, let’s talk about the problem of your code. The function pool query.() seems to me to be asynchronous/non-blocking, so that iterating on it to get these values will not be…
-
0
votes1
answer910
viewsA: Download PDF Node.js
Resovido using the pipe function. request(options, function (error, response, body) { /* CODIGO */ }).pipe(res);
-
0
votes1
answer910
viewsQ: Download PDF Node.js
I’m using Request to download a billet from https://www.boletocloud.com/ which is in pdf. Turns out I can’t see the pdf I downloaded, the API developers say it’s in UTF-8, I’ve uploaded everything…
-
4
votes1
answer1859
viewsA: Difference between a blocking language and a non-blocking language
Explanation In a blocking system the requisitions would be queued and then processed one by one, so it would not be possible to process several of them at the same time. That is, the client who has…
-
2
votes1
answer1092
viewsA: SELECT with various parameters in PHP
Using OR or AND If you want to add more attributes to filter your search you can use AND or. In case we will have: // Para AND (Irá retornar apenas as tuplas que tem LOGIN E IDADE que você informou…
phpanswered Marcelo Junior 816