# Chrome
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome —ignore-certificate-errors &> /dev/null &
# Chromium
/Applications/Chromium.app/Contents/MacOS/Chromium —ignore-certificate-errors &> /dev/null &
# Help
https://www.technipages.com/google-chrome-bypass-your-connection-is-not-private-message
Turing completeness — finally, the best explanation
Some UML staff to memorize
Relations between classes are defined using the following symbols:
Spring: ‘request’ scoped beans into the background thread
It is known that there no way to deal with request-scoped beans outside of request thread. But sometimes it is required to check such beans for existence, because the algorithm should works whether is it a request context or not. The wondering thing is that such bean is not null even in background thread. So we need something more than bean != null.
The working way to do that is:
@Autowired(required = false) private RequestScopedBean requestScopedBean; private RequestScopedBean getRequestScopedBean() { if (AopUtils.isAopProxy(requestScopedBean) && requestScopedBean instanceof Advised) { try { Advised advised = (Advised) this.requestScopedBean; TargetSource targetSource = context.getTargetSource(); Object target = targetSource.getTarget(); return (RequestScopedBean)target; } catch (Exception e) { // do nothing } } return null; }
Looking for conventional approach…
MemoryMeter & RamUsageEstimator
There are two tools working in the different ways but giving the same result.
https://github.com/jbellis/jamm and https://github.com/dweiss/java-sizeof
The first one is using a java.lang.instrument.Instrumentation, the second one do it in the old-fashioned way (based on types info).
In case you are using MemoryMeter:
-javaagent:/Users/nikolay/.m2/repository/com/github/jbellis/jamm/0.3.1/jamm-0.3.1.jar
should be passed to VM options
Postgress man
dropdb mydb
## plain
# dump
pg_dump -U myuser -C -F p -b -v -f mydb.sql mydb
# restore
createdb -O myuser mydb
psql mydb < mydb.sql
## tar
# dump
pg_dump -U myuser -F t -b -v -f mydb.tar mydb
# restore
pg_restore -U myuser -F t -d mydb mydb.tar
Github-Art
Creator of ZeroMQ: https://github.com/hintjens

http://gyazo.shabak.ru/f1211dfaf3ecd3d22c7847089de6.png
Guava EventBus
@AllowConcurrentEvents
Q: What’s the profit?
A: It make sense, If such handler has a lot of things to do. If there are some deferred actions, it is useless. The price for context switching should be well-grounded.
Blub paradox
Facade pattern
So funny example: https://en.wikipedia.org/wiki/Facade_pattern#Java
Template method
I always thought that the practice described by Template method is awkward..
Liquibase + JPA DDL autoupdate
It is obvious how things going to when there are some ddl changes in entity and in the same time some Liquibase executables need to be applied.
The order of exec:
- liquibase
- JPA
PS in my mind this is the best practice when schema managing with sql scripts: main script describes whole schema and patches containing all the changes. Liquibase is also good but it is hard to use together with
hibernate.hbm2ddl.auto=update
Vaadin useful links
Viritin: https://github.com/viritin/viritin
Vaadin grid: https://vaadin.com/grid
Grid Util: https://github.com/melistik/vaadin-grid-util
Sampler: http://demo.vaadin.com/sampler/
Example App (Dashboard): https://demo.vaadin.com/dashboard/
Showcase: http://demo.vaadin.com/valo-theme/
SASS API: https://vaadin.com/api/valo/
JPA entity identification
Why it is not a good idea to use a primary key for equals() and hashCode() ?
In short: it isn’t possible to provide an unique identity for entities which are hasn’t saved yet.
It is a good approach to implement your own unique identity conditioned by domain model.
Выделение памяти для Java-приложений
Иногда нужно устанавливать не только максимальный размер хипа но и минимальный (стартовый).
Если выставить -Xms512M -Xmx1024 то это заставит GC работать в более агрессивном режиме, и в отсутствие активного выделения памяти размер хипа будет стремиться к стартовому значению.
Если выставить только -Xmx то размер занимаемой памяти программой будет постепенно увеличиваться, пока не достигнет указанного значения.
Есть подозрение, что jvm не проверяет наличие реально доступной памяти в системе, если написать слишком большое число, jvm в рамках этого числа будет просить у OS все большее пространство до тех пор, пока память не закончится, и при очередном невыполнимом запросе OS просто остановит jvm.
Таким образом, если просто выставить размер хипа очень большим, это не гарантирует бесперебойной работы программы.
Нужно подбирать параметры -Xmx и -Xms для каждого конкретного случая.
lex & yacc
Such interesting things weren’t known when I worked at Laboratory of Macroeconomics Researches, and was building syntax analyser for some DSL…
Простота
«Простота — это главная составляющая того, чтобы быть умным, делать что-то с умом, да и вообще ума. …
Если ты умен, то делаешь вещь как можно более простой, но не проще того. Все что делается, должно делаться с умом. Если это архитектура, нужно моделировать как можно меньше, но но столько, сколько необходимо. Если не моделировать, потратишь массу сил на то, чтобы описать, что ты хочешь сделать, и не получишь необходимого общего представления.»
Ivar Jacobson, major contributor to UML
Domain Driven Design
Such an interesting book. Haven’t read id since started creating software architecture. But some of common statements are applying by intuition.
https://ddd-cqrs-base-project.googlecode.com/files/DomainDrivenDesignQuicklyOnline.pdf
Going reactive
GOING REACTIVE 2016
HOW MICROSERVICES AND FAST DATA ARE DRIVING
MAINSTREAM ADOPTION OF REACTIVE SYSTEMS
https://info.typesafe.com/rs/558-NCX-702/images/COLL-going-reactive-2016-report.pdf
How to add dependent maven project as sources in Intellij Idea
Note: this project was added previously as a maven dependency, so now we need to add it as a sources.
Project Structure -> Modules -> [+] -> Import Module
go through the wizard…
After that go to maven tab, then select grey root nodes, right click, choose ‘Unignore Projects’
Maybe you need to reopen IDE.
UPD: also you need to reload cashes. I did it by:
- change version of the adding library to one of previous
- click ‘Import Changes’ on the ‘Maven projects need to be imported’ tooltip
- change it back
- again click ‘Import Changes’ on the ‘Maven projects need to be imported’ tooltip