Signup/Sign In

Answers

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

Yes, there’s GSmartControl, which provides a GUI showing the SMART information from all the drives attached to the system it’s run on.

In Mint it’s packaged as gsmartcontrol.
3 years ago
More precisely, a double dash (--) is used in most Bash built-in commands and many other commands to signify the end of command options, after which only positional arguments are accepted.

Example use: Let's say you want to grep a file for the string -v - normally -v will be considered the option to reverse the matching meaning (only show lines that do not match), but with -- you can grep for the string -v like this:
***grep -- -v file***
3 years ago
Linux can do better than that - there's a kernel commandline option to test the entire memory as part of the boot sequence and lockout bad blocks - by necessity this will add several minutes to your bootup sequence where the box appears unresponsive. (memtest=n flag - see

Once you know where the bad blocks are you can tell linux to avoid them with the badram= flag.

There's also an online memory test tester (man memtester) and you have direct window into your IPMI too (which should be flagging any badram on any half-decent server - on my Intel servers any ipmi-discovered ECC errors have been written into syslog)
3 years ago
If you know for definite that your array will contain only one element with that value, you can do

***$key = array_search($del_val, $array);
if (false !== $key) {
unset($array[$key]);
}***
3 years ago
Coming up next is a finished model dependent on JeeBee's post, utilizing java enum's as opposed to utilizing a custom strategy.
***public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

String current = args[0];
Days currentDay = Days.valueOf(current.toUpperCase());

switch (currentDay) {
case MONDAY:
case TUESDAY:
case WEDNESDAY:
System.out.println("boring");
break;
case THURSDAY:
System.out.println("getting better");
case FRIDAY:
case SATURDAY:
case SUNDAY:
System.out.println("much better");
break;

}
}

public enum Days {

MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY,
SUNDAY
}
}***
3 years ago
On the off chance that you really need the appropriate response back as a string instead of a byte exhibit, you could generally accomplish something like this:
***String plaintext = "your text here";
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(plaintext.getBytes());
byte[] digest = m.digest();
BigInteger bigInt = new BigInteger(1,digest);
String hashtext = bigInt.toString(16);
// Now we need to zero pad it if you actually want the full 32 chars.
while(hashtext.length() < 32 ){
hashtext = "0"+hashtext;
}***
3 years ago
Under Windows this works:
***java -cp "Test.jar;lib/*" my.package.MainClass***
and this does not work:
***java -cp "Test.jar;lib/*.jar" my.package.MainClass***
Notice the *.jar, so the * wildcard should be used alone.

On Linux, the following works:
***java -cp "Test.jar:lib/*" my.package.MainClass***
3 years ago
Then again, you can utilize an expert gathering plugin, as demonstrated in the underneath example:
***
maven-assembly-plugin


package

single






true
com.package.MainClass



jar-with-dependencies


***
In this model, all the reliance containers as indicated in the segment will be automatically remembered for your single container. Note that container with conditions ought to be in a real sense put as, not to be supplanted with the container document names you need to incorporate.
3 years ago
*Java 11 and newer*
This solution is better than others and more portable:

***Path cwd = Path.of("").toAbsolutePath();***
Or even

***String cwd = Path.of("").toAbsolutePath().toString();***
3 years ago
The choice you're searching for is **- R**
***cp -R path_to_source path_to_destination/***
If **destination** doesn't exist, it will be built.
**-R** means **copy directories recursively**. You can also apply **-r** as it's case-indifferent.
Note the differences with joining the trailing **/**.
3 years ago
Also:

***find ./ -type f -print0 | xargs -0 grep "foo"***
but **grep -r** is a better answer.
3 years ago
Check the - R alternative
***chmod -R ***
Later on, you can save a great deal of time by checking the man page first:
***man ***
So for this situation:
***man chmod***
3 years ago