Posts by Jéf Bueno • 67,331 points
1,254 posts
-
9
votes4
answers19332
viewsA: Compare current date with javascript
That’s because new Date() also counts the current time, creating a date from the string time is zero. console.log(new Date()); console.log(new Date('07/04/2017')); if (new Date() > new…
-
7
votes1
answer1765
viewsA: Can I have more than one builder per class?
Can. Just need to set different parameters for them (in types and quantity), this is called Overload (overload). Ex.: class MinhaClasse { private int id; private String nome; public MinhaClasse() {…
-
5
votes2
answers1841
viewsA: How to treat division by 0
If you cannot do the check in the innermost method, you can capture the exception and do something. I think the best idea is to treat this in the most internal method, capture the exception should…
-
4
votes2
answers836
viewsA: What code should be used to focus a Textbox?
It is possible to do this two ways: Change focus to a label, for example, since this does not remain user-friendly. In my view, this is the best idea because it makes it possible to choose the next…
-
2
votes1
answer56
viewsA: How to select a string in resx (internationalization) without using the static method
You can use the ResourceManager.GetString for that reason var resManager = Messages.ResourceManager; string plano1 = resManager.GetString("plano_1");…
-
1
votes1
answer702
viewsA: Query image in a folder
To know whenever the user selects a value in the combobox you will need to use the event SelectedIndexChanged (or any similar). To carry a PictureBox with a file system image, you can use…
-
5
votes3
answers2223
viewsA: How to delete files from a recursively expression-based folder?
Using the Powershell is easy. get-childitem . -include LX*.* -recurse | foreach ($_) {remove-item $_.fullname} The command Get-Children returns a collection of files. The point (.) represents the…
-
5
votes3
answers3678
viewsA: How to remove unwanted words from a text?
If it’s a simple joke, you can create an algorithm that does the following: Create a list of words to be removed from the text. Create a list (lista_frase) where each element in the list is a word…
-
4
votes1
answer10235
viewsA: Write file . txt Node.js
Using the API filesystem nodejs. The API has a lot of details and gives you endless possibility, take a read on documentation for more details. Remember that you must have permission to write to the…
-
2
votes1
answer1615
viewsA: How to insert control key in c#
Change the property KeyPreview of form as true. Set actions for shortcuts in the event KeyDown of form Example: private void MainForm_KeyDown(object sender, KeyEventArgs e) { if (e.Control…
-
6
votes3
answers2714
viewsA: Failure to log in to an IIS application when trying to connect to Sqlserver
This has nothing to do with configuring the IIS itself. The error says that the user IIS APPPOOL Dotnet4 cannot connect to SQL Server. This is because your ASP.NET application is using Integrated…
-
9
votes2
answers4935
viewsA: Remove Visual Studio Code Side Panel
The name of this "panel" is minimap. You can change the visibility of it by changing your file Settings.json and adding a key-value pair with the key editor.minimap.enabled and a value boolean. This…
visual-studio-codeanswered Jéf Bueno 67,331 -
5
votes2
answers188
viewsA: Add email with copy when sending the form
You can add another address on "to", separating by comma. Always following the pattern defined in RFC 2822. $to_Email = "[email protected],[email protected],[email protected]"; If you want it to be a…
-
1
votes3
answers393
viewsA: Sort children in consultation Linq
You have two viable options: Sort the data after consulting var query = from c in context.Set<Grid>() where c.Id == id select c; var retorno = query.FirstOrDefault(); retorno.GridDatas =…
-
6
votes2
answers904
viewsA: How to access properties of an object that is inside another object?
You’re trying to access the property casas in a object, this property does not exist in object. You can make a cast Console.WriteLine(((casa)(cidade1.casas)).dono). But the correct thing is you…
-
9
votes3
answers361
viewsA: Is it correct to call a method, and pass your null parameters?
Another important point is that all controls that are buttons have a method called PerformClick, it triggers the event of click button. Note that there is no error in calling the event method by…
-
6
votes3
answers1515
viewsA: Is there any nomenclature for variables defined by underline/underscore?
Yes, this pattern is commonly called Snake case (snake_case, in this case :p). There is no official name for this pattern, Snake case was the name that the Ruby community gave him (that’s right, it…
-
3
votes1
answer631
viewsA: Return string in SQLITE query
The user name must be in quotes to represent a string. If you do not use quotes the database will try to compare the column login with another column. See the error message: in such column: lgomes…
-
2
votes5
answers5036
viewsA: Join two Jsons into a single object
Just take advantage of the dynamicity of Javascript and assign the second object as property usuario of the first object. var obj1 = { "razao_social":"INTELIDER","nome_fantasia":"INTELIDER…
-
2
votes2
answers246
viewsA: String for Keyvaluepair using LINQ
Using LINQ for this type of task will only make the code hard to read. Use a for normal seems to me a much better idea. var lista = new List<KeyValuePair<char, char>>(); for(int i = 0; i…
-
2
votes1
answer87
viewsA: Returning two objects from the Repository
There are several ways to solve this. Using tuples could be a good thing, but I think this mechanism is better in C# 7 and I find it difficult that you are using this version of the language. In…
-
1
votes2
answers456
viewsA: Change the name of the pdf file to hash and then manage to undo the name to read again
The logic is very simple: you keep the files with the original names in the system and when to send to download send it under another name public static void Download(string fName) { FileInfo fInfo…
-
2
votes1
answer36
viewsA: Error in constructor name parameter Objectparameter C#
I have no idea what you’re doing, but it’s pretty clear from the description of the error, that the problem is caused by the space at the end of the string. Remove one more character from the end of…
-
4
votes1
answer499
viewsA: How to dynamically grab the Content folder directory?
Use Server.MapPath If you’re going to use the code on a controller var caminho = Server.MapPath("~/Content"); var file = new StreamReader($"{caminho}/tb_ocupacao.txt",…
-
3
votes3
answers314
viewsA: Jquery function does not find the Controller when I go up to the server
It’s a bad idea to use it this way. There are already solutions for this, use Url.Action function carregaComboEmpresa() { $.ajax({ url: '@Url.Action("Action", "Controller")', type: "post", dataType:…
-
4
votes1
answer79
viewsQ: A list of a guy can’t pass as a list of his 'higher' type?
There are some entities in the application that I am developing that need to be sorted by a predefined routine. Thinking about it was created contract class, called ElementoOrdenavel and all…
-
2
votes1
answer96
viewsA: Migrate from VS 2005 to 2012 - Change framework version
Right click on your project, then on Properties. Then choose the tab Application and you will see a combobox with the label "Target Framework".…
-
3
votes2
answers296
viewsA: Logic operations in Python 2.7
What you intend to use is the operator &, who is the operator bit to bit. He who does the operation the way you described in your question. Using the and this is exactly the expected behavior.…
-
5
votes2
answers218
viewsA: ASP.NET My Javascript is not working
Remember to insert jQuery into the page and run the script only after you have already loaded the HTML. Because the code itself works perfectly - see at the end of the answer the executable example.…
-
5
votes2
answers354
viewsA: Why does max not even min return the expected value?
How the columns are varchar, sorting is different from numerical columns. You can cast a column to bring the expected result. Note that, ideally, this is just for you to see that the MIN and MAX…
-
2
votes1
answer237
viewsA: FK error while running Migrations on C#
This happens because there are already data in the table dbo.Branches. See, you’re creating a column obligatory, that is, that it cannot have null value. When creating this column, SQL Server…
-
2
votes1
answer240
viewsA: 500 (Internal Server Error) when defining action as [Childactiononly]
It turns out that actions marked with the attribute [ChildActionOnly] can only be called as a "child" method from within a view, using the extension methods Html.Action() or Html.RenderAction(). The…
-
2
votes1
answer680
viewsA: How to get the Hidden input value inside the controller using Formcollection?
The key to the FormCollection must be the value of the attribute name of input. The code of controller should be something like public ActionResult AdicionarCodevedoresTit(FormCollection…
-
11
votes2
answers6013
viewsA: Printing widgets from a list
You have to go through all the items in the list and print them out. foreach(var elemento in lista) { Console.WriteLine(elemento); } If you want a version one-Liner. This only works for List,…
-
1
votes1
answer330
viewsA: Open Asp.net project/solution that are coming from another machine
See what the mistake says: The Web Site 'http://localhost:52961' is configured to use IIS Express as the web server but the URL is Currently configured on the local IIS web server. That is, your…
-
3
votes1
answer192
viewsA: Return a new object using the Foreach function
The instruction is backwards. The right thing would be: for each element of totals, by name t. Add a new element in totalsAdapter. totals.ForEach(t => totalsAdapter.Add(new…
-
1
votes3
answers3098
viewsA: Use return of a function in another function
If the method returns a tuple of values it is necessary to use a tuple to receive the return of it. Applying it to your code would be something like: xList, xFreq = frequencia(lista) media =…
-
3
votes1
answer328
viewsA: How to have more than one column shown in a Combobox?
Create a property that joins name and function. Supposing Profissional be the class name. public class Profissional { // outras propriedades public string NomeFuncao => $"{nome} - {funcao}"; }…
-
1
votes1
answer239
viewsA: How to create property for an Array? VB.NET
It’s not possible. The most you can do is create a class for it. Something like Imports System Imports System.Collections Imports System.Collections.Generic Public Class Program Public Shared Sub…
-
4
votes1
answer353
viewsA: How to access properties with "." in the name on a Dynamic object
As a property you will not be able to access it, C# has no mechanism to handle it. In any case, an object dynamic nothing more than a set of key-values, so you can access a value by your key, this…
-
4
votes3
answers414
viewsA: How to remove specific word from string?
A simple replace works. You could also use a regex in replace to remove both "http://" and "https://". let input = 'http://answall.com'; input = input.replace('http://', ''); console.log(input); let…
-
2
votes1
answer1940
viewsA: How to change the menu color by hovering over
Just define the property background-color using the selector ul.nav li.dropdown:hover. ul.nav li.dropdown:hover { background-color: algumTomDeAzulAqui; } ul.nav li.dropdown:hover ul.dropdown-menu {…
-
1
votes2
answers135
viewsA: Because the System.out.print.ln of this if is not played
The line break is not being printada because the condition is wrong. The last column of the matrix will always be equal to the row size subtracting one and the condition is backwards public static…
-
7
votes3
answers1889
viewsA: mark a checkbox and uncheck the others
He’s doing this because that’s exactly what the code says. The best alternative, as already mentioned, would be to use radio Buttons. Since this is not possible, it follows an alternative that…
-
1
votes1
answer62
viewsA: I’m having doubts about how to access an instantiated object in another class
I think you’re making quite a mess. Anyway, according to the code of the question and what was understood by the comments, the only thing left is to call the method mostrarDadosVendedor() at the end…
-
0
votes1
answer1648
viewsA: How to refer to Assembly in Visual Studio?
You need to add the file System.Data.dl to your project. Click dependencies, add and choose the Assembly.
-
2
votes1
answer242
viewsA: update tab of tabcontrol
This is exactly the expected behavior. Once loaded the ComboBox, you will need to upload the data to it again when you make new inserts. There are several ways to treat this: you can update when…
-
0
votes2
answers189
viewsA: Back up more than one database. c#
You will need to go through all the selected items on CheckedList and do the deed. Something like: if(clbDataBase.CheckedItems.Count == 0) { MessageBox.Show("Por favor selecione um Banco de…
-
15
votes2
answers1167
viewsA: Foreach of C# vs Foreach() of EF6
The method ForEach() has no relation to the Entity Framework. He’s a class method List, see documentation. Note that he has no relation to LINQ, he is a native of List. There is no important…
-
6
votes3
answers1314
viewsA: Format Field C#
Only use the formatting n, followed by the number of decimals. You can see all the possibilities in custom numeric format string in MSDN. Using the .ToString() even so: numero.ToString("n0"); Note…