instruction stringlengths 34 36.1k |
|---|
I'm trying to make a simple network application using boost::asio.
I think that I understood the basic things like io_context, async functions etc, but I really don't know how to deal with buffers.
To be clear - I know how to use boost::buffers, but I don't know how to deal with it in architectural aspect.
Let's con... |
I was wondering what are the pro and cons between having one function with a if statement dictating 2 sections of code or two discreet functions that are called on separately.
In terms of pro and cons I was thinking.
Computational Complexity
Readability
Maintenance
And any other component I did not consider.
Here is... |
I have a case where I have a dictionary object and a value with no key.
The object can have the system values and then a user value. I have to store that value.
I could use a reserved word or I could use null.
userValue = "enabled";
data = {version: 10, date: 10101010};
data.name = "Charleen";
// reserved word
data... |
I am trying to improve an event-driven processing system, which is having a few problems because the events are not guaranteed to arrive in the correct chronological sequence. This is due to batching and caching upstream which is currently out of my control.
The sequence errors are not a complete disaster for my proces... |
I'm doing a conceptual class diagram for an app that lets:
Clinicians view the patient's lab results and their calculated Reynolds Risk Score.
Clinicians make changes to one or more of the patient’s lab results to see how the patient’s current Reynolds Risk Score could be improved.
My question is: Should Reynold's... |
I am trying to confirm best practice around architecture I am working with.
Frontend <-> API gateway <-> Service layer (Rest API) <-> DB
I have an incoming request which is asking for huge data set (>20000 rows) from multiple DB tables clubbed into one single data set. Now there are two school of thoughts and I want to... |
I'm having quite a difficulty with what i think would suit a Patient class and a Record class in UML
Basically the Record class stores the patient's information such as name, vitals, gender, age and etc.
However, when linking these two classes together, I'm very much confused as to which relationship would be suitable... |
I have 3 different libraries that provide depth data as well as gesture information. I need to wrap these libraries into a single simpler to use for user api. The apis I am trying to wrap provide a set of utilities as well as information that are not equal. The core data such as depth images or color images are provide... |
So I have built a domain model and some logic into that. I have created two repositories for two aggregate roots.
My question is how to access to the reference data from these layers?. For example, say we have the following types Elder and Young.
Our application entry points expect Elder or Young as inputs. But, to val... |
My web API talks to an outside service running elsewhere, based on the web API requests (mostly POST). There is a message queue (RabbitMQ) that sits in between them, for request/response from either side.
My web API is called by client applications that does not have a retry mechanism. Once the outside service respond... |
I'm designing an API for our web application, that will be consumed by mobile developers that will create our mobile app.
I chose to document it using Swagger / OpenAPI 3.0.0.
I'm surprised that when I create a new OpenAPI document on Swagger, I get a default version field set to 1.0.0.
The specification also uses 1.0.... |
Not sure how to handle this. Our current app (.Net MVC) is accessed via companyname.appname.com, authentication is handled via forms (cookie) authentication.
Within the app there is a global search box that is quite heavily used, we are looking to split this out into it's own microservice so all calls for search will g... |
The problem is -
We have a series of boxes (A, B, C, D, ...).
Each box contains bricks of different colours. For eg.
Box A - red, blue
Box B - blue, red, green
... and so on...
and there are multiple versions of each of the boxes -
Box A1 - red, blue
Box A2 - green, red, yellow
...
Box B1 - blue, red, green
Box B... |
I am thinking through some techniques where by I have an application with a timeline. The timeline plays in real time and at points on that timeline I would like to trigger some actions. There are no interpolation curves between points. This would be used on iOS though I'm sure other platforms offer similar-ish things,... |
I would like to allow a set of users to be able to submit a form on one page, and then it would cause an event to trigger on another page.
For example:
Submit Page:
Includes the form, the user submits the form
Alerts Page:
Displays information from the form on every instance of the page that is open across the world.
S... |
In my environment, we have multiple systems developed independently by different teams. Those teams frequently recreate the wheel because they're building applications, not building blocks.
As a trivial example, in one system, there may be a customer_no field, which may be an integer, but in a different system, that f... |
We are working on new enterprise project (multiple activities - online ordering, offline ordering, b2b ordering, accounting processing, secure payment processing, analysis and dynamic pricing and so on) without legacy burden and we are considering 2 scenarios.
Single database (with secure vault possibly)
Multiple da... |
I am new to WPF but actually I need to code in it.
I have got a **UserControl(Window)** and there is a DataGrid in it.
DataGrid can be used somewhere else in the future, but not 100% sure.
Me and one of my collegue need to work in the same module, the best would be if my collegue would work in the Window and I would w... |
Given this scenario: "Clinicians can record their own notes for each patient, viewable only by them." I would model it like this:
Clinician ----> Patient
and "Notes" as an association class between clinician and patient. However, does this mean that the "Notes" class is viewable by both clinicians and patients? If so... |
My team has inherited a Web Forms application that was built over the past decade or so into a monolithic code base with massive dependencies. In order to maintain this system we are going to have to spend time to break dependencies and implement proper TDD.
When I look online for guidance it seems that there are two o... |
So I am developing an employee management application on behalf of a company and am concerned about the extent of rights and capabilities that are to be bestowed upon registered administrator accounts.
Here's the question under a philosophical light:
"What is to be done when the one with power is corrupt?"
Here's the ... |
Background
While writing a new component, I m in middle of making a decision of SQL/NOSQL database (Mongo vs Mysql) for my storage layer. As of today, mysql seems to be a perfect fit for my use-case (6-7 domain entities, closely related to each other). Still, I want to keep my integrations with the data layer abstract ... |
I'm doing a Magic Square problem, and I'm using backtracking tecnique for do it.
So, the magic square asks you for an input which is the size of the square,
and you generate this square, and you need to fill the cells with integer numbers, and the sum of the rows and the columns must be exactly this:
That is the magic... |
I recently came by a seemingly trivial architectural problem. I had a simple repository in my code that was called like this (code is in C#):
var user = /* create user somehow */;
_userRepository.Add(user);
/* do some other stuff*/
_userRepository.SaveChanges();
SaveChanges was a simple wrapper that commits changes t... |
I have implemented a graph structure (for graphs having ~30,000 nodes and ~300,000 edges) as follows:
class graph;
class node;
class edge;
class graph
{
public:
graph(){};
vector<node*> nodeS;
vector<edge*> edgeS;
};
class node
{
public:
node(){};
vector<edge*> my_edgeS;
double weight;
};
class edg... |
For clarification, let's review the following example:
Consider that we have the following array of Ints:
let array = [1, 2, 3, 4, 5]
and we've been asked to generate a new array from array corresponding to the following two conditions:
The element in array should be > 3.
The new generated element should be a string ... |
I have an API in which we expect a emailID and a certain deal data.
The case is we want to keep the dealId and contactId(email) to be unique.
Creating a deal requires data insertion in multiple tables.
data is first inserted in tb_contact_email.
Then , it is inserted in tb_deals , tb_contacts and tb_contact_details
... |
We have a high read, low write website which currently has monolithic architecture on back end.
We have recently started breaking it into micro-services.
We have designed some micro-services - Product, Price, Offers, Content(images, videos, etc...).
There is another micro-service - "Recommend". This service runs a logi... |
Above Image shows the system design of my application. Things work fine when there is a single instance of my microservice but now I am planning to scale it and have the following concern about it :
How to handle concurrent update request on the same record initiated by two different instances of a microservice.
I kno... |
Say I have a function:
def foo(x):
if x % 2:
do_something_with(x)
return x
And I want to make the doing of something opt-outable:
def foo(x, maybe_do_something_with_x=True):
if maybe_do_something_with_x:
if x % 2:
do_something_with(x)
return x
That variable name is awful,... |
I work for something like a consulting company. I have a web application that I built for one client. Now around 30 other clients want about the same product. The problem is, I don't know where to put the data. Most of the data is transactional, and all clients can fit into the current schema. The problem is, most of o... |
I am developing a desktop application (C++/Qt), which might be roughly represented as consisting of two parts - data-handling part and the GUI.
I want the data-handling part to be extensible with 3rd-party plugins. After thinking over possible strategies (and googling :) ), I've come to the conclusion that probably th... |
So, first of all hello to everyone, I hope you are having a good day :)
I will give you a little context. I coded a program for my job, in which I save to a database Errors ID and their solutions. It could be one or more solutions.
Right now the database is a text file which contains a dictionary, with keys being the E... |
Today I was surprised to hear that our Scrum Master and Product Owner decided that they wanted us to consider a change to how Sprint Planning was done. The change essentially is that all of the Stories would be broken down into tasks, assigned estimates, but not assigned to a specific resource.
To me, this basically b... |
I am designing a system where a user can input a budget and a query returns to them sets of objects that they can afford from different vendors. The system has 100s of different combination types (i.e [Knife, Spoon, Fork], [Spoon, Glass, Mug]) so that the query is directed (using nosql database).
The query will look a... |
I had been using react-js and really like its concept so I want to know if there is a programming language/framework that sort of works like it. For instance, I want to define:
var A = something
var B = somefun(var A)
They could live in different objects, modules, files, etc. The important part is that I want to link ... |
I am working through a MySQL design issue. I have a server with a database of phone numbers used in nuisance calls, like robocallers. I also have remote clients that are provisioned. I want the remote clients to submit their data to the server.
A client can use mysql_connect to connect to the server's database but it s... |
We're currently designing an web application that will basically expose "messages" to end users, each message consisting of a subject and body, but more important 1 to many files we call "attachments". This could really be from 1 to possibly 10.000 attachments per message, with attachments being mostly "documents": pdf... |
In my office, there are 200 employees who come to the office in their car. But my parking space has slots for parking 160 cars only. Now I want to design and develop an application that issues parking tickets to employees by doing a fair allocation of parking slots.
For solving this problem, I was thinking of designing... |
I need to redesign a 10 year old Product Management Portal and underlying Data-model. There are build of materials as products in the system.
Product managers update pricing frequently for products. The current system uses Textual Boolean expression typed-in a Text-area, using combination of attributes of materials. It... |
I was in a job interview with a vp r&d today.
One of his questions went something like:
"How do you make sure your code works?"
This question struck me as a bit strange, so I explained how I debug (divide and conquer, debugger, prints, unit testing).
He then continued:
"What if the problem only comes once a day?"
I sai... |
I am new to C and wondering how to properly build primitive functions in order to handle errors. Take for example the following function:
bool
testIfEqual(int a, int b) {
return a == b;
}
Wondering if there are certain classes of errors that the compiler wont detect that this function should account for if it were t... |
The problem
A famous quote says: "There are only two hard things in Computer Science: cache invalidation and naming things"
We all know how important ubiquitous language / good names in DDD are.
I often find myself stuck thinking extremely hard about a good name for a new domain term. With experience I acquired instin... |
We currently have four environments in AWS, development, test, beta and production. Previously, we released from develop to beta at the end of each sprint (2 weeks). We would create feature branches off of develop.
We would then deploy to beta and production every month by merging across environments. Such as merging ... |
I'm trying to decide the best course of action based on two design principles that seem to be conflicting with each other: "a function should only do one thing" (SRP) and "don't repeat yourself" (DRY).
I need to perform two actions:
Get document properties (returns json data)
Download document (returns raw file data)
... |
I am working on a Rails + React application and investigating frontend testing. Unlike the backend tests this doesn't seem to be a straightforward process with one obvious path. There are a list of possible ways to go about this and they all seem to test in very different ways.
The methods I have found are:
Importing ... |
According to the answer in this post Should my classes have separate constructors just for unit testing?
ad hoc constructor is not good and should be avoided.
Unfortunately, I have the same problem in my code.
readonly AppletFirmware _appletFirmware;
readonly byte[] _motorControllerFirmware;
rea... |
Since we are just describing the problem domain rather than showing how the actual software will be designed, does that mean that we should not need abstract classes to show inheritance and arrowed lines to symbolise relationships, such as dependencies?
|
I'm having problem deciding which of these 2 structures to use from my DTOs:
Option 1 is:
@Data
class Lines{
private final Line[] lines;
}
@Data
class Line{
private final String[] specifiers;
private final Set<String> container;
}
Which can be used as this:
//Single
Lines lc1 = new Lines(new Line[]{
new Lin... |
I have a predictive model which runs 10,000+ scenarios to predict the outcome. It's a micro-simulator model for an insurance company. The data part is almost static with changes from time-to-time, meaning data is kind of read-only and data update happens outside of this simulator.
Each simulation run accepts several in... |
I am writing a client to talk to a server API in JavaScript. I have an OOP background but am trying to embrace modern EcmaScript.
So I started with this:
customerApi.js:
const baseUrl = "http://myapi";
export const getCustomers = () => { /* get customer code */ }
export const addCustomer = cust => { /* add customer cod... |
I'm generating plaintext emails with heavily personalized content: depending on various factors, sections or sentences need to be inserted, left out or phrased differently and placeholders need to be filled.
Currently I'm using Twig as a template engine, however the templates become very convoluted, because of the many... |
I need to implement the following flow:
Back-end makes HTTP request to Service A, waits for a response from Service A,
then makes HTTP request to Service B, waits for a response,
then makes concurrent HTTP requests to Service C, waits for responses.
if the response from Service A does not contain specific info required... |
I'm currently working on a bigger project which unfortunately has some files where software quality guidelines where not always followed. This includes big files (read 2000-4000 lines) which clearly contain multiple distinct functionalities.
Now I want to refactor these big files into multiple small ones. The issue is,... |
In the comments of a recent answer, I equated a static library with an archive of compiled object files.
The response was that they are not the same, so what is the difference?
To clarify - gcc accepts an archive of object files as a library, as per Ar_(Unix) #Example_usage. How does this differ from other forms of st... |
I've seen some tutorials and examples of implementing a repository pattern, and I don't quite understand something. My impression was that the whole point of a repository pattern was to hide the underlying data storage implementation from the calling code. Am I wrong in this assumption, in which case, what is the poi... |
I am working on a video game in Unity and at some point I'm facing a tough problem to solve:
The game freezes while loading level data.
Let me lay down what's happening in that process that takes a few seconds:
load track mesh data consisting of sections, faces, vertices
load track textures, build an atlas out of the... |
I often see classes of this form:
class Thingy {
public Thingy( /* some arguments here */ ) {
// Initialize some member variables.
// Maybe do some other things that
// are not likely to fail
}
public Execute() {
// Do the important stuff.
// This often involves acti... |
Process VMs (such as the Oracle JVM, CPython, .NET CLR etc.) are usually stack-based or register-based.
Are the "registers" in a register-based VM actually the registers of the underlying physical CPU? Or are they simply allocated memory bytes in RAM? How is this usually implemented?
And what about a stack-based VM: Is... |
At first this question seems elementary -- Is "real" data on a graph (xy coordinates) a model? However here is my logic. We know a model is an abstract representation of the real-world. A graph is a model. A mathematical formula is a model. Most of the time the data output from these graphs, as we synonymously cal... |
I'm making an HTTP API client class.
I want a Perform() method which takes a request object and returns an obejct that is expected from the API.
So a PostRequest object will describe how to get a Post.
Ultimately what I'm trying to do is the following:
Post post = client.Perform<PostRequest>(x => x.Id = 1);
I'm trying... |
How should versions be bumped during development between two major versions?
For example let say I have version 1.5.0 and my target is to release new major version that will be incompatible with major version 1.
As soon as I start developing and making changes, those changes will be backwards incompatible, so by follow... |
In our team we don't have dedicated Scrum Master, so one of the developer is playing the role of SM. I know this is wrong but it can't be changed.
In our system, we assign story points to all the stories at the time of grooming. Production issues don't have story points but we ASSUME it's 3 story point. For us 1 story... |
I'm in the school of thought of 'thin controllers', and love to push logic down into services and the domain models. However, I'm wondering if my controller should be making an HTTP Request to another web service or if the application service should do it. It seems that with my school of thinking then "yes" I should pu... |
I have not found many resources about this: I was wondering if it's possible/a good idea to be able to write asynchronous code in a synchronous way.
For example, here is some JavaScript code which retrieves the number of users stored in a database (an asynchronous operation):
getNbOfUsers(function (nbOfUsers) { console... |
I am manually creating a rather large data model as input to my unit tests. Data model is created using a number of builders. Developers use these builders in order to create the data model as they see fit for a particular unit test.
An example might be in order: when reporting work time, it is possible to report takin... |
I'm creating an application in which people meet certain criteria to receive a payout at certain milestones. In order to earn these milestones, users will record activity in a log, and when they have recorded a certain number of activities, an administrator user is notified to confirm and authorize their payout.
Curre... |
Exactly as the name says, should smart pointers be exposed in a C++ library API?
I've used quite a few C++ libraries and haven't ran into exposed smart pointers yet. Given that it's very common to hear "only use smart pointers", should developers expose smart pointers in their APIs?
|
I know that when the CPU is in user mode, it can't access all memory, it also can't execute some CPU instructions (called "privileged instructions" I believe).
But are these two restrictions the only things that the CPU cannot do when it is in user mode? For example, what about accessing the CPU registers, can the CPU ... |
Scenario
We are building a UI that allows users to query our data in bulk. The return format is CSV and there is a decent amount of processing that needs to happen, so this processing processing is done in parallel and then sets of rows are streamed back to the UI.
Current Implementation
An AJAX POST request is sent to... |
How can i realize password authenticated key retrieval? I found some description of PAKR:
A PAKR (Password-Authenticated Key Retrieval) protocol and its multi-server system allow one party (say, client), who has a memorable password, to retrieve a long-term static key in an exchange of messages with at least one other ... |
consider the following REST resource Account
{
number:"number-000",
name: "name",
customer : {},
type : {},
status : "status",
balance : 0,
rating : 0.0
}
Now say we have the following CRUD operations:
http://bank.com/Accounts/3456 -> HttpGet 3456 account details
http://bank.com/Accounts/3456 ... |
I'm trying to develop a game server in Netty using an event-based approach where incoming events are dispatched to the correct game rooms, but I'm having some trouble with managing my world state. My game is a small action top down fighter with 20 people in a single roon.
[0, 7, 8, 4, 72, 101, 108, 108, 111]
The first... |
Custom code written for the Salesforce platform is incapable of making a PATCH request to an external server (PUT and POST are okay though), and I need to make a PATCH request to an external service (Microsoft Graph).
While authentication can be handled with a POST request directly from SF to MSG, obtaining the access ... |
I have a small Desktop application (Windows+Mac) that uses third-party API calls (RESTful) to collect some data and present results to users.
At this moment, the API calls (open and free APIs) are made directly from the client (approach #1). However, I am wondering if this is a bad practice.
As an alternative, I woul... |
For a report with 25 fields, there are a lot of decisions to be made for every column. Tracking them in a wiki, like what's below, drew complaints that the final field values couldn't be scanned rapidly and it was hard to tell what were open questions (despite using red text for the word "Question").
Column A
Que... |
I am playing with sequence diagram. And main question is how to draw properly on sequence diagram interaction with variable. How to draw
1) When MakePayment aggregates person
insurance.MakePayment(person.FirstName, person.SecondName, 20);
2) Variable assignment
internalVariable = SecondName;
I am not sure that I ... |
Let's say (just for the sake of example) I have three classes that implement IShape. One is a Square with a constructor of Square(int length). Second is a Triangle with a constructor of Triangle(int base, int height). Third is a Circle with a constructor of Circle(double radius).
Considering all the classes share the s... |
I created one webapi application which includes few modules like account, user etc and overall includes 10 or more endpoints.
I deployed this in EC2 instances and configured in application load balancer with domain in cloud front. The authentication used is oauth2 (bearer token)
All working fine and can access using do... |
I somehow get the point of REST API, like for example you want to get the list of customers to the database server, you have to request a GET method and the server will throw a response with a standard format like JSON, XML, etc.. If you want to create data, you have to request a POST method and the server will throw a... |
For example in addition "Open" action, "Compile & Install" be another available action when user click on package
|
So i want to make a crawler in python but not the usual UA/middlewares way.
My idea was a modulable architecture, which pass the callable class as arguments in a cli. This is kind of odd, i don't know if there any other way/framework which implement that.
Architecture detail:
I have a class Command which is pass with f... |
It strikes me why most of the sites don't talk about this topic. Recently, I've been doing some extensive research when it comes to NoSQL schema design, and evaluating the different NoSQL options (Focusing on MongoDB, and DynamoDB), and found out, through this video:
https://www.youtube.com/watch?v=HaEPXoXVf2k
That whe... |
Given a Person model:
Person {
int PersonId;
string Name;
string Email;
}
and an UpdatePersonDto which just updates the Name
UpdatePersonDto {
int PersonId;
string Name;
}
How should the repository handle the update process?
Accept the UpdatePersonDto object, fetch the current Person object from ... |
What are the best practices to extend Authorization to the Model layer if in a monolith MVC application (i.e rails) you have other entry-points than just the Controller? I.e background jobs, or the model interaction?
Regarding security
Normally we enqueue jobs in a queue, to off-load the main thread, then we have a tas... |
I'm reading about Observer Pattern of GoF, the UML in the book:
From the above diagram, how many Observer interface are there in a system if I have two different ConcreteSubject classes? Would they share the same Observer interface? Or is that each (Concrete)Subject classes should have its corresponding Observer inter... |
For my company i am refactoring our embedded C/C++ code base to increase re-usability for commonly used functionality. Currently i am refactoring our command line interface but i ran into a design issue.
Our core command line interface is good and stable as is but in some project there is a need or wish to add addition... |
I'd like to develop a microservice architecture application that sends text messages from one communication provider to another and I'm just considering changing architecture would be best suited to cope with large workload fluctuations.
A text message is commissioned via a REST api and then sent to Whatsapp, Telegram ... |
This is to ask whether accdb databases are suitable for this application, and how to connect the user with the database (and the phone network with the database if anyone has a comment on this).
I use an old pc program that downloads data from a local sensor, writes it to a small Access database (mdb), and gives the us... |
We don't have any frameworj like Spring where we can inject dependencies using annotations or xml file.
We have handler classes, service classes and dao classes.
Handler classes access service which perform business logic to get the data to be persisted into the db using dao layer.
Now I have seen that in our project w... |
I must design a database that store items that can be associated to a production. Production is only a identifier with no common attributes. But, a production may or may not have attributes (which are heterogeneous according to the production).
If I use a 3 tables design, I can put a foreign key on the prod_id of the I... |
I started a new job with a greenfield site in Angular to create a website from an old desktop app. I gave a presentation guided by my Supervisor who wants game style top icon menus to cut down on space usage, however it has now come to light that my supervisor wants the sites page's, width's and height's to be equal t... |
I have a CategoryClass (Aggregate root) -> SubCategoryClass -> and now a relational entity (n-n).
Category (root) 1->N SubCategory 1->N SubCategorySlotType (n-n)
SlotType (root)
My SubCategory only exists in the context of the Category and the SubCategorySlotType only exists in the context of the SubCategory. Is this t... |
I have code that follows this pattern.
Class Factory
build:
returns: Add|Remove|Stub
takes: property1, property2, property3
Class Add
execute: does something
takes: property2, propery3
Class Remove
execute: does something
takes: property2
Class Null
execute: does nothing... |
I am trying to come up with a solution to replace joda-time with java 8 time in our product. The code-base encompasses many projects of which some import joda-time directly and some transitively. To limit regression and to allocate multiple developers for the task an iterative approach of library swapping is required. ... |
My company currently has SVN as main version control and we are in process of migrating to Git. Doing that is a perfect chance to do a structure reorganization.
Before I get to that let me describe current situation and our use cases. We have one main product and 20-ish clients which have customizations in place. What ... |
Hi I am in middle of designing DB and Got a little bit confused about DB Design.
I am Using Hibernate as ORM Tool ahd mapping between Page and Step entity in hibernate.
@ManyToMany(fetch = FetchType.LAZY,cascade=CascadeType.REFRESH)
@JoinTable(name = "page_childstep",
joinColumns = @JoinColumn(name = "page_id"),
inve... |
I have started work on writing a tool to version the database schemas we use at work and enable migrations under version control. My first research into existing tools turned out to be too cursory due to searching for the wrong key words and I'm now aware of Flyway and Liquibase. Now I'm wondering if it wouldn't be bet... |
I first posted this question on stackoverflow but I think, it as more it's place here.
In order to limit the size of my REST API answers, I want to implement the Google performance tip: using the fields query string parameter to do partial resources.
If I have a full answer GET https://myapi.com/v1/users
[
{
"id": ... |
As some js files are very common and widely used on the web, why browsers don't reutilise them?
wouldn't it improve efficiency, as js framework files are usually heavy?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.