Skip to content

Instantly share code, notes, and snippets.

View steklopod's full-sized avatar
🎯
spot on

Dima Kaltovich steklopod

🎯
spot on
  • Berlin, Germany
View GitHub Profile
@steklopod
steklopod / intellij-java-google-style.xml
Last active October 9, 2018 08:35
Настройка стиля форматирования джава-кода для плагина ёgoogle-java-formatё
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="GoogleStyle">
<!-- https://github.com/google/google-java-format -->
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
@steklopod
steklopod / AppsFlyerHandler.java
Created September 28, 2018 08:38
Spring JDBC tamplate
package ru.gamble.servicebus.core.processor.ifd.csv2db;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.commons.lang3.time.StopWatch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
@steklopod
steklopod / work_with_json.sql
Created September 20, 2018 07:35
Example of mariaDB sql
# Создание процедуры роутинга для для работы с DBF-файлами из системы ФИАС
# Author: Dima Koltovich [06.09.2018]
# Update: Dima Koltovich [14.09.2018]
# USE servicebus_ifd_main; #TODO - изменить эту строку при необходимости
DELIMITER $$
DROP PROCEDURE IF EXISTS `add_tt_params_from_json`$$
# Процедура добавления параметров к тасктайпу
@steklopod
steklopod / build.gradle
Created September 20, 2018 07:33
Some usefull build file for Java-project
buildscript {
repositories {
maven {
url "http://build.wd.orglot.office:8081/nexus/content/repositories/jcenter"
}
maven {
url {"http://build.wd.orglot.office:8081/nexus/content/repositories/fusesource"}
}
maven {
url {"http://build.wd.orglot.office:8081/nexus/content/repositories/central"}
@steklopod
steklopod / RarExtractor.java
Last active September 12, 2018 12:43
Download .rar from http and extract java example
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.commons.lang3.time.StopWatch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ru.gamble.servicebus.core.domain.Task;
import ru.gamble.servicebus.core.exception.UnzipFiasException;
import ru.gamble.servicebus.core.metadata.TaskHandlerEnumCore;
import ru.gamble.servicebus.core.model.ifd.TableAndDataSource;
@steklopod
steklopod / JDBC_methods.java
Created July 10, 2018 10:36
JDBC methods (select, insert)
package ru.gamble.servicebus.core.processor.ifd.manager;
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ru.gamble.servicebus.core.domain.Task;
import ru.gamble.servicebus.core.domain.TaskType;
import ru.gamble.servicebus.core.exception.PackageIdUpdaterExeption;
import ru.gamble.servicebus.core.exception.RowException;
USE exchangedb;
IF NOT EXISTS (select * from sysobjects where name='esb_out_a_report')
CREATE TABLE dbo.esb_out_a_report
(
MESSAGE_ID int,
OPERATION_CODE int,
MESSAGE_DT datetime,
ENTITY_ID varchar(750),
RECEIVER_ID int,
@steklopod
steklopod / MySql_gen_data_from_seq_example.sql
Last active July 9, 2018 15:52
Generate data from sequence MySQL
CREATE DATABASE IF NOT EXISTS `ifd_test`;
START TRANSACTION;
USE `ifd_test`;
TRUNCATE TABLE esb_out_a_report; # из ->
TRUNCATE TABLE esb_out_h_report; # -> в
INSERT INTO esb_out_a_report (message_id, entity_id, maintenance_flg, message_dt, operation_code, receiver_id)
SELECT
SET search_path TO ifd_test, test;
SHOW search_path;
CREATE SCHEMA IF NOT EXISTS test;
DROP TABLE IF EXISTS esb_out_a_report;
CREATE TABLE IF NOT EXISTS esb_out_a_report (
message_id SERIAL NOT NULL PRIMARY KEY,
operation_code INT DEFAULT NULL,
message_dt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
package com.javarush.task.task32.task3210;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
/*
Используем RandomAccessFile
*/
//Считать текст с файла начиная с позиции number, длинной такой же как и длинна переданного текста в третьем параметре.