Tips&Tricks from java developer


Blog

About me

Projects:

- AB English Courses

- StillSmallVoice.ru

- StillMakeUp.ru

How to get database size on PostgreSQL?

Problem You'd like to know how big is your PostgreSQL database. Solution Just run this query: SELECT pg_size_pretty(pg_database_size('database')) where: * database - your database name Read also PostgreSQL Disk Usage… »

  • 5 years ago
  • how-to, database, postgresql
  • Comments

How to view a replication lag on PostgreSQL?

Problem You'd like to know how big is the replication lag between master and slave on PostgreSQL. Solution You may run this query on your slave host: SELECT EXTRACT(EPOCH FROM (now() - pg_last_… »

  • 5 years ago
  • how-to, database, postgresql
  • Comments

How to delete git branches by regular expression?

Problem You want to delete plenty of branches in 1 line, e.g. you want to delete all release branches, named like: "release-1.0.0", "release-1.0.1" and so on Solution git branch -D… »

  • 6 years ago
  • how-to, git
  • Comments

How to view all related tables in Mysql/MariaDB?

Problem You want to view all tables related to specific table by foreign keys. Or you'd like to see all tables related to specific column. Solution You can use this simple query: For specific table… »

  • 6 years ago
  • mysql, database, how-to, mariadb
  • Comments

How-to automatically restart docker container if it down?

Problem You have an unstable Docker container and need restart it automatically when it down. Solution Docker has useful parameter --restart with three options: no - do not restart container, default behavior always - restart… »

  • 6 years ago
  • how-to, docker
  • Comments

How-to GROUP BY list of objects to map in java?

Problem: You need to group list of objects by field to map by object field. You have list of objects and need to group them by some field and get a Map<Field, List&… »

  • 6 years ago
  • how-to, java, collections
  • Comments

How-to split (partition) Collection in java?

Problem You have big Collection of objects and would like to partition by NUMBER elements. As a result you'd like to have Collection with Collection, each of them containing NUMBER elements. For example: You have… »

  • 6 years ago
  • how-to, java, collections
  • Comments

Script to emulate 'tail -f' over http/ftp

Problem You need to get file over http and get it updates in realtime, like tail -f does it. Very useful if you have access to you logs only over http or ftp. Solution Script… »

  • 6 years ago
  • script, bash
  • Comments

Script to partition data by NUMBER elements and insert them into string with delimeter

Problem Sometimes you need to split your data by specific number of lines and paste them to another string using delimiter. Solution Script partition.py Partition STDIN by NUMBER of lines and put them into… »

  • 6 years ago
  • script, python
  • Comments

How-to redirect using javascript?

Problem: You need to redirect user using javascript. Using vanilla JS, jQuery not nessesary Solution 1: Use this if you NOT need to put page to history // similar behavior as an HTTP redirect window.location.… »

  • 6 years ago
  • how-to, javascript
  • Comments

How-to reset mysql root password

Problem You forget or don't know administrator password for mysql or mariaDB. You should have access to server (terminal or ssh) Solution To reset mysql administrator (root) password you should: 1. Stop database: sudo systemctl… »

  • 6 years ago
  • mysql, database, how-to, mariadb
  • Comments
Page 1 of 1