2020-11-12

MySQL

 connect phpMyAdmin to localhost:3307


https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04#step-2-%E2%80%94-installing-mysql


vim /etc/phpmyadmin/config-db.php

/etc/init.d/apache2 restart
 

ALTER USER 'asdf'@'%' IDENTIFIED WITH mysql_native_password
BY '123';
FLUSH PRIVILEGES;

SELECT user,authentication_string,plugin,host FROM mysql.user;

2020-11-09

MS SQL

https://docs.microsoft.com/en-us/sql/relational-databases/databases/view-a-list-of-databases-on-an-instance-of-sql-server?view=sql-server-ver15 

SELECT name, database_id, create_date FROM sys.databases ; GO 

SELECT name FROM sys.databases ;

USE AdventureWorks2012;

SELECT DATEADD(month, 1, '20060830');

UPDATE column SET am=DATEADD(month, 1, column)   

2020-11-03

AMD compatibility

 https://dlcdnets.asus.com/pub/ASUS/mb/SocketAM4/PRIME_A320M-E/Memory_QVL_for_AMD_Ryzen_2nd_Generation_Processors.pdf

 https://www.amd.com/en/products/apu/7th-gen-a6-9500e-apu

https://dlcdnets.asus.com/pub/ASUS/mb/LGA1151/Z170-K/E11133_MB_Pin_Definition_v2_web_only.pdf 

https://dlcdnets.asus.com/pub/ASUS/mb/SocketAM4/PRIME_A320M-E/PRIME_A320M-E_Devices_report.pdf?_ga=2.150868278.121035418.1589210573-1092435267.1587983989

2020-10-04

SSL

 

 https://www.baeldung.com/spring-boot-https-self-signed-certificate


 keytool -genkeypair -alias baeldung -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore baeldung.p12 -validity 3650

 https://mkyong.com/spring-boot/spring-boot-ssl-https-examples/


 $ keytool -genkeypair -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore mkyong.p12 -validity 365

 

https://letsencrypt.org/ru/getting-started/

https://certbot.eff.org/lets-encrypt/ubuntubionic-other 

sudo certbot certonly --standalone

 https://dzone.com/articles/spring-boot-secured-by-lets-encrypt

 /etc/letsencrypt/live/asdf.pp.ua# openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out keystore.p12 -name tomcat -CAfile chain.pem -caname root

2020-10-01

Time Complexity

https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444

O(1) — Constant Time

O(N)—Linear Time

O(log(n)) — Logarithmic Time

O(N²) — Quadratic Time

O(2^N) — Exponential Time

Docker

docker ps

docker ps -a (all)

docker ps -l (latest exited)

docker exec -it acc357f011f4 psql -U testuser testdb

# \dt

Schema | Name | Type  |  Owner   

--------+------+-------+----------

 public | asdf | table | testuser

 

docker images

docker ps --format $FORMAT

docker run -ti ubuntu:latest  bash


https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-engine---community-1

https://docs.docker.com/engine/examples/postgresql_service/

https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/docker-mysql-getting-started.html#docker-starting-mysql-server

docker ps -a
docker pull mysql/mysql-server:tag
docker run  -P -p 3308:3306 --name=mysql3308 -d mysql/mysql-server:5.7
docker logs mysql3308 | grep GENERATED
docker exec -it mysql1 mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY '12345';

CREATE USER 'asdf'@'%' IDENTIFIED BY '12345';

GRANT ALL PRIVILEGES ON *.* TO 'asdf'@'%' WITH GRANT OPTION;


#########################################
https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/docker-mysql-getting-started.html#docker-starting-mysql-server

https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0

SELECT host, user FROM user ;

CREATE USER 'asdf'@'%' IDENTIFIED BY '12345';

GRANT ALL PRIVILEGES ON *.* TO 'asdf'@'%' WITH GRANT OPTION;

https://docs.docker.com/engine/examples/postgresql_service/

#############################33
docker-compose.yaml

version: '3.1'

services:

  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: usr
      POSTGRES_PASSWORD: pwd
      POSTGRES_DB: test     
    ports:
      - "5433:5432"

docker + postgres (amigoscode)
https://youtu.be/9i1gQ7w2V24?t=1590

2020-09-13

AWS

Просмотреть все учебные пособия >>

 https://aws.amazon.com/ru/getting-started/tutorials/

 

Запуск виртуальной машины Linux

Запуск интернет‑приложения

 

с помощью AWS Elastic Beanstalk

Данное пошаговое руководство поможет вам запустить демонстрационное приложение на PHP с помощью AWS Elastic Beanstalk (EB). Помимо PHP, сервис EB поддерживает и другие языки программирования, в том числе Java, .NET, Node.JS, Python, Ruby, Docker и Go, однако в данном пособии будет рассмотрен пример с языком PHP (для других языков процесс аналогичен). Сначала выполняется настройка приложения EB, а затем настройка среды EB, в которой будет запущено приложение.

Вы уже знаете? AWS еще более упростила запуск интернет-приложений. Мгновенный запуск приложений с помощью Amazon Lightsail >>

 

MiB Mem :    483.2 total,    188.1 free,    132.0 used,    163.1 buff/cache

java -Xmx32m -Xss256k -jar some.jar

MiB Mem :    483.2 total,      6.7 free,    317.8 used,    158.6 buff/cache

2020-05-10

Java Spring guides

https://www.youtube.com/watch?v=WDlifgLS8iQ&list=PLU2ftbIeotGoGSEUf54LQH-DgiQPF2XRO&index=3


https://spring.io/guides/gs/rest-service/

https://spring.io/guides/gs/securing-web/

http://logging.apache.org/log4j/2.x/manual/configuration.html

https://attacomsian.com/blog/spring-boot-console-application

2020-05-02

Spring Data JPA

Supported keywords inside method name: 
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation

https://spring.io/guides/gs/accessing-data-jpa/

https://spring.io/guides/gs/accessing-data-mysql/ 

https://attacomsian.com/blog/spring-data-jpa-one-to-many-mapping

2020-03-09

Lambda, Predicate


class Animal {
 boolean canHop = true;
 boolean canSwim;
 int x = 1;
 int y = 10;
}

interface CheckIface {
 int test1(Animal a);
}

//interface Predicate {
// boolean test(T t);
//}

class Solution {
 static final int i = 0;

 public static void main(String[] args) {
  Animal animal = new Animal();
  print1(animal, a -> {
   return a.x;
  });
  print1(animal, a -> a.y);
  print1(animal, a -> {
   return a.canHop ? 1 : 0;
  });

  print(animal, a -> a.canHop);
  print(animal, a -> a.canSwim);
 }

 static void print1(Animal a, CheckIface check) {
  if (check.test1(a) > 0)
   System.out.println("test " + check);
 }

 static void print(Animal a, Predicate<Animal> check) {
  if (check.test(a))
   System.out.println("test1 " + check);
 }