Posts by Jonathan • 1,073 points
56 posts
-
1
votes1
answer11
viewsQ: Reactor - After filter false, call another method
Given the code below: fun method() { return gateway1.getPerson(id) .filter { isPersonValid(it) } .flatMap { gateway2.isPersonHasAddress(id) } // Retorna Mono<Boolean> .filter { it }…
-
0
votes1
answer25
viewsQ: How to perform Flatten with reactor?
I have a list of strings, where I convert to a Flux. And, for each Flux, I perform a flatMap which, in turn, returns a list. Further ahead I run a collectList() which converts Flux to a list. As a…
-
0
votes1
answer39
viewsQ: Where the return is List<List<String>> convert this result into List<String> only by combining the elements
Considering the implementation below: fun main(list: List<String>) { val x = list .stream() .map { findMessages(it) } .collect(Collectors.toList()) } fun findMessages(s: String) :…
-
0
votes0
answers32
viewsQ: Convert Bytearray to Multipartfile without using the Mockmultipartfile class
I have a Bytearray type attribute (byte[]) and would like to convert it to a Multipartfile. After that I would like to take this multipartFile and send it to a function that will perform a request…
-
3
votes1
answer25
viewsQ: PUT or PATCH, which one should I use in this scenario
I have a hypothetical database: CREATE TABLE person ( code integer NOT NULL, name varchar(50) NOT NULL, PRIMARY KEY (code) ); When I perform a POST, I create by sending on the body: { "code": 15,…
-
0
votes0
answers11
viewsQ: Wiremock not ordering withRequestBody
I am implementing some tests in my application as follows: stubFor(post(urlPathEqualTo("endpoint")) .withRequestBody(equalToJson(stringJson, true, false))…
-
0
votes1
answer20
viewsQ: Reactor - Use orelse after a filter
With the following code: public void deleteOrSave() { Mono.just("someName") .filter(this::isMyName) .flatMap(this::delete) .orElse(this::save); } private boolean isMyName(String name) { return…
-
0
votes0
answers19
viewsQ: Subtraction of an Expression<sql. Timestamp> in the criteriaBuilder
I have the following implementation: private static Specification<Record> sinceMinusMinutes(Integer minutes) { return (Specification<Record>) (root, query, criteriaBuilder) ->…
-
0
votes0
answers19
viewsQ: Treat Optional Null or Empty using lambda functions
Let’s say I have the following methods: public Optional<List<String>> doSomething1() { // do something return null; } public Optional<List<String>> doSomething2() { // do…
-
1
votes1
answer103
viewsQ: Return true when Bigdecimal variable is different from null, otherwise return false
I have a type attribute BigDecimal x. I need to call a method exampleMethod(). I would like to pass the parameter true or false depending on whether x is null or not, as in the example below: val x:…
-
0
votes2
answers378
viewsQ: Json - Take key from a value
I own a json: { "pendente": 0, "cancelada": 1, "remitida": 2 } I matter that way in my file.js: const enumJson = require("./dir/enum.json"); I wonder, how do I get the key from a value. For example,…
-
1
votes1
answer33
viewsQ: Search in Elastic pass a list and return all matchs
I need to perform a search in Elastic search, but I’m having difficulties BoolQueryBuilder query = boolQuery() .must(matchQuery(CLIENT_ID, clientId)); fieldValues .forEach(fieldValue ->…
-
1
votes1
answer39
viewsQ: Get the content size returned in the request
Hello, I’m using an Interceptor that will intercept before and after the request. The goal of this is to get the size of the content sent and returned, however, I do not know a way to get the…
-
1
votes1
answer58
viewsQ: Sort an array within an object, entering all hierarchies of it
I own an object that contains several arrays within it. And these arrays contain other objects that contain a field lpec_sequence that I would like that under every hierarchy, it was ordered by that…
-
2
votes1
answer463
viewsQ: Query using order by slowly
I have a query like this: select ae_id from app_event join trip_item on ti_id = ae_trip_item_id where ae_driver_id = 63 order by ae_date desc limit 10; The table app_event has about 3 million data,…
postgresqlasked Jonathan 1,073 -
0
votes0
answers28
viewsQ: Problem running Ionic --device
I executed the command ionic cordova run android --device however, the execution stopped at here: Starting a new Gradle Daemon for this build (subsequent builds will be faster). Incremental java…
-
2
votes1
answer333
viewsQ: Get size of a request
On my system, I receive several request, I wonder if there is a way to get the size of this request (req) received in kbs preferably, to get a sense of how much bandwidth was spent for that…
-
0
votes0
answers146
viewsQ: Build menu is not opening with drag
I am testing some components of Ionic 2. I installed via usb an application with a simple menu, which has some items. When I try to open the side menu 'dragging', it doesn’t work, just by clicking…
-
1
votes1
answer472
viewsQ: Error using monolog: PHP Fatal error: Class 'Monolog Logger' not found
I tried using monolog in my application, however, after the installation done according to the documentation, i try to import and use, but there is an error message stating that it could not be…
-
1
votes1
answer30
viewsQ: Manage urls on a system
I’m on a project where there’s the test environment, and the production environment. When I am developing in test, I use some different urls for this. I use some Amazon services, and they are…
-
1
votes2
answers720
viewsQ: Update date at each update in a table
I have a table pessoa. In it I have a field called pe_modified which aims to have the date of the last modification in the table. Instead of me having to update on the query, is it possible to be…
-
3
votes2
answers7656
viewsQ: Go through all keys of a json
I want to go through all the keys of a json so I can get all of its values. Ex: { "logistics_provider": "{{lp_name}}", "shipper": "{{co_common_name}}", "invoice_key": "{{ae_identifier}}",…
-
1
votes1
answer47
viewsQ: Indefinite value after consulting the bank
I have the following code: var async = require('async'), pgPromise = require('../utils/pgPromise'); function anyFunction() { var tripItem = []; var tripStartEndTripItem = []; var tripStartEnd =…
-
4
votes2
answers758
viewsQ: Average between timestamp dates
I have 3 dates: 2016-08-17 12:29:01 2016-08-17 12:34:13 2016-08-17 12:39:26 And I would like to get the average time between them. If there are more than 60 seconds, then in minutes, and the same…
postgresqlasked Jonathan 1,073 -
0
votes2
answers68
viewsQ: Group two tables
I have two tables. A call Pessoa and another call Evento. Pessoa owns the fields id, name and email. Evento owns the fields id and pessoa_id. The table Evento contains several events for each…
postgresqlasked Jonathan 1,073 -
3
votes2
answers1286
viewsQ: Multiply the amount of elements from two different tables
I have two tables: pessoas and carros. I would like to take the number of elements of both tables, and multiply them.
-
1
votes1
answer115
viewsQ: Return value 'Undefined' because of asynchrony
I have a file called validationForgetPassword.js with the following code: "use strict" var config = require('./config'), createHash = require('sha.js'), pgPromise = require('./pgPromise'), winston =…
-
1
votes1
answer3765
viewsQ: Get information from a url using Node + express + ejs
I set up a url in the following format: localhost:8080/forgetPassword/id/hash I have this route rendering: app.get('/forgetPassword', function(req, res) { res.render('pages/forgetPassword'); }); So…
-
4
votes2
answers2461
viewsQ: Generate random password
Hello, I checked that there are libraries generate-password and password-Generator for random password generation. However, importing a library just for that, might not be a good idea. Is there any…
-
0
votes0
answers104
viewsQ: Validate information coming in req
I receive information for my route, where they are contained within a req. Ex: router.post('/', function (req, res){ }); This information I will put in my bank, however, before entering, I have to…
-
0
votes0
answers73
viewsQ: pg vs pg-Promise library
In my project I used the library pg for access to the postgres bank. But with some needs, I used the library pg-promise. For those who have used both, and understand more on the subject, I would…
-
2
votes3
answers230
viewsQ: Extract data separately from a date in string format
I have a date in string format: Wed Jul 20 2016 14:01:01 GMT-0300 (BRT) And I would like to extract the date and days and time in such a way that I can form a string like this: Quarta-Feira,…
-
2
votes1
answer79
viewsQ: Get Timezone from a date
I have that date: 2016-02-22T14:55:00.000-03:00 And I’d like to take the Timezone: -03:00 Automatically, without having to perform any regex.…
-
0
votes0
answers38
viewsQ: Convert date format to other
I would like to convert this date format: Wed Jul 20 2016 17:55:00 GMT-0300 (BRT) for this format: 2016-07-20T14:55:00.000-03:00
-
7
votes1
answer2212
viewsQ: Asynchronous function chaining alternatives
I need to perform 3 select. One in each table, and its precise result use in select remaining. In the original application, I do a lot of manipulations in the result of each query, which leaves a…
-
3
votes1
answer34
viewsQ: Access to json is returning error
I have the following json: x = { "body-json": { "id": "1" } } I’m trying to access the id this way: console.log(x.body-json.id); Turns out I can’t access the reference body-json. Can someone help…
-
2
votes3
answers2889
viewsQ: Get Defined/Current Time Difference
I would like to get how many hours has passed, from a given date, to the current date. For example: day = "Thu May 19 2016 05:00:00 GMT-0300 (BRT)"; today = "tue May 23 2016 09:00:00 GMT-0300…
-
2
votes1
answer505
viewsQ: Set date 7 days/a week ago
I would like to get today’s date, and subtract it from 7 days. Remember that if we are on the 2nd for example, you should subtract 1 from the month. The same applies to the year. Unfortunately, I…
-
2
votes2
answers379
viewsQ: Array returning Undefined because of asynchrony
I’m accessing the API of Trello, but I came across the following problem: Access Trello information by obtaining the id of each existing queue, the code is as follows: var x; var numberCardsByList =…
-
6
votes1
answer609
viewsQ: Access values within an array from the index
I have a variable x with the following content inside: x = [ { id: '1', name: 'name, } ] And I thought to access the id were x.id, however, it is not so. How to access?…
-
2
votes2
answers736
viewsQ: Traverse an array without knowing its indices
I own the following array: var array = { x: "Primeiro Valor", y: "Segundo Valor", z: "Terceiro Valor" }; I would like to access the values, however, I do not know the indices x,y,z, it is possible…
-
2
votes1
answer42
viewsQ: Two Salesforce Queries Generate Undefined Values
I’m performing two queries in Salesforce. However, when I try to use the values received outside the scope of the query, they are undefined. Follows the code: var conn = new jsforce.Connection();…
-
3
votes1
answer140
viewsQ: How to use Try/Catch to read files
I have a method called readFileCredentials which aims to open a file and return the data that was inside that file, follows the code of that method: readFileCredentials = function(file, cb){ var…
-
2
votes1
answer777
viewsQ: Read file and assign each row in a different variable
I have the following file: mensagem 1 mensagem 2 mensagem 3 mensagem 4 I would like to read this file using the Javascript language, and to each line, assign to a different variable.…
-
1
votes0
answers44
viewsQ: Direct to the github location
There is a repository on github where it already contains a project. I have to create a new branch and put my own project there, however, I don’t know how I direct to the repository, and besides, to…
-
6
votes2
answers2441
viewsQ: Convert date and time to numeric value in Javascript
I saw in the Kibana dates are treated as numerical values. For example, the date 2016-05-03T10:00:00 is equal to the numerical value 1462280400000. I would like to understand how this works, and…
-
1
votes1
answer383
viewsQ: Using Elasticsearch, how to obtain data between certain hours using range
Hello, I am using Elasticsearch, and my query is not searching for the information I want. { "query": { "bool": { "must": [ { "range": { "date": { "gte": "2016-04-29 00:00:01", "lte": "now" } } } ]…
-
4
votes2
answers3375
viewsQ: In Nodejs, the global variable in my app.js file is undefined in another file
I am in a project using Nodejs, and its Express framework. In the main archive app js. i call a function in order to read a file, and assign to a global variable: global.google_sheet_credentials =…
-
-1
votes2
answers516
viewsQ: Authentication using Codeigniter
I’m starting to use codeigniter, and I have a question. In the view, I have 2 presses, one for login and one for registration: <form id="login" method="post">…
-
0
votes2
answers3565
viewsQ: Difference between operating system and mobile platform
I have looked elsewhere for this information, but I have not been able to clarify it. I would like to know the difference between operating system and mobile platform. For example, I always hear…