Posts by Thiago R. • 267 points
25 posts
-
1
votes1
answer1079
viewsQ: Remove duplicated string characters if not a graph
How to remove duplicate characters in a string if it is not a graph (rr, ss) using Regex? Ex: Oiiiii => Hi Aloooo => Alo Past => Past Car => Car If the rr or ss appear at the beginning…
-
0
votes1
answer72
viewsQ: Doubt about Index for Boolean Fields - Mongodb
I have documents with boolean fields in a mongo collection. To index these fields, is it better that their values are Number (0 or 1) or does it make a difference if they are Boolean? I have…
-
0
votes1
answer118
viewsQ: Mongo indexes
I am starting the studies with the indexes. I have a base in Mongodb where the documents have about 10 fields. Searches can be done using all these variables. I created an index with all fields, and…
-
4
votes1
answer398
viewsQ: Looking for Keywords in Elasticsearch
I’m registering some objects of the kind: [{ nome: "bom_atendimento", chaves: ["bem atendido", "atendimento bom"] }, { nome: "ruim_atendimento", chaves: ["pessimo atendimento", "atendimento ruim"]…
-
0
votes1
answer657
viewsQ: Create audio file from URL
I need the messenger audio file to use in the Google Cloud Speech API. When an audio is received in the messenger, a url is generated that downloads that file into . mp4. How can I from that url…
-
1
votes1
answer44
viewsQ: Function that runs on scheduled time
How to create a function that runs for example every 5 minutes in the nodejs. I found the lib: http://bunkat.github.io/later but I don’t know how I make it to be executed always, and not just once…
-
1
votes1
answer104
viewsQ: What is the best way to generate custom errors
For example, the user enters an invalid value, and I want to generate an error. It would be using throw new Error("Você digitou um valor inválido") and dealing with try/catch as in Java? Or there’s…
-
1
votes1
answer50
viewsQ: Does uploading modules into a single file decrease app performance?
My project has several modules, if I load them all into one file - modulos.js - am I decreasing the app’s performance? ex: file that loads modules (modulos.js): exports.var1 = require("...")…
-
4
votes2
answers617
viewsQ: How to identify a number (in full) in a sentence
I need a script to identify a number in a sentence. Ex: "Two Weeks ago" -> number = 2 It can even be by substitution even. So: if str contain two, replace("two", 2) Is there a module that can do…
-
0
votes0
answers70
viewsQ: Generate graphics in image
Have some api where I pass the data, and it returns me the link of an image with the generated graph, in js Node? I found this project: https://github.com/ryanrolds/quiche, but it seems to be…
-
1
votes1
answer56
viewsQ: Using Q Promise to receive different Apis values
I need to get the values of some Apis. For example: calls to api1() and api2() return deferred.promise; I can do: api1().then( function(res1){ api2().then( function(res2){ console.log(res1, res2);…
-
1
votes0
answers87
viewsQ: How to return value ( Webhook )
I’m trying to use the api.ai https://docs.api.ai/docs/webhook From what I understand, I have to return a JSON in the format: "fulfillment": { "speech": "Today in Boston: Fair, the temperature is 37…
-
3
votes1
answer2275
viewsQ: How to get current date with time in js?
How to get current date with time in js? I need to know how many days you ran after a certain date. I’m using momentjs var start = moment( "2016/06/17" ); var end = moment( new Date() ); var time =…
javascriptasked Thiago R. 267 -
1
votes2
answers5842
viewsQ: Regex to validate date yyyy/mm/dd?
I have tested several expressions, but I did not get the desired result. How can I validate the date for yyyy/mm/dd ?
-
4
votes1
answer63
viewsQ: Regex that captures date informed by user, typed in a sentence
If I have a phrase: "melhor 01/01/2016 - 05/01/2016" How can I retrieve the dates of this phrase using regex? thus: var data1="01/01/2016" , data2="05/01/2016"
-
3
votes1
answer1113
viewsQ: How to check if String is contained in a position of an array?
I need to check if in a String, it contains any words that are in the array. For example: var array = ['faço?', '**fazer**' ] var str = 'como eu posso **fazer** isso?' Would have some more effective…
javascriptasked Thiago R. 267 -
3
votes1
answer129
viewsQ: Lost variable value ( Javascript )
I have this class, but every time I ask, and access the value of fb_firstNameis 'Undefined'. What I’m doing wrong? inside the set method, setFb_firstName(firstName) the value is correct, but when…
-
1
votes0
answers38
viewsQ: Why does variable have same value for different instances?
I have the following code File 1 : var fbuser_firstName; var FB = require('fb'); var User = function (sender) { FB.api('/' + sender, 'get', {access_token: process.env.PAGE_ACCESS_TOKEN}, function…
-
2
votes1
answer336
viewsQ: How to receive a facebook username? Graph API
Hi, guys. How to get a facebook user id, and its name using Graph api? I can only get the message id using sender = event.sender.id; function fbGetProfile(id) { request({ method: 'GET', uri:…
-
1
votes0
answers59
viewsQ: Ajax does not pass information to Servlet
I have a problem with the code, Servlet is not called. It only works if I put action="Fileuploader" in the form. Is there an error? Is there any other way? What I need: an array of images, where…
-
0
votes2
answers223
viewsQ: JSP information for another JSP
Example: I have a JSP A, which has some information and a button. When you press this button, JSP A sends variables to B (such as id, name...). B would use this information and update the page…
-
0
votes1
answer227
viewsQ: Wait Servlet finish action, and update screen with js
I pass a value to Servlet, with js, not to redirect the page: var formData = new FormData(); var xhr = new XMLHttpRequest(); xhr.open('POST', 'ServletMessage', true); xhr.send(formData); and write…
-
1
votes0
answers49
viewsQ: How to create a preview multiple images via "Multiple input" html?
I found this code on the net, it works well. But, how can I adapt it, to receive several images? <input type="file" accept="image/*" onchange="loadFile(event)"><img width="100px"…
-
5
votes1
answer566
viewsQ: Create inputs for images dynamically and move to Servlet without redirecting the page?
I would like to create a button that brings up a input for sending images. This button can be used multiple times. When the user(a) click the Submit, these images should be sent to the server…
-
0
votes0
answers51
viewsQ: Grab an AWS image and attach it to the email?
Is it possible to 'uple' an image in aws, and then attach it to an email? I thought of two things: If there is a way to recover the file directly from aws server ( as if it were my pc, for example,…