instruction stringlengths 34 36.1k |
|---|
Each pod represents single instance of the web application in a node of Kubernetes.
Lets say 100 users are signed into a web app like Stackoverflow and connected to Pod1 of NodeA. Pod1 is down now. But Pod2, Pod3.... PodN are alive in NodeA.
What happens to the users who have logged in ?
How does Kubernetes handle thi... |
When using derived types in MPI for communication of data which is not contiguous in memory, the sequence of datatype-displacement pairs defining the derived type seems to be assumed to be the same for each process, but I cannot find any guarantee of this being the case.
In C, suppose I had initialized on every process... |
In implementing a binary tree in Java, should the node class be a separate class file independent of the BinaryTreeclass, or should it be a default class in the same class file as the BinaryTree class?
First Example: Node is in separate class file
BinaryTree.java
public class BinaryTree {
...
}
BinaryTreeNode.jav... |
Am trying to build a highly available and fault tolerant file drop location in linux server. Please find the current system design below:
We got 2 linux servers in secured zone into which several clients from unsecured zone will be dropping files in batch mode using xcom utility. Each client has got different times to... |
Is there a design pattern that fits this description? A factory that creates classes that can be disabled and enabled. The users of the class don't know if the functionality is enabled or disabled--they just call methods on the class. What are appropriate names for this kind of factory and class?
How do you make this ... |
I have built a very basic webcrawler running off my laptop so it has limited memory and limited hard drive space. The way I have it now is I'm using MongoDB to store the links I find on pages. I make sure to sanitize them and remove any unnecessary URL parameters that might cause duplicate pages to be fetched. Every ti... |
As I understand with laravel passport, in order for a third party application to consume my api they need to register their application with mine by creating a client.
The passport:client artisan command can be used to create clients. When using this command it prompts you for a user id to assign the client to as follo... |
I am trying to find out if it is allowed in the UML to change the visibility (access modifier) of an operation when overriding it. For example, in Java it is possible to increase the visibility of an overridden method from protected to public:
public class A {
protected void doSomething() {
}
}
public class B ... |
In Javascript, I have seen a code like:
const getSomeMapper = (param1, param2, param3)
(param4, param5, param6) => {
// uses all these params and returns a promise
}
interface MainParamInterface {
param1: string;
param2: string;
param3: string;
}
function entryPoint({param1, param2, param... |
I have an invoice aggregate that I create with a lot of data:
$invoice = Invoice::create(
InvoiceId::generate(),
$lines, // Collection of lines
InvoiceNumber::create('1'),
$address, // Address value object
Currency::EUR(),
null,
$discounts // Collection of discounts for lines and the invoice... |
there's an up and running self-serve customer portal built that I'm trying to make a bit better when it comes to displaying proper items for different client types and auto-logging users. Here are a few considerations:
Built on ASP.NET MVC (4.7.2)
Authentication Mode = Forms
Uses custom Membership Provider
Uses variou... |
I would like to know if it is allowed in the UML to specify a different return type for overloaded operations. This is possible for methods in Java:
public class C
{
public int addOne(int a) {
return a + 1;
}
public float addOne(float f) {
return f + 1f;
}
}
My question is whether this... |
My team is just starting with BDD, and we are learning to write scenarios in a GIVEN, WHEN, THEN format. This will position us to start to automate our tests (with selenium) at the start of sprint, so that we fail until the application code catches up to satisfy the test(s).
We are thinking that the automation of our ... |
I got this question on an interview the other day and was clueless to what the best practices are for solving it. It's the issue where you have to transfer money between two systems and want to avoid double counting. The systems are not located in the same hosting environment and each is web accessible through a gate... |
I'm developing a web application for academic purposes.
What i have to do is a simple website which keeps track of realties along with their respective owners and the tags they are bound to.
The application takes data from a MySQL database and must include the following features:
List all realties
List all realtie... |
I am building a new system, which I will call S, that needs to get some data from another system, which I'll name D. System D provides a client and a collection of classes(POJOs) to represent the responses in memory. Instead of using the client directly everywhere, I am writing a sort of adapter which will handle all t... |
I'm very, very new to the networking and AWS side of things, but experimenting a bit with some concepts. I was wondering if anyone had suggestions for the following use case. I'm in an experimental capacity at the moment, so these atypical practices have their reasons. Anyway, thanks for any guidance y'all can provide... |
I'm currently considering breaking down one of my libraries in some 20 Debian sub-projects. Each part is already pretty much a standalone bit in the existing large library.
What I'm wondering is the impact at runtime. Will my software be impacted by the fact that they'll have to load more libraries? I think it won't be... |
Is there some sort of pattern for enforcing the calling of a populator method before any of the rest of the interface is used?
I say this because it is not generally a good idea to put something that has network calls or something that does large calculations in a constructor.
That work needs to be done before the oth... |
MethodA calls an MethodB which in turn calls MethodC.
There is NO exception handling in MethodB or MethodC. But there is exception handling in MethodA.
In MethodC an exception occurs.
Now, that exception is bubbling up to MethodA, which handles it appropriately.
What is wrong with this?
In my mind, at some point a call... |
I'm developing a microservice system. I have a discovery service (Eureka) for all my services and an API Gateway (Zuul) to call each service via an URL.
My problem: How can I assure that a service call via my API Gateway is high available?
If the gateway dies, my services aren't callable anymore. I could start multipl... |
The benefits of Behavior Driven Development (BDD) seem to be that non-technical stakeholders are more easily included in the writing of requirements/user stories.
In an open-source project, most stakeholders seem to have a technical background, and should thus be able to understand the tests themselves, without a BDD ... |
I'm building an API that will be used by the front-end in React and I'm not quite sure how I should send the permissions of each user based on their roles. Some fields can only be edited in some states and by a defined role. It is quite complex and I really don't know how I'll send that information, everything I know i... |
So I've seen some C libraries written so that they compile without any changes with a C++ compiler, for example Lua.
What are some advantages and disadvantages of doing this?
A few basic ones I see are:
Advantages:
library can be used with any C or C++ project with no extra effort (without using extern "C" for example... |
I understand that generally shared libraries are a microservice antipattern, and the disadvantages of shared libraries in a microservice world are well documented.
However, I have not been able to find much information on extracting something like core library code into a shared service. What are the advantages and di... |
Wikipedia describes a bootstrap compiler to have these properties:
An initial core version of the compiler
A minimal subset of the language to be used by successive compiler versions
Everything I've read online assumes an initial subset version gets bootstrapped, but isn't it possible to bootstrap a recent compiler v... |
I'm planning to develop a web application that would run on-premise at the customer. I'm quite unsure about the whole process of setting up the site in a user-friendly way, but mostly disturbed by the SSL configuration. Which formats are a must to support? Should I require the admin to run my Java application with a lo... |
I'm writing a simple web application that allows users to login on different levels. Example:
admin: may access to everything in read/write
manager: some sections are in read/only
operator: only few sections available
I'm using CakePHP, by the way.
As far as I understand there two main approaches to handle such a dif... |
I am used to programming java on the server side with ORM frameworks and using abstract classes for CRUD. But now I'm workign on a desktop project without ORM and just the good old JDBC API for database interaction (And I can't).
I thought to implement an AbstractDaoCrud to encapsulate basic CRUD operations, but I gue... |
If I'm writing a method, in C# for example, I will use a try catch block.
Let's say the method adds some numbers but I log exceptions in the catch block. What's the best way to handle an exception causes in the catch block? e.g. the method may have an unrelated exception to the logging in the catch block throwing file... |
Caveat: I'm conscious that this question may not be a great fit for stack-exchange platform as maybe 'too broad' but will try & structure it that it helps people in the future
I have 2 event steams that represent GPS & Heart Rate sensors over a period of time. Both sensors are non deterministic is when they raise eve... |
Say you're using an external library, that includes type declarations, and it has a function like:
function foo(x: number) : string {
//implementation
}
Somewhere in our code we're calling this with:
function ourFunction() {
return foo(1);
}
or with the return type explicit :
function ourFunction() : strin... |
I need to simulate & output the human heartrate BPM with real-world like values. I've been looking at a gaussian random approach but don't believe this fits my use case. I'm not concerned about the actual values only that they are uniformed & match the patterns of a monitored heart beat (i.e. increasing/decreasing unif... |
Imagine the following scenario: I wish to build a photo-sharing social network app similar to Instagram (iOS only for the sake of conversation), and I want to make sure that users are using only my app to upload the photo. If it's not uploaded from inside of the app, I want to discard that photo.
Since anyone can captu... |
So lets say I have a SQL query made by a server that fetches up to thousands of records at a time and I need to display those records in a grid(similar to AG Grid) on the client for the user to review. The user then has the ability to flip through the records (the grid is set up for both server side and client side pag... |
I'm quite inexperienced in design patterns and while I was studying them I got confused about the application of the Factory pattern. Wouldn't DI decouple the classes more than factory would do it? Or would it be overkill to use DI in some situations? I understand DI as a step beyond Factory in decoupling by implementi... |
I am building few sites for my company's client. The sites are mostly the same but could have some customisations.
so we decided to create duplicate sites instead of multi-tennant and we decided to use packaging system so we can install them as required by a site.
Now my question is if I have a package 1 (events) who a... |
I want to create a java program that can find the shortest word ladder between two words. It's been suggested that I use a graph data structure with words as nodes. The idea being that nodes with words that are different by only one character are directly connected.
I'm dealing with a text file of possible words that h... |
I have an application that is sending messages over a socket from different threads. I create my own wrapper for the socket that enables me to extend functionality.
Example
- on new SocketConnection() it returns only one instance based on IP and port. So if some other thread tries to create instance of IP 1.1.1.1 and... |
I've been learning object-oriented concept from this book, and stuck in a specified concept in the middle of chapter 6.
No one could understand my question without brief prologue, so I'm starting with it.
The purpose of chapter 6 is teaching how to describe objects by using abstract data descriptions; three criteria ar... |
According to "Clean Architecture", should you inject all entity dependencies (should you inject core business logic)?
For example, if I have a vector entity, should that entity be injected into all other entities/use cases or should the entities/use cases depend on vector directly?
In one way, it makes sense to inject ... |
Is there a software pattern (or some recommended guidelines) for how to convert between enum values and discriminated unions? Or more specifically: project a discriminated union onto its enum case? And how do you call the enum case? "enum tag"? "union tag"? Does it even have a standardized name?
For example this Swift ... |
Suppose you have 2 stored procedure, let's say a GetProducts and a GetProductDetails.
Now, the GetProducts returns a list of products with a property that is "calculated" basing on additional calculation (the last time it was purchased, the number of resellers etc).
How can I be sure about the correctness of the data ... |
I am working with a startup company for a while now. They have been affected by some reckless developers in the past. One area they want a real and immediate improvement is when they assign a task to a developer that requires database read, they want to prevent unwanted fields to be returned by API system.
In other wo... |
I am developing a system that has a list of projects (verified by mentors) to which a student can provide a solution. Now I am stuck in a situation about how the student will submit their solution for review by our mentors.
The student will fork our project repository (problem statement, initial code and tests) and wor... |
I read this guide about recommended app architecture for Android.
Here is a graphical summery:
The role of ViewModel is clear, but I don't understand why we need it if we use Repository. The purpose of ViewModel is to keep the data persistent during the Activity life cycle, but if the Repository anyway exists as long ... |
Is there are way we can completely avoid illegal states rather then throwing an IllegalStateException when a method is called when it should not be?
For example:
public interface Process {
void start();
void stop();
}
Illegal state would be created if stop() is called before start().
|
The Problem
I would like to create a managing "overseer" class that connects several related object groups together where any particular group is able to be easily swapped for another using C++11 syntax.
A secondary goal of finding a good approach to code structure is to make the underlying code run quickly (since it w... |
When you use tools like jsdocs, it generates static HTML files and its styles in your codebase based on the comments in your code.
Should these files be checked into the Git repository or should they be ignored with .gitignore?
|
Backstory (You can skip)
I am writing a pronunciation library for irregular words. Take something like the following:
T1E1s // tee one E one es | tee one E ones
1994-1995// 1994 (minus|dash|to|) 1995
19-mm // 19 dash mmmmmmmmmmmmmm | 19 dash millimeter | 19 dash em em
4x4 // 4 ex 4 | 4 times 4 | 4 by 4
Wha... |
I have an algorithm to create a version for an entity and then I save that version against below 2 entity:
1) Variant
2) Category
interface IEntityVersion
{
string GetVersion();
}
public class EntityVersion : IEntityVersion
{
public string GetVersion()
{
return null;
}
}
public interface IVari... |
To write the grammar for Whole Numbers (0,1,2...) in BNF, we may write:
Number ::⇒ Digit MoreDigits
MoreDigits ::⇒
MoreDigits ::⇒ Number
Digit ::⇒ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
For a number like 37, the parse tree would be:
Now here is the part that confuses me. If we replaced the first rule Number ::⇒ Dig... |
I remember reading on someone else's post that test code should not be treated as normal code but as small whole programs and that is an idea I really like and would like to refer to when discussing with other engineer colleagues, but is not unanimously shared.
Specially I was referring to it when discussing if test sh... |
There is a db with tables of genes. And these genes would need to be annotated based on the client's needs. So if a gene matches condition x, then add a new column y and value z to that gene. Every cancer is different, so we supplied every client with a template configuration file where they can insert their queries an... |
This is a design question asked during interviews. The requirement is to build a "discount coupon" system that tracks coupons available in an eCommerce site. Something like:
Coupon code CDSXGF can be used 100,000 times, gives a discount of 2%
Coupon code HFSECF can be used 500,000 times, gives a discount of 10%
Addin... |
I'm trying to write a chess engine, Min-Maxing works. Now I wanted to implement Alpha-Beta-Pruning, but despite reading about it and watching videos, I must have a severe misunderstanding somewhere.
For Min-Maxing, I build the complete search tree, and evaluate only the nodes at the deepest depth. Then go upwards, and... |
I hope this is the correct SE site for this kind of question.
My team is currently developing an application which IMO needs access control beyond RBAC. Users can have access rights to entities based on several factors e.g. the administrator of a company is implicitly granted admin access to subsidiaries.
To allow abs... |
For a complex service that my team and several others maintain, two of my team's applications are called when processing one incoming request. The flow is as follows: an upstream system invokes an HTTP endpoint of our application A, then several other applications managed by other teams are called, one of them publishi... |
I have a system, which stores different objects in DB. Each such object has properties. Some of them are relevant for all objects (like Name, Description), but some are specific to each object and depend on its type.
Now I need to create a web method, that will retrieve that objects and their properties as set of POCOs... |
I am working with an existing numerical model implemented in C++, and I don't have much of a background in software design. This model reads in many (~100) of structured text files, performs numerous calculations, and then spits out an answer. The current organization of the program is as follows:
Main function create... |
My users will be businesses with a small number of accounts each: e.g. Business #1 with 3 users, Business #2 with 5 users, etc.
I am trying to determine the best way to organise the relation (on Postgresql, hosted on AWS) for each business client: for e.g. each business will have their own sets of customers, logs, prod... |
A few years ago, now, we had a chap working with us who introduced the following topology for Mercurial...
The main repository server obviously holds the primary repositories, as you'd expect, but the the required repo is cloned to a local repository, and from there into one or more working folders.
I've never seen th... |
I'm struggling with a decision about how to design a web-API where I create new "things".
We roughly follow the API guidelines of Zalando, which do provide a nice starting point for web-APIs (https://opensource.zalando.com/restful-api-guidelines/). But there's no guidance on how to handle creating new resources, which ... |
I have been investigating using RabbitMQ for a publish/subscribe pattern across micro-services where aysnc calls are appropriate but I am having trouble understanding some concepts and could not find any info in the manual.
I'll outline a basic example of how I wish to use it below.
I have a core service for user manag... |
In a new Java project I plan to use an extra layer above Hibernate entities. So there would be a CustomerEntity and CustomerDomain. The reason for that is that the CustomerDomain can contain extra data fields from other sources like SOA or other DB. (Maybe DTO is better here than Domain.)
In the pilot solution both the... |
I would like to build a microservices architecture to handle the following scenario:
I have a building. The building has some kinds of devices. And the devices can be used by the users. In the system, the administrator can add a user and allow the user to use selected devices in the building.
I have user service, devic... |
Imagine there's a boolean status variable that is either running or stopped.
This variable is running by default and comes together with a deactivator function.
When a client calls the deactivator function, the status changes to stopped.
Calling the deactivator function returns a cancel function, which, when called, re... |
I have a pretty general question about the design of Angular web applications. I'm a big fan of writing services. Sometimes I write services that have only utility methods that don't require state at all (think mathematical functions and the like). I feel that even in that case writing injectable services for the utili... |
Traditional switch blocks have one scope, so the following throws a compiler error "A local variable or function named 'message' is already defined in this scope":
switch(value)
{
case 1:
string message = "Val: 1";
break;
case 2:
string message = "Val: 2";
break;
}
As Eric Lipp... |
So I have started reading some books and articles on architecture. They all state (put a little simply) that you should never let your view access the model directly, when using a Model-View-ViewModel (MVVM) pattern. Instead there should be a view model for each model.
One of the ideas is, as I understand it, that for... |
Currently I am trying to setup a relationship between user groups and roles.
I am trying to satisfy:
Multiple roles apply to single group
multiple groups can have same role
multiple groups with single role.
I have a Group Table with RoleID and GroupName and a Role table with RoleID and RoleName. I am able to sat... |
A quick search of this stackexchange shows that in general composition is generally considered more flexible than inheritance but as always it depends on the project etc and there are times when inheritance is the better choice. I want to make a 3D chess game where each piece has a mesh, possibly different animations a... |
I am developing a desktop application that will be run at each station at a call center. It listens for an incoming call, and whenever a call arrives, there are about 30 different classes that need to run various operations. Some of these operations are synchronous, such as setting a flag because they want to log onl... |
Is there a way to generate a single use token for password recovery, without using a database?
This is because, I have an application that doesn't have a database, and doesn't store or has access to the login database. I use a Web Service to login the users, and store everything I need on a session. So there is no need... |
I have been preparing a test plan for every sprint even if I have a master test plan just to plan the test for the current sprint. I am including topics like:
Introduction
Purpose
Feature Overview
Inscope
Outscope
Assumptions and Risks
Approach
Test Deliverables
Testing Task and Proposed Schedule
Recently after disc... |
I have been using Template Design pattern in my code for implementing CRUD procedures for different resources.
There are some steps which are same for many resources and some which need some addition/overriding.
ResourceCommonProcedures as a base class and each Resource procedure inheriting the base class.
public class... |
Problem description:
Parent view displays a list of items. This view has button add a new item to list wich open modal for creating a new item.
Two approaches how to do that:
1) POST Request -> Insert from response body new list item to the parent view
2) POST Request -> Notify parent view that new item created -> Pare... |
I am asking advice from the SQL graybeards. Because my following proposition goes against everything I have practiced.
In this instance
Let's assume we are developing a phone app. A social network with hundreds of thousands of users. Our technology is java for the use on the android phone and will be open sourced. Furt... |
Long time ago I learned that text files are not like Random access Files, i. e., adding or updating info at the beginning of a text file involves moving all the rest of the file "forward" (or backwards if the size of the new info is smaller than the former info) in storage to let some space. This takes time and space i... |
I recently came across an MSDN article about branching and merging and SCM: Branching and Merging Primer - Chris Birmele.
In the article they say 'big bang merge' is a merging antipattern:
Big Bang Merge — deferring branch merging to the end of the
development effort and attempting to merge all branches
simultaneo... |
Why do languages demand catch blocks when they aren't needed?
The compiler or parser complains with this code:
try {
const utils = require("applicationutils");
}
But it is OK with this code:
try {
const utils = require("applicationutils");
} catch(e) {}
I don't need the catch block.
I'm using JavaScript if ... |
So our domain model drove our database and ORMs worked for DDD implementations.
Now the tables have been altered a lot and as a consequence ORM impedence is too much in our domain model to use hibernate tweaks. I am looking at persistence approaches for DDD entites.
Can Cross-reference tables be brought into domain ... |
I've developed a reading tracking app in Swift and for simplicity's sake I used arrays for my model. It stores some data about the books a user reads and a small image of the cover. I save them to disk periodically for persistence.
Now I'm wondering as people use the app, at what point would it be wise to convert my m... |
I'm currently taking over a project that has a common pattern of interfaces like this:
public interface EmailService {
void sendInvitationEmail(Payload payload);
void sendNotificationEmailToAdmin(Payload payload);
void sendPasswordResetEmailToUser(User user);
void sendValidationEmailToNewUser(User user);
}
The... |
I wrote a startup-pipeline where definitions are passed via environment variables and are used together with (unit-tested) methods to create suite of several publications (for subscriptions) by some lightweight factories and generators (also unit tested).
The startup-pipeline looks like this
Load the publication defin... |
I am the manager of a small team of software engineers.
I am looking for arguments in favor of automatic, mandatory code formatting.
For me it is natural, it goes with the Quality Assurance process and I do not question it too much ; commit cannot be accepted in our Python software if it does not passes through black. ... |
I'm currently developing a real-time application using .NET Core 2.2. Many IOT devices (could be up to 100) are concurrently sending messages via MQTT. These messages are parsed, elaborated to extract and validate the current position of each device based on some business rules and then persisted to a SQL Server DB usi... |
Context
I have a workflow that has an email form. The requirements are the following: A user completes the form that contains email fields and submits it.
If everything goes well then an email model object is created and stored in the database, and then the data are sent to a rabbit queue.
When the queue gets processed... |
Suppose I have a User entity with name and age attributes. A User can own Boxes. A Box has the name and color attributes. Business rules dictate that one User can own at most 5 boxes. So, in this case, the User can be the aggregate root and whenever a new Box is bought by a User, I can do
class User {
private boxes: ... |
I have a library for a lockscreen in Android, that includes diferent dilogs for fingerprints, texts and all that stuff. My question is: What the best practice to provide localization. Should I have instuments that provides developers eho use this library to set up localization outside of library, which means if develop... |
I am trying to polish my data-mapping library and struggle with my fluent API design as it feels clumsy in some basic use-cases.
The library focuses on defining mapping objects from one type into another in a fluent way, even for immutable objects. The immutable API works as follows: Every constructor parameter has its... |
I have a C# MVC application. One of the requirements of the application is to maintain an audit log of everything that happens to a particular 'entity' page. To make the example concrete, lets say there is a customer page, with sub entities like addresses and phone numbers.
I have an audit service that logs a particula... |
My team has recently decided to adopt the CQRS pattern similar to the one used in the famous Microsoft EShopsOnContainers repository. In this solution, the queries are made in Query classes using Dapper and Commands are done in command handlers using EF Core.
The queries that I am doing on my domain are quite complex ... |
A lot of articles online give very simple examples on Blue-Green deployments. However, how would data update be handled?
Say I have a column called Category with values (A, B, C, D). In my next release I want to consolidate values (B, C) -> (E) to handle a new logic. However something goes wrong and I need to rollback ... |
I'm building a news aggregation system that collects news articles from several websites, then classifies them into categories, tags them with keywords and saves them to a database. All actions are activated in the same sequence, begins with news scraping. Everything is put in a loop that runs every 5 minutes.
Trying t... |
I've been looking at examples of sequence diagrams for observer pattern but most implement push model where the subject updates the observers. In a pull model how would it be different because technically the subject updates the observers still when there is a change just that the observer triggers the data extraction?... |
I have to design the architecture of a system that processes messages in a distributed manner. If this were the only requirement, I would use a message queue like Kafka and distribute the work with Faust. This solution would be perfect for my use-case because the work that needs to be done for each message involves a l... |
Stack Exchange has some bits of what seems to be session state -- for example, whether you want to see 15, 30, or 50 questions per page when you view a list of questions.
You can click on the button at the bottom of the list to change the setting, that value is a URL query parameter, and thereafter the new setting is r... |
Important note: This is PHP (5.3+). PHP is stateless and everything you do dies when the request is over unless saved to a persistent storage, but if the answer provided gives me pseudo-code, I'd also be happy. Also, I can't use routing. I need something that deals solely with objects and parts of them.
My system right... |
I've been asked how to re-design a legacy system by a relative for a company that builds custom chairs. On their website you can customize your chair in about 30 permutations : chair type, material, if wood what kind, color, height, leg type, etc..
They have been working for years with a system that creates a ~40 chara... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.