Most voted "encoding-style" questions
Encoding style is a set of rules or guidelines used when coding a computer program. Typically, following a certain coding style makes it easier for other programmers to read and understand the source code.
Learn more…234 questions
Sort by count of
-
1
votes1
answer112
viewsDoubts regarding the PEP8
I read the PEP8 but did not understand very well when using 2 blank spaces. I must use 2 spaces to separate a section of imports from another section? What sections a Python file normally displays?…
-
1
votes1
answer125
viewsReturn of the clean catch code
I am reading the book Clean Code of the series of Robert C. Martin. And it was presented a very common situation in my day to day. public static void main(String[] args) { String nome = null; try {…
-
1
votes2
answers68
viewsIncrement in For loop
I need a count that goes from 1 to 24, but in that order: 1,9,17,2,10,18,3,11,19,4,12,20,5,13,21,6,14,22,7,15,23,8,16,24 I did so, but I wanted something more "elegant". for($x=1;$x<9;$x++){ echo…
-
1
votes2
answers109
viewsIs it wrong to put this much code into a button click event?
It is wrong to put this amount of code in an event of click button? private void CPeBTNSalvar_Click(object sender, EventArgs e) { try { if (CPeTBCodigo.Text == "") { throw new…
-
1
votes1
answer60
viewsCode pattern for function calling
I don’t quite remember where, but I think it was in some discussion on a topic here in the same OS, referring to that in the statement of if, or any other function of the language itself must be…
-
1
votes0
answers49
viewsUsing or not using semicolons in Javascript
I have been a programmer for a short time and have now started using many frameworks and Javascript libraries. As I have greater knowledge in Java bring some language habits like using the ;, I am…
-
1
votes1
answer45
viewsPrint with variable or by direct account?
Are these two methods the same in terms of performance? Is one better than the other or is it better in terms of code organization? Method 01: direct printf("%.4lf\n", sqrt( pow(x2-x1, 2) +…
-
1
votes2
answers105
viewsMore appropriate way to name a list
Hello I would like to ask a question about attribute names. What would be the most appropriate way to name a list? Let’s assume that I have an attribute which is a list of Ufs. What would be the…
-
1
votes1
answer48
viewsWhat is the appropriate style to write in Python?
What standard to name classes, methods, variables, etc., in Python, I thought just like in Java was Camelcase, but recently I heard to use snake_case. Is there any specific Python pattern? Which of…
-
1
votes2
answers58
viewsOrganization for future code maintenance when I have two similar functions
I have two functions, one returns only the first result and the other also returns the first result or returns more than one result. I created the "string all" parameter to define whether to return…
-
1
votes2
answers49
viewsDoubts about usability - var e functions - Javascript
I came across a situation that until today had not occurred, my friend was coding and made the following block of code (only simulation) function teste() { teste = true // Ele faz uma verificação if…
-
0
votes1
answer1260
viewsTab vs. spaces for code indentation
Is there any recommendation on what is more appropriate? Tab character (\t) or spaces? From what I can see, there are usually conventions for language: Ruby: two spaces Delphi: two spaces Python:…
-
0
votes1
answer45
viewsList database file and put a new row after a certain number
I’ve been trying for days to find a small solution: Example: I have this code: //LISTAR AS PLAYLISTS $dados_playlist = mysql_fetch_array(mysql_query("SELECT * FROM playlists where codigo =…
-
0
votes3
answers899
viewsBest syntax for PHP function names
Greetings, I would like to know the correct syntax for writing functions in php. for example: public function load_default_controller() { } or public function loadDefaultController() { } The…
-
0
votes1
answer178
viewsCode Conventions in C#
I have some experience with Java and C. Recently, I picked up a project in C#. I wonder if there is a style guide from Microsoft or some other entity to learn what the C programming style looks…
-
0
votes1
answer107
viewsSeparate code regions using Sublime Text 3
In the Visual Studio there is a resource called Directive #Region , a resource that collects and hides code sections. Example static void Main(string[] args) { #region MyRegion1 //My code Here…
-
0
votes3
answers596
viewsHow to optimize SQL to filter results
The filter may occur in the following scenarios: Without any input filled 1 (a) input filled Combinations of inputs, including all SQL to be optimized: $cnpj = isset($_GET['cnpj']) ? $_GET['cnpj'] :…
-
0
votes1
answer70
viewsGood practice passing arguments to a method when they come from another function
I came across a code similar to the following: private fazerAlgo(AlgumaCoisa algumaCoisa) { Utilidades.converter( formatador.formatarParaTal( algumaCoisa.a, algumaCoisa.b, algumaCoisa.c ) ) } At…
-
0
votes2
answers415
viewsProblem with ternary operator
I have a problem with the ternary operator. I want to use it to make the code more elegant because it is simple. But it’s as if it doesn’t work because it doesn’t update the variable. The following…
-
0
votes1
answer779
viewsIndentation in Python
I wonder where I could put blank spaces to separate parts of the code according to PEP8. q = int(input('Quantos números sua sequência tem?(3 ou mais)')) if q < 3: while True: q =…
-
0
votes0
answers64
viewsWhat folder structure for the dll project in . net framework that I will play in the main project
I have a vs2017 solution with a main project that will use a dll project as a reference. I created the model, business and repository folders in the dll project Main project use a dll in the main…
-
0
votes2
answers74
viewsHow to edit gigantic codes?
It’s a question I’ve had since I started reading codes. I see some classes with a thousand, two thousand, thousands of lines. How a programmer can edit so much without "getting lost" in the middle…
-
0
votes0
answers78
viewsEdit Latex in Vim and Aspell - Accents
Hi, I’m trying to use VIM to edit a Latex file. When writing the text in Latex in the same I can accentuate normally, having difficulty to correct it in Aspell or Texmaker: I write in VIM:…
-
0
votes1
answer201
viewsCorrect use of "goto" with "if Else"
I have a question about the correct use of the "goto", I made a small example that illustrates my doubt: <?php $valor01=10; $valor02=8; if($valor01 > $valor02) { echo "valor01 é maior que…
-
0
votes1
answer29
viewscode Smell - select max(numeroProntuario)+1, but how to fix it?
I have a table Paciente mysql, in it I have the column id, nome, numeroProntuario etc. This column numeroProntuario is defined by the increment of +1 resulting from select max(numeroProntuario)…
-
0
votes1
answer180
viewsHow to create HTML page with PHP
I don’t have much knowledge and I don’t know if the way I’m doing it is correct or has any negative points. There’s some better option for me to do? <?php $ht = '<div class="panel…
-
0
votes2
answers60
viewsVerifying time of execution of a call in ADVPL
My VerifyOnServ(nTimeOut), is not always obeying the nTimeOut past, either because of it or the server with which it communicates. So I needed an insistence on his execution nTimeOut Follows the…
-
0
votes2
answers70
viewsIs 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…
-
0
votes2
answers46
viewsImplementation of member functions
It was overloading operators and defining them within the class itself, I found it natural to do so for these functions, but then a small doubt arose. Is it wrong to define member functions within…
-
-1
votes2
answers351
viewsJquery . click or Function
As I get used to it more and more <input type=button onclick="TESTE()"> <script> function TESTE(){ ... } To use the jquery method <input type=button id="teste"> <script>…
-
-1
votes3
answers139
viewsBest way to write a Javascript function
What is the best way to write the following function? This? function DOMtoString(document_root) { var html = '', node = document_root.firstChild; while (node) { switch (node.nodeType) { case…
-
-2
votes1
answer102
viewsIs there any way to reduce the if’s of my code?
function updateUser($usuario, $senha, $adm){ //Atualiza informações sobre o usuário $sql_query; $q_senha = ""; $q_adm = ""; $dot = ""; if(!empty($senha)){ $q_senha = "senha=md5('$senha')"; } if($adm…
-
-2
votes1
answer25
viewsopa I would like to strip the blue subliming of the links
.home ul { width: 100px; height: 30px; background-color:#d3d3d2; margin-top: -75px; margin-left: 1400px; color: white; font-size: 18px; font-family:Bahnschrift Condense; padding: 12px; text-align:…
-
-2
votes0
answers21
viewsEncode filenames in Base64 in python?
I need help from you to implement a python code to encode the filenames in Base64 and name it right away and then code and then decode back the filenames of those files. import os import base64…