Posts by Leonardo Bonetti • 5,313 points
231 posts
-
1
votes1
answer222
viewsQ: How to return a JSON with special characters in Flask?
When a JSON returns through the methods make_response(jsonify()), my browser can not understand the special characters, how to return JSON in UTF-8 encoding? Follows the code: @app.route('/',…
-
5
votes2
answers1119
viewsA: Where is Session stored in ASP.NET Core and how best to use it?
In ASP.NET Core a Cookie is provided to the User (client), which contains a Session ID that is sent to the server at each request, and the server uses the Session ID to fetch data in the session.…
-
4
votes1
answer129
viewsA: How to find a specific id within a list?
As a whole id is single that is, you can only have one id = "1" on your page, you could do so(much simpler): function SetBackgroundRed(id){ $("#"+id).css("background", "red"); } pagina_atual =…
-
1
votes2
answers67
viewsA: select input according to previous option
To receive the value of select use: $(this).find('option:selected').val(); option:selected selects the active item on select and val() receives the value of your select, then just use the if…
-
1
votes1
answer121
viewsA: Remove options from Google Maps
Try to add that: var styles = { default: null, hide: [ { featureType: 'poi.business', stylers: [{visibility: 'off'}] }, { featureType: 'transit', elementType: 'labels.icon', stylers: [{visibility:…
-
0
votes1
answer29
viewsQ: How to add parameters in the WHERE of a Procedure without using IF?
I have the following Query: CREATE DEFINER=`db`@`%` PROCEDURE `RelatorioComissoesByDate`( IN initialPeriod DATETIME, IN finalPeriod DATETIME, IN FK_Corretora INT, IN NomeCliente VARCHAR(256), IN…
mysqlasked Leonardo Bonetti 5,313 -
6
votes5
answers146
viewsQ: Is there a disadvantage or is it harmful to use null types?
I always have trouble receiving null values from the database because I forget to use the cancellable types and face the same problem: The type cannot be null This usually happens with attributes…
-
0
votes2
answers70
viewsQ: Is it better to use overloading or add an "if" with the optional parameter?
I have a method in which an attribute may not be used In this case if the value passed is not empty it adds the parameter to my email public async Task<bool> SendEmail(string to, string…
-
1
votes1
answer215
viewsQ: How to access Ihostingenvironment outside of the Controller in ASP.NET Core?
I’m updating an ASP.NET Framework API to ASP.NET Core and I’m stuck in a problem. No. NET Framework used the following: public GmailConnection(){ serverCredentialPath =…
-
0
votes1
answer128
viewsA: Is it possible to "debug" my application inside the server?
To solve this problem I simply use the Log4net, is a library that once configured, can write log files wherever and however you want. [Developing example]…
-
0
votes1
answer82
viewsA: What is the build flow of the . NET framework?
MVC: Model, View, Controller. Model: Application logic layer is where you put your application’s business rule (using C# or Vb.net for example) is where you manage data, logic and application rules.…
-
2
votes2
answers438
viewsQ: Route mapping does not work in ASP.NET Core 2.2
I have always used ASP.NET MVC 4 and now I am learning ASP.NET Core in version 2.2, I am doing some tests and I noticed that the routing is not working. I am using the standard design that is…
-
0
votes1
answer84
viewsQ: Website and database on the same machine, localhost or ip?
I have a website and database running on the same machine. And I use the following connection string: <add name="cs_name" connectionString="server=227.117.126.60;User…
-
4
votes2
answers123
viewsQ: How does a method with the same name return more than one object type?
I am implementing the Google Drive API and I came across the following situation: var fileMetadata = new GoogleDriveAPIV3.Data.File() { Name = "folderTest/testeUpload.jpg" };…
-
1
votes1
answer130
viewsQ: How to know if a file exists through its url without needing to download it?
I have a file list, and I need to know if it was uploaded to a storage facility. The idea to facilitate the process is to concatenate the file name, generate a URL and try to download the file, if…
c#asked Leonardo Bonetti 5,313 -
0
votes0
answers56
viewsQ: How to know the size of an object in memory ? c#
Just to put it in context, I’m upgrading an image search engine and need to save the previous search to the session: public static void SavePreviousSearch(APIStandardSearchResponse search) {…
c#asked Leonardo Bonetti 5,313 -
3
votes0
answers645
viewsQ: Ajax always returns HTTP error Error 404.15 - Not Found ASP.NET MVC 5
I use ASP.NET MVC 5 and developed a website, when I execute the following Ajax request: $.ajax({ method: "POST", url: "/Galeria/AddGaleriaItem", data: { ID: galeriaID , ObjectString:…
-
2
votes3
answers38
viewsQ: How to instantiate Webheadercollection using object initializers?
I’m making a requisition with the WebClient and would like to know if it is possible to add a Header within the class instance WebClient, example: WebClient client = new WebClient(){ Encoding =…
c#asked Leonardo Bonetti 5,313 -
1
votes0
answers150
viewsQ: How to return a file through my API configured in ASP.NET MVC 5
I developed an API that searches images and now I need to deliver the files to download, so I created the following code: public HttpResponseMessage Download(string id) { Download download = new…
-
2
votes2
answers119
viewsQ: How to shuffle a list of objects through a default value?
I have the following object: public class Object{ public String ID{get;set;} } And in a moment in my code I get a list of them: List<Object> objs = new List<Object>(); objs.add(new…
c#asked Leonardo Bonetti 5,313 -
3
votes2
answers96
viewsQ: Readalltext returns Chinese characters
I have a file. 55GB sql and needed to run line by line, but as I cannot load a file of this size, I divided into 543 100MB files named as Imagens<NumeroSequencial>.sql. So I made a code that…
c#asked Leonardo Bonetti 5,313 -
2
votes3
answers204
viewsQ: Update app.config or web.config via code
I am developing a robot that reads all lines of various files contained in a folder. But I need to know which was the last file and line read so I can resume when I need to. I thought I’d put it in…
c#asked Leonardo Bonetti 5,313 -
2
votes2
answers240
viewsA: Compare a field in the same table
Using GROUP BY to group by CPF and HAVING COUNT where the number of equal CPF is greater than 1: SELECT ID,Nome FROM Usuarios GROUP BY CPF Having COUNT(CPF) > 1; Then you get the ID’s and delete.…
-
1
votes1
answer95
viewsA: How to send an "Email Marketing" in ASP . NET?
You already have everything done in your code, there is no need for a framework for sending. You set message.IsBodyHtml = true; this causes email servers to read the syntax of your email as HTML. So…
-
6
votes1
answer53
viewsA: Difference between Executequery, Sqlquery and Executesqlcommand
Executesqlcommand: Executes a command, not for queries, or you will use to INSERT/UPDATE/DELETE. Executequery: Execute a query with parameter, first receiving the Query and then the parameters as in…
c#answered Leonardo Bonetti 5,313 -
0
votes2
answers158
viewsQ: How do I always return the same View, independent of Controller and Action?
I created a View calling for Manutencao that displays a maintenance page. And whenever the Index is called I display it. public class HomeController : Controller { public ActionResult Index() {…
-
4
votes1
answer83
viewsQ: How does the compiler know that class x is an extension?
In this example, I create a class extension method DateTime in the c#: static class DateTimeExtensions { public DateTime PrimeiroDiaDoMes(this DateTime data) { return new DateTime(data.Year,…
-
0
votes1
answer60
viewsQ: How to specify a white space in the AWS CLI S3?
Use Powershell or CMD to execute a command on AWS CLI S3, the command I execute is this: aws s3 cp s3://repositorioimagens/ampliacao/BR/1022-IKON IMAGES/STOCK239/ . --recursive The problem is that…
-
0
votes3
answers57
viewsQ: I cannot return data from an asynchronous Ajax
I make the population 4 HTML select with Ajax, however I’m having trouble returning the files, I tried to do it asynchronously only it was not good because the user can see each select being…
-
0
votes1
answer70
viewsQ: How to run a method on startup of ALL Controllers?
I have a static class that carries language in relation to cookie stored or the URL. Throughout controller I have to insert once the following method: protected override void…
-
1
votes1
answer267
viewsQ: How to mix parameters within an HTML.Beginform ASP.NET
I got the following Html.BeginForm(Don’t take into account if it’s incorrect is a legacy code and I can’t refactor it now). using (Html.BeginForm("Confirm", "Download", new { ContributorID =…
-
0
votes1
answer289
viewsQ: Lockar SELECT when I do an UPDATE - Sqlserver
Let me give you an example of what I’m doing, but the question really is at the end. I have a table with 4.100.000 records and I am creating a robot that reads this data and exports it to MYSQL (not…
-
2
votes1
answer1018
viewsQ: How to run more than one command in the powershell?
I have the following command of AWS Cli that runs on Windows Powershell and downloads a specific folder inside a S3 Bucket: aws s3 cp s3://rfcarga/RF73 . --recursive But I have other collections of…
powershellasked Leonardo Bonetti 5,313 -
1
votes1
answer8509
viewsQ: How to decrease the file size . zip generated by Dotnetzip?
Using the library Dotnetzip, I am zipping a folder with two image files (can be JPEG, EPS or AI) exactly equal (for test effect), each with 7.25 MB. I get the. zip file with the size of 14.3 MB.…
c#asked Leonardo Bonetti 5,313 -
2
votes1
answer147
viewsQ: How to know which part of the code an exception happened by looking at Visual Studio Output
I realized that in some requisitions the output of mine Visual Studio displays some messages such as this: Exception generated: 'System.Collections.Generic.Keynotfoundexception' in mscorlib.dll…
-
0
votes1
answer43
viewsQ: How to insert an item before and outside another item?
How to insert an item via Jquery so that it is BEFORE and OUT of a specific item (accepted edits to improve the way you ask). The following example inserts before, but inside the item…
-
0
votes1
answer61
viewsQ: It is possible to generate routes dynamically in ASP.NET MVC4
I am fixing some URL’s of my site and need to create several different routes for each page, for example: routes.MapRoute( name: "ComoVenderMinhasImagens", url: "como-vender-minhas-imagens",…
-
0
votes0
answers82
viewsQ: How to log a log through log4net when using the Task Scheduler to start a console application?
I compiled a console application in c# that has log4net (which is already working normally when I run the app) and configured through Windows Task Scheduler to run the application console every day…
-
1
votes1
answer241
viewsA: Accessing a list/array in a JSON URL
Just repeat the name of the list variable that appears in your Controller, in your case keys, when the controller receives the request it will know it is a list and automatically convert.…
-
0
votes2
answers288
viewsA: Open Page after Progressbar reaches 100%
If I understand correctly, just use the command window.open() within the if (width >= 100) passing within it the url of your page and the way it will open:…
-
1
votes3
answers163
viewsQ: How to draw a ribbon(gift loop or label) on a div?
How do I draw this green (Ribbon) loop in the top right corner of the center div? I couldn’t find a way to do it, could someone help me with that? After the answer I can edit the question to make it…
-
1
votes1
answer147
viewsA: Pass two sets of AJAX values to controller
Just by unifying the two objects within one, Ajax only passes one object to the Controller... var model1 = objectifyForm(model); var _objetoUnificado = {Model:model1 , Valores:valores}; //passar…
-
4
votes1
answer2517
viewsA: What is the difference between Document.querySelector and getelementsbytagname?
I’ll explain one by one and then the difference between them. document.querySelector(): Returns only the first element with the properties CSS inserted as a parameter and can only be used in the…
-
13
votes2
answers298
viewsQ: Does the IP influence the ranking of the site?
I wonder if IP influences ranking in Google. I recently migrated an Azure website (exclusive IP) to a shared hosting (shared IP) and the site fell from position (page 1.2 and sometimes 3 to page…
seoasked Leonardo Bonetti 5,313 -
2
votes1
answer80
viewsQ: How to replace COUNT(*) in innoDB
I migrated data from a bank Myisam for Innodb and some VIEW were extremely slow (on average 15x slower), after much research found that answer from @Maniero and in it he makes a comparison between…
-
1
votes2
answers187
viewsA: Turn IP number into location
It’s quite simple, there are several websites that provide this type of service via API, one of them is the ipstack which I have found and is free (max 10,000 requests per month). The advantage of…
-
0
votes1
answer79
viewsQ: Problem with customErrors configuration ASP.NET MVC 4
I need to set up a generic error page for my site, added the following code in the web config: <system.web> <trust level="Full" /> <customErrors mode="On"…
-
0
votes1
answer43
viewsQ: How to compare more than one column in an IN clause?
There is a way to compare >= 2 columns in a clause IN kind of like comparing objects? For example(Will give error so the question) SELECT * FROM Usuarios1 WHERE Nome,Sobrenome IN(SELECT…
sql-serverasked Leonardo Bonetti 5,313 -
5
votes1
answer1277
viewsA: SSL/TLS error when trying to perform Cielo API transaction
After a lot of research I managed to solve the error message by inserting the following line in the function Execute: System.Net.ServicePointManager.SecurityProtocol =…
c#answered Leonardo Bonetti 5,313 -
2
votes1
answer1277
viewsQ: SSL/TLS error when trying to perform Cielo API transaction
All week long I have had problems in calling their API, I get only the following error: The underlying connection was closed unexpected error in a send My code called in Restsharp is: public…
c#asked Leonardo Bonetti 5,313