Posts by mgibsonbr • 80,631 points
861 posts
-
2
votes3
answers10545
viewsA: Regular Expression White Space
The method Matcher.find looks for occurrences of a regular expression in a string. That is, it returns any substring that matches the regex you are looking for. If you want to extract the number…
-
2
votes2
answers548
views -
1
votes1
answer66
viewsA: Is it possible to know what shapes are currently available?
In accordance with the documentation (my emphasis): turtle.shape(name=None) Parameters: name - a string that is a valid form name Makes the shape of the turtle to be the one with the given name or,…
python-3.xanswered mgibsonbr 80,631 -
1
votes2
answers260
viewsA: How do programs store saved passwords?
When authentication to an external system is done by password, this password corresponds to access pass to this system - that is, to authenticate with it, you need to present this password, in its…
-
2
votes3
answers222
viewsA: Removing characters from a string - Python
If your string always has this format, just take its suffix - because the prefix Address: (8 letters) is fixed: s = "Address:58.200.133.200" ip = s[8:] If your input has any variance, the use of…
-
3
votes2
answers2574
viewsA: Read more than one. xls file in python
I suggest you take a look at the function zip and - if you do not yet have this concept - in list comprehensions (list comprehensions). This will help you a lot to structure your code. If you have a…
-
2
votes2
answers453
viewsA: Make list changes to be local in Python?
This is by design. A function accesses variables in its most general lexical scope (in this case, the top-level module) and can modify them at will. There is no copy being made. Even this is the…
-
9
votes4
answers1550
viewsA: How to make an external login authentication?
An "indirect" login is not much different from a "direct" login. The user presents his credentials to system A, system A presents these same credentials to system B, which in turn responds with a…
-
1
votes1
answer307
viewsA: Add attributes in file creation
In general, what attributes (metadata) a file can receive depends on two things: From the operating system, if these attributes are outsiders to the archive (i.e. not part of its contents); From the…
-
10
votes8
answers481
viewsA: I can’t learn syntax for
If you’re learning bonds for the first time, it helps to start with a simpler one - like the while - and only then pass to the for. This will help you understand exactly what happens in your code.…
-
5
votes2
answers2453
viewsA: Is it possible to do multiplications only with operators &, |, + and -?
You can do a multiplication [integer] using only the sum (+), provided that you have access to a conditional deviation operator that deviates if such registration is zero. By your link, there are…
-
3
votes2
answers526
viewsA: What is two-factor authentication?
The most common way to authenticate a user (i.e. prove that they are who they say they are) is through a password - a shared secret between the user and the server, which is assumed to be known only…
-
3
votes1
answer668
viewsA: Automatic input generator
I’m assuming you search for random entries, right? In this Wikipedia article about random graphs several different algorithms are cited to generate a graph, each with distinct properties (and…
-
3
votes1
answer1291
viewsA: Folder permission only for Android application
There is a workable solution if you want to save (possibly large) files to your sdcard and still make them accessible exclusively to your application: generate an encryption key in your application,…
-
2
votes1
answer292
viewsA: Vector in Java with fields in each cell
In Java every class - including the one that has the method main - can be used to create objects. This means that even your class Ex6 could to be used to create an object (although in practice this…
-
1
votes1
answer113
viewsA: How to serve a static page from.py urls?
According to an answer to the same question in Soen, this kind of thing is better done in webserver (Apache, Nginx...) than in Django. However, as a workaround there is the possibility of using one…
-
1
votes1
answer113
viewsQ: How to serve a static page from.py urls?
I have a website in Django where I want to serve the favicon.ico - which being a static file, is in STATIC_URL/caminho/pro/favicon.ico. It is possible to do this directly from urls.py? (i.e. without…
-
7
votes3
answers1012
viewsA: Recover md5 password from an Android application
First of all, using MD5 to hash passwords is a bad idea. You should decide whether or not to hash and, if the answer is "yes", do so in the appropriate manner (i.e. using a hash algorithm for this…
-
4
votes3
answers99
viewsA: Placing a vector in decreasing order
The problems with your code are as follows:: You’ll never get into that loop: for(int i=n;i>vetor.length;i--) { At the beginning, i vale n, which is equal to vetor.length; when the condition is…
-
2
votes1
answer886
viewsA: What is the Journal file on Android
The purpose of a Journal ("") is to ensure the atomicity changes made to the database data: say you have a transaction with 3 Inserts/updates/Letes; how to ensure that or all three succeed or the…
-
5
votes2
answers1410
viewsA: How to effectively test and locate application security holes?
According to your description of the most common problems, I would divide the attention on two fronts: Script injection for page redirection Image injection into news and highlights This is a sign…
-
6
votes2
answers157
viewsA: Using a security framework or fingernail?
Security is something very difficult to do it properly. The chances of you making a mistake are enormous. And especially if you have little knowledge on the subject, there is the possibility that…
-
19
votes2
answers526
viewsQ: What is two-factor authentication?
What is two-factor authentication? Or multiple-factor authentication? This expression usually comes from "associated" to large companies - such as Google, Facebook, etc - that have a login and…
-
21
votes6
answers1117
viewsA: Algorithm against Brute-force
The answer of the utluiz gives a good overview, besides calling attention to an important point: if your "security" is less, you are the target of a brute force attack; if it is too much, you are…
-
3
votes1
answer7703
viewsA: Problems with Constraints in Postgresql
Your table chamado has the following primary key definition: PRIMARY KEY("chamado_id","empresa_cliente_empresa_id","usuario_solicitante","usuario_responsavel") And nothing else. It means that a call…
-
151
votes7
answers26094
viewsQ: What is the difference between parameter and argument?
I have always used the terms "parameter" and "argument" as if they were synonyms: what is passed to a function and/or what the function receives as input. In the same way, I have read one and…
-
4
votes1
answer295
viewsA: Purposeful Cartesian product
What I’m going to write may sound absurd, but it’s common practice in techniques of Data Mining (in contrast to "normal" transactional systems, where this would be considered a WTF): Simply create a…
-
7
votes1
answer581
viewsQ: How do I know if a resource is in the browser cache?
Is it possible to find out, via Javascript and without any additional HTTP request, whether or not a particular resource is in the browser cache? And if you are, get it too without that requisition?…
-
9
votes1
answer344
viewsA: Standard that has contributed to the reliability of software that needs to meet complex models such as multi-business models
I believe the pattern multi-tenant ("multi-tenant") would be suitable for this case - although it is a single operator of a single company to access the various tenants. That article briefly…
pattern-designanswered mgibsonbr 80,631 -
23
votes3
answers72012
viewsA: Global variable in Javascript
In Javascript, a variable is global in the following situations: She was declared unused var: fill = ""; // Globalmente acessível She was declared using var, but in the top-level (i.e. without being…
-
1
votes2
answers1011
viewsA: Problems with saving data in form-model Django
I have no experience with Forms, but most likely your problem is that there are no indications of errors in your template. This is your line on ticket_post: if not form.is_valid(): return…
-
4
votes2
answers1417
views -
8
votes4
answers425
viewsA: Is it not recommended to use scaffolding?
It depends on the quality of scaffolding, and how well he deals with the inevitable changes which will arise during the course of the. Generally speaking, every time a system (e.g., its application)…
software-engineeringanswered mgibsonbr 80,631 -
10
votes2
answers1442
viewsA: HTTP requests in C++
According to that question on Soen, how to make an HTTP request depends on the operating system and/or the use of external libraries. According to the accepted answer, the recommended form is…
-
5
votes1
answer824
viewsA: SSL Socket Java encryption
How do I know the message is being encrypted / decrypted ? The idea behind a layer cryptography is to abstract all this from the programmer, presenting itself as if it were a normal socket. That is,…
-
7
votes1
answer175
viewsA: Is it possible to make a fake POST request?
Yes, it is possible to forge all an HTTP request. Never trust client-side data. Regardless of your architecture, if your server is communicating with other systems it is essential that these systems…
-
6
votes6
answers2305
viewsA: Transform results combination function into a dynamic function
This is the kind of situation that a recursive solution would be more elegant than an iterative one. I’m going to suggest a very simple implementation, then refine it to make it more flexible and…
-
40
votes2
answers2030
viewsA: How does a birthday attack work?
The attack This attack is based on birthday problem: If people are in a room, what are the chances of two of them having the same birthday? As there is a fixed number of days in the year, and the…
-
28
votes1
answer10823
viewsA: What are the most files I can have in a folder?
There is a limit, but it is not the operating system that imposes this, but the file system. Check which file system your server uses, and search for your maximum amount of files per folder. In that…
-
9
votes2
answers10050
viewsA: How to use power notation in HTML?
The HTML element <sup> can be used to put a text in this form: 2<sup>3</sup> Vira: 23. Alternatively, you can use the unicode characters for superscript (although only a few of…
-
5
votes2
answers3994
viewsA: How to calculate total table value with Javascript?
Assuming that this micro-optimization is really necessary (e.g., the table is gigantic), my suggestion would be to keep the pre-calculated total and update it whenever a line is edited - subtracting…
-
1
votes2
answers221
viewsA: Python error access is denied
When you have two versions of Python installed on the same computer, in general they coexist well side by side, if installed correctly. In the case of Windows, there are a few things to consider: A…
python-2.7answered mgibsonbr 80,631 -
1
votes2
answers84
viewsA: How does the compiler work in the case of a casting like this?
When you call the printf passing two arguments - a string and a number - has no way the compiler knows what the printf will do with them; pro compiler, is a normal function call. So, you can’t…
-
2
votes1
answer156
viewsA: Replace text Beautifulsoup
According to that question on Soen, when you insert an object BeautifulSoup inside another object BeautifulSoup, the find stops working properly - it stops the search before the time (it’s a bug in…
-
9
votes3
answers2122
viewsA: Is it possible to create a Javascript database?
It is inadvisable to use the file system itself on a network drive for data that will potentially be changed by two or more people concurrently. The ideal is to use a mini webserver for this. For…
-
4
votes1
answer138
viewsA: Doubt in string comparison and list value for all lines
I am assuming that the first line contains the labels ("Name", "Age", ...) and the others contain data. If this is incorrect, please edit the question clarifying the fact. As I understand it, the…
-
6
votes1
answer99
viewsQ: Is there any way to Feature Detection for CSS?
I know the technique of Feature Detection ("functionality discovery") - as well as Feature inference - when it comes to Javascript: if ( window.XMLHttpRequest ) { ... } But can you do this for CSS…
-
4
votes3
answers3662
viewsA: Find quotes with blanks with Regex
The best I can suggest is a regex that matches the string as a whole. Because the problem here is that an analysis local can produce different results from an analysis global. My attempt at solution…
-
11
votes3
answers301
viewsA: What is cloud computing?
The term "cloud computing" originally referred to to a network architecture where several computers - not necessarily identical, or of equal capacity - collaborate in the accomplishment of a certain…
-
3
votes3
answers1452
viewsA: Validate URL with ER
Your second example is a URL valid! As Urls have the general format: esquema://máquina/caminho/recurso http and https are just two examples of schema (schema; sometimes called "protocol"). Others…