Posts by gato • 22,329 points
373 posts
-
0
votes4
answers361
viewsA: Comparison between random number and typed number never says it’s right, even though the numbers are equal
Just complementing the other answers. You can also use one ternary operator to complete this routine of checking the number with the drawn number and simplify a little more the code, see below: from…
-
6
votes1
answer3009
viewsA: Equivalent of python Curl
You can use the Requests: HTTP for Humans to consume some service from an API or make common requests. Take an example: >>> import requests >>> r =…
-
8
votes6
answers2555
viewsA: How to change the title element text?
You can use pure Javascript to change the value, see: document.getElementById('1ano_card_title').childNodes[0].nodeValue = "R$20,00"; <h2 id="1ano_card_title" class="card-title…
-
2
votes2
answers1187
viewsQ: What is the purpose of the Assets directory?
I’m starting to learn about Unity, and in my first project I came up with a question about the directory Assets. It contains some files that are C# game scripts, and other extension files *.asset…
-
2
votes1
answer36
viewsQ: Is there an alternative to PRIORITY_MAX that is obsolete?
I’m using the class NotificationCompat.Builder to create a notification where it has to be at the top with the highest priority. I set the notification priority as follows:…
-
5
votes1
answer2040
viewsA: How to add Jquery to Electron?
You need to use the Node to install jQuery so you can use it on the server-side. See below: npm install jQuery Then just include the jQuery package (like suggested by Anderson Carlos Woss): var $ =…
-
8
votes2
answers333
viewsQ: What is the Technological Singularity?
Every time I read one news story related to artificial intelligence I came up with the word uniqueness, and along with it comes that Singularity Technology. I have already researched the term,…
-
5
votes1
answer2022
viewsQ: What is a view-port?
In this my question the user Guilherme Nascimento mentioned a term called view-port in its response to a div and its CSS, this term is unknown to me and has given me some doubts. Doubts What is…
-
1
votes1
answer5091
viewsQ: How to keep div size independent of text size?
I own a div which represents a square in which it aims to display a text to the user, see: html, body { background-color: #323232; } html { font-family: 'helvetica neue', 'arial', sans-serif;…
-
1
votes2
answers1343
viewsQ: How to check the format and type of a text file?
I have a input file in which I limited to only accept file whose format is a text file, with extension .txt. I used the attribute accept for this, see: accept=".txt" However, I would like to know if…
-
3
votes1
answer2225
viewsA: How to check if one list is inside the other?
You use the method intersection and check if there are common values in your set or list. Basically, it checks whether the elements of n belongs to lista. Behold: n = [int(input()) for c in range(0,…
-
13
votes1
answer1704
viewsQ: What are the terms "Cascade" and "Classifier" in relation to computer vision?
Always when I read something about Opencv and computer vision I come up with two terms that are Cascade and Classifier, these terms leave me very confused as to what they may be or mean. Therefore,…
-
2
votes3
answers520
viewsA: How to put this Alert JS to appear when entering the page
One way to do this is to add this library to the HTML and use it globally. Behold: swal("Meu alerta", "Olá alerta :D !"); <script…
-
7
votes6
answers1015
viewsQ: How could I highlight the radio button that is selected?
I own this radio group which serves to specify the severity level of a given occurrence, using the colors to classify the level. Behold: <html lang="en"> <head> <meta…
-
3
votes2
answers2956
viewsQ: How to change the color of a radio button?
I have these radio Buttons in which it serves to specify the level of severity of a given occurrence. And I’d like to know how I could change their color? Follow this illustration example: <link…
-
1
votes3
answers107
viewsA: Python - Variable problem
This is a name conflict, you have a local variable with the same name as a variable declared in the global scope, change the name of one of its variables and no more conflict. And as the local…
python-3.xanswered gato 22,329 -
4
votes1
answer1340
viewsQ: What are the differences between the HASH and BTREE algorithms used in an index?
I realized that I can create two types of indexes for one determining field in Heidisql, which use the algorithm HASH or BTREE, see below: See the CREATE code from an example table for the…
-
0
votes2
answers2666
viewsA: Pass values from one Object to another form C#
You can create a property of your class type in the form you want to receive the object and pass the object in the form builder, see an example below. Form that will receive the object: public…
-
2
votes1
answer839
viewsA: Edit value within an XML node with C#
One way to change a given node of an XML document is by using Xpath to create a query and select the node you want to change. In this case, I stored the knot in a Xmlnode that serves to represent a…
-
1
votes2
answers275
viewsQ: How to access the database directly from my model class in an ASP.NET Core project?
In ASP.NET Core Mvc I can access Dbcontext in the Controller through the property _context represented by my class MvcNotaContext see: private readonly MvcNotaContext _context; This way I can…
-
4
votes1
answer535
viewsQ: What is an Over-posting attack?
I came across the term Over-posting while following Microsoft’s guide to creating ASP.NET Core applications. I had made a question regarding the use of attributes in the signature of a method, which…
-
2
votes1
answer106
viewsQ: What is the purpose of the "[Bind("ID,Title,Releasedate,Genre,Price")]" feature in a method?
I am creating a project in ASP.NET Core MVC for learning purposes. In a certain part of the Microsoft guide when the technique of scaffold to generate the controller and the views corresponding to…
-
3
votes2
answers476
viewsA: Doubt Console.Readline
You have to convert the value to integer, see: using System; public class Program { public static void Main() { int tempo = 0; if (int.TryParse(Console.ReadLine(), out tempo)) Console.WriteLine("O…
-
4
votes2
answers95
viewsA: Mysql parameter automation does not work
I adapted this method for you MontarSqlComCondicoes() and you can take as your starting point. Behold: static string MontarSqlComCondicoes(string tabela, string c1, string c2, bool and) { var…
-
0
votes2
answers234
viewsA: How to read a string within an array?
Based in this answer I adapted a script for you, see: #!/bin/bash IFS=' ' read -r -a array <<< "20171012 20171102 20171115 20171120 20171225" echo "${array[4]}" Exit: 20171225…
-
7
votes3
answers1011
viewsA: How to compare strings differentiating case from case?
You can use the property Invariantcultureignorecase class StringComparer, see: string str1 = "Stack"; string str2 = "stack"; Console.WriteLine(str1.Equals(str2,…
-
3
votes3
answers97
viewsA: Group repeated values of Dropdownlist fill sql statement
One way to avoid repeating values of a given field is to use the method Distinct(), see a reproducible example: using System; using System.Linq; using System.Collections.Generic; public class…
-
9
votes3
answers1488
viewsA: Using Lower() in a list of lists in Python
A way to use the Lower in this list list, is to use the function map() and give an expression lambda for her lambda x:x.lower(), who had used the function lower() to do the job. However, it is…
-
8
votes1
answer812
viewsQ: What are the terms RISC and CISC regarding software development?
My teacher mentioned the two terms RISC and CISC, they seem to me to be some kind of architecture. And software that is developed (compiled) for computers that use RISC cannot be run on CISC-type…
-
2
votes2
answers4614
viewsA: How to calculate the factorial of a number?
If you want to calculate the factorial of a number, you can use the function array_product to calculate the product of the values contained in the array that in this case would be the sequence…
-
6
votes2
answers1240
viewsQ: What is the purpose of the Recyclerview.Adapter class when using Recyclerview?
To use the Recylerview Android we need to create a class CustomAdapter extending from the abstract class RecyclerView.Adapter then implement three methods that are: onCreateViewHolder…
-
8
votes1
answer1772
viewsQ: What is Viewholder Pattern?
I’m implementing a RecyclerView on Android and I noticed that it is necessary to create a class called ViewHolder. This class seems to be a design standard called Viewholder Pattern, and my doubts…
-
11
votes3
answers2941
viewsQ: What is a View on Android?
The visual components of Android as EditText, Button and others, possess the Listeners to handle events triggered by actions performed by users. Therefore, in the method corresponding to the event,…
-
15
votes2
answers13776
viewsQ: What’s the difference between Apache Cordova and Ionic?
I have some questions regarding Apache Cordova and Ionic. Both, to me, seem the same thing with the same purpose, allow the creation of hybrid applications for mobile devices. See that in the ionic…
-
2
votes1
answer353
viewsQ: Handling synchronous and asynchronous request results
I have a function that triggers an ajax request for a route, see: var getInstituicoesSemUsuario = function(tipo) { var resultado = ""; $.ajax( { url: "{{path_for('instituicao.sem.responsavel')}}",…
-
3
votes1
answer1855
viewsA: include failed to open stream
You can use the magic constant: require __DIR__ . '/../Persistencia/ClienteCRUD.php'; It contains the file directory, and the directory name does not have a bar / at the end, unless it is the root…
-
3
votes2
answers6024
viewsA: Initialize apache and mysql in windows 7 32 Bits using Xampp
This solution works for me. Open the XAMPP Control Panel, and click the button config. Behold: then just enable Autostart corresponding to Mysql and Apache and click the button Save. See below: But,…
-
16
votes2
answers2789
viewsQ: Is SOA the same as REST?
I am learning about SOA in a college course. And from what I understand, SOA is tied to the concept of Web Services. There are also REST Apis that are also related to this concept. Both terms give…
-
4
votes0
answers40
viewsQ: What is the purpose of using "{ }" keys to access the property of a class?
I was doing some tests with the magic method __get PHP and discovered a different way to access class properties, which is by using keys { }, see: return $this->{$bar}; I can also access the…
-
2
votes0
answers38
viewsQ: What is the purpose of an empty interface?
I was looking at exceptions to the rule validation engine Respect Validation, and discovered something that caught my attention. This is the interface ExceptionInterface, that apparently, there is…
-
19
votes5
answers43935
viewsA: What is a Table Test? How to apply it?
What is the Table Test? The Table Test or Trace Table as it can be called. It is a technique used to test algorithms or computer programs, in order to check if there is an error in the logic during…
-
10
votes1
answer358
viewsQ: What is a Backlog?
Was reading regarding the term Backlog, but I did not understand very well what he would be in relation to Scrum. Well, according to this website, there are some variations of Backlog, and it seemed…
-
1
votes2
answers363
viewsA: File reading
One way to read the file is to get all its characters in a loop. Behold: #include <stdio.h> void lerArquivo(FILE * arq) { int c; while ((c = getc(arq)) != EOF) putchar(c); } int main(void) {…
-
1
votes2
answers30328
viewsA: How to run a . py program by python IDLE on Windows?
To run a Python script, you need to be at the Windows command prompt, so just type the following: python meuPrograma.py Or if you want to run the script in IDLE interactively, you will have to use a…
-
2
votes1
answer1027
viewsA: Print Format & End in Python
I adapted this code based in this answer soen. If your data entry is the column values that were selected in a query. It is possible to format the output independent of the specified number of…
-
1
votes1
answer588
viewsA: Extract attributes from an XML in a SOAP message
In your case, I suggest you use the LINQ to select the nodes you want. Since, it is not too difficult to manipulate XML with it. See how to get the values with LINQ through this your XML, follow the…
-
5
votes1
answer16303
viewsQ: How to make and calculate the Frequency Distribution Table in R?
I’m trying to make the Frequency distribution table in R, however, I am not succeeding due to some formulas and calculations that I cannot implement in R. The structure of the frequency distribution…
-
11
votes2
answers811
viewsQ: What is memory segmentation?
I read about memory segmentation, however, I cannot understand what memory segmentation is and how it influences the functioning of my program. Illustration See this example of a program that…
-
10
votes2
answers1673
viewsA: What is the purpose of : (two points) in PHP?
Complementing the @rray response. You will also find the two-point sign : as part of the ternary operator ?: used for conditions. Take an example: $user = "gato"; echo ($user === "gato") ? "meow" :…
-
7
votes1
answer803
viewsQ: How can a WEB application that uses Oauth for authentication manage the user session?
Usually sessions are used to keep data of a particular user after they have logged into the WEB application, and it is the WEB application that is responsible for controlling and managing that data…