Posts by Jéf Bueno • 67,331 points
1,254 posts
-
1
votes4
answers8807
viewsA: How to insert a property into a javascript object?
As Javascript is completely dynamic, it is possible to create the property "on the fly", thus: data2.arrayInformacoes = arrayInformacoes; var data2 = { "desColigada": "Empresa fulano de tal",…
-
2
votes1
answer86
viewsA: Doubt Verb GET Webapi
Just remove the parent class reference in the daughter class (or vice versa) and use include. This type of circular reference is causing Stackoverflow.
-
1
votes1
answer1524
viewsA: Passing data to another page
An alternative using Javascript only is to save the value in localStorage/sessionStorage and when you open the other page search for this value. In the first form - assuming the transition will…
-
6
votes2
answers3476
viewsA: Get the first letter of the last name and last name?
Personally, I’d make your code a lot easier this way. Obviously you need to validate if the received string is not null or empty, but that’s just detail, the focus here is the implementation. String…
-
4
votes1
answer1373
viewsA: Redirect to View in another structure
There’s no mystery, just use the full view path. return View("~/Areas/NomeDaArea/Views/NomeDaView.cshtml")
-
4
votes2
answers558
viewsA: How to deserialize a json to int?
The error is very clear. The properties Icone and Color are declared as int and in JSON they have a string as value. I don’t know what the real purpose of this is, but if JSON is wrong, arrange the…
-
5
votes1
answer75
viewsA: Object Type Declaration Doubt - Entity Framework
IS IQueryable what you need. If you are selecting only the DbSet (db.Ocorrencia, in the example) it is also necessary to call the method AsQueryable because his type is just DbSet. From the first…
-
3
votes1
answer684
viewsA: Nodejs running at Gate 80 with Apache
Every request is made on a port, what happens is that the browser "hides" ports 80 and 443 which are the two standards of the HTTP protocol - without SSL and with SSL, respectively. By definition,…
-
3
votes2
answers584
viewsQ: Center text vertically
I’m trying to make a DIV for a subscription with a photo (24x24) next. I want to center this text vertically, according to the size of the photo. I tried to use vertical-align: middle, but it didn’t…
-
2
votes4
answers3265
viewsA: Select only 1st row of table
Use TOP(1). SELECT TOP(1) Max(remessa.dt_uso_inicio) AS DATA_REMESSA, min(dt_entorc_oficina)DATA_ABERTURA, patr.nr_patrimonio AS PATRIMONIO FROM orcos AS o JOIN patrimon AS patr ON o.cd_PATRIMONIO=…
-
2
votes2
answers327
viewsA: Identify if the value being printed is float, string or int
Use the function type print(type(3.4), type("hello"), type(45)) >> <class 'float'> <class 'str'> <class 'int'>…
-
7
votes1
answer1001
viewsA: Do not allow insertion of a date after another date already inserted
Just create an object of the type Date and normally compare whether the first date is greater than the second. A hint is to check if the end date is valid when trying to exit the second input and,…
-
5
votes2
answers279
viewsA: Download PDF file by link in e-mail
An anchor (<a href ...>) will always send a GET pro server. This is the problem, the action is responding to requests PUT and not GET. Just change the attribute of [HttpPut] for [HttpGet] will…
-
1
votes2
answers2794
viewsA: Maximize screen without edge without hiding the Windows taskbar
With the property FormBorderStyle set as None, you will have to handle it manually. That is, if you are going to use WindowState = FormWindowState.Maximized, the taskbar will stand behind the form.…
-
5
votes1
answer306
viewsA: How to enable Migrations using Entity Framework Core = Windows Forms C#
This option does not exist in Entity Framework Core. You can do something similar by making the migration happen whenever the application is started, for development purposes. Possibly if I were to…
-
1
votes1
answer649
viewsA: accessing class data in a function in the global scope with typescript
The problem is that the variable dados is part of the class scope and these functions are declared out of class, just adjust that. Declaring the variable data outside the class will allow it to be…
-
3
votes1
answer51
viewsA: What is the safest way to test whether a data-* attribute exists?
Only test if the method getAttribute returns something. Example code (change the element ids to be able to execute the snippet. validaDataAttribute(document.getElementById('teste'));…
javascriptanswered Jéf Bueno 67,331 -
1
votes2
answers1230
viewsA: HTML inside a Stringbuilder
First, tags cannot have space between signals <, > and the name of the tag and this is done on almost every line. Second, it has other places with spaces as in meta http-equiv that can’t.…
-
3
votes1
answer464
viewsA: Mysql: Query Table N:N
If you cannot guarantee that all registrants will be linked to a mode, you must use a Left Join. You can see more about the Joins in this question I made a Sqlfiddle so you can see the query…
-
8
votes1
answer8172
viewsA: How to catch setar/catch object in localstorage?
Turns out you can only save pairs of key/value in the localStorage/sessionStorage. So, when trying to save an object as the value of the key tarefa what is saved is the string "[object Object]". If…
-
0
votes1
answer121
viewsA: Additional information: The input character string was not in a correct format
What’s wrong is that txtCodigo.Text has a value that could not be converted to int. See this answer for more details.…
-
3
votes1
answer617
viewsA: Send email through outlook
The problem is that the argument passed as /m need to be in quotes in newer versions of outlook WinExec(PChar('C:\Program Files\Microsoft Office\Office16\outlook.exe '+'/c ipm.note /m "'+para +…
-
9
votes1
answer381
viewsA: Memory game with tag div
The problem is that you are using the same selector for all click events. Explaining better: all elements have the class cores, then by clicking on a specific element all events will be fired. One…
-
2
votes1
answer85
viewsA: How to generate Thumbnail using Mediatoolkit
To install the package, I recommend downloading it by nuget, but this is matter of preference. PM> Install-Package Mediatoolkit After downloading and referencing the package in the project, it is…
-
4
votes2
answers428
viewsA: The type must be a Reference type in order to use it as Parameter 'Tentity' in the Generic type or method 'Dbset<Tentity>'
Is not possible. You need to pass a class to DbSet. An Enum may be a property of a model, but never a model itself. That is, it is acceptable public MeuModel { public MeuEnum Status { get; set; } }…
-
25
votes4
answers4422
viewsQ: What is the difference between & and &&operators?
I was making a simple code with a if two conditions. Everything worked normal and after I went to read, I realized I had written condicao & condicao2 instead of using &&. Even with this…
-
5
votes3
answers609
viewsA: How to compare 2 Arrays to Assert.Equals?
First there’s a mistake there, Assert.Equals has the same behaviour as the method Equals of object, that is, this method checks whether two variables point to the same reference. You probably want…
-
5
votes1
answer48
viewsA: Check Text Box character to mark on a radiobutton
radioButtonA.Checked = textBox.Text == "A"; radioButtonB.Checked = textBox.Text == "B";
-
2
votes1
answer39
viewsA: Why do navigation properties need to be declared virtual?
It turns out that by creating the property as virtual Entity Framework will create a new class (which is called Dynamic proxy) run time and use it instead of using the original class. This new…
-
22
votes1
answer5228
viewsA: What are the differences between overrideing and overloading in Java?
Override(ing) is overwritten, ie set a new behavior for a method that already exists. This happens when the class in question inherits (extends - extends) any other class and a method is created…
-
1
votes2
answers54
viewsA: Change Word by clicking on it
Basically you just need to set a click event for the element. Note that I added an id to the div, you can use any selector you want, but be careful not to add the event to elements that don’t need…
javascriptanswered Jéf Bueno 67,331 -
1
votes1
answer86
viewsA: Javascript command
Using the method filter var pessoas = [{nome: 'Sérgio', idade: 35}, {nome: 'Jéferson', idade: 25}, {nome: 'Joaquim', idade: 19}]; var adultos = filtrarPessoas(pessoas); console.log(adultos);…
javascriptanswered Jéf Bueno 67,331 -
2
votes1
answer333
viewsA: Get size of a request
It is possible to use the module request-Stats var requestStats = require('request-stats'); var stats = requestStats(server); stats.on('complete', function (detalhes) { var tamanho =…
-
3
votes2
answers229
viewsA: Grab size from a textarea that has been added dynamically
Since you can capture this element, there is no problem in counting how many characters Textarea has. Just use the method val() which returns a string with all the inserted text and then uses the…
-
3
votes3
answers2248
viewsA: Fill string with blank boxes
Use PadRight to complete with spaces if the string is less than 30 characters (or 30, because nothing happens there) and Substring to cut it otherwise. item.nome.Length <= 30 ?…
-
23
votes2
answers6299
viewsQ: What defines a stable sorting algorithm?
It is known that there are several ways to sort the data of a collection, some examples are the famous Bubble Sort, Insertion Sort and Selection Sort. I heard some algorithms are stable and others…
-
4
votes3
answers1163
viewsA: How to get the id of the onclick that was executed
It is possible to pass this in function call and capture element id in function. function ativafuncao(obj){ console.log(obj.id); } <button id="teste"…
javascriptanswered Jéf Bueno 67,331 -
5
votes1
answer447
viewsA: How to keep MVC application running on IIS express (in Visual Studio) after debugging?
You can keep IIS Express running your application even after you stop debug, so you need to disable the option Edit and continue in Visual Studio. Step by step: In the top menu click on tools…
-
2
votes2
answers3195
viewsA: Run JS on third party page
You can inject Javascript into pages using a feature called Userscripts. This is quite used, including, the Github organization with Stackoverflow members in English has some scripts that we…
-
6
votes1
answer116
viewsA: Why does "Undefined" occur even defining the exact element to be hit?
The method getElementsByClassName returns a collection of elements and not an element only. If you are sure there is only one element with this class you can use index 0 to get it. postado =…
-
4
votes3
answers1104
viewsA: How to create a property of an object dynamically?
Just add the property after creating the object using the syntax ['propriedade']. function AddSelectOption(name, item) { vm.item = { }; vm.item[name] = item; vm.filters[name].push(vm.item); }…
-
0
votes2
answers150
viewsA: Validation when editing existing registration?
It is only necessary to search this record in the bank to return his information. Take advantage of the method that searches the record to validate, removing the need to use…
-
7
votes3
answers1098
viewsA: Problem with Padleft
Theoretically, the string "newValue" should have the value "000002001795", right? No. The PadLeft serves to complete a string with any character, which is passed as the second parameter of the…
-
1
votes2
answers471
viewsA: How to leave the json of two or more object classes on the same level in Asp.Net MVC
Creating a new object with all the properties of the internal objects. You can create an anonymous type or create a class to represent this type. Using LINQ is very easy. var dados =…
-
0
votes1
answer178
viewsA: Code Conventions in C#
There is a. In the MSDN has the guide C# Coding Conventions (C# Programming Guide)…
-
3
votes1
answer728
viewsA: Code first Migrations does not work
The command Enable-Migrations only activates the migration resource. To update the database you need to create a Migration and update the base by running the following commands on Package Manager…
-
1
votes3
answers2316
viewsA: C# Make Enter key jump to either textbox or combobox field
Your code is correct and functional. The problem there is that your controls on container do not have the TabOrder correct. So, change the property TabOrder of your controls to follow the desired…
-
1
votes1
answer723
viewsA: Find the dataRow index
It is possible to use the method IndexOf() of DataTable foreach(DataRow row in DataTable.Rows) { int index = DataTable.Rows.IndexOf(row); } However, the DataTable will always be in order, so it is…
-
7
votes1
answer546
viewsA: Angularjs is not working
Any and all Angular application, needs the directive ng-app to work, in it you reference the module created by you to represent the application. Since Angularjs does not define a method for the…
-
3
votes1
answer450
viewsA: How to mark/warn a method is obsolete
Only use the attribute Obsolete. It is also possible to pass a custom message to the Warning and as the second parameter a boolean which defines whether the use of this method will only generate a…