Most voted questions
150,413 questions
Sort by count of
-
5
votes1
answer244
viewsHow can I detect and alert that a particular user is sending many messages in a row?
In a chat room, how can I detect and alert that a certain system user is sending many messages in a row (Flood)?
-
5
votes3
answers2176
viewsCommand to replace characters recursively
I need a command that overwrites a specific pattern on each line of a file as many times as necessary until the pattern is no longer found. For example, in a CSV file, fields are separated by a…
-
5
votes1
answer191
viewsSimulate another environment by using the `Composer update`command
I have a project Symfony2 with facilities managed by composer, with their respective files composer.json and composer.lock synchronized between my local machine and the production server via git. It…
-
5
votes2
answers1709
viewsHow do I implement the Groupby method in Typescript?
I have an array: interface IFoo { IDCidade: number; Nome: string } var arr = [ { IDCidade: 10, Nome: "Foo" }, { IDCidade: 10, Nome: "Bar" }, { IDCidade: 20, Nome: "Foo" }, { IDCidade: 20, Nome:…
-
5
votes1
answer4590
viewsHow to resize graphics in Ipython Notebook without loss of quality?
In Ipython Notebook I produce graphics with (for example): x = [1,2,3,4] y = [5,6,7,8] plot(x, y) When I place the cursor over the generated graph, the tool appears at the bottom right corner to…
-
5
votes3
answers227
viewsIs there a dialect of LISP/Logo in Portuguese?
For children programming with English words can get in the way a little to understand well what everything is and does. I grew up with Superlogo in Dutch. There are things like this in English?…
-
5
votes1
answer3774
viewsHow to restart Openfire settings?
I am working on a project that uses an XMPP server. I am using Openfire to build a development and testing environment. After starting it for the first time it offers a step by step to configure it.…
-
5
votes2
answers326
viewsUse of uncharted entities in Symfony2
I read that normally the Entity folder of a Bundle stores the entities that will be persisted (in my case, by Doctrine) in the database. But, due to the ease of working with validations in the…
-
5
votes1
answer1706
viewsWorking with SVG files dynamically
I am developing a web page where I use numerous effects in CSS. among one of them I realized that I can not ultilizar the filters in Firefox. Searching the internet I found some solutions that tell…
-
5
votes2
answers961
viewsHow to redirect from non-www to www?
I want my website visitors to always access with www. I want to somehow redirect in case the user tries to enter without www or Ubdomain. If you try to access exemplo.com I want to redirect to…
-
5
votes4
answers2572
viewsExpandable menu CSS transitions
Having an expandable menu like using the CSS transition to open/close at the same time the part that is open and the part that is closing? The problem does not arise if the menus are the same size…
-
5
votes2
answers365
viewsHow to view a Youtube video in a Panel in Extjs?
Would you like to display a Youtube video in a Panel on Extjs. Would it be possible? Can someone give me a hint?
-
5
votes2
answers1264
viewsAccentuation of request parameter in JSF page
I have a JSF page that receives as a parameter, in the URL, the error message to be displayed. Ex.: http://example.com/application_error.jsf?exception=Não+permitido On the page, the parameter is…
-
4
votes1
answer33
viewsjquery"Animate()" is not working
I want to use "Animate()" to pass feedback to the user after a click, but the animation is not happening. I used css to determine what would be the final state of the animation and there, it worked,…
-
4
votes3
answers100
viewsWhat are the advantages of using a database instead of a JSON file to write data?
Most systems currently use the database feature to record the most diverse types of information, even static information. This leads to the conclusion that a database brings significant…
database modeling software-engineering software-architecture language-independentasked 3 years, 2 months ago user254120 -
4
votes3
answers109
viewsHow to compare arrays ignoring the order of the elements in Jest?
In a situation where I have two arrays, it is possible to use the expect of Jest for a comparison where I hope arrays are equal, regardless of the order of the elements? I searched, but found no…
-
4
votes1
answer52
viewsHow to use interpolation in declaring a property of a type?
I’m trying to declare a guy who accepts different properties with a number, for example: prop1, prop2 ... propN. The point is, I’m having a hard time getting it to behave the way I expected it to,…
typescriptasked 3 years, 2 months ago Rafael Tavares 4,528 -
4
votes1
answer38
viewsUse of delete in an abstract class pointer
Reading the book A tour of C++, in a section on memory leakage, when I came across 3 statements regarding the code below: The implementation of Smiley may fail to delete pointer to mouth. The…
-
4
votes3
answers117
viewsLimit HTML content in Divs and distribute in the following dynamically?
I’m trying to distribute the content HTML(texto,imagens etc) in DIVS dynamically, but I haven’t found anything related to this yet. Like picking up content from outside the DIV (overflow) and insert…
javascriptasked 3 years, 2 months ago André Cabral 811 -
4
votes1
answer27
viewsCombinatorics and Probability
When I combine for example 4 strings ["A","B","C","D"] 2 to 2, ie AB,AC,AD,BC... I can count on how many occurrences A and B appeared? My problem involves 16 items that combined 4 to 4 generate…
rasked 3 years, 2 months ago Fernando Malheiros 41 -
4
votes0
answers48
viewsIdentify 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…
-
4
votes1
answer49
viewsDoes the <Section> tag replace the <main>?
I’m starting to use HTML5 and still not sure how to choose between tags <main> and <section>. I see people using after the header <main>, while others already use the…
-
4
votes0
answers36
viewsWhat is "L" for before a string in C++?
I noticed that some frameworks and Engines require the string to be passed with L before the text. A Irrlicht Engine is an example. myObject->setLabel(L"my string"); What is the purpose of this L…
-
4
votes1
answer52
viewsDoes accessing a variable outside the scope of the class go against SOLID principles?
const clients = [{ username: "test" }]; class Validator { constructor(username){ this.username = username; } isUsernameTaken(username) { let usernames = []; clients.forEach((e) =>…
-
4
votes2
answers100
viewsSort two lists simultaneously, by notes in ascending order, then by name
I have created two lists, one of notes and one of names. The program must sort notes in ascending order, but it must sort names as well. I tested it as follows: notas = [5, 7, 9, 3] nomes =…
-
4
votes1
answer58
viewsHow do I make Typescript accept the "useRef" value in React?
export const Test = (): JSX.Element => { const wrapperRef = useRef(null); useEffect(() => { function handleClickOutside(event: MouseEvent) { if (wrapperRef.current &&…
-
4
votes1
answer49
viewsPython Any checks too many elements even returning a True option with the first
I’m having a question about how built-in any python: variavel = None any([not variavel, variavel.get("chave1"), variavel.get("chave2")]) The way I see it, if the first item on the list was True, the…
pythonasked 3 years, 4 months ago Mauro Martins Júnior 55 -
4
votes1
answer123
viewsWhat is the difference between the rest operator (%) in Python and Rust?
Writing a small program in Rust, I noticed that the operator results % are different from what I get in Python for negative numbers. For example, in Python -4 % 26 returns 22, but in Rust: fn main()…
-
4
votes2
answers94
viewsSpecial characters are not displayed by the console.log
I’m solving a school exercise and I need to print a string with special characters using console.log, however the \ contained in the string are removed when executing the code. In search of the…
-
4
votes1
answer56
viewsWhat are the differences between Traits (or Typeclasses) and Interfaces?
Studying Rust, I began to make use of the so-called traits that, according to the language book: We can use traits to define shared behavior in an abstract way. The same chapter further quotes the…
-
4
votes1
answer106
viewsWhat is the difference between align-items and align-content?
Is there any difference between the align-items and the align-content?
-
4
votes2
answers96
viewsA 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
answers64
viewsIs it possible to perform an overload (Overload) with Arrow functions?
I have a function where the return type depends on the parameter type. I was able to declare this overload with function, but not with Arrow Function, because I get the error: Cannot redeclare…
-
4
votes2
answers67
viewsIs 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…
oop characteristic-language software-engineering property language-independentasked 3 years, 4 months ago vinibrsl 19,711 -
4
votes1
answer81
viewsWhat 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…
-
4
votes2
answers92
viewsWhat term should I use in English for "dereference" a pointer
As you know in English the term Dereferencing is used to indicate access to the value stored at an address stored on a pointer i and..: int valor = 10; int *ptr = &valor; *ptr = 20; //…
-
4
votes0
answers40
viewsWhat are parser combinators?
Recently, studying on techniques of Parsing, found out about parser combinators, which seems to be a more functional approach to realize the parse of a sequence of characters. What is a parser…
-
4
votes1
answer77
viewsWhy does the Math.toRadians method return an inaccurate value?
I was programming a method in which I needed to convert a value from degrees to radians and I wondered if this conversion no longer existed in Java. Searching the Internet I discovered the method…
-
4
votes3
answers77
viewsGenerate multiple different arrays containing random numbers
I am developing a program and need to generate an array of 16 elements, in which each input is 0, 1 or 2; and then I need to check if this array meets certain conditions. To generate this array, I…
-
4
votes0
answers38
viewsIs there a more correct way to handle redirects in authentication streams? (e.g., HTTP Status 302, or Javascript, or auto-Ubmit form)
I work on a project where we have a Frontend application and a second Backend application (Nodejs) that takes care of authentication and contains a REST API. In the authentication part, Backend…
-
4
votes2
answers101
viewsInsert scale on y-axis for geom_line
I want to plot the columns analise1, analise2, analise3 in a single chart of lines but with different scales, because the width of the column analise1 is much larger than the other two columns. On…
-
4
votes1
answer74
viewsWhat is Clone-on-write (Cow)?
I’m studying Rust and recently discovered the existence of Cow, one smart-Pointer that works to make Clone-on-write. The description of the page seemed confusing to me, since I don’t have much…
-
4
votes1
answer60
viewsHow do I keep an original copy when using Sort in Javascript arrays?
I need to sort an array, but I can’t miss the original sequence. To do this, I created a new variable and assigned the value to it, making a copy of the original. However, when using the method…
-
4
votes1
answer71
viewsWhat is the difference between two code snippets with and without a constructor?
I’m having trouble understanding what a constructor does. Does it initialize a variable so it’s not null? If yes, this would not be solved easily by doing what is written in the second code snippet?…
-
4
votes2
answers71
viewsHow to define a dynamic named CSS property via Javascript?
I need to use the value of a string to change a CSS property of an element. I tried to do this, but it didn’t work: function funciona(nome, valor, id){ id.style.nome = valor; } function…
-
4
votes2
answers68
viewsAutomatic null value check versus types like "Option<T>"?
I recently started learning Rust and was introduced to the type Option<T>, representing, through a sum type, the presence or absence of a value (mutually exclusive possibilities). This same…
-
4
votes2
answers76
viewsWhy does Lua’s "print" print print extra spaces in the arguments?
I used the command print() concatenating a variable, but the output prints extra spaces. If I use the io.write(), this problem does not occur. Why this problem happens to the print()? Example: name…
-
4
votes2
answers114
viewsWhat is a daemon?
I know that "demon" comes from Latin daemon, but I believe that word has another meaning in the technological environment. What is a daemon? What do you eat? What’s the point?
nomenclatureasked 3 years, 6 months ago CypherPotato 9,292 -
4
votes1
answer124
viewsHow abstract are pointers in C?
I have a vision, which from time to time seems wrong, that C pointers are simply and literally memory addresses. In this case it starts from a misconception that memory was a linear thing and…
-
4
votes2
answers129
viewsHow to choose a random array element in Javascript?
I already know how shuffle an array, but how do I choose a random element of arrays? let arr = ['a', 'b', 'c']; How do I choose any element of arr?…