Author Archives: fvb

Docker container networking modes

https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach Note on docker container networking modes Docker offers different networking modes when running containers. Depending on the mode you choose you would connect to your MySQL database running on the docker host differently. docker run –net=”bridge” (default) Docker creates a bridge named docker0 by default. Both the docker host and the docker containers have an IP address on […]

Read more

Стратегии загрузки коллекций в JPA

https://dou.ua/lenta/articles/jpa-fetch-types/ Стратегии загрузки коллекций в JPA Понимание стратегий загрузки коллекций в JPA и Hibernate является ключевым для производительности приложения, использующего ORM. Отношениям один-ко-многим или многие-ко-многим между таблицами реляционной базы данных в объектном виде соответствуют свойства сущности типа List или Set, размеченные аннотациями @OneToMany или @ManyToMany. При работе с сущностями, которые содержат коллекции других сущностей, возникает проблема известная как «N+1 selects». Первый запрос выберет только корневые сущности, а каждая […]

Read more

Http Message Converters with the Spring Framework

http://www.baeldung.com/spring-httpmessageconverter-rest 1. Overview This article describes how to Configure HttpMessageConverter in Spring. Simply put, message converters are used to marshall and unmarshall Java Objects to and from JSON, XML, etc – over HTTP. 2. The Basics 2.1. Enable Web MVC The Web Application needs to be configured with Spring MVC support – one convenient and very customizable way to do […]

Read more

Linux multihome host with rule based routing

http://jensd.be/468/linux/two-network-cards-rp_filter rp_filter Since RHEL 6 (and CentOS 6), asymmetric routing doesn’t work anymore out of the box. The cause of the issue is a change in the default value for kernel parameter rp_filter. Rp_filter stands for reverse path filtering. The reverse path filter will check if the source of a packet that was received on a certain interface […]

Read more

Connecting services and hosts in Icinga2

To minimize overall configuration text it might be convenient to list all host services in the same block where the host is defined. The “apply for ” construct allows to di such thing. For example:   object Host “myhost.com” { import “generic-host-template” address = “myhost.com” vars.ipmi_address = “myhost-mgmt.com” vars.ipmi_config = “/usr/local/etc/freeipmi/ipmi_myhost.cfg” vars.service.https[“Myhost web”] = {port=8443} […]

Read more

Battery learning on LSI controller

https://web.archive.org/web/20130729085738/http://inside.godaddy.com/learning-deal-learning/ Many RAID controllers, like our Dell PERC cards, go through a battery learning cycle which calibrates the capacity of the battery to ensure it does not unexpectedly fail. For us, this cycle occurs every 90 days. When a battery learning cycle begins, it fully charges, discharges, and then charges again, realigning the true capacity of the […]

Read more

Working with local sendmail queue

https://www.cyberciti.biz/tips/howto-postfix-flush-mail-queue.html Under Postfix MTA, just enter the following command to flush the mail queue: # postfix flush OR # postfix -f To see mail queue, enter: # mailq OR #  sendmail -bp To remove all mail from the queue, enter: # postsuper -d ALL To remove all mails in the deferred queue, enter: # postsuper […]

Read more

Spring inside Netty

http://findevelop.blogspot.ru/2014/02/netty.html Netty: делаем лёгкий сервер с блэкджеком и аннотациями Допустим вам нужно обрабатывать http-запросы в своём приложении… Пишем на servlet-ах! Spring!! ЕщёКакойТоФреймворк!!! A теперь нам нужно слушать websocket… Выбор сужается? А завтра потребуется добавить поддержку SMPP или какого-нибудь ещё “необычного” протокола? Рано или поздно вам прийдётся создать консольное java-приложение и начать изучать “встраиваемые” сервера. Встроить […]

Read more

Java EL implicit objects

http://incepttechnologies.blogspot.ru/p/jsf-implicit-objects.html What are Expression Language Implicit Objects? JSF framework provides several objects related to current request being processed and/or execution environment. These objects aka Implicit Objects can be accessed at runtime in a facelet or backing bean using EL. Although you can access implicit objects using EL and JEE Servlet API as well, having predefined objects […]

Read more

Latencies reference

https://gist.github.com/jboner/2841832 Latency Comparison Numbers ————————– L1 cache reference 0.5 ns Branch mispredict 5 ns L2 cache reference 7 ns 14x L1 cache Mutex lock/unlock 25 ns Main memory reference 100 ns 20x L2 cache, 200x L1 cache Compress 1K bytes with Zippy 3,000 ns 3 us Send 1K bytes over 1 Gbps network 10,000 ns […]

Read more

InitV and systemd parctical notes

Nicely written reference https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html Short cheat shit List services: # chkconfig –list # systemctl list-units This will show any unit that systemd loaded or attempted to load, regardless of its current state on the system. # systemctl list-units –all # systemctl list-units –all –state=inactive # systemctl list-units –type=service Since systemd will only read units that it […]

Read more

Mutually recuresive type variable bounds

http://stackoverflow.com/questions/23248103/example-8-1-2-1-of-java-language-specificationmutually-recursive-type-variable http://www.javaadvent.com/2013/12/type-safing-the-observer-with-mutually-recursive-bounds.html A recursive type is a type that uses itself in its definition. The simplest example is the linked list: class List<T> { T value; List<T> next; } Here, List<T> is recursively defined because it uses a List<T> in its own definition. A type variable bound (Foo in <T> extends Foo) is recursive if […]

Read more

Apache Shiro

https://shiro.apache.org http://meri-stuff.blogspot.ru/2011/03/apache-shiro-part-1-basics.html The following is a reprint from http://meri-stuff.blogspot.ru Apache Shiro, originally called JSecurity, is Java security framework. It was accepted and became Apache top level project in 2010. It aims to be powerful and easy to be used. The project is in active development with active both users and developers mailing lists. Most important areas are […]

Read more

Running Spring application in WebLogic

http://pauldone.blogspot.ru/2010/02/weblogic-and-spring.html   WebLogic and Spring In this blog topic I describe some of the integration points that WebLogic provides for Spring based applications. I have mixed feelings about Spring. I definitely prefer its primary focus on the Dependency Injection pattern (DI) instead of the more typical JavaEE model of using the Service Locator pattern (think […]

Read more

JDBC url format

In case of PostgreSQL it is documented here. With JDBC, a database is represented by a URL (Uniform Resource Locator). With PostgreSQL™, this takes one of the following forms: jdbc:postgresql:database jdbc:postgresql://host/database jdbc:postgresql://host:port/database In case of MySQL it is documented here. The general format for a JDBC URL for connecting to a MySQL server is as […]

Read more

Functional data structures In Java

Also known as purely functional data structures, these are immutable and persistent. The methods of functional data structures are referential transparent. A persistent data structure does preserve the previous version of itself when being modified and is therefore effectively immutable. Fully persistent data structures allow both updates and queries on any version. Many operations perform […]

Read more