Posts by gato • 22,329 points
373 posts
-
2
votes1
answer336
viewsA: Does Python have a way to natively drip an IP?
There’s the Pyping that you can use, and any other way to use ping is by triggering it by the system itself other than this. Use Pip to install: pip install pyping Take an example: import pyping r =…
-
10
votes1
answer177
viewsQ: What is Type Annotation?
I’m reading a book about Typescript and I came across something that caught my attention which is the Type Annotation. Take the example: function foo(): { a: number, b?: number } { if (this.a <=…
-
14
votes1
answer368
viewsQ: What is abstraction and how does it influence the creation of functions?
I was reading a answer about Python user’s @Cool in which he mentions the term abstraction in relation to complexity, functions and object orientation, see: What you can do if you can’t change the…
-
7
votes1
answer146
viewsQ: What is the purpose of the keyword "export"?
I created a angular design to start my learning and I am currently using Typescript to do the App. However, a question arose regarding the keyword export (if it really is a keyword). I used it to…
-
5
votes2
answers64
viewsA: Doubt with string, extract data
Since it is a JSON I recommend using the library Json.NET Newtonsoft to get the data you want. Just do a Parsing using the class JArray and in a foreach get the key values tag so that you can fill…
-
2
votes5
answers714
viewsA: I want to turn a text into a list of dictionaries
One thing you have to keep in mind regarding JSON is that you should use double quotes " instead of single quotes ', see more about JSON. So your JSON has to be fixed. Of: [{'pais': 'Argentina',…
-
7
votes1
answer103
viewsQ: How can I define line breaks between elements of a layout?
I’m adding CSS and HTML and one of the doubts that always arise to me is in the way I should define the line break between elements of a layout. For example: <p>Nome</p> <input…
-
-2
votes1
answer640
viewsQ: How to remove the question mark "?" at the end of the URL of a request?
I’m using a form to trigger a request GET to an endpoint of mine <button> instead of the tag <a> for links because the CSS style was only made for the tag <button>. Behold:…
-
4
votes2
answers123
viewsQ: Why doesn’t my class apply the style I set to the "H1" tag?
I did an example of CSS code to learn a little bit more about the use of classes. However, I realized a mistake and I can’t quite understand why. 1° example .fonte-style-h1 { vertical-align: middle;…
-
10
votes4
answers4140
viewsQ: What is bias in neural networks?
In my Artificial Intelligence class the teacher addressed the subject of neural networks, which in this case, neural networks have the layers, such as: entree, occult and exit and the neurons that…
artificial-intelligenceasked gato 22,329 -
2
votes1
answer50
viewsQ: How to associate a set of words to a "do_" method of the Cmd class?
I’m using the class Cmd of module cmd Python to create an interpreter for a game in Text Adventure. However, I have come up with a problem regarding the words I use as methods for the interpreter to…
-
5
votes1
answer672
viewsQ: What are Mutexes and when is it advisable to use this feature?
I read about Mutexes and the class Mutex. However, I cannot understand clearly what Mutex is and what this class does. Since I would like to know if I can use this feature to prevent my desktop…
-
-3
votes1
answer169
viewsQ: How to build a basic parse to treat a sentence and extract an action contained in it that will be executed?
I’m trying to put together a simple parse to parse commands entered by a user for a type game Text Adventure. However, I’ve never had experience with it and I don’t know if the structure and types…
-
4
votes1
answer2544
viewsQ: How is the basic functioning of algorithm A*?
I’m reading regarding the search algorithm A* to be able to implement it in the future. I know it’s used to find a path in a graph, but I can’t visualize very well how it’s done. However, I am…
-
8
votes2
answers1283
viewsQ: How to access the elements of a set (set)?
I’m studying about ensembles (set) in Python because I’m going to use it in an algorithm to find paths in a graph, it’s for a college discipline that I’m having. I created two set examples using two…
-
3
votes2
answers679
viewsQ: What determines a variable as a Python array?
I’m studying about lines in Python and I’m using the object deque module Collections. So, in Python I can access the values of an array by simply writing: array = [1, 2, 3] arra[0] # 1 However, the…
-
1
votes3
answers1367
viewsA: Placing spaces between letters of a text
In Linq there is the method Select which allows you to design each element of a sequence. Remember that a string is nothing more than a sequence of characters. Take an example: var str = "Alguma…
-
2
votes1
answer548
viewsA: Check whether double variable is empty or numeric
Simply use the method Tryparse that converts a string for a number double, the first parameter of the method is the string to be converted and the second is the result in double equivalent to the…
-
3
votes2
answers110
viewsQ: How to associate objects to the vertices of a graph?
I’m studying about graph theory, more specifically about vertices which are units representing a given node of a graph. However, there are still some doubts regarding the vertices. See this…
-
4
votes1
answer2413
viewsA: Copy records from one table to another via select
There is the function IF() with it you can "transform" the null values into some other value in your insert... select, see this example: insert into table2(nome) select if (nome is null,'padrao para…
-
7
votes3
answers12436
viewsQ: What are recorders and what is their basic functioning?
I am reading a book about Assembly in order to better understand how a low-level language works, it will help me to understand more effectively the internal functioning of the programs I develop in…
-
3
votes2
answers273
viewsA: How to make an if-type validation in a set of options?
In your case I suggest you create a class with the fields that represent this XML and use Dataannotations for properties that cannot be empty, would be the attribute Required, see:…
-
6
votes1
answer111
viewsQ: What is type reference?
Was reading regarding the key word ref and I came across a warning that said not to confuse reference passage with type reference. No doubt this warning left me confused and awakened more doubts…
-
4
votes3
answers176
viewsA: Dynamic allocation with a void function
There’s no need to encapsulate the function malloc, even more this way, you could even get the return of it, however you would have to evaluate the gain and consider the context, but as it is…
-
1
votes1
answer611
viewsA: How to check if a field of an array of chars is empty in Java?
I believe there is no "empty" representation for the type char which is primitive, like '', then you have to look at it differently. I looked at the class documentation Character and I found the…
-
8
votes2
answers2322
viewsQ: How to ignore accents in an SQL query?
How could I perform a query ignoring words with letters that contain accents? Example of words: Olá, é, Lógica, Pão I tried using the command collate noaccents as follows: select c.* from Curso c…
-
1
votes2
answers109
viewsA: Is it wrong to put this much code into a button click event?
There is a lot of redundancy in your code. The event CPeBTNSalvar_Click will request the registration of something in the database or file? It seems that it is only searching the data of…
-
1
votes1
answer164
viewsA: Get reply JSON information
You can do it this way: echo 'ipPort: ' . $json["data"][0]["ipPort"]; Exit: ipport: 83.169.202.2:3128 The estate data contains a list with the information you need, in this case we get only the…
-
7
votes2
answers4189
viewsQ: How to generate the alphabet with white space between letters?
In Haskell I can generate the alphabet as follows: alfabeto = ['a'..'z'] To display it is enough: alfabeto "abcdefghijklmnopqrstuvwxyz" However, I would like to know how I can put a space between…
-
2
votes4
answers542
viewsA: Is there a design standard or recommendation that defines the optimal amount of parameters a function should have?
There is this principle of the book Clean Code by Robert C. Martin, he was adapted for PHP by the community, not that people should follow to the letter, but have to consider the context and…
-
1
votes2
answers61
viewsQ: How to display the values of two-class fields in a Datagridview?
I’m populating an object DataGridView with a list of type classes List<Curso>, and the way I populate the DataGridView is as follows: meuDataGridView.DataSource = cursos; But one of the fields…
-
4
votes3
answers124
viewsQ: How can I use or name constants for response type fields?
There are situations in which we have fields that represent a type of response, whether boolean responses sim and não, S and N or with multiple responses like the status of something. For example…
-
3
votes2
answers406
viewsQ: What is the purpose of the Interfaces used in a Mock?
I’m using a library called Moq which serves to create mocks that will be used in unit tests. However, to create a mock it is necessary to specify an interface, as in the example of the Moq project…
-
0
votes1
answer63
viewsA: how to pass two structs per function
If there is no type defined for the struct it is necessary to inform explicitly the struct, basically like this struct aluno a. In addition, the passage of struct can be done by reference or by…
-
8
votes1
answer198
viewsQ: How to implement the "evaluate()" and "successor()" method of the Slope Rise algorithm?
I’m trying to implement the algorithm Hill Climb (Hill Climbing) and this algorithm should return the sequence of cities considered good (with the shortest distance between cities) the problem of…
-
5
votes1
answer1239
viewsQ: What is an Adjacency Matrix?
Whenever read something in relation to graph theory I stumble upon a term called Adjacency matrix, it seems to me that this is strongly related to this theory. Therefore, I would like to know more…
-
4
votes2
answers888
viewsQ: How to get the row and column indexes of a list List<List<int>>?
I have a list that simulates a matrix (or two-dimensional array) that is structured as follows: List<List<int>> matriz = new List<List<int>>(); Whereas this matriz is…
-
1
votes2
answers112
viewsA: How to run a subconsultation on LINQ C#?
One way to do this is by creating a new variable with the let where their ids would be, then just use the method Contains to check whether the id corresponds in consultation. Take this example: var…
-
3
votes1
answer59
viewsQ: Is it possible to use Mariadb for Clusterization?
I am studying about SQL database analysis, and to go deeper I intend to run some practical tests with a DBMS, and I chose Mariadb for this. Therefore, I would like to know if it is possible to use…
-
11
votes2
answers2940
viewsQ: What is regression testing?
In the subject of Software Testing the teacher addressed a term called Regression Test, this within the software testing discipline. So this term has generated me some doubts regarding this…
-
7
votes1
answer250
viewsQ: What is the applicability of the eight queens problem?
In college the professor of linear programming presented the Problem of the 8 Queens. Basically, from what I understand, this problem consists of filling the board (could be simulated with a matrix)…
computer-scienceasked gato 22,329 -
6
votes1
answer1940
viewsA: How to resize an image in c#?
In the link suggested by @Diegosantos there is a method that allows resizing the image. I did a test with a PNG image with the size 1920x1080 and the size 2.46 MB. I resized the image to 600x400 and…
-
2
votes1
answer180
viewsQ: What would be the format of the data transmitted by a SOAP web service?
In web services that use the REST architecture, the format of the data that is trafficked by the network is XML or JSON, in some cases may be both. However, I don’t know what is the format of the…
-
5
votes2
answers576
viewsA: Extract Date from a C#String
You should analyze the dates within this string to ensure they are valid dates, so avoid future problems. With a regular expression and using the method Tryparseexact it is possible to extract the…
-
6
votes1
answer617
viewsQ: What is a Distributed System
In my distributed system class, SOAP and REST web-services and other topics in this field are discussed. However, I can’t understand what a Distributed System, I don’t know if it’s a combination of…
terminologyasked gato 22,329 -
3
votes2
answers459
viewsA: How does Hoisting work on ES6?
The Hoisting is a Javascript behavior of moving statements to the top of the scope, can be the global scope or a function. In es6 there are these two key words let and const. Let’s see how the…
-
15
votes5
answers453
viewsA: How to separate "words" in Camelcase in C#?
I made it based in this answer, she does not use regular expression see: string camelCase = string.Concat(ExampleEnum.CamelCase.ToString().Select((x,i) => i > 0 && char.IsUpper(x) ?…
-
1
votes2
answers284
viewsA: Convert number c#
You can use the class NumberFormatInfo to specify the information contained in the corresponding numerical value. In addition, it is important that you test as many entries as possible to prevent…
-
4
votes2
answers1245
viewsQ: What is Operational Research in the Context of Computing?
In the Linear Programming subject of my faculty, the professor cites a term called Operational Research where it uses certain algorithms to solve certain types of problems. However, I was very…
-
3
votes2
answers81
viewsA: Fragment string into random parts
I created a function that does this job, however, I advise you to test and optimize it before applying in a real case, even more when the string is too large. I would do this on the server-side and…
javascriptanswered gato 22,329