java – Why do I actually need an interface in Spring Boot?

When programming in Spring/Spring Boot, it’s a common practice to have every service/component implement an interface, for example:

public interface IAdder {
    int add(int a, int b);

public class Adder implements IAdder {
    public int add(int a, int b) { return a + b; }

Why do I actually need to write that interface if I don’t plan on having multiple implementations for “Adder” functionality?

One common answer to that question is “you’ll need it for mocking in your unit tests”. To that, I can answer – not really. I can mock the adder using every possible mocking framework you can think of (Mockito, for example):

IMultiplier multiplier;  // Class under test

IAdder adder;

public void multiplicationTest() {
    // Arrange
    when(adder).add(3, 3).thenReturn(6);
    // Act
    int result = multiplier.multiply(3, 5);
    // Assert
    verify(adder, times(4)).add(3, 3);

Having said that, what advantage can the IAdder interface provide for me?

networking – Enabling/disabling Ethernet interface via shell without root?

I am trying to create a shell script for enabling/disabling Ethernet interface on my unrooted Android 8.0 Set-Top Box. The box is connected both via Ethernet and Wifi – Ethernet has only IPTV vlan access, and Wifi has Internet access. My problem is that when Ethernet cable is connected, all traffic is routed through that interface, which means no Internet access for other apps (only IPTV access). That is why I am trying to automate Ethernet interface enable/disable when starting specific apps.

However, I cannot find a way to do this programmatically or via shell – all methods I tried require root access. Also, I know that a better way to enable both IPTV and Internet access would be by setting custom routing tables, but that also requires root access…

I have tried the following:

ifconfig eth0 down (requires root)
settings put secure ethernet_on 0 (requires reboot, which is a huge hassle)

Is there any other method to disable Ethernet interface which does not require root access? I can do it via Settings GUI, so I assume there must be a way to do it via terminal as well. Thanks.

Modify the ip address of a network adapter interface

ifconfig shows a Network Adapter – ens37. I want to modfiy it’s ip address to
I tried with ifconfig ens37 netmask But that throws an error.
Any commands or ways to modify the ip/mask of a network adapter interface.
I am running fedora as a virtual machine on VMWARE.

8 – How to create an archive containing files with the Drupal interface?

When you reserve a domain name with a host, it offers a free space of 10 MB to publish a web page (this type of offer does not support PHP).

I created a small 8MB website with HTML, CSS and JS (it’s also a PWA). It is really very simple. Here it is :

I want to create in Drupal 8, a small website generator for my clients. The little website I created should serve as a model.

I want to take the files from my small website and modify them on the fly using a form.

Here’s the idea :
A user completes a form with his information (name of the company, description of the company, postal address, pages on social networks, …), he clicks on a button “Generate the website”. Drupal replaces the information in the files and generates an archive.

That’s all.

This generator must be built with a Bootstrap 4 formula. It must not save anything in the database and generate the files on the fly.

Is it possible to create such a program with Drupal 8 ?

Thank you

javascript – How can I define an interface or type in TypeScript for my constant?

I am trying to define an interface or type for my dataset but I get some errors. Below the wrong interfaces and code I am using:

interface IVehicle {
    (key: number): { model: string, year: number };
interface IVehicles {
    (type: string): Array<IVehicle>

const DATASET: IVehicles = {
    CAR: (
        ("BMW", {
            model: "520d",
            year: 2015,
        ("Audi", {
            model: "A4",
            year: 2011,
        ("YAMAHA", {
            model: "R6",
            year: 2020,
        ("DUCATI", {
            model: "Monster",
            year: 2018,


Typescript showed me the error: Type ‘string’ is not assignable to type ‘{ model: string; year: number; }’..

TypeScript Playground with the code:

Thanks for the help

ubuntu – Security Onion 2.3 The IP being routed by Linux is not the IP address assigned to the management interface?

I have just installed Security Onion 2.3 and I faced some issue with network configuration, first of all I have 2 interface

1- Host Only for Management

2- Nat with internet connection

but I receive this error

The IP being routed by Linux is not the IP address assigned to the
 management interface?  

What’s wrong in my configuration and how canI fix it?

linux – Rodar programas que necessitam interface gráfica em servidor

Eai pessoal, sou usuário de Linux e desenvolvedor, gostaria de saber se há alguma possibilidade de rodar programas gráficos em por linha de comando…
Explicando melhor: eu já tive a experiência de instalar interface gráfica em um servidor, porém não é isso que procuro, não quero dar um “startx”, quero iniciar um programa GUI por CLI e quando eu fechar o mesmo quero me deparar com o terminal de novo…
Acho que descreveria como um “interface gráfica” sem área de trabalho convencional.
Não sei se é possível, mas seria de extrema utilidade pra mim.

interface – Which ergonomic criteria would justify the behavior of redirecting the user to a 404 redirect page?

Without having to reference the criteria (because I think it is not necessary to answer the question), you are probably struggle with the question because of a couple of reasons.

Firstly, it is possible for there to be more than one way of classifying something, and if the criteria doesn’t allow for this (or isn’t flexible enough to adapt) then you should consider customizing it so as to be more fit for your purpose.

Guidance and error management can both fall under the bigger perspective of messaging and notification to the user, which allows the user to feel in control of their actions (in their interaction with the system). So I don’t see this as a problem that you can’t fit it neatly into just one category.

The other thing is that there are ways to implement a 404 page that leads to a more positive user experience, and ways that can make the user more confused and frustrated. So it is not so much redirecting the user to a 404 page that is the problem, because at some point your system will probably generate an error that you can’t necessarily address immediately (e.g. the server is down).

But as with all good error handling and management best practices, if you can:

  • identify the source of the error (i.e. is it caused by the user or
    the system)
  • provide some idea the nature of the error (e.g. is it an expected error caused by things like validation or something unexpected and outside of the system) and then
  • give some ideas of how to resolve the issue or perhaps next steps

Then your users will thank you instead of clogging up your support system/mechanisms.

user expectation – How to design schedule service interface

I suppose is a big question.

I am trying to create understandable and clear UX design for schedule designer web app. May be, In a fact i’m looking for some well-known practice or production-ready interface, which fits our goals too.

So I think I have to describe our web app entities. To make it easier to understand my question I change names some of them to more usial.

So, imagine we have categories of followers and marketing emails to send. Also we have a schedule: each day we are going to send some pool of emails of some category.

Here is data model:
enter image description here

Also, I have to notice, that sometimes, we need to move some email of some category to another day of schedule, so
emails of day ≠ emails of followers category, even that looks like it.

What I decide to design right now:
enter image description here

The main key of this screen is Generate schedule button. We suggest that user needs to arrange categories to days and generate schedule from this screen. If user needs to move some email to another day so user could do it on another screen, when viewing generated content, and this idea looks bad.

I feel like I’m trying to reinvent the wheel. What is the most right pattern in this case? What already existed decision could fit my goals? Where to find right inspiration to get this done?
Any ideas or questions are welcome…

¿Cual seria la diferencia entre interface y metodos? JAVA

entiendo lo que son los métodos(comportamientos que tiene los objetos) e interfaz(lo que puede hacer una clase/objeto), pero a la hora de crear una interface me confunde y pienso que es lo mismo que los métodos, por ejemplo si tengo una clase abstracta llamada: figura (y ademas podria tener la clase triangulo, cuadrado que extiende de esa) puede tener como método calcularPerimetro y calcularArea , pero también eso podría ser una interface no? Entonces como podría separar (el concepto como para entenderlo mejor) de lo que seria los métodos y por otro lado interfaces.