Posts by Gabe • 2,417 points
20 posts
-
3
votes1
answer148
viewsQ: Set the array pointer within a function
I am trying to write a function that assigns an integer or a list of integers to a pointer, depending on a parameter. But the assignment doesn’t work within it, just outside: void retorna_algo(int…
-
3
votes1
answer917
viewsQ: How to insert a breakpoint into Javascript by code
I know it is possible to mark a line as breakpoint using Dev Tools, but it is possible to invoke the browser Debugger directly from the code?
-
4
votes2
answers6367
viewsA: Open, edit and save a binary file in Python3
To open a file in binary mode just use the mode b in office open: open("arquivo", "r+b") # Abre arquivo em modo binário para edição From there, all normal file reading, writing and browsing…
-
39
votes1
answer20752
viewsQ: Is it possible to do an UPDATE with data from another table?
I know it’s possible to execute one INSERT with data from another table: INSERT INTO Tabela (Col01, Col02, Col03) SELECT Col01, Col02, Col03 FROM Outra_tabela WHERE Condicao = 'qualquer coisa' But…
-
15
votes1
answer676
viewsQ: What is the purpose of the with_jquery function?
I’m learning to write Userscripts (for Tampermonkey) and virtually every example I see makes use of a function with_jquery: function with_jquery(f) { if (!jQuery) return; var script =…
-
13
votes1
answer4730
viewsA: When to use the term "url" or "link"?
The "path" of an image, or any resource, is always a URL. The acronym URL means "Uniform Resource Finder" and describes the address naming pattern of anything that can be accessed on a network. The…
terminologyanswered Gabe 2,417 -
2
votes3
answers384
viewsA: Reset "<select>" by unchecking checkbox
The line commented on in your example: // $('select').prop('selectedIndex', 0); was already very close to the solution. The problem is that $('select') returns all page selects, and then all were…
-
14
votes1
answer2693
viewsA: Differences between Python versions 3.x and 2.7
Python 3 is the future and present of Python. The two versions are maintained in parallel, for now, because version 3 was not designed to be backward compatible with existing Python 2 code. So they…
-
13
votes5
answers1943
viewsA: Is it possible to program to web with Lua?
Yes. is not a very mature ecosystem, but there are options for web frameworks in Lua: Pencil Sailor Orbit Ophal Lapis and Sailor look more advanced and robust, plus newer and updated.…
-
41
votes3
answers31330
viewsA: How to edit an incorrect commit message in Git?
There are 3 different situations, which become more and more complex: Edit the last local commit - BEFORE THE PUSH: The git commit --amend will open your editor, with the contents of the last commit…
-
18
votes2
answers4822
viewsA: What would be the best practices for commits in Git?
To documentation "official"1 git has a recommendation about commits and messages. They are a set of good practices to make the nevegação by the history of the project easier to assimilate. Although…
-
5
votes1
answer729
viewsQ: What is string.maketrans for?
I was looking at some Python challenges and found one that involved rotating the characters of a string. Of type 'a' turns 'c', 'b' turns’d', and at the end 'y' turns 'a' and 'z' turns 'b'. While…
-
2
votes1
answer742
viewsA: CSS interfering with element position while dragging
The function moveToPos uses the function translate CSS to change the place object. O translate functions as a matrix operation, and therefore relative to the object’s initial position. That is, when…
-
6
votes3
answers561
viewsA: Nth value of a binary search tree
I saw the @pcccj reply and agree with what it says, about returning the item, and not just write down its value. There are several ways to do this, from a genius algorithm that masterfully…
-
2
votes1
answer55
viewsQ: How to include one vim configuration file in another?
I am reorganizing/redoing my vim configuration files and would like to leave different language settings in separate files. Something like that: .vimrc .vimrc.python .vimrc.ruby .vimrc.cpp .vimrc.js…
-
1
votes0
answers37
viewsQ: Use regex in patsub
make has the function patsub to replace, or remove, text patterns in a string. A documentation only has examples containing fixed text snippets. make has some native way of applying regex to a…
-
7
votes1
answer579
viewsQ: Pass arguments to Makefile
I have a folder with a series of Latex files: arquivo_001.tex arquivo_002.tex arquivo_003.tex arquivo_004.tex My idea is to write a Makefile that allows me to do something like make 004 and he…
-
4
votes2
answers377
viewsA: Override the Python mock Decorator
The explanation of mgibsonbr on the application order of the decorators makes sense. In the same way as a pile of decorators is applied from the bottom up. I was hoping otherwise, for some reason.…
-
12
votes2
answers377
viewsQ: Override the Python mock Decorator
I have a class TestCase where all tests, except one, need to patch the same object. I am using the Python Mock, and I did the following: @mock.patch('metodo_alvo', mock.Mock(return_value=1)) class…
-
21
votes4
answers6715
viewsQ: How to call an external function without sending the 'self'?
I’m using a class attribute to save the View that I want to test on a Django application, like this: # TESTS.PY class OrderTests(TestCase, ShopTest): _VIEW = views.order def…