Posts by vinibrsl • 19,711 points
378 posts
-
5
votes1
answer39
viewsA: Logical error while removing repeated items from a list
The problem is that your code modifies the list within the for in. You can see this by placing a print inside the loop. >>> lista = [7,3,33,12,3,3,3,7,12,100] >>> for itens in…
-
4
votes2
answers96
viewsQ: A class is an instance?
Considering the example, one can say that p1 is an instance of Pessoa, which is the class: class Pessoa end p1 = Pessoa.new() # => #<Pessoa:0x00000001268ee528> However, it is not often said…
-
4
votes2
answers67
viewsQ: Is there practical application in write-only properties?
In object-oriented programming, a property is a member of a class that provides information about the object. That is, properties expose attributes. Properties can also be "write only". An example…
-
0
votes1
answer63
viewsA: How to extract a binary from a string?
If you need to "transform" "01000001" in <<"01000001">>, use the function list_to_binary/1. Take an example: erl(0)> Binary = list_to_binary("01000001"). <<"01000001">>…
-
3
votes1
answer63
viewsA: What are the differences between comparison operators in Erlang?
Operators == and /= are equity operators, who compare only the value. Operators =:= and =/= are identity operators, who compare type and value. To illustrate, =:= would be equivalent to === in…
-
4
votes1
answer81
viewsQ: What is list comprehension? Control structure? Loop?
Some languages have a way to create other lists without needing high-order functions like map and filter. This form is called list comprehension, or comprehensilist on. It is common to see list…
-
2
votes1
answer48
viewsA: What is "..." in Javascript?
This is the spread syntax, or spread syntax. It allows eternal objects, such as arrays, strings, and objects, to be expanded. Maybe in the question example it does not help to understand well, but…
javascriptanswered vinibrsl 19,711 -
1
votes1
answer58
viewsA: What are Fibers in Ruby and how to use them?
The Fiber is a class in the standard Ruby library that implements a cooperative, or preemptive, competition mechanism. It is worth remembering that although the context of the question is about…
-
3
votes2
answers75
viewsA: How to repeat a code snippet given times?
You started well, using a while loop. Missed adding condition to repeat code only the amount reported in variable gerar. There are a few ways to do this. The way I’ll show you is to subtract 1 from…
-
3
votes1
answer69
viewsA: Why are different types of quotes used in places as error messages?
Where to use? This severe accent pattern and simple quotes is not unique to error messages. See an example in a section of the bash: Brace expansions may be nested. The Results of each Expanded…
language-independentanswered vinibrsl 19,711 -
1
votes1
answer39
viewsA: What is different from Consign’s "include" and "then" methods?
Although the library uses a function called then, do not confuse with Promises. The then, in this context, executes the last executed function. See source code: Consign.prototype.then =…
-
1
votes1
answer39
viewsA: How to hide personal data on the front end
There is no way. Everything that moves between server and browser is visible by the user in some way. However, you can "hide" this key in two ways: Make the request for the external service in your…
-
1
votes2
answers36
viewsA: Why is an HTML element found only in "onload"?
Several actions occur when loading a page on the internet. HTML is downloaded, understood and rendered by the browser; images and style sheets are downloaded and rendered; etc. With Javascript you…
-
1
votes1
answer52
viewsA: How to use MYSQL with Case or IF
The UPDATE can be used with WHERE. UPDATE `_personagens` SET `treinos_restantes` = "XX" WHERE CURRENT_TIMESTAMP() >= `tempoVip`; UPDATE `_personagens` SET `treinos_restantes` = "XX" WHERE…
sql-updateanswered vinibrsl 19,711 -
1
votes1
answer21
viewsA: ERROR: Operand should countain 1 column(s) - CASE WHEN... THEN
The syntax of decimals is 0.5 and not 0,5. Change this in your query filters.
-
1
votes1
answer20
viewsA: Mysql KURDATE with month
You need the function MONTH on both sides. The same goes for function YEAR that you’re using. SELECT * FROM tabela WHERE MONTH(tabela.data) = MONTH(CURRENT_DATE()) AND YEAR(tabela.data) =…
-
3
votes2
answers51
viewsA: How to check if a character set exists in the table column?
To return all the people who have Silva anywhere in the text, use the operator LIKE. SELECT * FROM usuarios WHERE nome LIKE '%Silva%' Stay tuned for the performance cost of this operation.…
-
0
votes1
answer33
viewsA: How to concatenate two types of different values but of the same input into a list in python?
You can use the function split. An example: >>> "Marcelo 27".split() ['Marcelo', '27'] But note that if the name is double, as Marcos Vinicius, will not work as you expect, for it will…
-
0
votes2
answers75
viewsA: How to stop a for in Elixir?
Use the Membership Operator, or membership operator instead of for, which is a list understanding in Elixir. def a(list, p) do if p in list do IO.puts "Number #{p} belongs to the list" else IO.puts…
-
0
votes1
answer27
viewsA: Stop process in case of failure or invalid data
In the functional paradigm, by the concept of purism, you don’t use exceptions for flow control. That’s why many functions return a tuple {:ok, _} or {:error, _}, or simply :ok and :error. To check…
-
3
votes3
answers1090
viewsA: In programming, what is the actor model?
Actor model The actor model is a mathematical model of concurrent computing presented in 1973. The fundamental concept of the model is that everything is an actor, being it the most basic unit of…
-
0
votes2
answers61
viewsA: Manipulating lists in Elixir
The standard Elixir library is quite complete in this sense and has some modules for the operations you mentioned: List manipulation: Enum (nativo), List (nativo) Manipulation of JSON: Enum…
-
0
votes1
answer406
viewsA: Uncaught Typeerror: Cannot read Property 'value' of null // JS Error
You have to unblock the error. The exception is the type TypeError (MDN), than in Javascript. From the documentation: Typeerror is activated when an operator or argument passed to a function is…
-
3
votes2
answers165
viewsA: What is the purpose of ? (question mark) in calling a function?
The Elixir documentation itself talks about this in "Naming Conventions". Interrogation? The question mark in the Elixir indicates that the function returns a boolean. Note that not only in…
-
0
votes1
answer29
viewsA: GIT: Permission error in git merge
This is because in fact the files have the wrong permissions on some of the branches. Leave the permissions equal, commit and try the merge again. There’s also how to make Git ignore file mode, but…
-
0
votes1
answer51
viewsA: When I try to play my machine repository in the Google cloud repository I get an error saying : remote origin already exists
This is because there is already a remote with the name origin. You can simply swap the remote URL using: git remote set-url origin <sua-url> See also the documentation of git-remote.…
-
1
votes1
answer710
viewsA: Problems creating branchs -fatal: Not a Valid Object name: 'master'. ; bash: id: No such file or directory
Branch names cannot contain spaces. Instead of doing git checkout -b nome da branch, do git checkout -b nome-da-branch. Also make sure you have an updated version of Git.…
-
0
votes1
answer118
viewsA: How to make Cherry-pick from another git repository?
You can do this by adding the other Git repository as remote. git remote add projeto-b ~/projetos/projeto-b git fetch projeto-b git cherry-pick <commit1>..<commit2>…
-
0
votes1
answer46
viewsA: SQL-TRIGGER MAKING AUTO NUMBERING WRONG
A sequence, like auto increment, purposely skips the values if they have been deleted somewhere in time. For example: Criou o registro 13 Criou o registro 14 Deletou o registro 14 Criou o registro…
-
4
votes1
answer241
viewsQ: Should I ask for the user’s password twice at the time of registration?
In the registration forms, it is common to see the "Enter your password again" field, as a confirmation to make sure that the user has not missed the password entered. Thinking about the user…
-
1
votes2
answers61
viewsA: Is it still recommended to treat IE (Internet Explorer) in Crossbrowser tests?
Support the user, not the browser. It is a fact that most access today is via mobile (source). But you should primarily analyze the audience on your site. The audience is what matters. It’s expected…
-
0
votes1
answer74
viewsA: How to return all fields of an object in a Mutation in Graphql?
It is not possible to return all fields of an object implicitly. In Graphql you must be explicit with what you want your query to return. Whatever solution you have for this can be considered…
-
1
votes2
answers127
viewsA: How to access the console of an Elixir application?
You can spin iex -S mix at the root of the project to open a Elixir interactive shell (Iex) with the dependencies listed in Mix. Inside the shell you can interact with your ORM. If it is Ecto, for…
-
1
votes1
answer71
viewsA: Migrations are pending
The error you received indicates that there are migrations that your database has not yet applied. As you said, you had switched computers. The database is local and is not versioned by Git for…
-
0
votes1
answer423
viewsA: Grab mouse coordinates only when clicking on the screen
You can use the event click instead of mousemove. var lastClickPosition; document.addEventListener('click', storePosition, true); function storePosition(e) { lastClickPosition = { x: e.pageX, y:…
-
1
votes2
answers223
viewsA: How to convert an array to hash?
The return of a #map is an array. The structure you have is a hash array. Just access with the index: resultados = [{"eh5g4vs84ah84gsdf4a8va"=>"information"}] resultados[0] #=>…
-
9
votes1
answer156
viewsQ: What is Pattern matching in functional languages?
When reading about the functional paradigm, I realized that most languages have a common characteristic, the Pattern matching. Contextualizing for a programmer like me, accustomed to the…
-
1
votes1
answer364
viewsA: how to resolve Git public key permission error within VSCODE
Your SSH key has password and this is not supported by Visual Studio Code (and great majority of the other editors also not, including those of Jetbrains). One possible solution is to generate new…
-
0
votes2
answers62
viewsA: Are Google Compute Engine servers redundant by default?
It has redundancy, but not by default. See some techniques: Load Balancing With the GCP Load Balancer you can have its application in multiple regions. Deploy instances Across Multiple Regions using…
-
32
votes2
answers599
viewsA: Site made for seniors? Is there any good practice to build pages for seniors?
Initially it is interesting to separate the personas and accessibility problems to be addressed: Vision problems Cognitive problems Engine problems The three above problems are common in senility…
-
0
votes1
answer45
viewsA: Rails 5 belongs_to namespace
It is not common, in Rails, to put models inside modules, as you did in your models with the module Account. So Rails can’t find the association class automatically, so it only works by specifying a…
-
1
votes1
answer949
viewsA: How do I get every Gridview Card in flutter to open a specific link?
You need to associate the items of GridView with the items of an array. Assuming you have the following class: class Site { Site(this.name, this.url); String name; String url; } And the following…
-
10
votes2
answers73
viewsA: On the implementation of some() and Every()
The way he calls the method callback in the implementation may seem a little strange. It does all this by the way Javascript handles the context (this). And he does it so that the context is…
-
1
votes1
answer225
viewsA: Apply Inline Hover to another table in HTML
Unfortunately, CSS is not the only thing you can do, because there is no control over which row is in another table. You need a rule to establish that. In the example below, I reimplemented the CSS…
-
3
votes1
answer775
viewsA: How to have multiple languages in a single application?
There are multiple ways to do this, and the subject seems a little like micro frontends, but mobile and somewhat more complex. Native React or Native Flutter Both Flutter and React Native, which are…
-
5
votes3
answers187
viewsA: How do alternative language implementations work, such as Python in the JVM?
What is a programming language, after all? To understand this whole subject, you need to understand the concept of programming language. Whether BASIC, FORTRAN, Java, Ruby, C# or Crystal, a…
-
12
votes3
answers187
viewsQ: How do alternative language implementations work, such as Python in the JVM?
I always see people talking about implementations of X languages in another Y language. Like for example: Jruby, a Ruby implementation in Java Jython, an implementation of Python in Java Ironpython,…
-
0
votes3
answers132
viewsA: Read private method - Ruby
Access modifiers vary from language to language. In Ruby, private methods can be accessed by child classes.
-
2
votes1
answer84
viewsA: Website and database on the same machine, localhost or ip?
In theory, there is a difference. This is because 192.168.0.1, your local address, goes to the router to go to the server (which ironically, is the same client address). However, your operating…
-
1
votes1
answer462
viewsA: Save Image in Database
The database is good for dealing with dice, as tables with multiple columns and information. File systems are good to handle files, as images of various sizes and documents. Storing on a file server…