How to enable Developer Mode in iOS

How to enable Developer mode on iOS devices

Whether you are an aspiring developer, a game designer, or just someone who just so happens to need this function, getting iOS devices to be able to be compatible with imports for your code or applications can be challenging at times.

However, as of iOS 16 and above, you can now enable the new Developer Mode to help smoothen out the process of whatever special need you have.

Continue reading
How to set up a Plastic SCM repository in Unity

How to set-up a Plastic SCM repository in Unity and add team members to your project

When working with projects, it is common practice to use source control repositories to house our code, so that we can synchronize project files across multiple team members, and perform version control. Game development projects are no different.

If you have been using Unity for some time now, you may remember Unity Collaborate — a source control repository service built into the Unity Editor. In November of 2021, they replaced the Unity Collaborate service with Plastic SCM, and Unity users across the world went through a collective struggle trying to re-learn (or learn, if you are a first-time user — Plastic SCM is harder to use than Unity Collaborate) how to use the new service.

If you are one of these people, then this guide is for you.

Continue reading
XAMPP cannot start on macOS - Cannot calculate MAC address

XAMPP can’t start on macOS — cannot calculate MAC address

If you are running XAMPP on macOS, you may run into a variety of problems that may prevent you from starting the program. One of these problems is an error that says “cannot calculate MAC address” when you try to start the program.

Error starting XAMPP stack
The error message is not very helpful.

If your error message says something else, you may want to check out the other articles on XAMPP for macOS:

  1. XAMPP Apache not starting on macOS
  2. XAMPP MySQL not starting on macOS
Continue reading
How to set up a local web domain on WampServer

How to set up a local web domain (i.e. VirtualHost) on WampServer

When working on a website, it is not uncommon for developers to locally host websites on their own computers first, as it is often a good idea to run and test your website before you publish it online, so that you avoid having your live website run into errors and bugs.

If you are a Windows user, one of the several local web hosting softwares you have available to you is WampServer, which normally runs on the localhost URL when it is started up.

Fun fact: Wamp stands for Windows, Apache, MySQL and PHP. It is a play on the term LAMP (where L stands for Linux, and the rest of the letters mean the same as those in Wamp), as almost all web servers in the early days of the web ran on such a set-up. Today, LAMP stacks are still widely used to host many websites.

While running on localhost gives us the benefit of using root-relative URL paths, it still has a distinct drawback — it is a hassle to run multiple websites off the localhost URL, as it will still cause the aforementioned root-relative URL paths to break.

Fortunately for us, it is possible to set up what I call “local domains” on WampServer, so that you can use URLs outside of localhost to access your websites on WampServer.

Continue reading
Enumerations in Java explained (using Pokémon as an example)

Enumerations explained (using Pokémon as an example)

What are enums anyway, and what are they used for? Well, just think of it as yet another tool in your handy Java toolbox of things you can consider using to improve your efficiency and organisation of your program.

In this article, we are going to explore what enums are, and how they can be used in Java, by considering a piece of Java code that uses enums to recreate the type effectiveness system found in Pokémon.

Continue reading
Why is calling setters in Java constructors discouraged?

Why is calling setters from constructors discouraged in Java?

In Java, coders are discouraged from calling setter functions in class constructors. Even though doing so can sometimes reduce the amount of repeated code.

Consider the following class:

Unit.java

public class Unit {
	protected int health;

	public Unit(int hp) {
		// Prevents health for being set to 0 or less.
		if(hp <= 0)
			throw new IllegalArgumentException("Health must be more than 0.");
		health = hp;
	}

	public void setHealth(int hp) {
		// Prevents health for being set to 0 or less.
		// Repeat of the code in the constructor.
		if(hp <= 0)
			throw new IllegalArgumentException("Health must be more than 0.");

		health = hp;
	}

}

Instead of doing the check twice across 2 functions to ensure the incoming hp value is correct, it might occur to some coders that we can call the setter within the constructor instead, to reduce the amount of repeated code:

Unit.java

public class Unit {
	protected int health;

	public Unit(int hp) {
		// Prevents health for being set to 0 or less.
		if(hp <= 0)
			throw new IllegalArgumentException("Health must be more than 0.");
		health = hp;
		setHealth(hp);
	}

	public void setHealth(int hp) {
		// Prevents health for being set to 0 or less.
		// Repeat of the code in the constructor.
		if(hp <= 0)
			throw new IllegalArgumentException("Health must be more than 0.");

		health = hp;
	}
}

This, however, is discouraged, because (according to textbooks) setters like setHealth() can be overriden by child classes, creating unexpected or buggy behaviour in these child classes.

Continue reading
Java's Scanner.nextLine() is being skipped

Java’s Scanner nextLine() call is being skipped (i.e. not waiting for input)

As a programming language with its fair share of quirks, one of the many things a new Java programmer will run into is the issue of their Scanner.nextLine() calls being ignored. Consider the following Java code:

JavaNextLineProblem.java

import java.util.Scanner;
public class JavaNextLineProblem {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		// Prompt the user to enter their name.
		System.out.print("Enter your name: ");
		String name = input.nextLine();

		// Prompt the user to enter their age.
		System.out.print("Enter your age: ");
		int age = input.nextInt();

		// Prompt the user to enter a description.
		System.out.print("Describe yourself in a sentence: ");
		String description = input.nextLine();

		// Prompt the user to enter a message.
		System.out.print("Enter a message: ");
		String message = input.nextLine();
	}
}

This is the desired result (user input coloured in green):

Enter your name: John
Enter your age: 21
Describe yourself in a sentence: I am awesome.
Enter a message: Hello world!

However, this is what you actually get:

Enter your name: John
Enter your age: 21
Describe yourself in a sentence: Enter a message: Hello world!

The program skips over the collection of input for the Describe yourself in a sentence prompt, and goes straight into collecting the input for the Enter a message prompt. What’s going on?

Continue reading
XAMPP MySQL not starting on Windows

XAMPP MySQL not starting on Windows

XAMPP is a great tool for web developers who need to host websites locally on their own computers. Unfortunately, because it uses ports and services that are commonly used by other applications, conflicts can happen, causing certain applications on XAMPP to be unable to run.

In this article, we will be exploring what you can do if XAMPP’s Apache service does not run on Windows.

Continue reading
What to do when gitignore doesn't work

How to fix .gitignore not working on your repository

If you’re using a Git-based source control, you might be familiar with the use of a .gitignore file to list files which Git is supposed to ignore when tracking files and making commits. This can be particularly useful when using Git (if you’re using GitHub Desktop, you’re also using Git) as a source control tool for projects that generate temporary or user-specific files at every run, such as Unity, as these files cannot be shared across different users of the project.

User-generated files in Unity
User-generated files in Unity that don’t need to be tracked by Git.

Sometimes, when setting up the repository, because of a .gitignore that is not properly set up, files that you intend to be ignored can actually get committed into the repository. If that happens, retroactively applying the .gitignore list will not help.

Continue reading