Posts by Antonio Carlos • 929 points
15 posts
-
11
votes3
answers2628
viewsA: How to optimize this function for Fibonacci sequence?
An easy way to implement such a function efficiently is by using dynamic programming, which basically consists of storing intermediate results that will be reused. In the case of Fibonacci, simply…
-
6
votes2
answers76351
viewsA: link to an image to be redirected to another site
The parameter href tag to accepts both relative and absolute links. The way it was put in your example, it is understood the link as relative, soon it will reset the user to:…
html5answered Antonio Carlos 929 -
3
votes1
answer1552
viewsA: Python administrator privileges
If you are on linux, just run sudo: sudo python meuScript.py In the case of windows (since you mentioned administrator instead of root, I suppose this is the case), there are some options: You can…
-
0
votes1
answer599
viewsA: Error "No module named 'pytube'"
I believe the problem is caused by the existence of multiple versions of Pip and python installed on the machine. Go to the terminal and type: pip --version The return should be similar to: pip…
-
12
votes4
answers1313
viewsA: Capture user-typed input with PHP Shell
I believe what you want is: <?php echo "Qual seu nome?"; $stdin = fopen ("php://stdin","r"); $nome = fgets($stdin); echo "Olá,", $nome, "!"; ?> For more complex entries you can use the fscanf…
-
1
votes1
answer501
viewsA: Location selection depending on browser - Google Maps
The accuracy is determined by the browser, but you can, via code, ask the browser to give you greater precision. There’s no guarantee he’ll make it, but he’ll try. In your code, create the options…
-
1
votes1
answer77
viewsA: Error creating class reference and concatenating methods in Swift
The problem is that you are putting code to run directly in the top-level file, just as you would in languages like Python and Javascript. Swift, as well as C, C++, Java, among others, only accepts…
-
5
votes3
answers3107
viewsA: How to send strings in the URL via JS or jQuery?
Usually what is done to send a string through the URL is to use the function encodeURIComponent(), as in the example: Code: var uri = "http://w3schools.com/my test.asp?name=ståle&car=saab"; var…
-
5
votes2
answers10363
viewsA: What is the command to close or quit the game created in Unity?
In C# you can do the following: using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Update() { if (Input.GetKeyDown(KeyCode.Escape)) Application.Quit(); } }…
-
1
votes1
answer456
viewsA: Internet Explorer always in the foreground
You can leave the IE window in always forward mode through windows library. If you want a program that does this for you, I suggest using the Turbotop. It is quite simple to use, just install and…
-
1
votes1
answer642
viewsA: How to protect image files and ini files?
There are many ways to protect files, but with some effort you will always be able to change. I will list some ways to protect(use them together for greater efficiency): 1) Hash check: Use the…
pythonanswered Antonio Carlos 929 -
3
votes1
answer417
viewsA: Unity: How to navigate between two points on a sphere?
The solution is to use spherical coordinates. This coordinate system positions you on a sphere using the parameters radius, Phi angle and theta angle. While the Cartesian system, used by Unity,…
-
13
votes3
answers14607
viewsA: How to identify which city the user is in?
There are several examples and codes ready on the internet, but basically what you should do is: 1) Get the coordinates with HTML5 Geolocation: w3schools - HTML5 Geolocation //Check if browser…
-
1
votes3
answers447
viewsA: Divide a date into two parts
Make a boolean field (in Mysql: bit(1)) where 0 indicates the morning booking and 1 indicates the afternoon booking. With regard to date: If it is for ease, use the DATE type, it stores dates in the…
-
2
votes4
answers874
viewsA: How to work and switch multiple View Controllers via code?
If you don’t want to use performSegue, you can do the following: let newView = SecondViewController() self.presentViewController(newView, animated: true, completion: nil) This method does not…