Reusable module using spring framework with spring-boot application modules?

I have a maven module which will handle DB interactions for various scenarios. I want this module to use spring framework so we can leverage the standard DI and integration test capabilities. This module will never run as it own application. Lets call this the DB module.

This module will be included as a dependency in a number of deployable application modules which use spring-boot to get easy access to various REST / Web interfaces. Lets call this will be the App module.

As I see it, the DB module will define the standard classes and @Autowire or @Resource JdbcTemplate objects. The integration tests of the DB module will define the full context for the module when running tests. I can use various test profiles at this level to switch between h2 and real DB’s.

In the App module, we’ll have a standard Config class which will declare the @Configuration annotation and then declare the various @Beans from the classes in the DB module.

Are there any guidelines or advise on how i should declare contexts or beans in these modules?

networking – OpenVPN through NetworkManager fails, but not through console application

I have an openvpn server in my office and I want to connect to it with an Ubuntu 18.04 machine.

When I use the following command openvpn --config my.ovpn I can connect to my server and can easily ping devices that are located in my network. I get an IP from the IP subrange that my network is connected with 192.168.1.x, so all good.

Now where I fail is to make it work through NetworkManager.

I tried the following:

sudo nmcli connection import type openvpn file /path/to/my.ovpn

Then I connect

sudo nmcli connection up my

And I get a success response

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/27)

I check my connection and see that I don’t get a right IP, I just get a 192.168.255.6 IP which is not correct.
ifconfig

I can ping 8.8.8.8 for example and surf the web when I am connected, but I can’t ping any devices within my network.

I don’t see an relevant error in /var/log/syslog.

What am I doing wrong and where can I start to debug this thing?

nt.number theory – Does this work? Application of a weak convergence condition to an alternating sum of reciprocal powers of the natural numbers, with a twist

The idea is straightforward, take a super weak convergence condition and apply it with a twist which makes the angular information of the series disappear, hence only be able to reason about the existence of an $iy$ for given $x$.

Let a complex series be $$sum_{n=1}^infty l(s,n)e^{phi(s,n)i}$$ for $s = x+iy$, real $l$, $phi$, $x$ and $y$.

Given arbitrary $phi$, this sum could converge to any complex number defined by a radius $r = sum_1^infty left|l(s,n)right|$.

If, however, one is given the first $m$ terms of $phi$, the condition becomes $$left|sum_1^m l(s,n)e^{phi(s,n)i} – qright| leq sum_{m+1}^infty left|l(s,n)right|$$ where $q$ is the complex number we wish to check convergence for. As long as this inequality holds for any $m$, the series converges to $q$.

Now, for the series of reciprocal powers of the natural numbers, let $$mu(s) := sum_1^infty frac{e^{omega(s,n)i}}{n^s}$$
with $omega(s,n) = t_n + Im(s)log{n}$, $t_n in mathbb{R}$.

Checking for convergence $$left|sum_1^m frac{e^{t_ni}}{n^x} – qright| leq sum_{m+1}^infty left|frac{1}{n^x}right|$$ and setting $t_{2h} = alog{n}$, $t_{2h+1} = pi + alog{n}$ for $ainmathbb{R}$, $h in mathbb{N}$ one obtains $$left|sum_1^m frac{-1^{n-1}}{n^{s’}} – qright| leq sum_{m+1}^infty frac{1}{n^x}, s’ = x + ia$$

Here, one can set $q = 0$ to disprove Riemann’s hypothesis, as we morphed $mu$ into $eta$, the analytic continuation of $zeta$, and since for $0<x<1$ the comparison boils down to $something finite leq infty$. When $x<1$ the inequality always fails, so it seems consistent :).

application design – Android app development (daily journal type)

I want to get help from you all about building an android app that is capable of logging daily journal type data. I want to have these feature primarily in the app:

  1. Capable of logging the daily logs.
  2. Some way to save data to some cloud storage app like, Google drive
  3. Login with eMail feature for password recovery
  4. In built App lock
  5. Backup could have been done as a text file
  6. Search possible by date, by keywords (keywords are something like hashtags or labels so that user can tag days as happy days, sad days etc (like people do in their blogs sometimes))
  7. Last but not least, having some nice UI

I’m really newbie so I don’t know where to start and what all things I need to learn in order to make this project.
All you people have to do is list down the things I should learn to make this project into reality

PS:-

  • I am doing this for my own curiosity and fun.
  • It would be even more good if you suggest some things from your experience.

I would be really thankful to you all.

usability – Desktop Application Multiple Level Navigations on the page!

I am having 2 options as mock-ups wherein i am here to collect your opinion on the same.

The user will be clicking the global menu and he will land on the listing page. If the user needs to check the record details, he will click on view details against the record on the listing page.

When the user navigates to the View details page, he will have a lot of information that will be grouped and show it to the user. I am having a Page-level grouping and each group will have sub-level grouping on the page shown below.

