Tutor profile: Steven W.
Questions
Subject: Web Development
How do I make an HTML element repeat N times?
It depends on the framework you're using, but generally each framework has a different way of doing it. For example, Angular provides the `*ngFor="let item of array"` directive, which can be added to an element to create a copy of it for each item in an array. Meanwhile, in react you would surround the HTML to repeat in a standard JavaScript for loop. The simplest way to do it without a framework is to use JavaScript to append HTML elements directly to the element. So, e.g. you'd use something like this inside of a for loop: document.getElementById("parent").append("<div>My Content</div>")
Subject: Machine Learning
How can I input text data into a neural network?
One of the most common ways to input text data into a neural network is to represent each word as a different number, then to use "One-Hot Encoding" to convert that number into a form that a neural network can understand. To one-hot encode a number $$X$$, you simply create a long vector where every value is 0, except for the value at position $$X$$. So for example, you could say "Cat" is 1, "Dog" is 2, and so on. After one-hot encoding, "Cat" would be $$[ 1, 0, 0, \cdots, 0 ]$$ and "Dog" would be $$[ 0, 1, 0, \cdots, 0 ]$$, and so on.
Subject: Java Programming
Why is everyone so worried about immutability in Java?
Immutable data structures are really useful in parallel code. They make it easier to share data between multiple threads, because it prevents each thread from touching the other thread's data. Imagine if you were a cook trying to flavor a dish. If someone kept randomly adding things to the meal after you tasted it, it'd be much harder to figure out which spices were needed make the meal taste good because the meal keeps changing. With an immutable meal, it would be much easier to plan which spices to use, because neither you nor anybody else could modify the meal while you were planning the spices.