Posts by Leonel Sanches da Silva • 88,623 points
2,010 posts
-
2
votes2
answers5898
viewsA: Foreign key may not be primary key?
What will be my foreign key: the movie link or the name? Obs: the primary key is the name and not the link. The right answer, considering the standards and good practices of database modeling is:…
databaseanswered Leonel Sanches da Silva 88,623 -
2
votes5
answers35057
viewsA: How to define the border color of a table without CSS?
Examples: HTML attribute-ridden style for internal CSS use. <table widths="30;60" cellpadding="1.5" border="1" style="border-style:solid; border-color:#0000ff;"> HTML attribute-ridden…
htmlanswered Leonel Sanches da Silva 88,623 -
3
votes4
answers1022
viewsA: How to keep column 'order' in sequence even after editing the order of records?
My suggestion would be the column ordem not be sequential, but rather be a field that normally increases by 10. For example: id | ordem | nome ------------------------ 1 | 10 | Fabio 3 | 20 | Gilmar…
-
4
votes2
answers1717
viewsA: How do I convert multiple ". dfm" files that are in binary to text format?
Copy the executable CONVERT.EXE inside the directory Bin from Delphi to the directory that is yours DFM; Execute the command: convert.exe -t -i -s *.dfm…
-
3
votes1
answer412
viewsA: LIKE query in related table
It is interesting to identify each element of your sentence with a prefix, to avoid ambiguities. The sentence, at first, is correct. Only a few adjustments left, indicated below: SELECT *,…
-
1
votes2
answers2473
viewsA: how to extract zip files in c# to a folder where system is installed
After the code change, the problem that occurs is that the use of DownloadFile is incorrect. String.Concat does not map the directory to the machine: just assemble a String with a directory name.…
-
2
votes1
answer118
viewsA: Assign existing view to a controller
Just put your View in the directory Shared. So all the Controllers may call the View Hotel as follows: return View("Hotel", _package);…
asp.net-mvc-5answered Leonel Sanches da Silva 88,623 -
1
votes2
answers2473
viewsA: how to extract zip files in c# to a folder where system is installed
This is because you are waiting for the unzipping function to be able to download your zip file, and that is not how it works. First you need to download the file, save it somewhere and then open it…
-
2
votes2
answers985
viewsA: How to export an HTML/C#(Razor) page to PDF?
Using the Nuget Razorpdf2 package: https://www.nuget.org/packages/RazorPDF2 This is my package. Anything you can do is just send me a message about bugs, mentioning me in chat or comment on any of…
-
1
votes1
answer364
viewsA: How to get a Mysql output Parameter via C#
It means that some of its parameters are not formatted as it should be. Its function banco.formataDinheiro() is not returning a Double, and yes a String. That’s why the mistake. To work with money,…
-
3
votes1
answer2001
viewsA: How to List Users with Asp.Net MVC 5
If context is mapped correctly, the following Controller can solve: public class UsuariosController : Controller { public UserManager<ApplicationUser> UserManager { get; private set; } public…
-
0
votes4
answers1320
viewsA: Long processes in C#
Using AJAX upload. There is a Nuget package that configures jQuery for this: Install-Package jQuery.Ajaxupload Example: <script> // Variável que guarda seus arquivos var files; // Eventos que…
-
2
votes3
answers523
viewsA: Dynamic display of mandatory, optional or non-existent fields
Another solution would be to create a Viewmodel with attributes that should or should not be written: namespace MyProject.ViewModels { public class MyViewModel { public int Prop1 { get; set; }…
-
1
votes3
answers523
viewsA: Dynamic display of mandatory, optional or non-existent fields
First, mark in your template which properties are mandatory using the Attribute [Required]: public class MyModel { [Key] public int MyModelId {get;set;} [Required] public String Description…
-
8
votes2
answers5213
viewsA: Consume web-service in ASP.NET MVC
According to the website http://www.ehow.com/info_12212371_definition-service-endpoint.html, one endpoint is defined in the text translated below: A endpoint is a connection point from which HTML or…
-
1
votes1
answer201
viewsA: Write HTML in JSF - Frameworks fonts?
If the JSF version is 1.2 or higher, just type the normal HTML without problems in its source. The transformation is applied only to JSF tags. If it is version 1.1, use:…
-
8
votes2
answers1153
viewsA: Consulta Lambda
To do the equivalent of having in SQL no Linnum, just put a Where() after the GroupBy(): using (var ctx = new TracesEntity()) { var lambda = ctx.TraceTabelas.Where(q => q.DataBaseName ==…
-
13
votes2
answers7145
viewsA: Is it good practice to use <Summary> for documentation?
Yes. Not only the <summary>, but all documentation items. This information is mapped by Visual Studio’s Intellisense and appears in Code Completion (code-complete). Not only that, if you want…
-
2
votes3
answers2078
viewsA: Questions about relationship and mapping with Fluent API for EF 6
Chaves Compostas The idea in no way improves the security or structure, even hindering the implementation of its Controllers and Views. All it takes is one Property as a primary key that other Id’s…
-
1
votes1
answer116
viewsA: Dismember date to load javascript
var Result = (from a in db.TB_CLIENTES where a.CdCliente == "1" && a.CPF == _cpf select new { Nome = a.Nome, Endereco = a.Endereco, Numero = a.Numero, CEP…
-
6
votes1
answer1766
viewsA: Mount URL without the Action or Controller name or both
This description that stands after the address is called Slug. In this case, what you need to do is a specific route handler. For example: Appstart Routeconfig.Cs routes.MapRoute( "Default",…
asp.net-mvc-5answered Leonel Sanches da Silva 88,623 -
6
votes2
answers2690
viewsA: EF 6, Fluent Api mapping in inheritance classes
Withmany Is used WithMany() to specify a Many relationship. What’s really weird is the fact that you’re using WithMany() unencumbered. WithMany() serves for you to specify the inverse relation. For…
-
2
votes1
answer934
viewsA: Error: Registering ? instead of special character only using browser
Apparently the problem is the (lack of) parameterization of your sentence. Without this parameterization, nothing guarantees that you are executing a sentence adhering to the Unicode standard. I…
-
1
votes1
answer341
viewsA: What is the best way to add ENUM fields to the Rails 4 model?
Thus: class Item < ActiveRecord::Base enum status: { publicado: 1, suspenso: 2, something: 3 } end Searches # item.update! status: 1 item.publicado! item.publicado? # => true item.status #…
-
7
votes1
answer3147
viewsA: Help with setting up Dbcontext with Entityframework using good practices
Connectionstring in Context Statement It is not good practice. By posting your site on a different basis (as in Azure, for example), the system would no longer function properly. Ideally you set…
-
16
votes1
answer1856
viewsQ: ASP.NET MVC - Attribute you write in a View
I need to write a Attribute write a mask validation in the View. Given for example a zip code field, I would like it to mark a Property in the Model with a [CEP], be written in View the following:…
-
2
votes2
answers4329
viewsA: String to Double Asp.NET C#
Thus: double.Parse(consultaserv[2].ToString(), CultureInfo.InvariantCulture);
-
6
votes1
answer8559
viewsA: How to export a table to CSV using PHP?
The following function exports a PHP array to a CSV file: function array_para_csv(array &$array) { if (count($array) == 0) { return null; } ob_start(); $df = fopen("php://output", 'w');…
-
4
votes3
answers3841
viewsA: Why use relics in C#?
His idea is to decrease the amount of code displayed on the screen by grouping common functions. The advantage is to keep the code more succinct for reading. The downside is that the religions hide…
c#answered Leonel Sanches da Silva 88,623 -
6
votes3
answers5038
viewsA: Upload Images with PHP - Mysql
In the official PHP website have this example, that I altered a little to put : <?php // Nas versões do PHP anteriores a 4.1.0, deve ser usado $HTTP_POST_FILES // ao invés de $_FILES. $uploaddir…
-
4
votes1
answer372
viewsA: How to resize thumbnails generated by Uploadfy? ASP.NET c# MVC 4
The ideal would be to generate a thumbnail file beyond the original upload, in which there will be data saving. When uploading the image, you can upload a smaller file, which opens faster, and use…
-
3
votes2
answers330
viewsA: Display layout only when view is not loaded via ajax
Better do in the Controller: public ActionResult Index() { if (Request.IsAjaxRequest()) return PartialView("partialView"); else return View(); }…
-
1
votes1
answer733
viewsA: Write with MVC and jQuery however the data is coming null
This method addCliente is well outside the standard of the Web API. I would do such a thing: using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using…
asp.net-mvc-5answered Leonel Sanches da Silva 88,623 -
3
votes2
answers650
viewsA: Creating custom Annotations in ASP.NET
In Asp.net-mvc, we call "Annotations" of Attributes. Just as the Annotations of java, Attributes are used to decorate classes, methods, properties, etc. Only that one Attribute is a special class…
-
22
votes3
answers39348
viewsA: Function to add more hours or days to a date
Thus: Hours var time = new Date('2014-03-14T23:54:00'); var outraData = new Date(); outraData.setHours(time.getHours() + 2); // Adiciona 2 horas Days var time = new Date('2014-03-14T23:54:00'); var…
javascriptanswered Leonel Sanches da Silva 88,623 -
4
votes2
answers2039
viewsA: Validate fields with html 5 and mvc 5
In the Asp.net-mvc, validation is done by decorating the properties of your Model with the appropriate attributes. Examples: [Required]: Makes the completion property mandatory. [StringLength(60)]:…
asp.net-mvc-5answered Leonel Sanches da Silva 88,623 -
4
votes1
answer1354
viewsA: Upload multiple files using Uploadfy in ASP.NET MVC
The original answer recommended using the Nuget package: https://www.nuget.org/packages/Uploadfy/ But it is old and may not fit if the jQuery version is the latest. Then download the Zip at this…
-
8
votes2
answers3377
viewsQ: How to count lines of code in a . NET Solution?
What are all solutions (free or not) to count lines of code in a solution. NET? Use two Visual Studios: 2012 and 2013.
-
1
votes5
answers8743
viewsA: Center a form vertically
Explain the top in pixels, not in %, that should work: .form_envia { background: #EDEFF1; padding: 30px 100px; position: absolute; top: 10px; left: 20px; }…
-
0
votes1
answer845
viewsA: Consult Active Directory distribution groups
The ADSI class, implemented here, does that. Below is the translated code. unit ADSI; interface uses SysUtils, Classes, ActiveX, Windows, ComCtrls, ExtCtrls, ActiveDs_TLB, adshlp, oleserver,…
delphi-7answered Leonel Sanches da Silva 88,623 -
20
votes4
answers10727
viewsA: What is the Mysql CREATE VIEW command for?
CREATE VIEW creates an object of the type VIEW in your database. One View is a transformation on top of one or more tables that behaves like a table. It is usually read-only (it is not possible to…
mysqlanswered Leonel Sanches da Silva 88,623 -
6
votes5
answers38715
viewsA: Calling a form and closing a form in the same event
This is done by placing the second form in a Thread: public static void ThreadProc() { Application.Run(new Frm1()); } private void iniciar_Click(object sender, EventArgs e) { System.Threading.Thread…
-
1
votes2
answers368
viewsA: Override Xmltextwriter - Serialize Class for XML absolutely all attributes
Try forcing a data contract into your class, stating that the column can be null: [DataContract] public class Pessoa { [DataMember] public int Id {get;set;} [DataMember] [XmlElement(IsNullable =…
-
3
votes4
answers7742
viewsA: How does grid system work?
By default, the Bootstrap creates a grid with columns whose size is 100% of the parent container. For example, if you want to place a grid in a space of 960 pixels (a <div>, for example), the…
-
2
votes2
answers3135
viewsA: What would be the default size to create buttons in the menu of websites, in different resolutions?
There is no "pattern" of sizes. What exists are studies and recommendations, because variations of design between sites contain various types of sizes and shapes of buttons. A very good article,…
-
9
votes3
answers1123
viewsA: Error in C# function to increment variable
Its increment function performs the increment but the value of the variable is lost. Ideally its increment function would change the value of the variable pt. It can be done like this: public void…
c#answered Leonel Sanches da Silva 88,623 -
2
votes1
answer541
viewsA: Custom Roleprovider
The problem is in your PermissoesFiltro: the event OnAuthorize calls another call called AuthorizeCore, which effectively calculates the permission. I would override it so: public class…
-
6
votes3
answers1601
viewsA: Breadcrumb algorithm in ASP.NET MVC
I tried to use the SiteMapProvider, but it is not compatible with MVC5, so I had to keep improving my solution. The solution follows the line suggested by @iuristona, but adapted to the reality that…
-
5
votes3
answers5558
viewsA: Master-detail in MVC C# with Razor
This code was written at the time the Entity Framework was in version 5, so possibly the logic of manipulating the phone collection may have changed. Please notify me by comments if any error…
-
3
votes2
answers892
viewsA: Upload localhost application for online domain (hosted on my computer)
First, DNS (which you call "online subdomain") should have an entry pointing to your IP. Second, by uploading an application written in nodejs, it is already in theory exposed to the internet. What…