Сообщения

Сообщения за 2019

swagger auto gen excercises

**kongchen/swagger-maven-plugin** org.springframework.web.multipart.MultipartFile can't use both simultaniousely and compile with 1.8 not late.

tds_fdw postgres ms sql

src: https://habr.com/ru/company/postgrespro/blog/309490/       CREATE SERVER sql01 FOREIGN DATA WRAPPER tds_fdw OPTIONS (servername 'mssql01', database 'kladr', msg_handler 'notice');     CREATE USER MAPPING FOR postgres SERVER sql01 OPTIONS (username 'iburtovoy', password 'pwd');     IMPORT FOREIGN SCHEMA kladr FROM SERVER sql01 INTO test123 OPTIONS (import_default 'true');

javascript: let const var

когда var то hoisting - это переменная объявлена в начале кода. const ссылка остается постоянной let или const - будет ли изменена ссылка в будущем. eslint - правильно ли let или const await это синхронно выполнить асинхронную функцию. в момент await выполнение текущего блока прекращается и берется следующее событие эта самая функция в await. когда await выполнился в список событий добавится что есть результат. после этого события родительский блок продолжает выполнение. serverworker - это для уведомлений - работают в фоне даже после закрытия браузера. висят в фоне, принимают сообщения. webworker - отдельный поток в браузере который общается с основным потоком.

react: super(props)

So, to conclude, If you want to use this.props inside constructor, you need to pass it in super, otherwise it’s okay to not pass props to super as we see that irrespective of passing it to super, this.props is available inside render function. src:  https://medium.com/@etherealm/super-vs-super-props-in-react-class-components-58658af6ecf2

javascript: Automatic Semicolon Insertion (ASI)

var postTypes = new Array('hello', 'there'); // <--- a="" here="" p="" place="" semicolon=""> (function() { alert('hello there') })(); src:  https://stackoverflow.com/questions/4026891/javascript-uncaught-typeerror-object-is-not-a-function-associativity-question http://inimino.org/~inimino/blog/javascript_semicolons

javascript: pretty print proxy object

        console.info(Object.assign({}, ProxyObj));

javascript: event bubbling

Click on a paragraph. An alert box will alert the element whose eventlistener triggered the event. Note: The currentTarget property does not necessarily return the element that was clicked on, but the element whose eventlistener triggered the event. Now every event goes through three phases of event propagation: 1. From window to the target element phase. 2. The event target phase and 3. From the event target back to the window phase. event.currentTarget tells us on which element the event was attached or the element whose eventListener triggered the event. event.target tells where the event started. Suppose there’s an event which shows an alert on click of the element. This event has been attached to the body. Now when the user clicks on the strong tag, currentTarget(.nodeName) will show the body whereas target will show strong as the alert output.

javascript: import v requre plus exports

module.exports = ...; is equivalent to export default ....  exports.foo = ... is equivalent to export var foo = ... Require: You can have dynamic loading where the loaded module name isn't predefined /static, or where you conditionally load a module only if it's "truly required" (depending on certain code flow). Loading is synchronous. That means if you have multiple requires, they are loaded and processed one by one. ES6 Imports: You can use named imports to selectively load only the pieces you need. That can save memory. Import can be asynchronous (and in current ES6 Module Loader, it in fact is) and can perform a little better. src:  https://stackoverflow.com/questions/31354559/using-node-js-require-vs-es6-import-export ************************************************************************ // imports // ex. importing a single named export import { MyComponent } from "./MyComponent"; // ex. importing multiple named exports import

rsync lsyncd

settings{     nodaemon = true } sync{     default.rsync,     source="/home/apple/Desktop/Parallels\ Shared\ Folders/Home/Yandex.Disk.localized/Programming/src/dropbox/programming/src/js/demo/app/",     target="/home/apple/app/lsyncd/",     exclude={"/target", "*-local.p*"} } src:  https://axkibe.github.io/lsyncd/manual/config/layer4/ https://habr.com/ru/post/132098/

postgrsql sql

CREATE TABLE tests(timestamp bigint, val int); INSERT INTO tests(timestamp, val) VALUES (1514768400, 2), (1514768401,4), (1514769299,6), (1514769300,8), (1514769301,10), (1514770199,12), (1514770200,14), (1514770201,16), (1514771099,18), (1514771100,18), (1514771101,20), (1514771999,22); select distinct on (qwe) qwe,val1         from (         select (date_trunc('seconds', (to_timestamp(timestamp) - timestamptz 'epoch') / extract(epoch from interval '600 sec')) *         extract(epoch from interval '600 sec') +         timestamptz 'epoch') as qwe , val as val1         from tests         order by qwe asc         ) as tests2         order by qwe         ;     ------------------ select        avg(b.val) diff               --,               --TO_CHAR(TO_TIMESTAMP(b.timestamp), 'DD/MM/YYYY HH24:MI:SS') from tests b group by (DATE_PART('second', to_timestamp(b.timestamp)) ) order by diff select 

vertical-align eventually

https://web-standards.ru/articles/vertical-align/

grid css colorize even, odd

its not possible with css but some workaround  https://keithclark.co.uk/articles/targeting-first-and-last-rows-in-css-grid-layouts/

regex crap

Using 1.*1, * is greedy - it will match all the way to the end, and then backtrack until it can match 1, leaving you with 1010000000001. .*? is non-greedy. * will match nothing, but then will try to match extra characters until it matches 1, eventually matching 101. All quantifiers have a non-greedy mode: .*?, .+?, .{2,6}?, and even .??. http://www.rexegg.com/regex-quantifiers.html#cheat_sheet https://stackoverflow.com/questions/3075130/what-is-the-difference-between-and-regular-expressions

mockitos crap

How to make mock to void methods with mockito doAnswer(i -> {   ((Runnable) i.getArguments()[0]).run(); // ! нужно сделать i.callRealMethod()   return null; }).when(executor).execute(any()); https://stackoverflow.com/questions/2276271/how-to-make-mock-to-void-methods-with-mockito mockito:  https://www.youtube.com/watch?v=Z1WD5Jj9dH4 mockbean это по умолчанию вырубаются все вызовы методов. поэтому spybean чтобы замокать только те что надо? https://stackoverflow.com/questions/11620103/mockito-trying-to-spy-on-method-is-calling-the-original-method 

postgres troubleshooting

pg_dump -C -h localhost -U localuser dbname | psql -h remotehost -U remoteuser dbname src:  https://stackoverflow.com/questions/1237725/copying-postgresql-database-to-another-server ++++++++++++++++++++ \list or \l: list all databases \dt: list all tables in the current database You will never see tables in other databases, these tables aren't visible. You have to connect to the correct database to see its tables (and other objects). To switch databases: \connect database_name src: https://dba.stackexchange.com/questions/1285/how-do-i-list-all-databases-and-tables-using-psql -------------------------------- SELECT * FROM   pg_trigger WHERE  tgrelid = 'stakertech.public.blocks'::regclass; -> tgname = 'RI_ConstraintTrigger_a_16588'; tgname = 'RI_ConstraintTrigger_a_16589'; and because of these restrictions on the blocks table deletion on condition coin_id became VERY slow. so ALTER TABLE blocks DISABLE TRIGGER ALL; delete ... AL