Posts by Jéf Bueno • 67,331 points
1,254 posts
-
0
votes2
answers306
viewsA: No Overload for Matches delegate error on a C#
The click event can only have 2 parameters. A object that represents the element that triggered the event and a EventArgs which are different arguments for events (for example: an event in a…
-
2
votes1
answer31
viewsA: Why are you returning the path of class
It is because this is the standard implementation of the method toString(). You can see more about this in the post: Doubts about the toString() method of the Object class You can specify what you…
-
1
votes1
answer472
viewsA: Read fields in CSV format with C#
There are some things to tidy up in your code and, in general, the solution as a whole could be a little better. When I started writing the answer I thought about proposing an adapted solution, but…
-
1
votes2
answers54
viewsA: How to assign the name of a component, where it does not exist in the current context
In doing Name = "dtpvencimento", you are just stating a name for the control and not creating a variable for it. Therefore, it makes no sense for you to try to access a variable... There are several…
-
3
votes1
answer53
viewsA: Why does function . text() in jQuery not have the expected behavior?
There is absolutely nothing wrong. Note that if you want to change the HTML of the element, the function you should use is html() and not text(). I’m surprised you can use the field innerHTML in a…
-
13
votes2
answers189
viewsA: Are HTTP headers case sensitive or case insensitive?
They are case-insensitive. This is defined in RFC 7230, more specifically in the section 3.2 Header Fields. This is one of the current Rfcs that specify the HTTP 1.1 standard. This set of Rfcs…
-
1
votes1
answer93
viewsA: How to control MDI forms through a general method?
There are several ways to solve this. One approach I like is to create a generic method to open the Forms. In this case, the method is in the MDI form. public void OpenForm<TForm>() where…
-
4
votes4
answers712
viewsA: How to access only the first position of each row in an array of arrays (matrix / multidimensional array) using foreach?
The foreach go through all the elements of the collection. To do what you need, just use a for normal. Note that the property Length will return the amount total of elements in the collection, ie,…
-
1
votes2
answers306
viewsA: Find time within a range of hours
You are not considering that the hours may cross the day. Basically, what you need is to change the validation to something like: Inicio > Fim ? data <= Inicio && data <= Fim : data…
-
4
votes1
answer281
viewsA: How to use parameters in the sql query using Dapper?
I’m not sure about the mistake you’re getting. There is no way to identify this problem with the information you passed on the question, probably not even related to this query. Anyway, it is a fact…
-
1
votes1
answer36
viewsA: Formatted date range - return of between
It turns out that the function DATE_FORMAT returns a string. Do not use this function to filter or sort, it does not make sense something like this. The select should be SELECT id,…
-
1
votes1
answer432
viewsA: Consultation Group by Linq
There’s not much mystery, just use the method GroupBy. Note that I created an instance of CultureInfo to have control over the name of the months, in your case you need to see how the application…
-
1
votes1
answer38
viewsA: How do I assign a function to Contextmenustrip in c#?
Just add the method as event Click of item. sairToolStripMenuItem.Click += Exit;
-
2
votes1
answer164
viewsA: Injection error of dependency
Note that the controller asks for the specific type, not the interface. This is wrong. public CampeonatosController(CompetitionService competitionManager) { _competitionManager = competitionManager;…
-
1
votes2
answers375
viewsA: Calling another class method in a Task c#
The answer is basically the same as this question here: Modify visual element by another thread The difference is that, in WPF, each control has a property called Dispatcher which contains the…
-
0
votes1
answer96
viewsA: Return false does not work Typescript
What happens there is that the form submission is being triggered the moment you click the button. To prevent this, it is possible to use the method preventDefault() and then fire the Submit…
-
6
votes1
answer98
viewsA: Bug to popular a Data Gridview in Window Forms
Generally speaking, none of this is being done is necessary. It is possible to simply assign a list as the grid data source, so each item in the list will be a table row and each property of each…
-
2
votes1
answer38
viewsA: Camouflage Sender using Smtpclient
Just change the From mail.From = new MailAddress("[email protected]", "Qualquer coisa"); Note that it is very likely that both the outgoing SMTP server (the one you use to send the…
-
2
votes1
answer33
viewsA: I can only output a database record. How do I output all the records I have in the database?
The method SingleOrDefault serves precisely to obtain only one record according to the predicate passed by parameter. You need to remove the call for this method. MoviesData[] movies =…
-
2
votes1
answer53
viewsA: How to wait for multiple tasks to finish to run the next line?
Probably no need to use Task there (or any kind of multithreading). But without getting into this merit, I think you look for the method WaitAll. using System; using System.Threading.Tasks; using…
-
3
votes1
answer92
viewsA: Add HTML Properties to an input via Razor
In this case you must exchange the hyphens for underscore. Note that arrobas are unnecessary in attributes (apart from class), this operator is only used to name some reserved word of the language…
-
4
votes2
answers95
viewsA: Problem with LINQ
Probably this code has never worked before, at least not in the test case that was quoted in your question. What happens in your code is this. GetFiles returns a list of strings (in fact, it would…
-
0
votes1
answer355
viewsA: POST Web API method returning null
In Postman you must send a string and not an object. That is, the payload must be: "ana"
-
5
votes3
answers7855
viewsA: When do I use "%d" in a python language?
If you’re talking about format strings, this is a placeholder for numbers. The string formatted will always be an integer, even if the parameter is a floating point number. This way differs from…
-
1
votes2
answers163
viewsA: How to make an ASP.NET Core Post API without using MVC?
The payload sent must be a string and not an object. That is to say: "C%..." Instead of { value: "C%..." }…
-
3
votes3
answers4508
viewsA: Space between result (Python)
I’m not Pythonist, but I thought of something like this: keep the input string intact, just make sure it’s really a number. Then multiply the concatenated input string with a space by converting to…
-
4
votes2
answers186
viewsA: How to convert Two-dimensional array to a Single array?
The algorithm is simple: scroll through the array and create a new one-dimensional. using System; class MainClass { public static void Main (string[] args) { int[,] arrayBidimensional = new int[3,…
-
2
votes1
answer157
viewsA: How to Configure a string Connection
Failed to pass the pro connection string SqlConnection. var connectionString = this.Configuration.GetConnectionString("PokemonBD"); services.AddTransient<IDataBaseContext>(contex => new…
-
2
votes1
answer33
viewsA: Returning Internalservererror a Tuple list
There is no builder of Exception who receives a list of tuples. The available builders are Exception() Exception(String) Exception(SerializationInfo, StreamingContext) Exception(String, Exception)…
-
2
votes2
answers42
viewsA: How to load Enum property into a Lambda
var qry = customer.Where(x => x.Type == CustomerTypeRequest.Customer); or var qry = customer.Where(x => (int)x.Type == 1);
-
3
votes2
answers86
viewsA: Error saving BD change in C#
There are a number of problems there, but the main problem (which is causing the error in the case) is that your SQL command is wrong. You probably wrote something wrong precisely because it is very…
-
2
votes2
answers373
viewsA: Difference between Arraylist and Mutablelist in Kotlin
MutableList is a interface. ArrayList is a guy that implements the interface MutableList. That is to say, MutableList only defines contracts, defines what must be done. Already ArrayList implements…
-
4
votes2
answers120
viewsA: How to declare a vector with 2 positions?
To define that the type of a variable is a array it is necessary to use brackets, for example: private double[] notasProvas; Java cannot declare a array and already set the number of positions. The…
-
4
votes1
answer429
viewsA: Decoding on Base 64 does not consider "Ç"
It doesn’t make any sense to use Base64 there. My tip is to rewrite in the right way. In addition, it is important to understand the cause of the problem. Well, most likely, the representation in…
-
0
votes3
answers38
viewsA: How to instantiate Webheadercollection using object initializers?
Basically, it is possible to use any method Add that exists in WebHeaderCollection (the type of property Headers). This is the method used to initialize collections. For example: This can be done by…
-
5
votes1
answer1076
viewsA: Convert Base64 string to jpeg image in C#
Use the method FromBase64String class Convert to generate a array of bytes from the string in Base64. With this byte array, create a new stream in memory of the class MemoryStream. Having a stream…
-
5
votes1
answer242
viewsA: What is the difference between init and constructor?
First of all, what you call "set straight in class" is a builder. A class in Kotlin can have a primary constructor and "secondary constructors". Primary constructors are like this of your example…
-
4
votes3
answers339
viewsA: The name "Arthur" does not exist in the current context C#
It seems to me you’re trying to use the word arthur as a string. Well, literal strings need to be surrounded with double quotes. contaUm.titular = "arthur"; But this will not leave your code…
-
4
votes1
answer772
viewsA: Check if a string is a valid date
I don’t understand what you wanted to do in your code, but from the description of the problem, I imagine you’re looking for the method DateTime.TryParseExact. Note that the second argument of the…
-
3
votes2
answers54
viewsA: Event call at another event
Since the signature methods are different, a good idea is to create an intermediate method that is called by the two events. private void Metodo(int rowIndex) { Dgv.Rows[rowIndex].Cells["Total"].…
-
3
votes5
answers3984
viewsA: How to compare arrays to javascript?
Make the intersection between the input set and the other sets and check the amount of items resulting from this operation. Below is an example of implementation. Note that this implementation…
-
1
votes1
answer70
viewsA: Checkbox in the Console
You need to check the property checked and not value. Since you are using jQuery, you can use the method prop. $('#bt').on('click', function () { const c = $('#defaultCheck2').prop('checked')…
-
10
votes4
answers2085
viewsA: Does the date conversion always remain in en-BR?
This happens because you are not formatting the output. A date has no format, what is formatted is representation of this date in string. It is possible to set the format of a date using the .…
-
2
votes1
answer227
viewsA: How to send an Authorization TOKEN and parameters to perform an INSERT in my API?
Just like in POSTMAN, you need to send this token in a header of the requisition. client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "token da API");…
-
1
votes2
answers78
viewsA: Remove selection from a Strip Menu
This is the expected behavior of a menu. Swap the component for a ToolStrip and add a label.…
-
8
votes1
answer81
viewsA: Dispose() - Resource Release or Memory Release?
First of all, Dispose does not make "memory release". The method serves to finalize resources used. For example: a file that has been opened for editing or a network connection. Briefly, when a…
-
1
votes2
answers53
viewsA: Save Status Code in variable and check
You can use Enum HttpStatusCode public class Program { public static void Main() { var client = new HttpClient(); client.BaseAddress = new Uri("https://httpbin.org"); EnviarRequest(client, "uuid");…
-
0
votes1
answer60
viewsA: How can I get Bluetoothmanager of the device on Kotlin?
Because the method getSystemService is a method made to operate in a generic way and return any type of system service, not just a system manager bluetooth. In this way, the return of the method is…
-
3
votes1
answer29
viewsA: Doubt regarding the extension of the Date object
Because the builder of ExtDate always calls the empty Date constructor. class ExtDate extends Date { constructor () { super(); } foo() { console.log('bar'); } } var extDate = new…
-
2
votes1
answer126
viewsA: How to convert from List<> to Ilist<> using Automapper?
You don’t have to do any conversion. List<> implements IList<>, then any instance of List<> can be assigned to a variable IList<>. I don’t even know if it’s necessary to use…