Most voted questions
150,413 questions
Sort by count of
-
8
votes1
answer1608
viewsHow to apply the IF ELSE condition to selecting a column?
In Mysql, I have an old table entities where the column gender is in the format ENUM, containing values of the type: "i", "m", "f". When migrating this data to the new structure of this table, I…
-
8
votes3
answers20561
viewsHow to create functions in jQuery?
I would like to know the correct way, following good practices, to create functions in jQuery. I’ve used it like this: var focusToEnd = function() { ... } And also so: ; (function($) {…
-
8
votes5
answers1837
viewsHow to create a configuration file in Laravel 4?
I would like to know how to create, import and use new configuration files in an Laravel 4 project. By that, I mean, project files and own settings. For example: I would like to create a file that…
-
8
votes2
answers2353
viewsHow to get the integer value of one of the constants of an Enum?
I have an Enum (enumeration) calling Notas and need to obtain the integer corresponding to one of its constants. public enum Nota { Otimo = 5, MuitoBom = 4, Bom = 3, Regular = 2, Ruim = 1,…
-
8
votes3
answers3242
viewsHow to get the last date of a day of the week in a given month in SQL Server?
Using the T-SQL language of SQL Server, how to get, for example, the latest wednesday of the month of May of a given year?
-
8
votes2
answers650
viewsHow to use Packages in Laravel 4?
I am new to the Laravel 4 framework. In Laravel 3 it was simple to use Bundles. In version 4 the use of the Bundles was removed and started to use Packages, but I didn’t understand how it is used,…
-
8
votes4
answers265
viewsHow to set --no-ri --no-rdoc as default when using Gem install?
Always when giving Gem install I have to provide the parameters --no-ri and --no-rdoc, I would like this to be standard for this command! How can I do that?
-
8
votes3
answers2543
viewsUnit test with database
I have an application that uses JPA 2 with Hibernate behind and for unit testing, I use HSQLDB in memory with Junit 4.11. HSQLDB is configured in a persistence.xml file in a META-INF folder. My…
-
8
votes3
answers424
viewsServer.Mappath fails within Global.asax
In the code below, when I try to call the Mappath function inside Global.asax, an error occurs at runtime with the following error message: System.Web.Httpexception (0 80004005): Request is not…
-
8
votes4
answers2543
viewsInsert paragraphs from a JSON file into a DIV
I have a file json that in its contents it contains paragraphs. These paragraphs are separated by \n but when I insert the content the paragraphs are not separated and instead of line break I have a…
-
8
votes2
answers419
viewsHow do Nginx provide pre-compressed content?
I’ve already enabled the module Httpgzipstaticmodule, and defined the variable gzip_static on; But in the response headers of a GET request does not appear Content-Encoding gzip…
-
8
votes1
answer13268
viewsHow to create a JOB on Oracle?
I have the command below to perform the analysis of Oracle indexes: EXEC DBMS_STATS.GATHER_SCHEMA_STATS('USUARIO', estimate_percent=> 25); I would like to know how to schedule this command so…
-
7
votes1
answer65
viewsA client class that registers clients in itself would be a cohesive class?
Studying cohesion. Since a cohesive class is one that has unique responsibility, it would make sense for the class Cliente own these methods? If we think in the real world, a customer cannot…
-
7
votes2
answers80
viewsHow to understand mapping (map) of functions list in Python?
lista = [0, 1, 2, 3, 4] def square(y): return (y**2) def cube(y): return (y**3) funcs = [square, cube] for i in lista: valor = map(lambda x: x(i), funcs) print(list((valor))) Exit: [0, 0] [1, 1] [4,…
-
7
votes2
answers198
viewsHow to capture the last three digits of a number in Javascript?
Is there any Javascript function that captures from the last character? For example: var n = 200100; I want to get only the 3 numbers from the last character. In the example above, I would give 100.…
javascriptasked 3 years, 2 months ago Zed 73 -
7
votes1
answer198
viewsHow to put emoji in a string?
I know that in a string I can put any characters you want, ex: string = "qualquer coisa! @#$%ª太陽" But what if I want to put one emoji in a string, how do I? Has any specific way? Can I put it right…
-
7
votes2
answers141
viewsHow to Split by Capital Letters and Numbers at the same time?
How can I separate a string by letters and numbers at the same time? For example if I have strings: composto1 = 'H2SO4' composto2 = 'CaCO2' composto3 = 'C20H17' I’ve tried to do: import re…
-
7
votes1
answer72
viewsUse the anonymous typedef or not?
I was looking at some C codes and I came across something like this: Example: typedef struct { char nome[256]; } Pessoa; typedef struct Pessoa { char nome[256]; } Pessoa; There is some difference…
-
7
votes1
answer102
viewsWhat is the difference between a global variable and a global variable Static?
What is the difference between a global variable and a static global variable? Example: #include <stdio.h> int numero = 5; static int static_numero = 5; int main(void) { printf("numero: %d…
-
7
votes2
answers217
viewsWhat is the Mint language?
When dealing with Javascript frameworks we realize that there are a multitude of options, with new ones popping up all the time. Angular, Vue, React, Svelte, Stencil and others I can’t even…
-
7
votes2
answers87
viewsWhat is the relationship between unhashable and mutable?
I always use strings as keys in dictionaries, but, studying the theme, I noticed that it is possible to use any immutable object. So, in addition to strings, dictionaries accept as keys objects such…
-
7
votes1
answer126
viewsHow to change the color when drawing a line segment that belongs to a circle?
I’m trying to draw in an image 400 × 400. The first drawing is a line defined by the equation ax + by + c = 0. When to replace x and y and the result is 0 the point belongs to straight, then change…
-
7
votes0
answers56
viewsWhy is the color GREY darker than DARKGREY?
When we use keywords to define a CSS property, we can choose colors by name. What often irritates me is that the color Grey/Gray is noticeably darker than the color Darkgrey/darkgray, which makes no…
cssasked 3 years, 8 months ago Felipe Carriel 182 -
7
votes3
answers85
views -
7
votes5
answers287
viewsHow to go through an array of objects, add specific properties and unify those objects where it has a specific property equal to another?
I have an array of objects that have this structure below: listaProdutos = [ {nome:'Teclado',preco:28.00}, {nome:'Mouse',preco:36.00}, {nome:'Monitor',preco:500.00}, {nome:'CPU',preco:800.00},…
javascriptasked 3 years, 8 months ago Gato de Schrödinger 2,367 -
7
votes1
answer86
viewsHow does async/await work in Rust?
The idea of async/await has become common in several languages (C#, Javascript etc). It seems that Rust recently (in the 2018 edition of Rust) adopted the idea of async/await, together with the…
-
7
votes3
answers274
viewsHow to manipulate the DOM of a page before it finishes loading?
I am making a Lazy Loader in pure javascript, currently I put my embed script at the end of the HTML that identifies the images and, if they are not ready (for example loaded from the cache), this…
-
7
votes1
answer102
viewsWhat are the differences between Decorators and Attributes?
I asked a question recently about the use of attributes that was introduced in PHP 8. Attributes to me end up not sounding like novelty, because I remember seeing something like that when I worked…
-
7
votes1
answer528
viewsWhat does "?" interrogation mean in accessing the properties of an object?
I have already used ternary operators to carry out this type of verification: route.params.userUpdated ? route.params.userUpdated : undefined; But I’ve never seen anything like it:…
-
7
votes1
answer118
viewsHow to adapt a function that only accepts callback to the promise interface in Javascript?
I’m using an external library function to acquire the token of a user, it is the following: export default function GetGraphToken( email: string, password: string, callback: (graphClient: Client,…
javascript typescript asynchronous promises callbackasked 3 years, 10 months ago Matheus Wallace 73 -
7
votes3
answers229
viewsHas Javascript changed its rules about what is false or true?
It occurred to me in the part about booleans, the following problem. I have this variable: var name = "10kg" / 10; if (name) { console.log(name); } else { console.log("Not exist"); } The same should…
-
7
votes2
answers641
viewsWhen "Return" is different from "Return await" in an asynchronous function in Javascript?
I was doing a review of MR and saw a test similar to this: it('...', async () => { return await new Promise((resolve, reject) => { request(app.getHttpServer()) .get('...') .send({ /* ... */ })…
-
7
votes2
answers191
viewsWhat are the main differences between prototype-oriented programming and class-oriented programming?
After learning a little more about Javascript, I realized that even though I have a building class, classes (in fact, as in C# or Java) do not exist in Javascript. This is nothing more than…
oop classes characteristic-language language-independent prototypeasked 3 years, 11 months ago Luiz Felipe 32,886 -
7
votes1
answer88
viewsWhat are Core Web Vitals and how do they work, should I worry about them?
I saw recently that Google will consider the reports of Web Vitals (Lighthouse and Search Console) as a factor of rankings, because these factors can directly interfere with the user’s experience…
-
7
votes2
answers241
viewsIs there a difference between Number and parseFloat?
When I need to turn a string into a number in Javascript, I can use both the object Number as the function parseFloat. Example: var numero = "1.5"; console.log(Number(numero));…
-
7
votes1
answer135
viewsWhat is Task-Driven User Interface?
What is Task-Driven User Interface? Is it the same as Task-Based User Interface? What are the advantages over CRUD?
-
7
votes1
answer113
viewsIs there a difference between using discard or ignoring the value returned by a method?
I have a method similar to the below: public bool FazerAlgoERetornarSeSucesso() => true; And at some point, I need to call this method, but I don’t care about the result. Normally I would do…
-
7
votes4
answers798
viewsSearch id in object array with Javascript
Hello, I have the following object array: [ { "id": 97, "name": "Jon", "technologies": [ { "id": 6, "name": "React" }, { "id": 7, "name": "Messageria" } ] }, { "id": 98, "name": "Doe",…
javascriptasked 4 years, 1 month ago Fred 499 -
7
votes2
answers165
viewsWhat is the purpose of ? (question mark) in calling a function?
I’m studying the module Enum of the Elixir language in which it provides various functions that allows working with enumerables, However, one thing caught my attention in the call of some of the…
-
7
votes2
answers611
viewsWhat is the purpose of using UUID (version 4) as "Primary key"?
I have noticed that some places have switched the ID (generated by autoincroment, depending on SGDB) by UUID, usually use version 4 of UUID which is based on a pseudo-random system, the question is…
database entity-framework laravel-eloquent uuidasked 4 years, 2 months ago Guilherme Nascimento 98,651 -
7
votes1
answer295
viewsDifference between using Generics and "any" in Typescript?
When I know it’s better to use Generics or any in Typescript?
-
7
votes1
answer57
viewsTake more than one element from an Array
I wonder how I get 2 elements of an array at once. numeros = [1, 2, 3] let primeiros = numeros[1] but I need to take the first 2 values, and I haven’t found how to do. I need something like: let…
javascriptasked 4 years, 3 months ago Anderson 73 -
7
votes3
answers1292
viewsHow to loop 'for' in 1 line?
The following code did not work: rank = [1, 2, 3, 4] print(rank[c] for c in range(4)) If you can make use of for in a row would like to know.
-
7
votes3
answers263
viewsWhat would be something "native"?
I’ve read many posts and articles talking that one language, framework, editor or anything else is "native". So my question is: What is something native? Is that good or bad? There are advantages…
-
7
votes2
answers195
viewsQuestion about entering items in a list with indexes inside Python brackets
You can insert items into a list using methods such as, append(), extend(), or insert(). But it is also possible to insert through indexes in square brackets, normally used to replace items and not…
-
7
votes1
answer1248
viewsWhat is Microsoft’s MAUI?
I read that Microsoft’s MAUI is an evolution of Xamarin.Forms. I would like to know: What changes from the old version to this? What platforms are supported? How the migration between Xamarin.Forms…
-
7
votes1
answer114
viewsIs every anonymous function a closure?
Every anonymous function is considered a closure or only those that refer to the context where they were created are? I wish I knew that to distinguish them correctly. I know the concepts and the…
-
7
votes1
answer480
viewsSleepy barber problem with traffic lights
I found this code online while studying and I couldn’t understand two things: What the traffic light "seatbelt" does? Why isn’t the barber checking the waiting room after finishing a cut? (It goes…
-
7
votes1
answer85
viewsHow is it possible for the same memory address to have 2 different values at the same time?
I had a question about the behavior of the type qualifier const of the C++. I was testing how much a variable declared as a constant is protected from changes. For this I tried to change its value…
-
7
votes1
answer850
viewsHow does the "infer" of Typescript work?
I know it was introduced in language version 2.8 (see here), but even though I read these release notes, I still can’t understand the workings of infer. How it works? What is your real goal?…