Posts by Bruno Costa • 5,878 points
147 posts
-
0
votes2
answers50
viewsA: Play video from a playlist according to date and time has how?
Yes. You will need to fetch the local time used in the Date class. var date = new Date(); if(date.getHours() == 12){ var video = document.getElementById("video"); video.src = urls[i++];…
-
1
votes2
answers119
viewsA: How to shuffle a list of objects through a default value?
There is. The Random accepts this Seed you were talking about. If you always start with the same value it will always produce the same sequence. var r = new Random(4); var list = new…
c#answered Bruno Costa 5,878 -
0
votes2
answers197
viewsA: How to open external process on second Monitor
You can do it this way: [Flags] public enum SetWindowPosFlags : uint { // ReSharper disable InconsistentNaming /// <summary> /// If the calling thread and the thread that owns the window are…
-
1
votes1
answer40
viewsA: How to implement dictionaries in the Multithreaded Singleton standard
The Multithread Singleton standard meets me to enable the use of global variables in my application According to the code you posted is hard to notice if you really understand the statement you…
c#answered Bruno Costa 5,878 -
0
votes3
answers561
viewsA: Validate if a CPF already exists in the List before inserting C#
One of the most efficient ways to do this is by using a HashSet and not a Lista. The HashSetis an implementation of a data structure that ensures no duplicated data in time O(1), unlike the Time…
-
0
votes1
answer172
viewsA: How to change an image in Runtime with WPF
Here’s an example of how to change an image at runtime: public class Model : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected virtual void…
-
2
votes1
answer70
viewsA: How to stream video with interval request?
This can be done by consulting the order headers. More specifically the header Range. Then you can use ByteRangeStreamContent to return only a portion of the video. In terms of database you can do…
-
0
votes1
answer44
viewsA: Page inside a Rest Web Api C#
In the processing of the Rest Post, I will return a URL so that the request can view the result data it sent in a page with other information This is just adding an action to a new or existing…
-
0
votes1
answer55
viewsA: Problems contacting Domain Controller
I had several problems dealing with network directories and would like to leave a list of recommendations that should be followed if you use the same API I used. At some point your connection may…
c#answered Bruno Costa 5,878 -
0
votes1
answer55
viewsQ: Problems contacting Domain Controller
I made a program that accesses directories on the network. This program uses the windows API WNetAddConnection2. An example of implementing this API is available in C# in the SOEN. Here is the code…
c#asked Bruno Costa 5,878 -
0
votes1
answer259
viewsA: How to perform a recursive query with the relations stored in a JSON array?
The query was almost right. However it is necessary to be careful to write the second query precisely, either on select, either in the join. In the select it is necessary to choose the columns so…
-
0
votes1
answer259
viewsQ: How to perform a recursive query with the relations stored in a JSON array?
I have a MYSQL table that relates to itself. The relations are represented in the same table through a JSON Array. Here is the table and some sample data: CREATE TABLE `templatedata` ( `Id`…
-
1
votes1
answer49
viewsA: How can I evaluate performance in a . net core application in f#
Application performance information is provided in the diagnostic window. In this window it is also possible to enable the application Profiling, to have more details of which methods are consuming…
-
1
votes1
answer49
viewsQ: How can I evaluate performance in a . net core application in f#
I would like to profile my application asp.net-core developed in f#. I could not use the profiler included in the visual studio for this purpose. How can I evaluate the performance of my…
-
-4
votes2
answers166
viewsA: How to return the name of an instance of a class?
Another option is to add a property Nome to your class Trem. That way all the trains would have a Nome public class Trem{ public string Nome{get; set;} //... } And every time you create a Voce train…
-
0
votes0
answers23
viewsQ: How can I work with files in network directories on . NET?
How do I access files present in network directories on . Net? Accessing local files is simple, I can do Directory.EnumerateFiles("C:\\", "*.*"). But Directory.EnumerateFiles("\\\\10.88.0.1\\rec",…
-
0
votes0
answers25
viewsQ: Why does Linqpad say a network directory exists, while . NET does not?
I have a network directory on "\\10.88.0.1\rec". However Directory.Exists returns false while debugging in visual studio. This is strange since the LinqPad returns true. Are there any differences…
-
1
votes1
answer49
viewsA: How to write an Event without using visual studio (in .Cs or simply in a .txt file)
The answer is yes, but the code Voce made doesn’t make much sense. A class EventArgs is already defined in the namespace System in the assemblies System.Runtime.dll, mscorlib.dll, netstandard.dll.…
-
3
votes1
answer717
viewsA: How the Node thread pool works
Nodejs Thread pool Yes in Nodejs your code runs only on a single thread, however this does not restrict the Node from creating new threads for certain operations, if necessary. The concept you have…
-
2
votes3
answers2012
viewsA: Why does Scanner return error on something that is within the expected?
I wonder why it’s wrong The program gives error because the first call to entrada.nextInt() does not change line. so when Voce calls entrada.nextLine() the scanner will change line and return an…
-
3
votes4
answers1629
viewsA: Use color, RGB or hexa names?
You can specify colors with at least 10 different shapes according to the last draft of the CSS Color Module. This is a test that shows these shapes: .colorName{ color: red } .colorRGB{ color:…
cssanswered Bruno Costa 5,878 -
3
votes1
answer111
viewsA: Filehelpers . NET CORE 2.0
It is possible yes. I myself include a reference to the last alpha version bilblioteca in a project . NET core 2.0 and did not give any Warning. Usually when there is incompatibility problem the…
-
5
votes1
answer374
viewsA: How to auto-detect the current system language?
You can use it Locale.getDefault(); Of documentation: ... The Java Virtual Machine sets the default locale During startup based on the host Environment.... In free translation: The Java virtual…
javaanswered Bruno Costa 5,878 -
1
votes1
answer95
viewsA: Problem when cancelling a process
You can improve your cancellation process to kill the process. When a process is killed new processes will not be started. There may probably be more elegant ways to solve the problem. In this case…
-
2
votes3
answers166
viewsA: How do I stop a running program?
To kill the Voce process you can call process.Kill(); Yet the trick is in not calling WaitForExit since this method will wait until the process ends and this way will also block your graphic…
c#answered Bruno Costa 5,878 -
4
votes1
answer251
viewsA: Round up minutes C#
You can do it this way: public static class TempoUtils{ private static int MultiploSeguinte(int n, int m){ var resto = n % m; if(resto == 0) return n; var faltam = m - resto; return n + faltam; }…
c#answered Bruno Costa 5,878 -
0
votes1
answer124
viewsA: Accessing via Curl
You did not enter the Header User-Agent:. Secretly it seems that the server is also waiting for the format application/x-www-form-urlencoded. I also advise to use the HttpClient which is the latest…
c#answered Bruno Costa 5,878 -
2
votes3
answers87
viewsA: How do I make a conditional if by comparing only the last 2 digits?
Use the Substring. Example: Dim text As string = "Olá mundo!" Dim teste As Boolean = text.Substring(text.Length - 2) = "o!" Console.WriteLine(teste) //True…
vb.netanswered Bruno Costa 5,878 -
12
votes4
answers2561
viewsA: What’s wrong with gluttonous philosophers?
The problem of gluttonous philosophers has already been explained by @idkWhy. I just wanted to complement his response since in my opinion there is a little more knowledge to be drawn from the…
-
4
votes1
answer2182
viewsA: The call thread cannot access this object because it belongs to a different thread
You have to access the interface components in the same thread where they were created (also known as the UI thread). To do this you can use the Dispatcher. Example:…
-
2
votes1
answer501
viewsA: Bidirectional Communication - Send and Receive string value correctly
As stated in the comments by @Leandro the server will continue to write the message while there is no cancellation. I found it strange not to have a simple example as a server echo in the Github so…
-
1
votes1
answer228
viewsA: Send Bad Request by REST
The MVC already makes the automatic validation of the Model by Voce. To get the errors of your Voce model you can access the property ModelState. Example: var errors = string.join(" ",…
c#answered Bruno Costa 5,878 -
2
votes2
answers64
viewsA: Inherit comments from a virtual object
You also have the possibility to inherit the documentation as you wish. To do this use the <inheritdoc cref=""/> Example: /// <inheritdoc cref="object.ToString"/>…
-
1
votes1
answer558
viewsA: Find out which service is being used in port tcp C#
You can use the netstat -b to obtain this information. You can execute this command with the Process.Start and read the output returned by nestat for the process + port pair information. I made a…
-
3
votes1
answer87
viewsA: What kind of function should I use?
Avoid doing this. Look for other alternatives first. The reason for this recommendation comes from the simple fact that you must avoid, to the maximum extent possible, actively verifying a condition…
-
0
votes2
answers400
viewsA: C# MVC5 - Insert Fields with 4 Decimal Digits
When I enter the command below in my context class that is automatically generated, works normally, but I have to change every time the database is updated. You should not modify the code of your…
-
1
votes2
answers114
viewsA: Why is there the term "Private" in . NET?
One of the places where the private modifier is explicitly useful is when it has a read-only public property. public string Nome { get; private set; } This allows you to assign values to the…
-
2
votes1
answer99
viewsQ: How can I register a route in IIS to my container Docker?
I have a job HTTP which I am making available within a Docker container. So far, for all my services HTTP i created a redirect rule (Rewrite URL) on IIS which allowed my services to be available at…
-
7
votes3
answers814
viewsA: How and when to build an object in valid state?
Victor’s answer already speaks in all content I would like to give a much simpler answer. Normally you have one and only one way to build an object. This form is as follows:: Object objecto = new…
-
0
votes2
answers67
viewsA: How to avoid the sum of items in my lambda. Result is not expected
Like me I mentioned the previous question all this would depend on logic and your data. From what I understand Voce may have several elements in the group, but they all seem to have similar (or even…
-
3
votes1
answer38
viewsA: lambda error with Join when placing a Groupby
When Voce uses the GroupBy You have a list of groups. In order to understand, in your case, Voce will have so many groups depending on the number of budget ids. If you haven’t noticed, you can check…
-
0
votes1
answer113
viewsA: Use synchronous or asynchronous tasks to collect print counters
In this case it might be better not to use Task. Tasks work best when Voce has operations I\O asynchronous. Because as the I\O not processed the CPU can continue to do other things. One thing I…
-
0
votes5
answers1530
viewsA: Do programs written in C# depend on the . NET Framework to run?
There are alternatives that do not require the . net framework. The turbo.net studio eliminates the depedence of the .Net. framework. Of page of their Features is written as follows Eliminate . NET…
-
3
votes1
answer80
viewsA: Time consumption in cubic code
I followed the idea of @Jefferson Quesado. You can get the complexity of your algorithm by incrementing a counter. Basically Voce only needs to know the total number of iterations for each value of…
javaanswered Bruno Costa 5,878 -
1
votes1
answer47
viewsA: How do users' Sids work?
A user’s SID connected to the Microsoft Live account will be the same SID if connected to other machines? Yes. To prove this there is even a command that allows you to fetch a windows user’s SID:…
-
1
votes2
answers179
viewsA: Why can’t I assign a list of a more specific type than the declared type?
@ramaral indicated in the comments the question that has the answer. This problem happens because the guy Patient is not cowardly in relation to APerson. What this means is that Patiente is not a…
-
1
votes1
answer279
viewsA: How to assign a default date value to a Textboxfor?
Like the Pablo Carvalho commented, Voce should add the property value in its object @Html.TextBoxFor(model => model.data, "{0:dd/MM/yyyy}", new { @class = "form-control", @alt = "date",…
-
1
votes1
answer484
viewsA: To add runtime property to an already created class C#
One hypothesis is to use the ExpandoObject. dynamic objeto = new ExpandoObject(); objeto.Propriedade = 1; You will most likely have to copy the properties of the old object to this object. You can…
c#answered Bruno Costa 5,878 -
1
votes1
answer6295
viewsA: How to use line break in c#
The @Rovann Linhalis gave the answer to the question. You can use a method to wrap the string public static string WrapString(string text, int len) { int x =len; while (x < text.Length) { text =…
c#answered Bruno Costa 5,878 -
0
votes1
answer329
viewsA: How to filter an array within a Collection in MONGODB - C#
One of the ways to do this is to do the Unwind array. This is equivalent to doing a kind of SelectMany in Linq. You will have a different object for each language and at that time you can filter the…