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
// https://mvnrepository.com/artifact/li.flor/NativeJFileChooser | |
// implementation group: 'li.flor', name: 'NativeJFileChooser', version: '1.6.3' | |
JFileChooser fileChooser = new NativeJFileChooser("D:\\SafwahResult_bot\\resources"); | |
// fileChooser.setFileFilter(new FileNameExtensionFilter("images", "*.jpg")); // select files | |
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // select Dir | |
fileChooser.showSaveDialog(null); |
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
val randomInteger = (1..10).shuffled().first() |
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
let rondomFloat = Math.random(); // 0 >= rondomFloat < 1 | |
const value = 10 | |
let rondomFloat2 = Math.random() * value // 0 >= rondomFloat2 < value | |
let rondomInteger = Math.floor(Math.random() * value); // | |
function getRandomInteger(min, max) { | |
return Math.floor(Math.random() * (max - min)) + min; |
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.util.LinkedList; | |
import java.util.List; | |
abstract class ArgumentTokenizer { | |
private static final int NO_TOKEN_STATE = 0; | |
private static final int NORMAL_TOKEN_STATE = 1; | |
private static final int SINGLE_QUOTE_STATE = 2; | |
private static final int DOUBLE_QUOTE_STATE = 3; | |
private ArgumentTokenizer() { |
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
ReadWriteLock lock = new ReentrantReadWriteLock(); | |
// write | |
lock.writeLock().lock(); | |
gson.toJson(data, writer); | |
lock.writeLock().unlock(); | |
// read | |
lock.readLock().lock(); | |
var objectMap = readData(); |
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
services: | |
db: | |
container_name: postgres | |
image: postgres:14.1 | |
environment: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: root | |
PGDATA: /data/postgres | |
volumes: | |
- db:/data/postgres |
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
#h2 | |
spring.datasource.url=jdbc:h2:file:../recipes_db | |
spring.datasource.driverClassName=org.h2.Driver | |
spring.datasource.username=sa | |
spring.datasource.password= | |
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect | |
spring.h2.console.enabled=true | |
spring.h2.console.path=/h2-console | |
spring.jpa.hibernate.ddl-auto=update | |
spring.jpa.show-sql=true |
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
#postgresql | |
#spring.datasource.url=jdbc:postgresql://localhost:5332/postgresql | |
#spring.datasource.username=postgresql | |
#spring.datasource.password=root | |
#spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect | |
#spring.jpa.hibernate.ddl-auto=create-drop | |
#spring.jpa.show-sql=true | |
#spring.jpa.properties.hibernate.format_sql=true |
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
@Suppress("UNCHECKED_CAST") | |
class CircularQueue<T>( | |
private val capacity: Int, | |
) { | |
private val elements: Array<T?> = arrayOfNulls<Any?>(capacity) as Array<T?> | |
private var front = 0 | |
private var rear = 0 | |
private var count = 0 |
OlderNewer