Posts by Pagotti • 3,042 points
94 posts
-
0
votes3
answers4852
viewsA: How to remove accents with regular expressions in Python?
Your code is swapping all the characters captured in the regular expression with '' and thus removing the accent. If you want to translate each accent by the respective character without accent, you…
-
0
votes1
answer46
viewsA: Junction of tables
If the relationship is 1 para 1 between the three tables, then a JOIN normal between them, but from the comments it seems that the relationship is 1 para N and the filters on the tables force a…
-
0
votes2
answers1556
viewsA: Jquery to add element in the.append function div
The description of the problem is a little confusing, but what it seems is that you want to add a new "radio" payment option with the name "Bank Transfer" inside the div who already has the other…
-
1
votes2
answers2252
viewsA: Unassigned variable in c#
would like to know why To answer your question, the reason this message occurs is that there is a path that the code can go through, which is the last else, where the variable sn will not have been…
-
0
votes3
answers277
viewsA: How to concatenate sublists from a list and add values to them using Linq with C#
You can use a Sum in the selection to sum the quantities in each stock // estoques => representa a sua coleção de estoques ou a entidade do EF foreach (var e in estoques.Select(x => new { Key…
-
0
votes3
answers836
viewsA: Lists count total amount and higher repeat
You can use the function max specifying vetor.count in the parameter key to find the fashion of the list. vetor = [1,2,3,4,5,6,7,8,8,8] print ("tamanho: {}, moda: {}".format(len(vetor), max(vetor,…
-
1
votes2
answers188
viewsA: reverse push order
Splice If the object is an array, the push will insert at the end. To insert at the beginning you can use the splice Example: var final = 4; var comeco = 1; var arr = [2, 3]; arr.splice(0, 0,…
-
1
votes2
answers410
viewsA: Private class in Javascript
Module Pattern From the description of the problem, where you want to separate the private part from the public part, maybe what you’re looking for is the Module Pattern or something similar. I’ve…
-
1
votes1
answer107
viewsA: Installation geopy python 2.7
Try to use the distance as follows: Existing example in documentation of geopy from geopy import distance newport_ri = (41.49008, -71.312796) cleveland_oh = (41.499498, -81.695391)…
python-2.7answered Pagotti 3,042 -
1
votes2
answers1267
viewsA: search for value in json object and return position in array
One way to do this is to use the findIndex() in the array of sub_infos within the search of findIndex() of the main array. Example: var…
-
2
votes2
answers1079
viewsA: How to do a random query in Mysql without repeating data?
Use a fixed value as a parameter for RAND() A way to make pagination and maintain random order using the RAND() is to pass a fixed number as parameter because that way the order will be the same in…
-
1
votes1
answer199
views -
2
votes2
answers377
viewsA: Timout when searching between 2 date intervals
A suggestion: var dataIni = dataInicial.Date + new TimeSpan(0, 0, 0); var dataFin = dataFinal.Date + new TimeSpan(23, 59, 59); expressao.Where(p => p.DataCadastro >= dataIni &&…
-
1
votes2
answers145
viewsA: Why use three parameters for this`callback`function?
Since Javascript is a language where you don’t need to specify the type of data you expect to receive in the argument passed to the function (in this case you called the argument callback) the code…
-
2
votes7
answers1322
viewsA: Push element from one array to another array
Using Filter Although the filter causes the execution to pass twice through the array, the code becomes simpler. var array = [1, 2, 3, 4, 5]; function PickIt(arr) { return { par: arr.filter(x =>…
javascriptanswered Pagotti 3,042 -
2
votes1
answer328
viewsA: How to validate the JSON schema in C#?
One way is to create an deserializer using the library Newtonsoft. The first step is to generate the classes that represent the JSON object. One way to do this is to use an online service or by…
-
4
votes5
answers1894
viewsA: Test for string fill
One way to understand performance is to test: class Program { static void Main(string[] args) { string test = StrintToTest(); while(true) { Console.WriteLine("Press any key. ESC to exit"); var key =…
-
1
votes1
answer611
viewsA: How to do version control with Gitlab?
Gitlab already offers version control service Maybe you’re new to Git and that’s why you’re confusing things, so I suggest you go through Git Quick and Basic Guide. In short, Git is the software you…
-
1
votes3
answers816
viewsA: Remove spaces from a string from the second occurrence
Split + Join An alternative to keeping the first space is to use Split with the Join. let str = 'abc defghijk lmnop qrstuv wx y z' tokens = str.split(' ') str = tokens[0] + ' ' +…
-
1
votes1
answer388
viewsA: Google Maps - Set Zoom user
Use the Browser Location service The browser will ask the user to allow you to use the service and if they allow it, it will trigger the function and change the position of the map to its location.…
-
0
votes1
answer1627
viewsA: Bootstrap breaking line
Setting up a line in Bootstrap should be within a div classy row. This ensures that there is no break within that line according to the width. The way you define it as a single line, the resolution…
-
1
votes1
answer213
views -
1
votes1
answer221
viewsA: How to migrate a C# system using ASP.NET?
Layers The solution you’re looking for is known as layered architecture. When you separate your system into layers you are looking for some advantages like independence and reuse. What is the main…
-
1
votes3
answers63
viewsA: Business rule in a personal system
In short, the definition of a system goes through some phases. After this definition is that the system goes into "production". The academic part that takes care of this part is called Software…
business-ruleanswered Pagotti 3,042 -
3
votes4
answers1629
viewsA: Use color, RGB or hexa names?
Names in SVG 1.0 standard I believe the answer lies in the very documentation you put as reference in the question. I put in the title the link to the Portuguese page for the part that talks about…
-
1
votes2
answers29
viewsA: Difficulty finding values in an array
If the intention is to have as a result array with the field "name" of SELECT, you need to do: $guarda_array = array(); $count_pub=mysqli_query($db, "SELECT nome FROM publicidades_sponsors");…
-
0
votes2
answers586
viewsA: Checking multiple <select> of same "name" if it is empty with Jquery
Make a filter on us select that has some value. if ($("select[name='produto_qtd[]']").toArray().filter(function (e) { return $(e).val(); }).length > 0) alert('algum selecionado'); else…
-
2
votes1
answer108
viewsA: Problems with accentuation in Neo4j
Regular Expressions I played with Neo4j some time ago and remember that the names used were always treated as case-sensitive. I don’t remember seeing any features collations same as SQL databases.…
-
13
votes2
answers564
viewsA: Performance in PHP: consider or not?
Do Not Consider Performance I decided to put an answer, but it is necessary to anticipate that answers to this type of question will end up being based on the experience of each one with language.…
-
1
votes1
answer121
viewsA: How to make Generic with 2 C#classes
Its generic type in the abstract service class must follow the same type defined by Model and in the concrete class must specify a class which is an inheritance of Dao<Persistant>. A hint: In…
-
0
votes1
answer206
viewsA: What is the life cycle of an HTTP request in MVC standards?
Service is one of the 3 application layers The question you posted as a reference to your question, calls "service" the intermediate layer of the application. This intermediate layer is described…
-
11
votes3
answers5033
viewsA: Use UTF-8 or Latin1?
There is no correct answer for choosing the encoding. The choice must be made according to their needs. That is why banks accept several types. If your system has no chance to receive any special…
-
0
votes1
answer83
viewsA: How can I do this more intelligently and without conflict?
Regular Expression For the replacement part, use a regular expression to do the replace. When programming the expression, place the double sequences first and then the simple ones. A good place to…
-
6
votes3
answers285
viewsA: What is the function of #if false in C#?
Compilation Condicional The #IF is a pre-compilation command. With it you can modify your code according to parameters (constants) that you define or use predefined constants like the DEBUG or…
-
0
votes1
answer269
viewsA: alt and two letter shortcut
The key capture can pick up one key at a time and more the state of the shift, ctrl or alt. Then your code can capture the first choice and wait for the second. On the second capture, it performs…
-
1
votes2
answers189
viewsA: Multiply values from a dynamic table
In the first part of the code what he’s doing is putting an event in each box of input within the table for when the user enters some value. At this event he picks up the line tr to which the input…
-
0
votes1
answer140
viewsA: Problem creating foreign key in Entity
The error indicates that the EF did not find the property with the name you defined as FK in the annotation. You can try adding a navigation property to FK: public class Keys { [Key, Column(Order =…
-
1
votes2
answers96
viewsA: Correct code to select and compare
Use the clause EXISTS In the specific case of your example: SELECT * FROM A WHERE NOT EXISTS ( SELECT * FROM B WHERE A1 = B1 AND A2 = B2 AND A3 = B3) I created a DB Fiddle for you to see how it…
-
3
votes2
answers1245
viewsA: What is Operational Research in the Context of Computing?
In summary Operational Research (P.O.) is an area of applied mathematics that basically tries to solve problems related to optimization by searching solutions of equations of maximum (higher profit,…
-
3
votes1
answer168
viewsA: Python: Cleaning html code
You can use the re.sub() Example to remove attributes style: import re html_string = "[coloque aqui seu HTML]" html_no_style = re.sub(r' style="[^"]+"', '', html_string) It is important to test with…
-
3
votes2
answers297
viewsA: Can I have performance problems joining multiple classes to a single file?
No difference in final performance Separating a file for each class is a good practice to make code more readable and organized. The result of running the program after compiled will be the same if…
-
1
votes3
answers304
viewsA: Where is the error in replace js?
The Replace has only 2 arguments. The second argument from Replace it’s not like array of parameters. No Replace you must put an expression that represents the substitution of all parts of the…
-
1
votes2
answers2197
viewsA: What is the most efficient way to clear a list (List) with C#?
Complementing the answer already given, it is possible to use the class Stopwatch to perform performance tests of the possibilities you raised. For example: public class Program { public static void…
-
1
votes1
answer98
viewsA: Query PIVOT or SUM
Simulate the Pivot dynamically Mysql does not have Pivot. In that case you have two options. Generate a column for each case in one SUM with CASE. Dynamically generate the same SQL if the column…
-
0
votes3
answers3825
viewsA: Format date in SQL SERVER
Format without the tab If your field is DateTime you don’t need to make conversions to varchar to place a WHERE, just send the date in format 'yyyyMMdd hh:mm:ss' that SQL Server will recognize…
-
3
votes2
answers112
viewsA: What is the best way to monitor a value in a database?
During the Transaction If you have a system, it is likely that that system has a service layer or a layer of data access or business rules that handle the transactions that the system is running…
-
5
votes3
answers132
viewsA: Is there a "description" language of UML?
yUML I’ve used this tool that serves for some types of diagrams and has the advantage that you can share and have plugins for various platforms. An example: Code for Class Diagram:…
-
1
votes3
answers186
viewsA: Crossing of Tables with Multiple Coalesce
From the structure you presented, it seems to me that the desired output is something like this: SELECT COALESCE(A.ano_pcs_novo, D.ano_pcs_novo) AS ano_pcs_novo, COALESCE(A.nro_pcs_novo,…
sql-serveranswered Pagotti 3,042 -
0
votes8
answers955
viewsA: split/regex only on the first vertical bar "|"
Using slice and split var texto = "João|||23anos|"; var resultado = texto.split("|", 1).concat([texto.slice(texto.indexOf("|") + 1)]); console.log(resultado);…
-
0
votes4
answers211
viewsA: jQuery Hover does not work
Capture the mouse events Instead of hover use mouse events at document level: $(document).on("mouseenter", ".buy", function() { $(this).text('Ligue 0800 123 4567'); }); $(document).on("mouseleave",…