If you have downloaded a Unity Standalone game folder, and the game crashes or has problems, you might need to check the Standalone .exe logs.
They are in the following folders:
macOS ~/Library/Logs/Company Name/Product Name/Player.log
Windows with Backslashes C:/Users/username/AppData/LocalLow/CompanyName/ProductName/Player.log
Check the above folders for your operating system and check out the log!
Once you are connected, you will see what version of your operating system.
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-24-generic x86_64)
Next, you should find out what type of web server you are running. I know beforehand that I am running an apache server, so I should check the status of apache.
~$ sudo service apache2 status
* apache2 is running
As a result, at the certbot.eff.org website, I’ll select Apache for Software and Ubuntu 14.04 (trusty) for System.
2. Follow the instructions that pop up.
Next up is simply following the instructions for Certbot.
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-apache
Type Y to continue.
certbot is ready to be used, but we still need to check if the 443 port is ready.
3. Check if port 443 is open.
$ sudo apt-get install nmap
nmap is a useful tool on Ubuntu to see what ports you have open.
$ nmap localhost
Starting Nmap 6.40 ( http://nmap.org ) at 2017-04-30 03:52 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00028s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
nmap shows that I do not have 443/tcp open, so that means that I need to add open port 443.
4. Open port 443 if it’s not open.
Since I host the website on Amazon Web Services EC2, I have to visit https://aws.amazon.com and log into my account.
Once I’m on my dashboard, I need to visit EC2.
Next, I click on Running Instances.
I click on the running instance that I want to edit, and the checkbox becomes blue.
Afterwards, I look at the bottom of the page where there is additional information in the Description tab and click on the name of the Security Group.
If you click on Actions, you can Edit inbound rules of the Security Group.
For Edit inbound rules, we want to Add Rule HTTPS.
5. Use cerbot to add HTTPS to your website.
$ sudo certbot --apache
You will get a message to choose whether to allow both HTTP and HTTPS access or only HTTPS. I like option 2, so I type 2 and hit Enter.
If everything worked properly, you should get a Congratulations message.
Now, you can visit your website with HTTPS. Huzzah!
Automatic HTTPS certificate renewal
You will also get a message that your certificate will only last 3 months, but luckily, it should renew by itself.
Your cert will expire on 2017-07-29. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew"
However, the Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let’s Encrypt certificates last for 90 days, it’s highly advisable to take advantage of this feature.
You can check the certbot cron entries (automated scheduler):
0 */12 * * * means every 12 hours.
You can test automatic renewal for your certificates to make sure that this automatic renewal will work in the future by running the following command. I like to test that certbot will renew correctly.
certbot renew --dry-run
Always redirect to HTTPS
What controls the redirection to HTTPS on apache is the .htaccess file.
Bash for Windows 10 has been out for almost a year now. It has been incredible for a developer like myself to be able to use Bash natively on a Windows machine!
In this article, I’ll show you how I install my main Bash setup for Windows 10.
Your Windows 10 PC must be running a 64-bit version of Windows 10 Anniversary Update build 14393 or later.
To find your PC's CPU architecture and Windows version/build number, open Settings>System>About. Look for the System type and OS Build fields.
In this screenshot, I have a 64-bit operating system, x64-based processor and OS Build, 15063.138, so I fit the requirements.
Install Bash on Windows 10
Install ConEmu for tabs
Must have Bash customizations
Install VcXsrv Windows X Server for opening GUI applications
1. Install Bash on Windows 10
In order to run Bash on Windows, you will need to manually:
Turn on Developer Mode
Enable the “Windows Subsystem for Linux (beta)” feature
Open Settings -> Update and Security -> For developers
Select the Developer Mode radio button.
From Start, search for “Turn Windows features on or off” (type ‘turn’)
Select Windows Subsystem for Linux (Beta)
Hit OK. Installation will proceed, and afterwards, you will have to restart your computer.
After you restart your computer, you will be able to finish installing Bash on Windows 10.
Search for Microsoft Store.
From the Microsoft Store, find Ubuntu and download and install it.
From Start, search for “bash” (type ‘bash’) or it might already be open.
When you open bash, you will see a command prompt window.
Type "y" to continue.
The real “Bash on Ubuntu on Windows” shortcut will be installed. Bash on Ubuntu on Windows might already be installed through the Microsoft Store.
Now, you can open “Bash on Ubuntu on Windows” whenever you search for “bash”
Try opening Bash. The first time you install Bash on Windows, you will be prompted to create a UNIX username and password.
After typing in a UNIX user name and UNIX password, you can use Bash the same way that you would use a terminal on Mac and Linux.
The biggest problem though is there are no tabs! Let’s fix the tab issue.
2. Install ConEmu for tabs
ConEmu is an amazing program that gives you terminal tabs, allows you to copy and paste the normal way with CTRL-C and CTRL-V, and run any combinations of shells including Command Prompt, Bash, Powershell, and more.
I want to be able to open any folder with File Explorer with open, so that I can open the current working directory with open .
I have a shortcut called linux to open the Ubuntu’s root folder with File Explorer.
Lastly, I have an alias called reload for reloading the ~/.bashrc to apply any new configurations.
Replace huyle with the username of your computer.
# Custom shortcuts
alias windows="cd /mnt/c"
alias desktop="cd /mnt/c/Users/huyle/Desktop"
alias subl="/mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe"
alias open="/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe /c start -WorkingDirectory C:'\\'Users'\\'huyle'\\'AppData'\\'Local'\\'lxss"
alias linux="open C:/Users/huyle/AppData/Local/lxss"
alias reload="source ~/.bashrc"
These other shortcuts I use to access my favorite directories. I recommend you to add your favorite Windows or Ubuntu directories where you put your development code or work.
# Optional shortcuts
alias repos="cd /mnt/c/Users/huyle/Desktop/Repos"
alias work="cd /mnt/c/Users/huyle/Desktop/Work"
alias youtube="cd /mnt/c/Users/huyle/Desktop/YouTube"
You can save your file with nano by using CTRL+O and then pressing Enter.
Now, we can apply these changes.
Use the windows alias to easily switch to your Windows files! You can try some of these other aliases!
The open alias does not work with Ubuntu’s directories because of directory translation errors, but by default, at least, I set the alias to open the Ubuntu root directory.
Every now and then, I prefer using Sublime, so it’s very convenient to be able to type subl . in order to open current working directories with Sublime.
Here are some extra utilities that I like to install on Bash. These utilities are optional.
I like to use tmux, which is a terminal multiplexer. It lets you switch easily between several programs in one terminal.
I like tabs, but every now and then, I like everything in one terminal for a bird’s eye view.
I also like to use zip and unzip often to create zip files and extract them.
sudo apt-get install -y tmux zip unzip
Nice! Bash on Windows 10 with tabs and tmux feels so good. Your development is now super-charged!
4. Install VcXsrv Windows X Server for opening GUI applications
If you have ever wanted to open GUI applications through SSH connections, this step is for you.
By default, Windows 10 does not come with an X11 server by default. I’ve been using VcXsrv Windows X Server, but Xming also works.
Let’s say we wanted to check if “microwave” was in this list.
print("microwave in appliances")
When we run the program, since “microwave” is inside appliances, we get “microwave in appliances”.
You can use operators on lists.
Let’s say that I wanted to combine two lists.
c becomes a new list with the contents of a and b.
The list will be [1, 2, 3, 4].
When I run the program, I get the new list with a and b’s list values.
The multiply operator can repeat the contents of a list.
For example, let’s say that I wanted to multiply a’s contents by 3 times.
When I run the program, I get [1, 2, 1, 2, 1, 2]
The values inside a, which were originally 1, 2 are tripled because I multiplied a by 3.
We call using operators on lists, list operations.
In the last video, we talked about string slicing, which was the ability to grab a subsection of a string without using a for loop.
Lists can also use slicing.
If I wanted to get a list with a, b, and c, I would use list slicing.
How list slicing works is you have a start position followed by a colon followed by the end position + 1.
The start position 0 in list slicing is inclusive. example_list at index 0, which is “a” is included in the new list.
Then, the list slicing visits every value in between start position until end position.
The end position 3 is non-inclusive, which means that example_list at index 2, which is “c” is included in the new list, but example_list at index 3 is not included. 0 is inclusive. 3 is non-inclusive.
When we run the program, I’ll get the half_list, which is a new list with “a”, “b”, and “c”.
In the last video, we talked about how strings were immutable, meaning that we could not change the characters of a string with different characters.
Lists are mutable in Python. We can change the elements of a list.
The first value of the list is changed to a “b”.
You can also do fancy things like use list slicing to assign new values.
For example, I could use list slicing to change the first three values of the list.
example_list[0:3] = [“x”, “y”, “z”]
Now, when I print example_list, the first three values will get the x, y, z because I used string slicing to get the first three values then I reassigned them with x, y, z.
I can run the program, and I’ll see that the program has the “x”, “y”, “z”, “d”, “e”, “f”.
Let’s say that we wanted to add new values to the list.
There’s a very useful append function that lists can use to add new values to the end of a list.
When I run the program, we can see that the last three values of the list are g, h, and i, which were added with the .append function.
Let’s say that we wanted to sort the values in a list.
example_list = [“b”, “a”, “e”, “c”, “f”, “d”]
You can use the list’s sort function.
Sorting a list can be very useful. All you need to do is add a .sort().
When we run the program, we can see that the values in the list have been sorted in alphabetical order.
Another very useful list function is reversing a list.
Let’s take that sorted_list and reverse it.
All you need to do is add a .reverse() to the list. When we run the program, we get the reversed list.
The last thing that we’ll talk about is list deletion, which means that I can delete values in a list.
Let’s say that I wanted to delete the last value in the list.
First, I’ll get rid of example_list.reverse().
When I print example_list, “f”, which used to be the last value of the sorted list has been deleted.
There are more functions that you can use with lists, but we’ve talked about the most useful ones so far.
Google is your friend, so if you ever can’t figure out how to get a specific value from a list, Python might already have a built-in function that does exactly what you’re looking for.
We talked about recursion and iteration in the last tutorial.
Recursion is the term used when you call the same function inside a function, which causes repetition since you’re repeating the function.
Iteration is the term used when you repeat steps without using recursion.
This video will be about making iteration or repeating steps easier!
In tutorial #2, we talked about most recent assignment because we talked about how you can assign a variable multiple times.
A variable takes the value of its most recent assignment.
When we’re repeating the assignment of a variable, we are iterating.
When you hear iteration, think repetition.
Let’s say that we set:
Here, we set b = a, and since a’s most recent assignment is 2.
b is equal to 2.
Even though b is equal to a, b is unaffected when we add 1 to a.
b is completely separate from a.
When we add 2 to b’s most recent assignment, we get 2 + 2.
In that example, we were iterating the assignment of a variable.
Instead of writing each repetitive step 1 by 1, Python has statements that make writing iterations or repetitions easy.
We’ll start with the while statement or also called while loop.
The while statement works like a conditional.
When the condition is true, the statements underneath are run, but the difference is that the while statement is checked again, and if the condition is still true, then the statements underneath are run again.
As long as the condition stays true, the statements underneath are repeated.
We use the term while loop because the while statement loops in a circle, repeating its statements.
We can write the same function that did the countdown to New Year’s like we did last video.
The while statement is like an if statements that continually checks the condition after running all the statements underneath.
We start at 10.
num must be greater than 0.
The condition is True, so all the statements underneath are run.
num is equal to 10 – 1.
Now, num is 9.
All the statements tabbed once to the right have been completed.
The while statement checks its condition again.
9 is greater than 0, so the condition stays True.
Repeat all the statements underneath.
Keep on repeating until the condition is false.
The condition is false, when num is 0 because 0 is not greater than 0.
The while statement is similar to recursion, but it doesn’t reuse a function.
There are two main parts.
1. The condition
A while statement is triggered by a True condition like an if statement.
You need to make sure that the condition is eventually False or else, you’ll have an infinite repetition or loop.
For the while loop that we have written, we are constantly decreasing num by 1.
num is decreasing every time we repeat the contents of the while loop.
10 becomes 9, 9 becomes 8, and so on until num is 0. When num is 0, it is not greater than 0, so the while statement ends there.
Then, print(“New Year’s”) happens and afterwards, we’re at the end of the function.
Using iteration with the while statement makes repeating steps much easier than recursion in most cases.
Instead of manually writing print(10) print(9) and so on 1 by 1, the while loop allows us to repeat a series of steps until the condition is False.
In the last video, I told you that if iteration seems easier, then you should use iteration.
But when iteration seems complex, try to think out the solution with recursion to see if recursion will make solving the problem easier.
Let’s do another example,
Let’s make a while loop that prints a number of lines.
First, the function should take in a parameter for the number of lines that we want.
Next, we want to use the while loop. We want to think of a base case. The moment when we are done with the while loop.
We can use num being equal to 0 as a means of ending the while loop.
Step 1 is figuring out our condition. Our condition should be (num != 0) because when num is 0, we are done.
while loops always have the keyword, while, followed by a condition and a colon after the condition.
We want the while loop to print out a line when num is not 0. num starts at 3.
Step 2 is progress. We want num to be decreasing at each step or iteration.
We can subtract num by 1 with each step to make sure that we’re making progress to make the condition eventually false.
The condition will be false when num is equal to 0, so decreasing num by 1 each step makes sense!
We want to print out an empty line at each step because that’s the purpose of our function.
Let’s call out function with the argument 3.
When we run the function, 3 lines are printed out.
Let’s take a closer look at our function.
The argument is 3, so num = 3.
while loop always looks at the while statement and checks if it’s true.
Step 1) the condition. The condition is true because 3 != 0. Do the statements underneath.
3 – 1 = 2
2 != 0 is True
2 – 1 = 1
1 != 0 is True
1 – 1 = 0
0 != 0 is False, so while loop ends here.
While loops make repetitive steps much easier. If you are using repetition, think while loops.
There’s something called infinite while loops. Let’s talk about infinite while loops.
If you forget step 2, progress, then you’ll come out with a while loop that never stops.
If we delete the line, num = num – 1, the while loop will never stop because the condition will always be true.
3 != 0 is always true. num != 0 is always true because num always stays the same. There’s no progress.
The while loops continues forever! On a Windows computer, you can use CTRL-C to end the program.
We want the while loop to end, so always remember that you need progress that will make your condition be false eventually.
In this video, we’ll talk about return statements and recursion.
In a previous video, we talked about how the value that you get from a function is the return value.
If I call type(4), I get the return value of int.
How does the type() function return the type int value?
Let’s write a function that adds two numbers and returns the result the same way how the type() function gets a result.
Notice how the function uses the same format that we’ve learned in the last video, but there’s a new line that we haven’t seen before.
What return result does is that it gives the value, result, to where the function called.
The return statement also ends the function.
The reason why I bring up return statements here is that you can use the return keyword inside a conditional, and it ends the function.
Let’s change our function a little bit.
print("num1 is negative")
print("num2 is negative")
print("num1 and num2 are added")
If I were to call add_two_positive_numbers with:
I get the print message, num1 is negative.
I also get a return value of None because return stopped the program after the print(“num1 is negative”).
return can be used to exit the function. If there is no return value, you get a None, which means like it implies: nothingness.
Using returns with conditionals will help you limit your function to a specific behavior like what we did: adding only two positive numbers.
In a previous video, we used a function that we created inside another function.
Whenever we used the print function inside of our functions, we are using a function inside of a function.
Let’s talk about recursion. What is recursion? Recursion is the term used when a function calls itself.
Instead of a function calling a different function, the function calls itself.
A function triggering itself inside the function?
You might be thinking that triggering the function in itself would lead to an infinite loop of the function triggering itself.
You use a conditional that stops the function when you’re ready. A conditional that stops a function calling itself is called the base case.
The base case is the way that a function calling itself can stop.
For example, let’s say that we wanted to make a countdown function celebrating the new year.
We are making a countdown from 10 to 0 for New Year’s!
10, 9, 8, and so on until we get to 0.
When we hit 0, it’s New Year’s, so when num is 0, we stop the function.
If num is not 0, we countdown again bring the num down 1 number.
We start at 10, 10 is not 0, so display the current num, and go to the next num, which is 9.
We are calling countdown function again, but with one less num.
You can notice that there are two main parts to recursion.
The first part is progress.
We make sure that there is some sort of progress every time we use the function again.
In the example, we decrease the number that we’re using by 1.
The number is perpetually decreasing, which means that there is progression towards an end.
The second part is base case.
We make sure that the a base case occurs at our goal. When we countdown from 10, we want to countdown to 0 eventually.
The number 0 is our end goal.
We use a if statement to check if our number is 0 yet, so that we can just stop calling the function over again.
If we don’t call the function, countdown again, the function stops because there is nothing else in that if statement to do except for displaying “New Years!”
Any recursion can be done iteratively. What is iteratively?
Iteratively means repeating a process one at a time. Doing things manually one at a time.
We are using the print function manually or iteratively one at a time to print three empty lines.
Any iteration can be done recursively and use recursion.
Recursion takes a moment to think about.
Remember that there are two parts.
Part 1) Progress.
Part 2) Base case. The end point.
Decreasing a number or increasing a number is usually a good way to make progress.
The function calling the function must make progress.
A usual base case is checking for 0.
We want to print 3 new lines, so let’s use the number 3 as our argument to act as our starting point.
To make progress, let’s decrease the number 3 each time we use the function.
To end the function, let’s check if the countdown reaches to 0, because if we count from 3 to 0, we should have printed 3 new lines.
Checking if the number is 0 will be our base case, the end point.
3 is greater than 0, print a new line.
3 – 1 = 2
2 is greater than 0, print a new line.
2 – 1 = 1
1 is greater than 0, print a new line.
1 – 1 = 0
0 is not greater than 0, do nothing, which stops the function because there is nothing left to do.
You might be thinking: When do I use recursion and when do I use iteration, writing each line one by one? Why even use recursion?
Recursion is an important concept to understand because some very specific problems are much easier to solve with recursion.
For example, the Fibonacci sequence. Fibonacci numbers are a sequence of numbers in which each number is the sum of the two preceding numbers.
This problem is easier to solve with recursion than iteration. It’s a very specific problem, which happens to be easier to solve with recursion.
The majority of the time if you’re not dealing with a specific type of problem that works well with recursion, you should use iteration instead and write the repeated lines of what you want to do like how we printed 3 new lines by writing print() function 3 times.
Let’s talk about the cons of recursion.
Number 1) For Python, recursion is slower than iteration.
Speed is a huge turn off when using recursion. Think about speed.
Number 2) You may get confused in making your recursive function because often times, you might think hmmmm at step 5,
I am expecting the number to be this, and I think that if the progress keeps happening, the number will be what I expected.
It’s harder to write a good recursive function.
Number 3) Recursion uses more memory.
With all those cons, why would you even use recursion?
The main advantage of recursion is when you have a very specific problem that has a point A and a point B, and you need to get to point B, but to get to point B requires a large number of complex repetitive steps.
Recursion might be for you. In this very specific situation like Fibonacci numbers, recursion is absolutely the choice to use.
I would recommend to Google for some advice to see if recursion would be great for your very specific problem.
The ultimate rule to is if you ever think that writing your steps iteratively is hard, see if recursion will be easier.
If writing your steps iteratively is easy, then use iteration.
For example, in our countdown problem, counting down from 10 to 0, it’s easy to make.
We can easily print the countdown from 10 to 0. Since it’s easy to make, we should use iteration.
We learn recursion because you will encounter those very specific problems where recursion is the best or only way to solve the problem!
The last topic that we’ll talk in this video is infinite recursion.
Infinite recursion is the term used whenever the function keeps calling itself and never stops.
There’s no base case. There’s no end point.
We can write a new function:
There is no if statement base case that stops the program. All this program does is call itself again and again and again.
Python has an error called Maximum recursion depth exceeded that stops the function from calling itself infinite times.
If there was no Python error to stop the recursive function, the function would call itself until we wouldn’t have any more memory.