In the shell, what does ” 2>&1 ” mean?

File descriptor 1 is the standard output (stdout).File descriptor 2 is the standard error (stderr). Here is one way to remember this construct (although it is not entirely accurate): at first, 2>1 may look like a good way to redirect stderr to stdout. However, it will actually be interpreted as “redirect stderr to a file named 1“. & indicates that what follows and precedes is … Read more

How to implement a tree data-structure in Java?

Is there any standard Java library class to represent a tree in Java? Specifically I need to represent the following: The sub-tree at any node can have an arbitrary number of children Each node (after the root) and it’s children will have string value I need to get all the children (some sort of list … Read more

Running JAR file on Windows

Easiest route is probably upgrading or re-installing the Java Runtime Environment (JRE). Or this: Open the Windows Explorer, from the Tools select ‘Folder Options…’ Click the File Types tab, scroll down and select JAR File type. Press the Advanced button. In the Edit File Type dialog box, select open in Actions box and click Edit… … Read more

How can a Discord bot create a hyperlink in a Discord message in an embed or in general?

Jakye is right. Only bots can achieve this (but not in field titles, beware). Just do [link text here](url here). This embed description results in: this in the embed. Clicking on it directs you to countrycode.org. Using .addField(): If you want a bot’s message to just be a hyperlink, you need to make an embed, and only … Read more

What is the best way to implement constants in Java?

That is perfectly acceptable, probably even the standard. where TYPE is the type, NAME is the name in all caps with underscores for spaces, and VALUE is the constant value; I highly recommend NOT putting your constants in their own classes or interfaces. As a side note: Variables that are declared final and are mutable … Read more

Basic explanation of python functions

what is the purpose of having the arg1, arg2 in the parenthesis next to it? In this case, arg1 and arg2 are called arguments. Arguments allow functions to receive inputs it’s expected to use in order to perform a task. The inputs are provided by the callers. For example, in school math, you may’ve already … Read more

ImportError: No module named pandas

You’re missing a few (not terribly clear) steps. Pandas is distributed through pip as a wheel, which means you need to do: You’re probably going to run into other issues after this – it looks like you’re installing on Windows which isn’t the most friendly of targets for NumPy, SciPy, and Pandas. Alternatively, you could pickup a binary installer … Read more

C++ for each, pulling from vector elements

For next examples assumed that you use C++11. Example with ranged-based for loops: You should use const auto &attack depending on the behavior of makeDamage(). You can use std::for_each from standard library + lambdas: If you are uncomfortable using std::for_each, you can loop over m_attack using iterators: Use m_attack.cbegin() and m_attack.cend() to get const iterators.