Posts by Jéf Bueno • 67,331 points
1,254 posts
-
1
votes1
answer111
viewsA: How to create metadata (custom data) on an Laravel route?
There is, you can capture using $request->route()->getAction()['__title__']. For example class HomeController { public getIndex(Request $request) { $title =…
-
2
votes1
answer113
viewsA: Relationship in table with Include does not work
The Include that receives an expression is an extension method and is in the namespace System.Data.Entity, failed to include it. using System.Data.Entity;…
-
5
votes4
answers7010
viewsA: jQuery delete the last character typed in an input
You can use the slice() or the substring() to create a new string from the first character to the penultimate character and then make this new string is the new value of input. About the methods:…
-
5
votes4
answers5886
viewsA: Git bash does not accept paste command
In Git Bash (and various other software) Shift + Insert paste text in clipboard.
-
2
votes1
answer49
viewsA: Generate values dynamically in a table
Perform the function organizarIndices as soon as the page has been loaded and ready organizarIndices(); function organizarIndices(){ var table = document.getElementById('tabela'); var total =…
-
16
votes6
answers751
viewsA: Numbers and your friends
Kotlin (151 bytes) fun main(args: Array<String>){val n=1500;print((2..n).filter{i->d(d(i))==i&&i>d(i)}.map{"${it}-${d(it)}"})}fun d(n: Int)=(1..n-1).filter{n%it==0}.sum()…
-
17
votes6
answers751
viewsA: Numbers and your friends
C# (LINQ way) 284 bytes Disclaimer: It will only work on interactive consoles, like Linqpad or C# Interactive Visual Studio, because no public class was defined for the method Main() static int…
-
2
votes4
answers10576
views -
1
votes1
answer62
viewsA: Increment object to HTTP request
Capture the request stream and write your JSON on it. var payload = UTF8Encoding.UTF8.GetBytes(seuJson); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Headers.Add("...");…
-
2
votes1
answer27
viewsA: Migrations adds the letter S in the table name
It is the standard rule of pluralization of class names. You can disable this in the method OnModelCreating, with the following code…
-
1
votes1
answer168
viewsA: Returns query value in a variable
From the comments, I think that’s what you need public ActionResult Adicionar(RotaModel viewModel) { var rotas = ConsultaCarro(viewModel.NVeiculoId); // Aqui busca todas as rotas deste veículo var…
-
1
votes1
answer119
viewsA: How to remove a selected item in treeview c#
There are no properties Items and SelectedItem in a Tree view of Windows Forms. You need to use Nodes in place of Items and SelectedNode in place of SelectedItem. See the official control…
-
8
votes1
answer416
viewsA: How to format Datetime in C#?
The ToString accepted format. Realize that it is necessary to escape the word "from" because the d would be considered as day and which date formats are sensitive to the application culture, so it…
-
2
votes1
answer685
viewsA: How to increment a string variable c#
Option 1 Doing it right and changing the type of the variable malcoins public int malcoins = 0; In the click event private void button1_Click(object sender, EventArgs e) {…
-
1
votes1
answer231
viewsA: How to change the size of a screen through an event in C# WPF
You also need to define the properties MinWidth and MinHeigth. private void button_Click(object sender, RoutedEventArgs e) { MinWidth = novaLargura; Width = novaLargura; MinHeight = novaAltura;…
-
5
votes2
answers1757
viewsA: Hide password on terminal
You can use the getpass.getpass import getpass print('É necessário informar suas credenciais para se comunicar com a API') email = input('Email: ') password = getpass.getpass('Senha: ')…
-
3
votes1
answer37
viewsA: Why can I invoke functions without parentheses in VB.NET?
I do not know if someone will be able to answer something better than: it is so because it was defined that way. Whoever developed the language thought it was a good idea and decided that once it…
-
1
votes2
answers58
viewsA: Scope of a service
The problem there is the scope. The this within the then does not refer to the same this that you created the function, remove them or assign this to some variable to reference the external scope.…
-
7
votes3
answers4235
viewsA: Difference between Console.Write() and Console.Writeline()?
Console.Write writes one or more values on output. Console.WriteLine always adds a line break character after writing something on output. This causes anything that is written later to be in the…
-
4
votes1
answer49
viewsA: Error inserting Data with Angularjs
This was long obsolete and was removed in the current versions of Angularjs. See official documentation. Now we need to use .then passing as first parameter the callback if the request is successful…
-
2
votes1
answer161
viewsA: Scrollbar centering on its own
It really is the standard behavior of scroll, trigger the event ScrollToControl passing the control that was clicked. You can overwrite this event in the container of its elements by returning…
-
1
votes4
answers1753
viewsA: Comparing list indexes in python?
This error means that the variable lateral is not a collection (array, list, etc.). That is, it does not have an implementation of the method __getitem__. You declared a array at the beginning of…
-
27
votes1
answer4649
viewsQ: What is it, Kotlin?
I’ve heard a lot about Kotlin. What is this? Is it a programming language? If so: What are the main features? Can I program on any operating system? And run? How do the guys in it work? I don’t want…
-
1
votes3
answers620
viewsA: Check when global variable changes
As it is a seemingly simple case, it is possible to define this in the method set of property. public class SuaClasse { private bool houveAlteracaoBd; public bool HouveAlteracaoBD { get { return…
-
2
votes2
answers347
viewsA: How do I make my Dropdownlistfor equal to Select
You can set the value of the property Disabled of SelectListItem as true. For this to work, you will need to change the creation of the drop down list a little. Instead of using an object of the…
-
13
votes2
answers1301
viewsA: Differences between compiling and recompiling?
If you’re talking about C# and VB.Net (I can’t say otherwise): the main difference is that the rebuild (recompile) makes a clean in the project and then make a build (compile). As the build will…
-
2
votes1
answer488
viewsA: Delete a foreach and replace the result in a lambda expression in a method
You can do it using the method Any(). Some important points to note in your code: No need to call AsEnumerable() and then ToList(), you can use only one of the two methods; Going even deeper, you…
-
2
votes1
answer360
viewsA: How to put the background color in the first line cells using NPOI?
Create a new style, define the properties FillPattern as FillPatternType.SOLID_FOREGROUND and FillForegroundColor with the color you want. Then set this style as CellStyle of the cells of header.…
-
12
votes3
answers3678
viewsA: Can I upload folders along with the code on Github?
You can, as long as these folders are not listed in the . gitignore file and they are not empty they will be sent to the repository. Don’t forget to add the folders before commit $ git add pasta/ If…
-
6
votes1
answer2702
viewsA: How to extract and compress files with System.IO.Compression.Ziparchive in c#?
In the first two cases you need to note that it is necessary to "open" the zip file and at all times it is necessary to release the resources using the Dispose() (the using calls the method…
-
3
votes1
answer67
viewsA: How to create optional parameters in Soapserver
Specifying in the function that they are optional. This is done by setting a default value for the parameter in the function signature. class Bar { public function getDrink($age, $money, $name =…
-
4
votes2
answers851
viewsQ: Sort items from a Collection from a preset value
I have a Collection of the Eloquent and I would like to order it through two fields at the same time being one of them a predefined value. Ex.: this one Collection has several objects of the type…
-
1
votes2
answers428
viewsA: Hover and Disabled at the same time
You can use the :not(:disabled) in the CSS. .btn-destaque { padding: 25px 15px 25px 15px; background-color: #7857a5; color: white; border: 1px solid #8c37ff; } .btn-destaque:disabled {…
-
7
votes1
answer87
viewsA: Java int[] arraylist
The method Arrays.asList returns a fixed-size list. See documentation. That is, you cannot add elements to it, you cannot remove elements from it and you cannot touch its structure. You can simply…
-
2
votes1
answer5713
viewsA: Change input value with javascript
Pass this as an argument from onchange and change the method to work with the element and not just the value. So you can change the property value. function verifica(el){ if (el.value > 10 ||…
javascriptanswered Jéf Bueno 67,331 -
6
votes1
answer804
viewsA: Change color icon button javascript
Using CSS with pseudo class disabled. You set the color in the CSS, and disable the Javascript button normally. See working: document.getElementById('desativar').addEventListener('click', function()…
-
2
votes2
answers1154
viewsA: How to count the elements of a jquery li
You can use the method childrenthat returns all the children of a given element and get the length his. $('li').each(function() { var qtd = $(this).children().length; console.log(this.id, qtd); });…
-
4
votes2
answers280
views -
2
votes2
answers1578
viewsA: How to change position of all matrix elements by changing the row number by the column?
Your algorithm doesn’t seem to make any sense to me. Transpose an array, will reverse the size of it (rows turn columns and columns turn rows). The right thing would be to do something like: public…
-
3
votes2
answers1028
viewsA: How to query containing MAX and COUNT via LINQ
The Count in SQL, when you receive a field, returns the count of all lines table least those where the field passed is null. In the LINQ, the Count always receives a predicate and not an element, so…
-
16
votes2
answers670
viewsA: What is it, Prism?
Prisma is a Lua-based programming language and also an interpreter for this language. It is good to point out that the language is at an early stage and I did not find relevant information on how…
-
73
votes6
answers109646
viewsA: What does the error "Script execution disabled on this system" mean?
This is a Powershell security policy to prevent scripts malicious to be improperly executed on your system. Therefore, all scripts which are not signed will have their execution blocked. That is,…
-
6
votes2
answers94
viewsA: How to perform a Where using Entity Framework
Failed to assign the filtered query to ToListAsync(). Realize that the Where does not change the original collection, regardless of whether it is a list, a IQueryable or anything else, he returns a…
-
0
votes1
answer1786
viewsA: Syntax error, Unexpected 'class' (T_CLASS), expecting Identifier (T_STRING) - Remote Server Only
This is a problem in solving class names. The cause of this you yourself said in the question: PHP versions are different in development and in the publishing server. A priori you only have two…
-
1
votes1
answer36
viewsA: Delay in Angularjs used in file . cshtml
The cause of this is somewhat obvious. HTML is always run linearly, from top to bottom. This way, the HTML markup is being created even before your controller have the values filled. This is…
-
4
votes2
answers123
viewsA: Filter example in Angular 1
Just use an object to filter. angular.module('filter-app', []); angular.module('filter-app').controller('mainController', mainController); const itensSelect = [ { id: 1, nome: 'PlayStation 4' }, {…
-
2
votes1
answer173
viewsA: Initialization of attributes
Underneath the cloths there are no differences. In the end the instantiation of the attribute will be placed inside the constructor anyway. However, in the first case, it is impossible to deal with…
-
6
votes3
answers106
viewsA: Is there any way to interpret (parser) from a string Connection to an object?
How can you guarantee the format of string can do something like this: var cs = ConfigurationManager.ConnectionStrings["connString"].ConnectionString; var dicionario = cs.Split(';').ToDictionary(x…
-
3
votes1
answer70
viewsA: How to make a button that runs 2 events?
There are several ways to do this and normally you won’t need to make the button run more than one event. A simple way is to always keep the next value saved in a variable.…
javascriptanswered Jéf Bueno 67,331 -
2
votes1
answer403
views