Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

The flag Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms specifies the initial memory allocation pool.

This means that your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory. For example, starting a JVM like below will start it with 256 MB of memory and will allow the process to use up to 2048 MB of memory:

***java -Xms256m -Xmx2048m***
The memory flag can also be specified in different sizes, such as kilobytes, megabytes, and so on.

***
-Xmx1024k
-Xmx512m
-Xmx8g
***
The Xms flag has no default value, and Xmx typically has a default value of 256 MB. A common use for these flags is when you encounter a java.lang.OutOfMemoryError.
3 years ago
You need to initialize it first:
***
p = Pump().getPumps()
***
3 years ago
The encoding was "ISO-8859-1", so replacing open("u.item", encoding="utf-8") with open('u.item', encoding = "ISO-8859-1") will solve the problem.
3 years ago
For multiple integers in a single line, map might be better.
***
arr = map(int, input().split())
***
If the number is already known, (like 2 integers), you can use
***
num1, num2 = map(int, input().split())
***
3 years ago
Dereferencing a pointer means pointing to an element which is a pointer holding the address of the actual value.

int main() {
int a = 7, b ;
int *p;
p = &a; // Has address of a
b = *p; // pointer pointing to some another pointer
}
3 years ago
On most platforms, long and int are the same size (32 bits). Still, it does have its own format specifier:
***
long n;
unsigned long un;
printf("%ld", n); // signed
printf("%lu", un); // unsigned
***
For 64 bits, you'd want a long long:
***
long long n;
unsigned long long un;
printf("%lld", n); // signed
printf("%llu", un); // unsigned
***
Oh, and of course, it's different in Windows:
***
printf("%l64d", n); // signed
printf("%l64u", un); // unsigned
***
3 years ago
for printf the following specifiers and corresponding types are specified:

%f -> double
%Lf -> long double.
and for scanf it is:

%f -> float
%lf -> double
%Lf -> long double
3 years ago
Here is a small program to convert decimal to 16-bit binary numbers.
***
#include
int main()
{
int n, i, a;

printf("Enter an integer (decimal number)");
scanf("%d", &n);

printf("%d in binary number system is:\n", n);
//for example we are going to represent it with 16 bits
for (i = 15; i >= 0; i--)
{
a = n >> i;

if (a & 1)
printf("1");
else
printf("0");
}

printf("\n");

return 0;
}

***
3 years ago
If you set the target attribute to "_blank", the link will open in a new browser window or a new tab
***




The a target attribute







***
3 years ago
Use clearRect method by passing x,y co-ordinates and height and width of canvas. ClearRect will clear whole canvas as :

canvas = document.getElementById("canvas");
ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
3 years ago
Use one among the following code
***
print("Total score for {n} is {s}".format(n=name, s=score))
***
***
print("Total score for {0} is {1}".format(name, score))
***
f-string formatting from Python 3.6:
*** print(f'Total score for {name} is {score}') ***
3 years ago
Typical error on Windows because the default user directory is
*** C:\user\***
so when you want to pass this path as a string argument into a Python function, you get a Unicode error, just because the \u is a Unicode escape. If the next 8 characters after the \u are not numeric this produces an error.

To solve it, just double the backslashes:
*** C:\\user\\<\your_user>... ***
This will ensure that Python treats the single backslashes as single backslashes.
3 years ago