public static void main(String[] args) {
Optional<String> hello = Optional.ofNullable(null);
// 1. Optional Use:
// check value is present in hello
System.out.println(hello.isPresent());
// check if hello(v) is empty
System.out.println(hello.isEmpty());
// 2. orElse: if hello doesn't contain any value
// then $hello = world
String orElse = hello
.map(String::toUpperCase)
.orElseGet(() -> {
//.. extra computation to re
/* FIND SOMEONE WITH GIVEN EMAIL ADDRESS
* ==========================================================================*/
studentRepository
.findStudentByEmail("ahmed.ali@gmail.com")
.ifPresentOrElse(
System.out::println,
()-> System.out.println("Student with email ahmed.ali@gmail.com not found"));
@Bean
CommandLineRunner commandLineRunner(StudentRepository studentRepository) {
return args -> {
Student maria = new Student(
"Maria",
"Jones",
"maria.jones@gmail.com",
21
);
Student ahmed = new Student(
"Ahmed",
"Ali",
"ahmed.ali@gmail.com",
18
);
import React from 'react';
import ReactDOM from 'react-dom';
class Button extends React.Component {
scream() {
alert('AAAAAAAAHHH!!!!!');
}
render() {
return <button onClick={this.scream}>AAAAAH!</button>;
}
}
ReactDOM.render(<Button />, document.getElementById('app'));
mport React from 'react';
import ReactDOM from 'react-dom';
class MyName extends React.Component {
// name property goes here:
get name() {
return 'Andy';
}
render() {
return <h1>My name is {this.name}.</h1>;
}
}
ReactDOM.render(<MyName />, document.getElementById('app'));
import React from 'react';
import ReactDOM from 'react-dom';
class QuoteMaker extends React.Component {
render() {
return (
<blockquote>
<p>
What is important now is to recover our senses.
</p>
<cite>
<a target="_blank"
href="https://en.wikipedia.org/wiki/Susan_Sontag">
Susan Sontag
</a>
</cite>
</blockquote>
);
}
}
ReactDOM.render(
<QuoteMaker />,
document.getElementById('app')
);
# frozen_string_literal: true
# OlympicMedal is class that represents an olympic medal
class OlympicMedal
# <, <=, >=, >, ==, !=, <=>, .between?
include Comparable
MEDAL_VALUES = { Gold: 3, Silver: 2, Bronze: 1 }.freeze
attr_reader :type
def initialize(type, weight)
@type = type
@weight = weight
end
def <=>(other)
if MEDAL_VALUES[type] < MEDAL_VALUES[other.type]
-1
elsif MEDAL_VALUES[type] == MEDAL_VALUES[other.type]
1
else
0
end
end
https://wordpress.org/plugins/conditional-menus/
/sbin/parted /dev/sdm resizepart 1 yes 100%
https://dmitripavlutin.com/vue-next-tick/
<canvas class="webgl"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
Patch(Resources, Defaults(Resources), {Name: textName.Text, Title: textTitle.Text})
USE OnlineBanking
select A.Name, AF.ApplicationID, F.Name, AF.FeatureID from Applications_Features AF
JOIN Applications A
ON A.ID = AF.ApplicationID
JOIN Features F
ON F.ID = AF.FeatureID
1. **Install the tools required for auto signing to work**\
`sudo dnf install kmodtool akmods mokutil openssl`
2. **Generate a signing key**\
`sudo kmodgenca -a`
3. **Initiate the key enrollment**\
This will make Linux kernel trust drivers signed with your key\
`sudo mokutil --import /etc/pki/akmods/certs/public_key.der`\
You will be asked to enter a password, it doesn’t have to be very strong, just make sure to remember it. You’ll only need it once during step 5.\
4. **Reboot
<?php
//Inheritance
//Extension of one class
Class Room
{
public $name;
public $size;
function __construct($name,$size)
{
$this->name = $name;
$this->size = $size;
}
function intro()
{
echo "This is a ".$this->name;
}
}
Class Kitchen extends Room
{
function message()
{
echo "This is a ".$this->name." and it is ".$this->size;
}
}
$kitchen = new Kitchen("Kithen","large");
$kitchen->intro();
$ki
<?php
//Access modifiers
//Public : Accessed from anywhere
//Protected : Accessed from that class and class derived from it
//Private : Only within class
//Mistake forgot to write function
Class Room {
public $name;
protected $size;
private $shelf;
function set_name($name)
{
$this->name = $name;
}
protected function set_size($size)
{
$this->size = $size;
}
private function set_shelf($shelf)
{
$this->s