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);
 }

2020-03-06

Class StringBuilder

Modifier and Type Method and Description
StringBuilder append(boolean b)
StringBuilder append(char c)
StringBuilder append(char[] str)
StringBuilder append(char[] str, int offset, int len)
StringBuilder append(CharSequence s)
StringBuilder append(CharSequence s, int start, int end)
StringBuilder append(double d)
StringBuilder append(float f)
StringBuilder append(int i)
StringBuilder append(long lng)
StringBuilder append(Object obj)
StringBuilder append(String str)
StringBuilder append(StringBuffer sb)
StringBuilder appendCodePoint(int codePoint)
int capacity()
char charAt(int index)
int codePointAt(int index)
int codePointBefore(int index)
int codePointCount(int beginIndex, int endIndex)
StringBuilder delete(int start, int end)
StringBuilder deleteCharAt(int index)
void ensureCapacity(int minimumCapacity)
void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
int indexOf(String str)
int indexOf(String str, int fromIndex)
StringBuilder insert(int offset, boolean b)
StringBuilder insert(int offset, char c)
StringBuilder insert(int offset, char[] str)
StringBuilder insert(int index, char[] str, int offset, int len)
StringBuilder insert(int dstOffset, CharSequence s)
StringBuilder insert(int dstOffset, CharSequence s, int start, int end)
StringBuilder insert(int offset, double d)
StringBuilder insert(int offset, float f)
StringBuilder insert(int offset, int i)
StringBuilder insert(int offset, long l)
StringBuilder insert(int offset, Object obj)
StringBuilder insert(int offset, String str)
int lastIndexOf(String str)
int lastIndexOf(String str, int fromIndex)
int length()
int offsetByCodePoints(int index, int codePointOffset)
StringBuilder replace(int start, int end, String str)
StringBuilder reverse()
void setCharAt(int index, char ch)
void setLength(int newLength)
CharSequence subSequence(int start, int end)
String substring(int start)
String substring(int start, int end)
String toString()
void trimToSize()

Class String

Modifier and Type Method and Description
char charAt(int index)
int codePointAt(int index)
int codePointBefore(int index)
int codePointCount(int beginIndex, int endIndex)
int compareTo(String anotherString)
int compareToIgnoreCase(String str)
String concat(String str)
boolean contains(CharSequence s)
boolean contentEquals(CharSequence cs)
boolean contentEquals(StringBuffer sb)
static String copyValueOf(char[] data)
Equivalent to valueOf(char[]).
static String copyValueOf(char[] data, int offset, int count)
Equivalent to valueOf(char[], int, int).
boolean endsWith(String suffix)
boolean equals(Object anObject)
boolean equalsIgnoreCase(String anotherString)
static String format(Locale l, String format, Object... args)
Returns a formatted string using the specified locale, format string, and arguments.
static String format(String format, Object... args)
Returns a formatted string using the specified format string and arguments.
byte[] getBytes()
byte[] getBytes(Charset charset)
void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)
Deprecated. 
This method does not properly convert characters into bytes. As of JDK 1.1, the preferred way to do this is via the getBytes() method, which uses the platform's default charset.
byte[] getBytes(String charsetName)
void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
int hashCode()
int indexOf(int ch)
int indexOf(int ch, int fromIndex)
int indexOf(String str)
int indexOf(String str, int fromIndex)
String intern()
boolean isEmpty()
static String join(CharSequence delimiter, CharSequence... elements)
static String join(CharSequence delimiter, Iterable<? extends CharSequence> elements)
int lastIndexOf(int ch)
int lastIndexOf(int ch, int fromIndex)
int lastIndexOf(String str)
int lastIndexOf(String str, int fromIndex)
int length()
boolean matches(String regex)
int offsetByCodePoints(int index, int codePointOffset)
boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
boolean regionMatches(int toffset, String other, int ooffset, int len)
String replace(char oldChar, char newChar)
String replace(CharSequence target, CharSequence replacement)
String replaceAll(String regex, String replacement)
String replaceFirst(String regex, String replacement)
String[] split(String regex)
String[] split(String regex, int limit)
boolean startsWith(String prefix)
boolean startsWith(String prefix, int toffset)
CharSequence subSequence(int beginIndex, int endIndex)
String substring(int beginIndex)
String substring(int beginIndex, int endIndex)
char[] toCharArray()
String toLowerCase()
String toLowerCase(Locale locale)
String toString()
String toUpperCase()
String toUpperCase(Locale locale)
String trim()
static String valueOf(boolean b)
Returns the string representation of the boolean argument.
static String valueOf(char c)
Returns the string representation of the char argument.
static String valueOf(char[] data)
Returns the string representation of the char array argument.
static String valueOf(char[] data, int offset, int count)
Returns the string representation of a specific subarray of the char array argument.
static String valueOf(double d)
Returns the string representation of the double argument.
static String valueOf(float f)
Returns the string representation of the float argument.
static String valueOf(int i)
Returns the string representation of the int argument.
static String valueOf(long l)
Returns the string representation of the long argument.
static String valueOf(Object obj)
Returns the string representation of the Object argument.

Interface List

All Known Implementing Classes:
AbstractList, AbstractSequentialList, ArrayList, AttributeList, CopyOnWriteArrayList, LinkedList, RoleList, RoleUnresolvedList, Stack, Vector
Class ArrayList
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess
Direct Known Subclasses:
AttributeList, RoleList, RoleUnresolvedList

Collections.sort(aList);
aList.sort(null);
A null value indicates that the elements' natural ordering should be used
aList.sort((e1,e2) -> e2 - e1); //DESC

boolean add(E e)
void add(int index, E element)
boolean addAll(Collection<? extends E> c)
boolean addAll(int index, Collection<? extends E> c)
void clear()
Object clone()
boolean contains(Object o)
void ensureCapacity(int minCapacity)
void forEach(Consumer<? super E> action)
E get(int index)
int indexOf(Object o)
boolean isEmpty()
Iterator<E> iterator()
int lastIndexOf(Object o)
ListIterator<E> listIterator()
ListIterator<E> listIterator(int index)
E remove(int index)
boolean remove(Object o)
boolean removeAll(Collection<?> c)
boolean removeIf(Predicate<? super E> filter)
protected void removeRange(int fromIndex, int toIndex)
void replaceAll(UnaryOperator<E> operator)
boolean retainAll(Collection<?> c)
E set(int index, E element)
int size()
void sort(Comparator<? super E> c)
Spliterator<E> spliterator()
List<E> subList(int fromIndex, int toIndex)
Object[] toArray()
<T> T[] toArray(T[] a)
void trimToSize()