Posts by Jefferson Quesado • 22,370 points
421 posts
-
4
votes2
answers71
viewsA: How to use comparison function on a Std::Sort
I’m not a C++11 expert, but this code has some assumptions that are easy to understand. The first point here is regarding syntax, []( Vereador x, Vereador y ){ return x.votos > y.votos; }. That’s…
-
4
votes0
answers48
viewsQ: Identify new, removed and modified objects from two ordered "collections" using extra O(1) memory in O(N) time
I have 2 "sets" of elements, neo and old, which has elements of the type T, all non-zero. Also, I know that these elements are identified by a key K and I can extract using this key using a…
-
7
votes1
answer66
viewsA: A subset language of a context-free language is decidable?
Imagine we have a language U which is undecidable. Her words belong to the alphabet Σ. If U exist, so it is a sublingual of Σ*. Let us now take the following grammar G that produces L(G): S -> AS…
-
3
votes2
answers47
viewsA: Problem when I try to import my own modules into Lua (not found)
For documentation, you pass require("name-of-file"). By calling require "lili", it will search for the following files: lili lili.lua c:\windows\lili /usr/local/lua/lili/lili.lua In his example, the…
-
3
votes1
answer88
viewsA: What is the lowest number of irrigators (circles) needed to cover the surface of a foliage (rectangle)? (competitive programming)
As you yourself noticed, this problem can be reduced from coverage of area for coverage of segments. To level the playing field, I will explain this transformation. And the area, amazingly, is not…
-
1
votes1
answer26
viewsA: How to publish Maven artifacts in Jitpack with "Flavour" defined by Maven profile?
Jitpack allows you to place a custom build script. In this script, it guarantees some variables. In the case, the guaranteed variable VERSION brings the desired version to be generated. For example,…
-
1
votes1
answer26
viewsQ: How to publish Maven artifacts in Jitpack with "Flavour" defined by Maven profile?
I have a number of dependencies that I now need their normal "flavor", time I need their "flavor" without Amblas. I’ll take care of it by profiling retrolambda enabled or not. One of my projects I…
-
4
votes1
answer58
viewsQ: What are Fibers in Ruby and how to use them?
I was trying to do a reverse proxy using Webrick when I discovered that the version I had installed from Webrick did not contain the methods necessary to make a "chunked" worthy reading. So I…
-
2
votes1
answer58
viewsQ: List only the added files and modes in the git cast
I’m having trouble dealing with file permissions in git. In this case, I need to check if the file has been added with the correct permission mode. As for changing the permissions mode, you already…
gitasked Jefferson Quesado 22,370 -
6
votes1
answer182
viewsQ: Algorithm O(n log n) to identify contiguous intervals given a range list
I have the following problem: Given a list with n continuous intervals, return a list of m continuous intervals such that: every point of the entry list is contained in any of the intervals of the…
-
3
votes2
answers145
viewsA: What are the disadvantages of protecting a string of objects from a nullPointerException using the optional map?
What I write here first comes from experience I have in the company and then from absorbing what is written in the article (in English) Use Optional correctly is not optional, published in Dzone. As…
-
2
votes2
answers326
viewsA: Number represented as sum of square of consecutive primes in C
First point to be considered: 10^9 it is possible to be represented with 32 bits (in real, 32 bits reaches up to approximately 4 billion), so the upper limit of the input (which is 10^8) it is…
canswered Jefferson Quesado 22,370 -
4
votes1
answer96
viewsQ: Nonstatic nested interfaces can be used independent of instance of the enclosing class?
I was reading about JsInterop and I come across an example of code: package com.example; @JsType public class Bar { @JsFunction public interface Foo { int exec(int x); } public static int…
-
3
votes2
answers244
viewsQ: Which package should the "@required" annotation be imported from?
I need to put the note @required in a builder: class Pacote { final int id; final int nCodigos; final String tabela; Pacote({@required this.id, @required this.nCodigos, @required this.tabela}); //…
-
1
votes1
answer55
viewsA: Questions about Backus Naur Form
BNF is nothing more than a glorified notation for productions of formal grammars, often used for context-free grammars. She has her quirks, which are: non-terminal are denoted by <angle…
formal-languagesanswered Jefferson Quesado 22,370 -
3
votes2
answers1997
viewsA: Replace all letters of a String with asterisks
I am also a fan of regex, but for this case I do not see great needs. I should also disagree a little costamilam response because it replaces things that are not letters by letters, since it keeps…
javaanswered Jefferson Quesado 22,370 -
1
votes1
answer1058
viewsQ: How to transform a selected text to a low box in Vscode?
I would like to turn a snippet of code into a low box in Vscode. Get a similar effect to CTRLSHIFTY of the Eclipse? Something similar to the gif below:…
visual-studio-codeasked Jefferson Quesado 22,370 -
12
votes1
answer229
viewsA: Is a finite state machine capable of detecting the primality of a number?
It is not possible to have any Deterministic Finite Automaton that recognizes prime numbers (or recognizes compound numbers, which is the nontrivial subset of the complement of prime numbers). A…
-
1
votes1
answer85
viewsA: How to get the value of a specific parameter in a jointpoint in an "Around" processing?
At the end of the day, I used reflection proper. I noted which parameter I would like to treat as @Tenant. To be able to identify (route AspectJ) which methods I would like you to have this, I…
-
15
votes1
answer229
viewsQ: Is a finite state machine capable of detecting the primality of a number?
I recently saw a publishing how they taught Perl to recognize a prime number using regular expressions. The regular expression in question is: /^1?$|^(11+?)\1+$/ The only requirement of this regular…
-
5
votes1
answer539
viewsA: What are the main advantages of using the Java 9+ modularization feature?
What an expressive gain we have when using the new module system? Here, from what I could read and feel the taste (I couldn’t sip a large sip, only one came on the tip of my tongue) of Jigsaw, are…
-
7
votes1
answer1023
viewsA: What is a Great Algorithm?
An optimal algorithm is one that can solve a particular problem using as few resources as possible. However, we enter here a crop that ends up generating not a single great option, but a curve of…
-
4
votes0
answers150
viewsQ: What is Trunk Based Development?
I was recently introduced to an article in Medium on Trunk Based Development (TBD). The title was totally provocative, You don’t need Feature Branches anymore... ("You no longer need Feature…
-
6
votes6
answers623
viewsA: What is the reason for the application of the concept LIFO (Last In, First Out)?
I won’t go into the traditional merit, which I believe the answers of Maniero and Onosendai already answer the core of the question, but I will get into the real advantage of using batteries in some…
computer-scienceanswered Jefferson Quesado 22,370 -
10
votes2
answers4166
viewsA: What is the difference between the map() and flatMap() functions of Java 8?
Let’s start with the meaning of words? flat: flat, flat So the flatMap will map and flatten. What does that mean? Before you answer, allow me to take a walk to talk about manipulation of these data…
-
1
votes1
answer85
viewsQ: How to get the value of a specific parameter in a jointpoint in an "Around" processing?
I have the following method: @RequestMapping(path = "/{tenant}/import", method = RequestMethod.POST, consumes = "application/json", produces = "text/plain; charset=UTF-8") @Transactional public…
-
4
votes1
answer71
viewsQ: In pubspec.lock, what is a "direct main" dependency?
In Dart, we specify dependencies through pubspec.yaml through indicators of the desired version (similar to gemfile for Ruby or the composer.json for PHP). From this list of dependencies and…
-
3
votes1
answer77
viewsQ: How to express a predicate of equality in Java?
I have the following expression: final String idStatusAutorizada = ...; // valor constante return pendencias.stream() .map(TipoBlocCarga::getIdStatus) .anyMatch(idStatusPendencia ->…
-
8
votes2
answers338
viewsA: How to pass the value of a variable to uppercase or minuscule?
As I had mentioned in the comments, there is a shell expansion to do this: ${variable^^} will transform the text into variable high-cash. I’ll copy the examples of this answer in Stackoverflow…
bashanswered Jefferson Quesado 22,370 -
1
votes1
answer136
viewsA: How to change the version of mvnw from the command line?
Just invoke the maven-wrapper-plugin. Got it from the tutorial by Baeldung the following line: $ mvn -N io.takari:maven:wrapper -Dmaven=3.5.2 .... [INFO] --- maven:0.7.6:wrapper (default-cli) @…
-
1
votes1
answer136
viewsQ: How to change the version of mvnw from the command line?
I need to change the version of mvnw to the 3.5.0 or higher. I am using a maven-wrapper inherited from another project (copied and pasted), but it is in the version 3.3.9. How to make this change in…
-
2
votes1
answer153
viewsA: Project Maven Muti-module, how to control which artifacts Gitlab-CI should deploy?
Just put the plugin exists. When I started my search for this, my first idea would be to solve it through shell script itself. I would get the version through the help:evaluate, put it in a variable…
-
2
votes1
answer55
viewsQ: Is it possible to do two different variable expansions in a single expansion?
I have a variable, in array, $CLI_MODE. I fill it with a simple read: read -a CLI_MODE I would like to take the value of the first tiny element and, if possible, swap - for _. To get everything tiny…
bashasked Jefferson Quesado 22,370 -
4
votes1
answer121
viewsA: How, using git in Windows, indicate that the file is allowed to run in Unix environments?
To list a file with a different mode, use the git update-index, with the option --chmod=+x. I had to do it to make a Bash script hbm.sh executable: $ git update-index --chmod=+x hbm.sh $ git status…
-
0
votes1
answer153
viewsQ: Project Maven Muti-module, how to control which artifacts Gitlab-CI should deploy?
I have a multi-module Maven project in Gitlab. The structure is about the following: /pom.xml --> reator /cooker/ /cooker/pom.xml --> biblioteca principal /security-clean/…
-
4
votes1
answer121
viewsQ: How, using git in Windows, indicate that the file is allowed to run in Unix environments?
I’m using git in development, and I’m willing to put the project gradle to be executed in the IC. To execute the gradle, just give a ./gradlew to start the process. However, when calling this in my…
-
3
votes5
answers2164
viewsA: Square root manually in Javascript
There is a fast square root approach through a linear equation: L(x) = f(a) + f'(a)*(x-a) For a given value a where the function has a known value and f'(_) being the derivative of the function. By…
-
5
votes1
answer88
viewsA: Can qubit be represented in Boolean?
While electrons or photons are often used to represent qubits, I prefer to use another fundamental particle of nature. The cat. Let’s take, then, a 3 qubits cat system. Each cat, in order to…
-
0
votes1
answer608
viewsA: Calculation between Rows and Columns Different SQL SERVER
I didn’t do it the smartest way in the world, and it can even perform poorly for large data loads. I am taking into account that each line is numbered only in a growing way (not that this is a big…
-
4
votes2
answers110
viewsA: What’s the difference of foreach(function) and foreach(function())? Why does the first work and the second does not?
There is the possibility of using heroes.forEach(dotinha()) and be something useful! Only, for this, it is necessary that the function dotinha return a function. Below an example of play: const…
javascriptanswered Jefferson Quesado 22,370 -
3
votes1
answer56
viewsA: Miscalculation of rest of division
In general, it is all a consequence of understanding this question and its consequences. Amazingly, unless you have a proper numerical system, when using a comma number, you will be using a binary…
divisionanswered Jefferson Quesado 22,370 -
1
votes1
answer136
viewsA: Sensor values accelerometer to decimal degrees
Note: I’m not an Android programmer, so I’m answering this only with the concepts of physics and mathematics acquired over the years. Perhaps it would be appropriate to look at official…
-
3
votes0
answers104
viewsQ: How to proceed to implement a Preparedstatement on Android?
We are using the Sqldroid to work as a JDBC driver for Android. However, Sqldroid is an envelope for Android API calls, and this API does not deal well with nulls. So, for us to use…
-
2
votes2
answers1920
viewsA: How to modify commits that were not pushed
If you want to make a change to last commit, keeping all others unchanged, you can make one git commit --amend. The amend (in Portuguese seria traduzido para "melhorar" ou "emendar" according to…
-
4
votes1
answer89
viewsA: What is a loose object?
tl;dr A "loose" object is stored is, without being "tied" to another to define itself. It is "loose" within the repository. A primary information file. I couldn’t find the information direct on the…
gitanswered Jefferson Quesado 22,370 -
7
votes2
answers125
viewsA: Merge two features
You are in a development stream called Feature-branch workflow. It’s good to know these names because so you can search for more specialized things on Google. I really like Atlassian’s description…
gitanswered Jefferson Quesado 22,370 -
2
votes2
answers250
viewsA: How to validate elements produced during a Java Stream before Collect?
Taking the second solution from reply by @Scarabelo, but adapting to something more suitable. What is desired is not to make a filter, but a bizoiada (word from neoclassical cearencês). This look is…
-
6
votes1
answer64
viewsQ: How does the creation of a proxy work under the table?
I’ve had a lot of fun creating interface proxies in Java. For example, the following proxy was required on Sqldroid to run version 5.2.4 of Flyway (and also to catch the path of the file created by…
-
11
votes1
answer118
viewsQ: What are "bridge" methods in Java?
I recently had a problem with methods bridge, what occasional in an excellent answer by Victor Stafusa. But now I realize I don’t know why that method bridge have been created, nor what it means to…
-
9
votes2
answers710
viewsQ: Select "maximum" elements given a certain criterion in a "stream"
I have a collection of elements that I’m going through in a stream. Suppose it is to take the highest value element (integer) given a classification (string). This class is enough to exemplify my…