instruction
stringlengths
34
36.1k
as per request, I'll reduce this whole set of questions to 1-2 core points (thanks for the feedback ;)). I'm considering using insert-only tables for keeping the history of my data. while the productive usage is pretty clear to me by now, I'm still struggling to find a solution for some problems from a continued develo...
I'm working on a project in Python and want to get it hosted for others to use, the internal recommendation has been to host it on AzureML (it is a non-machine learning model, but follows the same practices of having a model and scoring script). A Python script on a single request would return the result in 0.1seconds....
I hope this is the correct sub StackExchange to post this question. In our company, we are currently using a Spring Cloud Config server for Spring boot apps to be able to fetch their configuration values (application properties). We also have Hashicorp vault for secrets management. So far this has worked out fine. Howe...
I've been trying for days to upload plain text files to a web server (both IIS and NGINX) via HTTP PUT/POST, from a C# desktop app, unsuccessfully However, I'm no further along. I have had various threads here, and on StackOverflow regarding specific issues), but given how trivial it was to GET files from the file serv...
I'm building a mobile app in Flutter, and the project has several distinct layers. The top part is something better described as MVVM: dumb View layer that performs rendering and delegates actions to reactive stateful ViewModel. The ViewModel itself is kept rather lean too, with all the actual logic pushed down to Mode...
I'm relatively new to Go but I come from a C#/OOP background where unit testing private methods isn't something that's generally done. I currently have a senior developer telling me it's "bad design" if private package methods can't be tested. Is this generally true of Go?
there are a vehicle class and customer class . In short, in the customer class there is a function that shows 'can this person or company rent that car'.The function uses a object of vehicle and compares with the customer so my question is in the class diagram which association should be there to show this connection b...
I'm trying to make sense of the docs located at: https://developer.mozilla.org/en-US/docs/Web/API/Response/redirected It says Note: Relying on redirected to filter out redirects makes it easy for a forged redirect to prevent your content from working as expected. Instead, you should do the filtering when you call fetc...
Often, when a program is starting it shows a modal window which has program logo, copyright information etc. For example, NetBeans shows the following window at startup: Could anyone say how such windows are called? I've heard that there is a special term for them.
I am going back and forth on an aspect of our FluentValidation and MediatR pipeline behavior implementation. We receive requests which, in a Mediator pattern, are mapped to command or query objects, which are, in turn, validated before being presented to the service layer/business logic. I can mostly validate everythi...
I am pretty new to async programming and the whole stream stuff, since i have a web programming background with php, where async programming and streams isn't really a big topic most time. I try to implement clean archtiecture in my next application where i use the concept of use cases to invoke business logic and rece...
A conceptual question... I have a XML configuration file used to set various behaviours in an application (colours, supressing help prompts etc). On starting the application, the XML is deserialized into memory, in a class whose structure matches the XML file's structure. For info, the application is a C# WinForms GUI...
I have a template class in c++ that depends on a few nontype template parameters. The implementation of some methods, and some field member, depend on the value of the template parameters, in a nontrivial way. This essentially require partial template specialization of the methods, which (being not directly doable in c...
We are generally following the package-by-feature approach, which is great. However, one specific case is constantly causing confusion and inconsistencies, and I'd like to know your approaches in this regard: Packaging API implementations that import, export or import and export data (by feature) We have had multiple...
Wikipedia says "increase key" is O(log n) for a binary heap, but it is referring to an internal function. I'm not asking about that: Imagine the data structure had an external/public function named modifyElement(currentElement, newElement). Some constraints: The currentElement is in the data structure already, but it...
When would you consider sharing a database to be fine? What are your rules? Our team in-charge of in-store credits. We: Calculate how much credit the customer earned Keep track of how much credit the customer earned and spent. Think of a bank but for in-store credits instead of money. Expire unspent credit. Think of g...
Had a discussion today in how to implement services that work with messages coming in from event queues. We call these services processors. One of us argues for using several functions, while the other argues for fewer functions that do more things, according to idiomatic go. To make things more difficult, there's a he...
We discuss about POSIX compliant shell script here. While we are writing more and more shell scripts, we build some helper functions to reuse the codes. We are considering putting a few helper functions (around 10 functions of the same category) into a library file (e.g. string_lib.sh) or splitting each functions into ...
I have worked with Scrum in various IT companies on software development projects. This framework has become the standard in several companies, but I have not yet managed to make friends with it because it causes me a lot of stress. Estimates We estimated the backlog items in hours. I often struggled with the fact that...
In Flask you can run a "webserver". Well really it's a "WSGI Server". Well really you shouldn't be using core server features like serving files through HTTP at all, you should be using a "real web server" like Apache. That has load balancing, multithreading, etc. In Node.js you can use Express as a webserver. Actually...
Generally print statements are frowned upon in favor to logging. But are there any situations where I should prefer using print statements? In a interactive command line application, if I ask for user input and he gives me wrong input, should I print the error message or should I log it? If I should print it, to where,...
I have a system where Client(C) sends request to Server(S0). S0 then sends the response back to Client that "request received" and closes the connection. C can regularly poll S0 to check on status of the task. The task to perform contains several asynchronous tasks (T1, T2, T3, etc.) that can take many hours to complet...
Azure Managed Identity provides a mean to only allow explicitly defined users/apps to access a given resource. For instance I can setup that no-one can access my database except the Managed Identities A and B. If C (or someone with no identity) tries to access the database, they are blocked. Even if they have the conne...
Presume a desktop application presents a Problem Reporting interface as part of it's GUI, and I wish to allow users to upload files as part of that PR. One would hope this is only ever used for constructive purposes, however - this raises several questions: How does an organisation deal with 'content policy' - i.e. us...
So I am working on my first project using SQLite and SQLModel as ORM. Creating and handling the first table in my database was easily structured: A function for each CRUD-Operation. But now I have added a second table to my DB and am starting to think about structure a bit. Essentially I want to do the same thing for a...
I have the following module structure: core persistence extension In my core module, I have an interface: Handler. This interface has multiple implementations in the core module as well as extension module. Some implementations depend on other complex types. I would like to persist instances of Handler in a database....
Lately, I have been playing with this idiom: Changing a private member variable into a local static variable when: member to singleton class used in only one function member is mutex for a shared resource used in only one function. member is constant expression used in only one function. Looking through my code, I pi...
I am new to backend development and I was building a feature for my project where I can send notifications to various channels (for example slack). I have a written notification class, which loads the service config from database and send the message. The project I am building is managing users across various services ...
I am looking for a way to let Web QA tester to test website with specific version. So, Web QA tester can say things like "this X is broken since version A.B.C". The current test/release process: developer create a feature branch from staging. commit to the feature branch. developer merge the feature branch to the dev ...
I have few questions on the go's answer to c10K problem. How is an event loop different from the network poller described in this blog? I see a striking similarity between waiting threads and waiting goroutines. And, non-blocking IO. I understand that it happens all under hood and transparently. But, at the sockets lev...
I'm currently refactoring our instance startup code, which is currently a 2,000 line mud method. The issue is that that method needs to create a large number (>50) of components/service objects, each with their own dependency requirements on other created components. Something of the style var service1 = createService1...
I am designing REST API for users and teams of users. One user can belong to multiple teams . One of the requirements is to be able to sort the users belonging to team in alphabetical order. Teams can be huge and contain a lot of users. We came with the idea to have sth like that: POST /users/{user-uuid}/teams-membersh...
I'm building a ASP.NET Core Web API and the application consists of 3 main modules. Data module: Contains the entities and DbContext Web API: Contains the controllers Service module: Contains all the data processing logic between the data module and the web API. I'm not using repository pattern to access data from th...
I am designing a database for localization standardizations. It contains Languages, Regions, Cultures, etc. For the region, I have a hierarchical structure that contains a name and a parent which is a parent name. Name in this case is the primary key. The parent region is the region that contains the given region. Each...
I'm in the very conceptual phase of designing an open source password manager that provides distributed Vaults that can be simultaneously accessed and managed from multiple devices with the promise of never storing passwords in the cloud and never having a monthly subscription fee. I ultimately plan to support all of t...
About 10 to 15 records are processed per day with the time interval of 5 minutes between each record. System A inserts a record in DB and sends id of that record to active mq. System B Listener receives id from mq and pulls records from DB System B processes that record and posts to System C using rest api call If 1,...
I am designing rate limiting in my application in which the rules can be dynamic. I have a basic design in which every request is validated against the rate limiting quota, which is stored in redis. As the system scales, redis will become the bottleneck and I want to cache the quotas in memory to speed up the response ...
The problem: We have a business process where we need to record many transactions between parties. At the same time, the products&services that transactions are for can fall into many categories at the same time. For example, we might have a transaction for iron rebar which falls into multiple categories at the same ti...
We've leveraged WCF Azure Service Bus Relay fairly heavily in the past and have a number of C# services that rely on it. All of these services relay REST requests to small on-site servers that sit behind corporate firewalls and are hosted on networks with dynamic public IPs. We are rapidly approaching the point where w...
There's a lot of free or member predicate-like functions (that returns boolean value) in different programming languages and popular libraries/frameworks that have "is" as a prefix, e.g.: isalpha C, python isEmpty C++ Qt C# ... Sometime such function names don't have "is" at all, for instance empty for C++ std::basic...
I am working on a project implemented in DDD style, and I use Repository architecture pattern to persist domain changes. I have multiple roles in domain layer, and that's what raises my question - how should my Repository handle this? Three solutions come to my mind: Separate Repositories for separate objects - (proba...
I am writing a service and a library that I need to make framework agnostic because it will be used by some client services. The client services will be written in both Micronaut and Spring frameworks. So I must probably avoid DI in a container. The library wraps the communication to the service, giving the client serv...
I have an Azure App Service running a .NET (Core) API for an inhouse application, which I'm integrating with Twilio to handle Whatsapp communication. To handle the web hook responsible for receiving a message, I can't think of a secure way to allow communication to my API, and thus thought that I could build an Azure F...
I'm writing my own dynamic programming language. So far I've been using a tagged union for all values. Since this boxes primitive types needlessly, I've begun researching tagged pointers which seem to be a common solution. It works by taking advantage of pointer alignment requirements which result in a certain number o...
Big and Little Endians represent the way we store bytes of multibyte numbers (int16, int32, etc.) in memory, transfer over the network, serialize, and so on. I know how they work, what they represent and what problems we can face if we don't understand them. For example, one problem could be if we use a library that wo...
<div> tags are display: block per default. <span> tags are display: inline per default. Could there be a tag that is display: flex per default? I don't mean a class, like bootstrap has. I mean a tag, like <flex>. Or better yet, a <row> and a <column> tag with the corresponding directions set per default. I've heard tha...
I'm studying for an exam and one of the questions, is about the concepts Separation of concerns and Modularity. But I struggle to see the difference between the two concepts, since both of them seem to be about reducing complexity in data by dividing it into smaller parts/modules? So is there a way where these two conc...
Reading Peter Van Roy's "Paradigms for Dummies", I am a bit stuck with the second footnote. Van Roy presents a graph depicting paradigms with different combinations of attributes for state. Named and unnamed, deterministic and nondeterministic, concurrent and sequential. The footnote states that two combinations are no...
New to the microservices architecture - but what I've picked up so far doing some research while designing a microservices architecture for a home rental system is these: Individual microservice should be as loosely coupled as possible - that doesn't mean they shouldn't communicate but not to the level that one micros...
As mentioned in some StackOverflow posts (like this one), I'm dealing with a difficult situation: My company is developing some C# applications (being a client-server application). We have migrated the server application from one computer to another one, and on the starting computer, everything was working fine but on ...
I have made a small project to try and learn to implement SQLite-DBs into my projects. For the DB part, I use sqlmodel and followed their tutorial. For the creation of the engine however, they use a module variable. This turned out to be a problem for me when trying to implement proper tests (see stackoverflow question...
Python is the language I use most in this period. My background in Java Before start learning Python I have programmed in Java language. In Java all code is written inside the methods of a class and variables are attributes of a class. In general is a best practice to avoid using static methods, public variables and so...
Many people come from frameworks that implement Dependency Injection and IoC containers for everything (in my case Angular 2+), so, this group of people will try to use dependency injection and IoC containers in everything even outside those frameworks. But, most of the implementation using DI is not using it to implem...
Our android application is built on java. And while sending push notifications we're using tomcat as a server. And it is doing more harm than good. Currently all the push notifications (FCM/APN) are pushed all at once. As I said they're not real time notifications that need to be delivered all at once. They can be deli...
I use MariaDB to store data using EAV model. I need EAV, because each attribute of each entity can have its own validity (validFrom, validTo). For example, I have entity person and I track changes made to their homeCity and degree attributes: attributes table: attributeId name ------------------------ 1 'ho...
This is a question which I have had in the back of my mind for a significant length of time, but never found an answer to, and never thought to directly ask - until today. I am interested to understand why HTTP supports multiple different methods, GET, PUT, POST, etc. My thoughts on this are: http methods are a way of...
This is a design problem that has plagued me from web apps to embedded systems. It seems that my fellow developers don't really care at all, so I've never seen an established pattern. In short: how does one decide if the parameters of a function should take an ID related to an object or parts of/the entire object itsel...
I'm trying to a create a "Task Queue" that has the following behaviour. Work is added via a Func such that the task is only started when the item is popped off the queue (no when it is added to the queue) Only a single item in the queue should be executing at any one time. If a new item is added, anything in the queue...
In tests, state verification or collaboration verification is usually undertaken. One of the drawbacks of this approach is the coupling of tests to the design of constructs. Consequently, when business-specific signals exist in the application - for instance, at the debug level of logs - verification could be focused s...
Let’s say I have a booking microservice (single instance) with its own DB. If I want to horizontally scale the service with multiple instances(exact same copy of the business logic code) running on multiple servers(with zookeeper keeping a track of service registry and centralized configuration) What efficient changes ...
I have a series of .NET kubernetes services that all need to retrieve dynamically a series of configurations from a database, since the deployment of this infrastructure is going to be on-prem for multiple clients each with a different configuration. This means that configuration-as-code and all the cloud-based solutio...
I inherited some code that I have spent some time reviewing to get a better handle on its design. There is one class that I came across that I have an idea for refactoring, but I am wondering if it I could get an opinion on whether or not it would make the design clearer. The class basically contains 4 properties: publ...
I'm a Software Engineer who sometimes need to review the code of my fellow team members. I often look at the source code and think; this looks fine. I'm having a hard time to think critical about it. I can be very critical when writing code myself since I'm active/highly involved with the code, but looking at it more p...
During my limited professional experience, I have been involved in microservices projects with a common structure: The Controller takes a request and validates it using the jakarta.validation.Valid annotation. After validation, it passes the request to the service. Inside the service layer, a Mapper component maps the...
I need to create a WPF application that gives me the possibility to connect to other computers in the same network. I'm looking into Windows Remote Desktop Services, but it seems like it doesn't have a screen sharing feature, necessary for me since I don't want the remote machine user to be logged out of their session....
I read a question about using a 32bit random number as a "unique" identifier. One of the answers asserted that a "rough guide" to estimating collision likelihood is that there's a 50% chance of a collision once about sqrt(n) numbers have been chosen. This would mean that for a 32bit number you'd have about a 50% chanc...
I have a process in golang that I want to kickoff through a RPC call but then have the function return early whilst the process continues in the background. Specifically it’s just a basic db transfer from one db instance to another. At the moment they way its working is I have my function kickoff a go routine and retu...
We have an API that allows clients to POST some request which takes some time to complete, so the API simply places it on a message queue and returns a 202 (Accepted) and a new GUID in the body. The client then can use this GUID to call a GET endpoint to check on the status of their POST request. Suppose they call the ...
I am currently writing an application that is going to be an adaptive quiz-like site for studying. The idea is a user is studying some topic and they are given questions on the site and enter their answers. As they enter in answers, the site's backend does some logic to compare the questions they missed with the rest o...
I maintain a large legacy app working with SQL database. The app uses raw SQL queries to query the database. Together with app rewrite I plan to introduce ORM to work with the database. The simplest solution would be to keep the database in current state and build ORM mappings based on the existing database. It seems t...
For context, I'm trying to make a span type that has a size type parameter, which mimics much of the std::span api. std::dynamic_extent is not zero in C++, instead being defined as -1ull or std::numeric_limits<std::size_t>::max(). when the Extent ntt parameter of a std::span is std::dynamic_extent, a size member variab...
In my understanding, the strengths of not using type are flexible and newbie-friendly, and the strengths of using type are easier to debug and reading code. However now you can use types on dynamically typed languages like Python or Javascript (technically on Typescript) which seems to me having the best of both worlds...
I'm trying to learn Observer Design Pattern and I started to watch the series which belongs to codewithmosh called "The Ultimate Design Pattern Series". in the lesson which was about Observer, he says: This is what we call a "Push" style of communication. because the "Subject" pushes the changes to the observers. How...
I have been working almost for a year in my current place. It is a product team over some domain. Here are some example reviews I am getting every now and then (Scala). Removing unneeded wrapping curly brackets from a function definition with single expression inside which does not even give a warning or anything. Sho...
If I have for example a User POJO like the following @AllArgsConstructor public class User { @Id private final String id; private String username; private String password; private Date createdDate; private Boolean enabled; //getters and setters } And I want to post a User and have an API like the following @Po...
We have a DB Service (Apache Druid) running along with prometheus,druid-exporter and Grafana deployments all being managed in the same namespace using k8s. We often see our prometheus or Grafana deplyments go down, and we need to set up alerting for the same. But when I look up k8s observability I see that it is again ...
My vanilla PHP backend app needs to be rewritten due to very poor design and lot of unstructured code. The legacy app is very large and the team small, so doing full rewrite in limited time is quite risky. I need to introduce PHP framework into the codebase and as a result the design of almost everything will change (r...
How important is the minor version of the Java Build SDK vs. the JDK version at runtime, is it a problem if the minor version is a bit outdated, if the run time version is still up to date? More details: We are using Java 17 to build an application, but it is an outdated Version of OpenJDK, i.e. 17 GA (build 17+35). Th...
I want to express a functional requirement along with some extra detail to constrain the functional requirement more but i can't seem to find out where to put the extra detail. E.g. if i have a functional requirement "The system shall calculate the total number of users" for a web-based shop and i want to express that ...
I have multiple maven projects ( rest services ) with common domain model. I would not say micro services. Structure is build this way to eventually move towards mircoservices. All the maven projects have dependency on domain model package. All custom validators are part of domain models package only. For validation o...
My question is focused on CMake C++ projects and separating out code into multiple repositories for re-usability, and somewhat mimicking a naive package management system. For now I would like to ignore any possible package managers like Conan or vcpkg. Suppose I have a C++ repository PackageA that uses CMake and suppl...
I recently changed my job to a big MNC and the code I am exposed to is highly complicated, difficult to read and understand. Although it is divided in microservices and runs on local I have to keep running it on local step by step and many times the methods are tediously long and not just abstract with bunch of hacks a...
We are migrating a template that was a mere questions array questions [ { type:text, name:first, value:What is our name },{ type:radio, name:favourite fruits, value:[ {banana}, {apple}, {pears} ] } ] to a library like SurveyJS (this Json is complex, can maintain page...
I recently fell in love with Factor , a programming language in the Forth family that enforces use of whitespace around identifiers, this allows creation of "functions" with extremely terse yet readable names, like [1..b] (it generates a range of integers from 1 to argument (inclusive), there is of course also [1..b)) ...
I'm facing the classic chicken/egg problem of where to store the keys to the kingdom. I'm building an application for retail distribution that will rely on receiving a cadence of regularly-issued Let's Encrypt certificates via a central website's REST API. The website will perform the regular task of renewing and stori...
I have certain dependencies in my project like sequelize-auto which are not required in production, since we only need to generate the models once during development. Even if we make changes to the database, we won't need to use sequelize-auto again in production. In my package.json file, I can make a distinction betwe...
After reading the whole question, you might think why I even need this, but believe me, it has a crucial usage in my project, which is very broad and complex, so I will only include the things directly related to the actual question. I am working with metaprograming, so to ease things enough, I declared a helper class ...
There are two ways to provide a way unsubscribe in Observer Design Pattern. 1. Provide a simple void UnSubscribe method: public void UnSubscribe(IObserver observer){ // remove observer from List of Observers in current observable class } 2. Return a UnSubscribe class upon subscription private class Unsubscrib...
I'm learning DDD and I have a question. Suppose there is a Graph entity with associated Node and Edge entities, corresponding to the vertices and edges of the graph. A node represents some business domain process, and an edge represents the interaction between processes. There are some business logic rules. For example...
I am working on digitizing old photographs, articles, ephemera, etc. related to my town's history, and I've been tasked to put these scans I've made onto a website for the public to see. There are several hundred scans that need to be made and was wondering if this is the right approach when working with the metadata f...
I have an idea for a mobile app, but As I'm not from a Software background, I need to know how much the backend operations will cost before I commit time and resources to develop this idea. In this manner, I will be able to determine the likelihood of success for this project. I'm hoping this group's experts can assist...
When my website sends emails to set or reset the password, they sometimes don't arrive at the recipient. This problem does not arise for email addresses at large providers (as Google or Microsoft), but often email servers of schools or state institutions. I guess that this is due to some bad spam filtering, where the e...
In a scenario with multiple teams, each overseeing a few microservices that collectively create a larger system, and where these services frequently use MongoDB databases, is it advisable for each service to set up and manage its own MongoDB database server? This approach seems rather complex. Alternatively, what if th...
Abstract (virtual) interfaces allow you to explicitly declare a set of methods which a child class must implement in order to compile and be used with other parts of the code. This works great for most problems, except with one drawback, you must pass/store pointers/references to the interface class rather than the cl...
TL;DR: Given a repo with a lot of big fixture tests, when should I look for a solution where the golden files are not part of the repo anymore? Where should they be stored? The setup Testing a complex data processing project with very diverse input sources Around 10^2 CSV files as fixture tests, each a few MB in size ...
I have two microservices, say "students" and "courses", they represent separate entities that are managed separately by different teams. A given student can be enrolled in multiple courses. In a monolythic app, I'd just use a students-to-courses table to do the mapping and would be done with it. What's the recommended ...
TLDR; what if you are tasked with taking out a feature and making it app 2 to reduce memory/compute foot print from app 1? Making an API contract between app 1 & 2 would defeat the purpose because APIs run on app 1. How then could we split a feature from a monolith that relies on the same data of app 1? I need to rev...
We have multiple developers contributing to a project, using Git as our repository. We have a QA branch that matches our QA environment and a master branch that matches production. Features can be in QA for weeks, because other more urgent requests come up, or there are issues with a particular feature that take the de...
I've tried web search and wiki and could not find mentioning history records. I don't buy an argument stated in Is there any practical trick to remember the difference between big-endian and little-endian? that there are two ends of a sequence. Try to ask somebody to open a book at the end and see how often the person ...
So I have two identical classes, say ClassA and ClassB. In both classes, they operate on the same kind of data classes, and the method bodies are exactly the same. The only difference is that the imported classes, which identically named in both ClassA and `ClassB, come from different packages/projects. That is, //Clas...