Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Filter result with JSON keys
Filters with JSON keys. In this example the result will be filtered with
number
and
issue_date
keys of
document_details
column
SELECT *
FROM students
WHERE 1 
    AND JSON_EXTRACT(document_details, '$.number') = 8
    AND JSON_EXTRACT(document_details, '$.issue_date') = '2020-05-18'
ORDER BY id DESC
by Valeri Tandilashvili
4 years ago
0
MySQL
JSON
1
Simple Math calculations
Addition of two integers
5+5; // 10
Multiplication of two integers
5*5; // 25
If we add a number to a string, the number will be converted into a string and the result will be a concatenation of the two strings
5+'12'; // 512
String multiplied by an integer
5*'5'; // 25
Multiplication of a string (but not numeric string) and a number
5*'t'; // NaN
The first operation of the expression is addition and then concatenation
5+5+'2'; // 102
by Valeri Tandilashvili
4 years ago
0
JavaScript
1
Concatenate strings and variables
Variable
myName
will be concatenated with the string
let myName = 'Valeri';
console.log('My name is ' + myName + '.');
The result will be:
My name is Valeri.
by Valeri Tandilashvili
4 years ago
0
JavaScript
Concatenation
1
There are several built-in functions to interact with the user:
alert('Text message');
prompt('What is your name?');
confirm('Do you want to learn JavaScript')
Function
alert
shows a text message
alert('Text message');
Function
prompt
asks the user to input a text. It can be an answer for the question that the function asks the user
prompt('What is your name?');
The function has another optional parameter, which is a default value of the input
prompt('What is your favorite programming language?', 'JavaScript');
Function
confirm
asks the user and waits for the user to accept or cancel
confirm('Do you want to learn JavaScript')
Simple example of the three interactive functions together:
if (confirm('Do you want to learn programming?')) {
    let language = prompt('Choose your favorite programming language: JS, Python, PHP', 'JS');
    alert('You will be redirected to ' + language + " tutorial's page");
    window.location.href = 'https://w3schools.com/'+language;
} else {
    alert('Go waste your time with playing video games')
}
by Valeri Tandilashvili
4 years ago
2
JavaScript
Built-in functions
1
Simple function called
greeting
that shows the following message:
Hello, my name is john
using
alert
built-in function. Then we can call the function by typing the function name followed by parenthesis:
greeting();
function greeting() {
    alert('Hello, my name is john');
}
greeting();
The same function with more flexibility. We pass the parameter
name
to the function, so it can be called for different users. When we call the function, we need to pass a string, as an argument
greeting('John');
function greeting(name) {
    alert('Hello, my name is ' + name);
}
greeting('John');
The same function with several parameters. We added another parameter
age
to the function
function greeting(name, age) {
    alert('Hello, my name is ' + name + ' and I am ' + age + ' years old');
}
greeting('John', 25);
The following function returns value, so that we can use the function in expressions
function doubleMe(number) {
    return 2*number;
}
console.log(3*doubleMe(50));  // 300
We can assign default values to parameters if they are not passed when the function gets called
function aboutMe(profession = 'student', name, city = 'Tbilisi' ) {
    console.log('I am a ' + profession + ' from ' + city + ' and my name is ' + name);
}
aboutMe(undefined, 'Valeri');
by Valeri Tandilashvili
4 years ago
0
JavaScript
Functions
The 10 Days of JavaScript
1
CSS justify-content Property CODE
Align the flex items at the center of the container:
div {
  display: flex;
  justify-content: center;
}
Align the flex items at the beginning of the container (this is default):
div {
  display: flex;
  justify-content: flex-start;
}
Align the flex items at the end of the container:
div {
  display: flex;
  justify-content: flex-end;
}
Display the flex items with space between the lines:
div {
  display: flex;
  justify-content: space-between;
}
Display the flex items with space before, between, and after the lines:
div {
  display: flex;
  justify-content: space-around;
}
by გიორგი ბაკაშვილი
4 years ago
0
CSS
CSS Properties
1
Secure password rules
We need to follow the rules if we want our passwords to be strong enough
1. Contains at least 8 characters
2. Contains at least one uppercase letter
3. Contains at least one lowercase letter
4. Contains at least one number
5. Contains at least one special character
by Valeri Tandilashvili
4 years ago
0
PHP
Security
1
Different types of arrays CODE
Creates array of numbers;
let myFavoriteNumbers = [5, 14, 16, 27]
Creates array of strings
let myFavoriteColors = ['green', 'yellow', 'red']
Creates array of arrays
let myMatrix = [
    [12, 23, 34], 
    [13, 35, 57], 
    [14, 47, 70], 
]
Creates array of objects
let myFavoritePlanets = [
    {name: 'Earth', radius: 6371}, 
    {name: 'Jupiter', radius: 69911}, 
    {name: 'Neptune', radius: 24622, moons: ['Triton', 'Thalassa', 'Nereid', 'Proteus', 'Hippocamp', 'Naiad']}
]
Accessing one of the moons of Neptune
console.log(myFavoritePlanets[2].moons[4])
by Valeri Tandilashvili
4 years ago
0
JavaScript
Arrays
1
Add new item to an array CODE
Creates
myFavoriteNumbers
array
let myFavoriteNumbers = [5, 14, 16, 18]
Adds new item
22
to the array
myFavoriteNumbers.push(22)
Adds the array as a new item to the
myFavoriteNumbers
array
myFavoriteNumbers.push([23, 24])
Adds the object to the array as new item
myFavoriteNumbers.push({firstNumber: 25, secondNumber: 26})
Adds the function to the array as new item
myFavoriteNumbers.push(function(){console.log('I am fired!')})
Adds new string item to the array
myFavoriteNumbers.push('27')
Let's fire the function that we added as an item
myFavoriteNumbers[7]()
After running the function the result will be:
I am fired!
by Valeri Tandilashvili
4 years ago
0
JavaScript
Arrays
1
Handle fatal errors CODE
PHP 7.0 + can handle fatal errors without terminating PHP process. It means we can catch the fatal error using
catch
block
try {
    undefinedFunction();
} catch (Error $e) {
    echo 'Fatal error occurred: ' . $e->getMessage();
}
After running the above code on PHP 7+ the result will be:
Fatal error occurred: Call to undefined function undefinedFunction()
If we run the same code on PHP 5.6, we will get the following result:
<br />
<b>Fatal error</b>:  Call to undefined function undefinedFunction() in <b>[...][...]</b> on line <b>5</b><br />
by Valeri Tandilashvili
4 years ago
0
PHP
Try / Catch
1
Results: 1580