Posts by George Wurthmann • 4,415 points
170 posts
-
2
votes3
answers297
viewsA: Concatenate and convert string array into int
In a more 'mathematical' way you can do so: public class Program { public static void Main() { int[] matriz = new int[3]; matriz[0] = 2; matriz[1] = 5; matriz[2] = 0; int result = 0; for(int i =…
c#answered George Wurthmann 4,415 -
6
votes4
answers152
viewsA: How to know the exact line of a Nullreferenceexception error when creating a new instance of an object with multiple properties
You can instantiate the object as an example below. So you can debuggar (debug) line-by-line: OcorrenciaRelatorioDTO ocorrenciaRel = new OcorrenciaRelatorioDTO; ocorrenciaRel.Id = ocorrencia.Id;…
c#answered George Wurthmann 4,415 -
3
votes1
answer262
viewsA: Make Google-Hartbar Preview Start From Scratch
Actually your chart already starts on 0, it only generates the negatives when none of the values is greater than zero. I can’t tell why this occurs, but you can get around using the hAxis.ticks to…
-
1
votes1
answer137
viewsA: mvc application with visual studio code, Connection Strings
As you did not specify in the question, it follows the way you could do in the Startup.Cs: public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; }…
-
1
votes2
answers290
viewsA: Doubt in passing parameters via AJAX to ASP NET CORE Action
You already managed to solve your problem, but I leave here some corrections in the settings of your AJAX, maybe it helps you: var id = $("#statisticId").val(); console.log(id); $.ajax({…
-
0
votes1
answer65
viewsQ: Map JSON to array-specific format for Google Charts line chart
I have a JSON in the following format: [ { "Countrys": [ "Cyprus", "Finland", "Germany", "Grenada", "Haiti", "Ireland", "North Korea", "Swaziland", "Turkmenistan", "Zambia" ], "ListDataPerYear": [ {…
-
1
votes2
answers425
viewsA: How to convert JSON to array to column chart in google Charts?
I converted using arrays.map as an example below: const data = [ { "Pais": "Qatar", "Valor": 683900 }, { "Pais": "Luxembourg", "Valor": 519360 }, { "Pais": "Iceland", "Valor": 476710 }, { "Pais":…
-
0
votes2
answers425
viewsQ: How to convert JSON to array to column chart in google Charts?
I have a JSON in the following format: [ { "Pais": "Qatar", "Valor": 683900 }, { "Pais": "Luxembourg", "Valor": 519360 }, { "Pais": "Iceland", "Valor": 476710 }, { "Pais": "Bahrain", "Valor": 442990…
-
3
votes1
answer182
viewsA: How to pass data from a View to a Model
Your question has some problems and as you said yourself it is very likely that you are researching wrong or something that does not exist. The first thing you need to understand is the Model, View…
-
4
votes3
answers231
viewsA: how to insert a select command into the BD using c#?
I could try to give an answer that just solves your problem, but they’ve already done that in the other answer. Instead I’ll pass you off as you should be doing. Your code is unsafe, do not do your…
-
1
votes3
answers1448
viewsA: Converting word file to pdf
How there are two answers using the Interop, I decided to post a solution that does not use it, not needing Office installed on the server. You can do this using the Freespire.DOC. To install it use…
-
0
votes1
answer249
viewsA: Viewing PDF file after obtaining bytes
The simplest form in WinForms is using the component Web Browser. Example: public partial class Form1 : Form { public Form1() { InitializeComponent(); //No seu caso pode por direto o caminho do FTP:…
-
3
votes2
answers177
viewsA: Converting (Mapping) a List of an entity to another reference explitically
Having explicit conversions, just do the following: //Convertendo B para A List<B> listB = listA.Select(a => (B)a).ToList(); //Convertendo A para B List<A> listA = listB.Select(b…
-
2
votes1
answer903
viewsA: C# Read Excel Spreadsheet
In lines of Excel which are headers the dot (.) may cause some problems and it is replaced by the character of cowling (#). To fix you can replace the character . for #: GrupoFornecParceiro =…
-
1
votes1
answer165
viewsA: Dropdownlist in C# with Htmlhelper
If you want your property Type_user be a DropDownList you need to change it in your Model. It has to be a list of options, there are some ways to do this, but it can be a property of type…
-
1
votes2
answers130
viewsA: I have Error in viewModel ASP.NET MVC C#
The problem is you’re returning a ViewModel for your view that actually expects to receive a IEnumerable<ViewModel>. Review the model of his view. Correct for her to receive the value returned…
-
2
votes1
answer383
viewsA: Error deserializing Model JSON data
Your problem is you’re trying to deserialize a List and actually expects an object Coffin. Pay attention to this part of Exception: Cannot deserialize the Current JSON array (e.g. [1,2,3]) into type…
-
1
votes2
answers293
viewsA: Using Linq to sql, how do I get the generated sql query?
Do the following in your context: public DatabaseContext() : base("MeuContext") { //Trecho abaixo utilizado para ver as querys geradas pelo Entity #if DEBUG Database.Log = s =>…
-
0
votes1
answer161
viewsA: Download Bank Image with ASP.NET MVC5
Your controller DownloadAnexoOcorrencia is incomplete. I made two examples of how you can get the result you want: Example 1: public FileStreamResult DownloadImagem() { //Converter byte[] to Stream…
-
1
votes1
answer86
viewsA: Timestamp in C# for persistence in Sqlserver
You can use the type Byte[], following Microsoft’s own standard. [Timestamp] public Byte[] CreatedAt { get; set; } Defining the type of your field as Byte[] and using the attribute [Timestamp] it…
-
2
votes1
answer184
viewsA: Can you help me?
You really want to use oracle? Clearly you are making a mistake, because you are using Mysql commands, but the error shown is from oracle (ORA-00933). If you just remove the mydb. script and run on…
-
2
votes1
answer284
viewsA: Alternative to recover ASP NET MVC password
Answering your question: depending on how the password is stored is possible, but unsafe and not at all advisable. For this to be possible you would need: Your password is stored unencrypted in the…
asp.net-mvcanswered George Wurthmann 4,415 -
3
votes2
answers86
viewsA: Problem when changing field focus
Apparently there is a bug that has not been fixed by microsoft on the AutoCompleteSource. I did a very simple test and actually using the textBox1.AutoCompleteSource =…
-
0
votes2
answers68
viewsA: Show how much it costs in total
You made a TextChanged for his textBox1, but it will never have the text changed since it is Enable = false. I’m referring to this excerpt, where textBox1.Text only gets the value of SomaTotal if…
-
1
votes1
answer1566
viewsA: Error: The provider 'ORAOLEDB.Oracle' is not registered on the local machine
Usually the problem is just the lack of registration even. Even already exists answers on the website that solves that same problem. The standard solution is usually the steps below, according to…
-
1
votes1
answer1093
viewsA: Name does not exist in the current context
Although you haven’t posted yours aspx still its error is quite obvious. It explicitly states that the gvFiles does not exist in the current context. It would appear gvFiles is a Grid View, due to…
-
0
votes1
answer123
viewsA: Why can’t I hash the password in my Seed method?
I couldn’t find a way to make the hash work using my custom membership code. It’s even obvious, but I’ll leave the form that I agreed to. Instead of using the section below: string password =…
-
1
votes1
answer304
viewsA: Avoid duplicated id in list c#
I’ll show you a way you can achieve what you want to do. That way you can use the Linq to check if the entered id already exists in your list: //Usando linq para verivicar se o id digitado já existe…
c#answered George Wurthmann 4,415 -
0
votes1
answer161
viewsA: Error connecting to database using Entity Framework
I believe you just need to add SslMode=none in your string Connection. Take an example: string connectionString = "ServerDoMeuBD;Database=MeuBD;Uid=Usuario;Pwd=Senha;SslMode=none;"; Read more about…
-
7
votes3
answers1590
viewsA: Check that all fields of an entity is null
The answers already solve your problem and are very good. But I would like to contribute one more way to do also using reflection. The solution is the same after all, but I think it’s simpler and…
c#answered George Wurthmann 4,415 -
3
votes1
answer123
viewsQ: Why can’t I hash the password in my Seed method?
I’m trying to use my method seed below to create a user in the database when it is created: protected override void Seed(CodingCraftMod1Ex4AuthMembershipContext context) { string password =…
-
5
votes1
answer146
viewsA: LINQ Lambda | Query Syntax VS Method Syntax Performance
Yes it is the same performance for your example. And according to the documentation: Most queries in the LINQ introductory documentation (Consultation Language integrated) is written using query…
-
0
votes2
answers646
viewsA: Select folder in directory in input
This is not possible with HTML or Javascript due to security issues. There are solutions that try to implement this in browsers but that do not work well in all browsers, not being at all feasible.…
asp.net-mvcanswered George Wurthmann 4,415 -
1
votes1
answer763
viewsA: Error making UTL_HTTP request. ORA-28759: Failure to open file
I have no experience with Wallet manager, but based on some cases I found on the internet I will try to help you with the error ORA-28759. The Wallet Manager gives read, write and modify permissions…
-
3
votes1
answer1258
viewsA: How to fix the percentage on top of the chart using Chartjs?
You don’t need to change anything in your chart code if you want to show only quantity, just include reference to chartjs-plugin-datalabels.min.js. But since you need the percentage, it is necessary…
-
4
votes1
answer552
viewsA: How to add caption to a chart using Chartjs?
I just changed the end of your code: Includes the generateLegend() to generate a legend in the new div that I added (legendDiv). Here you can read about the documentation for Chart JS V1. var data =…
-
2
votes1
answer243
viewsA: Pass value from a select to Html.Beginforms - Asp . Net
Why did you put your selection field <option value="@valor">@valor</option> out of your form? If you want to send it to the controller it makes sense to leave it on your form. If I…
-
2
votes2
answers81
viewsA: Error while searching with Entityframework
See if this solves: [HttpPost] [Route("GetProdutos/id")] public async Task<ActionResult> GetProdutos(int? id) { var listaProdutos = new List<Produto>(); var task = Task.Run(() =>…
-
2
votes2
answers1201
viewsA: Display a message on command output
To print on the console just use the DBMS_OUTPUT.put_line: begin DBMS_OUTPUT.put_line('Minha mensagem'); end; Your code would look like this: declare cont integer; tabela varchar2(100) := 'PESSOA';…
-
1
votes1
answer198
viewsA: How to disable ZIP Mask to save only Typed numbers when performing a Post - Asp.net MVC
How do you want to keep the dash, instead of changing your mask to data-pattern="[[99999999]]" change the Maxlength of the field. [MaxLength(9, ErrorMessage = "O campo {0} deve ter no máximo {1}…
-
0
votes3
answers551
viewsA: Convert string to integer positions
One string is a array of char. So when you access the numero[i] you are accessing a value of type char. Read about char, which is nothing more than a 16-bit numeric value representing a character.…
-
3
votes1
answer501
viewsA: Fill in date and time in View mvc 5 Razor
Javascript With Javascript just use the new Date(). I did the example below by taking the date, formatting with the toLocaleString() and playing in an input text field. var dataAtual = new Date();…
-
2
votes1
answer89
viewsA: UTF8 invalid codec in python
This is because you are actually reading data that is not in UTF-8. In your case in the error it is possible to see that this occurs in the character 'Ã' and to search for the character 0xe3 will…
pythonanswered George Wurthmann 4,415 -
6
votes2
answers419
viewsA: Export graphs from an Excel spreadsheet without Interop
Spire.XLS I made a solution using the component Spire.XLS the This is the developer’s site and there’s a good documentation on the component. You can install the Spire.XLS by Nuget: Install-Package…
-
0
votes3
answers8133
viewsA: Count number of elements from a python list
Another way would be to use the for, as Wictor proposes in the comments: i = 0 lista = [ 'A','B','C','D'] for x in lista: i+=1 if x == 'C': break; print(i) But using index() Wictor’s answer is…
pythonanswered George Wurthmann 4,415 -
1
votes1
answer1783
viewsA: Database swapping accent for "?"
As I suggested in the comments, you can use this query to see your Oracle BD settings: SELECT * FROM NLS_DATABASE_PARAMETERS; Your bank is with the settings: NLS_CHARACTERSET : WE8MSWIN1252…
-
1
votes1
answer44
viewsA: Compare existence of record with date and future date
I don’t know exactly what you want to do with the information. But from what you explained in the comment you want to validate Proximadata is within a period and also if for this same field there is…
-
1
votes1
answer53
viewsA: Recover Model List Passed by ajax through Formdata
The problem is here: data.append("grupo[campoLista]", "1,2,3"); You are passing as a string and not as an array. From what I understand formData.append does not support JSON, so my previous example…
-
1
votes2
answers177
viewsA: Upload file via FTP TLS
Have you tried using the Ftpwebrequest thus? FtpWebRequest requestFTP = (FtpWebRequest)WebRequest.Create(urlFTP); requestFTP.Credentials = new NetworkCredential(usuario, senha); requestFTP.EnableSsl…
c#answered George Wurthmann 4,415 -
2
votes2
answers679
viewsA: How to pass a parameter from one Action to another Action in the same Controller
return RedirectToAction("Index", new { id = maloteId }); With the above solution given by Pedro you will have to redirect this: /Controller/Index/maloteId But there are more overloads to the method…