Posts by Pedro Rodrigues • 769 points
15 posts
-
7
votes2
answers14582
viewsA: What is Basic Auth?
Basic authentication, or in English basic Authentication is a simple authentication scheme embedded in the HTTP protocol. Client sends HTTP requests with the authorization header Authorization…
-
31
votes2
answers3085
viewsA: What are the main differences between Kotlin and Java?
Main differences: In Kotlin function sane first-class citizens, that is, the language allows to manipulate functions with the main, if not all, operations available to other entities: passage of…
-
0
votes2
answers731
viewsA: How to run the click event on an image that is in Activity’s Fragment?
You are getting this error because in the method onActivityCreated of your fragment, you are seeking a vision in your activity, but it belongs to your fragment. If you analyze the life cycle of a…
androidanswered Pedro Rodrigues 769 -
1
votes2
answers997
viewsA: Join lines from a text file
You can create an algorithm like this: import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import…
algorithmanswered Pedro Rodrigues 769 -
1
votes4
answers5419
viewsA: Vector without repeated numbers in C
You can do it like this: #include <stdlib.h> #include <stdio.h> int exists(int *numbers, int size, int n) { for (register int i = 0; i < size; i++) { if (numbers[i] == n) return 1; }…
canswered Pedro Rodrigues 769 -
0
votes1
answer157
viewsA: Deploy Heroku Maven project with multiple modules
Your Procfile should be in the root of the project, ie in the same directory as your package project is. If your application is a web server and the final artifact is a file jar, then your Procfile…
-
3
votes1
answer2643
viewsA: Post JSON on Android
Yes, you are making an HTTP request using the POST method. To check what is being sent in the request you can use some tools, such as Requestbin, it collects the requisition information and lets you…
-
0
votes2
answers168
viewsA: Allow a Function to be called only after a time that page has been loaded
You can listen to the cargo event from window, after that wait a while (using the function setTimeout) and then call its function. window.addEventListener("load", function load(event) {…
-
3
votes4
answers11586
viewsA: Text that you type little by little?
An alternative to [Sergio] code using an anonymous function: (function() { var node = document.getElementById('message'), message = "This is my message... ! Thx =)", current =…
-
1
votes3
answers666
viewsA: While loop - number counter minus 0
Just do it like this: (function () { var number = prompt("Enter a number, 0 to stop: "); var quantity = 0; while (number != 0) { quantity++; number = Number(prompt("Enter another, chose 0 to…
-
2
votes1
answer397
viewsA: Error in passing parameter to a Shell Script
The problem is in the last line of the script: $ montage -background '#"$BACKGROUND"' -geometry +4+4 *.jpg Montagem.png Everything inside simple quotes is preserved without exception. See the…
-
5
votes5
answers5611
viewsA: Draw square on the canvas using wire fences (#)
A simple approach: width = int(input("Digite a largura: ")) height = int(input("Digite a altura: ")) for _ in range(0, height): for _ in range(0, width): print("#", end="") print("\n", end="")…
pythonanswered Pedro Rodrigues 769 -
1
votes1
answer62
viewsA: Delivery charge: sometimes it works and sometimes it doesn’t
I suggest some improvements to this code: You have several Zip Codes to apply the same rate, group these Zip Codes into a data structure, so that it is simpler to understand the code and simpler to…
javascriptanswered Pedro Rodrigues 769 -
1
votes1
answer404
viewsA: ssh key add error to github account
In the title I suggest you put something that references the location you are adding. Ex.: "Personal Notebook". Assuming you are using a Unix system, in the key you should put the contents of the…
-
1
votes3
answers28262
viewsA: Update DIV Automatically (autorefresh) without updating whole page
There are many frameworks and libraries that can help you manipulate GIFT, such as: Jquery, Angularjs, Emberjs, Reactjs, etc. I won’t go into detail about them, but basically you can add specific…