Java Programming Examples
Str PA
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
class Str {
private final Supplier contents;
private final Function, String> log;
private Str(Supplier contents) {
this.contents = contents;
this.log = action -> {
String value = contents.get();
action.accept(“traced Str: ” + value);
return value;
};
}
private Str(
Supplier contents,
Function, String> log) {
this.contents = contents;
this.
Read MoreData Structure Algorithms: Hashtables, Lists, Trees, and Graphs
Hashtable Compression: Removing Duplicates
public int compress() {
Set<T> in = new HashSet<>();
int count = 0;
for (int i = 0; i < table.size(); i++) {
T current = table.get(i);
if (current != null) {
if (in.contains(current)) {
table.set(i, null);
count++;
size--;
} else {
in.add(current);
}
}
}
return count;
}
List Reversal
public void reverse( Read More
Understanding Functions and Events in JavaScript
Accumulator Concept
In programming, a counter, often denoted as ‘x’, is used to track the number of iterations in a loop. An accumulator (ACC) is a special variable that increases or decreases with variable values during program execution. For example, if we have a variable named ‘amount’ within a loop, each cycle of the loop can increase the ‘amount’ variable based on a value entered by the user.
Repetitive Structures: While and For Loops
Problems requiring repetition can be solved using ‘while’
Read MoreComprehensive Guide to C# Programming Concepts and Features
Type Safety
Type safety in C# ensures that the language enforces type constraints at compile time, preventing errors related to data types during program execution. C# is a strongly typed language, meaning that every variable and expression has a specific data type associated with it, and type checking occurs statically at compile time. This static type checking ensures that type mismatch errors are caught before execution. Explicit type conversion is required for converting values between incompatible
Read MoreCIA Triad and Security Terminology
CIA Triad
Confidentiality – The data was not disclosed to any unauthorized parties.
Integrity – The data was not violated or modified
Availability – The data can get where it needs to go without fail
Design Principles
Fail-Safe Defaults
Permissions are only given with explicit permission
If all systems fail what will happen to system security?
You should consider the different ways a system could fail
Ex: chinese character in input field?
Least Privilege
Don’t give out any more privileges than necessary
Nobody
Red Hat Enterprise Linux 7: A Comprehensive Guide to System Administration
CHAPTER 1
SSH
ssh-keygen
ssh-copy-id server0
connect:
ssh server0
know the hostname:
ssh server0 hostname
HELP FROM RED HAT
redhat-support-tool
opencase –product=”Red Hat Enterprise Linux” –version=”7.0″
listcases
modifycase
to attacht sosreport do sosreport
sosreport
send attachment
JFI: find / -type f -name “asdfasdf.Txt”
CHAPTER 2
MANAGING FILES USING COMMAND-LNE TOOLS
Basic operations
cp
mv
rm
mkdir
Making Links Between Files
Differences between symbolic link and hard link
Let’s summarize
