Posts by Laerte • 22,243 points
249 posts
-
23
votes1
answer1280
viewsQ: Differences between declarative and imperative form of LINQ
What one way can do that the other can’t? There is a difference in performance? There’s one advantage over the other? Example: using System; using System.Collections.Generic; using System.Linq;…
-
1
votes3
answers477
viewsA: CSS does not obey margin-right
You can use the property text-align. Example, that simply aligns all text in the position you specify (right, left or center) #contact p { float: right; margin-right: 25px; text-align: right;…
-
6
votes4
answers6284
viewsQ: How does an empty constructor work?
Definition: Creating an empty constructor attributes if not set will be set to the default value of guy, example: int default value is zero. Context: Use a structure that returns entities from the…
-
128
votes7
answers5450
viewsQ: How to write easy-to-maintain, readable code?
How to know if the code is easy to read and maintain? I usually abstract a large part of my codes, I have a habit of using a lot lambda functions in C#. As this function for CPF validation. public…
-
10
votes2
answers1100
viewsA: What is the difference between Meter and Progress in HTML5?
Although they are similar visually they have different purposes, let’s see: <progress>: represents the progress of performing a task, example: uploading a file. <meter> is a measure, for…
-
4
votes1
answer966
viewsQ: How to implement the six degree separation theory algorithm?
What is? Theory that in the world it takes no more than six bonds of friendship for any two people to be connected. Question: I’ve been trying for some time to implement this algorithm, but I can’t…
-
12
votes3
answers44347
viewsA: How to create a python " *.exe" executable?
For this specific version the cx_Freeze solves your problem. For previous versions, there are these alternatives: Pyinstaller, py2exe, bbfreeze…
-
6
votes5
answers23456
viewsA: Add character in the middle of a string
I created a function that concatenates the value determined by you in half the total amount of characters in your text, it returns a string with the value already concatenated. function…
-
0
votes4
answers10133
viewsA: Develop iOS apps using Java
It is not possible to develop applications for iOS using Java, the official programming language to develop for iOS is Objective-C. Created by Apple. If you want to use Java I advise developing to…
-
4
votes4
answers1531
viewsA: How to assign a value to an Enum with binary notation?
Unable to declare binary literals in C#. What you can do is parse a string to the binary format using Convert.ToInt32, as can be seen here and here. int binario = Convert.ToInt32("0100", 2);…
-
0
votes3
answers9362
viewsA: How to get the value without a mask from a Maskedtextbox?
The solution I know for this type of problem is using Replace or Remove string data = "22/04/2014"; data = data.Replace("/", string.Empty); /* parâmetros: Caractere antigo e o substituto dele, no…
-
6
votes1
answer2229
viewsQ: How to add a control dynamically in C#?
How to add a control to a page ASP.NET dynamically using C#?
-
6
votes1
answer2229
viewsA: How to add a control dynamically in C#?
Creating a control TextBox dynamically: TextBox txtTeste = new TextBox(); txtTeste.ID = "txtTeste"; this.Page.Form.Controls.Add(txtTeste); To insert this component on the screen, the method is used…
-
51
votes8
answers2113
viewsQ: Is using customer validation enough?
Using Javascript validations is sufficient for efficient validation? Example: Date validation. It is necessary to check also in the code? What are the disadvantages of only performing validations…
-
9
votes7
answers16899
viewsA: How to create a <select> with images in the options?
In the <select> is possible by an image, already in the <option> only to change the background color: Example: http://jsfiddle.net/RL73e/ CSS select { background:…
-
6
votes1
answer564
viewsA: I cannot run DELETE in SQL when submitting form via POST in PHP
The way your sql query was written is wrong, the correct syntax is: DELETE FROM TABELA To call the function PHP the way you are trying to do, you need to put your function within the call of a $_GET…
-
79
votes2
answers11641
viewsQ: What is Reflection. Why is it useful?
It is recommended to use in projects? How to use? In what situations Reflection can be used?
-
26
votes2
answers9155
viewsQ: What is serialization? When to use? How to implement in C#?
[Serializable] public class Pessoa { public string Nome { get; set; } public string Cpf { get; set; } } There’s only one kind of serialization? What alternatives not to need serialize an object?…
-
0
votes3
answers240
viewsA: How to display "from" inside the Datetimepicker
This happens because C# interprets the letter’d' of the word "from" as if it were the letter 'd' reserved for the day number format. Don’t forget to set the Format, also: dtApartir.CustomFormat =…
-
0
votes2
answers5830
viewsA: How to make the printing of pages go out the way it is seen on the screen?
Searching I found the property -webkit-print-color-adjust which unfortunately only works on Chrome, but my question is focused on a solution that works in the main browsers (I will continue…
-
5
votes2
answers5830
viewsQ: How to make the printing of pages go out the way it is seen on the screen?
I need to make a page that, when the user prints, come out exactly as it is seen on the screen (with the styles), I’m using Bootstrap version 3.1. Is there any plugin in Javascript that does this?…
-
6
votes2
answers330
viewsQ: Implement composite key C#
I’m performing some tests and managed to implement using this form: public class Residencia { public object Id { get { return String.Concat(Cidade, Estado); } set { } } private string Cidade;…
-
36
votes4
answers10375
viewsQ: Difference between Object, Dynamic and var
I’m running some tests and it seems to me Object and Dynamic perform the same task as opposed to var that once assigned it is impossible to change their type, what is the difference between them?…
-
5
votes5
answers36671
viewsQ: How to get the total character size of an SQL column?
I want to take the total size of characters that a column supports, example INT supports 10 characters. I tried to use DATALENGTH that does not return the number of characters, but the amount of…
-
63
votes2
answers17606
viewsQ: Why use WHERE 1 = 1 in an SQL query?
During the maintenance of a legacy system I found the following Procedure: DECLARE @sql AS varchar(MAX); DECLARE @param as varchar(50); SET @sql = 'SELECT * FROM Destinatario where 1 = 1'; IF(@param…
-
6
votes3
answers5346
viewsQ: Clone class objects using Icloneable
I’m trying to use the Interface Icloneable to copy an object, but I’m having a problem when it has a class property because the Icloneable does not create a new memory address for these objects, but…
-
10
votes4
answers2357
viewsQ: Good practices for storing logs
What information should be stored? It’s good practice to use TRIGGER in the database for storing logs or via code is something safer and easy to maintain?…
-
137
votes3
answers101378
viewsQ: What are the main differences between SOAP, REST?
What are the main differences between these types of Web Service? In which cases apply? Is there any difference in performance?
web-serviceasked Laerte 22,243 -
4
votes2
answers2087
viewsQ: How to pass arguments to a PHP script via command line?
I have a script PHP which receives arguments as follows: script.php -f "valor". How do I make PHP pass this argument via command line?
-
12
votes5
answers6123
viewsQ: Physical Exclusion vs Logical Exclusion
What is the advantage of making logical exclusion (Ex: Set a flag indicating that the record is active or not), instead of performing physical exclusion? Is it common practice? It’s safe? Derived…
-
4
votes2
answers241
viewsQ: Popular programmatically x data manually
You can popular one-component data on .NET using Visual Studio interface (Select Datasource...). From the point of view of popular performance data via code is faster than manualmentr?…
-
43
votes5
answers22471
viewsQ: How do anonymous functions work?
I know they are functions that do not have the specified name, but what is the purpose? Is it possible to recur with anonymous functions? Ex: Fibonacci sequence. (function(x, y) { alert(x + y);…
-
10
votes2
answers7145
viewsQ: Is it good practice to use <Summary> for documentation?
This is the best way to document code in C#? /// <summary> /// Descrição /// </summary>
-
10
votes3
answers3841
viewsQ: Why use relics in C#?
What are the advantages and disadvantages of using #regions in the C#? Its use really facilitates code organization? #region /* Código */ #endregion…
-
17
votes4
answers7742
viewsQ: How does grid system work?
I’m using Bootstrap in a project, but so far I do not understand how the structure of it works. It uses grids but the documentation is not very clear on how it works and how to use. I want to put…
-
11
votes4
answers3989
viewsQ: How the relationship between the same table works
Performance changes? (Compared to different tables) In which case it could be used? It is recommended?
-
151
votes3
answers25811
viewsQ: What are the differences between Git, SVN and CVS?
What are the advantages, limitations and main differences between these 3 versioning systems, Git, SVN and CVS?
-
3
votes1
answer787
viewsA: Pygame - Align screen in the center
SDL, engine that the Pygame is based, uses the environment variable SDL_VIDEO_CENTERED to indicate that the window must be centered. The variable must be declared before the Pygame be initiated by…
-
5
votes3
answers844
viewsQ: Comparison of >= and <= with strings
I have a field in the database which is in the following format: YYYYMM Using the past I can normally search these fields: WHERE I.DT_INCL >= @inicio AND I.DT_INCL <= @final When trying to…
-
2
votes3
answers263
viewsQ: Intellisense disappears when the list of arguments is large
I’m using Visual Studio 2010 realized that when the list of parameters of the constructor is too large and does not fit on the screen Visual Studio no longer displays the list of parameters of the…
-
3
votes1
answer1829
viewsA: Export Mysql database to Sqlite
Try the script mysql2sqlite.sh: https://gist.github.com/esperlu/943776#file-mysql2sqlite-sh As described in the header, the way to use: ./mysql2sqlite.sh myDbase | sqlite3 database.sqlite If you…
-
0
votes6
answers2938
viewsA: I can’t get the value of an Asp:hiddenField in c#, it’s always empty
You put the tag <script> at the head of the page? Because if put and trying to assign a value will not work even, occurs the following error: Uncaught Typeerror: Cannot set Property 'value' of…
-
6
votes7
answers2949
viewsA: How to use multiple SQL commands (in the case delete on ORACLE) in one line only on C#?
Try to put the querys inside an Anonymous Blocks BEGIN..END What are Anonymous Blocks? They are declared in an application at the place where they are to be executed and passed in run-time at the…
-
2
votes3
answers13134
viewsA: How to make a dowload inline file available in html?
You can use an attribute from HTML5: download="pagina.html" Example: <a download="pagina.html"…
-
6
votes7
answers43303
viewsA: How do I know if a variable is of the Javascript Number type?
I use the function isNaN, that checks if the variable is not a number and denies it. var valor = 1.5; var teste = "a"; console.log(!isNaN(valor)); /* retorna false negando fica true, 1.5 é tipo…
-
5
votes3
answers2597
viewsA: How to write commands in a console program through a batch (.bat) file?
To pass parameters to a .bat: echo off echo %1 In the code above I passed the parameter number I want to pick, in case it will be only 1: programa.bat argumento You can also use the joker: %* that…
-
33
votes3
answers6231
viewsA: What does "??!?!" mean in C language?
??! is a trigraph equivalent to the logical expression || (or) This was invented because these 9 characters are not part of the ISO 646. Thus, in order to be able to program on any keyboard…
-
4
votes3
answers5030
viewsQ: Keep zero after comma using the float type?
I have a database where product values are stored. When there is occurrence of numbers with zero after commas they come without zero. I did a test and with decimal it worked, but my application uses…
-
4
votes3
answers10204
viewsA: How to put a value that is saved in the database in a combobox?
You need to assign the Datasource in his Combobox, the class "States" has the attributes "Id" and "Acronym" public class Estados { public int Id { get; set; } public string Sigla { get; set; }…