Posts by Jéf Bueno • 67,331 points
1,254 posts
-
2
votes2
answers1299
viewsA: How to format a Double by swapping a semicolon and keeping 2 decimal places in VB.NET
The method ToString has an overload that accepts a CultureInfo as parameter. Pass this parameter using the culture you want. Dim valor = 5.89d valor.ToString(new CultureInfo("pt-br")) See working on…
-
1
votes1
answer45
viewsA: Error opening View with values loaded directly from class
Read the error: Invalidoperationexception: The model item passed into the Viewdatadictionary is of type 'System.String', but this Viewdatadictionary instance requires a model item of type…
-
0
votes1
answer35
viewsA: Create and maintain a loadbar while a function is called
Yes, it is possible. Basically you will control the "Loader" using the directive ng-if. Take an example: angular.module('app', []).controller('mainController', mainController); function…
-
1
votes1
answer72
viewsA: HTML vs markup auxiliaries
There is some difference in what one HTML helper and one markup helper can do that the other cannot? No. The two were meant to work independently. Is there any recommendation, or good practice on…
-
1
votes1
answer832
viewsA: Error: Undefined object reference for an object instance
After this line var c = new Combustivel(); You need to instantiate a Veiculo in the object c c.Veiculo = new Veiculo(); You can also change the constructor of Combustivel for whenever an instance is…
-
1
votes1
answer95
viewsA: Perform a related table search on Laravel and page
You already have the relationship ready in models, just use the navigation property alunos in the model Turma. $turma = Turma::where('codigo', $codigoTurma)->first(); $alunos = $turma->alunos;…
-
8
votes2
answers62
viewsA: Search Object Array value
It is possible to use the methods filter and reduce. let filmes = [{ "Nome": "Harry Potter 1", "Preco": "50" }, { "Nome": "Harry Potter 2", "Preco": "60" }, { "Nome": "Harry Potter 3", "Preco": "70"…
-
3
votes1
answer78
viewsA: Shortcut key for PHP and Mysql paging
You can add a Listener for the event onkeydown in document and validate if the key pressed has code 37 (left arrow) or 39 (right arrow). 38 and 40 are respectively the codes of the up and down…
-
1
votes1
answer39
views -
4
votes1
answer1635
viewsA: Compressing Files in Powershell
Using Compress-Archive Compress-Archive C:\Origem -DestinationPath ('C:\Destino\arquivo.zip') Or using the class ZipFile of the . NET Framework Add-Type -Assembly "System.IO.Compression.FileSystem"…
powershellanswered Jéf Bueno 67,331 -
2
votes1
answer412
viewsA: How to replace string using another string containing Json?
You can deserialize JSON in a dictionary and then iterate over this dictionary to make substitutions in string of template. Note that in my example, I use the package Newstonsoft.Json to deserialize…
-
4
votes4
answers1976
viewsA: Remove numbers at the end of a Regex string C#
You can use the expression \d+$, she tries to find any digits that are at the end of string. Building an instance of Regex with this expression, you can validate the size of the substring which was…
-
6
votes1
answer70
viewsA: How to verify if a file containing a specific word exists?
You can use the function glob(). To get all ID files T9997012, you can use the wildcard *, for example: $array = glob('T9997012*.*'); In all other cases of the end of the question you can use the…
-
5
votes2
answers89
viewsA: How to iterate on a model in C# with variables that have number?
The right thing would be to turn this lot of properties into a collection (array, list or similar). public class Teste { public List<int> Campos { get; } = new List<int>(); } So you…
-
2
votes1
answer443
viewsA: Using SQL Query with Asp MVC5
I will give an answer based on what you said in the comments. First, to run a Count in a database table and return its value, you can use the method Count in the Dbset that represents the table…
-
6
votes2
answers2091
viewsA: Remove Repeated Integers List in Python
The set does just that. If you make a point that the type of the result is a list, just do the conversion of set for such a = [1, 2, 3, 3, 3, 4, 5, 6, 6, 7, 8] b = set(a) # Conjunto a partir de 'a',…
-
3
votes1
answer784
viewsA: Problems referencing a classlibrary from . net framework core - C#
It doesn’t. The two frameworks are different things and incompatible. For this there is the . NET Standard, you can make the class library have as target the . NET Standard and this will make it…
-
11
votes3
answers605
viewsA: How to give a Regex before a string? And select?
It is possible to do without regex capturing the character index : and then using the method Substring. Example: var str = "selecionar esta parte:outra coisa aqui"; var i = str.IndexOf(':'); if(i…
-
1
votes1
answer201
viewsA: Extension method(Wait() and Status()) does not work
The method Wait is a method of Task and respose is a string. Note that in the first code has the keyword await, this causes the task to be solved and the variable response be the type string. Your…
-
3
votes3
answers1700
viewsA: How to take the title of an HTML page and return its value in Javascript
Just use the property title in document. You can also use this property to change the title of the page. console.log(`Você está na página '${document.title}'`); console.log('Você está na página ' +…
-
4
votes1
answer60
viewsA: Sumasync return zero
What happens is that the Sum is being called in a IQueryable and this means that the implementation of this method is delegated to the preview of Queryable, ie - as you might imagine, who executes…
-
0
votes1
answer124
views -
4
votes1
answer1327
viewsA: Format monetary value with Angularjs
Please don’t do this kind of stunt. Do it the right way. Add the script angular-locale for the location you intend to use (I used en in the example) and then make use of the filter currency.…
-
0
votes1
answer39
viewsA: Starting with Angular
There’s a lot of things wrong there. First you need to create a module, then you need to register the controller in this module and, in order to be able to {{nome}} of view present something it is…
-
3
votes4
answers235
viewsA: Find out which div with the same class is larger
You can do this with a few lines of code using pure Javascript. Take an example: document.getElementById('bt').addEventListener('click', btClick); function btClick() { const divs =…
-
6
votes2
answers1387
viewsA: Name of fields of a generic object - Reflection
There is a class method Type called GetProperties public static void DescobridorDeNome<T>(T objeto) { var props = objeto.GetType().GetProperties(); foreach(var prop in props) {…
-
1
votes1
answer320
viewsA: Doubt about using a model in the view
The error describes the problem by itself. You can simply change the first line of the view to @model List<TSL.Models.GetPedidos> Other than that, the types are incompatible. Read the error:…
-
2
votes1
answer4309
viewsA: Subtract date from datetime
Yes, there is a more suitable way. The structure DateTime has the method AddMonths, to subtract a number amount is to use this method with a negative parameter. For example var data = new…
-
5
votes2
answers957
viewsA: What is the way to truncate a string in Csharp?
Why not create an extension method and be happy forever? You can read about them at Why use C extension methods#? public static class StringUtilsExtensions { public static string Trunc(this string…
-
7
votes4
answers814
viewsA: Why can’t we return a void call in a void return waiting method?
'Cause it doesn’t make any sense. If the method is void, nothing will be returned, then it makes no sense to try to return something, even if it is the return of a function that is also void. If you…
-
3
votes1
answer27
viewsA: How to escape Sqldatasource.Filterexpression?
Use parameters in query. DS_Grid.FilterExpression = "CodOrdemServico = CodOrdemServico AND Cliente LIKE '%{0}%'"; DS_Grid.FilterParameter.Add(new ControlParameter("Cliente", "TB_Cliente", "Text"));…
-
0
votes1
answer145
viewsA: Entity Framework. Select only 1 from a list in Include?
It is impossible. The function Include does not support these types of operations. You can use the Select and return an anonymous type containing the main record, phone and email. Example: var lista…
-
2
votes2
answers107
viewsA: How to make this type of signature in C#?
The block <? extends Teste> limits the type only to classes that inherit from Teste. In C# if this expression would be where T : Teste. This T can be anything, it is just an identifier for the…
-
0
votes1
answer100
viewsA: Change database instance
Open the file web.config and look for the section connectionStrings. There will probably have a tag add containing the string connection pointing to Localdb. Change it to look like this - obviously…
-
2
votes1
answer41
viewsA: Find specific data within a List
The solution to your problem can be divided into two distinct parts. The first part is to create a filter to get only records that are within the date range that you specified. This can be done…
-
2
votes3
answers436
viewsA: How to order the query in the same order as an array used in Wherein?
You can create a clause order by taking the array as a basis. $ids = [12, 5, 1, 8, 16]; $orders = array_map(function($item) { return "id = {$item} desc"; }, $ids); $rawOrder = implode(', ',…
-
1
votes3
answers434
viewsA: Synchronous query in Sqlite using Ionic
You can pass a callback to be executed after the request, like this: public requisicaoXPTA(callback) { this.database.executeSql("SELECT * FROM tbl_xpta", []).then((data) => { callback(); },…
-
2
votes1
answer18
viewsA: How to delete the line it automatically generates in a gridView windowns form
Set the value of the property AllowUserToAddRows for false. If you’re gonna do it for the way dedign, search for property in window properties when selecting the control. Or, at runtime, do this…
-
4
votes2
answers155
viewsA: Convert date 20171130 to format 30/11/2017 in string
It is possible to use DateTime.TryParseExact to convert the string in an instance of DateTime and then do any formatting. var strDate = "20171130"; // Este é o valor recuperado do banco DateTime…
-
2
votes1
answer345
viewsA: Converting E MMM dd HH:mm:ss Z yyyy to dd/MM/yyyy HH:mm:ss c#
If you are sure that the format will always be the same, you can make the conversion using TryParseExact DateTime dateValue; DateTime.TryParseExact(data, "ddd MMM dd hh:mm:ss BRT yyyy", new…
-
7
votes1
answer1708
viewsA: Calculate php percentage
It’s more of a math problem than PHP. Just make a rule of three and act in the code. The rule of three is simple, I believe you already know, but I’ll leave logic as a demonstration Se 1700 é 100%,…
-
0
votes1
answer24
viewsA: how to leave only input from a dialog with draggable disabled?
Just add some selector to this input on the property cancel. Take an example: $('#drag').draggable({ cancel: '.dont-drag' }); div { height: 400px; width: 400px; } <script…
-
7
votes2
answers6139
viewsQ: How to install . NET Core packages from Nuget using VS Code?
I am using VS Code to develop a . NET Core project and would like to know how to install packages in Nuget on it. In Visual Studio, there is a specific terminal for this, the Package Manager…
-
12
votes2
answers6139
viewsA: How to install . NET Core packages from Nuget using VS Code?
Using the command dotnet add of the . NET Core CLI You can do this using the . NET Core CLI command dotnet add, the option package and the package name right after. For example, to add the latest…
-
1
votes1
answer1350
viewsA: Convert file to Array of bytes
What you’re trying to do doesn’t make sense, Encoding.GetBytes() is to generate the array of bytes string. The very one FileUpload has a property FileBytes which contains the bytes of the archive.…
-
1
votes1
answer37
viewsA: How to send objects to function
You do not need to use type to pass a parameter registraUsuario($usuario, $conexao);
-
3
votes1
answer324
viewsA: Mounting a query with Laravel
That’s one of the cool (and confusing things about Laravel). These methods do not exist, they are short versions of the method where, what comes after this keyword is the name of the column that is…
-
8
votes2
answers690
viewsA: How do I convert PNG to JPG in C#?
One solution is to open the image and then save as JPG Image png = Image.FromFile(@"C:\caminho-da-imagem.png"); png .Save(@"C:\caminho-da-imagem.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); Note…
-
9
votes1
answer154
viewsA: How to leave this function javascript
Using parameters function centralizar(innermap, a, b, c) { innermap.flyTo([a, b], c); } Or maybe use a array instead of b, c. Kicking the parameters are coordinates and zoom, would be function…
-
2
votes5
answers212
viewsA: Get array object by description in index
What you’re looking for is a data structure called Dictionary, she is nothing but a table hash. A table hash is a linear data structure with constant access complexity, so there is not much loss of…