Posts by Leonel Sanches da Silva • 88,623 points
2,010 posts
-
1
votes2
answers69
viewsA: Error while using methods to generate hash and catch MAC address
It will not work the way it is. You cannot create a variable initialized in the class populated by methods of the same class. In practice, it is as if the compiler does not know the methods. There…
-
1
votes1
answer1128
viewsA: Consultation for the electronic Invoice?
Try compiling and debugging Uninfe on your machine. Its source code is here: https://svn.code.sf.net/p/uninfe/code/ This is an SVN repository. You can use Tortoisesvn to get the source.…
-
4
votes1
answer185
viewsA: Is there a standard "stack" data structure in Python?
No. The standard language recommendation is use a list as a stack (stack). In the case of a queue (Queue), additional methods and restrictions are required for the queue to be handled correctly.…
-
2
votes3
answers500
viewsA: Security key in Asp.net mvc
You can generate a SHA1 key using as seed for generating the MAC address (physical) of the machine network adapter. The process is very safe because it is difficult for the person who steals your…
-
1
votes1
answer58
viewsA: Problem with debugging
Make a Unload Project in your project (right click on it > Unload Project); Edit the .csproj (right click again on the project > Edit Novonome.csproj); Check if the following tag is identical…
-
6
votes1
answer1682
viewsA: How to obtain PDF content generated by Rotary?
ViewAsPdf has one more parameter called SaveOnServerPath, in which you pass the way to be saved on disk: var myPDF = new ViewAsPdf("ConvitePDF") { FileName = "Convite.pdf", PageSize = Size.A4,…
-
8
votes1
answer795
viewsA: Good practice with . NET MVC
First, I am taking over the organization for ASP.NET Identity, so that the answer does not become a text wall. Assuming the following scenario: Controller for user (Usuariocontroller); Viewmodel for…
-
4
votes2
answers872
viewsA: What is the best way to create a conditional foreign key Constraint?
This here: UNIQUE (id, accepts_comments) No need. Primary key verification already exists (which already ensures that the record is unique). This here: accepts_comments BOOLEAN NOT NULL DEFAULT…
-
5
votes3
answers4278
viewsA: Create a class dynamically in C#
First implement a special class to build other classes. The following code does this: using System; using System.Reflection; using System.Reflection.Emit; namespace TypeBuilderNamespace { public…
c#answered Leonel Sanches da Silva 88,623 -
2
votes1
answer792
viewsA: How to add item in an order in Asp.net c#?
There are some problems in your modeling. The way it is done, there is no way you specify the amount of pizzas and drinks ordered. The correct way would be a N to N relationship between Orders and…
-
1
votes2
answers138
viewsA: Doubt with _viewStart on MVC4
It’s wrong this way. A _ViewStart only supports one Layout file at a time. To do it this way (one layout inside another), you first need to define the internal Layout as one View normal. The details…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
0
votes2
answers92
viewsA: Setar schema in query with Repository
To reset in Runtime, you’ll need a library to make this switch for you: http://efmodeladapter.codeplex.com/ If you need me to pack the library in a Nuget package, just talk. Or you can define an…
-
1
votes1
answer1316
viewsA: Consuming Protheus webservice in C# (array)
It’s a simple problem of cast. Switch to the next: WS_FUNCSPONTO.TESTEARRAY[] qwert = new WS_FUNCSPONTO.TESTEARRAY[50];
-
6
votes3
answers6557
viewsA: Get logged in user
The reply of @Diegozanardo gets very close to the request in question. I will just add some information: SetAuthCookie I think it’s wrong to put an ID field on a Cookie who accepts String, then I’d…
-
1
votes1
answer40
viewsA: Wrong webservice message integrating with Actionscript
Before returning the reply, make sure that the response header will return text/plain, thus: [HttpPost] public string confirmahora() { String OUTPUT = "mensagem"; HttpConfiguration config = new…
-
2
votes1
answer4974
viewsA: Implementation of ASP.NET MVC Shopping Cart
I’m guessing your Models be it so: public class Design { [Key] public int DesignId { get; set; } public String Servico { get; set; } public Decimal Preco { get; set; } public virtual…
-
2
votes2
answers106
viewsA: Object Variable type and Expressions
If it is in SQL Server 2012, you can mount a micro-table that works as an array: DECLARE @ListaDeIDs TABLE(IDs int); INSERT INTO @ListaDeIDs VALUES(14),(25),(45),(12),(54); SELECT IDs FROM…
-
2
votes1
answer146
viewsA: Filter search with Checkbox values
At the moment when the Viewmodel to the Controller, there are two ways to get the Ids of the selected genres: Through the Press IdGenerosSelecionados; Through the collection GenerosSelecionados. To…
-
1
votes1
answer130
viewsA: Search with Checkbox
For this, you will need to use the Nuget package Mvccheckboxlist: https://www.nuget.org/packages/MvcCheckBoxList/ Before mount a ViewModel with a few things: public class…
-
9
votes1
answer11539
viewsA: How to Create Dropdownlist in ASP.NET MVC 4
The DropDownList requires a well-defined Id. Your association does not have this Id. Also, your class is well out of the standard. Let’s make some adjustments: public class ProjetoFuncionario {…
-
3
votes1
answer1056
viewsA: Entity Framework DDD Generic Infrarepository
Entity Framework already implements the Repository Standard I’ve answered that a few times, as in this answer about Unit of Work and repository, but I’ll write another answer because for some reason…
-
2
votes1
answer340
viewsA: What is the correct way to declare a chain of methods and prevent the same method from being used outside the scope?
It is correct to do this kind of implementation? From the point of view only of the objective of implementation, yes. In fact, I would say that this is the performative (elegant) way of allowing or…
-
4
votes1
answer3595
viewsA: Using Jquery Datatables with ASP.NET MVC 5
It doesn’t change the way it is done in PHP much. When describing Ajax: "ajax": { "url": "scripts/post.php", "type": "POST" }, Make the View write the JS script as follows: "ajax": { "url":…
-
2
votes1
answer78
viewsA: Search information in more than one table
Not use Find. Find brings only the requested registration, without the relationships between the other entities. Change to FirstOrDefault, and use Include to load related data: var ocorrencia =…
-
-1
votes1
answer221
viewsA: How do I not lose my Gridview lines that were dynamically created in Rowdatabound?
Let headers be created at other events, such as RowCreated and the RowCommand: protected void grvAvaliacao_RowCommand(object sender, GridViewRowEventArgs e) { // Coloque aqui a criação dos…
-
0
votes2
answers531
viewsA: python packages with dependency installation
I assume you will write a package in Pypi pattern (for use with Pip, for example, or easy_install), here is a complete example of how to do this.…
pythonanswered Leonel Sanches da Silva 88,623 -
4
votes1
answer4486
viewsA: Entity Framework Connection with Mysql
Summarizing what has been put into comment: 1. Install Mysql . NET Connector http://dev.mysql.com/downloads/connector/net/ 2. Setting up the file web.config as follows: <connectionStrings>…
-
0
votes2
answers594
viewsA: Managing dependencies with Maven in an offline environment
Yes, install Maven Proxy, configure and run: http://maven-proxy.codehaus.org/ If you want a more user-friendly repository, install Artifactory: http://www.jfrog.com/video/artifactory-1-min-setup/…
mavenanswered Leonel Sanches da Silva 88,623 -
0
votes1
answer835
viewsA: Error in reading JSON
As you are reading from a file, possibly the content is a string, then json.load will not work. The other thing is that you are passing to the method json.load the file descriptor, not a JSON…
-
2
votes1
answer109
viewsA: Backup Database Sqlserver
The script below generates a file per database in the format named_AAADDMM.BAK: DECLARE @name VARCHAR(50) -- nome do database DECLARE @path VARCHAR(256) -- caminho em disco para os arquivos DECLARE…
-
16
votes1
answer680
viewsA: Code First versus Database First?
Differences Code First: The code is written first. The database is generated from the code; Database First: The database is written first. The application code is generated from the database. Pros…
-
2
votes2
answers57
viewsA: Using [Foreignkey(")] - MVC
This annotation only exists for . NET Framework 4.5 onwards. Consider switching your application to Framework 4.5. I teach that in this answer. More:…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
0
votes1
answer125
viewsA: Create a function that returns information about a file
It’s a little too big this code. I’d do something like this: fname = "text.txt" num_lines = 0 num_words = 0 num_chars = 0 with open(fname, 'r') as f: for line in f: words = line.split() if…
python-3.xanswered Leonel Sanches da Silva 88,623 -
5
votes1
answer2742
viewsA: Working with Currency (decimal)
In the Model, use like this: [Required] [DataType(DataType.Currency)] [Display(Name = "Price", ResourceType = typeof(Resources.Language))] public Decimal Price { get; set; } In Views, use the Nuget…
-
2
votes2
answers217
viewsA: Problems with date format
To work, now install the following Nuget package: https://www.nuget.org/packages/jQuery.Validation.Globalize/ Don’t forget to set up BundleConfig.cs to add the new scripts to your Views.…
-
1
votes1
answer96
viewsA: Problem attaching value to Python 2 matrix
I simulated the execution of your code sequentially, in parts. I adapted the code a little and did the following: a = [[6, 2], [8, 4], [1, 9]] a.sort() print(a) vectorY = [] index = 1 for values in…
-
1
votes1
answer191
viewsA: Problem with select in table with relationship Many to Many
Several things to fix: 1. Controller public ActionResult TodosOsPedidos() { var pedido = _db.Pedidos.Include(p => p.ProdutosPedidos).ToList(); return View(pedido); } Make sure there is in the…
-
1
votes1
answer82
viewsA: Error message about something that does not exist in the application
The Global.asax does not accept this statement in duplicity: <%@ Application Codebehind="Global.asax.cs" Inherits="AgendaContato.MvcApplication" Language="C#" %> Also check that the file is…
-
2
votes1
answer260
viewsA: System.Outofmemoryexception - Parser for large files
It is possible to define some things to avoid the problem: Avoiding the construction of a giant tree in the parser; Using UnbufferedTokenStream in the parser; Using UnbufferedCharStream in the…
-
1
votes1
answer284
viewsA: Knowing if a file is locked or not
Apparently this is the most suitable way to do this check. By the way, is identical to this reply here from Soen. In the same answer, there is still the possibility to verify whether the exception…
-
0
votes1
answer335
viewsA: Script does not appear when pressing Section
Maybe you are starting the plugin before you finish loading the page. Try checking when the page is loaded to load the plugin: @section Scripts { <script…
-
2
votes1
answer101
viewsA: Partial is not rendered
Do not use RenderPartial for this case: Html.RenderPartial("_PartialTelefone", telefone); Use only Partial and with the @ in front: @Html.Partial("_PartialTelefone", telefone); Here I explain why.…
-
1
votes1
answer292
viewsA: Select in two tables
It’s no secret: var ban = contexto.Bans.Include(b => b.Usuario).FirstOrDefault(); var nomeUsuario = ban.Usuario.Nome;
-
7
votes2
answers717
viewsA: Normalization of tables and relationships
I don’t see the need to separate the information from Student Parents, unless you want to make a table of Guardians, whose cardinality for Student is 1 for N. In any case, I’ll assume you just want…
-
3
votes1
answer598
viewsA: How to insert values inside a key using List and JSON
You need to expand a little more your pro JSON.Net template to make the correct interpretation: public class Cliente { public string Nome { get; set; } public List<Veiculo> Comprou { get; set;…
-
1
votes1
answer634
viewsA: Methodology and Documentation for ASP.NET MVC Projects
I’ll answer a part of your question. Is it interesting to unlock the application layers in MVC and assign each to a team contributor? I don’t see this as a very practical solution, but as I said, I…
-
5
votes2
answers2094
viewsA: What is the difference between Attach, setar Entitystate for Modified and Currentvalues.Setvalues?
Attach Attach a record to context. It’s an optimistic behavior: the Entity Framework expects the record to exist and only observes other records that make use of this attached record. Any…
entity-frameworkanswered Leonel Sanches da Silva 88,623 -
9
votes1
answer1184
viewsA: Best Practices for Insertion, Modification and Deletion with Entityframework
Introducing First of all, we need understand how the Defaultmodelbinder implementation works, which is not mentioned in any answer on the subject. It assumes that the variables on screen can be…
-
5
votes1
answer5990
viewsA: Error updating entries in Entity Framework
Include in your context a override for the event SaveChanges as follows: public override int SaveChanges() { try { return base.SaveChanges(); } catch (DbEntityValidationException e) { foreach (var…
entity-frameworkanswered Leonel Sanches da Silva 88,623 -
2
votes1
answer652
viewsA: Visual Studio 2012 MVC 3 - Action button does not work
It won’t work, simply. MVC doesn’t use Code Behind. It’s another paradigm and another way to use buttons and pro events Controller. No point explaining all the differences in this answer. On the…
asp.net-mvcanswered Leonel Sanches da Silva 88,623