This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT setval('table_id_seq', 13, true); # true - следующее значение будет 14, false - следующее значение будет 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ссылка на источник: | |
http://ru-developer.blogspot.com/2015/10/pgadmin-postgresql.html | |
Проблема: | |
При подключении к удаленному серверу получаем ряд ошибок. | |
Сначала рабочее место жалуется, что сервер его не слушает, | |
потом, что у админа нет прав на подключение: | |
- "Server doesn’t listen" | |
- "Grant users remote access" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Grant CONNECT to the database: | |
GRANT CONNECT ON DATABASE database_name TO username; | |
2. Grant USAGE on schema: | |
GRANT USAGE ON SCHEMA schema_name TO username; | |
3. Grant on all tables for DML statements: SELECT, INSERT, UPDATE, DELETE: | |
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA schema_name TO username; | |
4. Grant all privileges on all tables in the schema: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT MAX(column_name) + 1 FROM table_name; -- for example max=999 | |
CREATE SEQUENCE table_name_column_name_seq START WITH 999; -- replace 999 with max above | |
ALTER TABLE table_name ALTER COLUMN column_name SET DEFAULT nextval('table_name_column_name_seq'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDate; | |
import java.time.format.DateTimeFormatter; | |
import java.time.temporal.ChronoUnit; | |
public class PeriodCalculator { | |
public static void main(String[] args) { | |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); | |
LocalDate startDate = LocalDate.parse("29/02/2020", formatter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Проблема: | |
При подключении к удаленному серверу получаем ряд ошибок. | |
Сначала рабочее место жалуется, что сервер его не слушает, | |
потом, что у админа нет прав на подключение: | |
- "Server doesn’t listen" | |
- "Grant users remote access" | |
Решение: | |
1. Заходим в настройки сервера по пути |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipconfig /flushdns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Отменить последний коммит, но сохранить изменения: | |
git reset HEAD~ | |
Удалить последний коммит и откатить изменения: | |
git reset --hard HEAD~ | |
Команда git reset откатывает HEAD до определенного состояния. | |
В нашем случае она откатывает HEAD до HEAD~ (сокращенно от HEAD~1), | |
что означает состояние на один коммит старше чем HEAD. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
#canvas { | |
width: 500px; | |
height: 500px; | |
border: 2px solid black; | |
margin: 10px; | |
background-image: url(grid.png); | |
} | |
input, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Как отправлять исходники в несколько репозиториев одной командой: | |
Создаем новый remote например "all" | |
git remote add "all" [email protected]:username/my-repo.git | |
и добавляем в него несколько адресов для пуша | |
git remote set-url --add --push "all" git@username/my-repo.git | |
git remote set-url --add --push "all" [email protected]:username/my-repo.git | |
Чтобы запушить сразу в два репозитория |
NewerOlder