Notes
Notes
Use static for variables outside a method if you won’t be creating instances of them
(and just read or alter their value)
You can run your code like this from the console using
javac (java file name)
java (java file name w/out .java)
Add %20s to make the string be displayed across 20 spaces (sorta like that cout
setw in C++ we use to print out matrices)
String.format(“%3.f”, someInt); used to set how many decimals will be displayed
String.valueOf() – function that transforms any primitive data type to string
String variables are immutable
Print out an array of strings: (using for-each loop)
for(string randomstr: arr){
System.out.println(randomstr);
}
You cannot alter arrays’ size once initialized; however, you can add and remove
items from an ArrayList
ArrayList<String> name = new ArrayList<>();
You can use an Iterator object to go through an ArrayList using a while loop.
Iterator it = name.iterator(); //notice how iterator() is with a lowercase i
While(it.hasNext()){
//do sumn
System.out.println(it.next());
}
Encapsulation – making data private (like actually using the keyword private), hiding
data.
Instance method creates an instance of a class, static method is standalone and
works by itself
The only properties declared in a constructor are the ones who aren’t constant
There are two types of exception class types: checked and unchecked. The checked
exceptions are checked at compile time (before runtime), while the unchecked
exceptions happen at runtime.
Device config and management
Windows 11 got a new feature for the maximise option – snap layouts (arrange app
windows in certain gridded layouts)
Optional updates do not include security updates
HDMIs transport digital video + they got 19 pins
Mini HDMIs are used by smaller devices
Displayports are most often found on pcs
VGA transports analog video
USBs can be used to transfer power
SharePoint is a Microsoft app that lets you use a server in which you can put files in
and share them from.
Mapped drive – provides users with a shortcut to files from a different device.
Basic ideas of security:
What you know: passwords, usernames, emails (what you can remember)
What you have: certain identification documents, cards, a phone etc.
Who you are: biometrics like fingerprints, retina scans
BYOD – bring your own devices (for the test know that they are at risk of being
stolen or tampered with when employees are transporting them from home to their
workplace).
Types of malware:
Computer virus – malicious code that can copy itself on your device. A virus must be
attached to a program in order to spread.
Worm – can replicate and spread across devices within a network.
Spyware – software that can track your activity and collect data about you without
your knowledge. (Which it then sends to a third party)
A trojan – spyware functioning similar to a virus. Looks legitimate but is malware. An
example of a trojan would be an ad promoting an antivirus software that is actually
harmful to your device.
Keylog – captures every keyboard keystroke.
Adware – causes popup windows to appear with ads. Can appear while installing
unknown files/apps from the internet which contain this malware. It also steals
personal information lol. It’s not that big a threat as it was in the past due to the
enhanced browser security
Ransomware – locks users out of their personal data until they pay up to regain their
access.
Phishing (Social Engineering attacks) – attacks where users are tricked into
revealing their private information (passwords, card information…). Such trickery
usually takes the form of manipulative emails.
Combating malware:
Have a good antivirus and antimalware program. Antivirus programs are best used
against common threats (viruses, trojans, worms)
Antimalware programs should be used against more sophisticated intruders.
Windows Defender is an antimalware program.
UAC – user account control
(inner) Joining tables only works if there is an identical primary key located in each
table.
A left outer join shows all records from the first table in a join plus matching records
from the second table. A right outer join shows all records from the second table in
a join plus matching records from the first table. A full outer join will show all
records from both tables. If a join is not specified, a cartesian product will show how
every record in one table is related to every record in another table. A self join is a
join between two columns in the same table, usually when a table has a hierarchical
structure.
UNION – adds the column entries of both tables, no matter if information may
repeat itself
INTERSECT – adds the column entries that are present in both tables.
DISTINCT – adds all column entries, but removes the repeating ones.
ORDER BY query can display column entries in descending order if you type DESC
next to the column name.
We use ON clause to specify a join condition. This lets us specify join conditions
separate from any search or filter conditions in the WHERE clause.
You can only have one WHERE statement in an SQL statement, so you should use
HAVING instead of WHERE if you need to use it after it’s been defined. (they have
the same function)
INSERT INTO … SELECT … - used when inserting data from a table into another.
Required fields must be included when inserting into a table
The UPDATE statement uses SET (UPDATE updates row info, but SET takes a column
as parameter). You always use WHERE in an UPDATE statement.
To change a view, we just need to change the CREATE keyword to ALTER (and the
rest of the syntax is identical). Alter changes the columns of a table/view…
Clustered indexes are based on the primary keys of a table, whereas non-clustered
indexes are based on any column of said table. Each non-clustered index speeds up
the query process; however, they adda to a table’s size.
You should use the keyword USE at the beginning of every query if you have copies
of a table.