Option 1:
In this screen, Page navigations are placed just below the page heading & it will be in a horizontal tab approach. Sub-navigation related to the active tab will come below in vertical tabbing below.

enter image description here

Option 2:
In this screen, Page navigations are placed just below the page heading & it will be in a vertical tab approach. Sub-navigation related to the active tab will come in the content area with horizontal tabbing.

enter image description here

If you see in those screens, There are Global Menus, Page Tabs & Inside Page tabs there are some more details which are sub-groups. Request you to drop your comments.. That will help me finalizing… Thank you..

What are the risk of providing identity in my application, rather than using a provider?

In our multi tenant SaaS software application we intended to use Microsoft Identity Platform (Azure AD) for user authentication and providing the claims for authorization within the application. We are facing a lot of difficulties managing and getting the correct claims throughout the stack and are now considering providing our own identity and web tokens (through a library like Microsoft.AspNetCore.Identity).

This means we would still rely on Azure AD for the authentication, but then use our own (synchronised) identities to manage application roles, permissions, etc and store these in the application database.

Q: What are the security risks we will be exposed to when we provide our own identity rather than use a service for these, keeping in mind we would still use a service for the authentication?

usability – In a Desktop application, should the recent file list placed directly in the file menu

A desktop tool mostly offers recent files. I am used to press Alt+F and then 1 to open the first recent files. It seems that I learned it from Notepad++. I thought it was a “platform convention” (refs Usability Guidelines), but it doesn’t seem like that.

Here are some examples. What would you recommend why? Maybe I am a too old-school user wanting to have the list of recent files with one action (one hotkey), not with a combined action (two subsequent hotkeys).

Notepad++

grafik

vs.code

grafik

IntelliJ

grafik

JabRef

grafik

(I want to change that –> https://github.com/koppor/jabref/issues/313, but I am unsure)

jsonp – Simple Java HTTP Server application that responds in PJSON

I want to create a very simple HTTP server Java with PJSON responds.
Here is the code:

public static void main(String() args) throws Exception {
     HttpServer server = HttpServer.create(new InetSocketAddress(8500), 0);
      HttpContext context = server.createContext("/test");
      context.setHandler(Sample::handleRequest);
      server.start();
     System.out.println(" Server started on port 8500");
    }    
 
 private static void handleRequest(HttpExchange exchange) throws IOException {
      JSONObject json = new JSONObject("{"weight":"23400"}");
      exchange.getResponseHeaders().add("Access-Control-Allow-Origin", "*");
      exchange.getResponseHeaders().add("Access-Control-Allow-Headers","origin, content-type, accept, authorization");
      exchange.getResponseHeaders().add("Access-Control-Allow-Credentials", "true");
      exchange.getResponseHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
      exchange.getResponseHeaders().set("contentType", "application/json; charset=UTF-8");
      exchange.sendResponseHeaders(200, json.toString().getBytes().length);
      OutputStream os = exchange.getResponseBody();
      os.write(json.toString().getBytes());
      os.close();
  }

and client:

$(document).ready(function () {
        $.ajax({
            url: 'http://localhost:8500/test/',
            type: "GET",
            dataType: "jsonp",
            data: { no: 120 },
            contentType: 'application/json',
            success: function (data) {
                $('#txtWeight').val(data);
            },
            error: function (err) {
                console.log( err);
            }
        });
    });

The problem that I have is related to the HTTP Handler. The Chrome returns:
Cross-Origin Read Blocking (CORB) blocked cross-origin response http://localhost:8500/test/?callback=jQuery34109210173679568667_1603222391566&no=120&_=1603222391567 with MIME type text/plain

Could you please have a look and tell me if something is wrong?

javascript – Is it an antipattern to pass an object that stores the application state from one function to another?

The program is written in JavaScript. To give you a rough idea what I am thinking of:

function State() {
  return {
    color: 'green',
    size: 100,

    // ... there are other properties here
  }
}

function init() {
  const state = State()
  const otherObj = OtherObj()
  
  // ...something like an event fires `foo`
  foo(state, otherObj)
}

function foo(state, otherObj) {
  state.size = calcNewSize(state) // state changes
  state.color = pickNewColor(state, otherObj) // state changes
  // ...   
}

function pickNewColor(state, otherObj) {
  const someInformation = getSomeInformation(state)

  // ... do other stuff

  return newColor
}

const a1 = init()
const a2 = init()
const a3 = init()

Right now, I have 3 objects that I should pass from function to function, but I am wondering, if this would scale well.

I am also wondering, if is better to pass the entire object, instead of only the properties that are needed by these functions. Maybe it would be a good idea, to draw a line at 2-3 arguments, and if more is necessary, then pass the entire object.

Also, this could possibly be refactored into a single class, with methods (like pickNewColor, getSomeInformation) having access to the properties (like size, color), in which case there wouldn’t be any need to pass around objects. However, I was wondering, if the above approach of passing around objects could work well.