Theory
Code snippets:
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:text="I accept terms " />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="(and read them carefully)" />
</LinearLayout>
JSON:
{
"name": "John",
"lastname": "Doe",
"email": "johndoe@acme.com",
}
SQL:
CREATE TABLE census (
id INTEGER,
name VARCHAR(20),
birth_place_latitude REAL,
year_income DECIMAL(20,3),
is_parent BOOLEAN
);
SELECT * FROM Customers;
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph</p>
</body>
</html>
CSS:
.flex-container {
border: 1px solid brown;
color: brown;
display: flex;
font-family: 'Montserrat', sans-serif;
padding: 0.5em 0 0.5em 0;
width: 25em;
}
.flex-item {
border: 1px solid brown;
border-radius: 10px;
text-align: center;
height: 2em;
line-height: 2em;
margin: 0 5px;
min-width: 5em;
}
Bash:
$num1 = 20;
$num2 = 10;
if [ "$num1" -eq "$num2" ]; then
echo "Numbers are equal"
elif [ "$num1" -gt "$num2" ]; then
echo "First number is greater"
else
echo "Second number is greater"
fi
# Checking the password entered by user
echo "Enter password: "
read input
if [ $input = "Pass!@#" ]; then
echo "Correct password entered"
fi
$ for i in $(seq 1 2 5); do
echo "Number: $i";
done
Number: 1
Number: 3
Number: 5
$ while true; do
echo "To stop execution of a loop, use CTRL+C"
done
Go:
var s int
var i int
for ; i < 50; i++ { // step 3, 4, 8; you can have a sparse loop declaration
if s > 100 {
break
}
if i % 2 == 0 {
continue
}
s += i
}
Kotlin:
class Author(id: Int, login: String, email: String, val books: String): User(id, login, email) {
override fun toString(): String {
return "Author{id=$id, login=$login, email=$email}, books: $books"
}
}
val user = User(1, "marys01", "mary0101@gmail.com")
val author = Author(2, "ohwilde", "wilde1854@mail.ie", "Someone’s portrait")
println(user) // User{id=1, login=marys01, email=mary0101@gmail.com}
println(author) // Author{id=2, login=ohwilde, email=wilde1854@mail.ie, books: Someone’s portrait
Python:
pets = ['dog', 'cat', 'parrot']
for pet in pets:
if pet == 'dog':
continue
print(pet)
pancakes = 2
while pancakes > 0:
print("I'm the happiest human being in the world!")
pancakes -= 1
if pancakes == 0:
print("Now I have no pancakes!")
break
else:
print("No pancakes...")
Java:
class Human {
String name;
int age;
public static void averageWorking() {
System.out.println("An average human works 40 hours per week.");
}
public void work() {
System.out.println(this.name + " loves working!");
}
public static void main(String[] args) {
Human.averageWorking(); // "An average human works 40 hours per week."
Human alice = new Human();
alice.name = "Alice";
alice.work(); // "Alice loves working!"
}
}
JS:
// literal notation
let arr = [element_1, element_2, element_3, element_n];
let arr1 = ['JetBrains', 'Hyperskill'];
let arr2 = [45, 34, 23];
let arr3 = ['JavaScript', 12];
// Multiple arguments
let platforms = new Array('JetBrains', 'Hyperskill', 'WebStorm', 'PyCharm');
console.log(platforms.length); // 4
console.log(platforms[0]); // JetBrains
Scala:
scala> def g(x: Int, y: Character) = x - y
g: (x: Int, y: Character)Int
scala> g(100, 'a')
res2: Int = 3
scala> g('a', 3)
<console>:13: error: type mismatch;
found : Int(3)
required: Character
g('a', 3)
object HelloScala extends App {
println("Hello, Scala!")
}
Text (No highlight):
class Human {
String name;
int age;
public static void main(String[] args) {
Human alice = new Human();
alice.name = "Alice";
alice.work(); // "Alice loves working!"
}
}
var s int
var i int
for ; i < 50; i++ { // step 3, 4, 8; you can have a sparse loop declaration
if s > 100 {
break
}
if i % 2 == 0 {
continue
}
s += i
}
let arr1 = ['JetBrains', 'Hyperskill'];
let arr2 = [45, 34, 23];
let arr3 = ['JavaScript', 12];
// Multiple arguments
let platforms = new Array('JetBrains', 'Hyperskill', 'WebStorm', 'PyCharm');
console.log(platforms.length); // 4
console.log(platforms[0]); // JetBrains
$num1 = 20;
$num2 = 10;
if [ "$num1" -eq "$num2" ]; then
echo "Numbers are equal"
elif [ "$num1" -gt "$num2" ]; then
echo "First number is greater"
else
echo "Second number is greater"
fi
Tables:
1:
Anonymous | User | Accountant | Administrator | |
POST api/auth/signup |
+ | + | + | + |
POST api/auth/changepass |
+ | + | + | |
GET api/empl/payment |
- | + | + | - |
POST api/acct/payments |
- | - | + | - |
PUT api/acct/payments |
- | - | + | - |
GET api/admin/user |
- | - | - | + |
DELETE api/admin/user |
- | - | - | + |
PUT api/admin/user/role |
- | - | - | + |
2:
Go | Java |
---|---|
|
|
3:
Data Model:
Mongo DB | RDB |
Different models for data storage with dynamic schemas, such as "key-value", documents, graphs, wide columns, etc. Storage models are optimized for higher capacity and scalability. This approach provides more flexibility for data upload. |
Data is being normalized and transformed into tables, consisting of rows and columns. All elements, including indexes and table-relations, have a predefined schema. Such a structure secures integrity of linked data and table relations. |
Data Representation:
Mongo DB | RDB | ||||||
Supports JSON with key-value matches for each record:
|
Data is stored as a record in a row
|
Data Accessibility/API:
Mongo DB | RDB |
Object-oriented API allows developers to record or withdraw data structures. By using key sections of applications, users can implement search by "key-value" pairs, sets of columns or by partly structured documents, containing serial objects and application attributes. MongoDb uses MQL(Mongo Query language) for data extraction. Data selection:
Data insertion:
Data update:
|
Requests for data record and selection are made using SQL. Those requests are analyzed and processed by RBD. Data selection:
Data insertion:
Data update:
|
Scalability and replication:
Mongo DB | RDB |
Fits better for Horizontal scaling (scaling out). MongoDB is considered to be more scalable than conventional RDBMS. Most NoSQL systems, including MongoDB, are capable of storing your database on multiple machines at the same time while maintaining high-speed performance. This DB has in-built replication support and sharding(a method for distributing data across multiple machines). MongoDB is a universal DB that ensures stable productivity, wherever you want to get it. At the same time, its requirements are relatively low, which allows it to run on powerful servers, virtual machines, and cloud services. |
Implies Vertical scaling (scaling up). Relational databases typically scale by increasing the computational power of the hardware or adding separate copies for read workloads. Performance depends on the disk subsystem. Optimization of queries, indexes and table structure is usually required for maximum performance. |
ACID properties:
Mongo DB | RDB |
It centers around the CAP theorem (Consistency, Availability, and Partition). NoSQL databases often offer a trade-off by relaxing the strict ACID property requirements in favor of a more flexible data model that can scale out. This makes NoSQL a great choice for high throughput, low latency use cases that need to scale out beyond a single instance. |
It centers around ACID properties (Atomicity, Consistency, Isolation, and Durability). Atomicity means that a transaction should be either fully completed or not completed at all. Consistency means that as soon as the transaction ends, the data must conform to the database schema. Isolation requires concurrent transactions to run separately from each other.Reliability refers to the ability to recover to the last saved state after an unexpected system failure or power outage |
4:
|
Mongo DB |
RDB |
||||||||
Data Model |
Different models for data storage with dynamic schemas, such as "key-value", documents, graphs, wide columns, etc. Storage models are optimized for higher capacity and scalability. This approach provides more flexibility for data upload. |
Data is being normalized and transformed into tables, consisting of rows and columns. All elements, including indexes and table-relations, have a predefined schema. Such a structure secures integrity of linked data and table relations. |
||||||||
Data Representation |
Supports JSON with key-value matches for each record:
|
Data is stored as a record in a row
|
||||||||
Data Accessibility/API |
Object-oriented API allows developers to record or withdraw data structures. By using key sections of applications, users can implement search by "key-value" pairs, sets of columns or by partly structured documents, containing serial objects and application attributes. MongoDb uses MQL(Mongo Query language) for data extraction. Data selection:
Data insertion:
Data update:
|
Requests for data record and selection are made using SQL. Those requests are analyzed and processed by RBD. Data selection:
Data insertion:
Data update:
|
||||||||
Scalability and replication |
Fits better for Horizontal scaling (scaling out). MongoDB is considered to be more scalable than conventional RDBMS. Most NoSQL systems, including MongoDB, are capable of storing your database on multiple machines at the same time while maintaining high-speed performance. This DB has in-built replication support and sharding(a method for distributing data across multiple machines). MongoDB is a universal DB that ensures stable productivity, wherever you want to get it. At the same time, its requirements are relatively low, which allows it to run on powerful servers, virtual machines, and cloud services.
|
Implies Vertical scaling (scaling up). Relational databases typically scale by increasing the computational power of the hardware or adding separate copies for read workloads. Performance depends on the disk subsystem. Optimization of queries, indexes and table structure is usually required for maximum performance. |
||||||||
ACID properties |
It centers around the CAP theorem (Consistency, Availability, and Partition). NoSQL databases often offer a trade-off by relaxing the strict ACID property requirements in favor of a more flexible data model that can scale out. This makes NoSQL a great choice for high throughput, low latency use cases that need to scale out beyond a single instance.
|
It centers around ACID properties (Atomicity, Consistency, Isolation, and Durability). Atomicity means that a transaction should be either fully completed or not completed at all. Consistency means that as soon as the transaction ends, the data must conform to the database schema. Isolation requires concurrent transactions to run separately from each other. Reliability refers to the ability to recover to the last saved state after an unexpected system failure or power outage. |
asdf
Abc abc abcd Abc abc abcd Abc abc abcd Abc abc abcd | Abc abc abcd Abc abc abcd Abc abc abcd Abc abc abcd | Abc abc abcd Abc abc abcd Abc abc abcd Abc abc abcd |
11111 1111 11111 1111 11111 1111 11111 1111 | 11111 1111 11111 1111 11111 1111 11111 1111 | 11111 1111 11111 1111 11111 1111 11111 1111 |
abcddddddddddddddddddddabcdddddddddddddddddddd | abcddddddddddddddddddddabcdddddddddddddddddddd | abcddddddddddddddddddddabcdddddddddddddddddddd |
Images:
asdf
Blocks test:
Gradle
dependencies {
// ...
implementation 'org.springframework.boot:spring-boot-starter-security'
// ...
}
Maven
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
//