Posts by Jefferson Quesado • 22,370 points
421 posts
-
6
votes1
answer1086
viewsQ: Passing a list of arguments to a Jasper Reports query
I’m redoing some reports on Jasper Reports here at the company. I am migrating to have a reporting service agnostic the SQL query structure of the report. Before, the system knew deeply how such a…
-
5
votes1
answer1239
viewsA: What is an Adjacency Matrix?
What is the Adjacency Matrix? Roughly speaking, it is a directly accessed Boolean matrix. Given a graph with n vertices, the adjacency matrix is a Boolean matrix of n*n houses. If there are any…
-
3
votes1
answer509
viewsA: Calculate the Cartesian product with functional programming
In an approach that reminds me a little more the functional and the logic, we can think of list heads and list body. The old function CAR and CDR of Lisp see me head. The basic function of the…
-
2
votes2
answers209
viewsA: Repetitive snippets of HTML
Basically, this response is a disagreement about the reply from @Sveen. Same idea, only I don’t like this one API via code inclusion. Makes it difficult to maintain and, in my opinion, makes it more…
-
3
votes1
answer62
viewsQ: How to turn a number reading directly into a stream?
Recently I wrote a reply exploring a little more the API of stream of Java 8, but I must say I was disappointed with some details of my code. The idea was to read a sequence of numbers and then…
-
1
votes2
answers1681
viewsA: Recursive even numbers in C++
As I said in comment, its basic value is 0. The recursive result is 0 + return of the next recursive step. So you can’t get out of 0. You can do as many recursive steps as you want, it will always…
-
7
votes1
answer121
viewsQ: What is the "slicing phenomenon" when trying to read data from a heterogeneous array?
I was curiously reading a reply on how to store heterogeneous types in an array when I come across the following response snippet: You will have to store in each element of the vector the object and…
-
4
votes1
answer2832
viewsA: Higher and lower value
What happened in your wrong code? You set bad initial values. Note that in the statement it has not been defined that the numbers will be strictly positive. The following entry would give the wrong…
javaanswered Jefferson Quesado 22,370 -
5
votes3
answers4373
viewsA: If H = 1 + ½ +1/3 + ¼ + ... + 1/N, make an algorithm to calculate H, where N is typed by the user
Floating point numbers are mythological beasts of wandering behavior. Or at least they are so if you do not know how to tame them before using them. Using floating points, I can add up 3 numbers in…
javaanswered Jefferson Quesado 22,370 -
19
votes2
answers288
viewsQ: What is a "dangling Object/commit" in git?
My repository has momentarily corrupted after the yesterday’s blackout in Brazil. I managed to heal the corruption (thus) and decided to run a git fsck to check the status of my local repository.…
-
36
votes2
answers727
viewsQ: "OMG! A heisenbug!" - Explaining to a layman what a heisenbug is
A Heisenbug is a bug that changes its behavior while being studied [1]. It has its name derived due to the principle that Heisenberg detected that simple "passive observation"* of quantum processes…
-
1
votes3
answers654
viewsA: How to separate a number into two
This particular case can be worked with strings. I don’t really like the floating point alternative to make a response due to the problem with floating points. So, how to solve the problem? Well,…
javaanswered Jefferson Quesado 22,370 -
23
votes1
answer583
viewsQ: What is the complexity class NPI?
Studying complexity, I came across the term NPI. It means NP-intermediate. But I didn’t understand what this "intermediary is". What characterizes an NPI problem? Why does it have that name? There…
-
2
votes3
answers4592
viewsA: How to do exponentiation using multiplication in Portugol as arithmetic operation?
You want to do the exponentiation of two numbers natural? Luckily, I already have dealt with a problem recently which involved calculating the exponential of two real numbers. For this, I needed the…
-
53
votes4
answers2561
viewsQ: What’s wrong with gluttonous philosophers?
When it comes to concurrent programming, they always mention 3 classic problems/competition models: producers and consumers readers and writers glutton philosophers (or dinner of philosophers) I…
-
3
votes4
answers320
viewsA: Flatten lists. Is a more concise solution possible?
The current responses "leave shallow" lists of lists. In this case, leaving shallow is all in the same depth. Objects that were previously at a depth of 2 lists are at the depth of a list only. What…
-
4
votes3
answers167
viewsA: Doubt about C pointers
There is a little confusion among operators here. But first, I need to talk about what is a variable. According to the author of the book Concepts of Programming Lingaugens Robert Sebesta, a…
-
13
votes3
answers971
viewsA: How to find "Happy Numbers" within an interval?
As the function to know whether a number is happy or not is a pure function, we can use on her memoisation. A very easy way to do memoization is with recursion. Note that the very definition of…
-
3
votes1
answer456
viewsA: Maven - How to add a directory to build?
The Maven already provides a default structure for you by non-code resource files. The location for this is in src/main/resources/ for production code and src/test/resources/ for testing. Maven will…
-
23
votes2
answers1231
viewsA: Can the operators ==, ==, != and !== be considered as "fuzzy logic"?
It is not a fuzzy logic operator per se. Not strongly. But it can be considered a boolean operator, so in a way would also be fuzzy. So for the question "is it a fuzzy logic operator?" I answer…
operatorsanswered Jefferson Quesado 22,370 -
1
votes3
answers259
viewsA: Problem with recursive function, 2 parameters
I’m gonna go through some things that are going on with your code: #include <stdio.h> #include <stdlib.h> #include <locale.h> int potencia(int i, int j) { return (j > 0) ? 1 :…
-
14
votes1
answer1927
viewsA: What and what are the types of development environment?
Usually you find at least 2 development environments: development producing Depending on the creativity and bureaucracy involved in the process, you can have other environments: development test (*)…
-
3
votes1
answer415
viewsQ: What are "Stages" and "Jobs" in the context of Gitlabci?
Seeing here the option of put the IC in Gitlab (https://docs.gitlab.com/ee/ci/README.html). I was in doubt about the nomenclature they use. They say it all goes in one pipeline…
-
4
votes1
answer415
viewsA: What are "Stages" and "Jobs" in the context of Gitlabci?
Stages are, shall we say, general "labels". A stage only begins when the previous stage ends. Within a single stage, however, several Jobs can be executed in parallel. Take, for example, the…
-
7
votes1
answer641
viewsA: Calculate integral trapezoid mode
In particular, I found it very odd what you did to calculate the integral in the manner of the trapezoids. You don’t have a lot of secrets from doing the whole thing with that method. The only thing…
-
18
votes1
answer380
viewsQ: Traits and mixins, what are they? When should I use them? Are there similar mechanisms in other languages?
I was curiously researching about trait here at Sopt and I realized that she is almost always associated with php. But unfortunately the research did not yield me a definitive answer to the concept…
-
3
votes1
answer353
viewsQ: Can I set up Gitlab-CI to only run a particular job with a branch name Pattern?
I’m using Gitlab for code evolution management. It’s all quiet about it. Usage merge-requests to review code changes. I also generally use the Gitflow, only using the name rc-* for launch branches…
-
7
votes2
answers1864
viewsA: Junit 5 - How to run a test method only if another test method passes?
You should think that in your calculator example you described 4 tests. Reasonable to think so, right? Even Junit will say that. But you only had one test. Writing test cases Every test case should…
-
4
votes2
answers1245
viewsA: What is Operational Research in the Context of Computing?
Formally, operational research is the search for a point in the domain of a function in order to minimize its value. Problems of maximizing a function f(x) can be treated as minimizing function g(x)…
-
4
votes2
answers297
viewsA: Can I have performance problems joining multiple classes to a single file?
The overview of reply from @Pagotti is right if done right. However, your classes are not static. If it is not static, it is instance. Do you know what happens when something is instance? It needs…
-
9
votes2
answers2973
viewsA: What’s the difference between socket and port?
The purpose of this post is to clarify the nomenclature and provide a metaphor to facilitate understanding. For something more formally correct, see the reply from @jsbueno First of all, let’s…
-
7
votes1
answer5110
viewsQ: What is Flyway and when to use it?
The system recently drew attention to this issue, and it talks about Flyway. So I’d like to know: what is Flyway? what problems he proposes to remedy? when to use it? what are the competing…
-
2
votes3
answers13060
viewsA: How to add all the numbers in the sequence in while?
How about including at design level the loop, but not at code level? Well, your question is clearly mathematical. As such, it could be solved mathematically. You have the numbers 1, 2, 3..., n, for…
-
34
votes2
answers2825
viewsA: What is a Turing stop problem?
The halting problem is usually provided as follows: Given a program and an input it accepts, will this program give me an answer? IE, it will at some point stop its execution? Note: I have all the…
-
13
votes3
answers651
viewsA: Problem of stopping can be solved in practice?
In fact, your solution can’t handle simple cases. For, any program that alters its state without going back is not detected as a possible cause of infinite loop. Imagine the following program in…
computer-theoryanswered Jefferson Quesado 22,370 -
11
votes2
answers1556
viewsA: Regular expression 6 decimal places
Agreeing with all the caveats that a validation via regular expression is not the way, we can ramble on the subject. It doesn’t hurt to remember, just because you can does not mean that must do.…
regexanswered Jefferson Quesado 22,370 -
7
votes2
answers1059
viewsA: How important is the branch in versioning?
By itself, branches are not versioning tools. I’ll come back to that later. Within a development process, you can use branches to isolate development. This allows you to change a code base without…
-
4
votes2
answers130
viewsA: How to store an operator?
Alternatively you could use Windows for this. The idea would be to basically implement the library operators that the @Andersoncarloswoss mentioned in his reply. The advantage of using Leds would be…
-
3
votes1
answer553
viewsA: Is there a better way to build a graph?
As I had commented, I made a map-based Java graph montage scheme, as long as each node had a key to identify it. Your case is slightly different, because each node here has several keys that…
-
2
votes0
answers35
viewsQ: Read command gets lost when using arrows in Mingw
I need to read a command line information. Here at work we use the Mingw that comes shipped on Sourcetree. For such a need, I tried to use the function built-in of bash read, but it does not behave…
bashasked Jefferson Quesado 22,370 -
3
votes3
answers10963
viewsA: Configure git to existing project folder
Alternatively, you can start a repository or repository locally with git init. After doing this, I recommend that you do the commits locally, even to avoid losing work case give some problem or you…
gitanswered Jefferson Quesado 22,370 -
13
votes4
answers2933
viewsA: Difference between operators && e ||
My searching for an answer to that question was fruitless, I should be using the wrong words. So, there goes an answer These operators you refer to are Boolean operators. This means that they…
-
4
votes1
answer187
viewsA: How to identify an invalid graph for operator allocation problem per machine?
As perceived by users in Mathexchange, my problem is the detection of an interval graph. Particularly I could not understand the algorithms available on the internet on the subject. So? I invented…
-
17
votes5
answers625
viewsQ: Allow or not allow end spaces in passwords?
The @dvd answered about password validation in Javascript. In his reply, he suggested removing spaces from the ends when validating the size: It is interesting [to validate the password size] also,…
-
12
votes2
answers1725
viewsA: How to increase number to fractional power?
You don’t want to use the math library and the method pow? Well, let’s go to the raw definition. The @Phelipe commented about a source very interesting how to calculate potentiation. Let’s go to the…
-
2
votes1
answer233
viewsQ: How to create, access and manipulate associative arrays?
I am using GNU-Bash on my Mingw terminal (bash --version: GNU bash, version 4.4.12(1)-release (i686-pc-msys)). I need to create a data dictionary to check if a new key has been found and associate…
bashasked Jefferson Quesado 22,370 -
3
votes2
answers75
viewsA: Syntax error no for?
First of all... Documentation. Thank you @Krismorte for documentation comment Understanding what has happened The error is in the use of for. The for consists of 3 fields (optional): initial…
-
3
votes1
answer181
viewsA: Order Growth
As you yourself suspected, the second iteration affects the third iteration. Being more specific, for all j amid [1, N], the third iteration will be repeated around N/j times. Already the first…
canswered Jefferson Quesado 22,370 -
3
votes2
answers3844
viewsA: How to delete commits from gitlab
You can try rewriting your history with git reset and then give a git push --force. I’d rather do the reset from the gitk: So you can do the reset to any point in your history. To propagate this,…
-
1
votes2
answers65
viewsA: Why can’t variables from the same instance be read in different processes? (Python)
All this is due to the parallelism model used. In that reply I talked about Java, but the foundation applies to most modern operating systems. When you order to make a new process, you are making a…