Posts by Jéf Bueno • 67,331 points
1,254 posts
-
25
votes8
answers4394
viewsA: How to identify "Capicua" numbers that have 5 digits?
Basically it is necessary to reverse the number and check if it is equal to the original input. This implementation works for numbers with any number of digits. Implementation in C#: using static…
-
3
votes2
answers1560
viewsA: How to know which tab is selected
Solution without jQuery - which turns out to be useless since AP uses bootstrap and the same needs jQuery to work. I am posting at the request of the same AP.…
-
4
votes1
answer502
viewsA: Service is not being called to update the database
It turns out that you are using the definition of routes by attributes and in this way you need to define the complete route service (this includes the api/). You can use the attribute RoutePrefix…
-
2
votes1
answer186
viewsA: (CS0029) convert a List into Observablecollection || Sqlite
Just create a new instance of ObservableCollection passing the list as parameter. public ObservableCollection<Tarefa> GetTarefas() { return new…
-
10
votes2
answers245
viewsA: How to fire multiple exceptions?
This seems to me a conceptual error in the code. Apparently you are using exceptions to treat validations and this is not only wrong as it is very bad, it is an extreme misuse of the exception…
-
3
votes1
answer2545
viewsA: How do I move the mouse over a particular div when another element appears?
I think description of your problem is wrong. Anyway, just use the method show() of jQuery within an event of mouseOver. $('.visivel').on('mouseover', function() { $('.invisivel').show(); });…
-
3
votes1
answer42
viewsA: Pass Parameter with VBS Double Apas
With double quotes, this will escape the quotes and generate the value as "args.ext". Atalho.Arguments = """args.ext"""
-
24
votes3
answers2716
viewsQ: How to prove the asymptotic order of an algorithm?
Considering an algorithm like the one below: function somaMatriz(matA, size) { let soma = 0; // 1 for(let i = 0; i < size; i++){ // n + 1 for(let j = 0; j < size; j++){ // n(n + 1) soma +=…
-
1
votes2
answers447
viewsA: Formatting numbers is not working
Just for the record, what you’re doing is a huge mess, and based on that, you might say your problems aren’t going to end here. The correct thing should be to solve the problem at the beginning and…
-
0
votes1
answer387
viewsA: How to make a Datagridbview column invisible to the user
With what you have so far, what you can do is change the visibility of the column after you fill the grid Something like that: DGW_itens.Columns[0].Visible = false; Where 0 corresponds to the index…
-
1
votes1
answer661
viewsA: Error: $injector:modulerr Module Error - I can’t fix
If you follow the giant link of your question, you will see a message like this Failed to instantiate module MyApp due to: Error: [$injector:modulerr]…
-
2
votes1
answer55
viewsA: Turn float or double into date within a lambda
It is impossible, because the Entity Framework does not know how to translate this to an SQL expression. There are two very clear options: 1. Materialize the query data before doing the select lista…
-
2
votes1
answer1012
viewsA: Group objects and add values
Just make a GroupBy simple var groupped = itensPedido.GroupBy(x => x.CodigoProduto) .Select(g => new { Chave = g.Key, Itens = g.ToList(), Total = g.Count(), Soma = g.Sum(x =>…
-
1
votes1
answer36
viewsA: Release of the datagridi dviewr gridi on the change button
That one flag only marks the element as ReadOnly, to undo this at runtime is to change this value. For example: private static void btLiberarBloquearGrid_Click(object sender, EventArgs e) {…
-
3
votes1
answer749
viewsA: Error: no implicit Conversion of Integer into String (Typeerror)
The return of gets.chomp is a string. It is necessary to convert this data to integer before trying to do any arithmetic operation. This is possible using the method to_i. Note that to use the text…
-
1
votes2
answers544
viewsA: Save date and time?
You create an object of the type Rota after verifying the validity of the ModelState. It is possible set the date property there. Rota rota = viewModel.CriaRota(); rota.DataSaida = DateTime.Now;…
-
1
votes1
answer474
viewsA: How to bring other columns with Groupby with LINQ
Just make use of the navigation properties. var processo = Processos .GroupBy(p => new { p.SituacaoProcessoId, Descr = p.SituacaoProcesso.Descricao }) .Select(p => new { Descricao =…
-
5
votes2
answers590
viewsA: Separating Sentences in a String
Just cut the string into two pieces. The first being from the beginning of the original string to the line break and the second from the line break to the end of the string. Notice that I used…
-
3
votes2
answers498
viewsA: How to use if Else in the code below
Your logic, in the block below, makes no sense. bool condição = true; // <- condição recebe o valor 'true' if (idArtista == idReparador) // <- Aqui é comparado se os ids são iguais, certinho {…
-
4
votes1
answer45
viewsA: Picking up array values
Make a loop to go through all the items in the most external array. foreach($array as $item){ echo $item["username"] . PHP_EOL; } See working on repl.it.…
-
2
votes1
answer235
viewsA: Convert string to timestamp for java date
It is possible to do this: Integer timeStamp = Integer.Parse("1504541885"); Date time = new Date((long) timeStamp * 1000); Documentation of java.util.Date…
-
5
votes1
answer339
viewsA: Check if a value is contained in the line
The % is a wildcard that represents "anything". That is, the search is being done by names that start with "a" and have anything after. You just have to adapt to anything before and after of "the".…
-
2
votes2
answers181
viewsA: Problem with async task
You need to use the await to await the execution of ReadAsByteArrayAsync var pdf = await response.Content.ReadAsByteArrayAsync();
-
7
votes1
answer1263
viewsA: Concatenation of two chained lists
This can be done in two different ways. The first is to concatenate the nodes of the second list in the first, that is, modify the first list and add all nodes of the other list. This would be more…
-
0
votes2
answers1587
viewsA: Create line chart windows form
Just change the ChartType. You can see all possible values in the documentation. chartGrafico.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;…
-
3
votes2
answers372
viewsA: "Nothing to commit" after failed authentication
The commits are local, on your machine. So what failed was just the push. Instead of repeating the command git commit -am 'lol' && git push origin master Just make a push git push origin…
-
14
votes1
answer615
viewsQ: How does the lifespan of static variables work?
I just saw a question about C. In it the following code was shown: #include <stdio.h> int main() { static int a = 5; printf("%d", a--); if(a) main(); return 0; } Example running on repl.it.…
-
4
votes2
answers317
viewsA: Random list in Query Linq to Entity C#
Use an object Random to sort the list and method Take to limit the amount of returned items. Random rnd = new Random(); listaPessoas = listaPessoas.OrderBy(p => rnd.Next()).Take(3).ToList(); See…
-
2
votes1
answer290
viewsA: How to inject a dependency of a service of its own into a certain syntax?
The first error is because the JS file path is wrong. This is very clear in stacktrace (that was posted and removed) that shows an error 404. The second mistake is because the order of scripts is…
-
2
votes2
answers94
viewsA: Problem when receiving char values
The while validates this entry should be using && and not ||. That is to say: If the entered value is different from M and also different of V and also different from N. while((turno != 'M')…
-
1
votes1
answer54
viewsA: Error loading database information to a datagridview via Entity Framework
You will need to properly return the data that must be presented on DataGridView because this control will not solve complex types. Your code would look like this: var dados =…
-
1
votes1
answer610
viewsA: Value comparison
Just make sure the loop is in the first run. If yes, you can be sure that this is the smallest so far. That is, you check whether the id is equal to one (because id is who controls the loop) or if…
-
1
votes1
answer159
viewsA: Problem saving Combobox data to Postgresql
This happens because you are using the SelectedIndex as the category value, only that not necessarily these values (index of the combobox and id of the table) will match. In fact, it’s very…
-
13
votes4
answers27125
viewsA: Multi-line selection in VS Code
This can be done using the combination Alt + Main mouse button. This will create a cursor per line clicked, holding the mouse button and dragging to select, allows selecting multiple lines. Or else,…
visual-studio-codeanswered Jéf Bueno 67,331 -
0
votes1
answer328
viewsA: If the user enters such number in the console will do an action
You need to read the input using Console.ReadLine(). The Console.ReadLine always returns a string. So if you want to do some numerical comparison you have to convert to integer first. For example:…
-
23
votes3
answers29017
viewsA: What is ROW_NUMBER?
ROW_NUMBER is a non-deterministic function that returns a sequential - and potentially volatile - number calculated as (and whenever) a query is executed and serves to list the results of the…
-
0
votes2
answers728
viewsA: Countdown of days passed from a given date, using the <form>
I think you understand the purpose of the site. Anyway, your problem is very simple and can be solved with few lines of code. I haven’t done everything for you because, as already said, this is not…
javascriptanswered Jéf Bueno 67,331 -
3
votes3
answers73
viewsA: How to debug code with Object Initializer format
There is no way. Only seeing the values after they were inserted into the object (see image below) or Initiating in the usual way, that would be: var myObject = new Object(); myObject.Id = 1;…
-
1
votes1
answer68
viewsA: How to make a date in ISO 8601 format but still be a Datetime
This is a form of representation of the date. A DateTime is a structure that tries to simulate a point in time (a date), as you will represent it date is not work of this structure itself. You can…
-
2
votes1
answer797
viewsA: How to include a line at the beginning of a text file?
Simple. You just need Read the entire file and save to a list of string, where each row represents a string in the list Insert new row at position 0 of the list Write all the strings of the list in…
-
0
votes2
answers77
viewsA: Error in the Ienumerable
There’s a mess there. You declare twice the class Noticia, one inside the other. Remove the most external statement, leaving the code like this: namespace Rotas.Model { public class Noticia { //…
-
4
votes2
answers1359
viewsA: Search specific value within a file . txt C#
Basically, this is it: var valores = File.ReadAllLines("NomeDoArquivo.txt") .Where(l => l.StartsWith("001-000")) .Select(l => l.Substring(l.LastIndexOf("=") + 1)) .ToList(); The use would be…
-
2
votes1
answer58
viewsA: How to pass more than one Controller option in Routes.Maproute()
Just change the route statement to: routes.MapRoute( "Contracts", "{controller}/Contract/{contract}", new { controller = "Home", action = "Contract", contract = UrlParameter.Optional }, new {…
-
18
votes8
answers4052
viewsA: How to generate 200,000 primes as fast as possible in Python?
My contribution is a somewhat implementation naive. It takes (on my machine) approximately 71 seconds to generate 200,000 primes. Despite this, it is a basic implementation, uses nothing from third…
-
3
votes1
answer917
viewsA: How to use multiple App.config
This is the expected behavior. You may have separate configuration files, but you will need to read them manually, the two methods cited by you will capture the information from the Assembly that is…
-
1
votes1
answer48
viewsA: Error with lambda and fields float
The fields of the type REAL cannot be represented by decimal, they are floating point numbers and therefore must be represented by a field double or even float. I based my answer on what was said in…
-
2
votes1
answer1315
viewsA: Change task time on Windows
My advice to you is: create a Windows service, That’s what they’re for. In Windows task scheduler it is impossible to create triggers with less than 1 minute repeat. On the other hand, it is…
-
3
votes2
answers202
viewsA: txt file opens in the browser instead of being downloaded
You can add a header to force this download // [...] Resto do código string fileName = "myfile.ext"; var disposition = new System.Net.Mime.ContentDisposition { FileName = fileName, Inline = false,…
asp.net-mvcanswered Jéf Bueno 67,331 -
3
votes1
answer252
viewsA: Creating a Method to Replace Characters in a String
The method itself replace has this purpose. Note that there is an overload that receives two CharSequence's as a parameter. I mean, you can do it like this String nova = antiga.replace("alguma…
-
4
votes1
answer51
viewsA: View error returning a txt file
This is exactly the problem, the file is already open when reading attempt is made. Your code opens a StreamWriter and does not close it. You can use the method Dispose or put the code that uses the…