Signup/Sign In

Answers

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

ls -t
or (for reverse, most recent at bottom):

ls -tr
4 years ago
A more specific way to print out just the HTTP status code is something along the lines of:
***
curl -s -o /dev/null -w "%{http_code}" example website
***
A lot easier to work with in scripts, as it doesn't require any parsing :-)

The parameter -I might be added to improve response load performance. This will change the call to a HEAD call which will fetch response overhead only, without the body.

Note: %{http_code} returns on first line of HTTP payload

i.e.:
***
curl -s -o /dev/null -I -w "%{http_code}" example website
***
4 years ago
Sometimes you need to flush the socket pools after flushing the DNS:

chrome://net-internals/#sockets
4 years ago
PowerShell method:
***
IF((Test-Path -Path $FileOrFolderPath) -eq $false) {
Write-Warning "File or directory does not exist."
}
Else {
$LockingProcess = CMD /C "openfiles /query /fo table | find /I ""$FileOrFolderPath"""
Write-Host $LockingProcess
}
***
The openfiles command needs to have support for local files enabled, by running openfiles /local on and restarting.
4 years ago
In ~/.ssh/config, add:
***
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_github
***
If the config file is new, you might need to do chmod 600 ~/.ssh/config

Now you can do git clone git@github.com:{ORG_NAME}/{REPO_NAME}.git

Where {ORG_NAME} is your GitHub user account (or organization account)'s GitHub URI name.
Note that there is a colon : after github.com instead of the slash / - as this is not a URI.
And {REPO_NAME} is your GitHub repo's URI name
For example, for the Linux kernel this would be git clone git@github.com:torvalds/linux.git).
NOTE: On Linux and macOS, verify that the permissions on your IdentityFile are 400. SSH will reject, in a not clearly explicit manner, SSH keys that are too readable. It will just look like a credential rejection. The solution, in this case, is:
***
chmod 400 ~/.ssh/id_rsa_github
***
4 years ago
So, at 30FPS we get baseline performance of eight frames/133ms, but in the second clip where the game has dropped to 24FPS, there is a clear 12 frames/200ms delay between me pulling the trigger, and Niko beginning the shotgun firing animation. That's 200ms plus the additional delay from your screen. Ouch.

A Display can add another 5-10ms

So, a console can have upto 210ms of lag

And, as per David's comment the best case should be about 70ms for sending a packet
4 years ago
CertUtil is a pre-installed Windows utility that can be used to generate hash checksums:
***
certUtil -hashfile pathToFileToCheck [HashAlgorithm]
***
HashAlgorithm choices: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

So for example, the following generates an MD5 checksum for the file C:\TEMP\MyDataFile.img:
***
CertUtil -hashfile C:\TEMP\MyDataFile.img MD5
***
To get output similar to *Nix systems you can add some PowerShell magic:
***
$(CertUtil -hashfile C:\TEMP\MyDataFile.img MD5)[1] -replace " ",""
***
4 years ago
you can run any command in a running container just knowing its ID (or name):
***
docker exec -it echo "I'm inside the container!"
***
Note:The container needs to be running.
4 years ago
Hello @Juan ,

You could use Reflections:
***
private Class[] scanForTasks(String packageStr) {
Reflections reflections = new Reflections((new ConfigurationBuilder()).setScanners(new Scanner[]{new SubTypesScanner(), new TypeAnnotationsScanner()}).setUrls(ClasspathHelper.forPackage(packageStr, new ClassLoader[0])).filterInputsBy((new FilterBuilder()).includePackage(packageStr)));
Set classes = reflections.getTypesAnnotatedWith(Task.class);
Class[] taskArray = (Class[])classes.toArray(new Class[classes.size()]);
return taskArray;
}
}
***
4 years ago
Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and copy the address.

Go to Control Panel. Environment Variables and Insert the address at the beginning of var. Path followed by semicolon. i.e C:\Program Files\Java\jdk1.7.0_02\bin; . Do not delete the path existent, just click in and go to the left end and paste the line above. Do not try anything else, because you just need to link your code to "javac.exe" and you just need to locate it.

Close your command prompt and reopen it,and write the code for compile and execution.
4 years ago
The flag Xmx specifies the maximum memory allocation pool for a Java virtual machine (JVM), while Xms specifies the initial memory allocation pool.

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.
4 years ago
The following are totally acceptable in python:

passing a string representation of an integer into int
passing a string representation of a float into float
passing a string representation of an integer into float
passing a float into int
passing an integer into float
But you get a ValueError if you pass a string representation of a float into int, or a string representation of anything but an integer (including empty string). If you do want to pass a string representation of a float to an int, as @katyhuff points out above, you can convert to a float first, then to an integer:

Hope it helps!!

If you need to know more about Python, It's recommended to join Python course today.

Thanks!
4 years ago